/*
 * Project Hub — V1 design tokens
 * Locked 2026-05-01. See docs/v1-design-system.md for spec.
 * Light theme added 2026-05-04 — Foundation #F0EBE3 (vintage book paper).
 */

:root {
  /* === Foundation === */
  --bg-0:        #08070A;
  --ink:         #ECECF1;
  --ink-soft:    #B8BAC4;
  --ink-mute:    #6E7180;

  /* === Burgundy — the only accent (unchanged across themes) === */
  --burgundy:        #722F37;
  --burgundy-soft:   #9B3F4A;
  --burgundy-deep:   #5C1A1B;
  --burgundy-link-h: #C46A75;

  /* === Glass surface (Linear pattern) === */
  --glass-bg:     rgba(10,10,12,0.6);
  --glass-inset:  rgba(255,255,255,0.06);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.4);

  /* === Card-solid === */
  --card-grad:        linear-gradient(180deg, rgba(28,22,32,0.78), rgba(18,15,22,0.78));
  --card-border:      rgba(255,255,255,0.10);
  --card-media-bg:    linear-gradient(135deg, rgba(28,22,32,0.7), rgba(14,12,18,0.7));
  --card-media-edge:  rgba(255,255,255,0.08);

  /* === Liquid glass button === */
  --lbtn-bg:           rgba(255,255,255,0.05);
  --lbtn-bg-hover:     rgba(255,255,255,0.10);
  --lbtn-border:       rgba(255,255,255,0.18);
  --lbtn-inset:        rgba(255,255,255,0.06);
  --lbtn-inset-hover:  rgba(255,255,255,0.10);
  --lbtn-top:          rgba(255,255,255,0.30);
  --lbtn-top-hover:    rgba(255,255,255,0.40);
  --lbtn-shadow:       0 8px 24px -8px rgba(0,0,0,0.6);
  --lbtn-shadow-hover: 0 12px 32px -8px rgba(0,0,0,0.7);

  /* === Hero vignette tunnel === */
  --vignette-color:  rgba(8,7,10,0.85);
  --vignette-glow:   rgba(155,63,74,0.10);

  /* === Project pin progress track === */
  --proj-track-bg:   rgba(255,255,255,0.12);

  /* === Background fallback === */
  --bg-fallback-a: rgba(40,30,55,0.45);
  --bg-fallback-b: rgba(92,26,27,0.25);

  /* === Grain overlay === */
  --grain-opacity: 0.05;
  --grain-blend:   overlay;

  /* === Prose (essay body) === */
  --prose-fg:         rgba(236,236,241,0.78);
  --prose-quote:      rgba(236,236,241,0.85);
  --prose-code-bg:    rgba(255,255,255,0.06);
  --prose-pre-bg:     rgba(255,255,255,0.04);
  --prose-pre-edge:   rgba(255,255,255,0.08);
  --prose-pre-fg:     rgba(236,236,241,0.88);
  --prose-hr:         rgba(255,255,255,0.08);
  --prose-figcaption: rgba(255,255,255,0.4);

  /* === Dim-list hover === */
  --dim-hover-bg:    rgba(255,255,255,0.03);

  /* === Theme transition === */
  --theme-tx: background-color 320ms ease, color 320ms ease, border-color 320ms ease, box-shadow 320ms ease, fill 320ms ease;
}

/* ======================================================================
 * Light theme — Foundation #F0EBE3, burgundy unchanged, warm hairline edge,
 * neutral lighter shadow (NOT warm-tinted), shader hidden.
 * ====================================================================== */
[data-theme="light"] {
  --bg-0:        #F0EBE3;
  --ink:         #1A1517;
  --ink-soft:    #5A4E54;
  --ink-mute:    #8C8088;

  /* Burgundy unchanged */

  /* Glass — warm hairline + neutral lighter shadow */
  --glass-bg:     rgba(255,253,248,0.55);
  --glass-inset:  rgba(40,20,25,0.10);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.12);

  /* Card-solid — cream gradient, warm hairline */
  --card-grad:        linear-gradient(180deg, rgba(255,253,248,0.92), rgba(245,240,232,0.92));
  --card-border:      rgba(40,20,25,0.10);
  --card-media-bg:    linear-gradient(135deg, rgba(245,240,232,0.85), rgba(232,220,210,0.85));
  --card-media-edge:  rgba(40,20,25,0.10);

  /* Liquid button — invert white insets to subtle warm darks; keep white top highlight for liquid feel */
  --lbtn-bg:           rgba(40,20,25,0.04);
  --lbtn-bg-hover:     rgba(40,20,25,0.08);
  --lbtn-border:       rgba(40,20,25,0.14);
  --lbtn-inset:        rgba(40,20,25,0.06);
  --lbtn-inset-hover:  rgba(40,20,25,0.10);
  --lbtn-top:          rgba(255,255,255,0.85);
  --lbtn-top-hover:    rgba(255,255,255,1);
  --lbtn-shadow:       0 8px 24px -8px rgba(0,0,0,0.18);
  --lbtn-shadow-hover: 0 12px 32px -8px rgba(0,0,0,0.22);

  /* Vignette — cream tunnel collapsing to bg-0 */
  --vignette-color:  rgba(240,235,227,0.92);
  --vignette-glow:   rgba(155,63,74,0.06);

  /* Project track */
  --proj-track-bg:   rgba(40,20,25,0.12);

  /* BG fallback — flat cream, no purple radial */
  --bg-fallback-a:   transparent;
  --bg-fallback-b:   rgba(155,63,74,0.04);

  /* Grain a touch stronger to remain visible on cream */
  --grain-opacity:   0.07;

  /* Prose — invert ink at same alpha levels */
  --prose-fg:         rgba(26,21,23,0.78);
  --prose-quote:      rgba(26,21,23,0.88);
  --prose-code-bg:    rgba(40,20,25,0.06);
  --prose-pre-bg:     rgba(40,20,25,0.04);
  --prose-pre-edge:   rgba(40,20,25,0.10);
  --prose-pre-fg:     rgba(26,21,23,0.88);
  --prose-hr:         rgba(40,20,25,0.10);
  --prose-figcaption: rgba(26,21,23,0.4);

  --dim-hover-bg:    rgba(40,20,25,0.04);
}

/* ======================================================================
 * Base reset
 * ====================================================================== */
* { -webkit-font-smoothing: antialiased; box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  background: var(--bg-0);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  letter-spacing: -0.011em;
  transition: var(--theme-tx);
}
body {
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--theme-tx);
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

.serif   { font-family: 'Instrument Serif', 'Times New Roman', serif; letter-spacing: -0.015em; font-weight: 400; }
.serif-i { font-family: 'Instrument Serif', serif; font-style: italic; }
.mono    { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ======================================================================
 * Glass primitives
 * ====================================================================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 0 0 1px var(--glass-inset), var(--glass-shadow);
  contain: paint;
  transition: var(--theme-tx);
}

.glass-soft {
  background: var(--lbtn-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--card-media-edge);
  box-shadow: inset 0 0 0 1px var(--glass-inset);
  contain: paint;
  transition: var(--theme-tx);
}

.card-solid {
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  box-shadow: inset 0 0 0 1px var(--glass-inset), var(--glass-shadow);
  contain: paint;
  transition: var(--theme-tx);
}

/* ======================================================================
 * Liquid glass button
 * ====================================================================== */
.liquid-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.6rem;
  border-radius: 9999px;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: var(--lbtn-bg);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid var(--lbtn-border);
  box-shadow:
    inset 0 0 0 1px var(--lbtn-inset),
    inset 0 1px 0 var(--lbtn-top),
    var(--lbtn-shadow);
  transition: transform 280ms cubic-bezier(.2,.9,.25,1), background 280ms ease, box-shadow 280ms ease, color 320ms ease, border-color 320ms ease;
}
.liquid-btn:hover {
  transform: translateY(-1px);
  background: var(--lbtn-bg-hover);
  box-shadow:
    inset 0 0 0 1px var(--lbtn-inset-hover),
    inset 0 1px 0 var(--lbtn-top-hover),
    var(--lbtn-shadow-hover);
}
.liquid-btn:active { transform: translateY(0); }

/* Primary CTA — burgundy fill works in both themes */
.liquid-btn-primary {
  background: linear-gradient(180deg, var(--burgundy-deep), #2E0D0E);
  border-color: rgba(155,63,74,0.35);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.10),
    inset 0 1px 0 rgba(255,255,255,0.42),
    inset 0 -10px 20px -10px rgba(0,0,0,0.45),
    0 8px 24px -6px rgba(92,26,27,0.5),
    0 1px 0 rgba(0,0,0,0.3);
}
.liquid-btn-primary:hover {
  background: linear-gradient(180deg, var(--burgundy), var(--burgundy-deep));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.14),
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -10px 20px -10px rgba(0,0,0,0.4),
    0 12px 32px -6px rgba(92,26,27,0.6),
    0 1px 0 rgba(0,0,0,0.3);
}

/* ======================================================================
 * Inline burgundy link
 * ====================================================================== */
.ink-link {
  color: var(--burgundy-soft);
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color 200ms ease;
}
.ink-link:hover { color: var(--burgundy-link-h); }

/* ======================================================================
 * Live dot pulse
 * ====================================================================== */
@keyframes pulse-burgundy {
  0%   { box-shadow: 0 0 0 0 rgba(155,63,74,0.65); }
  70%  { box-shadow: 0 0 0 8px rgba(155,63,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(155,63,74,0); }
}
.live-dot { animation: pulse-burgundy 1.9s ease-out infinite; }

/* ======================================================================
 * Reveal on scroll
 * ====================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 800ms ease, transform 800ms cubic-bezier(.2,.85,.2,1);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* === Hero stagger (per-word fade) === */
.stagger > span {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 900ms cubic-bezier(.2,.85,.2,1), transform 900ms cubic-bezier(.2,.85,.2,1);
}
.stagger.in > span { opacity: 1; transform: translateY(0); }

/* === 3D tilt === */
.tilt {
  transform-style: preserve-3d;
  transition: transform 320ms cubic-bezier(.2,.85,.2,1);
  will-change: transform;
}

/* ======================================================================
 * Aceternity dim-siblings list (writing)
 * ====================================================================== */
.dim-list:hover > .dim-row { opacity: 0.4; transition: opacity 200ms ease; }
.dim-list > .dim-row { transition: opacity 200ms ease, background 200ms ease, padding 200ms ease; }
.dim-list > .dim-row:hover { opacity: 1 !important; background: var(--dim-hover-bg); }

/* === Vertical brand label === */
.vbrand {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  letter-spacing: 0.4em;
}

/* === Top scroll progress === */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 1px;
  z-index: 60;
  background: linear-gradient(90deg, var(--burgundy-soft), var(--burgundy));
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
  transition: transform 80ms linear;
}

/* ======================================================================
 * Shader backdrop (Paper Shaders MeshGradient mount target)
 * Hidden in light theme — solid --bg-0 + grain take over.
 * ====================================================================== */
#bg-shader {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
#bg-shader, #bg-shader * { pointer-events: none; }
#bg-shader { overflow: hidden; }
#bg-shader canvas { display: block; width: 100% !important; height: 100% !important; }

.bg-fallback {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(800px 600px at 30% 20%, var(--bg-fallback-a), transparent 60%),
    radial-gradient(700px 500px at 80% 80%, var(--bg-fallback-b), transparent 60%),
    var(--bg-0);
  transition: background 320ms ease;
}

/* ======================================================================
 * Static grain overlay
 * ====================================================================== */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/></svg>");
}

/* ======================================================================
 * Preloader
 * ====================================================================== */
.preload {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg-0);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 600ms ease, visibility 600ms ease;
}
.preload.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.preload__dot { width: 6px; height: 6px; border-radius: 9999px; background: var(--burgundy-soft); animation: pulse-burgundy 1.4s ease-out infinite; }

body:not(.ready) main,
body:not(.ready) section,
body:not(.ready) footer,
body:not(.ready) nav,
body:not(.ready) aside { opacity: 0; }
body.ready main,
body.ready section,
body.ready footer,
body.ready nav,
body.ready aside { transition: opacity 600ms ease 100ms; opacity: 1; }

/* ======================================================================
 * Theme toggle button — Style A: icon only, top-right fixed
 * ====================================================================== */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 70;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--lbtn-bg);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid var(--lbtn-border);
  box-shadow:
    inset 0 0 0 1px var(--lbtn-inset),
    inset 0 1px 0 var(--lbtn-top),
    var(--lbtn-shadow);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease 200ms, visibility 600ms ease 200ms,
              transform 280ms cubic-bezier(.2,.9,.25,1),
              background 280ms ease, box-shadow 280ms ease,
              color 320ms ease, border-color 320ms ease;
}
body.ready .theme-toggle { opacity: 1; visibility: visible; }
.theme-toggle:hover { transform: translateY(-1px); background: var(--lbtn-bg-hover); }
.theme-toggle:active { transform: translateY(0); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
@media (max-width: 768px) {
  .theme-toggle { top: 16px; right: 16px; width: 36px; height: 36px; }
  .theme-toggle svg { width: 16px; height: 16px; }
}

/* ======================================================================
 * Home hero — one-line statement + inset card that opens to full-bleed
 * on scroll; the writing list then slides over the pinned card.
 * Values locked 2026-11-28 from sandbox/home-hero.html. Logic: js/hero-horizon.js
 * ====================================================================== */
.hero-statement { max-width: 1200px; margin: 0 auto; padding: 120px 60px 48px; }
.hero-statement h1 {
  font-family: 'Instrument Serif', 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(29px, 3.21vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  max-width: 22em;
  color: var(--ink);
  transition: color 320ms ease;
}
.hero-statement .name { display: block; }
.hero-statement .rest { display: block; margin-top: 0.3em; opacity: 0.45; font-size: clamp(22px, 2.43vw, 35px); line-height: 1.25; }

.hero-card-stage { position: relative; height: calc(85vh + 750px); }
.hero-card-sticky { position: sticky; top: 0; height: 85vh; }
.hero-card {
  position: absolute; inset: 0; overflow: hidden;
  background: #1A1114;
  will-change: clip-path;
}
.hero-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-card-grain {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.14; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.hero-cover {
  position: relative; z-index: 2;
  margin-top: -45vh;
  background: var(--bg-0);
  transition: background-color 320ms ease;
}
@media (max-width: 720px) {
  .hero-statement { padding: 96px 24px 32px; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ======================================================================
 * Projects horizontal pin-scroll
 * ====================================================================== */
.proj-pin {
  position: relative;
  height: 260vh;
  z-index: 10;
}
.proj-pin-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.proj-track {
  display: flex;
  gap: 4vw;
  padding: 0 8vw;
  align-items: center;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}
.proj-card {
  flex: 0 0 auto;
  width: min(72vw, 980px);
  height: 82vh;
  min-height: 600px;
  padding: clamp(1.5rem, 2.5vw, 2.5rem);
  border-radius: 32px;
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  box-shadow: inset 0 0 0 1px var(--glass-inset), var(--glass-shadow);
  contain: paint;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  transition: var(--theme-tx);
}
.proj-card-media {
  flex: 1 1 auto;
  border-radius: 22px;
  background: var(--card-media-bg);
  border: 1px solid var(--card-media-edge);
  position: relative;
  overflow: hidden;
  transition: var(--theme-tx);
}
.proj-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.proj-card-header {
  flex-shrink: 0;
  padding: 0.25rem 0 0;
}
.proj-card-title {
  font-family: 'Instrument Serif', 'Times New Roman', serif;
  font-size: clamp(2rem, 3vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 0.45rem;
}
.proj-card-sub {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 1.15rem;
  letter-spacing: -0.005em;
  max-width: 52ch;
}
.proj-card-cta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.proj-card .liquid-btn {
  padding: 0.62rem 1.3rem;
  font-size: 0.82rem;
}
.proj-progress {
  position: absolute;
  bottom: 5vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 2;
}
.proj-progress-track {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 1px;
  background: var(--proj-track-bg);
  transition: background 320ms ease;
}
.proj-progress-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--burgundy-soft), var(--burgundy));
  transition: width 120ms linear;
}

/* On narrow screens, fall back to vertical stacked projects (no pin) */
@media (max-width: 768px) {
  .proj-pin { height: auto; }
  .proj-pin-inner { position: static; height: auto; padding: 6rem 0 4rem; }
  .proj-header { position: static; padding: 0 1.5rem 2rem; }
  .proj-track { flex-direction: column; padding: 0 1.5rem; gap: 1rem; transform: none !important; }
  .proj-card { width: 100%; height: auto; min-height: 0; }
  .proj-progress { position: static; transform: none; margin: 2rem auto 0; justify-content: center; }
}

/* ======================================================================
 * Article column + contents + previous/next
 * Locked 2026-11-28 from sandbox/article-reader.html (600px measure).
 * ====================================================================== */
article:has(> .prose-essay) {
  max-width: calc(600px + 3rem) !important;
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
}

#toc-side {
  position: fixed; top: 120px; width: 220px; z-index: 20;
  opacity: 0; pointer-events: none; transition: opacity 240ms ease;
  font-family: 'Inter', system-ui, sans-serif; font-size: 13px; line-height: 1.4;
}
#toc-side.on { opacity: 1; pointer-events: auto; }
#toc-side .toc-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--ink-mute); padding-left: 14px; margin-bottom: 8px;
}
#toc-side a {
  display: block; position: relative; padding: 6px 0 6px 14px;
  color: var(--ink-mute); transition: color 160ms ease;
}
#toc-side a:hover, #toc-side a.active { color: var(--ink); }
#toc-side a.active::before {
  content: ''; position: absolute; left: 0; top: 50%;
  width: 5px; height: 5px; margin-top: -2.5px; border-radius: 9999px;
  background: var(--burgundy-soft);
}

#toc-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  transform: translateY(-100%); transition: transform 240ms ease;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  font-family: 'Inter', system-ui, sans-serif; font-size: 13px;
}
#toc-bar.on { transform: none; }
#toc-bar .toc-bar-head {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px 64px 14px 20px; color: var(--ink); text-align: left;
}
#toc-bar .toc-bar-num { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-mute); }
#toc-bar .toc-bar-chev { margin-left: auto; color: var(--ink-mute); transition: transform 200ms ease; }
#toc-bar.open .toc-bar-chev { transform: rotate(180deg); }
#toc-bar ol { display: none; padding: 4px 20px 14px; }
#toc-bar.open ol { display: block; }
#toc-bar ol a { display: block; padding: 7px 0; color: var(--ink-mute); }
#toc-bar ol a.active { color: var(--ink); }

#endnav { margin-top: 4rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
#endnav a {
  display: block; padding: 1.1rem 1.2rem; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  transition: border-color 200ms ease, background-color 200ms ease;
}
#endnav a:hover {
  border-color: color-mix(in srgb, var(--ink) 25%, transparent);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}
#endnav .endnav-k {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--ink-mute);
}
#endnav .endnav-t { font-family: 'Instrument Serif', serif; font-size: 1.5rem; line-height: 1.15; color: var(--ink); margin-top: 0.5rem; }
#endnav .endnav-s {
  font-size: 13px; line-height: 1.5; color: var(--ink-mute); margin-top: 0.4rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#endnav .endnav-next { text-align: right; }
@media (max-width: 640px) {
  #endnav { grid-template-columns: 1fr; }
  #endnav .endnav-next { text-align: left; }
}

/* ======================================================================
 * Prose (essay body) — newsletter aesthetic
 * ====================================================================== */
.prose-essay {
  color: var(--prose-fg);
  font-family: 'Newsreader', Georgia, 'Songti TC', 'STSong', 'Noto Serif TC', serif;
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: 0;
  max-width: 600px;
  margin-inline: auto;
  transition: color 320ms ease;
}
.prose-essay > * + * { margin-top: 1.3em; }
.prose-essay h2 {
  font-family: inherit;
  font-weight: 600;
  font-size: 1.45em;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin-top: 2.6em;
  margin-bottom: 0.4em;
}
.prose-essay h3 {
  font-family: inherit;
  font-weight: 600;
  font-size: 1.15em;
  line-height: 1.2;
  color: var(--ink);
  margin-top: 2em;
  margin-bottom: 0.3em;
}
.prose-essay a {
  color: var(--burgundy-soft);
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color 200ms ease;
}
.prose-essay a:hover { color: var(--burgundy-link-h); }
.prose-essay strong { color: var(--ink); font-weight: 500; }
.prose-essay em { font-style: italic; }
.prose-essay blockquote {
  font-family: ui-serif, Georgia, Cambria, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.55;
  letter-spacing: 0;
  color: var(--prose-quote);
  border-left: 2px solid var(--burgundy-soft);
  padding-left: 1.4rem;
  margin-top: 2em;
  margin-bottom: 2em;
  max-width: 60ch;
}
.prose-essay blockquote p { margin: 0; }
.prose-essay code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  background: var(--prose-code-bg);
  border-radius: 4px;
  color: var(--ink);
}
.prose-essay pre {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--prose-pre-bg);
  border: 1px solid var(--prose-pre-edge);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  color: var(--prose-pre-fg);
  margin-top: 1.6em;
}
.prose-essay pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
.prose-essay ul, .prose-essay ol {
  padding-left: 1.4em;
  max-width: 65ch;
}
.prose-essay ul { list-style-type: disc; }
.prose-essay ol { list-style-type: decimal; }
.prose-essay li + li { margin-top: 0.4em; }
.prose-essay li::marker { color: var(--burgundy-soft); }
.prose-essay hr {
  border: 0;
  border-top: 1px solid var(--prose-hr);
  margin: 2.4em 0;
}
.prose-essay table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.6em;
  font-size: 0.95rem;
  line-height: 1.5;
}
.prose-essay thead th {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 2px solid var(--burgundy-soft);
  padding: 0.5em 0.9em;
}
.prose-essay tbody td {
  border-bottom: 1px solid var(--prose-hr);
  padding: 0.55em 0.9em;
  vertical-align: top;
}
.prose-essay tbody tr:last-child td { border-bottom: 0; }
.prose-essay img {
  border-radius: 12px;
  margin: 2em 0;
  max-width: 100%;
}
.prose-essay figcaption {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--prose-figcaption);
  text-align: center;
  margin-top: 0.6em;
}
.img-placeholder {
  border: 1.5px dashed var(--prose-hr, rgba(255,255,255,0.12));
  border-radius: 12px;
  padding: 3rem 1.5rem;
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--prose-figcaption, rgba(255,255,255,0.3));
  margin: 2em 0;
}

/* ======================================================================
 * Reduced motion
 * ====================================================================== */
@media (prefers-reduced-motion: reduce) {
  .reveal, .stagger > span, .tilt, .live-dot { transition: none !important; transform: none !important; animation: none !important; }
  .progress { transition: none !important; }
  .bg-fallback { display: block; }
  .hero-card-stage { height: 85vh; }
  .hero-cover { margin-top: 0; }
  .proj-pin { height: auto; }
  .proj-pin-inner { position: static; height: auto; padding: 6rem 0; }
  .proj-track { flex-direction: column; transform: none !important; padding: 0 1.5rem; }
  .proj-card { width: 100%; height: auto; min-height: 0; }
}

/* ======================================================================
 * Tailwind-utility light-theme overrides
 * (HTML uses inline `text-white/65`, `border-white/[0.06]`, etc. The CDN
 * Tailwind has no `dark:` config, so we override these utilities directly
 * when [data-theme="light"] is set.)
 * ====================================================================== */
[data-theme="light"] .text-white\/85,
[data-theme="light"] .text-white\/85 * { color: rgba(26,21,23,0.85); }
[data-theme="light"] .text-white\/65 { color: rgba(26,21,23,0.7); }
[data-theme="light"] .text-white\/60 { color: rgba(26,21,23,0.65); }
[data-theme="light"] .text-white\/55 { color: rgba(26,21,23,0.6); }
[data-theme="light"] .text-white\/50 { color: rgba(26,21,23,0.6); }
[data-theme="light"] .text-white\/40 { color: rgba(26,21,23,0.5); }
[data-theme="light"] .text-white\/35 { color: rgba(26,21,23,0.5); }
[data-theme="light"] .text-white\/25 { color: rgba(26,21,23,0.3); }
[data-theme="light"] .text-white\/20 { color: rgba(26,21,23,0.25); }

[data-theme="light"] .border-white\/\[0\.06\] { border-color: rgba(40,20,25,0.10); }
[data-theme="light"] .bg-white\/\[0\.03\] { background-color: rgba(40,20,25,0.04); }
[data-theme="light"] .hover\:bg-white\/\[0\.03\]:hover { background-color: rgba(40,20,25,0.04); }
[data-theme="light"] .hover\:text-white:hover { color: var(--ink); }

/* Chinese titles render in Songti (system Song/Ming serif); body font
   unchanged. No webfont — falls back to generic serif where Songti is absent. */
.zh-title {
  font-family: "Songti TC", "Songti SC", "SongTi", "Noto Serif TC", serif;
  font-style: normal;
}

