/* ==========================================================================
   Conrad Buenviaje — portfolio styles
   Dark-first, layered surfaces, spring motion, tabular numbers.
   Edit the tokens in :root to re-theme the whole site.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- Ground & surfaces (layered, never one flat colour) --- */
  --bg: #09090b;
  --bg-raise: #0f0f12;
  --surface: rgb(255 255 255 / 0.035);
  --surface-hi: rgb(255 255 255 / 0.06);
  --line: rgb(255 255 255 / 0.08);
  --line-hi: rgb(255 255 255 / 0.16);

  /* --- Text (all pairs pass WCAG AA on --bg) --- */
  --text: #ededf0;
  --text-2: #a1a1aa;   /* 7.9:1 on --bg */
  --text-3: #8b8b95;   /* 5.6:1 on --bg, labels only */

  /* --- Accents: warm signal + cool counter-light (no purple gradients) --- */
  --signal: #ff7a45;
  --signal-ink: #1a0b04;
  --cool: #3dd9c5;
  --gold: #f5c84c;

  /* --- Type --- */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  /* --- Shape --- */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;

  /* --- Motion: --ease-spring is replaced at runtime by a real spring curve (see site.js) --- */
  --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 700ms;

  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient lighting behind the whole page: two soft, low-opacity glows + fine grain */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 120vh;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(40vw 30vh at 78% 12%, rgb(255 122 69 / 0.13), transparent 70%),
    radial-gradient(36vw 28vh at 12% 40%, rgb(61 217 197 / 0.07), transparent 70%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: radial-gradient(rgb(255 255 255) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
::selection { background: var(--signal); color: var(--signal-ink); }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

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

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

/* ---------- Primitives ---------- */

/* Eyebrow / mono label */
.label {
  font: 500 0.75rem/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Status dot badge, e.g. "Live" */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 0.03);
  font: 500 0.7rem/1.4 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--text-2);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
}
.badge[data-status="live"]::before { background: var(--cool); box-shadow: 0 0 8px var(--cool); }
.badge[data-status="working"]::before { background: var(--gold); }
.badge[data-status="prototype"]::before { background: var(--text-3); }
.badge[data-status="public"]::before { background: var(--signal); }

/* Chips for tools / stack */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.chips li {
  padding: 3px 9px;
  border-radius: 7px;
  background: rgb(255 255 255 / 0.045);
  box-shadow: inset 0 0 0 1px var(--line);
  font: 500 0.72rem/1.5 var(--font-mono);
  color: var(--text-2);
}

/* Layered panel: translucent fill, inner highlight, gradient-faded border */
.panel {
  position: relative;
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.045), rgb(255 255 255 / 0.015));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 1px 2px rgb(0 0 0 / 0.4),
    0 20px 40px -24px rgb(0 0 0 / 0.6);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  isolation: isolate;
}
/* Gradient border that fades out toward the bottom-right */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--line-hi), rgb(255 255 255 / 0.04) 45%, rgb(255 255 255 / 0.02));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
/* Cursor-tracked glow (position set by site.js via --mx/--my) */
.panel.glow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgb(255 122 69 / 0.10), transparent 60%);
}
.panel.glow:hover::after { opacity: 1; }

/* Buttons */
.btn {
  --lift: 0px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  font: 600 0.95rem/1 var(--font-sans);
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transform: translateY(var(--lift));
  transition: transform 500ms var(--ease-spring), box-shadow 300ms var(--ease-out), background 300ms;
}
.btn:hover { --lift: -2px; }
.btn:active { --lift: 1px; transition-duration: 120ms; }
.btn--primary {
  background: linear-gradient(180deg, #ff8d5c, var(--signal));
  color: var(--signal-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), 0 8px 24px -8px rgb(255 122 69 / 0.6);
}
.btn--ghost {
  background: rgb(255 255 255 / 0.04);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-hi);
}
.btn--ghost:hover { background: rgb(255 255 255 / 0.07); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Section heading block */
.section { padding-block: clamp(72px, 12vw, 140px); position: relative; }
.section-head { max-width: 720px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2 {
  margin: 12px 0 14px;
  font: 650 clamp(1.9rem, 5vw, 3rem)/1.05 var(--font-display);
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.section-head p { margin: 0; color: var(--text-2); font-size: 1.05rem; text-wrap: pretty; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-block: 12px;
}
.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: rgb(15 15 18 / 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 30px -18px rgb(0 0 0 / 0.8);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #ff8d5c, #e8552a);
  color: var(--signal-ink);
  font: 800 0.8rem/1 var(--font-mono);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35);
}
.nav { display: none; gap: 2px; }
.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 200ms, background 200ms;
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--text); background: rgb(255 255 255 / 0.06); }
.site-header .btn { min-height: 38px; padding: 0 16px; font-size: 0.875rem; }
@media (min-width: 820px) { .nav { display: flex; } }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(28px, 6vw, 72px); padding-bottom: clamp(56px, 9vw, 110px); }
.hero-grid {
  display: grid;
  gap: clamp(36px, 6vw, 64px);
  align-items: center;
}
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; } }

.hero-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hero h1 {
  margin: 20px 0 6px;
  font: 700 clamp(2.9rem, 11vw, 6.4rem)/0.92 var(--font-display);
  letter-spacing: -0.055em;
}
.hero h1 .accent {
  background: linear-gradient(100deg, var(--text) 30%, #ffb08e 70%, var(--signal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .fullname { margin: 0 0 22px; color: var(--text-3); font: 500 0.82rem/1.4 var(--font-mono); letter-spacing: 0.02em; }
.hero .lede {
  max-width: 34ch;
  margin: 0 0 30px;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  line-height: 1.45;
  color: var(--text-2);
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
.hero .lede strong { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* Ideas → Systems → Impact rail */
.triad {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
  font: 500 0.8rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.triad li { display: inline-flex; align-items: center; gap: 8px; }
.triad li + li::before { content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, var(--line-hi), var(--signal)); }

/* Portrait frame: layered stack with glow */
.portrait {
  position: relative;
  margin: 0 auto;
  width: min(100%, 440px);
}
.portrait::before {
  content: "";
  position: absolute;
  inset: 8% -6% -4% 6%;
  border-radius: var(--r-lg);
  background: radial-gradient(60% 60% at 50% 40%, rgb(255 122 69 / 0.35), transparent 70%);
  filter: blur(40px);
  z-index: -1;
}
.portrait .frame {
  padding: 8px;
  border-radius: calc(var(--r-lg) + 6px);
  transform: rotate(-1.2deg);
  transition: transform 900ms var(--ease-spring);
}
.portrait:hover .frame { transform: rotate(0deg) scale(1.01); }
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-lg); }
.portrait figcaption {
  position: absolute;
  left: -6px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgb(15 15 18 / 0.75);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px var(--line-hi), 0 12px 30px -12px rgb(0 0 0 / 0.8);
  font-size: 0.82rem;
  color: var(--text-2);
}
.portrait figcaption b { color: var(--text); font-weight: 600; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cool);
  box-shadow: 0 0 0 0 rgb(61 217 197 / 0.6);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgb(61 217 197 / 0); } 100% { box-shadow: 0 0 0 0 rgb(61 217 197 / 0); } }

/* ---------- Stats with digit roll-up ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: clamp(48px, 8vw, 80px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--line);
  box-shadow: inset 0 0 0 1px var(--line);
}
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: clamp(18px, 3vw, 28px); background: var(--bg-raise); }
.stat .num {
  display: flex;
  align-items: baseline;
  font: 650 clamp(2rem, 5vw, 2.8rem)/1 var(--font-display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stat .num .suffix { color: var(--signal); margin-left: 2px; }
.stat p { margin: 10px 0 0; color: var(--text-2); font-size: 0.88rem; line-height: 1.45; }

/* Rolling digits (built by site.js). Each digit is a 0-9 column translated into view. */
.roll { display: inline-flex; overflow: hidden; height: 1em; line-height: 1; }
.roll .col { display: flex; flex-direction: column; transition: transform 1400ms var(--ease-spring); }
.roll .col span { height: 1em; }

/* ---------- About ---------- */
.about-grid { display: grid; gap: clamp(28px, 5vw, 56px); align-items: start; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 0.75fr 1.25fr; } }
.about-photo { padding: 8px; border-radius: calc(var(--r-lg) + 6px); max-width: 360px; }
.about-photo img { border-radius: var(--r-lg); aspect-ratio: 1; object-fit: cover; }
.about-copy .label { margin: 0 0 14px; }
.about-copy p { margin: 0 0 18px; color: var(--text-2); font-size: 1.08rem; text-wrap: pretty; }
.about-copy p.lead { color: var(--text); font-size: clamp(1.25rem, 2.6vw, 1.55rem); line-height: 1.4; letter-spacing: -0.015em; }
.about-copy strong { color: var(--text); font-weight: 600; }

/* ---------- Capabilities ---------- */
.cap-grid { display: grid; gap: 14px; }
@media (min-width: 680px) { .cap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cap { padding: clamp(22px, 3vw, 30px); }
.cap .icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, rgb(255 122 69 / 0.18), rgb(255 122 69 / 0.06));
  box-shadow: inset 0 0 0 1px rgb(255 122 69 / 0.25);
  color: var(--signal);
}
.cap .icon svg { width: 20px; height: 20px; }
.cap h3 { margin: 18px 0 8px; font: 620 1.2rem/1.25 var(--font-display); letter-spacing: -0.02em; }
.cap p { margin: 0 0 18px; color: var(--text-2); font-size: 0.96rem; }

/* ---------- Story timeline ---------- */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--signal), var(--line-hi) 30%, var(--line) 85%, transparent);
}
.chapter { position: relative; padding-left: 36px; padding-bottom: clamp(36px, 6vw, 56px); }
.chapter:last-child { padding-bottom: 0; }
.chapter::before {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-hi), 0 0 0 4px var(--bg);
}
.chapter:first-child::before { background: var(--signal); box-shadow: 0 0 0 4px var(--bg), 0 0 16px rgb(255 122 69 / 0.6); }
.chapter-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 14px; }
.chapter-head .years { font: 600 0.8rem/1 var(--font-mono); color: var(--signal); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.chapter-head h3 { margin: 0; font: 640 clamp(1.3rem, 3vw, 1.7rem)/1.15 var(--font-display); letter-spacing: -0.03em; }
.chapter > p { max-width: 70ch; margin: 0 0 18px; color: var(--text-2); }
.roles { display: grid; gap: 10px; }
@media (min-width: 760px) { .roles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.role { padding: 18px 20px; border-radius: var(--r-md); }
.role .when { font: 500 0.75rem/1.3 var(--font-mono); color: var(--text-3); font-variant-numeric: tabular-nums; }
.role h4 { margin: 6px 0 2px; font-size: 1.02rem; font-weight: 620; letter-spacing: -0.01em; }
.role .org { margin: 0 0 10px; color: var(--text-2); font-size: 0.9rem; }
.role ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 0.9rem; }
.role li { margin-bottom: 4px; }
.role li::marker { color: var(--signal); }
.built-here { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.built-here .label { margin-right: 4px; }
.built-here a {
  font-size: 0.82rem; color: var(--text); text-decoration: none;
  padding: 3px 10px; border-radius: 999px;
  background: rgb(255 122 69 / 0.1); box-shadow: inset 0 0 0 1px rgb(255 122 69 / 0.3);
  transition: background 200ms;
}
.built-here a:hover { background: rgb(255 122 69 / 0.2); }

/* ---------- Creative work ---------- */
.work-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  display: block;
  padding: 8px;
  border-radius: calc(var(--r-md) + 8px);
  text-decoration: none;
  transform: translateY(0);
  transition: transform 600ms var(--ease-spring);
}
.tile:hover { transform: translateY(-4px); }
.tile .media {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1a1a1f, #111114);
}
.tile .media img { width: 100%; height: 100%; object-fit: cover; transition: transform 900ms var(--ease-spring); }
.tile:hover .media img { transform: scale(1.04); }
.tile .meta { padding: 14px 8px 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tile h3 { margin: 0 0 3px; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.tile .meta p { margin: 0; color: var(--text-2); font-size: 0.86rem; }
.tile .arrow { flex: none; width: 18px; height: 18px; color: var(--text-3); transition: transform 500ms var(--ease-spring), color 200ms; }
.tile:hover .arrow { transform: translate(2px, -2px); color: var(--signal); }

/* Video facade: thumbnail button that swaps itself for a privacy-enhanced YouTube iframe */
.video { padding: 8px; border-radius: calc(var(--r-md) + 8px); }
.video .player {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #111114;
  cursor: pointer;
  color: inherit;
}
.video .player img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity 300ms, transform 900ms var(--ease-spring); }
.video .player:hover img { opacity: 1; transform: scale(1.03); }
.video .player .play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 60px; height: 60px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgb(15 15 18 / 0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px var(--line-hi);
  transition: transform 500ms var(--ease-spring), background 200ms;
}
.video .player:hover .play { transform: scale(1.08); background: var(--signal); color: var(--signal-ink); }
.video .player .play svg { width: 22px; height: 22px; margin-left: 3px; }
.video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--r-md); }
.video .meta { padding: 14px 8px 8px; }
.video h3 { margin: 0 0 3px; font-size: 1rem; font-weight: 600; }
.video .meta p { margin: 0; color: var(--text-2); font-size: 0.86rem; }

.subhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; margin: clamp(48px, 7vw, 72px) 0 18px; }
.subhead:first-of-type { margin-top: 0; }
.subhead h3 { margin: 0; font: 630 1.35rem/1.2 var(--font-display); letter-spacing: -0.025em; }
.subhead a { color: var(--text-2); font-size: 0.9rem; text-decoration: none; }
.subhead a:hover { color: var(--signal); }

.credits { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 1px; border-radius: var(--r-md); overflow: hidden; background: var(--line); }
.credits li { background: var(--bg-raise); }
.credits a { display: flex; justify-content: space-between; gap: 14px; padding: 14px 18px; text-decoration: none; transition: background 200ms; }
.credits a:hover { background: var(--surface-hi); }
.credits .t { font-size: 0.95rem; }
.credits .r { font: 500 0.75rem/1.6 var(--font-mono); color: var(--text-3); white-space: nowrap; }

/* ---------- Systems ---------- */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.04);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-2);
  font: 500 0.85rem/1 var(--font-sans);
  cursor: pointer;
  transition: background 200ms, color 200ms, box-shadow 200ms;
}
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: none; }
.filters button .count { margin-left: 6px; font-variant-numeric: tabular-nums; opacity: 0.6; }

.sys-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .sys-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .sys-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sys { display: flex; flex-direction: column; padding: 22px; border-radius: var(--r-lg); }
.sys[hidden] { display: none; }
.sys.featured { grid-column: 1 / -1; }
@media (min-width: 1040px) { .sys.featured { grid-column: span 2; } }
.sys-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.sys h3 { margin: 0 0 8px; font: 630 1.18rem/1.25 var(--font-display); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.sys > p { margin: 0 0 14px; color: var(--text-2); font-size: 0.94rem; }
.sys .points { margin: 0 0 16px; padding-left: 18px; color: var(--text-2); font-size: 0.88rem; }
.sys .points li { margin-bottom: 4px; }
.sys .points li::marker { color: var(--cool); }
.sys .chips { margin-top: auto; }
.sys .links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sys .links a { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--text); text-decoration: none; }
.sys .links a:hover { color: var(--signal); }
.sys .links svg { width: 15px; height: 15px; }
.sys .links .private { font: 500 0.75rem/1.6 var(--font-mono); color: var(--text-3); }

/* ---------- Contact ---------- */
.contact-card { display: grid; overflow: hidden; border-radius: calc(var(--r-lg) + 8px); }

.contact-copy { padding: clamp(28px, 5vw, 56px); }
.contact-copy h2 { margin: 12px 0 14px; font: 680 clamp(2rem, 6vw, 3.4rem)/1 var(--font-display); letter-spacing: -0.045em; text-wrap: balance; }
.contact-copy > p { margin: 0 0 28px; color: var(--text-2); max-width: 46ch; font-size: 1.05rem; }
.email {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 clamp(1rem, 3.4vw, 1.3rem)/1.2 var(--font-sans);
  letter-spacing: -0.01em;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.email:hover { color: var(--signal); }
.copy-btn {
  min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px;
  background: rgb(255 255 255 / 0.06); box-shadow: inset 0 0 0 1px var(--line-hi);
  color: var(--text-2); font: 500 0.78rem/1 var(--font-mono); cursor: pointer;
}
.copy-btn:hover { color: var(--text); }
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; padding: 0; list-style: none; }
.socials a {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  background: rgb(255 255 255 / 0.04); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-2); font-size: 0.88rem; text-decoration: none;
  transition: color 200ms, background 200ms, transform 500ms var(--ease-spring);
}
.socials a:hover { color: var(--text); background: rgb(255 255 255 / 0.08); transform: translateY(-2px); }
.socials svg { width: 16px; height: 16px; }
.contact-photo { position: relative; min-height: 360px; background: #d9d8d3; }
.contact-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.contact-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(15 15 18 / 0.5), transparent 40%); }
@media (max-width: 859px) { .contact-photo::after { background: linear-gradient(180deg, rgb(15 15 18 / 0.5), transparent 40%); } }

/* ---------- Footer ---------- */
.site-footer { padding-block: 40px 56px; color: var(--text-3); font-size: 0.85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 24px; }
.site-footer a { color: var(--text-2); }

/* ---------- Entry motion (staggered spring reveals) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 600ms var(--ease-out), transform var(--dur) var(--ease-spring);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js [data-reveal].in { opacity: 1; transform: none; }

/* Hero entrance runs in pure CSS so the first screen never waits on JS */
[data-enter] { animation: enter 900ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 70ms + 60ms); }
@keyframes enter { from { opacity: 0; transform: translateY(16px) scale(0.985); } }

/* ---------- Reduced motion: no transforms, no rolls, no pulses ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .portrait .frame { transform: none; }
}

/* Forced colours / high contrast: keep panels visible */
@media (forced-colors: active) {
  .panel, .btn, .chips li, .badge { border: 1px solid CanvasText; }
}
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }

/* Desktop story layout: chapter title + intro on the left (sticky), roles on the right */
@media (min-width: 1000px) {
  .chapter {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "head roles" "intro roles" "intro led";
    grid-template-rows: auto auto 1fr;
    column-gap: 48px;
    align-items: start;
  }
  .chapter-head { grid-area: head; flex-direction: column; align-items: flex-start; }
  .chapter > p { grid-area: intro; font-size: 0.95rem; }
  .chapter .roles { grid-area: roles; }
  .chapter .built-here { grid-area: led; margin-top: 14px; }
  .roles:has(> :only-child) { grid-template-columns: 1fr; }
}

/* Method strip: Design -> Enforce -> Scale */
.method { display: grid; gap: 14px; margin: 0 0 clamp(40px, 6vw, 64px); padding: 0; list-style: none; counter-reset: none; }
@media (min-width: 760px) { .method { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.method li { padding: clamp(22px, 3vw, 30px); border-radius: var(--r-lg); }
.method .step { font: 600 0.8rem/1 var(--font-mono); color: var(--signal); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.method h3 { margin: 14px 0 8px; font: 660 clamp(1.4rem, 3vw, 1.75rem)/1.1 var(--font-display); letter-spacing: -0.03em; }
.method p { margin: 0; color: var(--text-2); font-size: 0.96rem; }
.cap-label { margin: 0 0 16px; }
/* Contact card is single column now (no photo); keep the copy at a readable width */
.contact-copy { max-width: 820px; }

/* ---------- Systems "Show all" ---------- */
.more-wrap { display: flex; justify-content: center; margin-top: 22px; }
.more-btn[hidden] { display: none; }

/* ---------- Story: key result + expandable detail ---------- */
.role .key { margin: 0; color: var(--text); font-size: 0.95rem; line-height: 1.5; }
.role .more { margin-top: 10px; }
.role .more summary {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 12px; border-radius: 999px;
  list-style: none; cursor: pointer;
  background: rgb(255 255 255 / 0.04); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-2); font: 500 0.75rem/1 var(--font-mono); letter-spacing: 0.04em;
  transition: color 200ms, background 200ms;
}
.role .more summary::-webkit-details-marker { display: none; }
.role .more summary:hover { color: var(--text); background: rgb(255 255 255 / 0.08); }
.role .more summary span { display: inline-block; transition: transform 500ms var(--ease-spring); }
.role .more[open] summary span { transform: rotate(45deg); }
.role .more ul { margin-top: 12px; }
.role .more[open] ul { animation: enter 600ms var(--ease-spring) both; }

/* ---------- Method flow connector (positions set by site.js) ---------- */
.method { position: relative; padding-left: 30px; }
.method .node {
  position: absolute; left: -27px; top: 30px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); box-shadow: inset 0 0 0 2px var(--line-hi);
  transition: background 400ms var(--ease-out), box-shadow 400ms var(--ease-out), transform 600ms var(--ease-spring);
  z-index: 1;
}
.method li { transition: box-shadow 500ms var(--ease-out); }
.method li.lit .node { background: var(--signal); box-shadow: 0 0 0 5px rgb(255 122 69 / 0.18), 0 0 16px var(--signal); transform: scale(1.1); }
.method li .step { transition: color 400ms; color: var(--text-3); }
.method li.lit .step { color: var(--signal); }
.method::before, .method::after {
  content: ""; position: absolute; border-radius: 2px; pointer-events: none;
  /* vertical by default (phones) */
  left: calc(var(--x0, 0px) - 1px); top: var(--y0, 0px); width: 2px; height: var(--len, 0px);
}
.method::before { background: var(--line-hi); }
.method::after {
  background: linear-gradient(180deg, var(--signal), var(--gold));
  transform-origin: top; transform: scaleY(var(--p, 0));
  transition: transform 500ms var(--ease-spring);
}
@media (min-width: 760px) {
  .method { padding-left: 0; padding-top: 34px; }
  .method .node { left: 26px; top: -27px; }
}
.method.is-row::before, .method.is-row::after {
  left: var(--x0, 0px); top: calc(var(--y0, 0px) - 1px); width: var(--len, 0px); height: 2px;
}
.method.is-row::after {
  background: linear-gradient(90deg, var(--signal), var(--gold));
  transform-origin: left; transform: scaleX(var(--p, 0));
}
