:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #161513;
  --muted: #6b665e;
  --line: #e2ddd4;
  --accent: #c2410c;
  --accent-soft: #fbe6d4;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 14px;
  --max: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12110f; --surface: #1b1a17; --ink: #f1ede6; --muted: #a39d93;
    --line: #2d2a26; --accent: #f2a93b; --accent-soft: #3a2a14; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12110f; --surface: #1b1a17; --ink: #f1ede6; --muted: #a39d93;
  --line: #2d2a26; --accent: #f2a93b; --accent-soft: #3a2a14; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
html, body { overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
b, strong { font-weight: 600; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px max(16px, calc((100% - var(--max)) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.nav__brand { font: 600 22px var(--serif); text-decoration: none; }
.nav__brand span { color: var(--accent); }
.nav__links { display: flex; gap: 22px; margin-left: auto; }
.nav__links a { text-decoration: none; font-size: 14px; color: var(--muted); transition: color .2s; }
.nav__links a:hover, .nav__links a.active { color: var(--ink); }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
/* The icon shows the theme you'd switch to: a moon in light mode, a sun in dark mode */
.theme-toggle svg { grid-area: 1 / 1; transition: transform .5s cubic-bezier(.22,1,.36,1), opacity .3s ease; }
.theme-toggle .icon-sun { color: var(--accent); opacity: 0; transform: rotate(-90deg) scale(.4); }
.theme-toggle:hover .icon-moon { transform: rotate(-15deg); }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.4); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle:hover .icon-sun { transform: rotate(45deg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.4); }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { opacity: 1; transform: none; }
  :root:not([data-theme="light"]) .theme-toggle:hover .icon-sun { transform: rotate(45deg); }
}
@media (prefers-reduced-motion: reduce) { .theme-toggle svg { transition: none; } }

main { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* HERO */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center;
  padding: 72px 0 56px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px;
  font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 4px #16a34a33; }
.hero h1 { font-size: clamp(44px, 7vw, 84px); }
.hero__lede { font-size: 19px; color: var(--muted); max-width: 34em; margin: 22px 0 30px; }
.hero__lede strong { color: var(--ink); }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px; border: 1px solid var(--ink);
  text-decoration: none; font-weight: 500; font-size: 15px; transition: transform .15s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--solid { background: var(--ink); color: var(--bg); }
.socials { list-style: none; padding: 0; margin: 28px 0 0; display: flex; gap: 20px; flex-wrap: wrap; }
.socials a { font: 500 13px var(--mono); color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.socials a:hover { color: var(--accent); border-color: var(--accent); }
/* Hero photo stack: two photos, click to bring the back one forward */
.hero__photo { margin: 0; width: 220px; justify-self: end; }
.stack__deck {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0;
  border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.stack__deck:focus-visible { outline: 2px solid var(--accent); outline-offset: 10px; border-radius: 20px; }
.stack__card {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--focus, 50% 50%);
  border-radius: 18px; border: 1px solid var(--line);
  box-shadow: 0 24px 50px -28px rgb(0 0 0 / .45);
  transition: transform .6s cubic-bezier(.22, 1, .36, 1), filter .6s ease, z-index 0s .25s;
}
.stack__card[data-pos="0"] { z-index: 2; transform: none; }
.stack__card[data-pos="1"] { z-index: 1; transform: translate(7%, -5%) rotate(4deg); filter: saturate(.8) brightness(.92); }
@media (hover: hover) {
  .stack__deck:hover .stack__card[data-pos="0"] { transform: translateY(-4px); }
  .stack__deck:hover .stack__card[data-pos="1"] { transform: translate(10%, -7%) rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) { .stack__card { transition: none; } }
figcaption { font: 12px var(--mono); color: var(--muted); margin-top: 22px; }
p, dd, .skills p { text-wrap: pretty; }

/* STATS */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stats div { padding: 26px 20px 26px 0; }
.stats div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.stats b { display: block; font: 400 30px var(--serif); color: var(--accent); }
.stats span { font-size: 13.5px; color: var(--muted); }

/* NOW (current programme) — a quiet nod to Xebia's purple and gradient */
.now {
  --x-ink: #831b84;
  --x-tint: #f3e8f3;
  --x-grad: linear-gradient(90deg, #ff6d73, #e05bef 55%, #6a00ff);
  position: relative; overflow: hidden;
  margin-top: 40px; padding: 26px 28px 24px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--x-ink) 22%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--x-tint) 75%, var(--surface)), var(--surface) 62%);
}
.now::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--x-grad); }
.now__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.now .kicker { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--x-ink); }
.now .dot { background: var(--x-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--x-ink) 20%, transparent); }
.now__badge {
  font: 500 11.5px var(--mono); letter-spacing: .04em; padding: 4px 10px; border-radius: 999px;
  color: var(--x-ink); background: color-mix(in srgb, var(--x-ink) 10%, transparent);
}
.now h2 { font-size: clamp(22px, 2.6vw, 30px); }
.now__lede { margin: 8px 0 0; color: var(--muted); max-width: 52em; }
.now__lede em { font-style: normal; color: var(--ink); font-weight: 500; }

.track { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.track > li { position: relative; padding-top: 16px; border-top: 2px solid var(--line); }
.track > li.is-now, .track > li.is-done { border-image: var(--x-grad) 1; }
.track > li.is-now::before {
  content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: #e05bef; box-shadow: 0 0 0 4px color-mix(in srgb, #e05bef 25%, transparent);
  animation: now-pulse 2.4s ease-in-out infinite;
}
.track span { display: block; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.track .is-now span { color: var(--x-ink); }
.track b { display: block; font: 400 19px/1.25 var(--serif); margin-top: 4px; }
.track small { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.track > li:not(.is-now):not(.is-done):not(.now__stage) b { color: var(--muted); }
@keyframes now-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, #e05bef 0%, transparent); } }

/* October and November are buttons: a click or tap plays that month's scene below */
.track__btn {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.track__btn b { display: inline; background: linear-gradient(var(--x-ink), var(--x-ink)) 0 100% / 0 1.5px no-repeat; transition: background-size .35s ease, color .2s; }
.track__btn:hover b, .track__btn[aria-expanded="true"] b { background-size: 100% 1.5px; color: var(--x-ink); }
.track__btn:focus-visible { outline: 2px solid var(--x-ink); outline-offset: 4px; border-radius: 6px; }
.track__cue {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font: 500 12px var(--mono); font-style: normal; color: var(--x-ink); opacity: .8; transition: opacity .25s;
}
/* Same arrow as "Read the story" and "Explore the study": it points right and nudges on hover */
.track__arrow { display: inline-block; font-style: normal; transition: transform .3s cubic-bezier(.22,1,.36,1); }
.track__btn:hover .track__cue, .track__btn[aria-expanded="true"] .track__cue { opacity: 1; }
.track__btn:hover .track__arrow, .track__btn[aria-expanded="true"] .track__arrow { transform: translateX(4px); }

/* The stage the scenes play on; collapsed until a month is chosen */
.track > li.now__stage { grid-column: 1 / -1; margin-top: -16px; padding: 0; border: 0; }
.now__stage { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s cubic-bezier(.22,1,.36,1) .1s; }
.now__stage > div { display: grid; min-height: 0; overflow: hidden; }
.now.is-showing .now__stage { grid-template-rows: 1fr; transition-delay: 0s; }
.scene {
  grid-area: 1 / 1; margin: 0; padding-top: 22px;
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 26px; align-items: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s ease, transform .4s ease, visibility 0s linear .25s;
}
.scene.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .45s ease .1s, transform .55s cubic-bezier(.22,1,.36,1) .1s, visibility 0s; }
.scene svg {
  display: block; width: 100%; height: auto; padding: 10px 8px 4px; border-radius: 12px;
  background: color-mix(in srgb, var(--x-ink) 5%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--x-ink) 16%, var(--line));
}
.scene figcaption { margin: 0; font: 16px/1.65 var(--sans); }
.scene figcaption ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.scene figcaption li { position: relative; padding-left: 16px; font-size: 14px; line-height: 1.45; color: var(--ink); }
.scene figcaption li::before { content: ""; position: absolute; left: 2px; top: .58em; width: 5px; height: 5px; border-radius: 50%; background: var(--x-ink); opacity: .7; }

/* Scene parts */
.scene svg * { transform-box: fill-box; transform-origin: center; }
.s-box { fill: var(--surface); stroke: var(--x-ink); stroke-width: 1.6; stroke-linejoin: round; }
.s-dot { fill: color-mix(in srgb, var(--x-ink) 40%, transparent); }
.s-ln { fill: color-mix(in srgb, var(--x-ink) 32%, transparent); transform-origin: left; }
.s-flow { fill: none; stroke: var(--x-ink); stroke-width: 2; stroke-dasharray: 4 6; opacity: .6; }
.s-lane { fill: none; stroke: color-mix(in srgb, var(--x-ink) 30%, transparent); stroke-width: 1.5; stroke-dasharray: 3 5; }
.s-whale, .o-boxes rect { fill: color-mix(in srgb, #2496ed 78%, var(--surface)); }
.o-boxes rect { stroke: var(--surface); stroke-width: 1.5; }
.s-eye { fill: var(--surface); }
.s-wave { fill: none; stroke: #2496ed; stroke-width: 1.4; opacity: .3; }
.s-vm { fill: var(--x-ink); opacity: .85; transform-origin: bottom; }
.s-pkt rect { fill: var(--x-ink); }
.s-pkt--back rect { fill: #e05bef; }
.s-pkt text { fill: #fff; font: 600 8.5px var(--mono); text-anchor: middle; }
.o-post { opacity: 0; }
.s-lbl { fill: var(--muted); font: 500 11px var(--mono); letter-spacing: .03em; text-anchor: middle; }
.s-ai { fill: var(--x-ink); font: 600 19px var(--mono); text-anchor: middle; }
.s-cam { fill: var(--x-ink); }
.o-cone { transform-origin: top; }
.o-visitor { fill: var(--ink); opacity: .7; }
.o-detect { fill: none; stroke: #ff6d73; stroke-width: 1.5; stroke-dasharray: 3 2; }
.o-ping, .o-arc { fill: none; stroke: #e05bef; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 10 100; stroke-dashoffset: 10; }
.o-rank { fill: #ff6d73; transform-origin: left; }
.s-note { fill: color-mix(in srgb, var(--x-ink) 10%, var(--surface)); stroke: var(--x-ink); stroke-width: 1; }
.s-alert { fill: #ff6d73; }
.s-btn { fill: none; stroke: color-mix(in srgb, var(--x-ink) 45%, transparent); stroke-width: 1.2; }
.s-btn--go { fill: var(--x-ink); stroke: none; }
.o-tap { fill: #e05bef; opacity: 0; }

/* October: code is typed, packed by the whale, scaled in the cloud, then talks to Gemini */
.scene.is-on .o-code .s-ln { animation: type .5s ease-out backwards; }
.scene.is-on .o-code .s-ln:nth-of-type(2) { animation-delay: .25s; }
.scene.is-on .o-code .s-ln:nth-of-type(3) { animation-delay: .45s; }
.scene.is-on .s-flow { animation: flow .8s linear infinite; }
.scene.is-on .o-boxes rect { animation: drop .45s cubic-bezier(.34,1.56,.64,1) backwards; }
.scene.is-on .o-boxes rect:nth-child(2) { animation-delay: .5s; }
.scene.is-on .o-boxes rect:nth-child(3) { animation-delay: .58s; }
.scene.is-on .o-boxes rect:nth-child(4) { animation-delay: .66s; }
.scene.is-on .o-boxes rect:nth-child(5) { animation-delay: .74s; }
.scene.is-on .o-boxes rect:nth-child(6) { animation-delay: .82s; }
.scene.is-on .o-boxes rect:nth-child(7) { animation-delay: .9s; }
.scene.is-on .o-boxes rect:nth-child(1) { animation-delay: .42s; }
.scene.is-on .o-whale { animation: bob 3s ease-in-out infinite; }
.scene.is-on .s-wave { animation: wave 2s linear infinite; }
.scene.is-on .s-vm2 { animation: scale-out 4s ease-in-out infinite; }
.scene.is-on .s-vm3 { animation: scale-out 4s ease-in-out .4s infinite; }
.scene.is-on .o-get { --d: 52px; animation: send 2.4s ease-in-out infinite; }
.scene.is-on .o-post { --d: 48px; animation: send 2.4s ease-in-out 1.2s infinite; }
.scene.is-on .o-json { --d: -56px; animation: send 2.4s ease-in-out .6s infinite; }
.scene.is-on .o-star { animation: twinkle 2.4s ease-in-out infinite alternate; }

/* November: a camera spots someone, AI flags and explains it, the owner abroad decides */
.scene.is-on .o-cone { animation: sweep 2.5s ease-in-out infinite alternate; }
.scene.is-on .o-visitor { animation: visitor 5s ease infinite; }
.scene.is-on .o-detect { animation: detect 5s ease infinite; }
.scene.is-on .o-ping { animation: ping 5s ease-in-out infinite; }
.scene.is-on .o-ai { animation: think 5s ease infinite; }
.scene.is-on .o-rank { animation: rank 5s ease infinite; }
.scene.is-on .o-arc { animation: arc 5s ease-in-out infinite; }
.scene.is-on .o-note { animation: note 5s ease infinite; }
.scene.is-on .o-acts { animation: acts 5s ease infinite; }
.scene.is-on .o-tap { animation: tap 5s ease-out infinite; }

@keyframes type { from { transform: scaleX(0); } }
@keyframes flow { to { stroke-dashoffset: -20; } }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes wave { to { transform: translateX(-20px); } }
@keyframes scale-out { 0%, 12% { transform: scaleY(0); opacity: 0; } 28%, 72% { transform: none; opacity: .85; } 88%, 100% { transform: scaleY(0); opacity: 0; } }
@keyframes send { 0% { transform: translateX(0); opacity: 0; } 15%, 80% { opacity: 1; } 100% { transform: translateX(var(--d)); opacity: 0; } }
@keyframes twinkle { from { transform: scale(.92) rotate(0deg); } to { transform: scale(1.1) rotate(20deg); } }
@keyframes sweep { from { transform: rotate(-10deg); } to { transform: rotate(6deg); } }
@keyframes visitor { 0%, 10% { opacity: 0; transform: translateX(-10px); } 20%, 88% { opacity: .7; transform: none; } 100% { opacity: 0; } }
@keyframes detect { 0%, 22% { opacity: 0; transform: scale(1.4); } 28% { opacity: 1; transform: none; } 31% { opacity: .2; } 34%, 88% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ping { 0%, 32% { stroke-dashoffset: 10; } 44%, 100% { stroke-dashoffset: -100; } }
@keyframes think { 0%, 42% { transform: none; } 47% { transform: scale(1.07); } 54%, 100% { transform: none; } }
@keyframes rank { 0%, 44% { transform: scaleX(0); } 54%, 90% { transform: none; } 100% { transform: scaleX(0); } }
@keyframes arc { 0%, 50% { stroke-dashoffset: 10; } 68%, 100% { stroke-dashoffset: -100; } }
@keyframes note { 0%, 64% { opacity: 0; transform: translateY(-8px); } 70%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes acts { 0%, 70% { opacity: 0; } 76%, 94% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tap { 0%, 82% { opacity: 0; transform: scale(.3); } 86% { opacity: .6; transform: scale(1); } 94%, 100% { opacity: 0; transform: scale(1.9); } }

@media (prefers-reduced-motion: reduce) {
  .track > li.is-now::before { animation: none; }
  .scene, .scene *, .now__stage { animation: none !important; transition: none !important; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .now { --x-ink: #ee83e3; --x-tint: #370038; }
}
:root[data-theme="dark"] .now { --x-ink: #ee83e3; --x-tint: #370038; }

/* RESEARCH (capstone) — preview card that opens into a study panel; Thapar maroon and gold */
.research, .study {
  --t-gold: #c08a1e;
  --t-ink: #7a0c0c;
  --t-tint: #f7e8e4;
  --t-grad: linear-gradient(90deg, #640000, #a8322d 55%, #d4a237);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.research, .study) { --t-gold: #e9bc58; --t-ink: #f2a596; --t-tint: #3b0d10; --t-grad: linear-gradient(90deg, #c0392b, #e57a68 55%, #e9bc58); }
}
:root[data-theme="dark"] :is(.research, .study) { --t-gold: #e9bc58; --t-ink: #f2a596; --t-tint: #3b0d10; --t-grad: linear-gradient(90deg, #c0392b, #e57a68 55%, #e9bc58); }

.research {
  position: relative; overflow: hidden; cursor: pointer;
  margin: -12px 0 32px; padding: 20px 24px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--t-ink) 22%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--t-tint) 75%, var(--surface)), var(--surface) 62%);
  display: grid; grid-template-columns: 180px 1fr; gap: 8px 28px; align-items: center;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.research::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--t-grad); }
.research:hover, .research.reveal.in:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--t-ink) 45%, var(--line)); box-shadow: 0 22px 44px -30px color-mix(in srgb, var(--t-ink) 60%, transparent); }
.research__visual .viz-caption { display: none; }
.research__top, .study__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
:is(.research, .study) .kicker { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--t-ink); }
:is(.research, .study) .dot { background: var(--t-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--t-ink) 20%, transparent); }
.research__badge {
  font: 500 11.5px var(--mono); letter-spacing: .04em; padding: 4px 10px; border-radius: 999px;
  color: var(--t-ink); background: color-mix(in srgb, var(--t-ink) 10%, transparent);
}
.research h3 { font-size: clamp(19px, 2.1vw, 23px); line-height: 1.25; margin: 0; }
.research__open { all: unset; cursor: pointer; }
.research__open::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.research__open:focus-visible::after { outline: 2px solid var(--t-ink); outline-offset: -2px; }
.research__summary { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.research__cue { display: inline-flex; gap: 6px; margin-top: 10px; font: 500 12.5px var(--mono); color: var(--t-ink); }
.research__arrow { transition: transform .25s ease; }
.research:hover .research__arrow { transform: translateX(4px); }

/* Diagram (shared) */
.research__viz { display: block; width: 100%; height: auto; }
.viz-over { fill: var(--t-ink); opacity: .7; }
.viz-uav { fill: var(--muted); opacity: .7; }
.viz-centroid { fill: var(--surface); stroke-width: 2.5; }
.viz-centroid--over { stroke: var(--t-ink); }
.viz-centroid--uav { stroke: var(--ink); }
.viz-drift { stroke: var(--t-ink); stroke-width: 2; stroke-dasharray: 5 5; animation: viz-flow 1.6s linear infinite; }
.viz-label { font: 600 13px var(--mono); fill: var(--t-ink); }
.viz-caption { font: 12px var(--mono); fill: var(--muted); }
@keyframes viz-flow { to { stroke-dashoffset: -20; } }

/* Panels: a card opens into one of these (capstone and projects share the frame) */
.panel {
  --p-ink: var(--accent); --p-tint: var(--accent-soft); --p-grad: linear-gradient(90deg, var(--accent), #f2a93b);
  width: min(900px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 48px); overflow: auto; overscroll-behavior: contain;
  padding: 30px 32px 26px; border-radius: 18px; color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--p-ink) 25%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--p-tint) 80%, var(--surface)), var(--surface) 55%) var(--surface);
  box-shadow: 0 40px 80px -30px rgb(0 0 0 / .5);
}
.study { --p-ink: var(--t-ink); --p-tint: var(--t-tint); --p-grad: var(--t-grad); }
.panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--p-grad); }
.panel::backdrop { background: rgb(12 10 8 / .55); backdrop-filter: blur(4px); }
.panel h2 { font-size: clamp(26px, 3vw, 36px); margin: 6px 40px 0 0; }
.panel__close {
  position: sticky; top: 0; float: right; margin: -14px -16px 0 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s;
}
.panel__close:hover { border-color: var(--p-ink); color: var(--p-ink); transform: rotate(90deg); }
.panel__close:focus-visible { outline: 2px solid var(--p-ink); outline-offset: 2px; }

/* Capstone panel content */
.study__head { padding-right: 8px; }
.study__grid { display: grid; grid-template-columns: 320px 1fr; gap: 32px; align-items: center; margin-top: 20px; }
.study__figure { margin: 0; }
.study__figure figcaption { margin-top: 8px; font: 12px/1.5 var(--mono); color: var(--muted); }
.study__body p { margin: 0; color: var(--muted); }
.research__stats { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.research__stats li { padding-top: 10px; border-top: 2px solid color-mix(in srgb, var(--t-ink) 35%, var(--line)); }
.research__stats b { display: block; font: 400 21px/1.2 var(--serif); color: var(--t-ink); }
.research__stats span { display: block; font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 4px; }
.research__stack { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font: 12.5px var(--mono); color: var(--muted); }
.study__more { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.study__more h3 { font-size: 20px; margin: 0 0 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; counter-reset: step; }
.steps li { position: relative; padding: 12px 12px 12px; border-radius: 12px; background: color-mix(in srgb, var(--t-ink) 6%, var(--surface)); counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; margin-bottom: 8px; border-radius: 50%; font: 600 11px var(--mono); color: var(--surface); background: var(--t-ink); }
.steps b { display: block; font-size: 14px; }
.steps span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.charts { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-top: 20px; }
.chart { margin: 0; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.chart figcaption { margin-bottom: 12px; }
.chart figcaption b { display: block; font-size: 14.5px; }
.chart figcaption span { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.chart__row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin: 7px 0; }
.chart__label { font: 12px var(--mono); color: var(--muted); }
.chart__bars { display: grid; gap: 3px; }
.bar { display: flex; align-items: center; gap: 6px; }
.bar i { display: block; height: 10px; width: calc(var(--v) * 0.85%); border-radius: 0 5px 5px 0; background: var(--bar, var(--t-ink)); transform-origin: left; }
.bar em { font: normal 11px var(--mono); color: var(--muted); }
.bar--remote { --bar: var(--t-ink); }
.bar--tuned { --bar: var(--t-gold); }
.bar--clip { --bar: color-mix(in srgb, var(--ink) 45%, transparent); }
.chart__key { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; font: 11.5px var(--mono); color: var(--muted); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.key:first-child { margin-left: 0; }
.key--remote { background: var(--t-ink); }
.key--tuned { background: var(--t-gold); }
.key--clip { background: color-mix(in srgb, var(--ink) 45%, transparent); }
.study__takeaway { margin: 18px 0 0; padding: 12px 16px; border-left: 3px solid var(--t-ink); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--t-ink) 7%, transparent); }
.study__takeaway b { color: var(--t-ink); }
.panel[open] .bar i { animation: bar-grow .9s cubic-bezier(.22,1,.36,1) both; }
.panel[open] .chart__row:nth-of-type(2) .bar i { animation-delay: .06s; }
.panel[open] .chart__row:nth-of-type(3) .bar i { animation-delay: .12s; }
.panel[open] .chart__row:nth-of-type(4) .bar i { animation-delay: .18s; }
.panel[open] .chart__row:nth-of-type(5) .bar i { animation-delay: .24s; }
.panel[open] .chart__row:nth-of-type(6) .bar i { animation-delay: .3s; }
.panel[open] .chart__row:nth-of-type(7) .bar i { animation-delay: .36s; }
@keyframes bar-grow { from { transform: scaleX(0); } }

html.study-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .viz-drift, .study[open] :is(.viz-over, .viz-uav, .viz-centroid, .viz-drift, .viz-label), .panel[open] .bar i { animation: none; }
  .research, .research__arrow { transition: none; }
}

/* Project cards: whole card toggles the extra detail; links stay clickable on top */
.project { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.project__open { all: unset; cursor: pointer; }
.project__card { position: relative; }
.project__open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.project__open:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.project__what { margin: 0 0 16px; color: var(--muted); }
.project__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.project__foot .project__links { margin-top: 0; padding-top: 0; position: relative; z-index: 1; }
.project__cue { display: inline-flex; gap: 6px; font: 500 12.5px var(--mono); color: var(--accent); }
.project__arrow { display: inline-block; transition: transform .35s cubic-bezier(.22,1,.36,1); }

/* SECTIONS */
.section { padding: 100px 0 0; }
.section__head { margin-bottom: 44px; }
.kicker { font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.section h2 { font-size: clamp(32px, 4.6vw, 52px); max-width: 16em; }
.subhead { font-size: 26px; margin: 64px 0 20px; }

/* ABOUT */
.about__grid { display: grid; grid-template-columns: 260px 1fr; gap: 64px; align-items: start; }
/* Profile card: photo with quick facts underneath, stays in view beside the text */
.profile {
  position: sticky; top: 96px; padding: 10px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 20px 40px -32px rgb(0 0 0 / .35);
}
.profile__photo { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 22%; border-radius: 12px; }
.profile .facts { grid-template-columns: 1fr 1fr; gap: 0 14px; margin: 6px 6px 0; border-top: 0; }
.profile .facts div { padding: 10px 0; }
.profile .facts div:nth-last-child(-n+2) { border-bottom: 0; padding-bottom: 4px; }
.profile .facts dt { font-size: 11px; }
.profile .facts dd { font-size: 14.5px; line-height: 1.35; text-wrap: balance; }
.about__body p { font-size: 17.5px; margin: 0 0 18px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 30px 0 0; border-top: 1px solid var(--line); }
.facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font: 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 2px 0 0; font-weight: 500; }

/* PROJECTS */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -16px 0 24px; }
.filters button {
  font: 500 13px var(--sans); padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted); transition: all .2s;
}
.filters button:hover { color: var(--ink); border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.project[hidden] { display: none; }
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; }
/* Two independent stacks, so expanding a card only moves the cards below it in the same column */
.projects__cols { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.projects__col { display: flex; flex-direction: column; gap: 20px; }
.project__card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; transform-origin: 50% 0;
  transition: transform .5s cubic-bezier(.22,1,.36,1), box-shadow .5s cubic-bezier(.22,1,.36,1), border-color .3s ease;
}
html:not(.is-touch) .project:hover .project__card { border-color: var(--accent); }
/* Expand in place: hover (mouse) or tap/Enter (any device) reveals the rest; cards below move down to make room */
.project__more {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .45s cubic-bezier(.22,1,.36,1) .12s, opacity .3s ease .12s;
}
.project__more > div { overflow: hidden; min-height: 0; }
.project__why { margin: 0 0 10px !important; }
.project__more .bullets { margin: 0 0 16px; }
.project.is-open .project__more { grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .5s cubic-bezier(.22,1,.36,1), opacity .4s ease .06s; }
.project.is-open .project__card { box-shadow: 0 24px 48px -30px rgb(0 0 0 / .4); border-color: var(--accent); }
.project.is-open .project__arrow { transform: rotate(90deg); }
@media (hover: hover) {
  html:not(.is-touch) .project:hover:not(.is-shut) .project__more { grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .5s cubic-bezier(.22,1,.36,1), opacity .4s ease .06s; }
  html:not(.is-touch) .project:hover:not(.is-shut) .project__card { transform: translateY(-3px); box-shadow: 0 24px 48px -30px rgb(0 0 0 / .4); }
  html:not(.is-touch) .project:hover:not(.is-shut) .project__arrow { transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) { .project__card, .project__more { transition: none; } }
.project--feature { grid-column: 1 / -1; }
.project--feature h3 { font-size: 40px; }
.project__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 16px; }
.tag { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.stack { font: 12px var(--mono); color: var(--muted); }
.project h3 { font-size: 28px; margin-bottom: 12px; }
.project h3 em { display: block; font-size: .55em; font-style: italic; color: var(--muted); margin-top: 6px; letter-spacing: 0; }
.project p { margin: 0 0 14px; color: var(--muted); }
.project p b, .bullets b { color: var(--ink); }
.bullets { margin: 0 0 14px; padding-left: 18px; color: var(--muted); }
.bullets li { margin-bottom: 6px; }
.bullets li::marker { color: var(--accent); }
.project__links { margin-top: auto; display: flex; gap: 18px; padding-top: 8px; }
.project__links a { font: 500 13px var(--mono); text-decoration: none; color: var(--accent); }
.project__links a:hover { text-decoration: underline; }

.mini, .certs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini a, .certs a, .certs div {
  display: block; height: 100%; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; transition: border-color .2s, background .2s;
}
.mini a:hover, .certs a:hover { border-color: var(--accent); background: var(--surface); }
.mini b, .certs b { display: block; font-weight: 600; }
.mini span, .certs span { font-size: 13.5px; color: var(--muted); }

/* SKILLS */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.skills div { padding: 24px 24px 24px 0; border-bottom: 1px solid var(--line); }
.skills h4 { margin: 0 0 6px; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.skills p { margin: 0; }
.coursework { margin: 26px 0 0; color: var(--muted); font-size: 15px; }
.coursework span { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin-right: 10px; }

/* JOURNEY */
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: 260px 320px; gap: 12px; }
.gallery figure { margin: 0; position: relative; overflow: hidden; border-radius: 14px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption {
  position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 4px 10px; border-radius: 999px;
  background: rgb(0 0 0 / .55); color: #fff; backdrop-filter: blur(6px);
}
.g1 { grid-column: span 4; }
.g2 { grid-column: span 2; }
.g3, .g4, .g5 { grid-column: span 2; }
.g1 img { object-position: 50% 60%; }

.timeline { list-style: none; padding: 0; margin: 48px 0 0; }
.timeline li { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding: 22px 0; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.when { font: 13px var(--mono); color: var(--muted); padding-top: 4px; }
.timeline h4 { margin: 0; font: 400 24px var(--serif); }
.timeline p { margin: 4px 0 0; color: var(--muted); }

/* CONTACT */
.contact { text-align: center; padding-bottom: 100px; }
.contact h2 { margin: 0 auto 16px; }
.contact > p:not(.kicker) { color: var(--muted); max-width: 32em; margin: 0 auto 28px; }
.contact__mail {
  font: 400 clamp(22px, 4vw, 40px) var(--serif); text-decoration: none; color: var(--accent);
  border-bottom: 2px solid currentColor; word-break: break-all;
}
.socials--center { justify-content: center; }

.footer {
  max-width: var(--max); margin: 0 auto; padding: 28px 16px 40px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted);
}
.footer p { margin: 0; }
.footer__links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { color: var(--accent); }
.footer details { max-width: 560px; }
.footer summary { cursor: pointer; }
.footer details p { margin-top: 8px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* PROJECT STORIES — a side sheet; a loss curve down its edge draws as you read */
button.project__cue { border: 0; background: none; padding: 0; cursor: pointer; }
button.project__cue:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
html.story-open { overflow: hidden; }
.project.is-lifted .project__card { transform: translateY(-6px) !important; box-shadow: 0 30px 60px -30px rgb(0 0 0 / .45); border-color: var(--accent); }

.story {
  width: min(680px, 94vw); max-width: none; height: 100dvh; will-change: transform; max-height: none; margin: 0 0 0 auto; padding: 0; border: 0;
  border-left: 1px solid var(--line); border-radius: 18px 0 0 18px; background: var(--surface); color: var(--ink);
  box-shadow: -40px 0 80px -40px rgb(0 0 0 / .45); overflow: hidden;
}
.story::backdrop { background: rgb(12 10 8 / .45); }
.story__scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 30px 34px 28px; }
.story__head { position: relative; padding-right: 44px; margin-bottom: 26px; }
.story__kicker { margin: 0; font: 500 11.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.story__title { margin: 6px 0 0; font-size: clamp(32px, 4vw, 44px); }
.story__sub { margin: 4px 0 0; font: italic 400 17px/1.4 var(--serif); color: var(--muted); }
.story__close {
  position: absolute; top: -4px; right: -6px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; transition: border-color .2s, color .2s, transform .25s;
}
.story__close:hover { border-color: var(--accent); color: var(--accent); transform: rotate(90deg); }
.story__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.story__body { position: relative; padding-left: 46px; }
.story__curve { position: absolute; left: 0; top: 0; width: 34px; height: 100%; overflow: visible; }
.story__track { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; }
.story__line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.story__curve .node { fill: var(--surface); stroke: var(--line); stroke-width: 2; transition: stroke .3s, fill .3s; }
.story__curve .node.is-hit { stroke: var(--accent); fill: var(--accent); }

.story__beats { list-style: none; margin: 0; padding: 0; display: grid; gap: 30px; }
.beat { opacity: .25; transform: translateY(10px); transition: opacity .5s ease, transform .6s cubic-bezier(.22,1,.36,1); }
.beat.is-in { opacity: 1; transform: none; }
.beat__tag { display: block; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
.beat p { margin: 0; font-size: 16px; line-height: 1.55; }
.beat b { font-weight: 600; }
.beat__fix { margin-top: 8px !important; padding-left: 22px; position: relative; color: var(--muted); }
.beat__fix::before { content: "↳"; position: absolute; left: 2px; top: 0; color: var(--accent); font-weight: 600; }

.beat__chart { margin: 16px 0 0; padding: 12px 10px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.beat__chart svg { display: block; width: 100%; height: auto; }
.beat__chart figcaption { margin: 4px 0 0; font: 11.5px var(--mono); color: var(--muted); text-align: center; }
.ax path { fill: none; stroke: var(--line); stroke-width: 1.5; }
.ax text { font: 9.5px var(--mono); fill: var(--muted); text-anchor: middle; }
.ax .ax__y { text-anchor: end; }
.pt circle { fill: var(--muted); }
.pt text { font: 9.5px var(--mono); fill: var(--muted); text-anchor: middle; }
.pt--live circle { fill: var(--accent); }
.pt--live text { fill: var(--accent); font-weight: 600; }
.pt--slow circle { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-dasharray: 3 2; }
.pt--slow text { fill: var(--ink); }
.pt { opacity: 0; transform: scale(.4); transform-box: fill-box; transform-origin: center; transition: opacity .4s ease, transform .5s cubic-bezier(.34,1.56,.64,1); }
.beat.is-in .pt { opacity: 1; transform: none; }
.beat.is-in .pt:nth-of-type(2) { transition-delay: .08s; } .beat.is-in .pt:nth-of-type(3) { transition-delay: .16s; }
.beat.is-in .pt:nth-of-type(4) { transition-delay: .24s; } .beat.is-in .pt:nth-of-type(5) { transition-delay: .32s; }
.beat.is-in .pt:nth-of-type(6) { transition-delay: .4s; } .beat.is-in .pt:nth-of-type(7) { transition-delay: .7s; }

/* "Why I built it": a query types itself, then the exact match climbs from fifth to first */
.why-viz { --row: 34px; }
.beat__tag + .beat__chart { margin: 4px 0 14px; }
.wv-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.wv-icon { width: 11px; height: 11px; border: 2px solid var(--muted); border-radius: 50%; position: relative; flex: none; }
.wv-icon::after { content: ""; position: absolute; width: 2px; height: 6px; background: var(--muted); right: -4px; bottom: -5px; transform: rotate(-45deg); }
.wv-q { font: 500 13px var(--mono); white-space: nowrap; overflow: hidden; width: 17ch; border-right: 2px solid var(--accent); }
.wv-list { list-style: none; margin: 12px 0 0; padding: 0; position: relative; height: calc(var(--row) * 5); }
.wv-list li {
  position: absolute; left: 0; right: 0; top: calc(var(--r) * var(--row)); height: calc(var(--row) - 8px);
  display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  transition: transform .9s cubic-bezier(.22,1,.36,1) 1.5s, opacity .5s ease;
  opacity: calc(1 - var(--r) * .17);
}
.wv-list i { width: 16px; height: 16px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 30%, transparent); flex: none; }
.wv-list span { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 30%, transparent); width: calc(70% - var(--r) * 6%); }
.wv-list em { margin-left: auto; font: 600 10.5px var(--mono); font-style: normal; color: var(--accent); white-space: nowrap; }
.wv-hit { border-color: var(--accent) !important; }
.wv-hit i, .wv-hit span { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.beat.is-in .wv-q { animation: wv-type 1.1s steps(17) .2s backwards, wv-caret .8s step-end 1.3s 3; }
.beat.is-in .wv-list li:not(.wv-hit) { transform: translateY(var(--row)); opacity: calc(1 - (var(--r) + 1) * .17); }
.beat.is-in .wv-hit { transform: translateY(calc(var(--row) * -4)); opacity: 1; }
@keyframes wv-type { from { width: 0; } }
@keyframes wv-caret { 50% { border-color: transparent; } }
.beat p + p { margin-top: 10px; }
.beat--result p { margin-top: 14px; color: var(--muted); font-size: 15px; }
.ladder { display: grid; gap: 9px; }
.ladder div { display: grid; grid-template-columns: 140px 1fr 56px; align-items: center; gap: 10px; font-size: 13px; }
.ladder span { color: var(--muted); }
.ladder i { height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--muted) 45%, transparent);
  /* bars start at 0.40 so the differences are visible */
  width: calc((var(--v) - var(--lo, .4)) / var(--span, .2) * 100%); transform-origin: left; transform: scaleX(0); transition: transform .8s cubic-bezier(.22,1,.36,1); }
.ladder b { font: 500 12.5px var(--mono); text-align: right; }
.ladder__top span, .ladder__top b { color: var(--accent); }
.ladder__top i { background: var(--accent); }
.beat.is-in .ladder i { transform: none; }
.beat.is-in .ladder div:nth-child(2) i { transition-delay: .1s; } .beat.is-in .ladder div:nth-child(3) i { transition-delay: .2s; } .beat.is-in .ladder div:nth-child(4) i { transition-delay: .35s; }
.beat__stats { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 26px; }
.beat__stats b { display: block; font: 400 26px/1.15 var(--serif); color: var(--accent); }
.beat__stats span { font-size: 13px; color: var(--muted); }
.story__foot { display: flex; gap: 18px; margin: 34px 0 0 46px; padding-top: 18px; border-top: 1px solid var(--line); }
.story__foot a { font: 500 13px var(--mono); color: var(--accent); text-decoration: none; }
.story__foot a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .story { width: 100vw; height: 92dvh; margin: auto 0 0; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; }
  .story__scroll { padding: 24px 18px 22px; }
  .story__body { padding-left: 36px; }
  .story__curve { width: 26px; }
  .story__foot { margin-left: 36px; }
  .beat__stats { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .beat, .pt, .ladder i, .wv-list li { transition: none !important; }
  .wv-q { animation: none !important; }
}

/* "Read the story" points where it goes: right, nudging on hover, never down */
.project .project__cue .project__arrow { transform: none !important; transition: transform .3s cubic-bezier(.22,1,.36,1); }
.project:hover .project__cue .project__arrow, .project__cue:focus-visible .project__arrow { transform: translateX(4px) !important; }

/* Answer Gap: answers arrive, two questions are left waiting */
.qv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qv-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.qv-list i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--mono); font-style: normal; color: var(--muted); border: 1px solid var(--line); }
.qv-list span { height: 6px; border-radius: 3px; flex: 1; max-width: 55%; background: color-mix(in srgb, var(--muted) 30%, transparent); }
.qv-list em { margin-left: auto; font: 500 10.5px var(--mono); font-style: normal; white-space: nowrap; opacity: 0; transition: opacity .4s ease; }
.qv-ok { color: var(--muted); }
.qv-stuck em { color: var(--accent); font-weight: 600; }
.qv-stuck { transition: border-color .4s ease .2s; }
.beat.is-in .qv-list em { opacity: 1; }
.beat.is-in .qv-list li:nth-child(1) em { transition-delay: .3s; } .beat.is-in .qv-list li:nth-child(3) em { transition-delay: .55s; }
.beat.is-in .qv-list li:nth-child(4) em { transition-delay: .8s; }
.beat.is-in .qv-stuck em { transition-delay: 1.4s; }
.beat.is-in .qv-stuck { border-color: var(--accent); transition-delay: 1.4s; }

/* Dropout: twenty students, nine at risk, four calls */
.dv-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; max-width: 360px; margin: 2px auto 0; }
.dv-grid i { aspect-ratio: 1; border-radius: 50%; background: color-mix(in srgb, var(--muted) 28%, transparent); transition: background .4s ease, box-shadow .4s ease; }
.beat.is-in .dv-grid .r { background: color-mix(in srgb, var(--accent) 55%, transparent); transition-delay: .3s; }
.beat.is-in .dv-grid .p { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); transition-delay: 1.2s; }
.dv-key { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 12px 0 0 !important; font: 11px var(--mono) !important; color: var(--muted); }
.dv-key span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dv-k1 { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.dv-k2 { margin-left: 12px; box-shadow: 0 0 0 2px var(--ink); }

/* BeanSight: a tray of beans, two defects get boxed */
.bv-tray { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px 14px; max-width: 330px; margin: 4px auto 0; }
.bv-tray i { position: relative; aspect-ratio: 1.35; border-radius: 50%; background: #9aa86a; transform: rotate(-20deg); }
.bv-tray i::after { content: ""; position: absolute; left: 48%; top: 14%; bottom: 14%; width: 2px; border-radius: 1px; background: rgb(0 0 0 / .25); }
.bv-tray i:nth-child(odd) { transform: rotate(25deg); }
.bv-tray .b { background: #5b4a32; }
.bv figcaption { margin-top: 16px; }
.bv-tray { padding: 8px 0; }
.bv-tray .b::before { content: ""; position: absolute; inset: -7px; border: 2px solid var(--accent); border-radius: 6px; opacity: 0; transform: scale(1.4); transition: opacity .4s ease, transform .5s cubic-bezier(.34,1.56,.64,1); }
.beat.is-in .bv-tray .b::before { opacity: 1; transform: none; transition-delay: .5s; }
.beat.is-in .bv-tray .b:nth-child(11)::before { transition-delay: .9s; }
/* how it routes */
.rv-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rv-node { display: inline-block; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: 500 12px var(--mono); text-align: center; opacity: .35; transition: opacity .4s ease, border-color .4s ease; }
.rv-node small { display: block; font-size: 10px; color: var(--muted); }
.rv-node--key { border-color: var(--accent); color: var(--accent); }
.rv-arrow { width: 18px; height: 2px; background: var(--line); position: relative; }
.rv-arrow::after { content: ""; position: absolute; right: -1px; top: -3px; border-left: 6px solid var(--line); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.rv-split { display: grid; gap: 6px; }
.beat.is-in .rv-node { opacity: 1; }
.beat.is-in .rv-flow > .rv-node:nth-of-type(2) { transition-delay: .35s; }
.beat.is-in .rv-split .rv-node { transition-delay: .7s; }

/* Project Camp: a task card crosses the board */
.kv-board { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; --col: calc((100% - 20px) / 3); }
.kv-col { display: grid; align-content: start; gap: 6px; padding: 8px; min-height: 104px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.kv-col small { font: 500 10.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kv-col i { height: 18px; border-radius: 5px; background: color-mix(in srgb, var(--muted) 22%, transparent); }
.kv-card { position: absolute; left: 8px; top: 82px; width: calc(var(--col) - 16px); height: 18px; border-radius: 5px; background: var(--accent); box-shadow: 0 6px 14px -6px rgb(0 0 0 / .4); }
.beat.is-in .kv-card { animation: kv-move 3.2s cubic-bezier(.65,0,.35,1) .4s both; }
@keyframes kv-move { 0%, 10% { transform: none; } 45%, 55% { transform: translateX(calc(100% + 26px)); } 100% { transform: translateX(calc(200% + 52px)); } }
/* request pipeline */
.pv-flow { position: relative; display: flex; justify-content: space-between; gap: 6px; padding-bottom: 14px; }
.pv-flow::before { content: ""; position: absolute; left: 6%; right: 6%; bottom: 4px; height: 2px; background: var(--line); }
.pv-flow span { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: 500 11.5px var(--mono); }
.pv-dot { position: absolute; left: 6%; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.beat.is-in .pv-dot { animation: pv-run 2.4s cubic-bezier(.65,0,.35,1) .3s 2 both; }
@keyframes pv-run { to { left: calc(94% - 10px); } }

@media (max-width: 600px) {
  .dv-grid { gap: 7px; }
  .pv-flow span { padding: 5px 5px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .qv-list em, .dv-grid i, .bv-tray .b::before, .rv-node { transition: none !important; }
  .kv-card, .pv-dot { animation: none !important; }
}

/* PAGE PROGRESS — a loss curve on the right edge (wide screens) or a thin bar on top (smaller ones) */
.rail { position: fixed; right: 14px; top: 50%; z-index: 9; width: 44px; height: min(56vh, 520px); transform: translateY(-50%); display: none; }
.rail__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rail__track { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 4; stroke-linecap: round; }
.rail__line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.rail__dot {
  position: absolute; left: 0; top: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent);
}
.rail__read {
  position: absolute; left: 0; top: 0; transform: translate(calc(-100% - 14px), -50%); white-space: nowrap; pointer-events: none;
  font: 500 10.5px var(--mono); color: var(--muted); padding: 2px 6px; border-radius: 6px; background: var(--bg);
  opacity: .0; transition: opacity .35s ease;
}
.rail.is-moving .rail__read, .rail:hover .rail__read { opacity: 1; }
.rail__tick { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; }
.rail__tick::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--muted); transition: background .3s, border-color .3s; }
.rail__tick.is-hit::before { background: var(--accent); border-color: var(--accent); }
.rail__tick span {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%); white-space: nowrap; font: 500 10.5px var(--mono); color: var(--ink);
  padding: 2px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.rail__tick:hover span, .rail__tick:focus-visible span { opacity: 1; }
.rail__tick:focus-visible::before { outline: 2px solid var(--accent); outline-offset: 2px; }
.topbar { position: fixed; left: 0; right: 0; top: 0; z-index: 11; height: 2px; pointer-events: none; }
.topbar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--accent); }
.topbar b { position: absolute; top: 0; width: 2px; height: 4px; background: var(--muted); opacity: .6; }
.topbar b.is-hit { background: var(--accent); opacity: 1; }
@media (min-width: 1200px) { .rail { display: block; } .topbar { display: none; } }

/* CUE HINTS — the first time a card comes into view on each page load, its "Read the story" / "See it" cue gets one soft sweep of
   light and a thin underline that draws in and fades, so readers know there's more behind it. The sweep moves toward the text
   colour (darker in light mode, brighter in dark mode), so contrast never drops. */
.project .project__cue, .now .track__cue {
  background: linear-gradient(100deg, currentColor 0 38%, var(--ink) 50%, currentColor 62% 100%) 100% 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text;
}
.project.cue-play .project__cue, .now.cue-play .track__cue { animation: cue-sweep 1.8s ease .35s 1 both; }
@keyframes cue-sweep { from { background-position: 100% 0; -webkit-text-fill-color: transparent; } 99% { background-position: 0 0; -webkit-text-fill-color: transparent; } to { -webkit-text-fill-color: currentColor; } }
.project .project__cue, .now .track__cue { position: relative; }
.project .project__cue::after, .now .track__cue::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1.5px; border-radius: 1px;
  background: currentColor; -webkit-text-fill-color: initial; transform: scaleX(0); transform-origin: left; opacity: 0;
}
.project.cue-play .project__cue::after, .now.cue-play .track__cue::after { animation: cue-line 2.2s cubic-bezier(.22,1,.36,1) .35s 1 both; }
@keyframes cue-line { 0% { transform: scaleX(0); opacity: 1; } 45% { transform: scaleX(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.project.cue-static .project__cue::after { transform: scaleX(1); opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .project.cue-play .project__cue, .now.cue-play .track__cue, .project.cue-play .project__cue::after, .now.cue-play .track__cue::after { animation: none; }
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .hero { gap: 32px; padding-top: 40px; }
  .hero__photo { width: clamp(150px, 22vw, 190px); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .about__grid { grid-template-columns: 210px 1fr; gap: 40px; }
  .profile .facts { grid-template-columns: 1fr; }
  .profile .facts div:nth-last-child(2) { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
  .now { padding: 22px 20px 20px; }
  .research { grid-template-columns: 130px 1fr; gap: 8px 20px; padding: 18px 20px; }
  .study__grid { grid-template-columns: 1fr; gap: 20px; }
  .study__figure { max-width: 340px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .charts { grid-template-columns: 1fr; }


  .track { grid-template-columns: 1fr; gap: 18px; }
  .scene { grid-template-columns: 1fr; gap: 14px; padding-bottom: 12px; }
  /* One column: the scene opens right under its month */
  .track > li:nth-child(1) { order: 1; }
  .track > li:nth-child(2) { order: 3; }
  .track > li:nth-child(3) { order: 5; }
  .track > li.now__stage { order: 2; margin-top: -18px; }
  .now[data-scene="scene-nov"] .track > li.now__stage { order: 4; }
  .projects, .skills { grid-template-columns: 1fr; }
  .projects__cols { grid-template-columns: 1fr; }
  .projects__col { display: contents; }
  .projects__col:first-child > .project:nth-child(1) { order: 1; }
  .projects__col:last-child > .project:nth-child(1) { order: 2; }
  .projects__col:first-child > .project:nth-child(2) { order: 3; }
  .projects__col:last-child > .project:nth-child(2) { order: 4; }
  .mini, .certs { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: 1fr 1fr; grid-template-rows: 260px 200px 200px; }
  .g1, .g2, .g3, .g4, .g5 { grid-column: span 1; }
  .g3 { grid-column: 1 / 3; }
}
@media (max-width: 600px) {
  .research { grid-template-columns: 1fr; }
  .s-lbl { font-size: 15px; }
  .research__visual { max-width: 210px; }
  .panel { width: 100vw; max-height: 92vh; margin: auto 0 0; padding: 26px 18px 22px; border-radius: 18px 18px 0 0; }
  .steps { grid-template-columns: 1fr; }
  .research__stats { grid-template-columns: 1fr; gap: 12px; }
  /* Phones: photo stack sits under the intro, centred */
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 32px; }
  .hero__photo { width: 210px; justify-self: center; }
  .about__grid { grid-template-columns: 1fr; gap: 28px; }
  .profile { position: static; display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center; }
  .profile__photo { border-radius: 10px; }
  .profile .facts { margin: 0; grid-template-columns: 1fr; }
  .profile .facts div { padding: 4px 0; border-bottom: 0; }
  .profile .facts dd { font-size: 14.5px; }
  .stack__card { border-radius: 12px; }
  .nav__links { display: none; }
  .nav .theme-toggle { margin-left: auto; }
  .section { padding-top: 72px; }
  .project__card { padding: 22px; }
  .project--feature h3 { font-size: 30px; }
  .mini, .certs { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .stats b { font-size: 24px; }
}
