/* =========================================================
   Prajwal Narayanaswamy — Portfolio
   ========================================================= */

:root {
  --bg: #0a0b0e;
  --bg-2: #0e1015;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #ecedf1;
  --text-2: #b4b8c3;
  --muted: #7d828f;
  --accent: #a594ff;
  --accent-2: #5eead4;
  --accent-ink: #0a0b0e;
  --glow: rgba(165, 148, 255, 0.16);
  --c1: #a594ff;
  --c2: #5eead4;
  --c3: #f5b86b;
  --c4: #f0729a;
  --field: 165, 148, 255;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;

  --radius: 18px;
  --wrap: 1180px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f5f1;
  --bg-2: #efede7;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-2: rgba(10, 10, 20, 0.04);
  --line: rgba(15, 15, 30, 0.09);
  --line-2: rgba(15, 15, 30, 0.16);
  --text: #121318;
  --text-2: #3d404a;
  --muted: #6b6f7a;
  --accent: #5a45f0;
  --accent-2: #0d9488;
  --accent-ink: #ffffff;
  --glow: rgba(90, 69, 240, 0.12);
  --c1: #5a45f0;
  --c2: #0d9488;
  --c3: #d97706;
  --c4: #db2777;
  --field: 90, 69, 240;
  --shadow: 0 30px 60px -30px rgba(20, 20, 40, 0.18);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
b, strong { font-weight: 600; color: var(--text); }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2);
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.mono { font-family: var(--mono); letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }

.skip {
  position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); transition: top .2s;
}
.skip:focus { top: 16px; }

/* ---------- ambient layers ---------- */
#field { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .footer, .nav { position: relative; z-index: 2; }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
.progress span {
  display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 50;
  width: min(calc(100% - 28px), 1000px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 8px 8px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  transition: box-shadow .3s, border-color .3s;
}
.nav.scrolled { box-shadow: var(--shadow); border-color: var(--line-2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
}
.brand-name { font-size: 15px; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  display: block; padding: 7px 14px; border-radius: 999px; font-size: 14px; color: var(--text-2);
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--surface-2); }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.kbd-btn {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 13px; color: var(--text-2);
}
.kbd-btn:hover { border-color: var(--line-2); color: var(--text); }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.i-sun { display: none; }
:root[data-theme="light"] .i-sun { display: block; }
:root[data-theme="light"] .i-moon { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px;
  border-radius: 999px; font-size: 15px; font-weight: 500; border: 1px solid transparent;
  transition: transform .25s var(--ease), background .25s, border-color .25s, box-shadow .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { box-shadow: 0 10px 30px -10px var(--accent); }
.btn-primary svg { transition: transform .25s var(--ease); }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-ghost { border-color: var(--line-2); background: var(--surface); }
.btn-ghost:hover { border-color: var(--text-2); }

/* ---------- hero ---------- */
.hero { padding: 120px 0 0; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; min-height: calc(100vh - 120px); min-height: calc(100svh - 120px); }

/* portrait stage */
.stage {
  position: relative; margin: 0; justify-self: end; width: 100%; max-width: 500px;
  height: clamp(460px, calc(100svh - 190px), 640px);
}
.stage [data-depth] { translate: var(--px, 0) var(--py, 0); transition: translate .6s cubic-bezier(.2,.7,.1,1); }
.arch {
  position: absolute; left: 6%; right: 6%; top: 22%; bottom: 0; overflow: hidden;
  border-radius: 999px 999px 28px 28px; border: 1px solid var(--line-2);
  background:
    radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 75%),
    radial-gradient(70% 50% at 80% 100%, color-mix(in srgb, var(--accent-2) 28%, transparent), transparent 70%),
    var(--bg-2);
  box-shadow: 0 40px 120px -40px var(--accent), inset 0 1px 0 rgba(255, 255, 255, .08);
  animation: arch-in 1.1s var(--ease) both;
}
.arch-grid {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 1px 1px, var(--line-2) 1px, transparent 0) 0 0 / 18px 18px;
  -webkit-mask-image: linear-gradient(#000 10%, transparent 75%); mask-image: linear-gradient(#000 10%, transparent 75%);
}
.arch-sheen {
  position: absolute; inset: -60%; opacity: .55;
  background: conic-gradient(from 0deg, transparent 0 62%, color-mix(in srgb, var(--accent-2) 45%, transparent) 72%, transparent 82%);
  animation: spin 16s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes arch-in { from { opacity: 0; transform: scale(.92) translateY(30px); } }
.cutout {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; height: 100%; width: auto; max-width: none;
  -webkit-mask-image: linear-gradient(#000 84%, transparent 99%); mask-image: linear-gradient(#000 84%, transparent 99%);
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, .45)) drop-shadow(0 0 28px color-mix(in srgb, var(--accent) 30%, transparent));
  animation: cutout-in 1.3s var(--ease) both .15s;
}
:root[data-theme="light"] .cutout { filter: drop-shadow(0 20px 30px rgba(20, 20, 40, .18)); }
@keyframes cutout-in { from { opacity: 0; clip-path: inset(100% 0 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }

/* console row: live terminal + metrics */
.console { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 48px; align-items: stretch; }
.console .terminal { display: flex; flex-direction: column; }
.console .term-body { flex: 1; height: auto; min-height: 320px; max-height: 360px; }
.status {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--text-2);
  margin-bottom: 28px;
}
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #34d399; }
.dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid #34d399;
  animation: ping 2s var(--ease) infinite;
}
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

.hero h1 { font-weight: 500; letter-spacing: -0.035em; line-height: 1.02; }
.h-name {
  display: block; font-size: clamp(15px, 1.4vw, 17px); font-family: var(--mono); font-weight: 400;
  letter-spacing: 0; color: var(--accent); margin-bottom: 18px;
}
.h-line { display: block; font-size: clamp(40px, 4.9vw, 68px); }
.h-line em {
  font-size: 1.08em;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: .06em;
}
.lede { margin-top: 26px; max-width: 600px; font-size: 18px; color: var(--text-2); line-height: 1.65; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 36px; }
.socials { display: flex; gap: 4px; margin-left: 6px; }
.socials a {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--text-2);
  transition: color .2s, background .2s;
}
.socials a:hover { color: var(--text); background: var(--surface-2); }

/* terminal */
.terminal {
  border-radius: var(--radius); border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow), 0 0 0 1px var(--line) inset, 0 0 120px -40px var(--glow);
  overflow: hidden;
}
.term-bar { display: flex; align-items: center; gap: 7px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--line-2); }
.term-bar span:nth-child(1) { background: #ff5f57; }
.term-bar span:nth-child(2) { background: #febc2e; }
.term-bar span:nth-child(3) { background: #28c840; }
.term-bar p { margin-left: auto; margin-right: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.term-body {
  margin: 0; padding: 18px 22px 20px; height: 340px; overflow-y: auto; font-family: var(--mono); font-size: 13.5px;
  line-height: 1.7; color: var(--text-2); cursor: text; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.term-out > div { white-space: pre-wrap; word-break: break-word; min-height: 1.7em; }
.term-body .k { color: var(--muted); }
.term-body .err { color: #f87171; }
.term-body .hint { color: var(--accent); }
.term-body .tl { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent-2) 40%, transparent); }
.term-body .swatch { display: inline-block; width: 22px; height: 12px; margin-right: 3px; border-radius: 2px; vertical-align: middle; }
.term-form { display: flex; align-items: center; gap: 8px; }
.term-form[hidden] { display: none; }
.term-input {
  flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; color: var(--text);
  font: inherit; caret-color: var(--accent);
}
.term-input::placeholder { color: var(--muted); opacity: .6; }
.term-key { cursor: default; }
.term-body .p { color: var(--accent-2); }
.term-body .c { color: var(--text); }
.term-body .ok { color: #34d399; }
.term-body .dim { color: var(--muted); }
.term-body .caret {
  display: inline-block; width: 8px; height: 1.1em; vertical-align: -3px; background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* metrics */
.metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--line);
}
.metrics li {
  display: flex; flex-direction: column; justify-content: flex-end; padding: 20px 22px;
  background: color-mix(in srgb, var(--bg-2) 90%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.metrics b { display: block; font-size: clamp(28px, 3vw, 38px); font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.metrics span { font-size: 13px; color: var(--muted); }

/* marquee */
.marquee {
  margin-top: 64px; overflow: hidden; padding: 18px 0; border-block: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 45s linear infinite; }
.marquee span {
  font-family: var(--mono); font-size: 13px; color: var(--muted); padding: 0 28px; white-space: nowrap;
  display: flex; align-items: center; gap: 28px;
}
.marquee span::after { content: "✦"; color: var(--accent); opacity: .6; font-size: 10px; margin-left: 28px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
.section { padding: 140px 0 40px; }
.sec-head { margin-bottom: 56px; max-width: 760px; }
.eyebrow {
  display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 18px;
}
.eyebrow span { color: var(--accent); }
.eyebrow::after { content: ""; flex: 0 0 60px; height: 1px; background: var(--line-2); }
.sec-head h2, .contact h2 {
  font-size: clamp(34px, 4.4vw, 56px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.05;
}
.sec-head h2 em, .contact h2 em { color: var(--accent); font-size: 1.06em; }
.sec-sub { margin-top: 16px; color: var(--text-2); font-size: 17px; }

/* cards + spotlight */
.card {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: border-color .3s, transform .4s var(--ease);
}
.spot::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(500px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 45%);
  transition: opacity .3s;
}
@media (hover: hover) { .spot:hover::before { opacity: 1; } }
.spot.tap::before { opacity: 1; transition-duration: .08s; }
.spot:hover { border-color: var(--line-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-family: var(--mono); font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-2); background: var(--surface-2);
}

/* ---------- about ---------- */
.about-grid {
  display: grid; grid-template-columns: 300px 1fr; gap: 28px 72px;
  grid-template-areas: "head head" "portrait copy";
}
.about-grid .sec-head { grid-area: head; margin-bottom: 20px; }
.portrait { grid-area: portrait; }
.about-copy { grid-area: copy; }
.portrait-frame {
  position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-2);
  aspect-ratio: 267 / 360; background: var(--bg-2);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: top; filter: saturate(.9) contrast(1.02); transition: transform .8s var(--ease); }
.portrait:hover img { transform: scale(1.03); }
.portrait-frame::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--bg) 70%, transparent));
}
.portrait figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.portrait figcaption .mono { color: var(--text-2); }
.about-copy .big { font-size: clamp(20px, 2vw, 25px); line-height: 1.5; color: var(--text); letter-spacing: -0.015em; margin-bottom: 22px; }
.about-copy p + p { margin-top: 16px; }
.about-copy p { color: var(--text-2); }
.facts { display: grid; grid-template-columns: 1fr 1fr; margin-top: 40px; border-top: 1px solid var(--line); }
.facts div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.facts div:nth-child(odd) { padding-right: 20px; }
.facts dt { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.facts dd { color: var(--text); }
.facts dd em { font-size: 1.15em; }

/* ---------- timeline ---------- */
.timeline { position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 200px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(var(--line-2), var(--line) 80%, transparent);
}
.job { display: grid; grid-template-columns: 200px 1fr; gap: 0 48px; padding-bottom: 28px; }
.job-meta { position: relative; padding-top: 26px; padding-right: 32px; }
.job-meta::after {
  content: ""; position: absolute; right: -6px; top: 31px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent); box-shadow: 0 0 0 5px var(--glow);
}
.date { font-size: 13px; color: var(--text); }
.loc { font-size: 13px; color: var(--muted); }
.job-body { padding: 28px 30px; }
.job-body header { margin-bottom: 18px; }
.job-body h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.35; }
.job-body .at { font-weight: 400; color: var(--text-2); }
.via { font-size: 13px; color: var(--muted); margin-top: 2px; }
.job-body > ul:not(.chips), .sub ul { display: grid; gap: 10px; }
.job-body > ul:not(.chips) li, .sub li {
  position: relative; padding-left: 20px; color: var(--text-2); font-size: 15px; line-height: 1.6;
}
.job-body > ul:not(.chips) li::before, .sub li::before {
  content: ""; position: absolute; left: 2px; top: .7em; width: 8px; height: 1px; background: var(--accent);
}
.sub { padding: 20px 0; border-top: 1px dashed var(--line-2); }
.sub:first-of-type { border-top: 0; padding-top: 0; }
.sub h4 { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.sub h4 span { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 17px; color: var(--accent); }
.job-body .chips { margin-top: 20px; }

/* ---------- case studies ---------- */
.case {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; padding: 44px; margin-bottom: 24px; overflow: hidden;
}
.case-rev .case-copy { order: 2; }
.tag { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.case h3, .mini h3 { font-size: clamp(26px, 2.6vw, 34px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 14px; }
.case-copy > p:not(.tag) { color: var(--text-2); font-size: 16px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 28px 0; border-radius: 12px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.kv li { padding: 14px 16px; background: var(--bg-2); }
.kv b { display: block; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.kv span { font-size: 12.5px; color: var(--muted); }

.case-visual {
  position: relative; border-radius: 14px; border: 1px solid var(--line); padding: 28px 22px;
  background:
    radial-gradient(circle at 1px 1px, var(--line-2) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg-2);
  display: flex; flex-direction: column; justify-content: center; min-height: 340px;
}
.visual-foot { margin-top: 20px; text-align: center; font-size: 11.5px; color: var(--muted); }

.pipeline { display: grid; grid-template-columns: 1fr 34px 1.1fr 34px 1fr; align-items: center; }
.pl-col { display: flex; flex-direction: column; gap: 10px; }
.node {
  display: block; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg); font-size: 12.5px; font-weight: 500; line-height: 1.35; text-align: center;
}
.node { position: relative; transition: border-color .25s, box-shadow .25s, color .25s; }
.node.run { border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 20%, transparent); animation: nodepulse 1s ease-in-out infinite; }
.node.ok { border-color: #34d399; }
.node.warn { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .15); }
.node.ok::after, .node.warn::after {
  position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #0a0b0e;
}
.node.ok::after { content: "✓"; background: #34d399; }
.node.warn::after { content: "!"; background: #fbbf24; }
@keyframes nodepulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-2) 10%, transparent); } }
.node small { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.node-hi {
  border-color: var(--accent); padding: 18px 12px;
  box-shadow: 0 0 0 4px var(--glow), 0 0 40px -10px var(--accent);
}
.pl-link { position: relative; height: 100%; min-height: 120px; display: flex; flex-direction: column; justify-content: center; gap: 30px; }
.pl-link i { position: relative; display: block; height: 1px; background: var(--line-2); overflow: hidden; }
.pl-link i::after {
  content: ""; position: absolute; top: -1px; left: -30%; width: 30%; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-2));
  animation: flow 1.8s linear infinite;
}
.pipeline .pl-link i::after { opacity: .35; }
.pipeline.running .pl-link i::after { opacity: 1; animation-duration: .9s; }
.pl-link i:nth-child(2)::after { animation-delay: .6s; }
.pl-link i:nth-child(3)::after { animation-delay: 1.2s; }
@keyframes flow { to { left: 100%; } }

.clusters { width: 100%; height: auto; overflow: visible; }
.clusters circle[data-c] { cursor: pointer; }
.clusters .hull { fill: none; stroke-dasharray: 3 5; stroke-width: 1; opacity: 0; transition: opacity .6s ease; }
.clusters text { font-family: var(--mono); font-size: 10px; fill: var(--text-2); opacity: 0; transition: opacity .6s ease; }
.settled .clusters .hull { opacity: .55; transition-delay: 1.1s; }
.settled .clusters text { opacity: 1; transition-delay: 1.3s; }
#clusters[data-focus] circle[data-c] { transition: opacity .25s, transform 1.6s cubic-bezier(.2,.7,.1,1); }
#clusters[data-focus="0"] circle[data-c]:not([data-c="0"]),
#clusters[data-focus="1"] circle[data-c]:not([data-c="1"]),
#clusters[data-focus="2"] circle[data-c]:not([data-c="2"]),
#clusters[data-focus="3"] circle[data-c]:not([data-c="3"]) { opacity: .12 !important; }
.cl-tip {
  position: absolute; z-index: 3; left: 0; top: 0; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; max-width: 220px; padding: 8px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13px; line-height: 1.4;
  opacity: 0; transition: opacity .15s;
}
.cl-tip.show { opacity: 1; }
.cl-tip .mono { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.cl-foot, .sim-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.cl-foot .mono, .sim-tag { font-size: 11px; color: var(--muted); }
.cl-rerun, .sim-run {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg);
  font-size: 13px; font-weight: 500; transition: border-color .2s, background .2s, color .2s;
}
.cl-rerun:hover, .sim-run:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.sim-run:disabled { opacity: .6; cursor: progress; }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.mini { padding: 34px; display: flex; flex-direction: column; }
.mini > p:not(.stat), .mini-body > p:not(.stat) { color: var(--text-2); }
.mini-top { display: flex; justify-content: space-between; align-items: start; }
.ext {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2);
  transition: transform .3s var(--ease), background .3s, color .3s;
}
.ext:hover { transform: rotate(45deg); background: var(--text); color: var(--bg); }
.stat { margin: 18px 0 20px; font-size: 14px; color: var(--muted); }
.stat b { font-size: 18px; }
.mini .chips { margin-top: auto; }

.wave { display: flex; align-items: center; gap: 4px; height: 70px; margin-top: 26px; }
.wave i { flex: 1; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent-2)); height: 20%; animation: wave 1.4s ease-in-out infinite; opacity: .85; }
.wave i:nth-child(3n) { animation-delay: -.3s; }
.wave i:nth-child(3n+1) { animation-delay: -.7s; }
.wave i:nth-child(4n) { animation-delay: -1s; animation-duration: 1.1s; }
.wave i:nth-child(5n) { animation-delay: -.5s; animation-duration: 1.7s; }
@keyframes wave { 0%, 100% { height: 18%; } 50% { height: 95%; } }

.board {
  margin-top: 26px; height: 70px; border-radius: 10px; border: 1px solid var(--line);
  background: repeating-conic-gradient(var(--surface-2) 0 25%, transparent 0 50%) 0 0 / 35px 35px;
  position: relative; overflow: hidden;
}
.board::after {
  content: "♞"; position: absolute; top: 50%; left: 0; transform: translateY(-50%); font-size: 30px; color: var(--accent);
  animation: knight 6s var(--ease) infinite; text-shadow: 0 0 20px var(--accent);
}
@keyframes knight {
  0% { left: 2%; } 25% { left: 30%; } 50% { left: 55%; } 75% { left: 80%; } 100% { left: 2%; }
}

/* ---------- skills ---------- */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill { padding: 26px; }
.skill h3 { font-size: 17px; font-weight: 600; margin-bottom: 18px; display: flex; gap: 10px; align-items: baseline; }
.skill h3 span { font-size: 12px; color: var(--accent); font-weight: 400; }
.skill .chips li { font-size: 12.5px; padding: 5px 11px; transition: border-color .2s, color .2s; }
.skill .chips li:hover { border-color: var(--accent); color: var(--text); }

/* ---------- education & awards ---------- */
.edu-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; }
.edu-list { display: grid; gap: 20px; align-content: start; }
.edu { padding: 26px 28px; }
.edu .date { color: var(--accent); font-size: 12.5px; margin-bottom: 8px; }
.edu h3, .certs h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.edu p { color: var(--text-2); }
.edu p.muted { color: var(--muted); font-size: 14px; margin-top: 10px; }
.certs { padding: 26px 28px; }
.certs ul { margin-top: 14px; }
.certs li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.certs li em { font-size: 15px; color: var(--muted); }

.awards { display: flex; flex-direction: column; gap: 20px; }
.award-feature {
  padding: 0; overflow: hidden; text-align: left; display: block; aspect-ratio: 4 / 3.4; width: 100%;
}
.award-feature img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; transform: scale(1.14); transform-origin: 50% 20%; transition: transform .8s var(--ease); }
.award-feature:hover img { transform: scale(1.19); }
.award-over {
  position: absolute; inset: auto 0 0 0; padding: 60px 26px 24px; display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, transparent, rgba(8, 8, 12, .92) 45%); color: #fff;
}
.award-over .mono { font-size: 12px; color: #c9c2ff; }
.award-over strong { font-size: 22px; color: #fff; font-weight: 600; letter-spacing: -0.02em; }
.award-over span:last-child { font-size: 14px; color: rgba(255, 255, 255, .75); }
.award-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.award-list li { padding: 18px 24px; background: var(--bg-2); color: var(--text-2); font-size: 15px; }
.award-list b { display: block; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }

/* ---------- contact ---------- */
.contact { padding-bottom: 100px; }
.contact-card {
  padding: clamp(36px, 6vw, 80px); text-align: center; overflow: hidden;
  background:
    radial-gradient(600px 300px at 50% 0%, var(--glow), transparent 70%),
    var(--surface);
}
.contact-card .eyebrow { justify-content: center; }
.contact-avatar {
  position: relative; width: 88px; height: 88px; margin: 0 auto 22px; padding: 3px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent));
}
.contact-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--bg-2); }
.contact-avatar .dot { position: absolute; right: 4px; bottom: 6px; width: 14px; height: 14px; border: 3px solid var(--bg-2); box-sizing: content-box; }
.contact-avatar .dot::after { inset: -6px; }
.contact-card .eyebrow::after { display: none; }
.contact-card .lede { margin: 22px auto 0; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 36px; }
.email-copy {
  display: inline-flex; align-items: center; gap: 12px; height: 46px; padding: 0 6px 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--bg-2); font-size: 14px; max-width: 100%;
}
.email-copy .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-label { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 12px; color: var(--text-2); transition: background .2s; }
.email-copy:hover .copy-label { background: var(--accent); color: var(--accent-ink); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.foot a:hover { color: var(--text); }

/* ---------- command palette ---------- */
.cmdk {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 14vh 16px 16px;
  background: rgba(5, 5, 10, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .2s var(--ease);
}
.cmdk[hidden] { display: none; }
.cmdk-panel:focus { outline: none; }
.cmdk-panel {
  width: min(560px, 100%); border-radius: 16px; border: 1px solid var(--line-2); background: var(--bg-2);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .6); overflow: hidden; animation: pop .25s var(--ease);
}
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmdk-group { padding: 10px 10px 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14.5px; color: var(--text-2); }
.cmdk-item .ic { width: 22px; text-align: center; color: var(--muted); font-family: var(--mono); }
.cmdk-item .hint { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.cmdk-item[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.cmdk-item[aria-selected="true"] .ic { color: var(--accent); }
.cmdk-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

/* ---------- lightbox & toast ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 24px;
  background: rgba(5, 5, 10, .85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade .2s;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 88vh; width: auto; border-radius: 12px; box-shadow: 0 40px 100px -20px #000; animation: pop .3s var(--ease); }
.lb-close { position: absolute; top: 20px; right: 20px; background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .2); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 99; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500;
  transition: opacity .3s, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }


/* ---------- utilities ---------- */
.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; }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }

/* ---------- hero rotator ---------- */
.rotator { display: inline-grid; vertical-align: bottom; justify-items: start; transition: width .45s var(--ease) .12s; }
.rotator .rw {
  grid-area: 1 / 1; opacity: 0; transform: translateY(.35em);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .08em; white-space: nowrap;
}
/* sequential swap: old word leaves quickly, new word enters after it — never both at once */
.rotator .rw:not(.on) { visibility: hidden; transition: opacity .28s ease-in, transform .28s ease-in, visibility 0s .28s; }
.rotator .rw.on { opacity: 1; transform: none; visibility: visible; transition: opacity .45s var(--ease) .3s, transform .45s var(--ease) .3s, visibility 0s .3s; }
.rotator .rw.out { opacity: 0; transform: translateY(-.35em); }

/* ---------- timeline progress ---------- */
.timeline::after {
  content: ""; position: absolute; left: 200px; top: 8px; width: 1px; height: calc((100% - 16px) * var(--fill, 0));
  background: linear-gradient(var(--accent), var(--accent-2)); box-shadow: 0 0 12px var(--accent);
}

/* ---------- simulator log ---------- */
.sim { margin-top: 6px; }
.sim-log {
  margin-top: 12px; height: 168px; overflow-y: auto; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); font-size: 11.5px; line-height: 1.65; scrollbar-width: thin; overscroll-behavior: contain;
}
.sim-log li { display: grid; grid-template-columns: 54px 52px 1fr; gap: 6px; color: var(--text-2); animation: fade .25s; }
.sim-log .t { color: var(--muted); }
.sim-log .src { color: var(--accent); }
.sim-log .ok span:last-child { color: #34d399; }
.sim-log .warn span:last-child { color: #fbbf24; }
.sim-log .dim span:last-child { color: var(--muted); }
.sim-log .done { font-weight: 500; }

/* ---------- ask ---------- */
.ask { padding: 28px; }
.ask-form {
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--muted); transition: border-color .2s, box-shadow .2s;
}
.ask-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--glow); }
.ask-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; }
.ask-form input::-webkit-search-cancel-button { display: none; }
.ask-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap; margin-top: 18px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest button {
  padding: 6px 12px; border-radius: 999px; border: 1px dashed var(--line-2); background: transparent; font-size: 13px; color: var(--text-2);
  transition: border-color .2s, color .2s;
}
.suggest button:hover { border-color: var(--accent); border-style: solid; color: var(--text); }
.mode { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mode-note { font-size: 11.5px; color: var(--muted); }
.mode-note b { color: var(--text-2); font-weight: 500; }
.switch { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 0; font-size: 14px; font-weight: 500; }
.switch .knob {
  position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); transition: background .25s;
}
.switch .knob::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2);
  transition: transform .25s var(--ease), background .25s;
}
.switch[aria-checked="true"] .knob { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .knob::after { transform: translateX(16px); background: var(--accent-ink); }
.switch:disabled { opacity: .7; cursor: progress; }
.ask-progress { height: 3px; margin-top: 16px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ask-progress span { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: transform .2s; }
.ask-results { margin-top: 24px; display: grid; gap: 12px; min-height: 120px; }
.ask-empty { color: var(--muted); font-size: 15px; padding: 26px; border: 1px dashed var(--line-2); border-radius: 14px; text-align: center; }
.ask-empty b { color: var(--text-2); }
.ask-meta { font-size: 12px; color: var(--muted); }
.ask-hit {
  padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 70ms);
}
.ask-hit.best { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: 0 0 0 3px var(--glow); }
.ask-hit header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.ask-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.ask-hit h3 { font-size: 16px; font-weight: 600; }
.ask-hit p { color: var(--text-2); font-size: 15px; }
.ask-hit mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); border-radius: 3px; padding: 0 2px; }
.ask-hit footer { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.meter { width: 90px; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.score { font-size: 11.5px; color: var(--muted); }
.ask-go { margin-left: auto; font-size: 13px; color: var(--text-2); }
.ask-go:hover { color: var(--accent); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.how { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 1px dashed var(--line-2); counter-reset: step; }
.how-step {
  flex: 1 1 140px; position: relative; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2);
  display: flex; flex-direction: column; font-size: 12px; color: var(--muted);
}
.how-step b { font-size: 13px; color: var(--text); font-weight: 500; }
.how-step.lit { animation: lit .9s var(--ease); animation-delay: calc(var(--i) * 120ms); }
@keyframes lit { 30% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); } }
.sem-only { display: none; }
.sem-only-inline { display: none; }
.is-semantic .sem-only { display: flex; }
.is-semantic .sem-only-inline { display: inline; }


/* ---------- research: narration demo ---------- */
.case-narrator .case-copy > p:not(.tag) + p { margin-top: 12px; }
.case-narrator .case-copy em { color: var(--text); font-size: 1.12em; }
.case-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.pub-badge {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 5px 12px 5px 5px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: 13px; color: var(--text-2); transition: border-color .2s, background .2s;
}
.pub-badge:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.pub-badge-k { padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; }

.narr { --code-c: var(--accent); --ctx-c: var(--accent-2); padding: 0; overflow: hidden; justify-content: flex-start; min-height: 0; align-self: start; position: sticky; top: 96px; }
.narr-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.narr-file { font-size: 12px; color: var(--text-2); }
.narr-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.lg-ctx::before { background: var(--ctx-c); }
.lg-code::before { background: var(--code-c); }
.narr-code { counter-reset: ln; padding: 10px 0; font-size: 13px; line-height: 1.85; background: var(--bg); overflow: auto; max-height: 344px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.narr-code li {
  counter-increment: ln; position: relative; padding: 0 16px 0 52px; white-space: pre; color: var(--text-2);
  transition: background .25s, color .25s, box-shadow .25s;
}
.narr-code li::before { content: counter(ln); position: absolute; left: 0; width: 36px; text-align: right; color: var(--muted); opacity: .6; }
.narr-code .ind {
  display: inline-block; width: calc(var(--d) * 4ch); height: 1.85em; vertical-align: top;
  background: repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 4ch);
}
.narr-code .kw { color: var(--accent); }
.narr-code .fn { color: var(--accent-2); }
.narr-code .at { color: var(--c3); }
.narr-code .ty { color: var(--c4); }
.narr-code .pp, .narr-code .cm { color: var(--muted); }
.narr-code .cm { font-style: italic; }
.narr-code .str { color: var(--c2); }
.narr-code .num { color: var(--c4); }
.narr-code li { cursor: pointer; }
.narr-code li:hover { background: var(--surface-2); }
.narr-code li:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.narr-prog { grid-column: 1 / -1; height: 2px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.narr-prog i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--muted); }
.narr[data-voice="code"] .narr-prog i { background: var(--code-c); }
.narr[data-voice="ctx"] .narr-prog i { background: var(--ctx-c); }
.narr-code li.scope { background: color-mix(in srgb, var(--ctx-c) 9%, transparent); box-shadow: inset 3px 0 0 var(--ctx-c); }
.narr-code li.speaking { background: color-mix(in srgb, var(--code-c) 16%, transparent); box-shadow: inset 3px 0 0 var(--code-c); color: var(--text); }
.narr-caption {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 12px; min-height: 132px; align-content: start;
  padding: 14px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.narr-who { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.narr[data-voice="ctx"] .narr-who { color: var(--ctx-c); }
.narr[data-voice="code"] .narr-who { color: var(--code-c); }
.narr-wave { display: flex; align-items: center; gap: 3px; height: 16px; justify-self: start; }
.narr-wave i { width: 3px; height: 30%; border-radius: 2px; background: var(--muted); opacity: .5; }
.narr.playing .narr-wave i { opacity: 1; animation: wave .9s ease-in-out infinite; }
.narr.playing[data-voice="ctx"] .narr-wave i { background: var(--ctx-c); }
.narr.playing[data-voice="code"] .narr-wave i { background: var(--code-c); }
.narr-wave i:nth-child(2) { animation-delay: -.2s; } .narr-wave i:nth-child(3) { animation-delay: -.5s; }
.narr-wave i:nth-child(4) { animation-delay: -.35s; } .narr-wave i:nth-child(5) { animation-delay: -.7s; }
.narr-text { grid-column: 1 / -1; color: var(--text); font-size: 15px; line-height: 1.5; }
.narr-text.is-code { font-family: var(--mono); font-size: 14px; color: var(--code-c); }
.narr-controls { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 16px 0; }
.narr-play, .narr-sound {
  height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg);
  font-size: 13px; font-weight: 500; transition: border-color .2s, color .2s, background .2s;
}
.narr-play { background: var(--text); color: var(--bg); border-color: var(--text); }
.narr-play:hover { box-shadow: 0 8px 24px -10px var(--accent); }
.narr-sound:hover { border-color: var(--accent); color: var(--accent); }
.narr .visual-foot { padding: 0 16px 16px; text-align: left; margin-top: 12px; }

/* wide mini card (chess) */
.mini-wide { flex-direction: row; gap: 32px; align-items: center; }
.mini-wide .mini-body { flex: 1.3; display: flex; flex-direction: column; }
.mini-wide .board { flex: 1; align-self: center; height: auto; min-height: 0; margin-top: 0; aspect-ratio: 2 / 1; background-size: 25% 50%; }
.mini-wide .board::after { font-size: clamp(30px, 4vw, 48px); }
.mini-wide .chips { margin-top: 0; }

/* ---------- publication card ---------- */
.pub { display: grid; grid-template-columns: 1fr auto; gap: 28px; padding: 30px; margin-bottom: 24px; }
.pub h3 { font-size: clamp(20px, 2vw, 24px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.pub h3 a { background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 1px no-repeat; transition: background-size .35s var(--ease); }
.pub h3 a:hover { background-size: 100% 1px; }
.pub-authors { margin-top: 10px; color: var(--text-2); font-size: 15px; }
.pub-venue { margin-top: 4px; color: var(--muted); font-size: 14px; }
.pub-venue em { font-size: 1.1em; color: var(--text-2); }
.pub-abstract { margin-top: 16px; }
.pub-abstract summary {
  cursor: pointer; width: fit-content; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent);
  list-style: none;
}
.pub-abstract summary::-webkit-details-marker { display: none; }
.pub-abstract summary::before { content: "+ "; }
.pub-abstract[open] summary::before { content: "− "; }
.pub-abstract p { margin-top: 10px; color: var(--text-2); font-size: 15px; max-width: 760px; }
.pub-side { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 190px; }
.pub-side .btn { justify-content: center; }
.pub-demo { margin-top: 4px; font-size: 13px; color: var(--text-2); text-align: center; }
.pub-demo:hover { color: var(--accent); }

/* ---------- colophon ---------- */
.col-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; }
.vitals { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; }
.vitals div { padding: 18px 20px; border-radius: 12px; }
.vitals div:nth-child(4n+1), .vitals div:nth-child(4n+4) { background: var(--surface-2); }
.vitals dt { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.vitals dd { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.vitals dd small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.vitals dd[data-m="sw"], .vitals dd[data-m="js"] { font-size: 16px; line-height: 1.4; padding-top: 6px; }
.built { padding: 28px; display: flex; flex-direction: column; }
.built h3 { font-size: 20px; font-weight: 600; margin-bottom: 14px; }
.built li { padding: 12px 0; border-top: 1px solid var(--line); color: var(--text-2); font-size: 15px; }
.built-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 20px; }

/* ---------- shortcuts dialog ---------- */
.keys-panel { padding: 8px 8px 16px; }
.keys-panel header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 12px; }
.keys-panel h2 { font-size: 16px; font-weight: 600; }
.keys-panel dl div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 14px; }
.keys-panel dd { color: var(--text-2); text-align: right; }
.keys-panel dt { white-space: nowrap; }
.keys-foot { padding: 12px 12px 0; font-size: 12px; color: var(--muted); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 120; pointer-events: none; }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .hero-grid { grid-template-columns: 1fr; gap: 56px; min-height: 0; }
  .stage { justify-self: center; max-width: 440px; height: 540px; }
  .console { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .case { grid-template-columns: 1fr; padding: 32px; }
  .case-rev .case-copy { order: 0; }
  .narr { position: static; }
  .skills { grid-template-columns: 1fr 1fr; }
  .edu-grid { grid-template-columns: 1fr; }
  .col-grid { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; }
  .pub-side { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .pub-demo { align-self: center; }
  .award-feature { aspect-ratio: 16 / 11; }
}
@media (max-width: 820px) {
  .nav-links { display: none; }
  .about-grid { grid-template-columns: 1fr; grid-template-areas: "head" "portrait" "copy"; }
  .portrait { max-width: 280px; }
  .timeline::before, .timeline::after { left: 5px; }
  .job { grid-template-columns: 1fr; padding-left: 30px; }
  .job-meta { padding: 0 0 12px; }
  .job-meta::after { left: -30px; right: auto; top: 5px; }
  .mini-grid { grid-template-columns: 1fr; }
  .mini-wide { flex-direction: column; align-items: stretch; }
  .mini-wide .board { width: 100%; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .nav { top: 10px; width: calc(100% - 20px); }
  .kbd-btn kbd { display: none; }
  .brand-name { display: none; }
  .hero { padding-top: 104px; }
  .hero-grid { gap: 28px; }
  .stage { order: -1; max-width: 320px; height: 380px; margin-top: 4px; }
  .console { margin-top: 36px; }
  .lede { font-size: 16.5px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics li { padding: 16px 18px; }
  .section { padding-top: 96px; }
  .job-body { padding: 22px 20px; }
  .case { padding: 22px; gap: 28px; }
  .case-visual { padding: 18px 12px; min-height: 0; }
  .pipeline { grid-template-columns: 1fr; gap: 0; }
  .pl-link { min-height: 36px; flex-direction: row; justify-content: center; gap: 24px; }
  .pl-link i { width: 1px; height: 36px; }
  .pl-link i::after { width: 3px; height: 30%; top: -30%; left: -1px; background: linear-gradient(180deg, transparent, var(--accent-2)); animation-name: flow-v; }
  .skills { grid-template-columns: 1fr; }
  .mini { padding: 24px; }
  .facts { grid-template-columns: 1fr; }
  .facts div:nth-child(odd) { padding-right: 0; }
  .term-body { font-size: 12.5px; height: 300px; padding: 14px 16px; }
  .console .term-body { min-height: 280px; max-height: 300px; }
  .term-key { display: none; }
  .ask { padding: 18px; }
  .ask-form { padding-left: 14px; }
  .ask-form input { font-size: 16px; }
  .ask-kbd { display: none; }
  .vitals { grid-template-columns: 1fr; }
  .vitals div:nth-child(n) { background: none; }
  .vitals div:nth-child(odd) { background: var(--surface-2); }
  .sim-log li { grid-template-columns: 46px 44px 1fr; }
  .narr-code { font-size: 12px; }
  .narr-code li { white-space: pre-wrap; overflow-wrap: anywhere; }
  .narr-code li { padding-left: 40px; }
  .narr-code li::before { width: 26px; }
  .narr-code .ind { width: calc(var(--d) * 2.5ch); background-size: 2.5ch 100%; background-image: repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 2.5ch); }
  .pub { padding: 22px; }
  .foot { justify-content: center; text-align: center; }
}
@keyframes flow-v { to { top: 100%; } }

/* Reduce, don't remove: with Reduce Motion on, movement becomes a gentle dissolve (the way iOS itself
   handles it). Fades, typing and counting stay; sliding, parallax and continuous drift stop. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { transform: none; transition: opacity .7s ease; transition-delay: var(--d, 0s); }
  .rotator .rw, .rotator .rw.out { transform: none; }
  .arch, .cutout { animation: fade-in .9s ease both; }
  .arch-sheen, .marquee-track, .board::after, .wave i, .narr-wave i, .pl-link i::after { animation: none; }
  .dot::after { display: none; }
  .stage [data-depth] { translate: none !important; }
  .btn:hover, .ext:hover, .portrait:hover img { transform: none; }
  .award-feature:hover img { transform: scale(1.14); }
  .ask-hit, .sim-log li, .cmdk-panel, .lightbox img { animation-name: fade-in; }
  #clusters svg { transition: opacity .3s ease; }
  #clusters.fading svg { opacity: 0; }
}
@keyframes fade-in { from { opacity: 0; } }


/* ---------- touch devices: lighter rendering, no hover-only affordances ---------- */
.on-touch { display: none; }
.cmdk-close { display: none; width: 34px; height: 34px; margin-right: -6px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: 14px; }
@media (hover: none) {
  /* iOS keeps :hover "stuck" after a tap, so hover lifts become press feedback instead. */
  .btn:hover, .ext:hover { transform: none; }
  .btn, .more-btn, .suggest button, .narr-play, .narr-sound, .sim-run, .cl-rerun, .kbd-btn, .icon-btn { transition: transform .15s ease, background .2s, border-color .2s, color .2s; }
  .btn:active, .more-btn:active, .suggest button:active, .narr-play:active, .narr-sound:active, .sim-run:active, .cl-rerun:active, .kbd-btn:active, .icon-btn:active { transform: scale(.96); }
  .stage.scroll-depth [data-depth] { transition: none; }
  .on-hover, .on-hover-flex, .cmdk-esc { display: none; }
  .on-touch { display: inline; }
  .cmdk-close { display: grid; place-items: center; }
}
@media (pointer: coarse) {
  /* Blurring an animated background under every card is expensive on phone GPUs. */
  .card, .metrics li, .terminal, .award-list li { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .card { background: color-mix(in srgb, var(--bg-2) 94%, transparent); }
  .metrics li { background: var(--bg-2); }
  .spot::before { transition: opacity .6s ease; }
  /* iOS zooms the whole page when an input's text is under 16px. */
  .term-input, .cmdk-input input, .ask-form input { font-size: 16px; }
}

/* collapsible bullet lists (phones) */
.is-collapsed > li:nth-child(n+3) { display: none; }
.more-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; font-size: 13px; color: var(--text-2);
}
.more-btn::after { content: "▾"; font-size: 11px; transition: transform .2s; }
.more-btn[aria-expanded="true"]::after { transform: rotate(180deg); }

@media (max-width: 600px) {
  .section { padding-top: 76px; }
  .sec-head { margin-bottom: 30px; }
  .sec-head h2, .contact h2 { font-size: clamp(30px, 8.4vw, 40px); }
  .eyebrow { margin-bottom: 12px; }
  .about-copy .big { font-size: 19px; }
  .timeline { margin-top: -4px; }
  .job { padding-bottom: 20px; }
  .job-body > ul:not(.chips) li, .sub li { font-size: 14.5px; }
  .case { margin-bottom: 18px; }
  .case h3, .mini h3 { font-size: 26px; }
  .kv { margin: 20px 0; }
  .kv b { font-size: 21px; }

  /* Stack: swipeable row instead of six stacked cards */
  .skills {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    margin: 0 -16px; padding: 2px 16px 14px; scroll-padding: 0 16px; scrollbar-width: none;
  }
  .skills::-webkit-scrollbar { display: none; }
  .skill { flex: 0 0 84%; scroll-snap-align: start; }
  .skills-hint { display: flex; }

  /* Under the hood: two columns of vitals */
  .vitals { grid-template-columns: 1fr 1fr; padding: 6px; }
  .vitals div { padding: 14px; }
  .vitals div:nth-child(n) { background: none; }
  .vitals div:nth-child(4n+1), .vitals div:nth-child(4n+4) { background: var(--surface-2); }
  .vitals dd { font-size: 20px; }
  .vitals dt { font-size: 10.5px; }
  .vitals dd[data-m="sw"], .vitals dd[data-m="js"] { font-size: 14px; }
  .built { padding: 22px; }
  .built li { font-size: 14.5px; }

  .contact { padding-bottom: 72px; }
  .edu, .certs { padding: 22px; }
}
.skills-hint { display: none; align-items: center; gap: 6px; margin-top: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ---------- print: a clean, résumé-like printout ---------- */
@media print {
  :root, :root[data-theme] { --bg: #fff; --bg-2: #fff; --surface: #fff; --surface-2: #f4f4f4; --text: #000; --text-2: #222; --muted: #555; --line: #ddd; --line-2: #ccc; --accent: #3a2bd6; --glow: transparent; }
  #field, .grain, .progress, .nav, .terminal, .marquee, .case-visual, .mini .wave, .mini .board, #ask, #colophon, .contact-actions, .cmdk, .lightbox, .toast, .skip, .footer a { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .hero { min-height: 0; padding: 0; }
  .section { padding: 24px 0 0; }
  .sec-head { break-inside: avoid; break-after: avoid; }
  .card { border: 1px solid #ddd; backdrop-filter: none; box-shadow: none; }
  .case { grid-template-columns: 1fr; padding: 16px; }
  .sub, .job-body > ul, .skill, .edu, .certs, .case, .mini, .award-list, .contact-card { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .h-line em, .rotator .rw { color: #3a2bd6 !important; -webkit-text-fill-color: #3a2bd6; background: none; }
  .rotator .rw:not(.on) { display: none; }
  .status, .cta, .sec-sub, .portrait, .award-feature, .mini-grid .ext { display: none !important; }
  .print-only { display: block !important; margin-top: 12px; font-family: var(--mono); font-size: 9.5pt; color: #333; }
  .h-line { font-size: 30pt; }
  .lede { max-width: none; font-size: 11pt; margin-top: 10px; }
  .hero-grid { display: block; min-height: 0; }
  .stage, .contact-avatar, .pub-side, .case-actions, .pub-badge { display: none !important; }
  .pub { display: block; padding: 16px; break-inside: avoid; }
  .pub-abstract summary { display: none; }
  .console { display: block; margin-top: 18px; }
  .metrics { grid-template-columns: repeat(6, 1fr); }
  .metrics li { padding: 10px 12px; background: #fff; }
  .metrics b { font-size: 18pt; }
  .sec-head { margin-bottom: 14px; }
  .sec-head h2 { font-size: 20pt; }
  .eyebrow { margin-bottom: 4px; }
  .about-grid { display: block; }
  .about-copy .big { font-size: 12.5pt; margin-bottom: 8px; }
  .facts { margin-top: 14px; }
  .timeline::before, .timeline::after, .job-meta::after { display: none; }
  .job { grid-template-columns: 150px 1fr; gap: 0 16px; padding-bottom: 12px; }
  .job-meta { padding-top: 14px; }
  .job-body { padding: 14px 18px; }
  .case { gap: 10px; margin-bottom: 12px; }
  .kv { margin: 12px 0; grid-template-columns: repeat(4, 1fr); }
  .skills { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .skill { padding: 14px; }
  .edu-grid { grid-template-columns: 1fr 1fr; }
  .contact-card { padding: 20px; }
}
.print-only { display: none; }

/* Touch devices: keyboard hints are noise. */
@media (hover: none) {
  .cmdk-item .hint, .kbd-btn kbd, .term-key, .ask-kbd { display: none; }
}
