/* ===== CSS VARIABLES ===== */
:root {
  --bg: #f9f9f7;
  --bg-secondary: #f0efeb;
  --text: #1a1a1a;
  --text-muted: #888;
  --text-subtle: #b0b0b0;
  --accent: #2a2a2a;
  --accent-hover: #555;
  --link: #333;
  --link-hover: #000;
  --border: #ddd;
  --border-light: #e8e8e4;
  --nav-link: #444;
  --nav-active: #111;
  --header-bg: #f9f9f7;
  --gif-border: #ddd;
  --toggle-bg: #eee;
  --toggle-hover: #ddd;
  --shadow: rgba(0,0,0,0.06);
}

[data-theme="dark"] {
  --bg: #0d0d0d;
  --bg-secondary: #161616;
  --text: #d4d4d4;
  --text-muted: #666;
  --text-subtle: #444;
  --accent: #d4d4d4;
  --accent-hover: #aaa;
  --link: #aaa;
  --link-hover: #eee;
  --border: #2a2a2a;
  --border-light: #222;
  --nav-link: #888;
  --nav-active: #eee;
  --header-bg: #0d0d0d;
  --gif-border: #2a2a2a;
  --toggle-bg: #1e1e1e;
  --toggle-hover: #2a2a2a;
  --shadow: rgba(0,0,0,0.3);
}

/* ===== RESET ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  line-height: 1.75;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 1000;
  background: var(--toggle-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  font-size: 15px;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--toggle-hover);
  transform: scale(1.08);
}

.toggle-icon {
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* ===== SIDE TEXT ===== */
.side-text {
  position: fixed;
  right: -62px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  font-size: 10px;
  color: var(--text-subtle);
  letter-spacing: 0.12em;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  transition: color 0.25s ease;
}

/* ===== HEADER ===== */
.header {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  background: var(--header-bg);
  transition: background 0.25s ease;
}

.header-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.avatar-wrap {
  flex-shrink: 0;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
  transition: border-color 0.25s ease;
}

.header-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  transition: color 0.25s ease;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.header-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.header-links a:hover {
  color: var(--text);
}

.dot {
  color: var(--text-subtle);
}

/* ===== NAV ===== */
.nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-top: 4px;
  margin-right: 50px;
}

.nav-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--nav-link);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
  cursor: pointer;
  line-height: 1.6;
}

.nav-link:hover {
  color: var(--nav-active);
}

.nav-link.active {
  color: var(--nav-active);
  font-weight: 500;
}

/* ===== DIVIDER ===== */
.divider {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
  height: 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.25s ease;
}

/* ===== MAIN ===== */
.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ===== PAGES ===== */
.page {
  display: none;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== ABOUT PAGE ===== */
.about-text p {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.85;
  margin-bottom: 20px;
  transition: color 0.25s ease;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text strong {
  color: var(--text);
  font-weight: 500;
}

/* ===== FILTER TABS ===== */
.filter-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.filter-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 6px 14px 8px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  margin-bottom: -1px;
  letter-spacing: 0.02em;
}

.filter-tab:hover {
  color: var(--text);
}

.filter-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 500;
}

/* ===== PROJECT BADGES ===== */
.project-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  font-weight: 400;
  flex-shrink: 0;
  border: 1px solid;
}

.badge-software {
  color: #2d7a4f;
  border-color: #2d7a4f40;
  background: #2d7a4f0d;
}

.badge-iot {
  color: #7a4f2d;
  border-color: #7a4f2d40;
  background: #7a4f2d0d;
}

.badge-pub {
  color: #2d4f7a;
  border-color: #2d4f7a40;
  background: #2d4f7a0d;
}

[data-theme="dark"] .badge-software {
  color: #6fcf97;
  border-color: #6fcf9730;
  background: #6fcf970d;
}

[data-theme="dark"] .badge-iot {
  color: #e0a96d;
  border-color: #e0a96d30;
  background: #e0a96d0d;
}

[data-theme="dark"] .badge-pub {
  color: #6d9de0;
  border-color: #6d9de030;
  background: #6d9de00d;
}

/* ===== PROJECTS PAGE ===== */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-light);
  transition: border-color 0.25s ease;
}

.project-item:first-child {
  padding-top: 0;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item.hidden {
  display: none;
}

/* Publication GIF tint */
.project-gif-pub img {
  filter: grayscale(20%);
}

.project-info {
  flex: 1;
  min-width: 0;
}

.project-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.project-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.project-title:hover {
  color: var(--text-muted);
}

.github-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.github-icon:hover {
  color: var(--text);
}

.project-date {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-left: auto;
}

.project-tech {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  font-style: italic;
}

.project-desc {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.8;
  transition: color 0.25s ease;
}

.project-desc strong {
  color: var(--text);
  font-weight: 500;
}

.project-desc em {
  font-style: italic;
}

.pub-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.pub-link:hover {
  color: var(--text);
}

.project-gif {
  flex-shrink: 0;
  width: 130px;
}

.project-gif img {
  width: 130px;
  height: 86px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--gif-border);
  display: block;
  transition: border-color 0.25s ease;
}

/* ===== ACHIEVEMENTS PAGE ===== */
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.achievement-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-light);
  transition: border-color 0.25s ease;
}

.achievement-item:first-child {
  padding-top: 0;
}

.achievement-item:last-child {
  border-bottom: none;
}

.achievement-title {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 3px;
  transition: color 0.15s ease;
  cursor: pointer;
}

a.achievement-title:hover {
  color: var(--text-muted);
}

.achievement-title.muted {
  color: var(--text-muted);
  font-weight: 400;
}

.achievement-date {
  display: block;
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-bottom: 8px;
}

.achievement-date.muted {
  color: var(--text-subtle);
}

.achievement-desc {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.8;
  transition: color 0.25s ease;
}

/* ===== PHOTOGRAPHY PAGE ===== */
.photo-intro {
  margin-bottom: 28px;
}

.photo-intro p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px;
  justify-items: center;
  align-items: start;
}

.photo-item {
  width: 100%;
  display: flex;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-item:hover {
  transform: translateY(-4px);
}

.photo-loading {
  grid-column: 1 / -1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 48px 0;
  text-align: center;
  font-style: italic;
}

/* ===== BLOG PAGE ===== */
.blog-intro {
  margin-bottom: 24px;
}

.blog-intro p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-light);
  transition: border-color 0.25s ease;
  cursor: pointer;
}

.blog-item:first-child {
  padding-top: 0;
}

.blog-item:last-child {
  border-bottom: none;
}

.blog-item-info {
  flex: 1;
  min-width: 0;
}

.blog-item-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.blog-item-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  transition: color 0.15s ease;
}

.blog-item:hover .blog-item-title {
  color: var(--text-muted);
}

.blog-item-date {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-left: auto;
}

.blog-item-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.blog-tag {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  font-weight: 400;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-secondary);
}

.blog-item-excerpt {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.8;
}

.blog-item-thumb {
  flex-shrink: 0;
  width: 130px;
}

.blog-item-thumb img {
  width: 130px;
  height: 86px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--gif-border);
  display: block;
  transition: border-color 0.25s ease;
}

/* Detail View */
.blog-back-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 24px;
  transition: color 0.15s ease;
}

.blog-back-btn:hover {
  color: var(--text);
}

.blog-detail-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 16px;
}

.blog-detail-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 12px;
}

.blog-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.blog-detail-body {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.85;
}

.blog-detail-body p {
  margin-bottom: 20px;
}

.blog-detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.blog-detail-gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

.blog-detail-video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  margin: 28px 0;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

.blog-detail-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.blog-detail-references {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.blog-detail-references h4 {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.blog-detail-references ul {
  list-style: none;
  padding-left: 0;
}

.blog-detail-references li {
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.blog-detail-references a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
  border-bottom: 1px dashed var(--text-subtle);
}

.blog-detail-references a:hover {
  color: var(--text);
  border-bottom-style: solid;
}

/* ===== RESPONSIVE ===== */
/* Restructured media queries grouped at the bottom of style.css to maintain a perfect CSS cascade. */

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.9);
  backdrop-filter: blur(5px);
}

.lightbox-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 85vh;
  object-fit: contain;
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from {transform:scale(0.95); opacity:0;}
  to {transform:scale(1); opacity:1;}
}

.lightbox-close {
  position: absolute;
  top: 25px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Make markdown images inside blog detail fit gracefully */
.blog-detail-body-text img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 24px auto;
  border-radius: 4px;
  cursor: zoom-in;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 12px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-detail-body-text img:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow);
}

/* Left blank to consolidate this tablet breakpoint at the bottom. */

/* ===== MODERN BLOG PARSING STYLES ===== */
.blog-detail-body-text {
  transition: opacity 0.15s ease-in-out;
  opacity: 1;
}

.blog-detail-body-text.fade-out {
  opacity: 0;
}

/* Inline Code */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  color: var(--text);
  word-break: break-word;
}

/* Code Blocks */
.code-block-container {
  margin: 24px 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #161616;
  box-shadow: 0 4px 12px var(--shadow);
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #1e1e1e;
  border-bottom: 1px solid #282828;
}

.code-block-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-code-btn {
  background: #2a2a2a;
  border: 1px solid #3d3d3d;
  color: #cccccc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.copy-code-btn:hover {
  background: #3a3a3a;
  color: #ffffff;
}

.copy-code-btn.copied {
  background: #2d7a4f;
  border-color: #2d7a4f40;
  color: #ffffff;
}

.code-block-container pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
}

.code-block-container code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #e0e0e0;
  line-height: 1.6;
  background: none;
  padding: 0;
  border-radius: 0;
  border: none;
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 28px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
}

.table-container th, .table-container td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

.table-container th {
  background: var(--bg-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

.table-container tr:last-child td {
  border-bottom: none;
}

.table-container tr:nth-child(even) td {
  background: var(--bg-secondary);
  opacity: 0.95;
}

.table-container tr:hover td {
  background: var(--toggle-hover);
}

/* Headers inside blog body */
.blog-detail-body h2,
.blog-detail-body h3,
.blog-detail-body h4 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--text);
  margin-top: 32px;
  margin-bottom: 16px;
}

.blog-detail-body h2 {
  font-size: 1.15rem;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}

.blog-detail-body h3 {
  font-size: 1.0rem;
}

.blog-detail-body h4 {
  font-size: 0.9rem;
}

/* Lists inside blog body */
.blog-detail-body ul,
.blog-detail-body ol {
  margin: 16px 0 20px 24px;
}

.blog-detail-body li {
  margin-bottom: 8px;
  font-size: 0.88rem;
  line-height: 1.8;
}

/* Capsule Version Toggle Switch */
.version-toggle-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding: 10px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  animation: fadeIn 0.2s ease;
}

.toggle-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.version-toggle-capsule {
  position: relative;
  display: flex;
  background: var(--bg);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid var(--border);
  width: 260px;
  height: 32px;
  overflow: hidden;
}

.toggle-slider {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 50%;
  background: var(--accent);
  border-radius: 18px;
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.toggle-btn {
  flex: 1;
  position: relative;
  z-index: 2;
  background: none;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.25s ease;
  text-align: center;
  line-height: 26px;
  padding: 0;
}

.toggle-btn.active {
  color: var(--bg);
}

[data-theme="dark"] .toggle-slider {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.blog-series-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--bg);
  margin-left: 8px;
  vertical-align: middle;
}

/* Blog Series Dropdown Filter */
.blog-filter-container {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
}

.blog-series-select {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  background-color: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 36px 8px 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23a0a0a0%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  min-width: 220px;
}

.blog-series-select:hover,
.blog-series-select:focus {
  border-color: var(--text-muted);
}

/* ===== THOUGHTS STICKY NOTES PAGE ===== */
.thoughts-intro {
  margin-bottom: 28px;
}

.thoughts-intro p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Masonry Column Grid */
.thoughts-grid {
  column-count: 3;
  column-gap: 20px;
  width: 100%;
  display: block;
}

@media (max-width: 900px) {
  .thoughts-grid {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .thoughts-grid {
    column-count: 1;
    column-gap: 0;
  }
}

/* Sticky Card Styling */
.thought-card {
  display: inline-block;
  width: 100%;
  margin-bottom: 20px;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 4px 8px var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  break-inside: avoid-column;
  -webkit-column-break-inside: avoid;
  transition: transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.28s ease, border-color 0.28s ease;
  position: relative;
  overflow: hidden;
  /* Sticky notes text should always be dark for perfect readability on pastels */
  color: #1c1c1e !important;
  text-align: left;
}

.thought-card:hover {
  transform: translateY(-5px) rotate(0.5deg);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.15);
}

.thought-card-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  line-height: 1.7;
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #1c1c1e !important;
}

.thought-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  padding-top: 10px;
  margin-top: auto;
}

.thought-card-date {
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.5);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Pastel Sticky Note Color Themes (matching Google Keep & Windows sticky notes) */
.thought-color-yellow { background-color: #fff475 !important; }
.thought-color-blue { background-color: #cbf0f8 !important; }
.thought-color-green { background-color: #ccff90 !important; }
.thought-color-pink { background-color: #fdcfe8 !important; }
.thought-color-purple { background-color: #d7aefb !important; }
.thought-color-red { background-color: #f28b82 !important; }
.thought-color-teal { background-color: #a7ffeb !important; }
.thought-color-grey { background-color: #e8eaed !important; }

/* Micro-animation tweak: random subtle tilt for realistic sticky-note look */
.thoughts-grid > .thought-card:nth-child(2n) {
  transform: rotate(-0.5deg);
}
.thoughts-grid > .thought-card:nth-child(3n) {
  transform: rotate(0.5deg);
}
.thoughts-grid > .thought-card:nth-child(2n):hover,
.thoughts-grid > .thought-card:nth-child(3n):hover {
  transform: translateY(-5px) scale(1.02) rotate(0deg);
}

/* ===== RESPONSIVE MEDIA QUERIES (CONSOLIDATED CASCADE) ===== */

/* Desktop viewports (side-text becomes hidden) */
@media (max-width: 1100px) {
  .side-text {
    display: none;
  }
}

/* Laptop and small desktops (Thoughts page goes to 2 columns) */
@media (max-width: 900px) {
  .thoughts-grid {
    column-count: 2;
  }
}

/* Tablets in Portrait viewports */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 16px;
    padding: 24px 16px 16px;
  }

  .header-info {
    padding-right: 40px; /* Safeguard to prevent overlapping with fixed theme toggle button on narrow viewports */
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-right: 0;
    gap: 8px;
  }

  .main {
    padding: 24px 16px 80px;
  }

  .project-item {
    flex-direction: column;
  }

  .project-gif {
    width: 100%;
  }

  .project-gif img {
    width: 100%;
    height: 140px;
  }

  .project-date {
    margin-left: 0;
    width: 100%;
  }

  .filter-tabs {
    gap: 0;
    overflow-x: auto;
  }

  .filter-tab {
    padding: 6px 10px 8px;
    white-space: nowrap;
  }

  .blog-item {
    flex-direction: column;
    gap: 16px;
  }

  .blog-item-thumb {
    width: 100%;
  }

  .blog-item-thumb img {
    width: 100%;
    height: 140px;
  }

  .blog-item-date {
    margin-left: 0;
    width: 100%;
  }

  .blog-detail-gallery {
    grid-template-columns: 1fr;
  }
}

/* Small tablets / wide mobile phones (Thoughts page goes to 1 column) */
@media (max-width: 600px) {
  .thoughts-grid {
    column-count: 1;
    column-gap: 0;
  }
}

/* Mobile phones (portrait view) */
@media (max-width: 480px) {
  .header-info {
    width: 100%;
  }

  .nav {
    margin-right: 0;
    align-items: flex-start;
    flex-direction: row;
    gap: 6px;
  }

  .theme-toggle {
    top: 14px;
    right: 16px;
  }

  /* Make audience version toggle switch stack vertically on narrow screens to prevent spillover */
  .version-toggle-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .version-toggle-capsule {
    width: 100%;
  }
}

