/* ==========================================================================
   Sanjay Seebaran · Portfolio
   Studio stage, then ledger. One accent: crimson #c8102e.
   ========================================================================== */

/* ---------- Fonts ---------- */
/* Inter variable with optical sizing: display sizes get the Inter Display cut automatically. */
@font-face {
  font-family: "Inter";
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/inter@5.2.5/files/inter-latin-opsz-normal.woff2") format("woff2-variations"),
       url("https://cdn.jsdelivr.net/npm/@fontsource-variable/inter@5.2.5/files/inter-latin-opsz-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Metric-matched fallback so the swap to Inter does not shift layout. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("ArialMT");
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
  size-adjust: 107.12%;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: rgb(0 0 0 / 0.09);
  --line-strong: rgb(0 0 0 / 0.18);
  --chip: rgb(0 0 0 / 0.05);
  --accent: #c8102e;
  --accent-hover: #a90d27;
  --accent-text: #c8102e;
  --on-accent: #ffffff;
  --focus: #c8102e;
  --nav-bg: rgb(245 245 247 / 0.72);
  --shadow: 0 1px 1px rgb(0 0 0 / 0.03), 0 6px 16px rgb(0 0 0 / 0.04), 0 22px 56px rgb(0 0 0 / 0.07);
  --logo-plate: transparent;

  /* Sampled from the portrait backdrop */
  --slate-1: #777985;
  --slate-2: #656871;
  --slate-3: #4e515a;
  --slate-4: #3e414a;
  --ink: #0a0a0b;

  --font: "Inter", "Inter Fallback", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius-card: 24px;
  --radius-lg: 28px;
  --max: 1200px;
  --side: 16px;
  --gutter: 16px;
  --nav-h: 52px;
  --hero-h: max(100svh, 560px);

  --fs-body: clamp(17px, 0.9rem + 0.25vw, 19px);
  --fs-hero: min(19.2vw, 128px);
  --fs-display: clamp(40px, 12vw, 64px);
}

@media (min-width: 600px) {
  :root { --fs-display: clamp(72px, 4.2vw + 40px, 112px); }
}
@media (min-width: 768px) {
  :root { --side: 24px; --gutter: 24px; }
}
@media (min-width: 900px) {
  :root { --fs-hero: clamp(72px, 9.4vw, 140px); }
}

/* Dark theme: system preference unless the visitor picked light, or an explicit dark choice. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0b;
    --bg-elev: #161618;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --line: rgb(255 255 255 / 0.1);
    --line-strong: rgb(255 255 255 / 0.2);
    --chip: rgb(255 255 255 / 0.08);
    --accent-text: #ef3e56;
    --focus: #ef3e56;
    --nav-bg: rgb(22 22 24 / 0.7);
    --shadow: 0 0 0 1px rgb(255 255 255 / 0.06), 0 8px 24px rgb(0 0 0 / 0.4), 0 24px 64px rgb(0 0 0 / 0.35);
    --logo-plate: #f5f5f7;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0b;
  --bg-elev: #161618;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --line: rgb(255 255 255 / 0.1);
  --line-strong: rgb(255 255 255 / 0.2);
  --chip: rgb(255 255 255 / 0.08);
  --accent-text: #ef3e56;
  --focus: #ef3e56;
  --nav-bg: rgb(22 22 24 / 0.7);
  --shadow: 0 0 0 1px rgb(255 255 255 / 0.06), 0 8px 24px rgb(0 0 0 / 0.4), 0 24px 64px rgb(0 0 0 / 0.35);
  --logo-plate: #f5f5f7;
}
:root[data-theme="light"] { color-scheme: light; }

/* The studio stage is dark in both themes. */
.on-dark,
.js .nav.is-on-stage {
  --bg: #0a0a0b;
  --bg-elev: #161618;
  --text: #f5f5f7;
  --text-2: #c7c7cc;
  --line: rgb(255 255 255 / 0.14);
  --line-strong: rgb(255 255 255 / 0.3);
  --chip: rgb(255 255 255 / 0.1);
  --accent-text: #ef3e56;
  --focus: #ef3e56;
  --nav-bg: rgb(14 14 16 / 0.45);
  color: var(--text);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  font-family: var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: no-preference) {
  html:not(.lenis) { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.5;
  letter-spacing: -0.011em;
  overflow-x: clip;
}

[hidden] { display: none !important; }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
img, svg, picture, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
sub, sup { font-size: 0.72em; line-height: 0; }
table { border-collapse: collapse; }
::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.btn:focus-visible, .icon-btn:focus-visible { border-radius: 999px; }
[tabindex="-1"]:focus { outline: none; }

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

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.3s var(--ease);
}
.skip-link:focus { transform: none; }

.container {
  width: min(100% - 2 * var(--side), var(--max));
  margin-inline: auto;
}

.tnum,
time { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Type ---------- */
.display {
  font-size: var(--fs-display);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
  max-width: 16ch;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--text-2);
}
.eyebrow__num {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.eyebrow__num::after {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--line-strong);
}

.link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.3s var(--ease);
}
.link:hover { text-decoration-color: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  --h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--h);
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn__label { display: inline-block; pointer-events: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--text); }
.btn--sm { --h: 36px; padding: 0 16px; font-size: 14px; }
.btn--lg { --h: 56px; padding: 0 30px; font-size: 18px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.3s var(--ease);
}
.icon-btn:hover { background: var(--chip); }
.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--moon { fill: currentColor; stroke: none; }
.icon--sun { display: none; }
:root[data-theme="dark"] .icon--sun { display: block; }
:root[data-theme="dark"] .icon--moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon--sun { display: block; }
  :root:not([data-theme="light"]) .icon--moon { display: none; }
}

/* ---------- Small parts: pills, tags, chips, badges, logos ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill--warn { border: 1px solid var(--line-strong); color: var(--text); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.tag--done { background: var(--accent); color: var(--on-accent); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--chip);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  transition: transform 0.4s var(--ease);
}
.chip__note { font-size: 13px; color: var(--text-2); }
@media (hover: hover) {
  .chip:hover { transform: translateY(-2px); }
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--chip);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.badge__dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--text-2); }
.badge--accent { background: var(--accent); color: var(--on-accent); }

/* Logos: supplied files only. Monochrome until hover/focus; neutral initials chip if missing. */
.logo {
  --logo-h: 36px;
  display: inline-flex;
  align-items: center;
  flex: none;
  height: var(--logo-h);
  filter: grayscale(1);
  opacity: 0.7;
  transition: filter 0.5s var(--ease), opacity 0.5s var(--ease);
}
.logo img {
  width: auto;
  height: 100%;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
}
.logo:not(.is-fallback) {
  background: var(--logo-plate);
  border-radius: 10px;
}
:root[data-theme="dark"] .logo:not(.is-fallback) { padding: 6px 10px; height: calc(var(--logo-h) + 12px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo:not(.is-fallback) { padding: 6px 10px; height: calc(var(--logo-h) + 12px); }
}
.logo--inline { --logo-h: 28px; }
.logo:hover,
.card:hover .logo,
.card:focus-within .logo,
.ledger:hover .logo,
.research__intro:hover .logo { filter: none; opacity: 1; }
.logo.is-fallback {
  justify-content: center;
  min-width: var(--logo-h);
  padding: 0 10px;
  border-radius: 10px;
  background: var(--chip);
  color: var(--text-2);
  filter: none;
  opacity: 1;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.logo.is-fallback::before { content: attr(data-initials); }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--nav-h);
  color: var(--text);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), color 0.4s var(--ease);
}
.nav.is-scrolled:not(.is-on-stage) { border-bottom-color: var(--line); }
.nav__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}
.nav__mono {
  display: inline-flex;
  align-items: flex-end;
  min-height: 44px;
  padding-block: 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  text-decoration: none;
  color: var(--text);
}
.nav__dot {
  width: 6px;
  height: 6px;
  margin: 0 0 1px 2px;
  border-radius: 50%;
  background: var(--accent);
}
.nav__links {
  position: relative;
  display: none;
  gap: 28px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.nav__links a {
  display: block;
  padding: 16px 0;
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}
.nav__links a:hover,
.nav__links a[aria-current] { color: var(--text); }
.nav__indicator {
  position: absolute;
  left: 0;
  bottom: 9px;
  width: 100px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  pointer-events: none;
  transform-origin: 0 50%;
  transform: translateX(var(--x, 0)) scaleX(var(--s, 0));
  opacity: var(--o, 0);
  transition: transform 0.6s var(--ease), opacity 0.3s var(--ease);
}
.nav__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.nav__menu-btn .burger { position: relative; display: block; width: 18px; height: 10px; }
.nav__menu-btn .burger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.4s var(--ease);
}
.nav__menu-btn .burger span:first-child { top: 0; }
.nav__menu-btn .burger span:last-child { bottom: 0; }
.nav__menu-btn[aria-expanded="true"] .burger span:first-child { transform: translateY(4.25px) rotate(45deg); }
.nav__menu-btn[aria-expanded="true"] .burger span:last-child { transform: translateY(-4.25px) rotate(-45deg); }

/* Full-height, near-opaque: a backdrop-filter nested inside the blurred nav would not blur the page. */
.nav__sheet {
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  height: calc(100svh - var(--nav-h));
  padding: 8px 0 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  border-top: 1px solid var(--line);
}
.nav__sheet ul { margin-block: 0; padding: 0; list-style: none; }
.nav__sheet a {
  display: block;
  padding: 10px 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.nav__sheet:not([hidden]) li { animation: sheetIn 0.5s var(--ease) both; }
.nav__sheet li:nth-child(2) { animation-delay: 0.03s; }
.nav__sheet li:nth-child(3) { animation-delay: 0.06s; }
.nav__sheet li:nth-child(4) { animation-delay: 0.09s; }
.nav__sheet li:nth-child(5) { animation-delay: 0.12s; }
.nav__sheet li:nth-child(6) { animation-delay: 0.15s; }
.nav__sheet li:nth-child(7) { animation-delay: 0.18s; }

@media (min-width: 900px) {
  .nav__links { display: flex; }
  .nav__menu-btn, .nav__sheet { display: none; }
  .nav__bar { gap: 24px; }
}

/* ---------- Scene: hero + profile ---------- */
.scene { position: relative; }

/* The track spans the whole scene, so the sticky pin inside it releases exactly at the scene's end. */
.scene__track {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.scene__pin {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hero-h);
  overflow: hidden;
}
.has-scene .scene__pin {
  position: sticky;
  height: 100svh;
}

.stage {
  position: absolute;
  inset: 0;
  background: var(--ink);
}

.portrait {
  --ph: min(82svh, 760px);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: calc(var(--ph) * 2 / 3);
  height: var(--ph);
  margin-inline: auto;
}
.portrait__glow {
  position: absolute;
  inset: -22% -60% -6%;
  background: radial-gradient(closest-side, #73757f 0%, #686a74 24%, #5c5f68 40%, #474a52 56%, #2c2e33 72%, rgb(16 16 18 / 0.75) 86%, rgb(10 10 11 / 0) 100%);
}
.portrait__card {
  position: absolute;
  inset: 0;
  border-radius: 40px;
  background: radial-gradient(120% 85% at 50% 22%, var(--slate-1) 0%, #5f626b 45%, #43464e 100%);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.22), 0 8px 24px rgb(0 0 0 / 0.1);
  opacity: 0;
  visibility: hidden;
}
.portrait picture { position: absolute; inset: 0; }
.portrait__img {
  --feather:
    linear-gradient(90deg, transparent 0%, rgb(0 0 0 / 0.55) 8%, #000 18%, #000 82%, rgb(0 0 0 / 0.55) 92%, transparent 100%),
    linear-gradient(180deg, transparent 0%, rgb(0 0 0 / 0.6) 6%, #000 13%, #000 72%, transparent 98%);
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-mask-image: var(--feather);
  mask-image: var(--feather);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  transform-origin: 50% 60%;
}
.js .portrait__img { transform: scale(1.08); }
.js .portrait__img.is-loaded { transform: none; transition: transform 1.2s var(--ease); }

@media (min-width: 900px) {
  .portrait {
    --ph: min(94svh, 1100px);
    left: auto;
    right: max(var(--side), calc((100% - var(--max)) / 2));
    margin: 0;
  }
}

/* Hero */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  height: var(--hero-h);
  padding-top: var(--nav-h);
  padding-bottom: clamp(36px, 8svh, 112px);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to top, rgb(10 10 11 / 0.92) 0%, rgb(10 10 11 / 0.72) 30%, rgb(10 10 11 / 0) 58%);
}
.hero__sentinel {
  position: absolute;
  left: 0;
  top: calc(100% - 1px);
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.has-scene .hero__sentinel { top: 45%; }
.hero__inner { position: relative; }
.hero__title {
  margin-bottom: clamp(14px, 2.2svh, 28px);
  font-size: var(--fs-hero);
  font-weight: 650;
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.line {
  display: block;
  overflow: hidden;
  padding: 0.04em 0 0.16em;
  margin-bottom: -0.16em;
}
.line__inner { display: block; }
.hero__sub {
  max-width: 30ch;
  margin-bottom: clamp(20px, 3.4svh, 36px);
  font-size: clamp(19px, 0.9vw + 15px, 28px);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-2);
}
.hero__sub-lead { display: block; color: var(--text); }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }

@media (min-width: 900px) {
  .hero::before { display: none; }
  .hero { padding-bottom: clamp(48px, 12svh, 140px); }
  .hero__sub { max-width: 24ch; }
}
@media (max-width: 899px) and (orientation: landscape) {
  .portrait { --ph: 92svh; left: auto; right: 4vw; margin: 0; }
  .hero::before { background: linear-gradient(90deg, rgb(10 10 11 / 0.9) 0%, rgb(10 10 11 / 0.6) 45%, rgb(10 10 11 / 0) 75%); }
  .hero__title { font-size: min(12vw, 21svh); }
  .hero__sub { max-width: 22ch; font-size: 18px; }
}

/* Hero intro (CSS only, so first paint never waits on a CDN). */
@keyframes rise { from { transform: translateY(108%); } to { transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.line__inner { animation: rise 1.1s var(--ease) 0.15s both; }
.line:nth-child(2) .line__inner { animation-delay: 0.23s; }
.hero__sub { animation: fadeUp 0.9s var(--ease) 0.42s both; }
.hero__ctas { animation: fadeUp 0.9s var(--ease) 0.52s both; }
.js .nav { animation: fadeIn 0.6s var(--ease) 0.6s both; }

/* Profile */
.profile {
  position: relative;
  z-index: 1;
  padding-block: clamp(96px, 14vw, 160px) clamp(56px, 8vw, 120px);
}
.profile__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}
.profile__body { grid-column: 1 / -1; max-width: 860px; }
.profile__lede {
  font-size: clamp(24px, 0.9vw + 16px, 34px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.022em;
  text-wrap: pretty;
}
.profile__media { display: none; }

.has-scene .profile {
  display: flex;
  align-items: center;
  min-height: 100svh;
  padding-block: calc(var(--nav-h) + 28px) 28px;
}
.has-scene .profile__grid { align-items: center; width: min(100% - 2 * var(--side), var(--max)); }
.has-scene .profile__body { grid-column: 1 / 8; }
.has-scene .profile__media {
  display: block;
  grid-column: 8 / 13;
  justify-self: end;
  height: min(74svh, 780px);
  aspect-ratio: 2 / 3;
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin: clamp(36px, 5svh, 64px) 0 0;
  padding: 0;
  list-style: none;
}
.stat {
  display: flex;
  flex-direction: column;
  padding-top: 16px;
  border-top: 1px solid var(--line-strong);
}
.stat__fig {
  margin-bottom: 10px;
  font-size: clamp(48px, 2.6vw + 26px, 72px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.stat__fig--word {
  font-size: clamp(30px, 1.2vw + 20px, 44px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
.stat__label {
  max-width: 28ch;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-2);
}
.mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
.mask__inner { display: inline-block; }

@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Sections & cards ---------- */
.section {
  position: relative;
  padding-block: clamp(96px, 12vw, 176px);
}
.section--tight { padding-block: clamp(32px, 4vw, 64px) clamp(96px, 12vw, 176px); }
.section__head { margin-bottom: clamp(40px, 6vw, 80px); }

.card {
  position: relative;
  padding: clamp(24px, 3.2vw, 44px);
  border-radius: var(--radius-card);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  container-type: inline-size;
}

/* ---------- Exams ---------- */
.exams__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.exams__brand .logo { --logo-h: 32px; }
.exams__org { font-size: 15px; font-weight: 500; color: var(--text-2); }

.tracker { --node: 56px; --gap: clamp(16px, 4vw, 48px); position: relative; }
.tracker__steps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.tracker__rail {
  position: absolute;
  top: calc(var(--node) / 2 - 1px);
  left: calc(var(--node) / 2);
  width: calc(50% + var(--gap) / 2);
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}
.tracker__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent), var(--line-strong));
  transform-origin: 0 50%;
}
.tracker__node {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--node);
  height: var(--node);
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--bg-elev);
}
.is-done .tracker__node {
  background: var(--accent);
  box-shadow: 0 8px 24px rgb(200 16 46 / 0.32);
}
.tracker__node svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tracker__check { stroke-dasharray: 1; stroke-dashoffset: 0; }
.is-next .tracker__node { border: 2px solid var(--accent-text); }
.is-next .tracker__node::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-text);
}
.tracker__pulse {
  position: absolute;
  inset: -2px;
  border: 2px solid var(--accent-text);
  border-radius: 50%;
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.55; }
  80%, 100% { transform: scale(1.6); opacity: 0; }
}
.tracker__name {
  margin-bottom: 10px;
  font-size: clamp(22px, 1.4vw + 14px, 32px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.tracker__name span {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-2);
}
.tracker__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text-2);
}

.countdown {
  display: none;
  margin-top: clamp(32px, 5vw, 56px);
  padding-top: clamp(24px, 3vw, 32px);
  border-top: 1px solid var(--line);
}
.js .countdown { display: block; }
.countdown__label { margin-bottom: 12px; font-size: 15px; font-weight: 600; color: var(--text-2); }
.countdown__cells { display: flex; flex-wrap: wrap; gap: 16px clamp(24px, 4vw, 56px); }
.countdown__cell { display: flex; align-items: baseline; gap: 8px; }
.countdown__num {
  font-size: clamp(40px, 3vw + 24px, 72px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.countdown__unit { font-size: 15px; color: var(--text-2); }
.countdown__note { margin-top: 14px; font-size: 13px; color: var(--text-2); }
.countdown__done { font-size: clamp(24px, 1.4vw + 16px, 36px); font-weight: 650; letter-spacing: -0.025em; }

@container (max-width: 520px) {
  .countdown__cell { flex-direction: column; align-items: flex-start; gap: 6px; }
  .tracker { --node: 48px; }
}

/* ---------- Experience timeline ---------- */
.timeline {
  --tl-pad: clamp(32px, 5vw, 64px);
  position: relative;
  padding-left: var(--tl-pad);
}
.timeline__rail {
  position: absolute;
  top: 40px;
  bottom: 40px;
  left: 7px;
  width: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}
.timeline__fill {
  position: absolute;
  inset: 0;
  background: var(--text-2);
  transform-origin: 50% 0;
}
.timeline__list {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline__item { position: relative; }
.timeline__node {
  position: absolute;
  top: 34px;
  left: calc(-1 * var(--tl-pad));
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--accent);
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.5s var(--ease);
}
.js-motion .timeline__item:not(.is-reached) .timeline__node {
  border-color: var(--line-strong);
  background: var(--bg);
  transform: scale(0.8);
}

/* Logo sits on its own row, so a logo file loading late never shifts the title. */
.role__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "logo dates" "meta meta";
  align-items: center;
  gap: 20px 16px;
  margin-bottom: 24px;
}
.role__head .logo { --logo-h: 32px; grid-area: logo; justify-self: start; }
.role__meta { grid-area: meta; }
.role__dates { grid-area: dates; }
.role__title {
  font-size: clamp(22px, 1.1vw + 16px, 30px);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.role__org { margin-top: 4px; font-size: 16px; color: var(--text-2); }
.role__dates { font-size: 15px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.role__points {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.role__points li { position: relative; padding-left: 24px; }
.role__points li::before {
  content: "";
  position: absolute;
  top: 0.74em;
  left: 2px;
  width: 10px;
  height: 1.5px;
  background: var(--text-2);
}

/* ---------- Research ---------- */
.research__intro { margin-top: 28px; }
.research__project {
  max-width: 34ch;
  margin-bottom: 12px;
  font-size: clamp(20px, 0.7vw + 16px, 26px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.research__org {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text-2);
}

.research__scroller {
  position: relative;
  display: grid;
  gap: 24px;
}
.research__steps {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 24px;
  border-top: 1px solid var(--line);
  transition: opacity 0.5s var(--ease);
}
.step:first-child { border-top: 0; }
.step__num {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.step__title {
  margin-bottom: 14px;
  font-size: clamp(30px, 1.8vw + 20px, 48px);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.step__text { max-width: 38ch; }
.step__stat {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 20px;
  font-size: 15px;
  color: var(--text-2);
}
.step__stat-num {
  font-size: 44px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.step__note { max-width: 42ch; margin-top: 14px; font-size: 14px; color: var(--text-2); }

@media (min-width: 1024px) {
  .research__scroller {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gutter);
    align-items: start;
  }
  .research__visual { grid-column: 1 / 7; }
  .research__steps { grid-column: 8 / 13; }
  .step { border-top: 0; padding-block: 40px; }
}
@media (min-width: 1024px) and (min-height: 700px) and (prefers-reduced-motion: no-preference) {
  .research__visual {
    position: sticky;
    top: calc(var(--nav-h) + max(12px, (100svh - var(--nav-h) - 620px) / 2));
  }
  .step { min-height: 86svh; }
  .research__steps { padding-bottom: 6svh; }
  .research__scroller.is-pinned .step:not(.is-active) { opacity: 0.62; }
}

/* Chart */
.chart { padding: clamp(16px, 2.2vw, 28px); }
.chart__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.chart__caption { font-size: 14px; font-weight: 500; color: var(--text-2); }
.chart__plot { position: relative; aspect-ratio: 640 / 376; }
.chart__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart__labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 12px;
  line-height: 1;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.ch-lbl { position: absolute; white-space: nowrap; }
.ch-lbl--x { transform: translateX(-50%); }
.ch-lbl--y { transform: translateY(-130%); }
.ch-lbl--title-x { transform: translateX(-100%); }
.ch-lbl--table { transform: translate(-100%, -100%); font-weight: 600; opacity: 0; }
.ch-lbl--term { transform: translateX(-50%); color: var(--text); font-weight: 600; }
.ch-lbl--bars { color: var(--text); }
.chart__note { margin-top: 14px; font-size: 13px; line-height: 1.45; color: var(--text-2); }

.ch-grid line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ch-axes line { stroke: var(--line-strong); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.ch-table { opacity: 0; }
.ch-table__panel { fill: var(--chip); }
.ch-table rect:not(.ch-table__panel) { fill: var(--line-strong); }
.ch-table__head { fill: var(--text-2) !important; fill-opacity: 0.6; }
.ch-band { fill: var(--text); fill-opacity: 0.05; }
.ch-term { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.ch-area { fill: var(--accent); fill-opacity: 0.14; }
.ch-bars rect { fill: var(--text-2); }
.ch-bars--accent rect { fill: var(--accent); }
.ch-curve, .ch-seg { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ch-curve { stroke: var(--text); stroke-width: 3; }
.ch-seg { stroke: var(--accent-text); stroke-width: 4.5; }
.ch-dot { fill: var(--accent); }
@media (max-width: 599px) {
  .ch-curve { stroke-width: 5; }
  .ch-seg { stroke-width: 7.5; }
  .ch-dot { r: 8; }
  .chart__labels { font-size: 11px; }
}

/* Formula */
.formula {
  margin-top: clamp(14px, 1.8vw, 20px);
  padding-top: clamp(14px, 1.8vw, 20px);
  border-top: 1px solid var(--line);
}
.formula__caption { font-size: 14px; font-weight: 500; color: var(--text-2); }
.formula__math .katex-display { margin: 0.35em 0 0.5em; padding: 4px 0; overflow-x: auto; overflow-y: hidden; }
.formula__math .katex { font-size: clamp(1.05em, 1.2vw + 0.6em, 1.45em); }
.formula__legend {
  display: grid;
  gap: 6px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}
.formula__sym {
  margin-right: 6px;
  font-family: KaTeX_Main, "Times New Roman", serif;
  font-size: 1.12em;
  color: var(--text);
}
@container (min-width: 500px) {
  .formula__legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) and (max-height: 820px) {
  .chart { padding: 20px 24px; }
  .chart__note { margin-top: 8px; font-size: 12px; }
  .chart__top { margin-bottom: 8px; }
  .formula { margin-top: 10px; padding-top: 10px; }
  .formula__math .katex { font-size: 1.22em; }
  .formula__math .katex-display { margin: 0.2em 0 0.35em; }
}

/* ---------- Education ---------- */
.degree > .logo { --logo-h: 40px; margin-bottom: 28px; }
.degree__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 32px;
}
.degree__title {
  font-size: clamp(26px, 1.5vw + 18px, 40px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.degree__title span { font-weight: 500; color: var(--text-2); }
.degree__class {
  margin-top: 10px;
  font-size: clamp(18px, 0.4vw + 15px, 21px);
  font-weight: 600;
  color: var(--accent-text);
}
.degree__org { margin-top: 6px; color: var(--text-2); }
.degree__dates { font-size: 17px; color: var(--text-2); white-space: nowrap; }
.chips__title { margin-bottom: 14px; font-size: 15px; font-weight: 600; color: var(--text-2); }

/* ---------- Skills ---------- */
.skills__grid { display: grid; gap: var(--gutter); }
.skills__title {
  margin-bottom: 20px;
  font-size: clamp(22px, 0.8vw + 17px, 28px);
  font-weight: 650;
  letter-spacing: -0.02em;
}
@media (min-width: 900px) {
  .skills__grid { grid-template-columns: 5fr 7fr; align-items: start; }
}

/* ---------- Awards ledger ---------- */
.ledger__org {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  font-size: 15px;
  color: var(--text-2);
}
.ledger__org .logo { --logo-h: 32px; }
.ledger__rows { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line-strong); }
.ledger__row {
  position: relative;
  display: grid;
  gap: 10px 32px;
  padding-block: clamp(24px, 3vw, 36px);
}
.ledger__row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line-strong);
  transform-origin: 0 50%;
  transform: scaleX(var(--rule, 1));
}
.ledger__year {
  font-size: clamp(40px, 2.4vw + 26px, 64px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.04em;
}
.ledger__year--multi {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  font-size: clamp(26px, 1.1vw + 20px, 36px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.ledger__year--multi time + time::before {
  content: "·";
  margin-right: 12px;
  color: var(--text-2);
}
.ledger__title {
  font-size: clamp(20px, 0.7vw + 16px, 26px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.ledger__meta { margin-top: 6px; font-size: 15px; color: var(--text-2); }
@media (min-width: 768px) {
  .ledger__row { grid-template-columns: minmax(200px, 4fr) 8fr; align-items: baseline; }
}

/* ---------- Accordion ---------- */
.accordion { padding: 0; }
.accordion__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--radius-card);
  list-style: none;
  cursor: pointer;
}
.accordion__summary::-webkit-details-marker { display: none; }
.accordion__summary:focus-visible { outline-offset: -4px; border-radius: var(--radius-card); }
.accordion__heading { display: grid; gap: 6px; }
.accordion .eyebrow { margin-bottom: 6px; }
.accordion__title {
  font-size: clamp(28px, 1.8vw + 18px, 44px);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.accordion__meta { font-size: 15px; color: var(--text-2); }
.accordion__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--chip);
  transition: transform 0.5s var(--ease);
}
.accordion__icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.accordion[open] .accordion__icon { transform: rotate(180deg); }
.accordion__body {
  display: grid;
  gap: 32px;
  padding: 0 clamp(24px, 3vw, 40px) clamp(24px, 3vw, 40px);
}
@media (min-width: 768px) {
  .accordion__body { grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
}

.grades { width: 100%; }
.grades caption {
  padding-bottom: 12px;
  text-align: left;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.grades caption span { margin-left: 8px; font-size: 15px; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }
.grades th, .grades td {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  text-align: left;
  vertical-align: baseline;
}
.grades thead th {
  padding-top: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.grades thead th:last-child, .grades td { text-align: right; }
.grades tbody th { font-weight: 500; }
.grades tbody th span { margin-left: 6px; font-size: 14px; font-weight: 400; color: var(--text-2); }
.grades td { font-weight: 650; white-space: nowrap; padding-left: 16px; }

/* ---------- Contact ---------- */
.contact__grid { display: grid; gap: 56px; }
.contact__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }
.contact__list { display: grid; }
.contact__row {
  display: grid;
  gap: 4px;
  padding-block: 18px;
  border-top: 1px solid var(--line);
}
.contact__row:last-child { border-bottom: 1px solid var(--line); }
.contact__row dt { font-size: 15px; font-weight: 600; color: var(--text-2); }
.contact__row dd { font-size: 18px; overflow-wrap: anywhere; }
.contact__portrait {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 85% at 50% 22%, var(--slate-1) 0%, #5f626b 45%, #43464e 100%);
  box-shadow: var(--shadow);
}
.contact__portrait picture, .contact__portrait img { width: 100%; height: 100%; }
.contact__portrait img {
  object-fit: cover;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%), linear-gradient(180deg, transparent 0%, #000 8%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%), linear-gradient(180deg, transparent 0%, #000 8%, #000 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
@media (min-width: 600px) {
  .contact__row { grid-template-columns: 160px 1fr; align-items: baseline; }
}
@media (min-width: 900px) {
  .contact__grid { grid-template-columns: 7fr 5fr; align-items: center; gap: var(--gutter); }
  .contact__portrait { justify-self: end; }
}

/* ---------- Footer ---------- */
.footer {
  padding-block: 32px calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
}
.footer .link { color: var(--text-2); }
.footer .link:hover { color: var(--text); }

/* ---------- Reduced motion: no pinning, scrubbing, parallax or tilt; simple fades only ---------- */
@media (prefers-reduced-motion: reduce) {
  .line__inner { animation: fadeIn 0.6s ease both; }
  .line:nth-child(2) .line__inner { animation-delay: 0.05s; }
  .hero__sub, .hero__ctas, .js .nav { animation: fadeIn 0.6s ease 0.1s both; }
  .js .portrait__img { transform: none; }
  .js .portrait__img.is-loaded { transition: none; }
  .tracker__pulse { animation: none; opacity: 0; }
  .chip, .accordion__icon, .nav__indicator, .skip-link { transition: none; }
  .nav__sheet:not([hidden]) li { animation: none; }
}

/* ---------- Print ---------- */
@media print {
  .nav, .scene__pin, .hero__ctas, .contact__cta, .skip-link { display: none !important; }
  .hero { height: auto; padding: 0 0 24px; }
  .on-dark { --text: #000; --text-2: #333; }
  .accordion__body { display: grid !important; }
}
