/* Hallmark · genre: modern-minimal · macrostructure: Narrative Workflow · theme: Cobalt · enrichment: E-diagram (Tier A CSS) · nav: N9 · footer: Ft1
 * tone: technical-austere · anchor hue: 262 (cobalt) · motion: GSAP ScrollTrigger (count-up · rail scrub · diagram draw)
 * pre-emit critique: P4 H5 E4 S5 R4 V5
 */
/* Hallmark · tokens · theme: Cobalt · paper: light (near-white) · display: grotesk-sans · accent: cool (cobalt 262) */
:root {
  --color-paper: oklch(99.3% 0.003 260);
  --color-paper-2: oklch(97.2% 0.006 260);
  --color-paper-3: oklch(94.5% 0.01 260);
  --color-ink: oklch(21% 0.025 265);
  --color-ink-2: oklch(40% 0.02 265);
  --color-ink-3: oklch(55% 0.015 265);
  --color-rule: oklch(90% 0.01 260);
  --color-accent: oklch(50% 0.2 262);
  --color-accent-soft: oklch(94% 0.035 262);
  --color-accent-ink: oklch(44% 0.19 262);
  --color-on-accent: oklch(99% 0.003 260);
  --color-focus: oklch(50% 0.2 262);
  --color-dot: oklch(82% 0.02 262);
  --color-glow: oklch(88% 0.08 262 / 0.55);
  --term-bg: oklch(97.2% 0.006 260);
  --term-rule: oklch(90% 0.01 260);
  --term-ink: oklch(24% 0.025 265);
  --term-dim: oklch(55% 0.015 265);
  --term-tool: oklch(46% 0.19 262);
  --term-ok: oklch(48% 0.13 155);
  --term-caret: oklch(50% 0.2 262);

  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --text-xs: 0.78rem;
  --text-sm: 0.9rem;
  --text-md: 1rem;
  --text-lg: 1.2rem;
  --text-xl: 1.6rem;
  --text-2xl: clamp(1.9rem, 4vw, 2.6rem);
  --text-stat: clamp(2.2rem, 5vw, 3.4rem);
  --text-display: clamp(2.6rem, 8vw, 5.6rem);

  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 7rem;

  --page-max: 72rem;
  --measure: 62ch;
  --page-gutter: clamp(1rem, 5vw, 3rem);
  --rule-hair: 1px;
  --radius-sm: 4px;
  --radius-md: 10px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 120ms;
  --dur-base: 220ms;
}

/* Dark theme · same hue anchors, inverted lightness */
:root[data-theme="dark"] {
  --color-paper: oklch(17% 0.018 265);
  --color-paper-2: oklch(21% 0.022 265);
  --color-paper-3: oklch(27% 0.026 265);
  --color-ink: oklch(94% 0.01 260);
  --color-ink-2: oklch(80% 0.014 262);
  --color-ink-3: oklch(66% 0.016 262);
  --color-rule: oklch(31% 0.02 265);
  --color-accent: oklch(68% 0.17 262);
  --color-accent-soft: oklch(30% 0.07 262);
  --color-accent-ink: oklch(76% 0.14 262);
  --color-on-accent: oklch(15% 0.02 265);
  --color-focus: oklch(76% 0.15 262);
  --color-dot: oklch(36% 0.03 262);
  --color-glow: oklch(45% 0.14 262 / 0.45);
  --term-bg: oklch(13% 0.016 265);
  --term-rule: oklch(30% 0.02 265);
  --term-ink: oklch(92% 0.01 260);
  --term-dim: oklch(64% 0.02 262);
  --term-tool: oklch(78% 0.13 262);
  --term-ok: oklch(78% 0.14 160);
  --term-caret: oklch(78% 0.13 262);
}


*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; color-scheme: light; scrollbar-color: var(--color-ink-3) var(--color-paper-2); }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
}

a {
  color: var(--color-accent-ink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }
a:active { color: var(--color-ink); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.wrap { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-gutter); }

.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; }
.skip { position: absolute; left: var(--space-md); top: -3rem; background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-sm); z-index: 20; }
.skip:focus-visible { top: var(--space-md); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-style: normal;
  color: var(--color-ink);
  overflow-wrap: anywhere;
  min-width: 0;
  margin: 0;
}

/* N9 · edge-aligned, sticky with scroll progress */
.nav-edge {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in oklch, var(--color-paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}
.nav-edge .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  height: 3.5rem;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  white-space: nowrap;
  color: var(--color-accent-ink);
  border: var(--rule-hair) solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-sm);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn-ghost:hover { background: var(--color-accent); color: var(--color-on-accent); }
.btn-ghost:active { transform: translateY(1px); }
.progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--color-accent);
  transform-origin: left center;
  transform: scaleX(0);
}

/* Hero */
.hero { padding-block: var(--space-3xl) var(--space-2xl); }
.hero h1 {
  font-size: var(--text-display);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.035em;
  max-width: none;
}
.hero h1 .tagline {
  margin-top: var(--space-md);
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-accent);
  max-width: 28ch;
}
.hero .line { display: block; }
.hero-meta {
  margin-top: var(--space-xl);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: end;
}
.hero-meta p { margin: 0; font-size: var(--text-lg); color: var(--color-ink-2); max-width: var(--measure); }
.contact {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  justify-self: end;
}
.contact a { white-space: nowrap; }
.contact .muted { color: var(--color-ink-3); }

/* T4 · stat strip */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: var(--rule-hair) solid var(--color-ink);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  margin: var(--space-xl) 0 0;
}
.stat { padding: var(--space-lg) var(--space-md) var(--space-lg) 0; }
.stat + .stat { padding-left: var(--space-md); border-left: var(--rule-hair) solid var(--color-rule); }
.stat-n {
  font-family: var(--font-display);
  font-size: var(--text-stat);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-l { margin-top: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-3); }

/* Section heads */
.section { padding-block-start: var(--space-3xl); }
.section-head h2 { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.section-head p { margin: var(--space-sm) 0 0; color: var(--color-ink-2); max-width: var(--measure); }

/* Narrative workflow — rail + stages */
.journey {
  margin-top: var(--space-2xl);
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  column-gap: var(--space-lg);
}
.rail { position: relative; }
.rail-track, .rail-fill {
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 2px;
  margin-left: -1px;
}
.rail-track { background: var(--color-rule); }
.rail-fill { background: var(--color-accent); transform-origin: top center; transform: scaleY(1); }
.stages { display: flex; flex-direction: column; gap: var(--space-2xl); }
.stage { position: relative; }
.stage-dot {
  position: absolute;
  left: calc(-1 * (var(--space-lg) + 1.25rem) - 6px);
  top: 0.4rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-paper);
  border: 2px solid var(--color-accent);
}
.stage-when { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-accent-ink); letter-spacing: 0.02em; }
.stage h3 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.015em; margin-top: var(--space-2xs); }
.stage .org { color: var(--color-ink-3); font-size: var(--text-sm); margin: var(--space-2xs) 0 var(--space-md); }
.stage ul { margin: 0; padding-left: 1.1em; max-width: 70ch; }
.stage li { margin-bottom: var(--space-xs); padding-left: var(--space-2xs); }
.stage li::marker { color: var(--color-ink-3); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-md); padding: 0; list-style: none; }
.tags li {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-2);
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.5rem;
  margin: 0;
  white-space: nowrap;
}

/* Stack grid */
.stack {
  margin-top: var(--space-2xl);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: var(--rule-hair) solid var(--color-ink);
}
.stack-col { padding: var(--space-lg) var(--space-lg) 0 0; }
.stack-col + .stack-col { padding-left: var(--space-lg); border-left: var(--rule-hair) solid var(--color-rule); }
.stack-col h3 { font-size: var(--text-md); font-weight: 600; }
.stack-col .tags { margin-top: var(--space-sm); }

/* Research */
.research { margin-top: var(--space-2xl); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xl); }
.paper { border-top: var(--rule-hair) solid var(--color-rule); padding-top: var(--space-md); }
.paper h3 { font-size: var(--text-lg); font-weight: 600; }
.paper .stage-when { display: block; margin-bottom: var(--space-2xs); }
.paper p { margin: var(--space-xs) 0 0; color: var(--color-ink-2); }

.edu { margin-top: var(--space-lg); color: var(--color-ink-2); }

/* Ft1 · mast-headed */
.foot {
  margin-top: var(--space-3xl);
  border-top: var(--rule-hair) solid var(--color-ink);
  padding: var(--space-xl) 0 var(--space-2xl);
}
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-md); }
.foot-mark { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; }
.foot-links { display: flex; flex-wrap: wrap; gap: var(--space-lg); font-family: var(--font-mono); font-size: var(--text-sm); }
.foot-links a { white-space: nowrap; }


/* Hero art · Tier B hand-built SVG */
.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  column-gap: var(--space-2xl);
  align-items: center;
}
.hero-copy { display: contents; }
.hero-top h1 { grid-column: 1 / -1; }
.hero-top .hero-meta { margin-top: 0; }
.hero-top .hero-meta { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
.hero-top .contact { justify-self: start; flex-direction: row; flex-wrap: wrap; column-gap: var(--space-lg); }
.hero-art { margin: var(--space-lg) 0 0; min-width: 0; max-width: 27rem; justify-self: end; width: 100%; }
.hero-art svg { display: block; width: 100%; height: auto; overflow: visible; }
.hero-art figcaption { margin-top: var(--space-xs); text-align: center; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); }
.art-link { stroke: var(--color-rule); stroke-width: 1.5; }
.art-pulse { fill: var(--color-accent); opacity: 0; }
.art-node circle { fill: var(--color-paper); stroke: var(--color-accent); stroke-width: 1.5; }
.art-label { font-family: var(--font-mono); font-size: 11px; fill: var(--color-ink-2); }
.art-core circle { fill: var(--color-accent); }
.art-core .art-halo { fill: var(--color-accent-soft); }
.art-core-label { font-family: var(--font-display); font-size: 15px; font-weight: 600; fill: var(--color-on-accent); }
.art-core-sub { font-family: var(--font-mono); font-size: 10px; fill: var(--color-on-accent); opacity: 0.85; }

/* Stage figures */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 17rem); column-gap: var(--space-xl); align-items: start; }
.stage-body { min-width: 0; }
.stage-fig {
  margin: var(--space-xl) 0 0;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  background: var(--color-paper-2);
  padding: var(--space-md);
  min-width: 0;
  position: sticky;
  top: 5rem;
}
.stage-fig svg { display: block; width: 100%; height: auto; }
.stage-fig figcaption { margin-top: var(--space-sm); font-size: var(--text-xs); color: var(--color-ink-3); line-height: 1.45; }
.fig-head { display: flex; justify-content: space-between; gap: var(--space-xs); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-2); margin-bottom: var(--space-sm); }
.fig-head b { color: var(--color-accent-ink); }

.sc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.sc-item { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-xs); color: var(--color-ink-3); line-height: 1.35; transition: color var(--dur-base) var(--ease-out); }
.sc-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--color-ink-3); background: var(--color-paper); transition: background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out); }
.sc-item.is-pass { color: var(--color-ink); }
.sc-item.is-pass .sc-dot { background: var(--color-accent); border-color: var(--color-accent); }
.meter { margin-top: var(--space-md); height: 4px; border-radius: 2px; background: var(--color-paper-3); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--color-accent); transform-origin: left center; transform: scaleX(1); }

.wave-bar { fill: var(--color-accent); transform-box: fill-box; transform-origin: center; }
.dub-steps { list-style: none; margin: var(--space-sm) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2xs); }
.dub-steps li { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; color: var(--color-ink); background: var(--color-paper); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-sm); padding: var(--space-2xs); text-align: center; overflow-wrap: anywhere; }
.dub-steps small { display: block; font-weight: 400; color: var(--color-ink-3); }

.anomaly .thr { stroke: var(--color-ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.anomaly .sig { fill: none; stroke: var(--color-ink-2); stroke-width: 1.5; stroke-linejoin: round; }
.anomaly .anom { fill: var(--color-accent); }
.anomaly .anom-ring { fill: none; stroke: var(--color-accent); stroke-width: 1.5; }

@media (max-width: 860px) {
  .hero-top { grid-template-columns: minmax(0, 1fr); }
  .hero-art { justify-self: start; }
  .hero-top .hero-meta { margin-top: var(--space-xl); }
  .stage { grid-template-columns: minmax(0, 1fr); }
  .stage-fig { max-width: 24rem; position: static; }
}


/* Hero backdrop · dot grid + cursor spotlight (HP3) */
.hero { position: relative; isolation: isolate; }
.hero-bg {
  position: absolute;
  inset: 0 calc(-1 * var(--page-gutter));
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--color-dot) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 35%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 70% 35%, #000 20%, transparent 75%);
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(260px circle at var(--mx, 70%) var(--my, 35%), var(--color-glow), transparent 70%);
  opacity: var(--glow, 0);
  transition: opacity var(--dur-base) var(--ease-out);
}
.hero-name .ch { display: inline-block; will-change: transform; }

/* Tech marquee */
.marquee {
  margin-top: var(--space-2xl);
  border-block: var(--rule-hair) solid var(--color-rule);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  list-style: none;
  margin: 0;
  padding: var(--space-md) 0;
  animation: marquee 48s linear infinite;
}
.marquee-track li {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-ink-3);
  padding-inline: var(--space-lg);
  white-space: nowrap;
}
.marquee-track li::after { content: "·"; margin-left: var(--space-lg); color: var(--color-accent); }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; justify-content: center; }
  .marquee-track li:nth-child(n+19) { display: none; }
}

/* By the numbers */
.numbers {
  margin-top: var(--space-2xl);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: var(--space-lg);
}
.chart {
  margin: 0;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  background: var(--color-paper-2);
  padding: var(--space-lg);
  min-width: 0;
}
.chart figcaption { margin-top: var(--space-md); font-size: var(--text-xs); color: var(--color-ink-3); }
.cols {
  height: 15rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-lg);
  align-items: end;
  border-bottom: var(--rule-hair) solid var(--color-ink-3);
  padding-top: var(--space-lg);
}
.col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.col-bar {
  width: 100%;
  max-width: 4.5rem;
  height: var(--h);
  background: linear-gradient(180deg, var(--color-accent), var(--color-accent-ink));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transform-origin: bottom center;
  position: relative;
}
.col-v {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -0.35rem);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}
.col-l { position: absolute; top: 100%; margin-top: var(--space-xs); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); }
.chart-cols figcaption { margin-top: var(--space-xl); }

.legend { display: inline-flex; align-items: center; gap: var(--space-2xs); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: var(--space-xs); }
.lg-before { background: var(--color-paper-3); border: var(--rule-hair) solid var(--color-ink-3); }
.lg-after { background: var(--color-accent); }
.cmp-row {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 3.2rem;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md) 0;
  border-top: var(--rule-hair) solid var(--color-rule);
}
.cmp-row:first-of-type { border-top: 0; }
.cmp-label b { display: block; font-size: var(--text-sm); }
.cmp-label span { font-size: var(--text-xs); color: var(--color-ink-3); line-height: 1.35; display: block; }
.cmp-bars { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bar {
  height: 1.35rem;
  width: var(--w);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: var(--space-xs);
  transform-origin: left center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
}
.bar-before { background: var(--color-paper-3); color: var(--color-ink-2); }
.bar-after { background: var(--color-accent); color: var(--color-on-accent); }
.cmp-delta { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--color-accent-ink); text-align: right; font-variant-numeric: tabular-nums; }

/* Pinned pipeline */
.pipe-sec { padding-bottom: var(--space-lg); background: var(--color-paper); }
.pipe {
  margin-top: var(--space-2xl);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: center;
}
.pipe-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.pipe-step {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: var(--rule-hair) solid transparent;
  transition: background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.pipe-n { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-accent-ink); padding-top: 0.2rem; }
.pipe-step h3 { font-size: var(--text-lg); font-weight: 600; }
.pipe-step p { margin: var(--space-2xs) 0 0; color: var(--color-ink-2); font-size: var(--text-sm); }
.pipe-step .tags { margin-top: var(--space-sm); }
.pipe.is-pinned .pipe-step h3 { color: var(--color-ink-3); }
.pipe.is-pinned .pipe-step .pipe-n { color: var(--color-ink-3); }
.pipe.is-pinned .pipe-step.is-active h3 { color: var(--color-ink); }
.pipe.is-pinned .pipe-step.is-active .pipe-n { color: var(--color-accent-ink); }
.pipe.is-pinned .pipe-step.is-active { opacity: 1; background: var(--color-paper-2); border-color: var(--color-rule); }
.pipe.is-pinned .pipe-step:not(.is-active) p,
.pipe.is-pinned .pipe-step:not(.is-active) .tags { display: none; }
.pipe-visual svg { display: block; width: 100%; max-width: 15rem; margin-inline: auto; height: auto; }
.pv-rail { stroke: var(--color-rule); stroke-width: 2; }
.pv-fill { stroke: var(--color-accent); stroke-width: 2; transform-origin: 110px 40px; }
.pv-node rect { fill: var(--color-paper); stroke: var(--color-rule); stroke-width: 1.5; transition: fill var(--dur-base) var(--ease-out), stroke var(--dur-base) var(--ease-out); }
.pv-t { font-family: var(--font-display); font-size: 15px; font-weight: 600; fill: var(--color-ink-3); transition: fill var(--dur-base) var(--ease-out); }
.pv-node.is-on rect { stroke: var(--color-accent); }
.pv-node.is-active rect { fill: var(--color-accent); stroke: var(--color-accent); }
.pv-node.is-active .pv-t { fill: var(--color-on-accent); }
.pv-node.is-on .pv-t { fill: var(--color-ink); }
.pv-token { fill: var(--color-accent); stroke: var(--color-paper); stroke-width: 3; }


/* Nav actions */
.nav-actions { display: flex; align-items: center; gap: var(--space-xs); }
.nav-btn {
  display: inline-flex; align-items: center; gap: var(--space-2xs);
  height: 2rem; padding: 0 var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-sm);
  background: var(--color-paper); color: var(--color-ink-2);
  font-family: var(--font-mono); font-size: var(--text-xs);
  cursor: pointer; white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.nav-btn:hover { border-color: var(--color-accent); color: var(--color-ink); }
.nav-btn:active { transform: translateY(1px); }
.nav-btn kbd { font-family: var(--font-mono); font-size: 0.7rem; color: var(--color-ink-3); border: var(--rule-hair) solid var(--color-rule); border-radius: 3px; padding: 0 0.25rem; }
.lang-sep { color: var(--color-ink-3); }
html[lang="en"] .lang-en, html[lang="vi"] .lang-vi { color: var(--color-accent-ink); font-weight: 600; }
.theme-toggle { width: 2rem; justify-content: center; padding: 0; }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle svg { display: none; }
:root[data-theme-mode="light"] .theme-toggle .i-sun,
:root[data-theme-mode="dark"] .theme-toggle .i-moon,
:root[data-theme-mode="system"] .theme-toggle .i-auto,
:root:not([data-theme-mode]) .theme-toggle .i-sun { display: block; }
.btn-ghost { height: 2rem; }
@media (max-width: 600px) {
  .cmdk-open span, .cmdk-open kbd { display: none; }
  .cmdk-open::before { content: "⌘"; }
  .wordmark { font-size: var(--text-sm); }
  .nav-actions { gap: 4px; }
  .nav-btn, .btn-ghost { padding: 0 var(--space-xs); }
  .theme-toggle { width: 2rem; padding: 0; }
}
@media (max-width: 380px) {
  .wordmark { font-size: 0; }
  .wordmark::before { content: "TBT"; font-size: var(--text-md); letter-spacing: 0.02em; }
}

/* Hero 3D canvas (desktop, progressive) */
.hero-3d {
  position: absolute;
  inset: 0 calc(-1 * var(--page-gutter));
  width: calc(100% + 2 * var(--page-gutter));
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms var(--ease-out);
}
.hero.has-3d .hero-3d { opacity: 1; }
.hero.has-3d .hero-bg { opacity: 0.35; }

/* Agent terminal */
.agent-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--space-2xl); align-items: start; }
.agent-notes { list-style: none; margin: var(--space-lg) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.agent-notes li { padding-left: var(--space-md); border-left: 2px solid var(--color-accent); color: var(--color-ink-2); font-size: var(--text-sm); }
.agent-notes b { color: var(--color-ink); }
.term {
  margin: 0;
  border: var(--rule-hair) solid var(--term-rule);
  border-radius: var(--radius-md);
  background: var(--term-bg);
  color: var(--term-ink);
  overflow: hidden;
  min-width: 0;
}
.term-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-xs) var(--space-md); border-bottom: var(--rule-hair) solid var(--term-rule); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--term-dim); }
.term-replay { font: inherit; color: var(--term-tool); background: var(--color-paper); border: var(--rule-hair) solid var(--term-rule); border-radius: var(--radius-sm); padding: 0.1rem 0.5rem; cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out); }
.term-replay:hover { border-color: var(--term-tool); }
.term-replay:active { transform: translateY(1px); }
.term-body { margin: 0; padding: var(--space-md); min-height: 21rem; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out .t-user { color: var(--term-ink); font-weight: 600; }
.term-out .t-dim { color: var(--term-dim); }
.term-out .t-tool { color: var(--term-tool); }
.term-out .t-ok { color: var(--term-ok); }
.term-out .t-ans { color: var(--term-ink); }
.term-caret { display: inline-block; width: 0.55em; height: 1.1em; vertical-align: text-bottom; background: var(--term-caret); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.term figcaption { padding: var(--space-xs) var(--space-md) var(--space-sm); font-size: var(--text-xs); color: var(--term-dim); border-top: var(--rule-hair) solid var(--term-rule); }

.more-link { display: inline-block; margin-top: var(--space-md); font-family: var(--font-mono); font-size: var(--text-sm); white-space: nowrap; }

/* Interactive anomaly */
.anomaly .pts circle { fill: var(--color-ink-3); transition: fill var(--dur-fast) var(--ease-out); }
.anomaly .pts circle.is-flag { fill: var(--color-accent); }
.an-ctl { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-2); }
.an-range { flex: 1; accent-color: var(--color-accent); min-width: 0; }
.fig-head .an-n { color: var(--color-accent-ink); }

/* Selected work · horizontal gallery */
.work-viewport { margin-top: var(--space-2xl); overflow: hidden; }
.work-track {
  list-style: none; margin: 0;
  padding: var(--space-xs) var(--page-gutter) var(--space-lg);
  padding-inline-start: max(var(--page-gutter), calc((100vw - var(--page-max)) / 2 + var(--page-gutter)));
  display: flex; gap: var(--space-lg);
  width: max-content;
}
.work-card { width: min(24rem, 80vw); flex: none; }
.work-card a {
  display: flex; flex-direction: column; height: 100%;
  min-height: 19rem;
  padding: var(--space-lg);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  background: var(--color-paper-2);
  color: var(--color-ink);
  text-decoration: none;
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.work-card a:hover { border-color: var(--color-accent); background: var(--color-paper); }
.wc-k { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-accent-ink); }
.work-card h3 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; margin-top: var(--space-md); }
.work-card p { color: var(--color-ink-2); margin: var(--space-sm) 0 0; }
.wc-cta { margin-top: auto; padding-top: var(--space-lg); font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-accent-ink); white-space: nowrap; }
.work-sec .section-head { padding-inline: var(--page-gutter); }
.work-sec > .wrap.section-head { padding-inline: var(--page-gutter); }
@media (max-width: 860px) {
  .work-viewport { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .work-viewport::-webkit-scrollbar { display: none; }
  .work-card { scroll-snap-align: start; }
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
}


/* Work gallery controls */
.work-ctl { display: flex; align-items: center; gap: var(--space-md); margin-top: var(--space-xl); }
.work-hint { display: inline-flex; align-items: center; gap: var(--space-xs); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-2); white-space: nowrap; }
.work-hint svg { width: 28px; height: 12px; fill: none; stroke: var(--color-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; animation: nudge 1.6s var(--ease-in-out) infinite; }
@keyframes nudge { 50% { transform: translateX(6px); } }
.hint-touch { display: none; }
@media (hover: none) { .hint-desk { display: none; } .hint-touch { display: inline; } }
.work-progress { flex: 1; height: 2px; background: var(--color-rule); border-radius: 1px; overflow: hidden; min-width: 2rem; }
.work-progress-fill { display: block; height: 100%; background: var(--color-accent); transform-origin: left center; transform: scaleX(0.2); }
.work-count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.work-count b { color: var(--color-ink); }
.work-prev, .work-next { width: 2rem; justify-content: center; padding: 0; font-family: var(--font-body); font-size: var(--text-md); }
.work-prev:disabled, .work-next:disabled { opacity: 0.35; cursor: default; }
.work-ctl + .work-viewport { margin-top: var(--space-lg); }
.work-viewport.is-hover-pan { cursor: ew-resize; }
.work-viewport.is-hover-pan .work-card a { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .work-hint svg { animation: none; } }

/* Open source live stats */
.oss { margin-top: var(--space-2xl); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-md); align-items: end; }
.oss-item { display: flex; flex-direction: column; gap: var(--space-2xs); padding: var(--space-md); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-md); text-decoration: none; color: var(--color-ink); transition: border-color var(--dur-fast) var(--ease-out); }
.oss-item:hover { border-color: var(--color-accent); }
.oss-n { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.oss-l { font-size: var(--text-xs); color: var(--color-ink-3); }
.oss-src { grid-column: 1 / -1; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); }
@media (max-width: 860px) { .oss { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Command palette */
.cmdk { padding: 0; border: 0; background: transparent; width: min(36rem, calc(100vw - 2rem)); margin-top: 12vh; color: var(--color-ink); }
.cmdk::backdrop { background: oklch(20% 0.02 265 / 0.35); backdrop-filter: blur(3px); }
.cmdk-box { margin: 0; background: var(--color-paper); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-md); box-shadow: 0 24px 60px -20px oklch(20% 0.04 265 / 0.35); overflow: hidden; }
.cmdk-input { width: 100%; border: 0; border-bottom: var(--rule-hair) solid var(--color-rule); padding: var(--space-md) var(--space-lg); font: inherit; font-size: var(--text-lg); background: transparent; color: var(--color-ink); outline: none; }
.cmdk-list { list-style: none; margin: 0; padding: var(--space-xs); max-height: 50vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--color-rule) transparent; }
.cmdk-list li { display: flex; justify-content: space-between; gap: var(--space-md); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); cursor: pointer; }
.cmdk-list li small { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); }
.cmdk-list li[aria-selected="true"] { background: var(--color-accent-soft); }
.cmdk-list li[aria-selected="true"] small { color: var(--color-accent-ink); }
.cmdk-foot { margin: 0; padding: var(--space-xs) var(--space-lg); border-top: var(--rule-hair) solid var(--color-rule); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); }
.cmdk-foot kbd { border: var(--rule-hair) solid var(--color-rule); border-radius: 3px; padding: 0 0.3rem; margin-right: 2px; }

/* Custom cursor (fine pointers only, set by JS) */
.cursor { display: none; }
.has-cursor .cursor { display: block; opacity: 0; transition: opacity var(--dur-base) var(--ease-out); position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.cursor-dot, .cursor-ring { position: fixed; left: 0; top: 0; border-radius: 50%; pointer-events: none; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--color-accent); }
.cursor-ring { width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1.5px solid var(--color-accent); opacity: 0.45; transition: width var(--dur-base) var(--ease-out), height var(--dur-base) var(--ease-out), margin var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
.cursor.is-live { opacity: 1; }
.cursor.is-hover .cursor-ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; opacity: 0.8; }
.tilt { transform-style: preserve-3d; will-change: transform; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }


/* Bilingual blocks (case studies) */
html[lang="vi"] .l-en, html[lang="en"] .l-vi { display: none; }

/* Case study pages */
.cs-main { padding-block: var(--space-2xl) var(--space-3xl); max-width: 52rem; }
.cs-kicker { display: flex; flex-wrap: wrap; gap: var(--space-md); justify-content: space-between; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-accent-ink); margin: 0 0 var(--space-lg); }
.cs-title { font-size: clamp(2.2rem, 6vw, 3.8rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; }
.cs-dek { font-size: var(--text-lg); color: var(--color-ink-2); margin: var(--space-md) 0 0; max-width: var(--measure); }
.cs-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: var(--space-2xl) 0; border-top: var(--rule-hair) solid var(--color-ink); border-bottom: var(--rule-hair) solid var(--color-rule); }
.cs-metrics div { padding: var(--space-md) var(--space-md) var(--space-md) 0; }
.cs-metrics div + div { padding-left: var(--space-md); border-left: var(--rule-hair) solid var(--color-rule); }
.cs-metrics dt { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; }
.cs-metrics dd { margin: var(--space-2xs) 0 0; font-size: var(--text-xs); color: var(--color-ink-3); }
.cs-sec { margin-top: var(--space-2xl); max-width: var(--measure); }
.cs-sec h2 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.015em; }
.cs-sec p { color: var(--color-ink-2); }
.cs-sec ul { padding-left: 1.1em; color: var(--color-ink-2); }
.cs-sec li { margin-bottom: var(--space-xs); }
.cs-sec li::marker { color: var(--color-accent); }
.cs-stack { margin-top: var(--space-2xl); }
.cs-next { margin-top: var(--space-2xl); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
.cs-next a { display: flex; flex-direction: column; gap: var(--space-2xs); padding: var(--space-lg); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-md); text-decoration: none; color: var(--color-ink-3); font-size: var(--text-xs); font-family: var(--font-mono); transition: border-color var(--dur-fast) var(--ease-out); }
.cs-next a:hover { border-color: var(--color-accent); }
.cs-next b { font-family: var(--font-display); font-size: var(--text-lg); color: var(--color-ink); font-weight: 600; }
@media (max-width: 640px) {
  .cs-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-metrics div:nth-child(3) { padding-left: 0; border-left: 0; }
  .cs-metrics div:nth-child(n+3) { border-top: var(--rule-hair) solid var(--color-rule); }
  .cs-next { grid-template-columns: minmax(0, 1fr); }
}

/* Responsive */
@media (max-width: 860px) {
  .numbers { grid-template-columns: minmax(0, 1fr); }
  .pipe { grid-template-columns: minmax(0, 1fr); }
  .pipe-visual { display: none; }
  .cmp-row { grid-template-columns: minmax(0, 1fr) 3rem; }
  .cmp-bars { grid-column: 1 / -1; grid-row: 2; }
  .hero-meta { grid-template-columns: minmax(0, 1fr); }
  .contact { justify-self: start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: var(--rule-hair) solid var(--color-rule); }
  .stack { grid-template-columns: minmax(0, 1fr); }
  .stack-col, .stack-col + .stack-col { padding: var(--space-lg) 0 0; border-left: 0; }
  .research { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat + .stat { padding-left: 0; border-left: 0; border-top: var(--rule-hair) solid var(--color-rule); }
  .journey { grid-template-columns: 1.25rem minmax(0, 1fr); column-gap: var(--space-md); }
  .stage-dot { left: calc(-1 * (var(--space-md) + 0.625rem) - 6px); }
}

@media print {
  .cursor, .cmdk, .term, .work-sec, .oss, .nav-edge, .skip, .foot, .hero-art, .stage-fig, .hero-bg, .marquee, .pipe-visual, .numbers { display: none; }
  body { font-size: 10pt; }
  .section { padding-block-start: 14pt; }
  .hero { padding-block: 0 10pt; }
  .stage, .paper { break-inside: avoid; }
}
