/* ──────────────────────────────────────────────────────────────
   fanaticalnerd — design system, v2 "declassified"

   Type    Instrument Serif (display) · Schibsted Grotesk (text) · Martian Mono (metadata)
   Colour  Ink (dark, default) and Paper (light). One accent: signal red.
   Motif   The redaction bar and the 6px square "node".
   ────────────────────────────────────────────────────────────── */

/* ─── Fonts (self-hosted, Latin subset; SIL Open Font License) ─── */
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/instrument-serif-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/instrument-serif-regular.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 300 600;
  font-stretch: 75% 112.5%;
  font-display: swap;
  src: url(/assets/fonts/martian-mono-var.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url(/assets/fonts/schibsted-grotesk-italic-var.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/assets/fonts/schibsted-grotesk-var.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Fallbacks sized to match the web fonts, so nothing shifts when they load (measured against each family) */
@font-face { font-family: 'Instrument Serif Fallback'; src: local('Times New Roman'), local('TimesNewRomanPSMT'); size-adjust: 83.18%; ascent-override: 119.02%; descent-override: 37.27%; line-gap-override: 0%; }
@font-face { font-family: 'Instrument Serif Fallback'; font-style: italic; src: local('Times New Roman Italic'), local('TimesNewRomanPS-ItalicMT'); size-adjust: 83.18%; ascent-override: 119.02%; descent-override: 37.27%; line-gap-override: 0%; }
@font-face { font-family: 'Schibsted Grotesk Fallback'; src: local('Arial'), local('ArialMT'); size-adjust: 104.15%; ascent-override: 94.09%; descent-override: 24.96%; line-gap-override: 0%; }
@font-face { font-family: 'Martian Mono Fallback'; src: local('Courier New'), local('CourierNewPSMT'); size-adjust: 108.32%; ascent-override: 92.32%; descent-override: 18.46%; line-gap-override: 0%; }

/* ─── Tokens ─── */
:root {
  --bg: #0e0d0c;
  --bg-2: #161513;
  --fg: #ece7df;
  --fg-2: #aaa49a;
  --fg-3: #8a847b;
  --line: rgba(236, 231, 223, 0.12);
  --line-2: rgba(236, 231, 223, 0.24);
  --accent: #e0302a;
  --accent-text: #ff5a4e;
  --on-accent: #fff;
  --redact: #ece7df;
  --sel: rgba(224, 48, 42, 0.9);

  --f-display: 'Instrument Serif', 'Instrument Serif Fallback', 'Times New Roman', serif;
  --f-sans: 'Schibsted Grotesk', 'Schibsted Grotesk Fallback', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-mono: 'Martian Mono', 'Martian Mono Fallback', ui-monospace, 'SF Mono', Menlo, monospace;

  --wrap: 1320px;
  --pad: clamp(20px, 4vw, 56px);
  --header-h: 68px;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: dark;
}
[data-theme="paper"] {
  --bg: #f1ede6;
  --bg-2: #e8e3da;
  --fg: #151311;
  --fg-2: #4d4842;
  --fg-3: #67625b;
  --line: rgba(21, 19, 17, 0.14);
  --line-2: rgba(21, 19, 17, 0.28);
  --accent: #d0261f;
  --accent-text: #c0221b;
  --redact: #151311;
  color-scheme: light;
}

/* ─── Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 24px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font-family: var(--f-sans); font-size: 17px; line-height: 1.6; font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; font-kerning: normal;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; }
::selection { background: var(--sel); color: #fff; }
:focus-visible { outline: 1px solid var(--accent-text); outline-offset: 4px; }

.skip { position: absolute; left: var(--pad); top: -80px; z-index: 300; padding: 10px 14px; background: var(--fg); color: var(--bg); font: 500 12px var(--f-mono); }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* ─── Type ─── */
.serif { font-family: var(--f-display); font-weight: 400; letter-spacing: -0.015em; }
.mono, .label { font-family: var(--f-mono); font-stretch: 87.5%; }
em, .it { font-family: var(--f-display); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.d1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(3.1rem, 9.2vw, 9rem); line-height: 0.92; letter-spacing: -0.035em; }
.d2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(2.6rem, 6vw, 5.4rem); line-height: 0.95; letter-spacing: -0.03em; }
.d3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.02; letter-spacing: -0.02em; }
.intro { font-size: clamp(1.1rem, 1.6vw, 1.32rem); line-height: 1.5; color: var(--fg-2); max-width: 46ch; }
.intro strong { color: var(--fg); font-weight: 500; }
.small { font-size: 15px; color: var(--fg-2); }

.label {
  display: inline-flex; align-items: baseline; gap: 10px;
  font-size: 11px; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-3);
}
.label b { font-weight: 400; color: var(--fg); }
.label i { font-style: normal; color: var(--fg-3); }
.node { display: inline-block; width: 6px; height: 6px; background: var(--accent); flex-shrink: 0; transform: translateY(-1px); }

/* Underline that draws in on hover */
.u { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.5s var(--ease); padding-bottom: 1px; }
.u:hover, .u:focus-visible { background-size: 100% 1px; }
.u--on { background-size: 100% 1px; }
.u--on:hover { background-size: 0 1px; background-position: 100% 100%; }

/* ─── Header ─── */
.hdr {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background-color 0.5s var(--ease);
}
.hdr::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line); transform: scaleX(0); transform-origin: left; transition: transform 0.8s var(--ease); }
.hdr.is-scrolled::after { transform: scaleX(1); }
.hdr .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.hdr__progress { position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); z-index: 1; }
@supports (animation-timeline: scroll()) {
  .hdr__progress { animation: progress linear both; animation-timeline: scroll(root); }
  @keyframes progress { to { transform: scaleX(1); } }
}

.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; font-size: 16px; letter-spacing: -0.01em; }
.brand .node { width: 9px; height: 9px; transition: transform 0.6s var(--ease); }
.brand:hover .node { transform: rotate(45deg) scale(0.9); }
.brand small { font: 400 11px var(--f-mono); font-stretch: 87.5%; color: var(--fg-3); letter-spacing: 0.02em; }
@media (max-width: 560px) { .brand small { display: none; } }

.nav { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 34px); }
.nav a, .theme-btn, .menu-btn {
  font: 400 11.5px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--fg-2); transition: color 0.25s;
}
.nav a:hover, .theme-btn:hover, .menu-btn:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); }
.nav a[aria-current="page"]::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 8px; background: var(--accent); transform: translateY(-2px); }
.theme-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 0; }
.theme-btn svg { width: 14px; height: 14px; transition: transform 0.7s var(--ease); }
.theme-btn:hover svg { transform: rotate(180deg); }
.menu-btn { display: none; padding: 10px 0; }

@media (max-width: 960px) {
  .nav .nav__link { display: none; }
  .menu-btn { display: inline-flex; }
}

/* Mobile menu overlay */
.menu {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column;
  background: var(--bg); padding: 0 var(--pad) 32px; overflow-y: auto; overscroll-behavior: contain;
  visibility: hidden; clip-path: inset(0 0 100% 0); transition: clip-path 0.7s var(--ease-in-out), visibility 0s 0.7s;
}
.menu-open .menu { visibility: visible; clip-path: inset(0 0 0 0); transition: clip-path 0.7s var(--ease-in-out); }
.menu__top { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; }
.menu__links { list-style: none; margin-top: 8vh; display: grid; gap: 4px; }
.menu__links a { display: flex; align-items: baseline; gap: 16px; font-family: var(--f-display); font-size: clamp(2rem, min(13vw, 9.5vh), 4.5rem); line-height: 1.05; letter-spacing: -0.03em; }
.menu__links a span { font: 400 11px var(--f-mono); color: var(--fg-3); }
.menu__links li { overflow: hidden; }
.menu__links li > a { transform: translateY(105%); transition: transform 0.8s var(--ease); }
.menu-open .menu__links li > a { transform: none; }
.menu-open .menu__links li:nth-child(2) > a { transition-delay: 0.05s; }
.menu-open .menu__links li:nth-child(3) > a { transition-delay: 0.1s; }
.menu-open .menu__links li:nth-child(4) > a { transition-delay: 0.15s; }
.menu-open .menu__links li:nth-child(5) > a { transition-delay: 0.2s; }
.menu-open .menu__links li:nth-child(6) > a { transition-delay: 0.25s; }
.menu__foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.menu-open { overflow: hidden; }

/* ─── Layout: margin-label sections ─── */
.sec { padding-block: clamp(80px, 12vw, 168px) 0; }
.sec:last-child { padding-bottom: clamp(80px, 12vw, 168px); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 2vw, 32px); }
.sec__head { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: end; padding-bottom: clamp(28px, 4vw, 48px); }
.sec__label { grid-column: 1 / 4; align-self: start; padding-top: 0.6em; }
.sec__title { grid-column: 4 / 11; }
.sec__aside { grid-column: 11 / -1; justify-self: end; }
.sec__body { grid-column: 4 / -1; }
@media (max-width: 900px) {
  .sec__label, .sec__title, .sec__aside, .sec__body { grid-column: 1 / -1; }
  .sec__label { padding: 0 0 18px; }
  .sec__aside { justify-self: start; margin-top: 20px; }
}

/* Hairline that draws itself */
.rule { position: relative; height: 1px; }
.rule::before { content: ''; position: absolute; inset: 0; background: var(--line-2); transform-origin: left; }
.js .rule::before { transform: scaleX(0); transition: transform 1.4s var(--ease); }
.js .rule.is-in::before { transform: scaleX(1); }

/* ─── Index (list rows) ─── */
.index { list-style: none; border-top: 1px solid var(--line); }
.index > li { border-bottom: 1px solid var(--line); }
.row {
  position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto 28px; gap: 8px 24px; align-items: baseline;
  padding: clamp(20px, 2.6vw, 30px) 0;
}
.row__n { font: 400 11px var(--f-mono); font-stretch: 87.5%; color: var(--fg-3); transition: color 0.3s; }
.row__t { font-family: var(--f-display); font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.05; letter-spacing: -0.02em; transition: transform 0.7s var(--ease); }
.row__d { grid-column: 2 / 3; color: var(--fg-2); font-size: 15.5px; max-width: 62ch; margin-top: 4px; }
.row__m { font: 400 11px var(--f-mono); font-stretch: 87.5%; letter-spacing: 0.02em; text-transform: uppercase; color: var(--fg-3); text-align: right; white-space: nowrap; }
.row__a { width: 22px; height: 22px; align-self: center; grid-row: 1 / span 2; grid-column: 4; color: var(--fg-3); }
.row__a .ic-stroke { stroke-dasharray: 40; stroke-dashoffset: 0; }
a.row:hover .row__n, a.row:focus-visible .row__n { color: var(--accent-text); }
a.row:hover .row__t, a.row:focus-visible .row__t { transform: translateX(14px); }
a.row:hover .row__a { color: var(--fg); }
a.row:hover .row__a .ic-stroke { animation: draw 0.7s var(--ease); }
@keyframes draw { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 0; } }
.row--compact .row__t { font-size: clamp(1.35rem, 2.2vw, 1.75rem); }
@media (max-width: 640px) {
  .row { grid-template-columns: 34px minmax(0, 1fr) 22px; }
  .row__m { grid-column: 2; grid-row: 3; text-align: left; margin-top: 6px; }
  .row__a { grid-column: 3; }
  .row__d { grid-column: 2; }
}

/* Inline list separated by slashes */
.slashes { display: inline-flex; flex-wrap: wrap; gap: 0 10px; list-style: none; }
.slashes li + li::before { content: '/'; margin-right: 10px; color: var(--fg-3); }

/* ─── Buttons ─── */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 22px; overflow: hidden; isolation: isolate;
  font: 400 11.5px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--fg); border: 1px solid var(--line-2); transition: color 0.45s var(--ease), border-color 0.45s;
}
.btn::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--fg); transform: translateY(101%); transition: transform 0.55s var(--ease); }
.btn:hover { color: var(--bg); border-color: var(--fg); }
.btn:hover::before { transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn--solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--solid::before { background: var(--accent); }
.btn--solid:hover { color: var(--on-accent); border-color: var(--accent); }
.btn--sm { height: 38px; padding: 0 16px; }
.btn[disabled] { opacity: 0.5; cursor: wait; }

/* ─── Masthead (inner pages) ─── */
.mast { padding-block: clamp(56px, 9vw, 128px) clamp(40px, 6vw, 80px); }
.mast__crumb { grid-column: 1 / 4; padding-top: 0.7em; }
.mast__title { grid-column: 4 / -1; }
.mast__intro { grid-column: 4 / 11; margin-top: clamp(20px, 3vw, 36px); }
.mast__tools { grid-column: 4 / -1; margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
@media (max-width: 900px) {
  .mast__crumb, .mast__title, .mast__intro, .mast__tools { grid-column: 1 / -1; }
  .mast__crumb { padding: 0 0 20px; }
}

/* ─── Form fields ─── */
.field { display: grid; gap: 10px; }
.field > span { font: 400 11px var(--f-mono); font-stretch: 87.5%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-3); }
.input {
  width: 100%; height: 48px; padding: 0 16px;
  background: transparent; border: 1px solid var(--line-2); border-radius: 0;
  font-size: 15.5px; color: var(--fg); transition: border-color 0.3s, background-color 0.3s;
}
.input::placeholder { color: var(--fg-3); }
.input:hover { border-color: var(--fg-3); }
.input:focus { outline: none; border-color: var(--fg); background: var(--bg-2); }
textarea.input { height: auto; min-height: 260px; padding: 14px 16px; font: 400 12.5px/1.7 var(--f-mono); resize: vertical; }
select.input { appearance: none; padding-right: 40px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(-45deg, transparent 50%, var(--fg-3) 50%); background-size: 5px 5px; background-position: right 22px center, right 17px center; background-repeat: no-repeat; }
select.input option { background: var(--bg); color: var(--fg); }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 16px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.search-field .input { padding-left: 44px; }

/* Status: a square that blinks while busy */
.status { display: inline-flex; align-items: center; gap: 10px; font: 400 11px var(--f-mono); font-stretch: 87.5%; letter-spacing: 0.03em; text-transform: uppercase; color: var(--fg-3); }
.status::before { content: ''; width: 6px; height: 6px; background: #4ade80; }
.status--busy::before { background: var(--accent); animation: blink 0.9s steps(1) infinite; }
.status--off::before { background: var(--fg-3); }
@keyframes blink { 50% { opacity: 0; } }

/* Skeleton */
.skel { height: 12px; background: linear-gradient(90deg, var(--line) 0%, var(--line-2) 50%, var(--line) 100%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Empty / notice box */
.note-box { padding: 40px 24px; border: 1px dashed var(--line-2); color: var(--fg-2); text-align: center; }

/* ─── Redaction ─── */
.redact { position: relative; display: inline-block; white-space: nowrap; }
.redact::after {
  content: ''; position: absolute; left: -0.06em; right: -0.06em; top: 0.12em; bottom: 0.02em;
  background: var(--redact); transform-origin: right; pointer-events: none;
}
.redact--live::after { animation: declassify 0.9s steps(7, end) forwards; animation-delay: var(--delay, 1.4s); }
@keyframes declassify { to { transform: scaleX(0); } }
.redact--hover::after { transition: transform 0.6s steps(6, end); }
.redact--hover:hover::after, .redact--hover:focus-within::after { transform: scaleX(0); }

/* ─── Split-word reveal ─── */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 0.14em 0.08em 0; margin: 0 -0.14em -0.08em 0; }
.w > span { display: inline-block; }
.js [data-split] .w > span { transform: translateY(105%); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i, 0) * 45ms + var(--base, 0ms)); }
.js [data-split].is-in .w > span { transform: translateY(var(--lift, 0px)); }
.js [data-split].is-settled .w > span { transition: transform 0.5s var(--ease); transition-delay: 0s; }

/* Above the fold: start on first paint (CSS only) and never hide content, so the
   headline and portrait count as painted immediately (fast LCP). */
.js :is(.hero, .mast, .nf) [data-split] .w > span { transform: translateY(var(--lift, 0px)); animation: word-rise 1.1s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms + 60ms); }
.js :is(.hero, .mast, .nf) .reveal { opacity: 1; transform: none; transition: none; animation: rise-in 0.9s var(--ease) backwards; animation-delay: var(--d, 0ms); }
@keyframes word-rise { from { transform: translateY(105%); } }
@keyframes rise-in { from { transform: translateY(18px); } }

/* Generic fade-up */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0ms); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ─── Figures ─── */
.fig { display: grid; gap: 12px; }
.fig figcaption { display: flex; justify-content: space-between; gap: 12px; font: 400 11px var(--f-mono); font-stretch: 87.5%; letter-spacing: 0.02em; text-transform: uppercase; color: var(--fg-3); }

/* Scanned image: colour is revealed by a passing scan line */
.scan { position: relative; overflow: hidden; background: #000; }
.scan img { width: 100%; height: 100%; object-fit: cover; }
.scan__base { filter: grayscale(1) contrast(1.15) brightness(0.75); }
.scan__color { position: absolute; inset: 0; clip-path: inset(0 0 0 0); }
.scan::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--accent); box-shadow: 0 0 12px 1px var(--accent); opacity: 0; }
.js .scan__color { clip-path: inset(0 0 100% 0); }
.js .scan.is-in .scan__color { animation: scan-reveal 2.2s var(--ease-in-out) forwards; animation-delay: var(--scan-delay, 0.2s); }
.js .scan.is-in::after { animation: scan-line 2.2s var(--ease-in-out) forwards; animation-delay: var(--scan-delay, 0.2s); }
@keyframes scan-reveal { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes scan-line { 0% { top: 0; opacity: 1; } 96% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
@media (hover: none) {
  .scan:active .scan__color { animation: scan-reveal 1.4s var(--ease-in-out); }
  .scan:active::after { animation: scan-line 1.4s var(--ease-in-out); }
}

/* ─── Icons (custom two-tone set in /assets/icons.svg) ─── */
.ic { width: 24px; height: 24px; flex-shrink: 0; --ic-accent: var(--accent); }
.ic--lg { width: 40px; height: 40px; }

/* ─── Footer ─── */
.ftr { margin-top: auto; border-top: 1px solid var(--line); padding-block: 40px 32px; }
.ftr__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 2vw, 32px); row-gap: 28px; }
.ftr__col { display: grid; gap: 8px; align-content: start; font-size: 15px; }
.ftr__col:nth-child(1) { grid-column: 1 / 4; }
.ftr__col:nth-child(2) { grid-column: 4 / 7; }
.ftr__col:nth-child(3) { grid-column: 7 / 10; }
.ftr__col:nth-child(4) { grid-column: 10 / -1; justify-items: end; text-align: right; }
.ftr__col a { color: var(--fg-2); justify-self: start; transition: color 0.25s; }
.ftr__col:nth-child(4) a { justify-self: end; }
.ftr__col a:hover { color: var(--fg); }
.ftr__base { grid-column: 1 / -1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 28px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .ftr__col:nth-child(n) { grid-column: span 6; justify-items: start; text-align: left; }
  .ftr__col:nth-child(4) a { justify-self: start; }
}

/* ─── Article prose ─── */
.prose { font-size: 18px; line-height: 1.75; color: var(--fg); }
.prose > * + * { margin-top: 1.2em; }
.prose p, .prose li { color: color-mix(in srgb, var(--fg) 86%, var(--bg)); }
.prose h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.9rem, 3vw, 2.4rem); line-height: 1.05; letter-spacing: -0.02em; margin-top: 2em; }
.prose h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; margin-top: 1.7em; }
.prose h4 { font-size: 1.05rem; font-weight: 600; margin-top: 1.6em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.6em; }
.prose a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.prose a:hover { color: var(--accent-text); }
.prose strong { font-weight: 600; color: var(--fg); }
.prose em { font-size: 1.1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.45em; }
.prose ul li::marker { content: '■  '; color: var(--accent); font-size: 0.6em; }
.prose ol li::marker { font: 400 0.7em var(--f-mono); color: var(--fg-3); }
.prose blockquote { padding-left: 24px; border-left: 1px solid var(--accent); font-family: var(--f-display); font-size: 1.45em; line-height: 1.3; color: var(--fg); }
.prose blockquote p { color: inherit; }
.prose code { font: 400 0.8em var(--f-mono); padding: 2px 6px; background: var(--bg-2); border: 1px solid var(--line); }
.prose pre { padding: 20px 22px; background: var(--bg-2); border: 1px solid var(--line); overflow-x: auto; }
.prose pre code { padding: 0; border: 0; background: none; font-size: 13px; line-height: 1.7; }
.prose img { border: 1px solid var(--line); cursor: zoom-in; margin-inline: auto; }
.prose hr { border: 0; height: 1px; background: var(--line); margin-block: 2.6em; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { font: 400 11px var(--f-mono); text-transform: uppercase; color: var(--fg-3); }

.lightbox { position: fixed; inset: 0; z-index: 300; display: none; place-items: center; padding: 24px; background: color-mix(in srgb, var(--bg) 94%, transparent); cursor: zoom-out; }
.lightbox.is-open { display: grid; }
.lightbox img { max-width: 100%; max-height: 90vh; }

/* ─── Page transitions ─── */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.35s var(--ease-in-out) both; }
::view-transition-new(root) { animation: vt-in 0.6s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .js [data-split] .w > span, .js .reveal { transform: none; opacity: 1; }
  .js .rule::before { transform: scaleX(1); }
  .js .scan__color { clip-path: none; }
  .redact::after { display: none; }
}

/* ─── Glyphs: inline, animated tool icons (40px grid) ─── */
.glyph { width: 44px; height: 44px; flex-shrink: 0; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: square; stroke-linejoin: miter; }
.glyph * { transform-box: view-box; }
.glyph rect { fill: currentColor; stroke: none; }
.glyph .acc { fill: var(--accent); stroke: none; }
.glyph .acc-s { stroke: var(--accent); }
.glyph .g-fill { fill: var(--accent); stroke: none; opacity: 0.9; clip-path: inset(100% 0 0 0); transition: clip-path 0.9s var(--ease); }
.gh:hover .g-fill, .gh:focus-visible .g-fill { clip-path: inset(0 0 0 0); }
.glyph .g-spin { transform-origin: 20px 20px; transition: transform 1.4s var(--ease); }
.gh:hover .g-spin, .gh:focus-visible .g-spin { transform: rotate(102.86deg); }
.glyph .g-sweep { transform-origin: 6px 34px; }
.gh:hover .g-sweep { animation: g-sweep 1.4s var(--ease-in-out) infinite alternate; }
.gh:hover .g-blip { animation: blink 0.7s steps(1) infinite; }
@keyframes g-sweep { from { transform: rotate(-40deg); } to { transform: rotate(40deg); } }
.glyph .g-ring { transform-origin: 20px 20px; transition: transform 0.9s var(--ease); }
.gh:hover .g-ring { transform: scale(0.68); }
.gh:hover .g-dot { animation: g-dot 0.9s steps(1) infinite; }
.gh:hover .g-dot:nth-of-type(2) { animation-delay: 0.15s; }
.gh:hover .g-dot:nth-of-type(3) { animation-delay: 0.3s; }
@keyframes g-dot { 50% { opacity: 0.15; } }
.glyph .g-line { stroke-dasharray: 12; }
.gh:hover .g-line { animation: g-line 0.7s var(--ease) both; }
.gh:hover .g-line:nth-of-type(4) { animation-delay: 0.12s; }
.gh:hover .g-line:nth-of-type(5) { animation-delay: 0.24s; }
@keyframes g-line { from { stroke-dashoffset: 12; } to { stroke-dashoffset: 0; } }
.glyph .g-s2, .glyph .g-s3 { transition: transform 0.8s var(--ease); }
.gh:hover .g-s2 { transform: translate(1.5px, -1.5px); }
.gh:hover .g-s3 { transform: translate(3px, -3px); }

/* ─── Tool tiles (hairline grid, no boxes) ─── */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.tile { position: relative; display: grid; gap: 14px; align-content: start; padding: 32px 28px 40px 0; border-bottom: 1px solid var(--line); }
.tile:not(:nth-child(3n + 1)) { padding-left: 28px; border-left: 1px solid var(--line); }
.tile__t { font-family: var(--f-display); font-size: clamp(1.6rem, 2.4vw, 2.1rem); line-height: 1.05; letter-spacing: -0.02em; margin-top: 18px; transition: transform 0.7s var(--ease); }
.tile p { font-size: 15.5px; color: var(--fg-2); max-width: 36ch; }
.tile .label { margin-top: 6px; }
.tile::after { content: ''; position: absolute; top: 18px; right: 18px; width: 6px; height: 6px; background: var(--accent); transform: scale(0); transition: transform 0.5s var(--ease); }
.tile:hover::after, .tile:focus-visible::after { transform: scale(1); }
.tile:hover .tile__t { transform: translateX(8px); }
.tiles--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles--2 .tile:not(:nth-child(3n + 1)) { padding-left: 0; border-left: 0; }
.tiles--2 .tile:nth-child(2n) { padding-left: 28px; border-left: 1px solid var(--line); }
@media (max-width: 900px) {
  .tiles, .tiles--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile:nth-child(n) { padding-left: 0; border-left: 0; }
  .tile:nth-child(2n) { padding-left: 24px; border-left: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .tiles, .tiles--2 { grid-template-columns: 1fr; }
  .tile:nth-child(n) { padding-left: 0; border-left: 0; padding-right: 32px; }
}

/* ─── Cursor: a red node inside a trailing reticle that locks onto targets ───
   Only active with a fine pointer and motion allowed (site.js adds .has-cursor). */
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor :is(input, textarea, select, [contenteditable]) { cursor: auto !important; }
html.has-cursor:has(dialog[open]), html.has-cursor:has(dialog[open]) * { cursor: auto !important; }
html:has(dialog[open]) .cur { display: none; }

.cur { position: fixed; inset: 0; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
.cur.is-on { opacity: 1; }
.cur.is-text { opacity: 0; }
.cur__dot, .cur__frame, .cur__label { position: absolute; left: 0; top: 0; will-change: transform; }
.cur__dot::after { content: ''; position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; background: var(--accent); transition: transform 0.45s var(--ease); }
.cur.is-lock .cur__dot::after { transform: rotate(45deg) scale(1.25); }
.cur.is-down .cur__dot::after { transform: scale(0.5); }
.cur__frame { width: 28px; height: 28px; }
.cur__frame i { position: absolute; width: 7px; height: 7px; border: 0 solid var(--fg); opacity: 0.5; transition: border-color 0.3s, opacity 0.3s, width 0.35s var(--ease), height 0.35s var(--ease); }
.cur__frame i:nth-child(1) { left: 0; top: 0; border-left-width: 1px; border-top-width: 1px; }
.cur__frame i:nth-child(2) { right: 0; top: 0; border-right-width: 1px; border-top-width: 1px; }
.cur__frame i:nth-child(3) { left: 0; bottom: 0; border-left-width: 1px; border-bottom-width: 1px; }
.cur__frame i:nth-child(4) { right: 0; bottom: 0; border-right-width: 1px; border-bottom-width: 1px; }
.cur.is-lock .cur__frame i { border-color: var(--accent); opacity: 1; width: 10px; height: 10px; }
.cur.is-down .cur__frame i { width: 4px; height: 4px; }
.cur__label { padding: 5px 8px; background: var(--fg); color: var(--bg); font: 400 10px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; opacity: 0; transition: opacity 0.25s; }
.cur.has-label .cur__label { opacity: 1; }

/* Magnetic elements spring back when released */
.mag { transition: transform 0.6s var(--ease), color 0.45s var(--ease), border-color 0.45s, background-color 0.3s; }

/* 3D tilt */
[data-tilt] { transition: transform 0.6s var(--ease); transform: perspective(600px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }

/* Inspection lens on scanned images */
.scan.is-spot .scan__color { animation: none !important; clip-path: circle(var(--r, 84px) at var(--mx, 50%) var(--my, 50%)); transition: clip-path 0.5s var(--ease); }
.scan.is-spot::after { animation: none !important; opacity: 0; }

/* ─── Touch screens: phones and iPads ─── */
@media (pointer: coarse) {
  /* 44px tap targets without changing the visual rhythm */
  .nav a, .theme-btn, .menu-btn { display: inline-flex; align-items: center; min-height: 44px; }
  .btn--sm { height: 44px; }
  .brand { padding-block: 9px; }
  a.label, .ftr__col a, .toc a, .creds a, .credit a, .menu__foot a { padding-block: 12px; margin-block: -12px; }
  .menu__foot { row-gap: 20px; }
  /* iOS zooms into fields under 16px */
  .input, textarea.input, select.input { font-size: 16px; }
}

/* No hover on touch: avoid sticky hover states, give tap feedback instead */
@media (hover: none) {
  a.row:hover .row__t, .tile:hover .tile__t { transform: none; }
  .tile:hover::after { transform: scale(0); }
  .btn:hover { color: var(--fg); border-color: var(--line-2); }
  .btn:hover::before { transform: translateY(101%); }
  .btn--solid:hover { color: var(--bg); border-color: var(--fg); }
  .btn:active { color: var(--bg); border-color: var(--fg); }
  .btn:active::before { transform: none; transition-duration: 0.15s; }
  .btn--solid:active { color: var(--on-accent); border-color: var(--accent); }
  a.row:active .row__n { color: var(--accent-text); }
  a.row:active .row__t, .tile:active .tile__t { transform: translateX(8px); transition-duration: 0.2s; }
  .tile:active::after { transform: scale(1); }

  /* Tool glyphs play once as they scroll into view */
  .gh.is-in .g-fill { clip-path: inset(0 0 0 0); transition-delay: 0.5s; }
  .gh.is-in .g-spin { transform: rotate(102.86deg); transition-delay: 0.4s; }
  .gh.is-in .g-sweep { animation: g-sweep 1.4s var(--ease-in-out) 0.4s 2 alternate both; }
  .gh.is-in .g-blip { animation: blink 0.7s steps(1) 0.4s 4; }
  .gh.is-in .g-ring { animation: g-ring 1.2s var(--ease) 0.4s both; }
  .gh.is-in .g-dot { animation: g-dot 0.9s steps(1) 0.4s 3; }
  .gh.is-in .g-dot:nth-of-type(2) { animation-delay: 0.55s; }
  .gh.is-in .g-dot:nth-of-type(3) { animation-delay: 0.7s; }
  .gh.is-in .g-line { animation: g-line 0.8s var(--ease) 0.4s both; }
  .gh.is-in .g-line:nth-of-type(4) { animation-delay: 0.52s; }
  .gh.is-in .g-line:nth-of-type(5) { animation-delay: 0.64s; }
  .gh.is-in .g-s2 { transform: translate(1.5px, -1.5px); transition-delay: 0.4s; }
  .gh.is-in .g-s3 { transform: translate(3px, -3px); transition-delay: 0.5s; }
}
@keyframes g-ring { 50% { transform: scale(0.68); } }

/* Horizontal-scroll hint for wide tables on narrow screens */
.scroll-hint { display: none; }
@media (max-width: 700px) { .scroll-hint { display: block; margin-bottom: 14px; } }

/* Short screens (phones in landscape): keep the whole menu in view */
@media (max-height: 520px) { .menu__links { margin-top: 2vh; } .menu__foot { margin-top: 20px; } }
