/* jasx.dev: shared styles.
   Dark theme: the palette of the Star Trails photograph, a near-black blue sky, starlight and one warm amber.
   Light theme: the same sky printed as a negative on a pale plate, with night-blue ink. */

@font-face { font-family: 'Newsreader'; src: url('/assets/fonts/newsreader.woff2') format('woff2'); font-style: normal; font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/assets/fonts/newsreader-italic.woff2') format('woff2'); font-style: italic; font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Newsreader Display'; src: url('/assets/fonts/newsreader-display-italic.woff2') format('woff2'); font-style: italic; font-weight: 560; font-display: block; }
@font-face { font-family: 'Instrument Sans'; src: url('/assets/fonts/instrument-sans.woff2') format('woff2'); font-style: normal; font-weight: 400 700; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/assets/fonts/instrument-sans-italic.woff2') format('woff2'); font-style: italic; font-weight: 400 700; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/assets/fonts/jetbrains-mono.woff2') format('woff2'); font-style: normal; font-weight: 100 800; font-display: swap; }
/* Only the Chinese characters the site uses: the note on the portrait and Jason's name (14 KB).
   Changing them means fetching a new subset under a new name; see DESIGN.md. */
@font-face { font-family: 'Noto Serif HK'; src: url('/assets/fonts/noto-serif-hk-2.woff2') format('woff2'); font-style: normal; font-weight: 200 900; font-display: swap; }
/* Until the fonts arrive, system fonts stand in, scaled and given the same line metrics as the
   real ones (measured from the files against the common English letters), so text keeps its
   size and line breaks and nothing jumps when they swap in. */
@font-face { font-family: 'Newsreader Fallback'; src: local('Times New Roman'), local('TimesNewRomanPSMT'); size-adjust: 100.37%; ascent-override: 73.23%; descent-override: 26.4%; line-gap-override: 0%; }
@font-face { font-family: 'Newsreader Fallback'; font-style: italic; src: local('Times New Roman Italic'), local('TimesNewRomanPS-ItalicMT'); size-adjust: 92.28%; ascent-override: 79.65%; descent-override: 28.72%; line-gap-override: 0%; }
@font-face { font-family: 'Instrument Sans Fallback'; src: local('Arial'), local('ArialMT'); size-adjust: 102.36%; ascent-override: 94.77%; descent-override: 24.42%; line-gap-override: 0%; }
@font-face { font-family: 'JetBrains Mono Fallback'; src: local('Courier New'), local('CourierNewPSMT'); size-adjust: 99.98%; ascent-override: 102.02%; descent-override: 30%; line-gap-override: 0%; }

:root {
  --serif: 'Newsreader', 'Newsreader Fallback', 'Times New Roman', Times, serif;
  --display: 'Newsreader Display', 'Newsreader', 'Times New Roman', serif;
  --sans: 'Instrument Sans', 'Instrument Sans Fallback', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* for code, the command line and the 0x6A mark */
  --mono: 'JetBrains Mono', 'JetBrains Mono Fallback', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --cjk: 'Noto Serif HK', 'Noto Serif TC', 'Songti TC', serif;
  /* at least clear of the notch and rounded corners on a phone held sideways */
  --gutter: max(clamp(20px, 5vw, 88px), calc(env(safe-area-inset-left, 0px) + 16px), calc(env(safe-area-inset-right, 0px) + 16px));
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

/* Dark tokens: the default, and anything that stays dark in the light theme
   (the screening room and the full-bleed night photograph). */
:root, .theme-dark {
  color-scheme: dark;
  --bg: #05070c;
  --surface: #0b0f18;
  --plate: #0b0f17;
  --plate-edge: rgba(255, 255, 255, .07);
  --plate-shadow: 0 -30px 80px -40px rgba(0, 0, 0, .95);
  --line: rgba(196, 212, 245, .085);
  --line-2: rgba(196, 212, 245, .18);
  --ink: #eceff5;
  --ink-2: #a9b1c2;
  --ink-3: #828a9c;
  --accent: #f1b56c;
  --star: #bcd3ff;
  --selection: rgba(188, 211, 255, .3);
  --glass-tint: rgba(18, 23, 34, .46);
  --glass-sheen: rgba(255, 255, 255, .085);
  --glass-sheen-low: rgba(255, 255, 255, .02);
  --glass-top: rgba(255, 255, 255, .16);
  --glass-edge: rgba(255, 255, 255, .07);
  --glass-shadow: 0 18px 50px -18px rgba(0, 0, 0, .75);
  --glass-glint: rgba(255, 255, 255, .1);
  --chip: rgba(255, 255, 255, .045);
  --chip-hover: rgba(255, 255, 255, .08);
  --chip-edge: rgba(255, 255, 255, .08);
  --lens: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .04));
  --lens-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 0 0 1px rgba(255, 255, 255, .07), 0 6px 18px -8px rgba(0, 0, 0, .6);
  --frame: #0c1018;
  --frame-bar: #121722;
  --frame-bar-edge: rgba(255, 255, 255, .06);
  --frame-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 50px 90px -40px rgba(0, 0, 0, .9);
  --url: #9ea6b8;
  --url-bg: rgba(255, 255, 255, .05);
  --phone-ring: 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 6px #0b0e15, 0 0 0 7px rgba(255, 255, 255, .09), 0 34px 60px -18px rgba(0, 0, 0, .95);
  --code-bg: #090c13;
  --code-bar: #0f131c;
  --code-edge: rgba(255, 255, 255, .06);
  --code-text: #c3cad8;
  --code-note: #858ea1;
  --c-key: #a9b6ff; --c-type: #8fd0ff; --c-str: #f1b56c; --c-num: #f6cc9c; --c-com: #586174; --c-field: #d6dcea; --c-macro: #c9d7ff; --c-fn: #eef1f7;
  --menu-bg: rgba(5, 7, 12, .9);
  --backdrop: rgba(2, 3, 7, .56);
  --footer-glow: #0b1020;
  --unlit: .17;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f3f6;
  --surface: #e4e7ed;
  --plate: #fbfbfd;
  --plate-edge: rgba(14, 20, 36, .09);
  --plate-shadow: 0 -24px 60px -34px rgba(20, 30, 60, .24);
  --line: rgba(14, 20, 36, .11);
  --line-2: rgba(14, 20, 36, .24);
  --ink: #0b0e16;
  --ink-2: #454d5f;
  --ink-3: #5c6476;
  --accent: #a2570f;
  --star: #2c4a8a;
  --selection: rgba(44, 74, 138, .18);
  --glass-tint: rgba(250, 251, 253, .58);
  --glass-sheen: rgba(255, 255, 255, .7);
  --glass-sheen-low: rgba(255, 255, 255, .25);
  --glass-top: rgba(255, 255, 255, .95);
  --glass-edge: rgba(14, 20, 36, .09);
  --glass-shadow: 0 16px 40px -20px rgba(20, 30, 60, .3);
  --glass-glint: rgba(255, 255, 255, .35);
  --chip: rgba(14, 20, 36, .045);
  --chip-hover: rgba(14, 20, 36, .08);
  --chip-edge: rgba(14, 20, 36, .08);
  --lens: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 255, 255, .7));
  --lens-shadow: inset 0 0 0 1px rgba(14, 20, 36, .07), 0 4px 12px -6px rgba(20, 30, 60, .3);
  --frame: #ffffff;
  --frame-bar: #eceef2;
  --frame-bar-edge: rgba(14, 20, 36, .08);
  --frame-shadow: 0 0 0 1px rgba(14, 20, 36, .1), 0 40px 70px -40px rgba(20, 30, 60, .38);
  --url: #4a5162;
  --url-bg: rgba(14, 20, 36, .05);
  --phone-ring: 0 0 0 1px rgba(14, 20, 36, .18), 0 0 0 6px #ffffff, 0 0 0 7px rgba(14, 20, 36, .12), 0 30px 50px -22px rgba(20, 30, 60, .38);
  --code-bg: #fbfbfc;
  --code-bar: #eef0f4;
  --code-edge: rgba(14, 20, 36, .08);
  --code-text: #2a3142;
  --code-note: #646c7e;
  --c-key: #3949ab; --c-type: #0b6e83; --c-str: #9a520e; --c-num: #a8501a; --c-com: #6e7688; --c-field: #2a3142; --c-macro: #3949ab; --c-fn: #0b0e16;
  --menu-bg: rgba(242, 243, 246, .92);
  --backdrop: rgba(10, 14, 22, .26);
  --footer-glow: #e1e5ee;
  --unlit: .2;
}
.theme-dark { color: var(--ink); }

/* Images that match a theme: project sites shown in their own dark or light theme */
:root:not([data-theme="light"]) .for-light, [data-theme="light"] .for-dark { display: none; }

*, *::before, *::after { box-sizing: border-box; }
/* Keep the scrollbar's space even while search or the menu locks scrolling,
   so nothing (the nav especially) shifts sideways when they open and close. */
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; scrollbar-color: color-mix(in srgb, var(--ink) 22%, var(--bg)) var(--bg); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 400 17px/1.6 var(--sans); font-kerning: normal;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, h4, p, figure, dl, dd, ol, ul, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3 { font-weight: 400; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
img, picture, svg, canvas, video { display: block; max-width: 100%; }
picture img { width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; color: inherit; }
kbd { font: inherit; }
cite { font-style: italic; }
::selection { background: var(--selection); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
main:focus { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 200; left: 16px; top: 12px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; transform: translateY(-160%); transition: transform .3s var(--ease-out); }
.skip-link:focus { transform: none; }
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Type ---------- */
.page-title { font: 360 clamp(56px, 10vw, 168px)/.92 var(--serif); letter-spacing: -.024em; }
.section-title { font: 360 clamp(40px, 5.6vw, 92px)/1 var(--serif); letter-spacing: -.02em; }
.page-lede { max-width: 40ch; font: 400 clamp(18px, 1.4vw, 21px)/1.55 var(--sans); color: var(--ink-2); }
/* Chinese in English text (Jason's name): the Chinese serif, whose characters fill the em, a
   little smaller so they stand about as tall as the English capitals */
[lang|="zh"] { font-family: var(--cjk); }
.prose [lang|="zh"] { font-size: .9em; white-space: nowrap; }
/* titles of photographs, as titles of works are set */
.work-title { font-family: var(--serif); font-style: italic; }
/* small factual notes: camera settings, places, dates */
.details { font-size: 14px; line-height: 1.55; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Links read as links: underlined text, nothing appended. */
.text-link, .prose a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em; text-decoration-color: var(--line-2); transition: text-decoration-color .25s; }
.text-link { font-weight: 500; }
.text-link:hover, .prose a:hover { text-decoration-color: currentColor; }

/* ---------- Glass ----------
   Only for things that float over content: the nav, photo controls, the search panel. */
.glass {
  position: relative;
  background: linear-gradient(180deg, var(--glass-sheen), var(--glass-sheen-low) 46%, var(--glass-sheen-low)), var(--glass-tint);
  -webkit-backdrop-filter: blur(18px) saturate(175%) brightness(1.06);
  backdrop-filter: blur(18px) saturate(175%) brightness(1.06);
  box-shadow: inset 0 1px 0 var(--glass-top), inset 0 0 0 1px var(--glass-edge), var(--glass-shadow);
}
.glass::after {
  /* a soft reflection that follows the pointer, on the glass and under its text */
  content: ''; position: absolute; z-index: -1; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(160px 80px at var(--mx, 30%) var(--my, 0%), var(--glass-glint), transparent 70%);
}
.has-liquid .glass--liquid { -webkit-backdrop-filter: url(#liquid-lens) blur(7px) saturate(180%) brightness(1.08); backdrop-filter: url(#liquid-lens) blur(7px) saturate(180%) brightness(1.08); }

/* ---------- Navigation ---------- */
.nav { --scrim: var(--bg); position: fixed; z-index: 60; top: max(14px, env(safe-area-inset-top)); left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; }
/* Once the page moves, a soft fade along the top edge, so text scrolling up past the pill
   doesn't run sharp into it or show in the gap above it. */
.nav::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: calc(84px + env(safe-area-inset-top)); pointer-events: none; background: linear-gradient(var(--scrim), color-mix(in srgb, var(--scrim) 72%, transparent) 38%, transparent); opacity: 0; transition: opacity .5s var(--ease-out); }
.nav.is-scrolled::before { opacity: 1; }
.nav.is-over-dark { --scrim: #05070c; }
/* over a dark section (the screening room, the night photograph) the nav turns dark too */
[data-theme="light"] .nav.is-over-dark {
  color-scheme: dark; --ink: #eceff5; --ink-2: #a9b1c2; --line-2: rgba(196, 212, 245, .18); --accent: #f1b56c;
  --glass-tint: rgba(18, 23, 34, .46); --glass-sheen: rgba(255, 255, 255, .085); --glass-sheen-low: rgba(255, 255, 255, .02); --glass-top: rgba(255, 255, 255, .16); --glass-edge: rgba(255, 255, 255, .07); --glass-shadow: 0 18px 50px -18px rgba(0, 0, 0, .75); --glass-glint: rgba(255, 255, 255, .1);
  --chip: rgba(255, 255, 255, .045); --chip-hover: rgba(255, 255, 255, .08); --chip-edge: rgba(255, 255, 255, .08);
  --lens: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .04)); --lens-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 0 0 1px rgba(255, 255, 255, .07), 0 6px 18px -8px rgba(0, 0, 0, .6);
}
.nav-pill { pointer-events: auto; display: flex; align-items: center; height: 46px; padding: 0 5px; border-radius: 999px; color: var(--ink); transform: translateX(var(--shift, 0px)); transition: transform .6s var(--ease-out), opacity .6s var(--ease-out); }
.js .page-home .nav-pill { opacity: 0; visibility: hidden; transform: translate(var(--shift, 0px), -14px); }
.js .page-home.is-intro-done .nav-pill, .js .page-home .nav.is-shown .nav-pill { opacity: 1; visibility: visible; transform: translateX(var(--shift, 0px)); }
.nav-home { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 16px 0 0; border-radius: 999px; }
.nav-mark { --j-x: 1.75px; position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--chip); box-shadow: inset 0 0 0 1px var(--chip-edge), inset 0 1px 0 var(--glass-top); }
.nav-mark span { grid-area: 1 / 1; transition: transform .55s var(--ease-out), opacity .4s; }
/* the italic j and the hex are centred by their ink, not their font box */
.nav-mark span:first-child { font: italic 420 22px/1 var(--serif); transform: translate(var(--j-x, 0px), var(--j-y, 0px)); }
/* the hex is trimmed to its capitals, so the circle centres the letters themselves; Firefox
   can't trim text yet and sets this font about .07em low, so it is lifted by that instead */
.nav-mark span:last-child { font: 600 11px/1 var(--mono); letter-spacing: .02em; color: var(--accent); text-box: trim-both cap alphabetic; transform: translate(var(--hex-x, 0px), calc(var(--hex-y, 0px) + 1.5em)); opacity: 0; }
@supports not (text-box: trim-both cap alphabetic) { .nav-mark { --hex-y: -.07em; } }
.nav-home:hover .nav-mark span:first-child, .nav-home:focus-visible .nav-mark span:first-child { transform: translate(var(--j-x, 0px), calc(var(--j-y, 0px) - 150%)); opacity: 0; }
.nav-home:hover .nav-mark span:last-child, .nav-home:focus-visible .nav-mark span:last-child { transform: translate(var(--hex-x, 0px), var(--hex-y, 0px)); opacity: 1; }
/* the name is centred on its capitals, like the links beside it */
.nav-name { font: 420 19px/1 var(--serif); letter-spacing: -.005em; white-space: nowrap; text-box: trim-both cap alphabetic; transform: translateY(.03em); }
@supports not (text-box: trim-both cap alphabetic) { .nav-name { transform: translateY(.087em); } }
.nav-rule { width: 1px; height: 20px; margin: 0 5px 0 1px; background: var(--line-2); transition: opacity .4s, width .6s var(--ease-out), margin .6s var(--ease-out); }
.nav-links { position: relative; display: flex; align-items: center; overflow: hidden; max-width: var(--links-w, 520px); transition: max-width .6s var(--ease-out), opacity .45s var(--ease-out); }
.nav-link { position: relative; z-index: 1; display: inline-flex; align-items: center; height: 36px; padding: 0 15px; border-radius: 999px; white-space: nowrap; font: 500 14px/1 var(--sans); color: var(--ink-2); transition: color .3s; }
.nav-link:hover, .nav-link[aria-current] { color: var(--ink); }
.nav-link:focus-visible { outline-offset: -2px; }
.nav-lens {
  position: absolute; z-index: 0; top: 0; bottom: 0; left: 0; width: var(--w, 0px); border-radius: 999px;
  transform: translateX(var(--x, 0px)) scaleX(var(--sx, 1)); transform-origin: center; opacity: var(--o, 0);
  background: var(--lens); box-shadow: var(--lens-shadow); transition: opacity .3s;
}
.nav-cmd, .nav-theme { display: inline-flex; align-items: center; justify-content: center; height: 36px; border-radius: 999px; color: var(--ink-2); background: var(--chip); box-shadow: inset 0 0 0 1px var(--chip-edge); transition: color .3s, background .3s; }
.nav-cmd:hover, .nav-theme:hover { color: var(--ink); background: var(--chip-hover); }
.nav-cmd { justify-content: flex-start; gap: 8px; width: var(--cmd-w, auto); max-width: 140px; margin-left: 4px; padding: 0 13px 0 11px; font: 500 13px/1 var(--sans); white-space: nowrap; overflow: hidden; transition: color .3s, background .3s, width .6s var(--ease-out), padding .6s var(--ease-out), gap .6s var(--ease-out); }
.nav-cmd .icon { font-size: 15px; }
.nav-cmd kbd { display: inline-block; max-width: 60px; overflow: hidden; white-space: nowrap; transition: opacity .4s, max-width .6s var(--ease-out); }
.nav-theme { width: 36px; margin-left: 4px; }
.nav-theme .icon { font-size: 16px; }
.theme-moon, [data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: block; }
.nav-menu { display: none; align-items: center; gap: 10px; height: 36px; margin-left: 4px; padding: 0 12px 0 14px; border-radius: 999px; font: 500 14px/1 var(--sans); background: var(--chip); box-shadow: inset 0 0 0 1px var(--chip-edge); }
.nav-menu-icon { position: relative; width: 18px; height: 18px; display: grid; place-items: center; }
.nav-menu-icon i { position: absolute; width: 14px; height: 1.5px; border-radius: 2px; background: currentColor; transition: transform .45s var(--ease-out); }
.nav-menu-icon i:first-child { transform: translateY(-3px); }
.nav-menu-icon i:last-child { transform: translateY(3px); }
.nav-menu[aria-expanded="true"] .nav-menu-icon i:first-child { transform: rotate(45deg); }
.nav-menu[aria-expanded="true"] .nav-menu-icon i:last-child { transform: rotate(-45deg); }
/* Compact while reading. Scrolling up, tabbing to a link or resting the mouse on it (is-peek)
   brings the links back; the name and the buttons stay visible, so focus on them doesn't. Everything that changes width shares one duration and easing, so the
   pill's width moves in step with its slide (--shift) and an edge can be held still. */
.nav.is-compact:not(.is-peek):not(:has(.nav-links :focus-visible)) .nav-links { max-width: 0; opacity: 0; }
.nav.is-compact:not(.is-peek):not(:has(.nav-links :focus-visible)) .nav-rule { opacity: 0; width: 0; margin: 0; }
.nav.is-compact:not(.is-peek):not(:has(.nav-links :focus-visible)) .nav-cmd { width: 36px; padding: 0 10.5px; gap: 0; }
.nav.is-compact:not(.is-peek):not(:has(.nav-links :focus-visible)) .nav-cmd kbd { max-width: 0; opacity: 0; }

.menu { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; padding: calc(96px + env(safe-area-inset-top)) var(--gutter) calc(32px + env(safe-area-inset-bottom)); background: var(--menu-bg); -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%); opacity: 0; transition: opacity .45s var(--ease-out); }
.menu[hidden] { display: none; }
.menu.is-open { opacity: 1; }
.menu-inner { display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.menu-links li { overflow: hidden; border-bottom: 1px solid var(--line); }
.menu-links a { display: block; padding: 14px 0; font: 360 clamp(42px, 12vw, 64px)/1.05 var(--serif); letter-spacing: -.02em; transform: translateY(100%); transition: transform .8s var(--ease-out) calc(var(--i) * 55ms + 80ms); }
.menu.is-open .menu-links a { transform: none; }
.menu-links a[aria-current] { color: var(--ink-2); }
.menu-foot { display: flex; flex-direction: column; gap: 12px; font-size: 15px; color: var(--ink-2); }
.menu-foot div { display: flex; gap: 20px; }
.menu-search { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; padding: 6px 0; font: inherit; color: var(--ink); }
.menu-search .icon { font-size: 17px; }

@media (max-width: 820px) {
  .nav-links, .nav-rule, .nav-cmd { display: none; }
  .nav-menu { display: flex; }
  .nav-pill { width: calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); }
  .nav-home { margin-right: auto; padding-right: 8px; }
}

/* ---------- Sections ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 18px 48px; padding: 0 var(--gutter); margin-bottom: clamp(40px, 5.5vw, 84px); }
.section-aside { font-size: 15px; }

.page-hero { padding: clamp(150px, 22vh, 230px) var(--gutter) clamp(60px, 8vw, 110px); }
.page-hero .page-lede { margin-top: clamp(28px, 3.4vw, 46px); }
.page-hero--split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px 64px; }
.page-hero--split .page-lede { margin: 0 0 .6em; }

/* ---------- Competitions and research ---------- */
.award-list { margin: 0 var(--gutter); border-top: 1px solid var(--line); }
.award { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.45fr) minmax(0, 1.25fr) 104px; gap: 10px 32px; align-items: baseline; padding: 26px 0 25px; border-bottom: 1px solid var(--line); }
.award-result { font: 380 clamp(26px, 2.5vw, 40px)/1.08 var(--serif); letter-spacing: -.012em; text-wrap: balance; }
.award-event { font: 500 17px/1.4 var(--sans); }
.award-event a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em; text-decoration-color: var(--line-2); transition: text-decoration-color .25s; }
.award-event a:hover { text-decoration-color: currentColor; }
.award-detail { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.award-date { justify-self: end; font-size: 14px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 980px) {
  .award { grid-template-columns: minmax(0, 1fr) auto; }
  .award-result { grid-column: 1; }
  .award-date { grid-column: 2; grid-row: 1; }
  .award-event, .award-detail { grid-column: 1 / -1; }
}

/* ---------- Project visuals ---------- */
.screens { position: relative; width: 100%; max-width: 100%; min-width: 0; padding: 0 11% 7% 0; }
.browser { position: relative; overflow: hidden; border-radius: 14px; background: var(--frame); box-shadow: var(--frame-shadow); }
.browser-bar { display: flex; align-items: center; justify-content: center; height: 32px; padding: 0 14px; background: var(--frame-bar); border-bottom: 1px solid var(--frame-bar-edge); }
.browser-url { padding: 3px 14px; border-radius: 7px; font: 500 12px/1.3 var(--sans); color: var(--url); background: var(--url-bg); }
.phone { position: absolute; right: 0; bottom: 0; width: 23%; overflow: hidden; border-radius: 22px; background: #000; box-shadow: var(--phone-ring); }
.phone picture { aspect-ratio: 390 / 760; overflow: hidden; }
.phone img { height: 100%; object-fit: cover; object-position: top; }

.terminal, .code-plate { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; border-radius: 14px; background: var(--code-bg); box-shadow: var(--frame-shadow); }
.terminal-bar, .code-bar { display: flex; align-items: center; height: 34px; padding: 0 18px; font: 12px/1 var(--mono); color: var(--ink-3); background: var(--code-bar); border-bottom: 1px solid var(--code-edge); }
.terminal-body { padding: 24px 26px 28px; font: 400 clamp(13px, 1.02vw, 15px)/1.75 var(--mono); }
.t-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .8em; min-height: 1.75em; }
.t-line + .t-line { margin-top: .55em; }
.t-prompt { color: var(--accent); }
.t-cmd { color: var(--ink); white-space: pre; }
.t-note { color: var(--code-note); }
.t-caret { display: inline-block; width: .62em; height: 1.15em; transform: translateY(.18em); background: var(--ink); animation: caret 1.05s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.terminal figcaption, .code-plate figcaption { padding: 12px 18px 14px; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--code-edge); }
.code-plate pre { margin: 0; padding: 22px 26px; overflow: auto; font: 400 clamp(12px, .92vw, 14px)/1.72 var(--mono); color: var(--code-text); tab-size: 4; }
.code-plate pre:focus-visible { outline-offset: -3px; }
.c-key { color: var(--c-key); }
.c-type { color: var(--c-type); }
.c-str { color: var(--c-str); }
.c-num { color: var(--c-num); }
.c-com { color: var(--c-com); font-style: italic; }
.c-field { color: var(--c-field); }
.c-macro { color: var(--c-macro); }
.c-fn { color: var(--c-fn); }
/* the LSW commands type themselves out once */
.terminal.is-armed .t-line { opacity: 0; }
.terminal.is-armed .t-line.is-on { opacity: 1; }
.terminal.is-armed .t-note { opacity: 0; transition: opacity .6s var(--ease-out); }
.terminal.is-armed .t-line.is-done .t-note { opacity: 1; }
.t-line.is-typing .t-cmd::after { content: ''; display: inline-block; width: .62em; height: 1.15em; margin-left: 1px; transform: translateY(.18em); background: var(--ink); }

/* ---------- Research figures (Studyember) ----------
   Drawn like figures in a paper: hairlines, small open circles, serif labels, and the one
   line that matters in amber. */
.fig { width: 100%; max-width: 640px; min-width: 0; margin: 0; }
.fig-art { color: var(--ink); }
.fig-svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig-svg--narrow { display: none; }
.fig-bar { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.fig-edge { stroke: var(--ink-2); stroke-width: 1.3; }
.fig-not { stroke: var(--ink-3); stroke-width: 1.4; stroke-dasharray: 1.5 6; stroke-linecap: round; }
.fig-cross { fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-linecap: round; }
.fig-node { fill: var(--fig-bg, var(--bg)); stroke: var(--ink); stroke-width: 1.6; }
.fig-node--ai { fill: var(--ink); }
.fig-ghost { fill: var(--fig-bg, var(--bg)); stroke: var(--ink-3); stroke-width: 1.3; stroke-dasharray: 2 3; }
.fig-label { font: 400 21px var(--serif); fill: var(--ink); }
.fig-note { font: italic 400 17px var(--serif); fill: var(--ink-2); }
.fig-note--bar { fill: var(--accent); }
.fig-note--muted { fill: var(--ink-3); }
.fig figcaption { max-width: 60ch; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.fig-num { margin-right: .55em; font-weight: 600; color: var(--ink); }
.plate .fig { --fig-bg: var(--plate); }
@media (max-width: 600px) {
  .fig-svg--wide { display: none; }
  .fig-svg--narrow { display: block; }
}

/* ---------- The portrait and its note ----------
   Jason's note on Bruce's photo, in Traditional Chinese. Where the photo sits beside text, the note
   runs top to bottom in the space between them, like an inscription beside a painting, and the
   pages widen that space to --note-w plus room either side. Narrow layouts put it under the photo.
   The line height is fixed, so the stand-in font takes the same room before the real one arrives. */
:root { --note-w: 113px; /* three columns of 16px × 1.75, the credit and the space before it */ --note-gap: clamp(22px, 2vw, 30px); }
.portrait { position: relative; }
.portrait-note { margin-top: 16px; font: 360 15px/1.8 var(--cjk); letter-spacing: .06em; color: var(--ink-2); }
.portrait-note-text > span { display: block; }
.portrait-note-credit { display: block; margin-block-start: 6px; font: 400 12px/1.2 var(--mono); letter-spacing: .04em; color: var(--ink-3); }
@media (min-width: 901px) {
  .portrait-note { position: absolute; top: 0; margin: 0; writing-mode: vertical-rl; font-size: 16px; line-height: 1.75; letter-spacing: .14em; }
  .portrait-note-credit { margin-block-start: 14px; text-align: end; }
}

/* ---------- Footer ---------- */
.footer { position: relative; overflow: hidden; margin-top: clamp(100px, 14vw, 200px); padding: clamp(90px, 11vw, 160px) var(--gutter) max(26px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: radial-gradient(120% 90% at 100% 110%, var(--footer-glow), var(--bg) 62%); }
/* The star trails are a pre-rendered image (tools/render-images.py) rather than the SVG they
   come from: the SVG's 230 paths took the GPU ~55 ms to draw, a visible stutter while
   scrolling. The image is only requested once the footer is near (main.js). */
.footer-sky { position: absolute; inset: 0; pointer-events: none; background: right bottom / cover no-repeat; opacity: .85; -webkit-mask: radial-gradient(120% 95% at 100% 100%, #000 18%, rgba(0, 0, 0, .55) 42%, transparent 72%); mask: radial-gradient(120% 95% at 100% 100%, #000 18%, rgba(0, 0, 0, .55) 42%, transparent 72%); }
/* in the light theme the trails are printed as a negative, like the hero */
/* the file this screen will use, so main.js can fetch it ahead of time */
.footer-sky { --footer-art: url('/assets/footer-trails-1600.webp'); }
@media (min-resolution: 1.31dppx) { .footer-sky { --footer-art: url('/assets/footer-trails-2400.webp'); } }
@media (min-resolution: 1.61dppx) { .footer-sky { --footer-art: url('/assets/footer-trails-3200.webp'); } }
.no-js .footer-sky, .footer.is-near .footer-sky {
  background-image: url('/assets/footer-trails-1600.webp');
  /* the 1600 image is declared at 1.3x so screens at 100–130% scaling use it: faint lines under
     a mask look the same, and it is half the memory of the next size up */
  background-image: image-set(url('/assets/footer-trails-1600.webp') 1.3x, url('/assets/footer-trails-2400.webp') 1.6x, url('/assets/footer-trails-3200.webp') 2x);
}
[data-theme="light"] .footer-sky { filter: invert(1) hue-rotate(180deg); opacity: .6; }
.footer-inner { position: relative; max-width: 1600px; margin: 0 auto; }
.footer-title { font: 340 clamp(64px, 11vw, 190px)/.9 var(--serif); letter-spacing: -.03em; }
.footer-lede { max-width: 38ch; margin-top: clamp(24px, 3vw, 40px); font-size: 17px; color: var(--ink-2); }
.footer-mail { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; margin-top: 22px; }
.footer-email { font: 380 clamp(26px, 3vw, 44px)/1.2 var(--serif); letter-spacing: -.01em; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--line-2); transition: text-decoration-color .25s; }
.footer-email:hover { text-decoration-color: currentColor; }
.copy-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 13px; border-radius: 999px; font: 500 14px/1 var(--sans); color: var(--ink-2); transition: color .3s; }
.copy-btn:hover { color: var(--ink); }
.copy-btn .icon { font-size: 15px; }
.copy-btn [data-copy-label] { min-width: 3.4em; text-align: center; }
.copy-btn .check-icon, .copy-btn.is-copied .copy-icon { display: none; }
.copy-btn.is-copied .check-icon { display: block; color: var(--accent); }
.footer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; margin-top: clamp(70px, 9vw, 120px); padding-top: 30px; border-top: 1px solid var(--line); }
.footer-grid h3 { margin-bottom: 14px; font: 500 14px/1.4 var(--sans); color: var(--ink-3); }
.footer-grid li + li { margin-top: 6px; }
.footer-grid a { color: var(--ink-2); transition: color .3s; }
.footer-grid a:hover { color: var(--ink); }
.footer-clock time { font: 380 40px/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 30px; margin-top: clamp(60px, 8vw, 110px); font-size: 14px; color: var(--ink-3); }
.footer-base p a { color: var(--ink-2); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em; text-decoration-color: var(--line-2); transition: color .3s, text-decoration-color .3s; }
.footer-base p a:hover { color: var(--ink); text-decoration-color: currentColor; }
.footer-hex { font: 500 13px/1 var(--mono); color: var(--ink-3); transition: color .3s; }
.footer-hex span { color: var(--accent); }
.footer-hex:hover { color: var(--ink); }
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:last-child { grid-column: 1 / -1; }
}
/* fingers need taller links than a mouse does */
@media (pointer: coarse) {
  .footer-grid li + li { margin-top: 0; }
  .footer-grid a { display: inline-block; padding: 7px 0; }
  .footer-hex { padding: 10px 0; }
  /* links that stand on their own get a finger-sized hit area, without moving anything */
  .text-link, .footer-email, .footer-base p a, .award-event a, .lost-links a { position: relative; }
  .text-link::after, .footer-email::after, .footer-base p a::after, .award-event a::after, .lost-links a::after { content: ''; position: absolute; inset: -9px -6px; }
}

/* ---------- Search panel ---------- */
.palette { position: fixed; inset: 0; z-index: 120; display: flex; justify-content: center; align-items: flex-start; padding: max(12vh, 70px) 16px 16px; }
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: var(--backdrop); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); opacity: 0; transition: opacity .3s; }
.palette-panel { --glass-tint: color-mix(in srgb, var(--bg) 72%, transparent); width: min(640px, 100%); overflow: hidden; border-radius: 22px; color: var(--ink); opacity: 0; transform: translateY(-10px) scale(.985); transition: opacity .3s var(--ease-out), transform .45s var(--ease-out); }
.palette.is-open .palette-backdrop { opacity: 1; }
.palette.is-open .palette-panel { opacity: 1; transform: none; }
.palette-field { display: flex; align-items: baseline; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); font: 15px/1.4 var(--mono); }
.palette-prompt { color: var(--accent); white-space: nowrap; }
.palette-field input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: none; font: 15px/1.4 var(--mono); color: var(--ink); caret-color: var(--accent); }
.palette-field input::placeholder { color: var(--ink-3); }
/* below 16px, iOS Safari zooms the page when the field takes focus */
@media (pointer: coarse) { .palette-field, .palette-field input { font-size: 16px; } }
.palette-list { max-height: min(52vh, 420px); overflow: auto; padding: 8px; overscroll-behavior: contain; }
.palette-list:empty { display: none; }
.palette-group { padding: 12px 12px 6px; font-size: 13px; color: var(--ink-3); }
.palette-item { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: 12px; cursor: pointer; font-size: 15px; }
.palette-item span:last-child { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item[aria-selected="true"] { background: var(--chip-hover); box-shadow: inset 0 0 0 1px var(--chip-edge); }
.palette-out { padding: 0 20px; font: 13px/1.6 var(--mono); color: var(--star); white-space: pre-wrap; }
.palette-out:not(:empty) { padding: 16px 20px; border-bottom: 1px solid var(--line); }

/* ---------- Page and theme transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .28s var(--ease-in-out) both; }
::view-transition-new(root) { animation: vt-in .45s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
/* a project's name grows into its own page's title, or shrinks back into a list (transitions.js) */
::view-transition-group(project-name) { animation-duration: .75s; animation-timing-function: var(--ease-out); }
::view-transition-old(project-name) { animation: vt-out .3s var(--ease-in-out) both; }
::view-transition-new(project-name) { animation: vt-in .5s var(--ease-out) both; }
/* Switching theme: the new one spreads out in a circle from the switch, like a print coming up
   in the developer, instead of fading (main.js draws the circle). */
.is-theme-shift::view-transition-old(root), .is-theme-shift::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* the page under the circle stays live to the pointer, so a hovered nav doesn't think it was left */
.is-theme-shift::view-transition { pointer-events: none; }

/* ---------- Darkroom: the CTF's hidden page ---------- */
/* Lit only by a red safelight. The print is all but invisible until the lights go on (the
   light theme) or someone looks in the developer tools. */
[data-theme="dark"] .page-darkroom { background: radial-gradient(110% 60% at 50% 0%, rgba(150, 20, 10, .2), transparent 70%) var(--bg); }
.darkroom { min-height: 80vh; padding: clamp(160px, 26vh, 260px) var(--gutter) 40px; }
.darkroom .page-lede { margin-top: 32px; }
.darkroom-print { max-width: 44ch; margin-top: 48px; padding: clamp(24px, 4vw, 48px); border-radius: 3px; background: #0b0809; color: #110c0d; font: 500 clamp(14px, 1.4vw, 18px)/2 var(--mono); letter-spacing: .06em; }
[data-theme="light"] .darkroom-print { background: #f8f3ec; color: #1d1714; box-shadow: 0 30px 60px -34px rgba(60, 30, 10, .4); }
.darkroom-print span { display: block; }
.darkroom-note { max-width: 46ch; margin-top: 32px; color: var(--ink-2); }
.darkroom kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; font: 13px var(--mono); white-space: nowrap; }

/* ---------- 404 ---------- */
.lost { min-height: 80vh; padding: clamp(160px, 26vh, 260px) var(--gutter) 40px; }
.lost .page-lede { margin-top: 32px; }
.lost-links { display: flex; flex-wrap: wrap; gap: 14px 32px; margin-top: 40px; }

/* Asked for less see-through glass: keep the shape, lose most of the transparency. */
@media (prefers-reduced-transparency: reduce) {
  .glass, .palette-panel { --glass-tint: color-mix(in srgb, var(--bg) 94%, transparent); }
  .menu { --menu-bg: color-mix(in srgb, var(--bg) 97%, transparent); }
}
/* Windows high contrast: the system picks the colours, so show plain text and drop the effects. */
@media (forced-colors: active) {
  .glass, .menu, .palette-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav::before { display: none; }
  .palette-panel { background: Canvas; border: 1px solid CanvasText; }
  .palette-item[aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0ms !important; }
  ::view-transition-old(root), ::view-transition-new(root), ::view-transition-group(project-name), ::view-transition-old(project-name), ::view-transition-new(project-name) { animation: none; }
}
