/* ============================================================
   Ángel García — portfolio
   Dark technical dossier: graphite ground, paper-white ink,
   hairline rules, one tracer-orange accent.
   ============================================================ */

:root {
  --bg: #0a0b0d;
  --bg-raise: #111317;
  --bg-sunk: #070809;
  --ink: #eeece7;
  --ink-2: #a9acb3;
  --ink-3: #6e727a;
  --line: rgba(238, 236, 231, 0.09);
  --line-2: rgba(238, 236, 231, 0.17);
  --accent: #ff5d1f;
  --accent-soft: rgba(255, 93, 31, 0.14);
  --paper: #ebe8e1;
  --paper-2: #dedad1;
  --paper-ink: #17181b;
  --warn: #f0b43c;
  --alarm: #e5484d;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --serif: "Instrument Serif", "Times New Roman", serif;

  --pad: clamp(16px, 4.2vw, 64px);
  --max: 1440px;
  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 16px/1.62 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* film grain */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, video, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; color: var(--ink); }
::selection { background: var(--accent); color: #000; }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: #000; padding: 8px 12px; font-weight: 600; }
.skip:focus { top: 12px; }
.ico { width: 14px; height: 14px; flex: none; }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font: 500 13.5px/1 var(--sans); color: var(--ink); white-space: nowrap;
  transition: background 0.25s var(--ease), border-color 0.25s, color 0.25s, transform 0.25s var(--ease);
}
.btn .ico { transition: transform 0.3s var(--ease); }
.btn:hover .ico { transform: translateX(3px); }
.btn--lg { height: 46px; padding: 0 20px; font-size: 14.5px; }
.btn--ghost:hover { border-color: var(--ink); }
.btn--solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); color: #000; }

/* ------------------------------------------------ nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px); /* clear of a phone's status bar when the page runs edge to edge */
  transition: transform 0.45s var(--ease), background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled { background: rgba(10, 11, 13, 0.72); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom-color: var(--line); }
.nav.is-hidden { transform: translateY(-100%); }
.nav-in { height: 100%; display: flex; align-items: center; gap: 24px; }
.nav-mark { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; font-size: 14.5px; letter-spacing: -0.01em; }
.nav-mark svg { width: 26px; height: 26px; transition: transform 0.6s var(--ease); }
.nav-mark:hover svg { transform: rotate(90deg); }
/* home page: the gear turns into an arrow while the page scrolls back up (site.js drives the shape) */
.nav-mark.is-arrow svg { transform: none; transition: none; }
.nav-mark .mark-ring { transform-origin: 16px 16px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a { display: flex; align-items: baseline; gap: 6px; padding: 8px 12px; font-size: 13.5px; color: var(--ink-2); border-radius: 999px; transition: color 0.2s, background 0.2s; }
.nav-links a span { font: 10.5px var(--mono); color: var(--ink-3); transition: color 0.2s; }
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active span { color: var(--accent); }
.nav-menu-only { display: none !important; }
.nav-cta { display: flex; gap: 8px; }
.nav-toggle { display: none; width: 40px; height: 40px; margin-left: auto; position: relative; }
.nav-toggle span { position: absolute; left: 10px; right: 10px; height: 1.5px; background: var(--ink); transition: transform 0.35s var(--ease); }
.nav-toggle span:nth-child(1) { top: 16px; }
.nav-toggle span:nth-child(2) { top: 23px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

/* ------------------------------------------------ hero */
.hero { position: relative; padding-top: calc(var(--nav-h) + clamp(24px, 4vw, 56px)); padding-bottom: clamp(40px, 6vw, 80px); overflow: hidden; }
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 88px 88px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 0%, transparent 75%);
  opacity: 0.55;
}
.hero-meta { position: relative; display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--ink-3); padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.hero-meta .status { margin-left: auto; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; }
.hero-meta .status i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 93, 31, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(255, 93, 31, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 93, 31, 0); } }

.hero-main { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 400px); gap: 24px 48px; align-items: end; padding-top: clamp(28px, 5vw, 64px); padding-bottom: clamp(28px, 4vw, 48px); }
.hero-name {
  font-size: clamp(64px, 13.2vw, 212px);
  font-weight: 500; letter-spacing: -0.055em; line-height: 0.86;
  margin-left: -0.04em;
}
.hero-name .ln { display: block; overflow: hidden; padding: 0.16em 0.04em 0.2em; margin: -0.16em 0 -0.14em; }
.hero-name .ln > span { display: inline-block; }
.js .hero-name .ln > span { transform: translateY(105%); transition: transform 1.2s var(--ease); }
.js .hero-name .ln:nth-child(2) > span { transition-delay: 0.08s; }
.is-loaded .hero-name .ln > span { transform: none; }
.hero-side { display: grid; gap: 20px; padding-bottom: 0.6em; }

/* opening image: video behind the name, darkened toward the text and into the page */
.hero--media { min-height: min(100svh, 1040px); display: flex; flex-direction: column; }
.hero--media .hero-main { margin-top: auto; }
.hero-media { position: absolute; inset: 0; overflow: hidden; background: var(--bg-sunk); }
.hero-media img, .hero-media video { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: var(--hero-pos, 60% 50%); filter: saturate(0.95) brightness(1.05); }
.hero-video { opacity: 0; transition: opacity 1.4s var(--ease); }
.hero-video.is-playing { opacity: 1; }
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 11, 13, 0.5) 0%, rgba(10, 11, 13, 0) 22%, rgba(10, 11, 13, 0.08) 55%, rgba(10, 11, 13, 0.78) 82%, var(--bg) 100%),
    linear-gradient(90deg, rgba(10, 11, 13, 0.55) 0%, rgba(10, 11, 13, 0.15) 40%, rgba(10, 11, 13, 0) 62%);
}
.hero--media .hero-grid { opacity: 0.3; }
.hero--media .hero-meta { color: var(--ink-2); }
/* the text beside the name sits on a darker glass panel so the video never fights it */
@media (min-width: 861px) {
  .hero--media .hero-side {
    padding: 26px 28px 28px; border: 1px solid var(--line-2); border-radius: 4px;
    background: rgba(10, 11, 13, 0.55); -webkit-backdrop-filter: blur(8px) saturate(1.2); backdrop-filter: blur(8px) saturate(1.2);
  }
}
.hero-credit { position: relative; margin-top: 4px; color: var(--ink-3); font-size: 10.5px; text-align: right; }
.js .hero-media { opacity: 0; transition: opacity 1.2s var(--ease); }
.is-loaded .hero-media { opacity: 1; }
.hero-role { color: var(--accent); }
.hero-lede { font-size: clamp(18px, 1.55vw, 21px); line-height: 1.45; color: var(--ink); letter-spacing: -0.01em; }
.hero-lede em { font-size: 1.12em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.js .hero-side, .js .hero-meta, .js .traj { opacity: 0; transform: translateY(14px); transition: opacity 1s var(--ease) 0.35s, transform 1s var(--ease) 0.35s; }
.js .hero-meta { transition-delay: 0.1s; }
.js .traj { transition-delay: 0.55s; }
.is-loaded .hero-side, .is-loaded .hero-meta, .is-loaded .traj { opacity: 1; transform: none; }

/* trajectory plate */
.traj { margin: 0; border: 1px solid var(--line-2); background: linear-gradient(180deg, rgba(255,255,255,0.018), rgba(255,255,255,0)); border-radius: 4px; position: relative; }
.traj-head { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.traj-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traj-replay { font: inherit; color: var(--ink-2); padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px; transition: color 0.2s, border-color 0.2s; }
.traj-replay:hover { color: var(--accent); border-color: var(--accent); }
.fig-n { color: var(--accent); white-space: nowrap; }
.traj-plot { position: relative; height: clamp(220px, 26vw, 340px); }
.traj-svg { width: 100%; height: 100%; overflow: visible; }
.traj-svg text { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-3); letter-spacing: 0.04em; }
.traj-svg .t-grid { stroke: var(--line); stroke-width: 1; }
.traj-svg .t-axis { stroke: var(--line-2); stroke-width: 1; }
.traj-svg .t-los { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 5; }
.traj-svg .t-ghost { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 1 4; opacity: 0.7; }
.traj-svg .t-path { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.traj-svg .t-glow { fill: none; stroke: var(--accent); stroke-width: 8; opacity: 0.12; stroke-linecap: round; filter: blur(4px); }
.traj-svg .t-dot { fill: #fff; }
.traj-svg .t-halo { fill: var(--accent); opacity: 0.25; }
.traj-svg .t-mark { stroke: var(--ink-2); stroke-width: 1; fill: none; }
.traj-svg .t-sonic { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0; transition: opacity 0.4s; }
.traj-svg .t-sonic-l { fill: var(--warn); opacity: 0; transition: opacity 0.4s; }
.traj-svg .t-end { opacity: 0; transition: opacity 0.5s; }
.traj-svg .t-end text { fill: var(--ink); }
.traj-svg .t-end .hot { fill: var(--accent); }
.traj.is-sonic .t-sonic, .traj.is-sonic .t-sonic-l { opacity: 1; }
.traj.is-done .t-end { opacity: 1; }
.traj-read { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); }
.traj-read > div { padding: 12px 16px; border-left: 1px solid var(--line); }
.traj-read > div:first-child { border-left: 0; }
.traj-read dt { color: var(--ink-3); margin-bottom: 4px; }
.traj-read dd { color: var(--ink-3); text-transform: none; }
.traj-read b { font: 400 clamp(17px, 1.6vw, 22px)/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.traj figcaption { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 10.5px; }

/* ------------------------------------------------ quick jumps */
.jumps { padding-top: clamp(28px, 4vw, 48px); }
.jumps-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; color: var(--ink-3); }
.jumps-track {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding: 2px max(var(--pad), calc((100vw - var(--max)) / 2 + var(--pad))) 4px;
  scroll-padding-inline: max(var(--pad), calc((100vw - var(--max)) / 2 + var(--pad)));
  /* edge fades stay inside the side gutter, so a card in full view is never dimmed */
  scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 min(24px, var(--pad)), #000 calc(100% - min(48px, var(--pad))), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 min(24px, var(--pad)), #000 calc(100% - min(48px, var(--pad))), transparent);
}
.jumps-track.is-static { overflow-x: hidden; } /* every card in view: nothing to scroll */
.jumps-track::-webkit-scrollbar { display: none; }
.jump {
  flex: 0 0 clamp(244px, 24vw, 300px); scroll-snap-align: start; position: relative;
  display: grid; grid-template-rows: auto auto 1fr; align-content: start; gap: 6px; padding: 0 18px 18px; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: 4px; background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent);
  transition: border-color 0.3s, background 0.3s;
}
.jump:hover, .jump:focus-visible { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent 60%); }
/* picture strip on top of each card: 1 photo, 3 slices or a 2 x 2 mosaic */
.jump-pic { position: relative; display: block; margin: 0 -18px 8px; border-bottom: 1px solid var(--line); overflow: hidden; }
.jump-media { display: grid; gap: 1px; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg); transition: transform 0.9s var(--ease); }
.jump-media--3 { grid-template-columns: repeat(3, 1fr); }
.jump-media--4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.jump-media img { width: 100%; height: 100%; min-height: 0; object-fit: cover; filter: saturate(0.75) brightness(0.74); transition: filter 0.5s; }
.jump:hover .jump-media img, .jump:focus-visible .jump-media img { filter: saturate(1) brightness(0.95); }
/* zoom the whole mosaic, so the hairlines between slices scale with it */
.jump:hover .jump-media:not(.jump-media--draw), .jump:focus-visible .jump-media:not(.jump-media--draw) { transform: scale(1.04); }
.jump-pic::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(10,11,13,0.35), transparent 38%, transparent 62%, rgba(10,11,13,0.5)); }
/* logos on paper: no dark shade, only a light dim that lifts on hover */
.jump-pic--paper::after { display: none; }
.jump-pic--paper .jump-media { background: var(--paper); }
.jump-pic--paper .jump-media img { filter: brightness(0.9); }
.jump:hover .jump-pic--paper .jump-media img, .jump:focus-visible .jump-pic--paper .jump-media img { filter: none; }
.jump-media--draw {
  place-items: center; color: var(--ink-3); transition: color 0.3s;
  background-color: var(--bg-sunk);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 18px 18px; background-position: center;
}
.jump-media--draw svg { width: 30%; height: auto; }
.jump:hover .jump-media--draw { color: var(--accent); }
.jump-code { position: absolute; left: 10px; top: 10px; z-index: 1; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 2px; background: rgba(10,11,13,0.72); color: var(--ink); font-size: 11px; line-height: 1.5; transition: color 0.3s, border-color 0.3s; }
.jump:hover .jump-code { color: var(--accent); border-color: var(--accent); }
.jump-title { font-size: clamp(20px, 1.8vw, 24px); color: var(--ink); letter-spacing: -0.025em; line-height: 1.1; font-weight: 500; }
.jump-sub { align-self: start; font-size: 13px; color: var(--ink-3); line-height: 1.4; padding-right: 26px; }
.jump-go { position: absolute; right: 16px; bottom: 16px; color: var(--ink-3); transition: color 0.3s, transform 0.3s var(--ease); }
.jump:hover .jump-go { color: var(--accent); transform: translateX(3px); }
/* slider under the cards: drag the thumb or click the rail */
.jumps-foot { margin-top: 14px; }
.jumps-bar { position: relative; height: 22px; cursor: pointer; touch-action: none; outline: none; }
.jumps-bar[hidden] { display: none; }
.jumps-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-2); }
.jumps-thumb { position: absolute; left: 0; top: 50%; width: 30%; height: 3px; margin-top: -1.5px; border-radius: 3px; background: var(--ink-2); cursor: grab; transition: height 0.2s, margin-top 0.2s, background 0.2s; }
.jumps-bar:hover .jumps-thumb, .jumps-bar:focus-visible .jumps-thumb, .jumps-bar.is-drag .jumps-thumb { height: 6px; margin-top: -3px; background: var(--accent); }
.jumps-bar.is-drag .jumps-thumb { cursor: grabbing; }
.jumps-bar:focus-visible::after { content: ""; position: absolute; inset: 0 -6px; border: 1px solid var(--accent); border-radius: 3px; }

/* volunteering */
.vol { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2vw, 28px); }
.vol li { border-top: 1px solid var(--line-2); padding-top: 14px; }
.vol h4 { font-size: 18px; font-weight: 500; }
.vol p.mono { color: var(--accent); font-size: 10.5px; margin: 6px 0 10px; }
.vol p:last-child { font-size: 14.5px; }

/* ------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: clamp(24px, 3vw, 40px) clamp(16px, 2vw, 28px); border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat-v { font-size: clamp(38px, 4.4vw, 64px); font-weight: 300; letter-spacing: -0.045em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-v small { font: 400 13px var(--mono); letter-spacing: 0.04em; margin-left: 6px; color: var(--ink-3); vertical-align: 0.9em; }
.stat-l { margin-top: 12px; font-size: 13.5px; line-height: 1.45; max-width: 26ch; }

/* ------------------------------------------------ sections */
.section { padding-top: clamp(80px, 11vw, 160px); }
.sec-head { display: grid; grid-template-columns: minmax(160px, 3fr) 9fr; gap: 16px 32px; align-items: start; margin-bottom: clamp(40px, 5vw, 72px); }
.sec-idx { display: flex; gap: 14px; color: var(--ink-2); padding-top: 0.9em; border-top: 1px solid var(--line-2); }
.sec-idx span { color: var(--accent); }
.sec-title { font-size: clamp(30px, 4.1vw, 60px); font-weight: 400; letter-spacing: -0.035em; line-height: 1.04; max-width: 20ch; }
.sec-title em { font-size: 1.08em; }
.sub-h { color: var(--ink-3); margin: clamp(56px, 7vw, 96px) 0 24px; padding-top: 14px; border-top: 1px solid var(--line); }

/* plates & crop marks */
.crop { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.crop::before, .crop::after { content: ""; position: absolute; width: 12px; height: 12px; border-color: var(--line-2); border-style: solid; }
.crop::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.crop::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* ------------------------------------------------ research cards */
.rlist { display: grid; gap: clamp(64px, 8vw, 120px); }
.rcard { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(24px, 4vw, 64px); align-items: center; }
.rcard--flip { grid-template-columns: 5fr 7fr; }
.rcard--flip .rcard-media { order: 2; }
.rcard-media { position: relative; display: block; overflow: hidden; border: 1px solid var(--line-2); border-radius: 3px; aspect-ratio: 3 / 2; background: var(--bg-raise); }
.rcard-media img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); transition: transform 1.2s var(--ease), filter 0.6s; filter: saturate(0.85); }
.rcard:hover .rcard-media img { transform: scale(1.035); filter: saturate(1); }
.rcard-media video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.rcard-media.is-paper { background: var(--paper); border-color: var(--paper-2); }
.rcard-media.is-paper img { object-fit: contain; padding: 6%; mix-blend-mode: multiply; filter: none; }
.case-hero .traj { margin: 0; }
.rcard-top { display: flex; gap: 14px; color: var(--ink-3); margin-bottom: 18px; }
.code { color: var(--accent); }
.rcard-title { font-size: clamp(34px, 3.8vw, 54px); font-weight: 500; letter-spacing: -0.04em; }
.rcard-title a { background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 1.5px no-repeat; transition: background-size 0.5s var(--ease); }
.rcard-title a:hover { background-size: 100% 1.5px; }
.rcard-sub { font: italic 400 clamp(20px, 1.8vw, 24px)/1.3 var(--serif); color: var(--ink); margin-top: 10px; }
.rcard-sum { margin-top: 18px; max-width: 52ch; }
.rcard-nums { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 28px; border-top: 1px solid var(--line); }
.rcard-nums > div { padding: 14px 12px 0 0; display: flex; flex-direction: column-reverse; gap: 6px; }
.rcard-nums > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.rcard-nums dd { font: 400 clamp(20px, 1.8vw, 26px)/1 var(--sans); letter-spacing: -0.03em; color: var(--ink); }
.rcard-nums dt { font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }
.rcard-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.tags li { font: 11px var(--mono); letter-spacing: 0.04em; color: var(--ink-3); padding: 4px 8px; border: 1px solid var(--line); border-radius: 2px; }

/* publications */
.pubs { border-top: 1px solid var(--line-2); padding-top: 16px; display: grid; grid-template-columns: minmax(160px, 3fr) 9fr; gap: 16px 32px; }
.pubs-h { color: var(--ink-3); }
.pubs ol { display: grid; }
.pubs li { display: flex; flex-direction: column; padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.pubs li:last-child { border-bottom: 0; margin-bottom: 0; }
.pub-t { font-size: clamp(17px, 1.5vw, 20px); color: var(--ink); line-height: 1.35; letter-spacing: -0.01em; }
.pub-a { margin-top: 8px; font-size: 14px; }
.pub-a strong { color: var(--ink); font-weight: 500; }
.pub-a span { color: var(--ink-3); }
.pub-s { order: -1; align-self: flex-start; margin-bottom: 10px; color: var(--accent); border: 1px solid rgba(255, 93, 31, 0.4); padding: 3px 8px; border-radius: 2px; font-size: 10.5px; }

/* ------------------------------------------------ project grid */
.pfilter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(28px, 3vw, 44px); }
.pfilter button { padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); transition: color 0.2s, border-color 0.2s, background 0.2s; }
.pfilter button sup { color: var(--ink-3); font-size: 9px; margin-left: 2px; }
.pfilter button:hover { color: var(--ink); border-color: var(--ink-3); }
.pfilter button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pfilter button[aria-pressed="true"] sup { color: var(--accent); }
.pgrid > li.is-out { display: none; }
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(40px, 4vw, 64px) clamp(16px, 2vw, 32px); }
.pcard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.pcard-media { aspect-ratio: 4 / 3; display: grid; place-items: center; }
.pcard-media.plate--paper { padding: clamp(14px, 1.6vw, 24px); }
.pcard-media.plate--paper img { max-height: 100%; max-width: 100%; width: auto; height: auto; object-fit: contain; transition: transform 1s var(--ease); }
.pcard-media.is-photo img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.8); transition: transform 1s var(--ease), filter 0.6s; }
.pcard:hover .pcard-media img { transform: scale(1.04); }
.pcard:hover .pcard-media.is-photo img { filter: none; }
.pcard-meta { display: flex; gap: 12px; color: var(--ink-3); margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 10.5px; }
.pcard-meta span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-title { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-top: 12px; font-size: clamp(21px, 1.9vw, 27px); color: var(--ink); letter-spacing: -0.03em; line-height: 1.12; font-weight: 500; }
.pcard-arrow { flex: none; width: 30px; height: 30px; border: 1px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); transform: translateY(4px); transition: all 0.35s var(--ease); }
.pcard:hover .pcard-arrow { background: var(--accent); border-color: var(--accent); color: #000; transform: translateY(4px) rotate(-45deg); }
.pcard:hover .code { color: var(--accent); }
.pcard-short { margin-top: 10px; font-size: 14.5px; line-height: 1.5; color: var(--ink-3); transition: color 0.3s; max-width: 46ch; }
.pcard:hover .pcard-short { color: var(--ink-2); }
.pcard .code { color: var(--ink-2); transition: color 0.3s; }

/* ------------------------------------------------ experience */
.xp { border-top: 1px solid var(--line-2); }
.xp > li { display: grid; grid-template-columns: 3fr 4fr 5fr; gap: 16px 32px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.xp-when { color: var(--ink-3); padding-top: 4px; }
/* employer's logo under the dates: a paper tile, same height for every logo */
.xp-logo { display: inline-flex; margin-top: 18px; height: 84px; max-width: 100%; border-radius: 4px; background: var(--paper); overflow: hidden; }
.xp-logo img { height: 100%; width: auto; max-width: none; }
.xp-who h3 { font-size: clamp(19px, 1.6vw, 22px); font-weight: 500; letter-spacing: -0.02em; }
.xp-who p { margin-top: 4px; color: var(--ink-2); }
.xp-who p.mono { color: var(--ink-3); margin-top: 8px; }
.xp-what { font-size: 15px; display: grid; gap: 12px; align-content: start; }
.xp-what > p:first-child { color: var(--ink-2); }
.xp-hl { display: grid; gap: 7px; }
.xp-hl li { position: relative; padding-left: 18px; font-size: 14.5px; line-height: 1.5; }
.xp-hl li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 8px; height: 1px; background: var(--accent); }
.xp-label { color: var(--ink-3); font-size: 10.5px; margin-top: 4px; }
.xp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.xp-chips li { font-size: 13px; color: var(--ink); padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 999px; }
.xp .tags { margin-top: 2px; }
.xp--edu .xp-what em { font-size: 1.08em; }

/* ------------------------------------------------ about */
.about { display: grid; grid-template-columns: 4fr 7fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.about-photo { margin: 0; }
.about-img { position: relative; }
.about-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; border-radius: 3px; filter: grayscale(0.35) contrast(1.04); transition: filter 0.8s; }
.about-photo:hover img { filter: none; }
.about-photo figcaption { margin-top: 12px; color: var(--ink-3); }
.about-text { display: grid; gap: 20px; font-size: clamp(16px, 1.3vw, 18px); max-width: 62ch; }
.about-text p:first-child { font-size: clamp(22px, 2.2vw, 30px); line-height: 1.3; color: var(--ink); letter-spacing: -0.02em; }
.langs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin-top: 12px; }
.langs > div { padding: 14px 12px 0 0; }
.langs > div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.langs dt { color: var(--ink); }
.langs dd { color: var(--ink-3); margin-top: 4px; font-size: 10.5px; }

.lead { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2vw, 32px); }
.lead-img { aspect-ratio: 3 / 2; overflow: hidden; border-radius: 3px; border: 1px solid var(--line); margin-bottom: 18px; background: var(--bg-raise); }
.lead-img img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); filter: grayscale(0.4); transition: filter 0.6s, transform 1s var(--ease); }
.lead-card:hover .lead-img img { filter: none; transform: scale(1.03); }
.lead-card h4 { font-size: 19px; font-weight: 500; }
.lead-card--text { border-top: 1px solid var(--line-2); padding-top: 16px; }
.lead-card p.mono { color: var(--accent); margin: 6px 0 10px; font-size: 10.5px; }
.lead-card p:last-child { font-size: 14.5px; }

.skills { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.skill h4 { color: var(--ink); font-size: 11px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.skill li { font-size: 14px; padding: 4px 0; }

/* ------------------------------------------------ contact */
.contact { margin-top: clamp(100px, 13vw, 200px); padding: clamp(64px, 9vw, 140px) 0 clamp(56px, 7vw, 100px); border-top: 1px solid var(--line-2); position: relative; overflow: hidden; }
.contact::before { content: ""; position: absolute; width: 900px; height: 900px; right: -300px; top: -200px; background: radial-gradient(circle, rgba(255, 93, 31, 0.10), transparent 60%); pointer-events: none; }
.contact .sec-idx { border-top: 0; padding-top: 0; }
.contact-h { position: relative; font-size: clamp(40px, 7.2vw, 112px); font-weight: 400; letter-spacing: -0.05em; line-height: 0.98; margin-top: 28px; }
.contact-h em { font-size: 1.06em; color: var(--accent); }
.contact-mail { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: clamp(32px, 4vw, 56px); }
.contact-mail a { font-size: clamp(22px, 3vw, 40px); color: var(--ink); letter-spacing: -0.03em; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px no-repeat; padding-bottom: 4px; transition: color 0.2s; overflow-wrap: anywhere; }
.contact-mail a:hover { color: var(--accent); }
.contact-links { position: relative; display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 40px; color: var(--ink-2); }
.contact-links a { display: inline-flex; align-items: center; gap: 6px; transition: color 0.2s; }
.contact-links a:hover { color: var(--accent); }

.foot { border-top: 1px solid var(--line); }
.foot-in { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; padding-top: 22px; padding-bottom: 22px; font-size: 13px; color: var(--ink-3); }
.foot a:hover { color: var(--ink); }

/* ------------------------------------------------ case study */
.case-head { padding-top: calc(var(--nav-h) + clamp(32px, 6vw, 88px)); }
.crumbs { display: flex; gap: 10px; color: var(--ink-3); margin-bottom: clamp(24px, 4vw, 48px); }
.crumbs a { color: var(--ink-2); transition: color 0.2s; }
.crumbs a:hover { color: var(--accent); }
.crumbs span:last-child { color: var(--accent); }
.case-title { font-size: clamp(44px, 8vw, 128px); font-weight: 500; letter-spacing: -0.055em; line-height: 0.92; max-width: 14ch; }
.case-sub { font: italic 400 clamp(22px, 2.4vw, 34px)/1.25 var(--serif); color: var(--ink); margin-top: 18px; max-width: 34ch; }
.case-intro { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(28px, 5vw, 80px); margin-top: clamp(36px, 5vw, 64px); padding-top: 28px; border-top: 1px solid var(--line-2); }
.case-lede { font-size: clamp(18px, 1.55vw, 21px); line-height: 1.55; color: var(--ink); letter-spacing: -0.01em; }
.case-meta > div { display: grid; grid-template-columns: 100px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.case-meta > div:first-child { padding-top: 0; }
.case-meta dt { color: var(--ink-3); padding-top: 3px; font-size: 10.5px; }
.case-meta dd { font-size: 14.5px; color: var(--ink-2); }
.case-links { display: flex; gap: 10px; margin-top: 28px; }
.case-hero { margin-top: clamp(40px, 6vw, 80px); }
.case-hero .fig { margin: 0; }
.case-nums { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: clamp(40px, 5vw, 64px); }
.case-nums > div { padding: 24px 20px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.case-nums > div:first-child { border-left: 0; padding-left: 0; }
.case-nums dd { font-size: clamp(30px, 3.2vw, 46px); font-weight: 300; letter-spacing: -0.045em; line-height: 1; color: var(--ink); }
.case-nums dt { font-size: 13px; line-height: 1.4; max-width: 26ch; }
.case-body { display: grid; grid-template-columns: 3fr 9fr; gap: clamp(24px, 4vw, 64px); margin-top: clamp(56px, 8vw, 112px); align-items: start; }
.case-toc { position: sticky; top: calc(var(--nav-h) + 24px); color: var(--ink-3); }
.case-toc > p { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.case-toc a { display: flex; gap: 10px; padding: 6px 0; color: var(--ink-3); transition: color 0.2s; text-transform: none; letter-spacing: 0; font: 13.5px/1.35 var(--sans); }
.case-toc a span { font: 10.5px/1.9 var(--mono); }
.case-toc a:hover, .case-toc a.is-active { color: var(--ink); }
.case-toc a.is-active span { color: var(--accent); }
.case-sec + .case-sec { margin-top: clamp(64px, 8vw, 120px); }
.case-sec > h2 { font-size: clamp(26px, 2.8vw, 40px); font-weight: 500; letter-spacing: -0.035em; display: flex; gap: 16px; align-items: baseline; margin-bottom: 24px; }
.case-sec > h2 .mono { color: var(--accent); font-size: 12px; }
.prose { max-width: 68ch; font-size: 16.5px; }
.prose > * + * { margin-top: 1em; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose a { color: var(--ink); border-bottom: 1px solid var(--accent); transition: color 0.2s; }
.prose a:hover { color: var(--accent); }
.prose ul { display: grid; gap: 10px; }
.prose li { position: relative; padding-left: 22px; }
.prose li::before { content: ""; position: absolute; left: 0; top: 0.78em; width: 10px; height: 1px; background: var(--accent); }
.prose .note { font-size: 14px; color: var(--ink-3); padding-left: 14px; border-left: 1px solid var(--line-2); }
.prose sup { font-size: 0.7em; }

/* figures */
.figs { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(16px, 2vw, 28px); margin-top: 36px; }
.fig { margin: 0; grid-column: span 12; min-width: 0; }
.fig--half { grid-column: span 6; }
.fig--third { grid-column: span 4; }
.fig--quarter { grid-column: span 3; }
.plate { position: relative; display: block; width: 100%; border-radius: 3px; overflow: hidden; text-align: left; }
.plate--dark { background: var(--bg-raise); border: 1px solid var(--line-2); }
.plate--paper { background: var(--paper); padding: clamp(12px, 2.4vw, 32px); border: 1px solid var(--paper-2); }
.plate--paper img { mix-blend-mode: multiply; margin: 0 auto; max-height: 72vh; object-fit: contain; }
.plate--paper .crop::before, .plate--paper .crop::after { border-color: rgba(23, 24, 27, 0.35); width: 14px; height: 14px; }
.plate--paper .crop::before { top: 8px; left: 8px; }
.plate--paper .crop::after { bottom: 8px; right: 8px; }
.plate--dark img { max-width: 100%; margin: 0 auto; }
.figs--hero { margin-top: 0; }
.figs--hero .plate--dark img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3 / 4; }
button.plate { cursor: zoom-in; }
button.plate img { transition: transform 0.9s var(--ease); }
button.plate:hover img { transform: scale(1.015); }
.plate--video video { width: 100%; background: #000; }
.fig--video.is-portrait video { aspect-ratio: 9 / 16; object-fit: cover; }
.fig figcaption { display: flex; gap: 12px; margin-top: 12px; font-size: 13.5px; line-height: 1.45; color: var(--ink-3); }
.fig figcaption .fig-n { font: 10.5px/1.9 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.fig-html { border: 1px solid var(--line-2); border-radius: 3px; padding: clamp(16px, 2.4vw, 32px); background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent); overflow-x: auto; }

/* data tables */
.data { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.data + .data { margin-top: 28px; }
.data th { font: 10.5px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); text-align: left; font-weight: 400; padding: 0 12px 10px 0; border-bottom: 1px solid var(--line-2); }
.data td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.data td:first-child { color: var(--ink); }
.data th:not(:first-child), .data td:not(:first-child) { text-align: right; font-family: var(--mono); font-size: 13.5px; }
.data tfoot td { border-bottom: 0; color: var(--ink); padding-top: 14px; }
.data tfoot td:last-child { color: var(--accent); font-size: 16px; }
.data strong { color: var(--accent); font-weight: 500; }

/* pipeline diagram */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; counter-reset: p; }
.pipeline li { position: relative; padding: 18px 20px 20px; border: 1px solid var(--line-2); margin-left: -1px; background: var(--bg); }
.pipeline li:not(:last-child)::after { content: ""; position: absolute; right: -7px; top: 26px; width: 12px; height: 12px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); transform: rotate(45deg); background: var(--bg); z-index: 1; }
.pl-n { font: 10.5px var(--mono); color: var(--accent); letter-spacing: 0.06em; }
.pipeline h3 { font-size: 17px; margin: 10px 0 8px; }
.pipeline p { font-size: 13.5px; line-height: 1.5; }
.pipeline--5 { grid-template-columns: repeat(5, 1fr); }
.tag-warn, .tag-alarm { font: 10px var(--mono); letter-spacing: 0.06em; padding: 2px 6px; border-radius: 2px; white-space: nowrap; }
.tag-warn { background: var(--warn); color: #000; }
.tag-alarm { background: var(--alarm); color: #fff; }

/* state machine */
.fsm { display: flex; align-items: stretch; gap: 0; }
.fsm-node { flex: 1; border: 1px solid var(--line-2); padding: 16px; display: flex; flex-direction: column; gap: 6px; border-radius: 3px; background: var(--bg); }
.fsm-node span { font: 10.5px var(--mono); color: var(--ink-3); }
.fsm-node b { color: var(--ink); font-weight: 500; font-size: 17px; }
.fsm-node small { font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.fsm-node--hot { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.fsm-node--hot b { color: var(--accent); }
.fsm-edge { flex: 0 0 96px; position: relative; display: flex; align-items: center; justify-content: center; text-align: center; font: 10px/1.35 var(--mono); letter-spacing: 0.04em; color: var(--ink-3); padding: 0 6px 22px; }
.fsm-edge::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 50%; transform: translateY(14px); height: 1px; background: var(--accent); }
.fsm-edge::before { content: ""; position: absolute; right: 6px; bottom: 50%; transform: translateY(17.5px) rotate(45deg); width: 7px; height: 7px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); }
.fsm-foot { margin-top: 16px; font-size: 13px; color: var(--ink-3); }

.case-nav { display: grid; grid-template-columns: 1fr 1fr; margin-top: clamp(96px, 12vw, 180px); border-top: 1px solid var(--line-2); }
.case-nav a { display: grid; gap: 10px; padding: 32px 0 48px; transition: color 0.3s; }
.case-nav a span { color: var(--ink-3); }
.case-nav a b { font-size: clamp(22px, 2.8vw, 40px); font-weight: 400; letter-spacing: -0.035em; color: var(--ink-2); transition: color 0.3s; line-height: 1.1; }
.case-nav a:hover b { color: var(--ink); }
.case-nav a:hover span { color: var(--accent); }
.case-nav-next { text-align: right; padding-left: 24px !important; border-left: 1px solid var(--line); }
.case-nav-prev { padding-right: 24px !important; }

.nf { padding-top: 30vh; min-height: 80vh; }
.nf h1 { font-size: clamp(48px, 8vw, 120px); letter-spacing: -0.05em; margin: 16px 0; }
.nf a { color: var(--accent); }

/* lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; }
.lightbox::backdrop { background: rgba(5, 6, 7, 0.92); backdrop-filter: blur(6px); }
.lightbox[open] { display: grid; place-items: center; align-content: center; gap: 14px; }
.lightbox img { max-width: min(94vw, 1600px); max-height: 84vh; width: auto; background: var(--paper); border-radius: 3px; }
.lightbox-cap { color: var(--ink-2); font-size: 14px; max-width: 80ch; text-align: center; padding: 0 16px; }
.lightbox-close { position: fixed; top: 16px; right: 16px; font: 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); border: 1px solid var(--line-2); padding: 8px 12px; border-radius: 999px; background: rgba(10,11,13,0.6); }

/* reveal */
.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .nav-links a { padding: 8px 8px; }
  .nav-cta .btn--ghost { display: none; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills { grid-template-columns: repeat(3, 1fr); row-gap: 36px; }
  .vol { grid-template-columns: repeat(2, 1fr); }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .pipeline li:nth-child(2)::after { display: none; }
  .pipeline--5 li:nth-child(4)::after { display: none; }
  .pipeline li:nth-child(n+3) { margin-top: -1px; }
}

@media (max-width: 860px) {
  :root { --nav-h: 58px; }
  .nav-toggle { display: block; }
  .nav-cta { display: none; }
  .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0; height: calc(100dvh - var(--nav-h));
    flex-direction: column; gap: 0; padding: 16px var(--pad) 32px;
    background: var(--bg); border-top: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.3s, transform 0.4s var(--ease), visibility 0.3s;
  }
  .nav.is-open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav.is-open { background: var(--bg); }
  .nav-links a { font-size: 30px; letter-spacing: -0.03em; color: var(--ink); padding: 14px 0; border-bottom: 1px solid var(--line); border-radius: 0; gap: 14px; }
  .nav-links a span { font-size: 11px; }
  .nav-menu-only { display: flex !important; }

  .hero-main { grid-template-columns: 1fr; }
  .hero--media { min-height: 0; }
  .hero--media .hero-media { bottom: auto; height: min(74svh, 620px); }
  .hero--media .hero-main { margin-top: 0; padding-top: min(40svh, 330px); }
  .hero-media::after {
    background: linear-gradient(180deg, rgba(10, 11, 13, 0.6) 0%, rgba(10, 11, 13, 0.1) 30%, rgba(10, 11, 13, 0.45) 66%, var(--bg) 100%);
  }
  .hero-credit { text-align: left; }
  .hero-name { font-size: clamp(64px, 19vw, 150px); }
  .hero-side { padding-bottom: 0; }
  .hero-meta .status { margin-left: 0; }
  .hide-sm { display: none; }
  .traj-head { padding: 10px 12px; }
  .traj-title { display: none; }
  .traj-replay { margin-left: auto; }
  .traj-read { grid-template-columns: repeat(3, 1fr); }
  .traj-read > div { padding: 10px 12px; }
  .traj-read > div:nth-child(4) { border-left: 0; }
  .traj-read > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }

  .sec-head, .pubs { grid-template-columns: 1fr; }
  .sec-idx { padding-top: 12px; }
  .rcard, .rcard--flip { grid-template-columns: 1fr; }
  .rcard--flip .rcard-media { order: 0; }


  .xp > li { grid-template-columns: 1fr; gap: 8px; }
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 420px; }
  .lead { grid-template-columns: 1fr; gap: 40px; }
  .skills { grid-template-columns: repeat(2, 1fr); }

  .case-intro { grid-template-columns: 1fr; }
  .case-nums { grid-template-columns: repeat(2, 1fr); }
  .case-nums > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .case-nums > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .case-body { grid-template-columns: 1fr; }
  .case-toc { display: none; }
  .fig--half, .fig--third { grid-column: span 12; }
  .fig--quarter { grid-column: span 6; }
  .fsm { flex-direction: column; }
  .fsm-edge { flex: 0 0 auto; padding: 14px 0 14px 28px; justify-content: flex-start; text-align: left; }
  .fsm-edge::after { left: 14px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; transform: none; }
  .fsm-edge::before { left: 10.5px; right: auto; top: auto; bottom: 1px; transform: rotate(135deg); }
  .case-nav { grid-template-columns: 1fr; }
  .case-nav-next { text-align: left; padding-left: 0 !important; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .pgrid { grid-template-columns: minmax(0, 1fr); }
  .xp-logo { height: 60px; margin-top: 14px; } /* minmax: the one-line card meta must not widen the column */
  .pipeline { grid-template-columns: 1fr; }
  .pipeline li { margin-left: 0; margin-top: -1px; }
  .pipeline li::after { display: none; }
  .skills { grid-template-columns: 1fr; }
  .vol { grid-template-columns: 1fr; }
  .langs { grid-template-columns: 1fr; }
  .langs > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
  .rcard-nums { grid-template-columns: 1fr; }
  .rcard-nums > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-bottom: 12px; }
  .rcard-nums > div { padding-bottom: 12px; }
  .data { font-size: 13px; }
  .data th, .data td { padding-right: 8px; }
  .data td:not(:first-child) { font-size: 12.5px; }
  .stat-v { font-size: 34px; }
}

.is-shot *, .is-shot *::before, .is-shot *::after { transition: none !important; animation: none !important; }
.is-shot [data-reveal] { opacity: 1 !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  html, .jumps-track { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}

@media print {
  body::after, .nav, .preview, .traj-replay { display: none; }
  body { background: #fff; color: #222; }
}
