/* ==========================================================================
   Brian Yue · portfolio
   One stylesheet for every page. Colors are tokens on :root; dark mode
   follows the system setting.
   ========================================================================== */

:root {
  --paper: #f5f5f2;
  --surface: #ffffff;
  --plate: #ffffff;
  --ink: #141414;
  --ink-2: #55585d;
  --ink-3: #6b6e73;
  --rule: #e0e0db;
  --rule-strong: #141414;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(194, 65, 12, 0.08);
  --chart-bar: #c2410c;
  --mark-tile: #ffffff; --mark-edge: #d3d3ce; --mark-ink: #141414; --mark-dot: #c2410c;  /* header logo: white tile, hairline edge on light pages */
  --dot: rgba(20, 20, 20, 0.16);
  --img-dim: 1;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -12px rgba(0,0,0,.12);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4.5vw, 48px);
  --max: 1240px;
  --radius: 8px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 68px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b0c0d;
    --surface: #141517;
    --plate: #ebebeb;
    --ink: #ededeb;
    --ink-2: #a5a7ab;
    --ink-3: #93969b;
    --rule: #232528;
    --rule-strong: #ededeb;
    --accent: #f08a4b;
    --accent-ink: #140b05;
    --accent-soft: rgba(240, 138, 75, 0.10);
    --chart-bar: #dc6a2c;
    --mark-tile: #f5f5f2; --mark-edge: transparent; --mark-ink: #0b0c0d; --mark-dot: #d4541a;
    --dot: rgba(237, 237, 235, 0.14);
    --img-dim: 0.92;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b0c0d;
  --surface: #141517;
  --plate: #ebebeb;
  --ink: #ededeb;
  --ink-2: #a5a7ab;
  --ink-3: #93969b;
  --rule: #232528;
  --rule-strong: #ededeb;
  --accent: #f08a4b;
  --accent-ink: #140b05;
  --accent-soft: rgba(240, 138, 75, 0.10);
  --chart-bar: #dc6a2c;
  --mark-tile: #f5f5f2; --mark-edge: transparent; --mark-ink: #0b0c0d; --mark-dot: #d4541a;
  --dot: rgba(237, 237, 235, 0.14);
  --img-dim: 0.92;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
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; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.label {
  font: 500 12px/1.5 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.label.accent { color: var(--accent); }
.link {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color .2s ease, background-size .3s var(--ease);
}
.link:hover { color: var(--accent); }

/* pills (buttons, tags) */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 13px/1 var(--sans);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, color .2s ease, transform .2s var(--ease);
}
.pill:hover { border-color: var(--ink); }
.pill.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.theme-btn { padding: 0; width: 37px; height: 37px; justify-content: center; }
.theme-btn svg { width: 16px; height: 16px; }
:root[data-theme="dark"] .theme-btn .i-moon, :root:not([data-theme="dark"]) .theme-btn .i-sun { display: none; }
.pill.solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill .arrow { transition: transform .3s var(--ease); }
.pill:hover .arrow { transform: translateX(3px); }
.pill .hint { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pill.done .hint { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tags li { font: 500 12px/1 var(--mono); letter-spacing: .04em; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 999px; padding: 6px 10px; }

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  transition: transform .45s var(--ease), background-color .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
  view-transition-name: site-header;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom-color: var(--rule);
}
.site-header.hide { transform: translateY(-100%); }
.bar { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand .mark { width: 30px; height: 30px; flex: none; display: block; transition: transform .4s var(--ease); }
.brand:hover .mark { transform: rotate(-6deg); }
.brand .m-bg { fill: var(--mark-tile); stroke: var(--mark-edge); stroke-width: 16; }
.brand .m-fg { fill: var(--mark-ink); }
.brand .m-dot { fill: var(--mark-dot); }
.brand .wm { font-family: var(--sans); font-weight: 600; font-size: 17px; letter-spacing: -0.025em; line-height: 1; }
.navpill {
  display: flex; gap: 2px; padding: 4px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.navpill a {
  font: 500 13.5px/1 var(--sans);
  text-decoration: none; color: var(--ink-2);
  padding: 9px 15px; border-radius: 999px;
  transition: color .2s ease, background-color .2s ease;
}
.navpill a:hover { color: var(--ink); background: var(--accent-soft); }
.navpill a[aria-current="page"] { color: var(--paper); background: var(--ink); }
.navpill .ext { font-size: .85em; margin-left: 2px; }  /* Résumé opens the PDF in a new tab */
.bar-right { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .navpill, .bar-right .pill:not(.menu-btn):not(.theme-btn) { display: none; }
  .menu-btn { display: inline-flex; }
}

/* mobile menu */
.menu {
  position: fixed; inset: 0; z-index: 45;
  background: var(--paper);
  padding: calc(var(--header-h) + 32px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-left, 0px)) 40px;
  display: flex; flex-direction: column; justify-content: space-between;
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease), visibility 0s .35s;
}
.menu.open { opacity: 1; visibility: visible; transition: opacity .35s var(--ease); }
.menu nav { display: flex; flex-direction: column; }
.menu nav a {
  font-size: clamp(2rem, 9vw, 3rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1.15;
  text-decoration: none; padding: 6px 0; border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
  transform: translateY(16px); opacity: 0; transition: transform .5s var(--ease), opacity .5s var(--ease);
}
.menu nav a span { font: 500 12px/1 var(--mono); color: var(--ink-3); letter-spacing: .06em; }
.menu.open nav a { transform: none; opacity: 1; }
.menu .menu-mail { text-decoration: none; }
.menu .menu-mail:hover { color: var(--accent); }
.menu.open nav a:nth-child(2) { transition-delay: .04s; }
.menu.open nav a:nth-child(3) { transition-delay: .08s; }
.menu.open nav a:nth-child(4) { transition-delay: .12s; }
.menu.open nav a:nth-child(5) { transition-delay: .16s; }
.menu.open nav a:nth-child(6) { transition-delay: .2s; }
.menu nav a[aria-current="page"] { color: var(--accent); }
body.menu-open { overflow: hidden; }

/* scroll progress (project pages) */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }

/* ---------- hero (home) ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; padding-top: calc(var(--header-h) + clamp(40px, 7vw, 96px)); padding-bottom: clamp(56px, 8vw, 112px); }
.hero-grid {
  position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 80% 75% at 60% 40%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 75% at 60% 40%, #000 25%, transparent 78%);
}
.xhair { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .4s ease; }
.hero:hover .xhair.live { opacity: 1; }
.xhair .xl, .xhair .yl { position: absolute; background: var(--accent); opacity: .35; }
.xhair .xl { left: 0; right: 0; top: 0; height: 1px; }
.xhair .yl { top: 0; bottom: 0; left: 0; width: 1px; }
.xhair .ro { position: absolute; left: 0; top: 0; font: 500 12px/1 var(--mono); letter-spacing: .06em; color: var(--accent); white-space: nowrap; padding: 8px 0 0 10px; }
@media (hover: none), (pointer: coarse) { .xhair { display: none; } }

.hero-in { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
@media (max-width: 860px) { .hero-in { grid-template-columns: minmax(0, 1fr); } .hero-in .view { max-width: 328px; } }

/* portrait as a drawing view, with registration marks */
.view { position: relative; padding: 14px; margin: -14px; }  /* corner marks sit just outside the photo, so the photo lines up with the page edge */
.view::before, .view::after, .view .reg::before, .view .reg::after { content: ""; position: absolute; width: 16px; height: 16px; border-color: var(--ink-3); border-style: solid; border-width: 0; }
.view::before { left: 0; top: 0; border-left-width: 1px; border-top-width: 1px; }
.view::after { right: 0; top: 0; border-right-width: 1px; border-top-width: 1px; }
.view .reg::before { left: 0; bottom: 0; border-left-width: 1px; border-bottom-width: 1px; }
.view .reg::after { right: 0; bottom: 0; border-right-width: 1px; border-bottom-width: 1px; }
.view .portrait { aspect-ratio: 4 / 5; }
.view figcaption { display: flex; justify-content: space-between; margin-top: 12px; }

.kicker { margin: 0 0 18px; }
.display {
  font-family: var(--sans); font-weight: 500;
  font-size: clamp(2.7rem, 6vw, 5.6rem); line-height: .98; letter-spacing: -0.052em;
  margin: 0 0 clamp(24px, 3.5vw, 36px); text-wrap: balance;
}
.display em { font-weight: 640; font-style: italic; letter-spacing: -0.05em; color: var(--accent); }  /* "make it.": Geist Italic, a touch under bold */
.display em .w { padding-right: .08em; margin-right: -.08em; }  /* keep the italic overhang out of the word-reveal mask */

/* title block, in the format of a drawing's */
.titleblock {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px;
  margin: 0 0 28px; max-width: 640px;
  background: var(--ink); border: 1px solid var(--ink); border-radius: 4px; overflow: hidden;
}
.titleblock > div { padding: 10px 14px 11px; background: var(--paper); grid-column: span 3; }
.titleblock > div.third { grid-column: span 2; }
.titleblock > div.wide { grid-column: 1 / -1; }
.titleblock dt { font: 500 12px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.titleblock dd { margin: 3px 0 0; font-size: 15px; line-height: 1.45; }
.titleblock .wide dd { font-size: clamp(15px, 1.4vw, 17px); }
@media (max-width: 560px) { .titleblock > div.third { grid-column: 1 / -1; } }
@media (max-width: 420px) { .titleblock > div { grid-column: 1 / -1; } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* headline word reveal */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .06em; margin-bottom: -.06em; }
.split .w > span { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  html.js .split .w > span { transform: translateY(105%); animation: rise .9s var(--ease) forwards; animation-delay: calc(var(--i) * 70ms + 120ms); }
  html.js .fade-in { opacity: 0; animation: fadeup .9s var(--ease) forwards; animation-delay: var(--d, .5s); }
}
@keyframes rise { to { transform: none; } }
@keyframes fadeup { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- marquee ---------- */
/* plain text, not links: a fixed label on the left, muted items and separators, no pause on hover */
.marquee { position: relative; border-block: 1px solid var(--rule); overflow: hidden; padding: 16px 0; user-select: none; }
.marquee-label { position: absolute; left: 0; top: 0; bottom: 0; z-index: 1; display: flex; align-items: center; padding: 0 64px 0 var(--gutter);
  font: 500 12.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink);
  background: linear-gradient(90deg, var(--paper) calc(100% - 52px), transparent); }
.marquee-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.marquee ul { display: flex; list-style: none; margin: 0; padding: 0; }
.marquee li { font: 500 12.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 0 18px; white-space: nowrap; display: flex; align-items: center; gap: 36px; }
.marquee li::after { content: "+"; color: var(--ink-3); opacity: .7; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* ---------- sections ---------- */
.section { padding-block: clamp(72px, 10vw, 136px); }
.section + .section { border-top: 1px solid var(--rule); }
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px 32px; margin-bottom: clamp(36px, 5vw, 56px); }
.sec-head h2 {
  font-family: var(--sans); font-weight: 500; font-size: clamp(2.2rem, 4.8vw, 3.9rem); line-height: 1; letter-spacing: -0.048em; margin: 8px 0 0;
}
.sub-head { display: flex; align-items: baseline; gap: 14px; margin: 0 0 22px; }
.sub-head h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.group + .group { margin-top: clamp(56px, 7vw, 88px); }
.sub-head .sub-link { margin-left: auto; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.sub-head .sub-link:hover { color: var(--accent); }
@media (max-width: 560px) { .sub-head:has(.sub-link) .label { display: none; } }
.sw { padding-bottom: clamp(72px, 10vw, 136px); }
.sw .group { scroll-margin-top: 96px; }
.sw .group + .group { border-top: 1px solid var(--rule); padding-top: clamp(40px, 5vw, 64px); }
.sec-head p { margin: 0; color: var(--ink-2); max-width: 44ch; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(40px, 5vw, 64px) clamp(20px, 2.6vw, 36px); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) { .cards.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .cards, .cards.three { grid-template-columns: minmax(0, 1fr); } }
.card > a { display: block; text-decoration: none; }
.media {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: var(--plate);
  border: 1px solid var(--rule);
  isolation: isolate;
}
.cards.three .media { aspect-ratio: 5 / 4; }
.media > img { width: 100%; height: 100%; object-fit: cover; filter: brightness(var(--img-dim)); transition: transform 1s var(--ease); }
.media.contain > img { object-fit: contain; padding: 9%; }
.media.fit > img { object-fit: contain; padding: 3%; }
/* renders and diagrams sit in the same light studio as the 3D viewer */
.media.contain, .media.tint { background: radial-gradient(120% 95% at 50% 28%, #ffffff 0%, #eceef0 55%, #dcdee1 100%); }
.media.contain > img, .media.tint > img { mix-blend-mode: multiply; }
.media.contain > img, .media.tint > img, .media.fit > img { filter: none; }
/* organization tile shown at rest; the work fades in on hover */
.org {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px;
  background: var(--org-bg, var(--ink)); color: var(--org-fg, #fff);
  transition: opacity .6s var(--ease), transform 1s var(--ease);
}
.org .word { font-weight: 700; font-size: clamp(2rem, 4.4vw, 3.4rem); letter-spacing: -0.04em; line-height: .95; }
.org .word.sm { font-size: clamp(1.6rem, 3.2vw, 2.6rem); }
.org .sub { font: 500 12px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .8; max-width: 30ch; }
.org .logo { width: var(--logo-w, 44%); max-height: var(--logo-h, 46%); object-fit: contain; }
.org.has-logo .word { display: none; }
@media (hover: hover) { .card:hover .org.reveal, .card a:focus-visible .org.reveal { opacity: 0; transform: scale(1.03); } }
.card:hover .media > img { transform: scale(1.045); }
.media .go {
  position: absolute; right: 14px; bottom: 14px; z-index: 2;
  font: 500 12.5px/1 var(--sans); color: var(--paper); background: var(--ink);
  padding: 10px 14px; border-radius: 999px; display: inline-flex; gap: 8px; align-items: center;
  opacity: 0; transform: translateY(8px); transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.card:hover .go, .card a:focus-visible .go { opacity: 1; transform: none; }
.media .num { position: absolute; left: 14px; top: 14px; z-index: 2; font: 500 12px/1 var(--mono); letter-spacing: .06em; color: var(--ink-2); background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--rule); border-radius: 999px; padding: 7px 10px; }
.card-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; margin-top: 18px; }
.card-info h3 { font-size: clamp(1.2rem, 1.9vw, 1.5rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; margin: 0; transition: color .2s ease; }
.card:hover h3 { color: var(--accent); }
.card-info .yr { font: 400 12.5px/1.9 var(--mono); color: var(--ink-3); }
.card-info p { grid-column: 1 / -1; margin: 2px 0 12px; font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.card-info .tags { grid-column: 1 / -1; }
.status { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; margin: 6px 0 4px; }
.status span { font: 500 12px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.status span.k { color: var(--ink-2); }
.status span + span::before { content: "/"; margin-right: 6px; color: var(--ink-3); }
.card-info .dates { grid-column: 1 / -1; font: 400 12px/1.5 var(--mono); color: var(--ink-3); margin-bottom: 10px; }

/* typographic media (cards without photos): a graphite plate, like the 3D stage */
.media.type {
  display: flex; flex-direction: column; justify-content: space-between; padding: 22px; color: #f2f2f0; border-color: transparent;
  background: radial-gradient(120% 95% at 50% 30%, #34373c 0%, #1b1c1f 55%, #0e0f11 100%);
}
.media.type .big { font-weight: 500; font-size: clamp(3.2rem, 6.4vw, 5.2rem); letter-spacing: -0.06em; line-height: .9; transition: transform 1s var(--ease); }
.card:hover .media.type .big { transform: scale(1.04); transform-origin: 0 100%; }
.media.type .cap { font: 500 12px/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .72); max-width: 26ch; }

/* about teaser / split */
.split-2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
@media (max-width: 760px) { .split-2 { grid-template-columns: minmax(0, 1fr); } }
.portrait { aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--rule); background: var(--surface); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; filter: brightness(var(--img-dim)); }
.big-text { font-size: clamp(1.4rem, 2.6vw, 2.1rem); line-height: 1.3; letter-spacing: -0.025em; font-weight: 500; margin: 14px 0 28px; }
.big-text span { color: var(--ink-3); }

/* personal strip on home */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.strip a { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--rule); }
.strip img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); filter: brightness(var(--img-dim)); }
.strip a:hover img { transform: scale(1.05); }

/* ---------- footer / contact ---------- */
.site-footer { background: var(--accent); color: var(--accent-ink); padding-top: clamp(72px, 10vw, 128px); margin-top: 0; }
.site-footer .label { color: color-mix(in srgb, var(--accent-ink) 70%, transparent); }
.site-footer ::selection { background: var(--accent-ink); color: var(--accent); }
.site-footer .pill { background: transparent; color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); }
.site-footer .pill:hover { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
.site-footer .pill .hint { color: inherit; opacity: .8; }
.contact-big {
  display: inline-block; font-weight: 600; font-size: clamp(2rem, 7.4vw, 6.4rem); letter-spacing: -0.055em; line-height: 1;
  text-decoration: none; overflow-wrap: anywhere; margin: 18px 0 32px; transition: color .25s ease;
}
.contact-big:hover { opacity: .75; }
.foot-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; margin-top: clamp(64px, 9vw, 112px); padding-block: 24px calc(28px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid color-mix(in srgb, var(--accent-ink) 25%, transparent); font: 400 12px/1.6 var(--mono); color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.foot-bar a { color: inherit; text-decoration: none; }
.foot-bar a:hover { color: var(--accent-ink); text-decoration: underline; }

/* ---------- project page ---------- */
.p-hero { padding-top: calc(var(--header-h) + clamp(40px, 7vw, 88px)); padding-bottom: clamp(32px, 5vw, 56px); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: clamp(36px, 6vw, 72px); }
.p-hero h1 { font-family: var(--sans); font-weight: 500; font-size: clamp(2.5rem, 5.6vw, 4.9rem); line-height: .98; letter-spacing: -0.052em; margin: 14px 0 22px; max-width: 16ch; text-wrap: balance; }
.p-lede { font-size: clamp(1.1rem, 1.9vw, 1.35rem); line-height: 1.5; color: var(--ink-2); max-width: 56ch; margin: 0; }
.p-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 56px; align-items: end; }
.p-org { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; text-align: right; padding-bottom: 4px; }
.p-org .label { max-width: 26ch; color: var(--ink-3); line-height: 1.5; }
.p-org-logo { display: block; width: var(--w); height: var(--h); background: var(--ink); opacity: .62; transition: opacity .3s var(--ease);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: right center; mask-position: right center; }
.p-org:hover .p-org-logo { opacity: .9; }
@media (max-width: 760px) {
  .p-head { grid-template-columns: minmax(0, 1fr); }
  .p-org { order: -1; flex-direction: row; align-items: center; gap: 12px; text-align: left; padding: 0 0 6px; }
  .p-org-logo { height: 26px; width: min(calc(26px * var(--ar)), 132px); -webkit-mask-position: left center; mask-position: left center; }
}
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; margin-top: clamp(36px, 5vw, 56px); border-top: 1px solid var(--rule-strong); }
.meta-grid > div { padding-top: 14px; }
.meta-grid dt { font: 500 12px/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.meta-grid dd { margin: 4px 0 0; font-size: 15px; line-height: 1.45; }
@media (max-width: 760px) { .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; } }

.p-lead { margin-bottom: clamp(48px, 7vw, 88px); }
.p-lead .frame { aspect-ratio: 16 / 9; border-radius: var(--radius); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.stats > div { padding: clamp(22px, 3vw, 36px); border-left: 1px solid var(--rule); background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 18px 18px; }
.stats > div:first-child { border-left: 0; }
.stats .big { font-weight: 600; font-size: clamp(2.8rem, 6vw, 5rem); letter-spacing: -0.06em; line-height: 1; }
.stats .cap { font: 500 12px/1.5 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); margin-top: 14px; }
.stats.nums { margin-bottom: clamp(40px, 6vw, 72px); }
.stats.nums > div:nth-child(3n+1) { border-left: 0; }
.stats.nums > div:nth-child(n+4) { border-top: 1px solid var(--rule); }
.stats.nums .big { font-size: clamp(1.6rem, 4vw, 3.2rem); letter-spacing: -0.045em; white-space: nowrap; }
@media (max-width: 700px) {
  .stats.nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats.nums > div { border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  .stats.nums > div:nth-child(-n+2) { border-top: 0; }
  .stats.nums > div:nth-child(2n+1) { border-left: 0; }
  .stats.nums .big { white-space: normal; }
}
@media (max-width: 700px) { .stats { grid-template-columns: minmax(0, 1fr); } .stats > div { border-left: 0; border-top: 1px solid var(--rule); } .stats > div:first-child { border-top: 0; } }

.p-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
@media (max-width: 960px) { .p-body { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }
.toc { position: sticky; top: calc(var(--header-h) + 28px); }
.toc ol { list-style: none; margin: 14px 0 0; padding: 0; border-left: 1px solid var(--rule); }
.toc a {
  display: flex; gap: 12px; align-items: baseline; text-decoration: none;
  font-size: 14px; color: var(--ink-3); padding: 7px 0 7px 16px; margin-left: -1px;
  border-left: 2px solid transparent; transition: color .2s ease, border-color .2s ease;
}
.toc a span { font: 500 12px/1 var(--mono); }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); border-left-color: var(--accent); }

.glance { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 6px 22px; margin-bottom: clamp(40px, 5vw, 64px); }
.glance dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); column-gap: 28px; }
.glance dl > div { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.glance dt { font: 500 12px/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.glance dd { margin: 4px 0 0; font-size: 14.5px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.glance dd a { color: var(--accent); }

.p-sec { padding-bottom: clamp(44px, 6vw, 72px); }
.p-sec + .p-sec { border-top: 1px solid var(--rule); padding-top: clamp(36px, 5vw, 56px); }
.p-sec h2 { display: flex; gap: 14px; align-items: baseline; font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; margin: 0 0 18px; }
.p-sec h2 .n { font: 500 12px/1 var(--mono); color: var(--accent); letter-spacing: 0; transform: translateY(-4px); }
.prose { max-width: 68ch; }
.prose p { margin: 0 0 16px; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { margin: 0 0 16px; padding-left: 1.2em; }
.prose li { margin: 0 0 8px; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 600; }
.contrib { border-left: 2px solid var(--accent); padding: 4px 0 4px 20px; font-size: 18.5px; line-height: 1.6; }
.next-note { color: var(--ink-2); }
.vtable-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.vtable { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14.5px; line-height: 1.45; }
.vtable th, .vtable td { text-align: left; vertical-align: top; padding: 12px 16px; border-top: 1px solid var(--rule); }
.vtable thead th { border-top: 0; font: 500 12px/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.vtable tbody th { font-weight: 600; }
.vtable .pass { display: inline-block; margin-right: 6px; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 4px 7px; border-radius: 5px; background: rgba(22, 128, 61, .12); color: #15803d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vtable .pass { background: rgba(74, 222, 128, .12); color: #4ade80; } }
:root[data-theme="dark"] .vtable .pass { background: rgba(74, 222, 128, .12); color: #4ade80; }
.vtable .pass.proxy { background: rgba(180, 120, 0, .14); color: #8a5a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vtable .pass.proxy { background: rgba(251, 191, 36, .14); color: #fbbf24; } }
:root[data-theme="dark"] .vtable .pass.proxy { background: rgba(251, 191, 36, .14); color: #fbbf24; }
@media (max-width: 640px) {
  .vtable-wrap { overflow: visible; border: 0; background: none; }
  .vtable { min-width: 0; }
  .vtable thead { display: none; }
  .vtable, .vtable tbody, .vtable tr, .vtable th, .vtable td { display: block; }
  .vtable tr { border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); padding: 6px 0; margin-bottom: 10px; }
  .vtable th, .vtable td { border-top: 0; padding: 6px 16px; }
  .vtable tbody th { font-size: 16px; }
  .vtable td::before { content: attr(data-label); display: block; font: 500 12px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
}
.todo { display: none; }

/* figures */
figure { margin: 0; }
.figs { margin-top: 28px; display: grid; gap: 24px; }
.frame { position: relative; background: var(--plate); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.frame img { width: 100%; height: 100%; object-fit: cover; filter: brightness(var(--img-dim)); }
.frame.contain img { object-fit: contain; }
.frame.pad img { padding: 5%; }
.frame a { display: block; height: 100%; cursor: zoom-in; }
.frame a img { transition: transform .8s var(--ease); }
.frame a:hover img { transform: scale(1.025); }
.frame.is-missing, .media.is-missing, .portrait.is-missing { background: var(--surface); border-style: dashed; display: grid; place-items: center; }
.is-missing img, .is-missing a { display: none; }
.is-missing::after { content: "Add photo: " attr(data-file); font: 400 12px/1.5 var(--mono); color: var(--ink-3); padding: 16px; text-align: center; }
figcaption { font: 400 13px/1.55 var(--mono); color: var(--ink-2); margin-top: 10px; max-width: 72ch; }
figcaption b { font-weight: 500; color: var(--ink); margin-right: 6px; }
.row { display: flex; gap: 16px; align-items: flex-start; }
.row > figure { flex: var(--ar) 1 0%; min-width: 0; }
.row .frame { aspect-ratio: var(--ar); }
@media (max-width: 640px) { .row { flex-direction: column; gap: 24px; } .row > figure { flex: none; width: 100%; } }

.sheets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 760px) { .sheets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sheets a { text-decoration: none; display: block; }
.sheets .frame { aspect-ratio: 11 / 8.5; transition: border-color .2s ease, transform .3s var(--ease); }
.sheets a:hover .frame { border-color: var(--accent); transform: translateY(-3px); }
.sheets .s-t { display: block; font: 500 12px/1.4 var(--mono); margin-top: 9px; }
.sheets .s-d { display: block; font: 400 12px/1.45 var(--mono); color: var(--ink-2); }
.sheets a:hover .s-t { color: var(--accent); }
.sheets-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; padding-top: 14px; border-top: 1px solid var(--rule); }

/* diagram (inline SVG) */
.diagram { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; }
.diagram svg { width: 100%; height: auto; min-width: 680px; }
.diagram .ink { stroke: var(--ink); }
.diagram .fill-ink { fill: var(--ink); }
.diagram .soft { stroke: var(--ink-3); }
.diagram .acc { stroke: var(--accent); }
.diagram .fill-acc-soft { fill: var(--accent-soft); }
.diagram .fill-paper { fill: var(--surface); }
.diagram text { font-family: var(--mono); fill: var(--ink-2); font-size: 21px; }
.diagram .t-title { font-size: 19px; letter-spacing: .08em; fill: var(--ink-3); }
.diagram .t-big { font-family: var(--sans); font-size: 34px; font-weight: 600; fill: var(--ink); letter-spacing: -0.02em; }
.diagram .t-body { font-family: var(--sans); font-size: 23px; fill: var(--ink-2); }
.diagram .t-acc { fill: var(--accent); }

/* next project */
.next { border-top: 1px solid var(--rule); }
.next a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 24px 48px; align-items: center; text-decoration: none; padding-block: clamp(56px, 8vw, 104px); }
.next .t { font-family: var(--sans); font-weight: 500; font-size: clamp(2.1rem, 5vw, 4.2rem); letter-spacing: -0.05em; line-height: 1; margin: 14px 0 0; transition: color .25s ease; }
.next a:hover .t { color: var(--accent); }
.next .media { aspect-ratio: 16 / 10; }
.next a:hover .media img { transform: scale(1.04); }
@media (max-width: 760px) { .next a { grid-template-columns: minmax(0, 1fr); } }

/* ---------- about page ---------- */
.cv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px clamp(32px, 6vw, 96px); }
@media (max-width: 760px) { .cv { grid-template-columns: minmax(0, 1fr); } }
.cv h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); font-weight: 600; letter-spacing: -0.03em; margin: 0 0 16px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); font-size: 15.5px; line-height: 1.45; }
.tl li:first-child { border-top-color: var(--rule-strong); }
.tl .when { font: 400 12.5px/1.7 var(--mono); color: var(--ink-3); }
.tl .sub { display: block; color: var(--ink-2); font-size: 14px; }
.tl a { text-decoration: none; }
.tl a:hover { color: var(--accent); }
.skills dl { margin: 0; }
.skills dl > div { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); }
.skills dl > div:first-child { border-top-color: var(--rule-strong); }
.skills dt { font: 500 12px/1.9 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.skills dd { margin: 0; font-size: 15px; line-height: 1.5; }
@media (max-width: 420px) { .skills dl > div { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* ---------- personal page ---------- */
.ptiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: clamp(48px, 7vw, 96px); }
@media (max-width: 860px) { .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.ptile { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; text-decoration: none; isolation: isolate; border: 1px solid var(--rule); background: var(--ink); color: #fff; }
.ptile-media { position: absolute; inset: 0; z-index: -1; }
.ptile-media img { width: 100%; height: 100%; object-fit: cover; filter: brightness(calc(var(--img-dim) * .92)); transition: transform 1s var(--ease); }
.ptile-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.18) 45%, rgba(0,0,0,0) 70%); }
a.ptile:hover .ptile-media img { transform: scale(1.05); }
.ptile-meta { position: absolute; inset: auto 0 0 0; padding: clamp(14px, 2vw, 22px); display: flex; flex-direction: column; gap: 8px; }
.ptile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ptile .num { font: 500 12px/1 var(--mono); letter-spacing: .08em; opacity: .75; }
.ptile .t { font-family: var(--sans); font-weight: 500; font-size: clamp(1.45rem, 2.4vw, 2rem); line-height: 1.02; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.ptile .n { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; opacity: .8; white-space: nowrap; }
.ptile-icon { position: absolute; left: 50%; top: 40%; width: 46%; transform: translate(-50%, -50%); fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .8s var(--ease), stroke .3s ease; }
a.ptile:hover .ptile-icon { transform: translate(-50%, -50%) rotate(-12deg) scale(1.04); stroke: var(--accent); }
.ptile.type { background: var(--surface); color: var(--ink); }
.ptile.type .ptile-media { background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 18px 18px; }
.ptile.type .ptile-media::after { display: none; }
.ptile.type .n { color: var(--ink-3); opacity: 1; }
div.ptile.type { border-style: dashed; }
a.ptile.type:hover .t { color: var(--accent); }
.pcat { padding-block: clamp(48px, 7vw, 88px); border-top: 1px solid var(--rule); }
.pcat-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px clamp(24px, 5vw, 72px); align-items: end; margin-bottom: clamp(24px, 3.5vw, 40px); }
@media (max-width: 760px) { .pcat-head { grid-template-columns: minmax(0, 1fr); } }
.pcat-head h2 { font-family: var(--sans); font-weight: 500; font-size: clamp(2.2rem, 4.8vw, 3.8rem); line-height: 1; letter-spacing: -0.048em; margin: 8px 0 0; }
.pcat-blurb p { margin: 0 0 16px; color: var(--ink-2); max-width: 56ch; }
.pcat-blurb p:last-child { margin-bottom: 0; }
.pcat-soon { font: 400 13px/1.6 var(--mono); color: var(--ink-3); margin: 0; }
.masonry { display: flex; gap: 16px; align-items: flex-start; }
.masonry .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.masonry figure { margin: 0; }
.masonry .frame img { height: auto; }
.masonry figcaption { display: flex; justify-content: space-between; gap: 12px; }
.masonry figcaption .when { color: var(--ink-3); white-space: nowrap; }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pchips .soon { color: var(--ink-3); border-style: dashed; cursor: default; }
.pchips .soon:hover { border-color: var(--rule); }
.empty { border: 1px dashed var(--rule); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--ink-2); }

/* ---------- reveal on scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js [data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity .55s var(--ease), transform .55s var(--ease); transition-delay: var(--d, 0s); }
  html.js [data-reveal].in { opacity: 1; transform: none; }
}

/* ---------- lightbox ---------- */
dialog.lb { border: 0; padding: 0; margin: auto; width: min(96vw, 1400px); max-height: 94vh; background: transparent; color: #f2f2f0; overflow: visible; }
dialog.lb::backdrop { background: rgba(8, 8, 9, .92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lb-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb img { max-width: 100%; max-height: calc(94vh - 72px); width: auto; height: auto; background: #fff; border-radius: 6px; }
.lb .lb-cap { font: 400 12.5px/1.5 var(--mono); color: #c9cacc; text-align: center; max-width: 80ch; margin: 0; padding: 0 12px; }
.lb-btn { position: fixed; top: max(14px, env(safe-area-inset-top, 0px)); right: 14px; font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #f2f2f0; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 10px 14px; cursor: pointer; }
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; padding: 0; font-size: 18px; letter-spacing: 0; }
.lb-prev { left: 12px; right: auto; }
.lb-next { right: 12px; }

/* ---------- page transitions (Chrome, Edge, Safari 18+) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: vt-out .25s ease both; }
  ::view-transition-new(root) { animation: vt-in .55s var(--ease) both; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
/* Source chart (TTBW): HTML bars, one series in the accent */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.srcchart { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 22px 24px 18px; }
.srcchart figcaption { margin-top: 18px; }
.sc-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px 48px; }
.sc-h { font: 500 12px/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 16px; }
.sc-plot { position: relative; height: 168px; margin: 0 0 0 24px; }
.sc-tick { position: absolute; left: 0; right: 0; bottom: calc(var(--t) / var(--ymax) * 100%); border-top: 1px solid var(--rule); }
.sc-tick:first-child { border-top-color: var(--ink-3); }
.sc-tick em { position: absolute; right: calc(100% + 8px); top: -.65em; font: 400 11px/1.3 var(--mono); font-style: normal; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sc-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.sc-cols > *, .sc-x > * { flex: 1 1 0; min-width: 0; }
.sc-cols > .sc-gap, .sc-x > .sc-gap { flex: 1.4 1 0; }
.sc-col { position: relative; height: 100%; display: flex; justify-content: center; align-items: flex-end; outline: none; cursor: default; }
.sc-col i { display: block; width: min(18px, 64%); height: calc(var(--v) / var(--ymax) * 100%); background: var(--chart-bar); border-radius: 4px 4px 0 0; transition: opacity .15s; }
.sc-v { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--v) / var(--ymax) * 100% + 6px); font: 500 12px/1 var(--mono); color: var(--ink); }
.sc-gap { position: relative; height: 100%; }
.sc-cols > .sc-gap::after { content: "//"; position: absolute; left: 50%; bottom: -.62em; transform: translateX(-50%); padding: 0 2px; background: var(--surface); font: 400 11px/1.2 var(--mono); color: var(--ink-3); letter-spacing: -.1em; }
.sc-cols:hover .sc-col:not(:hover) i, .sc-cols:focus-within .sc-col:not(:focus-visible) i { opacity: .4; }
.sc-col:hover::after, .sc-col:focus-visible::after { content: attr(data-tip); position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--v) / var(--ymax) * 100% + 8px); z-index: 2; pointer-events: none; white-space: nowrap; padding: 6px 8px; border-radius: 4px; background: var(--ink); color: var(--paper); font: 500 12px/1 var(--mono); }
.sc-col.start::after { left: 0; transform: none; }
.sc-col.end::after { left: auto; right: 0; transform: none; }
.sc-col:hover .sc-v, .sc-col:focus-visible .sc-v { visibility: hidden; }
.sc-x { display: flex; margin: 8px 0 0 24px; font: 400 11px/1.3 var(--mono); color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.sc-x > span { white-space: nowrap; }
.sc-rows { display: grid; gap: 4px; }
.sc-row { display: grid; grid-template-columns: minmax(8.5em, 11em) minmax(0, 1fr); align-items: center; gap: 14px; padding: 6px 0; font-size: 14px; }
.sc-k { color: var(--ink-2); line-height: 1.35; }
.sc-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sc-track i { display: block; flex: none; width: calc(var(--v) / var(--tmax) * (100% - 3.5ch)); min-width: 3px; height: 14px; background: var(--chart-bar); border-radius: 0 4px 4px 0; }
.sc-track b { font: 500 13px/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .sc-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } }
.sc-x .minor { visibility: hidden; }
@media (max-width: 560px) { .srcchart { padding: 18px 16px 14px; } }

/* ---------- animated card posters (smaller work) ----------
   Dark stage in the ISS style. Still at rest; on hover (or focus, or on screen on touch devices) assets/site.js runs a small
   physics loop per card (data-anim) and feeds --px/--py (smoothed pointer, -1..1) and --mx/--my (spotlight) here. */
.media.anim { isolation: isolate; container-type: inline-size; }
.a-dark { background: radial-gradient(120% 95% at 50% 30%, #1c1e22 0%, #0b0c0e 72%); }
.anim-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.anim-svg .nc { text-transform: none; }
.a-dark .spot { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .5s var(--ease);
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 40%), rgba(240, 138, 75, .13), rgba(240, 138, 75, 0) 38%); mix-blend-mode: screen; }
.card.mini:hover .a-dark .spot { opacity: 1; }
.a-dark .anim-svg.hud { z-index: 4; pointer-events: none; }
.a-dark .hk { font: 500 14.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; fill: rgba(255, 255, 255, .5);
  paint-order: stroke; stroke: #0d0e10; stroke-width: 4px; stroke-linejoin: round; }
.a-dark .hk .hv { fill: rgba(255, 255, 255, .9); font-variant-numeric: tabular-nums; }
.a-dark .hk.end { text-anchor: end; }
/* parallax: the far layer drifts against the pointer, the near layer a little with it */
.a-dark .par.far { transform: translate(calc(var(--px, 0) * -9px), calc(var(--py, 0) * -7px)); }
.a-dark .par.near { transform: translate(calc(var(--px, 0) * 4px), calc(var(--py, 0) * 3px)); }
.a-dark .par circle[opacity] { fill: #fff; }

/* ISS */
.iss-orbit { fill: none; stroke: rgba(255, 255, 255, .14); stroke-width: 1; stroke-dasharray: 2 6; }
.iss-atm { fill: none; stroke: rgba(240, 138, 75, .45); stroke-width: 1; stroke-dasharray: 3 4; }
.iss-dot { fill: #ededeb; }
.iss-trail line { stroke: #f2f2f0; stroke-linecap: round; }

/* Snap-fit */
.snap .wall, .snap .arm-shape polygon { fill: #24272c; stroke: rgba(255, 255, 255, .62); stroke-width: 1.4; stroke-linejoin: round; }
.snap .cube rect { fill: rgba(255, 255, 255, .05); stroke: rgba(255, 255, 255, .55); stroke-width: 1.4; }
.snap .cube .layers { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 1; }
.snap .snapring { fill: none; stroke: #f08a4b; stroke-width: 2.2; }
.snap .eps { font: 500 13px var(--mono); letter-spacing: .1em; text-transform: uppercase; fill: #f6b380; opacity: .5; }

/* Vanguard */
.a-fly .warp { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.a-fly .ship { position: absolute; inset: 0; z-index: 1; will-change: transform; }
.a-fly .ship img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.a-fly .plume { position: absolute; left: var(--nx); top: calc(var(--ny) - 2.9%); width: 20%; height: 5.8%; z-index: 2;
  transform-origin: 0 50%; transform: rotate(var(--na)) scaleX(0); opacity: 0; mix-blend-mode: screen; pointer-events: none;
  background: radial-gradient(ellipse 100% 50% at 0% 50%, #fff8ee 0%, #ffd7a3 16%, #ff9d52 38%, rgba(240, 110, 40, .35) 58%, rgba(240, 110, 40, 0) 76%); filter: blur(.5px); }
.a-fly .plume::after { content: ""; position: absolute; left: -6%; top: -45%; width: 80%; height: 190%; border-radius: 50%;
  background: radial-gradient(ellipse at 10% 50%, rgba(255, 150, 80, .45), rgba(255, 150, 80, 0) 65%); filter: blur(4px); }

@media print {
  :root, :root[data-theme] { --paper: #fff; --surface: #fff; --ink: #141414; --ink-2: #55585d; --ink-3: #6b6e73; --rule: #e0e0db; --accent: #c2410c; --chart-bar: #c2410c; color-scheme: light; }
  .site-header, .menu, .progress, .toc, dialog, .marquee { display: none !important; }
  html.js [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ---------- lightbox zoom (drawings and figures) ---------- */
.lb img { cursor: zoom-in; }
.lb.no-zoom img { cursor: default; }
dialog.lb.zoomed { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; overflow: auto; background: #fff; }
dialog.lb.zoomed .lb-inner { display: block; }
dialog.lb.zoomed img { max-width: none; max-height: none; width: auto; height: auto; border-radius: 0; cursor: zoom-out; }
dialog.lb.zoomed .lb-cap { display: none; }
dialog.lb.zoomed .lb-btn { background: rgba(20, 20, 20, .78); border-color: transparent; }

/* ---------- present mode: press P before screen sharing ---------- */
html.present body { font-size: 18.5px; }
html.present figcaption { font-size: 14px; }
html.present .label, html.present .meta-grid dt, html.present .glance dt { font-size: 12.5px; color: var(--ink-2); }
html.present .prose, html.present .p-lede { max-width: 72ch; }
html.present .marquee-track, html.present .scroll-cue .line::after { animation: none !important; }
html.present .xhair { display: none !important; }
html.present .media .go { display: none !important; }
html.present [data-reveal], html.present .fade-in, html.present .split .w > span { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
html.present .site-header.hide { transform: none; }
html.present *, html.present *::before, html.present *::after { scroll-behavior: auto; }
.present-toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 80; transform: translate(-50%, 12px);
  font: 500 13px/1.4 var(--sans); color: var(--paper); background: var(--ink); border-radius: 999px; padding: 10px 16px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s var(--ease); white-space: nowrap;
}
.present-toast.show { opacity: 1; transform: translate(-50%, 0); }
.present-toast kbd { font: 500 12px/1 var(--mono); border: 1px solid color-mix(in srgb, var(--paper) 35%, transparent); border-radius: 4px; padding: 2px 5px; margin: 0 2px; }
@media (hover: none), (pointer: coarse) { .present-toast { display: none; } }

/* ---------- 3D models and video: a studio "stage" (light grey in light mode, graphite in dark) ---------- */
.stage {
  --st-bg: radial-gradient(120% 95% at 50% 28%, #ffffff 0%, #ebecee 50%, #d6d8db 100%);
  --st-fg: rgba(20, 20, 22, .7); --st-tick: rgba(20, 20, 22, .55); --st-acc: var(--accent);
  --b-bg: rgba(255, 255, 255, .72); --b-hover: #fff; --b-fg: #161618; --b-bd: rgba(0, 0, 0, .1);
  position: relative; aspect-ratio: var(--ar, 16 / 9); border-radius: var(--radius); overflow: hidden; isolation: isolate;
  color: var(--st-fg); background: var(--st-bg); box-shadow: inset 0 0 0 1px var(--rule);
}
.vid .stage, .stage.dark { --st-acc: #f08a4b;
  --st-bg: radial-gradient(120% 95% at 50% 32%, #3a3d42 0%, #1d1e21 52%, #0e0f11 100%);
  --st-fg: rgba(255, 255, 255, .8); --st-tick: rgba(255, 255, 255, .5);
  --b-bg: rgba(16, 16, 18, .55); --b-hover: rgba(255, 255, 255, .16); --b-fg: #f2f2f0; --b-bd: rgba(255, 255, 255, .18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stage {
  --st-bg: radial-gradient(120% 95% at 50% 32%, #3a3d42 0%, #1d1e21 52%, #0e0f11 100%);
  --st-fg: rgba(255, 255, 255, .8); --st-tick: rgba(255, 255, 255, .5);
  --b-bg: rgba(16, 16, 18, .55); --b-hover: rgba(255, 255, 255, .16); --b-fg: #f2f2f0; --b-bd: rgba(255, 255, 255, .18); } }
:root[data-theme="dark"] .stage {
  --st-bg: radial-gradient(120% 95% at 50% 32%, #3a3d42 0%, #1d1e21 52%, #0e0f11 100%);
  --st-fg: rgba(255, 255, 255, .8); --st-tick: rgba(255, 255, 255, .5);
  --b-bg: rgba(16, 16, 18, .55); --b-hover: rgba(255, 255, 255, .16); --b-fg: #f2f2f0; --b-bd: rgba(255, 255, 255, .18); }
.stage::after { content: ""; position: absolute; inset: 12px; z-index: 1; pointer-events: none;
  --t: linear-gradient(var(--st-tick), var(--st-tick));
  background: var(--t) left top / 14px 1px, var(--t) left top / 1px 14px, var(--t) right top / 14px 1px, var(--t) right top / 1px 14px,
              var(--t) left bottom / 14px 1px, var(--t) left bottom / 1px 14px, var(--t) right bottom / 14px 1px, var(--t) right bottom / 1px 14px;
  background-repeat: no-repeat; }
.stage model-viewer, .stage video, .stage iframe, .stage .fallback { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage model-viewer { --poster-color: transparent; background: transparent; outline: none; }
.stage model-viewer:focus-visible { outline: 2px solid var(--st-acc); outline-offset: -2px; }
.stage .fallback { object-fit: contain; }
model-viewer:defined ~ .fallback { display: none; }
model-viewer:not(:defined) > * { display: none; }  /* hotspots and progress bar wait for the viewer (it loads on approach) */
.stage video { object-fit: cover; background: #000; }
.stage:fullscreen { aspect-ratio: auto; border-radius: 0; }
.stage:fullscreen video { object-fit: contain; }
.stage .bar { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--p, 0) * 100%); background: var(--st-acc); transition: opacity .5s; }
.m3d.is-loaded .bar { opacity: 0; }
.hud { position: absolute; z-index: 2; pointer-events: none; font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--st-fg); }
.hud-tl { left: 22px; top: 22px; }
.hud-bl { left: 22px; bottom: 22px; }
.m3d.is-touched .hud-bl { opacity: 0; transition: opacity .6s; }
.stage .ctl { position: absolute; right: 16px; bottom: 16px; z-index: 3; display: flex; gap: 6px; }
.stage .ctl button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border-radius: 999px; cursor: pointer; color: var(--b-fg);
  border: 1px solid var(--b-bd); background: var(--b-bg); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .2s, color .2s; }
.stage .ctl button:hover { background: var(--b-hover); }
.stage .ctl button:focus-visible, .stage .start:focus-visible { outline: 2px solid var(--st-acc); outline-offset: 2px; }
.stage .ctl button[aria-pressed="true"] { color: var(--st-acc); border-color: color-mix(in srgb, var(--st-acc) 55%, transparent); }
.hs { appearance: none; border: 0; padding: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--st-acc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st-acc) 28%, transparent); cursor: default; transition: opacity .3s; }
.hs span { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); white-space: nowrap; font: 500 12px/1.2 var(--mono); color: #f2f2f0;
  background: rgba(14, 14, 16, .82); border: 1px solid rgba(255, 255, 255, .16); border-radius: 6px; padding: 6px 8px; }
.hs:not([data-visible]) { opacity: 0; }
.vid .start { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0) 45%); }
.vid .start img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.vid .start .ring { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 999px; background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .35s var(--ease), background .35s; }
.vid .start .ring svg { width: 26px; height: 26px; margin-left: 3px; }
.vid .start:hover .ring { transform: scale(1.07); background: rgba(255, 255, 255, .22); }
.vid.is-playing .start, .vid.is-playing > .stage > .hud { display: none; }
.vid.is-playing .stage::after { display: none; }
@media (max-width: 640px) { .hud-tl { left: 16px; top: 16px; } .hud-bl { left: 16px; bottom: 16px; } .stage .ctl { right: 10px; bottom: 10px; } .m3d .ctl [data-act="in"], .m3d .ctl [data-act="out"] { display: none; } }
@media (prefers-reduced-motion: reduce) { .vid .start .ring, .stage .ctl button { transition: none; } }
