/* ════════════════════════════════════════════════════════════════
   Ali Hakimzadeh — bioinformatics portfolio
   Direction: "Deep Lab" — near-black instrument panel, one locked
   accent, mono-forward technical type, asymmetric editorial grid.
   ════════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #08090B;
  --bg-raise:  #0E1013;
  --bg-sunk:   #050608;

  /* Ink */
  --ink:       #F4F5F7;
  --ink-dim:   #9BA1A9;
  --ink-faint: #7C828A;   /* AA-safe on --bg at small sizes */

  /* The single accent. Nothing else on this page is chromatic. */
  --accent:     #C8FF3D;
  --accent-ink: #0A0C05;
  --accent-08:  rgba(200, 255, 61, 0.08);
  --accent-16:  rgba(200, 255, 61, 0.16);
  --accent-32:  rgba(200, 255, 61, 0.32);

  /* Hairlines */
  --line:        rgba(255, 255, 255, 0.08);
  --line-bright: rgba(255, 255, 255, 0.16);

  /* Type */
  --font-display: 'Clash Display', 'Geist', system-ui, sans-serif;
  --font-body:    'Geist', system-ui, -apple-system, sans-serif;
  --font-mono:    'Geist Mono', ui-monospace, 'SF Mono', monospace;

  /* Layout */
  --container: 1280px;
  --gutter:    28px;

  /* Shape lock: containers 20, inner 12, interactive pill */
  --r-lg: 20px;
  --r-sm: 12px;

  /* Motion — the built-in CSS easings are too weak */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
/* Lenis owns scrolling when it is active */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
button { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

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

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

/* Numerals never jitter */
.tnum, .stat__num, .pub__year, .tl__time, .pindex__no {
  font-variant-numeric: tabular-nums;
}

/* Visible to assistive tech, not to the eye */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Skip link ─────────────────────────────────────────── */
.skip {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 999;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  transform: translateY(-160%);
  transition: transform 200ms var(--ease-out);
}
.skip:focus { transform: translateY(0); }

/* ── Fixed atmosphere layers ───────────────────────────── */
/* Film grain. Fixed + pointer-events:none so it never repaints on scroll. */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* A single, very restrained ambient wash — not an identity gradient */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(46% 38% at 78% 4%,  rgba(200, 255, 61, 0.055), transparent 72%),
    radial-gradient(52% 44% at 8%  92%, rgba(255, 255, 255, 0.026), transparent 72%);
}

/* Content sits above the atmosphere */
.nav, main, .footer { position: relative; z-index: 2; }

.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 200;
  pointer-events: none;
}
.scroll-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

/* ── Navigation ────────────────────────────────────────── */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 300ms var(--ease-out), border-color 300ms ease;
}
.nav.scrolled {
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  border-bottom-color: var(--line);
}
.nav__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.brand__text { letter-spacing: -0.005em; word-spacing: 0.14em; }
.brand__mark { display: grid; place-items: center; color: var(--accent); }

.nav__links { display: flex; align-items: center; gap: 2px; }
.nav__links > a:not(.btn) {
  position: relative;
  padding: 8px 13px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  transition: color 200ms ease;
}
.nav__links > a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 13px; right: 13px; bottom: 2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms var(--ease-out);
}
.nav__links > a.active { color: var(--ink); }
.nav__links > a.active::after { transform: scaleX(1); }
.nav__cv { margin-left: 10px; }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav__toggle span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 300ms var(--ease-out), opacity 160ms ease;
}
.nav.open .nav__toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav.open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav.open .nav__toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms var(--ease-out),
              background 220ms ease,
              border-color 220ms ease,
              color 220ms ease;
}
.btn:active { transform: scale(0.97); }
.btn--lg { padding: 16px 28px; font-size: 0.92rem; }

.btn--primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn--ghost   { background: transparent; color: var(--ink); border-color: var(--line-bright); }

/* Button-in-button trailing icon */
.btn__ico {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  margin-right: -8px;
  border-radius: 50%;
  background: rgba(10, 12, 5, 0.16);
  transition: transform 220ms var(--ease-out);
}
.btn--ghost .btn__ico { background: rgba(255, 255, 255, 0.08); }

@media (hover: hover) and (pointer: fine) {
  .nav__links > a:not(.btn):hover { color: var(--ink); }
  .btn--primary:hover { background: #D6FF66; }
  .btn--ghost:hover   { border-color: var(--accent); color: var(--accent); }
  .btn:hover .btn__ico { transform: translate(2px, -1px); }
}

.nav__cv.btn--ghost { padding: 8px 16px; font-size: 0.75rem; }

/* ── Reveal ────────────────────────────────────────────
   Driven by IntersectionObserver in site.js so it works with or
   without GSAP. GSAP is enhancement only — it must never be load-bearing.
   No blur: 29 elements animating a filter is the most expensive thing
   the page could do, and it bought nothing a fade could not. */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 520ms var(--ease-out),
              transform 520ms var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 50ms; }
.reveal[data-delay="2"] { transition-delay: 100ms; }
.reveal[data-delay="3"] { transition-delay: 150ms; }
.reveal[data-delay="4"] { transition-delay: 200ms; }
.reveal[data-delay="5"] { transition-delay: 250ms; }

/* An index reads left to right, so it wipes rather than rises. */
.pindex.reveal { transform: none; }
.pindex.reveal li {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 620ms var(--ease-out);
}
.pindex.reveal.in li { clip-path: inset(0 0 0 0); }
.pindex.reveal li:nth-child(2) { transition-delay: 60ms; }
.pindex.reveal li:nth-child(3) { transition-delay: 120ms; }
.pindex.reveal li:nth-child(4) { transition-delay: 180ms; }
.pindex.reveal li:nth-child(5) { transition-delay: 240ms; }
.pindex.reveal li:nth-child(6) { transition-delay: 300ms; }

/* If JS never runs, content must still be visible */
.no-js .reveal { opacity: 1; transform: none; }
.no-js .pindex.reveal li { clip-path: none; }

/* ── Eyebrow (budget: 3 on the whole page) ─────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
}

/* ════════════════ HERO ════════════════ */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 128px 0 96px;
  overflow: hidden;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
}
.hero__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(100deg, var(--bg) 12%, rgba(8, 9, 11, 0.82) 42%, transparent 72%),
    linear-gradient(0deg, var(--bg) 2%, transparent 34%);
}
.hero .container { position: relative; z-index: 2; }

/* Asymmetric: content left, canvas breathes right */
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  align-items: center;
  gap: 48px;
}
/* No max-width here: the name is the widest thing on the page and the
   mask below clips anything that overruns. Measure is capped per-element. */

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.75rem, 11vw, 6.6rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  margin-top: 26px;
  color: var(--ink);
}
/* Per-line mask reveal. overflow:hidden clips horizontally too, so the
   padding/negative-margin pair buys slack for wider fallback metrics
   before the display face loads — without changing layout width. */
.hero__title .line {
  display: block;
  overflow: hidden;
  padding: 0 0.14em 0.06em 0;
  margin-right: -0.14em;
}
.hero__title .line > span { display: block; white-space: nowrap; }

.hero__claim {
  margin-top: 26px;
  max-width: 34ch;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.15rem, 2.1vw, 1.6rem);
  line-height: 1.32;
  letter-spacing: -0.015em;
  color: var(--ink-dim);
  text-wrap: pretty;
}
.hero__claim em { font-style: normal; color: var(--ink); }
.hero__claim .hl {
  color: var(--accent);
  box-shadow: inset 0 -0.32em 0 var(--accent-08);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

/* Canvas legend — proves the hero is data, not decoration */
.hero__legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 20px;
  border-left: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.hero__legend li { display: flex; align-items: center; gap: 9px; }
.hero__legend .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.hero__legend li[data-on] { color: var(--accent); }
.hero__legend .cap {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ════════════════ MARQUEE (the page's only one) ════════════════ */
.marquee {
  position: relative;
  padding: 22px 0;
  border-block: 1px solid var(--line);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  gap: 0;
  will-change: transform;
  animation: marquee 42s linear infinite;
}
.marquee__group {
  display: flex;
  align-items: center;
  gap: 40px;
  padding-right: 40px;
  flex-shrink: 0;
}
.marquee__group li {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.marquee__group li::after {
  content: "·";
  margin-left: 40px;
  color: var(--accent-32);
}
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee:hover .marquee__track { animation-play-state: paused; }

/* ════════════════ STATS — no card, hairlines only ════════════════ */
.stats { padding: 84px 0 24px; }
.stats__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.stat { padding: 4px 28px; border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; border-left: 0; }
/* The counter rewrites .stat__num's textContent, so the "+" has to live
   outside it as a sibling — flex keeps them on one baseline. */
.stat__value { display: flex; align-items: flex-start; gap: 3px; }
.stat__num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 5.4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.stat__value sup {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 2.3vw, 1.7rem);
  line-height: 1.15;
  color: var(--accent);
}
.stat__label {
  display: block;
  margin-top: 12px;
  max-width: 18ch;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}

/* ════════════════ SECTION SHELL ════════════════ */
.section { padding: 116px 0; position: relative; }
/* Vary the rhythm on purpose: About and Projects are the anchors and
   get air; Research and Publications are denser reference material. */
.about       { padding: 168px 0 104px; }
.research    { padding: 104px 0; }
.projects    { padding: 168px 0 104px; }
.publications{ padding: 104px 0; }
.experience  { padding: 140px 0; }
.section__head { max-width: 700px; margin-bottom: 60px; }
.section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.eyebrow + .section__title { margin-top: 18px; }
.section__lede {
  margin-top: 20px;
  max-width: 32em;
  font-size: 1.02rem;
  color: var(--ink-dim);
  text-wrap: pretty;
}
.link-a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-32);
  transition: border-color 200ms ease;
}
@media (hover: hover) and (pointer: fine) { .link-a:hover { border-bottom-color: var(--accent); } }

/* ════════════════ ABOUT ════════════════ */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 4.6fr) minmax(0, 7.4fr);
  gap: 72px;
  align-items: start;
}
.about__media { position: relative; padding-top: 14px; }

/* Hard-cropped plate, offset hairline frame. No spinning rings. */
.about__plate { position: relative; }
.about__plate::before {
  content: "";
  position: absolute;
  inset: 18px -18px -18px 18px;
  border: 1px solid var(--accent-32);
  border-radius: var(--r-sm);
  pointer-events: none;
}
.about__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--r-sm);
  filter: grayscale(1) contrast(1.06) brightness(0.94);
  transition: filter 500ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .about__plate:hover .about__photo { filter: grayscale(0.55) contrast(1.02) brightness(1); }
}

.about__badge {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.about__badge-dot {
  width: 7px; height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--accent-08);
}
.about__badge strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 550;
}
.about__badge span {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

.about__body > p { margin-top: 18px; color: var(--ink-dim); max-width: 34em; text-wrap: pretty; }
.about__body > p:first-of-type { margin-top: 24px; }
.about__body strong { color: var(--ink); font-weight: 550; }
.about__body a { color: var(--accent); border-bottom: 1px solid var(--accent-32); }

.about__facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-top: 40px;
  border-top: 1px solid var(--line);
}
.about__facts li {
  padding: 18px 20px 18px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink);
}
.about__facts li:nth-child(odd) { border-right: 1px solid var(--line); padding-right: 20px; }
.about__facts li:nth-child(even) { padding-left: 20px; }
.about__facts span {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ink-faint);
}

/* ════════════════ RESEARCH — asymmetric bento ════════════════ */
.research__grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.rcard {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 30px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 380ms ease, transform 380ms var(--ease-out);
}
/* Bento rhythm: 1 large + 2 stacked + 3 across */
.rcard:nth-child(1) { grid-column: span 7; grid-row: span 2; }
.rcard:nth-child(2) { grid-column: span 5; }
.rcard:nth-child(3) { grid-column: span 5; }
.rcard:nth-child(4),
.rcard:nth-child(5),
.rcard:nth-child(6) { grid-column: span 4; }

/* Names the concrete artifact instead of a decorative glyph. */
.rcard__kicker {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.rcard h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.12rem;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.rcard p {
  margin-top: 13px;
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--ink-dim);
}
.rcard em { color: var(--ink); font-style: italic; }
/* The flagship cell gets more air and a larger heading. No
   space-between: on a row-spanning cell it opened a ~230px hole. */
.rcard:nth-child(1) { padding: 38px; }
.rcard:nth-child(1) h3 { font-size: 1.5rem; }
.rcard:nth-child(1) > p:not(.rcard__kicker) { font-size: 0.98rem; max-width: 46ch; }

/* Fills the row-spanning cell with evidence instead of empty space. */
.rcard__evidence {
  margin-top: auto;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.rcard__evidence li {
  display: flex;
  gap: 14px;
  padding: 9px 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-dim);
}
.rcard__evidence li + li { border-top: 1px solid var(--line); }
.rcard__evidence span {
  flex: 0 0 76px;
  color: var(--ink-faint);
}

/* These cards are not links. A lift on hover promises a click that
   never happens, so only the hairline responds. */
@media (hover: hover) and (pointer: fine) {
  .rcard:hover { border-color: var(--line-bright); }
}

/* ════════════════ PROJECTS — feature + editorial index ════════════════ */
.pfeature {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 44px;
  align-items: center;
  padding: 40px;
  margin-bottom: 56px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
/* Continues the index numbering: this card is 01, the list starts at 02. */
.pfeature__no {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}
.pfeature h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.pfeature__org {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-faint);
}
.pfeature p { margin-top: 18px; max-width: 52ch; color: var(--ink-dim); }
.pfeature__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.pfeature__fig {
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--bg-sunk);
}
.pfeature__fig img { width: 100%; height: 100%; object-fit: cover; }
.pfeature__fig figcaption {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* Editorial index — deliberately NOT the bento family */
.pindex { border-top: 1px solid var(--line); }
.pindex__row {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 4fr) minmax(0, 5fr) auto;
  gap: 28px;
  align-items: baseline;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  transition: transform 380ms var(--ease-out);
}
.pindex__row::before {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 480ms var(--ease-out);
}
.pindex__no {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  transition: color 280ms ease;
}
/* Both must be block: as inline boxes the org ran in after the title
   and its margin-top did nothing. */
.pindex__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.24rem;
  letter-spacing: -0.02em;
  transition: color 280ms ease;
}
.pindex__org {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
}
/* Honest status for rows that have nothing to link to */
.pindex__state {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.pindex__desc { font-size: 0.9rem; line-height: 1.6; color: var(--ink-dim); }
.pindex__go {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-faint);
  align-self: center;
  transition: color 280ms ease, border-color 280ms ease, transform 280ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .pindex__row:hover { transform: translateX(16px); }
  .pindex__row:hover::before { transform: scaleX(1); }
  .pindex__row:hover .pindex__no,
  .pindex__row:hover .pindex__title { color: var(--accent); }
  .pindex__row:hover .pindex__go {
    color: var(--accent);
    border-color: var(--accent);
    transform: translate(2px, -2px);
  }
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags li {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

/* ════════════════ PUBLICATIONS — featured statement + 2-col ════════════════ */
.pub-feature {
  padding: 44px;
  margin-bottom: 44px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-lg);
}
.pub-feature__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.pub-feature__meta .yr { color: var(--ink-faint); }
.pub-feature h3 {
  margin-top: 18px;
  max-width: 30ch;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.pub-feature .authors { margin-top: 16px; font-size: 0.9rem; color: var(--ink-dim); }
.pub-feature .authors strong { color: var(--ink); }

/* A published figure is reproduced as printed — it sits on its own light
   plate rather than being inverted or tinted, because recolouring a data
   graphic would misrepresent it. */
.figplate {
  margin: 28px 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #F4F5F7;
}
.figplate img { width: 100%; height: auto; }
.figplate figcaption {
  padding: 11px 16px;
  background: var(--bg-sunk);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.6;
  color: var(--ink-faint);
}
.figplate figcaption a {
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line-bright);
}
@media (hover: hover) and (pointer: fine) {
  .figplate figcaption a:hover { color: var(--accent); border-bottom-color: var(--accent); }
}
.pub-feature .btn { margin-top: 8px; }

.pubs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 44px;
  border-top: 1px solid var(--line);
}
.pub {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 280ms ease;
}
.pub__year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.pub__venue {
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-dim);
}
.pub__title {
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.04rem;
  line-height: 1.3;
  letter-spacing: -0.018em;
  text-wrap: pretty;
}
.pub__authors { margin-top: 10px; font-size: 0.84rem; color: var(--ink-dim); }
.pub__authors strong { color: var(--ink); font-weight: 550; }
.pub__doi {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  transition: color 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .pub__doi:hover { color: var(--accent); }
}

/* ════════════════ EXPERIENCE ════════════════ */
.experience__grid {
  display: grid;
  grid-template-columns: minmax(0, 4.6fr) minmax(0, 7.4fr);
  gap: 72px;
  align-items: start;
}
.experience .section__head { position: sticky; top: 104px; margin-bottom: 0; }

.awards { margin-top: 38px; padding-top: 22px; border-top: 1px solid var(--line); }
.awards__head {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
}
.awards li {
  position: relative;
  padding: 7px 0 7px 20px;
  font-size: 0.88rem;
  color: var(--ink-dim);
}
.awards li::before {
  content: "";
  position: absolute;
  left: 0; top: 15px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line-bright);
}

.timeline { position: relative; padding-left: 34px; }
/* Static rail */
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--line);
}
/* Scrub-driven fill, scaled by GSAP */
.timeline__fill {
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
}
.tl { position: relative; padding-bottom: 44px; }
.tl:last-child { padding-bottom: 0; }
.tl__dot {
  position: absolute;
  left: -33px; top: 6px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--accent);
}
.tl__time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.tl__role {
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.022em;
}
.tl__org { margin-top: 5px; font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink); }
.tl__desc { margin-top: 12px; max-width: 32em; font-size: 0.92rem; color: var(--ink-dim); }

/* ════════════════ CONTACT — full-bleed statement, no card ════════════════ */
.contact { padding: 120px 0 96px; border-top: 1px solid var(--line); }
.contact__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.contact__lede { margin-top: 26px; max-width: 50ch; font-size: 1.04rem; color: var(--ink-dim); }

.contact__mail {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-top: 44px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-bright);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.15rem, 3.2vw, 2.1rem);
  letter-spacing: -0.03em;
  color: var(--ink);
  transition: color 260ms ease, border-color 260ms ease;
}
.contact__mail svg { flex-shrink: 0; transition: transform 300ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .contact__mail:hover { color: var(--accent); border-bottom-color: var(--accent); }
  .contact__mail:hover svg { transform: translateX(5px); }
}

.contact__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  margin-top: 56px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.contact__loc {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
}
.contact__loc svg { color: var(--accent); }

.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.socials a {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-faint);
  transition: color 240ms ease, border-color 240ms ease, transform 240ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-3px); }
}

/* ════════════════ FOOTER ════════════════ */
.footer { border-top: 1px solid var(--line); padding: 30px 0; }
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.footer p {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

/* ════════════════ RESPONSIVE ════════════════ */
/* 1180, not 1080: below this the headline no longer clears the legend
   column, and the two-up asymmetric grids get too narrow to hold a measure. */
@media (max-width: 1180px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  /* Portrait-ish hero: the plot now sits under the copy, so the veil
     has to carry legibility instead of the empty right-hand column. */
  .hero__veil {
    background:
      linear-gradient(180deg, var(--bg) 8%, rgba(8, 9, 11, 0.86) 44%, rgba(8, 9, 11, 0.6) 100%),
      linear-gradient(0deg, var(--bg) 2%, transparent 30%);
  }
  .hero__legend { flex-direction: row; flex-wrap: wrap; gap: 8px 22px; padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .hero__legend .cap { flex-basis: 100%; border-top: 0; padding-top: 0; margin-top: 0; }
  .about__grid, .experience__grid { grid-template-columns: 1fr; gap: 48px; }
  .experience .section__head { position: static; }

  /* Bento reflow: 2-up */
  .rcard:nth-child(1) { grid-column: span 12; grid-row: auto; }
  .rcard:nth-child(2), .rcard:nth-child(3) { grid-column: span 6; }
  .rcard:nth-child(4), .rcard:nth-child(5), .rcard:nth-child(6) { grid-column: span 6; }

  .pfeature { grid-template-columns: 1fr; gap: 32px; }
  /* The description is the only line that explains the item, so it wraps
     to a second row rather than being hidden on tablet and phone. */
  .pindex__row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 8px 20px;
  }
  .pindex__desc {
    grid-column: 2 / -1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (max-width: 860px) {
  .stats__grid { grid-template-columns: repeat(2, 1fr); gap: 32px 0; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .pubs { grid-template-columns: 1fr; gap: 0; }
}

/* The full link row plus the CV pill stops fitting the bar at ~900px,
   so the drawer takes over there. Keep in sync with mobileMQ in site.js. */
@media (max-width: 900px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(84%, 340px);
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
    padding: 32px 28px;
    background: rgba(8, 9, 11, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 360ms var(--ease-drawer);
  }
  .nav.open .nav__links { transform: translateX(0); }
  .nav__links > a:not(.btn) { padding: 15px 4px; font-size: 1rem; }
  .nav__links > a:not(.btn)::after { display: none; }
  .nav__cv { margin: 18px 0 0; justify-content: center; }
}

@media (max-width: 760px) {
  :root { --gutter: 20px; }
  .section { padding: 84px 0; }

  .hero { padding: 108px 0 88px; }
  .hero__scroll { display: none; }

  /* Everything collapses to one column */
  .rcard:nth-child(n) { grid-column: span 12; }
  .rcard:nth-child(1) { padding: 30px; }
  .rcard:nth-child(1) h3 { font-size: 1.24rem; }

  .pfeature { padding: 28px; }
  .pub-feature { padding: 30px; }
  .about__facts { grid-template-columns: 1fr; }
  .about__facts li:nth-child(odd) { border-right: 0; padding-right: 0; }
  .about__facts li:nth-child(even) { padding-left: 0; }
  .about__plate::before { inset: 12px -12px -12px 12px; }
}

@media (max-width: 440px) {
  .stats__grid { grid-template-columns: 1fr; }
  .stat { padding-left: 0; border-left: 0; }
  .hero__cta { width: 100%; }
  .hero__cta .btn { flex: 1; justify-content: center; }
  .pindex__row { grid-template-columns: 32px minmax(0, 1fr); }
  .pindex__go, .pindex__state { display: none; }
}

/* ════════════════ REDUCED MOTION ════════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* filter too — a leftover blur would keep content unreadable even
     though opacity says it is "visible". */
  .reveal { opacity: 1 !important; transform: none !important; filter: none !important; }
  .marquee__track { animation: none; }
  .hero__scroll-line::after { animation: none; opacity: 0.6; }
  .timeline__fill { transform: scaleY(1); }
  /* Reduced motion means fewer and gentler animations, not zero.
     Looping animation stops; colour and opacity feedback stays. */
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-property: opacity, color, background-color, border-color !important;
    transition-duration: 140ms !important;
  }
}

/* ════════════════ REDUCED TRANSPARENCY ════════════════ */
@media (prefers-reduced-transparency: reduce) {
  .nav.scrolled { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav__links { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .grain, .ambient { display: none; }
}

/* ════════════════ PRINT ════════════════
   .reveal gates 30+ blocks at opacity 0. Without this, Ctrl+P on a
   researcher's page yields a hero and a footer. */
@media print {
  .reveal, .reveal.in { opacity: 1 !important; transform: none !important; }
  .pindex.reveal li { clip-path: none !important; }
  .nav, .grain, .ambient, .scroll-progress, .hero__canvas,
  .hero__veil, .marquee, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .section, .about, .research, .projects, .publications, .experience { padding: 18px 0; }
  .rcard, .pfeature, .pub-feature { background: none; border-color: #ccc; }
  a { color: #000; text-decoration: underline; }
  .pindex__desc { display: block !important; -webkit-line-clamp: none; }
}
