/* ============================================================
   JUSTIN LIAO PORTFOLIO v3 — style.css
   Graphite base · instrument-cyan primary · brass secondary
   DM Serif Display + Syne + JetBrains Mono
   ============================================================ */

:root {
  color-scheme: dark;
  /* Graphite base — cool, near-black */
  --bg:           #0b0e12;
  --bg-2:         #0e1218;
  --bg-3:         #131920;
  --surface:      #121820;
  --surface-2:    #182028;

  /* Primary accent — instrument cyan (scope trace on dark) */
  --accent:        #5cc8e8;
  --accent-bright: #8fe0f7;
  --accent-dim:    #79b4c6;
  --accent-glow:   rgba(92, 200, 232, 0.07);

  /* Secondary accent — muted brass */
  --brass:      #c9a55c;
  --brass-dim:  #96793f;

  --border:       rgba(122, 168, 192, 0.12);
  --border-hover: rgba(92, 200, 232, 0.32);

  --text-primary:   #e9eef3;
  --text-secondary: #b0bac6;
  --text-muted:     #8e9ba9;

  --sidebar-w: 240px;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans:  'Syne', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-expo: cubic-bezier(0.87, 0, 0.13, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5f0;
  --bg-2: #f0eee8;
  --bg-3: #e8e6df;
  --surface: #eeece6;
  --surface-2: #e5e3dc;
  --accent: #14657a;
  --accent-bright: #104d60;
  --accent-dim: #326b79;
  --accent-glow: rgba(20, 101, 122, 0.06);
  --brass: #79571c;
  --brass-dim: #79571c;
  --border: rgba(36, 54, 60, 0.16);
  --border-hover: rgba(20, 101, 122, 0.45);
  --text-primary: #202c32;
  --text-secondary: #4e5c64;
  --text-muted: #59676e;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Syne renders a literal tilde like a centered dot at body-text size. */
.metric-approx {
  font-family: var(--font-mono);
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 2px; }
::selection { background: rgba(92, 200, 232, 0.25); color: var(--accent-bright); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  color: var(--text-secondary);
  font: 0.75rem var(--font-mono);
  cursor: pointer;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--border-hover); }
.theme-moon { display: none; }
[data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: block; }

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.4s var(--ease-expo);
}

.sidebar-header {
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-name-link { text-decoration: none; }

.sidebar-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  transition: color 0.25s;
}

.sidebar-name-link:hover .sidebar-name { color: var(--accent); }

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  letter-spacing: 0.04em;
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  transition: color 0.25s, background 0.25s;
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 2px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  transition: transform 0.3s var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-link.active::before { transform: translateY(-50%) scaleY(1); }

.sidebar-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
}

.social-link { color: var(--text-muted); text-decoration: none; transition: color 0.25s; }
.social-link:hover { color: var(--accent); }

/* ============================================================
   MAIN / SECTIONS / TRANSITIONS
   ============================================================ */

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  min-width: 0;
}

.section {
  display: none;
  min-height: 100vh;
}

.section.active {
  display: block;
  animation: sectionIn 0.55s var(--ease-out);
}

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

/* Staggered reveal elements */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

.cs-body.reveal.in { transform: none; }

.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }

.section-inner {
  max-width: 1080px;
  padding: 6rem 3.5rem 4rem;
}

.section-inner-wide { max-width: 1100px; }

.page-header { margin-bottom: 2.5rem; }

.page-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0;
}

.page-title em { font-style: italic; color: var(--accent); }

.page-intro {
  margin-top: 1.25rem;
  max-width: 540px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

.dot-sep { color: var(--text-muted); margin: 0 0.5rem; }

/* Typography — no orphan words, evenly filled lines */
.hero-title,
.page-title,
.detail-title,
.about-statement,
.card-title {
  text-wrap: balance;
}

p, .cs-list li, .card-summary, .glance-v, .cap-v {
  text-wrap: pretty;
}

/* ============================================================
   PROJECT FIGURES
   ============================================================ */



.fig {
  margin: 1.5rem 0 1.7rem;
  border: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden;
  max-width: 820px;
}
.fig--portrait { max-width: 440px; }
.design-archive {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
}
.design-archive summary {
  cursor: pointer;
  color: var(--text-secondary);
  font: 0.8rem/1.6 var(--font-mono);
}
.design-archive summary:hover { color: var(--accent); }
.results-table-wrap { overflow-x: auto; margin: 1.5rem 0; }
.results-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.results-table caption { text-align: left; color: var(--text-secondary); padding-bottom: 0.75rem; }
.results-table th, .results-table td {
  text-align: left;
  padding: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.results-table thead { background: var(--bg-2); }
.results-table tbody th { font-weight: 400; }
.results-table td { font-family: var(--font-mono); white-space: nowrap; }
.figure-open { display: block; color: inherit; text-decoration: none; }
.figure-open:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.figure-open img { cursor: zoom-in; }
.figure-hint {
  display: block;
  padding: 0.45rem 0.9rem;
  text-align: right;
  color: var(--text-secondary);
  font: 0.75rem var(--font-mono);
}
.figure-open:hover .figure-hint { color: var(--accent); }
.fig img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: var(--surface);
}
.fig--schematic img { background: #fff; }
/* Trim empty tabletop in-page; the preview opens the untouched photograph. */
.fig--board img { aspect-ratio: 4 / 3; object-fit: cover; object-position: center 46%; }
.fig-cap {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  letter-spacing: 0.04em;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.image-lightbox {
  position: fixed;
  inset: 0;
  width: calc(100vw - 2rem);
  height: calc(100dvh - 2rem);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-hover);
  background: var(--bg);
  color: var(--text-primary);
  overflow: hidden;
}
.image-lightbox[open] { display: flex; flex-direction: column; }
.image-lightbox::backdrop { background: rgba(2, 4, 7, 0.88); }
.lightbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.lightbox-toolbar button, .lightbox-original {
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-hover);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  font: 0.8rem var(--font-mono);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.lightbox-toolbar button:disabled { opacity: 0.5; cursor: default; }
.lightbox-close { margin-left: auto; }
.lightbox-stage {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}
.lightbox-stage.zoomed { display: block; }
.lightbox-img {
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  cursor: zoom-in;
}
.lightbox-stage.zoomed .lightbox-img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}
.lightbox-caption, .lightbox-status {
  flex-shrink: 0;
  margin: 0;
  padding: 0.6rem 1rem;
  font: 0.8rem/1.5 var(--font-mono);
}
.lightbox-caption { border-top: 1px solid var(--border); }
.lightbox-status { color: var(--text-secondary); }

/* ============================================================
   STATUS LABELS
   ============================================================ */

.status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  border: 1px solid;
  background: var(--bg-2);
  backdrop-filter: blur(4px);
}

.status-validated  { color: var(--accent);  border-color: rgba(92, 200, 232, 0.4); }
.status-progress   { color: var(--brass);   border-color: rgba(201, 165, 92, 0.4); }
.status-research   { color: var(--accent-bright); border-color: rgba(143, 224, 247, 0.35); }
.status-team       { color: var(--text-secondary); border-color: rgba(139, 149, 163, 0.35); }
.status-leadership { color: var(--brass);   border-color: rgba(201, 165, 92, 0.4); }

/* ============================================================
   HOME
   ============================================================ */

.home-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 6rem 3.5rem 4rem;
  gap: 2.75rem;
  max-width: 1100px;
}

/* Compact hero */
.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0;
  max-width: 780px;
  margin-bottom: 1rem;
}

.hero-title em { font-style: italic; color: var(--accent); }

.hero-sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 1.75rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* Featured projects */
.featured-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.featured-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.featured-all {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.25s;
}

.featured-all:hover { color: var(--accent); }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.featured-project {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s var(--ease-out);
}

.featured-project:hover { border-color: var(--border-hover); transform: translateY(-3px); }
.featured-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.featured-image img { width: 100%; height: 100%; object-fit: contain; }
.featured-image.board-photo img { object-fit: cover; object-position: center 46%; }
.featured-copy { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.8rem; flex: 1; }
.featured-copy p { font-size: 0.92rem; line-height: 1.65; color: var(--text-secondary); }
.featured-copy .card-cta { padding-top: 0.5rem; color: var(--accent); }
.featured-copy .card-title { font-size: 1.55rem; }

/* ============================================================
   PROJECTS PAGE — filters + card grid
   ============================================================ */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.25rem;
}

.filter-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.filter-chip:hover {
  color: var(--accent);
  border-color: var(--border-hover);
}

.filter-chip.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

.project-card {
  border: 1px solid var(--border);
  background: var(--bg-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: border-color 0.3s, transform 0.3s var(--ease-out), background 0.3s;
}

.project-card:hover {
  border-color: var(--border-hover);
  background: var(--surface);
  transform: translateY(-3px);
}

.project-card.filtered-out { display: none; }

.earlier-work { margin-top: 3.5rem; }
.earlier-work[hidden] { display: none; }
.earlier-label { margin-bottom: 1.25rem; }

.project-card-progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
}
.project-card-progress .card-img { height: 100%; min-height: 240px; aspect-ratio: auto; border-bottom: none; border-right: 1px solid var(--border); }
.project-card-progress .card-body { min-height: 0; }
.project-card-progress .status { align-self: flex-start; }
.project-card-progress .card-summary { max-width: 680px; }

.card-img {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: none;
  transition: filter 0.5s, transform 0.5s var(--ease-out);
}

.project-card[data-project="imerse-pedal"] .card-img .board-photo-img { object-fit: cover; object-position: center 46%; }
.project-card[data-project="microwave-probe"] .card-img img { object-position: center 50%; }
.project-card[data-project="epr-positioning"] .card-img img { object-position: center; }
.project-card[data-project="pelvistim"] .card-img img {
  object-fit: contain;
  object-position: center center;
  background: var(--surface);
}



.project-card:hover .card-img img {
  filter: grayscale(0%) brightness(1);
}

.card-body .status { align-self: flex-start; }

.card-body {
  padding: 1.4rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
  min-height: 220px;
}

.card-cat {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-primary);
  transition: color 0.25s;
}

.project-card:hover .card-title { color: var(--accent); }

.card-summary {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 0.2rem;
}

.card-cta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: auto;
  transition: color 0.25s, transform 0.25s var(--ease-out);
}

.project-card:hover .card-cta {
  color: var(--accent);
  transform: translateX(4px);
}

/* ============================================================
   PROJECT DETAIL — case study layout
   ============================================================ */

.back-link {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  margin-bottom: 2.5rem;
  transition: color 0.25s, transform 0.25s var(--ease-out);
}

.back-link:hover { color: var(--accent); transform: translateX(-4px); }

.detail-header { margin-bottom: 2.25rem; }

.detail-cat {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.detail-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0;
  margin-bottom: 1.25rem;
}

.detail-title em { font-style: italic; color: var(--accent); }

/* At a Glance */
.glance {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  margin-bottom: 2.25rem;
}

.glance--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.glance-item {
  min-width: 0;
  padding: 1rem clamp(1.2rem, 2vw, 1.55rem) 1.05rem;
  border-right: 1px solid var(--border);
}

.glance-item:last-child { border-right: none; }

.glance-k {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

.glance-v {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Case-study sections */
.cs-section {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 2.35rem;
  padding: 1.45rem 0;
  border-top: 1px solid var(--border);
}

.cs-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-top: 0.3rem;
}

.cs-body p {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  max-width: 720px;
}

.cs-body p:last-child { margin-bottom: 0; }

.cs-list {
  list-style: none;
  max-width: 720px;
}

.cs-list li {
  font-size: 0.92rem;
  line-height: 1.48;
  color: var(--text-secondary);
  padding: 0.34rem 0 0.34rem 1.1rem;
  position: relative;
}

.cs-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent-dim);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  letter-spacing: 0.02em;
}

/* ============================================================
   ABOUT
   ============================================================ */

.about-hero {
  min-height: 34vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 6rem 3.5rem 1rem;
  max-width: 980px;
}

.about-portrait {
  flex-shrink: 0;
  width: min(220px, 20vw);
  aspect-ratio: 4 / 5;
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: 0.5rem;
  overflow: hidden;
}

.about-portrait img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 35%;
}

.about-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
}

.about-statement {
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 2.8vw, 2.15rem);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: 0;
  max-width: 620px;
}

.about-statement em {
  font-style: italic;
  color: var(--accent);
}

.about-content {
  padding: 2rem 3.5rem 5rem;
  max-width: 900px;
}

.about-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.about-row-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-top: 0.3rem;
}

.about-row-body p {
  font-size: 0.98rem;
  line-height: 1.72;
  color: var(--text-secondary);
  max-width: 620px;
}

/* Experience rows */
.xp {
  display: flex;
  flex-direction: column;
  max-width: 560px;
}

.xp-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.xp-row:last-child { border-bottom: none; }

.xp-role {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.xp-org {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.xp-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.edu-school {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.edu-degree {
  font-size: 0.98rem;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 0.45rem;
}

.edu-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  max-width: 620px;
}

.edu-meta span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: nowrap;
}

/* Toolkit */
.toolkit {
  max-width: 650px;
  border-top: 1px solid var(--border);
}

.toolkit-k {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 0.15rem;
}

.toolkit-line {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 1.2rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.toolkit-v {
  font-size: 0.96rem;
  color: var(--text-secondary);
  line-height: 1.58;
}

/* ============================================================
   CONTACT
   ============================================================ */

.contact-intro {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 480px;
  margin-bottom: 2.5rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  overflow: hidden;
  max-width: 520px;
  margin-bottom: 2.5rem;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.4rem;
  background: var(--surface);
  text-decoration: none;
  transition: background 0.25s, padding-left 0.25s var(--ease-out);
  border-bottom: 1px solid var(--border);
}

.contact-card:last-child { border-bottom: none; }
.contact-card:hover { background: var(--surface-2); padding-left: 1.7rem; }

.contact-icon { color: var(--accent-dim); flex-shrink: 0; width: 20px; }
.contact-info { flex: 1; }

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
}

.contact-value { font-size: 0.85rem; color: var(--text-secondary); }

.contact-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.25s, transform 0.25s var(--ease-out);
}

.contact-card:hover .contact-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.contact-resume {
  max-width: 520px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: 1.4rem;
}

.contact-resume-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.resume-actions {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.25s, transform 0.2s var(--ease-out);
}

.btn-primary:hover { background: var(--accent-bright); transform: translateY(-2px); }

.btn-secondary {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-hover);
  padding-bottom: 1px;
  transition: color 0.25s, border-color 0.25s;
}

.btn-secondary:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   HAMBURGER / MOBILE
   ============================================================ */

.hamburger {
  display: none;
  position: fixed;
  top: 1rem; left: 1rem;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  width: 40px; height: 40px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  transition: border-color 0.25s;
}

.hamburger:hover { border-color: var(--border-hover); }

.hamburger span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--text-secondary);
  transition: transform 0.3s var(--ease-out), opacity 0.25s;
}

.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1000px) {
  .glance { grid-template-columns: repeat(3, 1fr); }
  .glance--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glance-item { border-bottom: 1px solid var(--border); }
  .glance-item:nth-child(3n) { border-right: none; }
  .glance-item:nth-child(3) ~ .glance-item { border-bottom: none; }
  .glance--four .glance-item:nth-child(odd) { border-right: 1px solid var(--border); }
  .glance--four .glance-item:nth-child(even) { border-right: none; }
  .glance--four .glance-item:nth-child(n+3) { border-bottom: none; }
}

@media (max-width: 900px) {
  .featured-grid { grid-template-columns: 1fr; }
  .project-card-progress { display: flex; }
  .project-card-progress .card-img { height: auto; min-height: 0; aspect-ratio: 16 / 9; border-right: none; border-bottom: 1px solid var(--border); }
  .project-grid { grid-template-columns: 1fr; }
  .about-row { grid-template-columns: 1fr; gap: 0.75rem; }
  .cs-section { grid-template-columns: 1fr; gap: 0.75rem; }
}

@media (max-width: 768px) {
  .theme-toggle { top: 1rem; right: 1rem; }
  .featured-head { flex-wrap: wrap; gap: 0.5rem; }
  body {
    display: block;
    width: 100%;
  }

  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; }
  .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    overflow: hidden;
  }

  .section-inner { padding: 5rem 1.5rem 2.5rem; }
  .home-wrap { padding: 5rem 1.5rem 2.5rem; }
  .section-inner,
  .home-wrap {
    width: 100%;
    max-width: 100%;
  }
  .about-hero { padding: 5rem 1.5rem 1rem; min-height: auto; flex-direction: column; align-items: flex-start; gap: 1.5rem; }
  .about-portrait { width: 180px; }
  .about-content { padding: 1.5rem 1.5rem 4rem; }

  .glance { grid-template-columns: 1fr 1fr; }
  .glance-item { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .glance-item:nth-child(2n) { border-right: none; }

  .hero-title {
    font-size: clamp(2.05rem, 8.4vw, 2.45rem);
    line-height: 1.12;
  }

  .hero-kicker,
  .page-tag {
    letter-spacing: 0.08em;
  }

  .page-title {
    font-size: clamp(2.25rem, 11vw, 2.85rem);
    line-height: 1.02;
  }

  .hero-title,
  .page-title,
  .detail-title,
  .about-statement {
    letter-spacing: 0;
    max-width: 100%;
  }

  .xp-row { flex-direction: column; gap: 0.2rem; }

  .toolkit-line {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .edu-meta span {
    white-space: normal;
  }

  .about-statement { font-size: clamp(1.35rem, 6vw, 1.85rem); }
}

@media (max-width: 420px) {
  .section-inner,
  .home-wrap,
  .about-hero,
  .about-content {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .hero-title { font-size: clamp(1.9rem, 8vw, 2.25rem); }
  .page-title { font-size: clamp(2rem, 10vw, 2.55rem); }
  .hero-actions { gap: 0.9rem; }
  .btn-primary { padding: 0.72rem 1.1rem; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal { opacity: 1; transform: none; }
  .section.active { animation: none; }
}
