/*
 * Dikenocracy — site stylesheet.
 * Direction and tokens: DIRECTION.md (repo root). Product facts: PRODUCT.md.
 * Source: website/tools/site.css → built with tools/build_site_css.py into /styles-20261015.css
 * (self-hosted @font-face rules from tools/fonts.generated.css are prepended).
 */

@font-face { font-family: 'Libre Franklin'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/libre-franklin-cyrillic-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Libre Franklin'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/libre-franklin-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Libre Franklin'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/libre-franklin-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Libre Franklin'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/libre-franklin-latin-wght-normal.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: 'Source Serif 4'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-cyrillic-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-greek-wght-normal.woff2) format('woff2'); unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF; }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-latin-wght-normal.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: 'Source Serif 4'; font-style: italic; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-cyrillic-ext-wght-italic.woff2) format('woff2'); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-cyrillic-wght-italic.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-greek-wght-italic.woff2) format('woff2'); unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-latin-ext-wght-italic.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-latin-wght-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; }


/* ─── Tokens ───────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --bg: #eef0f3;
  --surface: #e2e5ea;
  --surface-2: #d5d9e0;
  --line: #b9bfca;            /* tables and form fields only */
  --ink: #0b0c0e;
  --ink-2: #2a2e35;
  --muted: #555c68;
  --accent: #1f2de6;
  --accent-hover: #1520b8;
  --accent-ink: #ffffff;
  --accent-tint: #dfe2fb;
  --night: #0b0c0e;
  --on-night: #eef0f3;
  --on-night-muted: #a7aebb;
  --ok: #1d6b43;
  --warn: #8a5a00;
  --danger: #a3261b;

  --display: 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif;
  --text: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --code: ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace; /* taste-skill-ignore: real code blocks only */

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-ui: clamp(1rem, 0.96rem + 0.1vw, 1.0625rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 2.6vw, 3.75rem);
  --step-display: clamp(2.75rem, 1.4rem + 4.6vw, 6rem);

  --maxw: 1440px;
  --margin: clamp(20px, 3.3vw, 48px);
  --gutter: clamp(16px, 1.7vw, 28px);
  --section: clamp(96px, 12vw, 176px);
  --nav-h: 72px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-ui: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 140ms;
  --t-ui: 200ms;

  /* Legacy names, still used by inline styles of the converter and the Ayalon page */
  --bg-deep: var(--bg);
  --bg-panel: var(--surface);
  --bg-card: #f7f8fa;
  --border: var(--line);
  --border-strong: var(--muted);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-2);
  --text-muted: var(--muted);
  --white: var(--ink);
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --primary-soft: var(--accent-tint);
  --link: var(--accent);
  --link-hover: var(--accent-hover);
  --font-main: var(--text);
  --font-ui: var(--display);
  --font-mono: var(--code); /* taste-skill-ignore: legacy alias, used by code in the converter */
  --gap-xs: 0.5rem;
  --gap-sm: 1rem;
  --gap-md: 2rem;
  --gap-lg: 4rem;
  --gap-xl: 6rem;
}

/* ─── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  scrollbar-color: #9aa1ad var(--bg);
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-body)/1.6 var(--text);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
}
::selection { background: var(--accent); color: var(--accent-ink); }
img, svg, video { max-width: 100%; }
img { display: block; height: auto; }
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
  text-wrap: balance;
}
p, li, dd, blockquote { text-wrap: pretty; }
p { margin: 0; }
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  transition: color var(--t-fast) var(--ease-ui), text-decoration-color var(--t-fast) var(--ease-ui);
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
code, kbd, samp, pre { font-family: var(--code); }
abbr[title] { text-decoration: underline dotted; }
time, .tnum { font-variant-numeric: tabular-nums; }
hr { border: 0; height: 2px; background: var(--surface-2); margin: 3rem 0; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #b4bac4; border: 3px solid var(--bg); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #8f96a2; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--margin); top: -100px; z-index: 200;
  padding: 0.75rem 1.1rem; background: var(--accent); color: var(--accent-ink);
  font: 600 var(--step-ui) var(--display); text-decoration: none;
}
.skip-link:focus { top: 12px; }

.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.16em; }
.icon--back { transform: scaleX(-1); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--margin); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }

/* ─── Buttons and links ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 48px; padding: 0 1.35rem;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 0;
  font: 600 var(--step-ui)/1.2 var(--display);
  text-decoration: none; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-ui), color var(--t-fast) var(--ease-ui), transform 120ms var(--ease-ui);
}
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn:active { transform: scale(0.97); }
.btn .icon { transition: transform var(--t-ui) var(--ease-ui); }
@media (hover: hover) and (pointer: fine) { .btn:hover .icon--arrow { transform: translateX(3px); } }
.btn--ghost {
  background: transparent; color: var(--ink); padding-inline: 0;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.32em;
  text-decoration-color: var(--accent);
}
.btn--ghost:hover { background: transparent; color: var(--accent); }
.btn--light { background: var(--accent-ink); color: var(--accent); }
.btn--light:hover { background: var(--bg); color: var(--accent-hover); }
.btn--night { background: var(--on-night); color: var(--ink); }
.btn--night:hover { background: #ffffff; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.75rem; margin-top: 2rem; }

.more {
  display: inline-flex; align-items: center; gap: 0.5em; min-height: 44px;
  font: 600 var(--step-ui) var(--display); color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.32em; text-decoration-color: var(--accent);
}
.more:hover { color: var(--accent); }
.more .icon { transition: transform var(--t-ui) var(--ease-ui); }
@media (hover: hover) and (pointer: fine) { .more:hover .icon--arrow { transform: translateX(3px); } }

/* ─── Navigation ───────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  font-family: var(--display);
  transition: box-shadow var(--t-ui) var(--ease-ui);
}
.site-nav.is-stuck { box-shadow: 0 8px 24px -16px rgba(11, 12, 14, 0.45); } /* taste-skill-ignore: sticky bar while the page scrolls under it */
.site-nav__inner {
  max-width: var(--maxw); margin-inline: auto; padding-inline: var(--margin);
  min-height: var(--nav-h); display: flex; align-items: center; gap: 2.25rem;
}
.site-nav__brand {
  display: inline-flex; align-items: center; gap: 0.55rem; margin-right: auto;
  min-height: 44px;
  font: 700 1.25rem/1 var(--display); letter-spacing: -0.025em; color: var(--ink); text-decoration: none;
}
.site-nav__brand:hover { color: var(--ink); }
.site-nav__logo { width: 22px; height: 22px; color: var(--ink); }
.site-nav__links { display: flex; align-items: center; gap: 1.9rem; margin: 0; padding: 0; list-style: none; }
.site-nav__links > li { display: flex; align-items: center; }
.site-nav__links a {
  display: inline-flex; align-items: center; min-height: 44px;
  font: 500 var(--step-ui) var(--display); color: var(--ink); text-decoration: none;
  text-decoration-thickness: 2px; text-underline-offset: 0.45em;
}
.site-nav__links a:hover { color: var(--accent); }
.site-nav__links a[aria-current='page'] { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent); }
.site-nav__action {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.05rem;
  background: var(--accent); color: var(--accent-ink);
  font: 600 var(--step-ui) var(--display); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease-ui), transform 120ms var(--ease-ui);
}
.site-nav__action:hover { background: var(--accent-hover); color: var(--accent-ink); }
.site-nav__action:active { transform: scale(0.97); }
.site-nav__has-menu { position: relative; }
.site-nav__parent { display: flex; align-items: center; }
.site-nav__submenu-toggle {
  display: grid; place-items: center; width: 36px; min-height: 44px; padding: 0;
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.site-nav__submenu-toggle:hover { color: var(--accent); }
.site-nav__caret {
  width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--t-ui) var(--ease-ui);
}
.site-nav__submenu-toggle[aria-expanded='true'] .site-nav__caret { transform: translateY(2px) rotate(225deg); }
.site-nav__submenu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 110;
  min-width: 17rem; margin: 0; padding: 0.4rem; list-style: none;
  background: #f7f8fa;
  box-shadow: 0 2px 6px rgba(11, 12, 14, 0.08), 0 18px 42px -12px rgba(11, 12, 14, 0.28); /* taste-skill-ignore: floating menu */
  transform-origin: top right;
  animation: menu-in 160ms var(--ease-out);
}
.site-nav__submenu[hidden] { display: none; }
.site-nav__submenu a { display: flex; width: 100%; padding: 0.7rem 0.85rem; min-height: 44px; }
.site-nav__submenu a:hover { background: var(--surface); color: var(--ink); }
@keyframes menu-in { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }
.site-nav__toggle { display: none; } /* legacy hamburger (Survival build): the links stay visible instead */

@media (max-width: 760px) {
  :root { --nav-h: 60px; }
  .site-nav { position: static; }
  .site-nav__inner { flex-wrap: wrap; gap: 0.5rem; padding-block: 0.6rem 0.75rem; min-height: 0; }
  .site-nav__action { display: none; }
  .site-nav__links { flex-basis: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .site-nav__links > li { display: block; }
  .site-nav__links > li > a, .site-nav__parent {
    display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px;
    background: var(--surface); color: var(--ink);
  }
  .site-nav__parent > a { flex: 1; justify-content: center; min-height: 48px; }
  .site-nav__links > li > a[aria-current='page'], .site-nav__parent:has(a[aria-current='page']) { background: var(--ink); color: var(--on-night); text-decoration: none; }
  .site-nav__parent:has(a[aria-current='page']) a, .site-nav__parent:has(a[aria-current='page']) button { color: var(--on-night); text-decoration: none; }
  .site-nav__has-menu { position: static; }
  .site-nav__submenu { left: var(--margin); right: var(--margin); top: auto; min-width: 0; margin-top: 6px; }
  .site-nav__inner { position: relative; }
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.site-footer { background: var(--night); color: var(--on-night); font-family: var(--display); }
.site-footer a { color: var(--on-night); text-decoration: none; }
.site-footer a:hover { color: #ffffff; text-decoration: underline; text-decoration-color: currentColor; }
.site-footer :focus-visible { outline-color: var(--on-night); }
.site-footer__inner {
  max-width: var(--maxw); margin-inline: auto; padding: clamp(56px, 7vw, 96px) var(--margin) 24px;
  display: flex; flex-direction: column; gap: clamp(48px, 8vw, 120px);
}
.site-footer__cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem var(--gutter); }
.site-footer__title { font: 600 var(--step-ui) var(--display); color: var(--on-night); margin-bottom: 0.9rem; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; margin: 0; padding: 0; list-style: none; font-size: var(--step-ui); }
.site-footer__links a { display: inline-flex; min-height: 36px; align-items: center; color: var(--on-night-muted); }
.site-footer__links a:hover { color: var(--on-night); }
.site-footer__cols .site-footer__links { flex-direction: column; gap: 0.1rem; }
.site-footer__note { font: 400 var(--step-small)/1.5 var(--display); color: var(--on-night-muted); max-width: 34ch; }
.site-footer__brand { display: inline-flex; align-items: center; gap: 0.55rem; font: 700 1.25rem var(--display); letter-spacing: -0.025em; }
.site-footer__brand svg { width: 22px; height: 22px; }
.site-footer__wordmark {
  display: block; font: 700 clamp(3rem, 17vw, 15.5rem)/0.8 var(--display); letter-spacing: -0.05em;
  white-space: nowrap; margin-left: -0.04em; padding-bottom: 0.06em;
}
.site-footer__wordmark:hover { text-decoration: none !important; color: var(--on-night) !important; }
@media (max-width: 760px) {
  .site-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2.25rem; }
  .site-footer__wordmark { font-size: 16.4vw; }
}

/* ─── Shared page head (inner pages) ───────────────────────────────────────── */
.page-head { padding-top: clamp(56px, 8vw, 128px); padding-bottom: clamp(48px, 6vw, 96px); }
.page-head__title { grid-column: 1 / -1; font-size: var(--step-display); line-height: 0.95; letter-spacing: -0.035em; }
.page-head__lead { grid-column: 6 / -1; margin-top: clamp(24px, 3vw, 44px); font-size: var(--step-lead); line-height: 1.4; max-width: 38ch; }
.page-head__note { grid-column: 1 / 5; grid-row: 2; margin-top: clamp(24px, 3vw, 44px); font: 500 var(--step-small)/1.5 var(--display); color: var(--muted); max-width: 30ch; align-self: start; padding-top: 0.45em; }
.page-head__actions { grid-column: 6 / -1; margin-top: 2rem; }
@media (max-width: 900px) {
  .page-head__lead, .page-head__actions, .page-head__note { grid-column: 1 / -1; }
  .page-head__note { grid-row: auto; }
}

/* Section scaffolding used across pages */
.section { padding-top: var(--section); }
.section__title { font-size: var(--step-head); line-height: 1; letter-spacing: -0.03em; margin-bottom: clamp(1rem, 1.6vw, 1.5rem); }
.section__lead { font-size: var(--step-lead); line-height: 1.4; max-width: 40ch; }
.prose { max-width: 66ch; }
.prose > * + * { margin-top: 1.1em; }
.prose h3 { font-size: 1.3rem; letter-spacing: -0.015em; margin-top: 1.8em; }
.axis { grid-column: 6 / -1; }
.side { grid-column: 1 / 5; }
@media (max-width: 900px) { .axis, .side { grid-column: 1 / -1; } }

/* Fields of colour */
.field-cobalt { background: var(--accent); color: var(--accent-ink); }
.field-cobalt :is(h1, h2, h3, h4), .field-night :is(h1, h2, h3, h4) { color: inherit; }
.field-cobalt a:not(.btn) { color: var(--accent-ink); }
.field-cobalt :focus-visible { outline-color: var(--accent-ink); }
.field-night { background: var(--night); color: var(--on-night); }
.field-night :focus-visible { outline-color: var(--on-night); }
.field-surface { background: var(--surface); }

/* Pictures: one duotone treatment, square corners */
.pic { margin: 0; background: var(--surface); overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: cover; }
.pic figcaption, .credit { font: 400 var(--step-small)/1.4 var(--display); color: var(--muted); margin-top: 0.6rem; }

/* ─── Home ─────────────────────────────────────────────────────────────────── */
.masthead__band { height: clamp(180px, 27vh, 340px); background: var(--accent); overflow: hidden; display: grid; grid-template-columns: 3fr 1fr; }
.masthead__band img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 58%; }
.masthead__band img + img { object-position: 50% 40%; }
@media (max-width: 760px) { .masthead__band { grid-template-columns: 1fr; } .masthead__band img + img { display: none; } }
.masthead__body { padding-top: clamp(28px, 3.4vw, 52px); padding-bottom: clamp(56px, 7vw, 112px); row-gap: 0; }
.masthead__title {
  grid-column: 1 / -1;
  font-size: min(var(--step-display), 6.2vw); line-height: 0.95; letter-spacing: -0.035em;
}
.masthead__title .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.masthead__title .line > span { display: inline-block; }
.dateline {
  grid-column: 1 / 5; grid-row: 2; align-self: start; margin-top: clamp(28px, 3vw, 44px); padding-top: 0.35em;
  font: 500 var(--step-small)/1.55 var(--display); color: var(--muted);
}
.dateline a { color: var(--ink); text-decoration: none; }
.dateline a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }
.dateline__dti { color: var(--accent); font-weight: 600; }
.masthead__standfirst { grid-column: 6 / -1; grid-row: 2; margin-top: clamp(24px, 2.6vw, 40px); font-size: var(--step-lead); line-height: 1.4; max-width: 44ch; }
.masthead__actions { grid-column: 6 / -1; grid-row: 3; margin-top: 1.6rem; }

@media (max-width: 900px) {
  .dateline, .masthead__standfirst, .masthead__actions { grid-column: 1 / -1; grid-row: auto; }
  .masthead__title { font-size: clamp(2.6rem, 10.5vw, 4.5rem); }
}
@media (prefers-reduced-motion: no-preference) {
  .masthead__title .line > span { animation: line-rise 760ms var(--ease-out) both; }
  .masthead__title .line:nth-child(2) > span { animation-delay: 90ms; }
  .masthead__standfirst, .masthead__actions, .dateline { animation: fade-up 600ms var(--ease-out) 260ms both; }
}
@keyframes line-rise { from { transform: translateY(105%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }

/* Intro mosaic */
.tiles { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; padding: 8px; }
.tile { position: relative; overflow: hidden; margin: 0; padding: 20px; display: flex; align-items: flex-end; min-height: 34svh; }
.tile--slogan { grid-column: 1 / 9; grid-row: 1 / 3; background: var(--night); color: var(--on-night); }
.tile--slogan p { font: 700 clamp(2.4rem, 6.2vw, 8.25rem)/0.86 var(--display); letter-spacing: -0.04em; text-transform: uppercase; color: var(--on-night); }
.tile--figure { grid-column: 9 / 13; grid-row: 1; background: var(--surface); flex-direction: column; align-items: flex-start; justify-content: flex-end; }
.tile--figure b { display: block; font: 700 clamp(4rem, 1rem + 8vw, 9rem)/0.82 var(--display); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.tile--figure span { display: block; margin-top: 0.6rem; font: 500 var(--step-ui)/1.3 var(--display); }
.tile--pic { grid-column: 9 / 13; grid-row: 2; padding: 0; background: var(--accent); }
.tile--pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile--text { grid-column: 1 / -1; background: var(--bg); padding: clamp(32px, 4vw, 56px) 0 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); min-height: 0; }
.tile--text .tile__body { grid-column: 7 / -1; padding-right: clamp(0px, 2vw, 32px); }
.tile--text .tile__body p { font-size: var(--step-lead); line-height: 1.38; max-width: 40ch; }
.tile--text .tile__body p + p { margin-top: 1em; }
.tile--text .tile__side { grid-column: 1 / 6; align-self: start; padding-left: clamp(12px, 2.6vw, 40px); font: 500 var(--step-small)/1.5 var(--display); color: var(--muted); max-width: 32ch; }
@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; }
  .tile--slogan { grid-column: 1 / -1; grid-row: auto; min-height: 46svh; }
  .tile--slogan p { font-size: 10.5vw; }
  .tile--figure, .tile--pic { grid-column: auto; grid-row: auto; min-height: 0; aspect-ratio: 1; }
  .tile--figure b { font-size: 22vw; }
  .tile--text { grid-column: 1 / -1; display: block; padding: 32px 14px 0; }
  .tile--text .tile__side { padding-left: 0; margin-bottom: 1.2rem; }
}

/* Staircase of statements */
.stair { list-style: none; margin: 0; padding: 0; }
.stair li { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.stair li + li { margin-top: clamp(40px, 4.5vw, 64px); }
.stair__line { font-size: var(--step-head); line-height: 1; letter-spacing: -0.03em; }
.stair li:nth-child(1) > * { grid-column: 1 / -1; }
.stair li:nth-child(2) > * { grid-column: 3 / -1; }
.stair li:nth-child(3) > * { grid-column: 5 / -1; }
.stair li:nth-child(4) > * { grid-column: 7 / -1; }
.stair li:nth-child(4) .stair__line { color: var(--accent); }
.stair__text { margin-top: 12px; max-width: 34ch; font-size: var(--step-body); }
.stair-foot { margin-top: clamp(40px, 5vw, 72px); }
@media (max-width: 760px) {
  .stair li > * { grid-column: 1 / -1 !important; }
  .stair li:nth-child(2) { padding-left: 6vw; }
  .stair li:nth-child(3) { padding-left: 12vw; }
  .stair li:nth-child(4) { padding-left: 18vw; }
  .stair__line { font-size: 8.4vw; }
}

/* The Main Equation, a full cobalt page */
.equation { margin-top: var(--section); padding-block: clamp(72px, 9vw, 140px); }
.equation__title { grid-column: 1 / 6; font-size: var(--step-ui); font-weight: 600; letter-spacing: 0; color: var(--accent-ink); }
.equation__intro { grid-column: 6 / -1; font-size: var(--step-lead); line-height: 1.4; max-width: 36ch; }
.equation__formula {
  grid-column: 1 / -1; margin: clamp(28px, 4vw, 56px) 0 clamp(36px, 5vw, 72px);
  font: 700 clamp(1.7rem, 0.4rem + 5.1vw, 5.6rem)/1.05 var(--display); letter-spacing: -0.03em;
  display: flex; flex-wrap: wrap; column-gap: 0.32em; row-gap: 0.1em;
}
.equation__formula > span { white-space: nowrap; }
.equation__formula sup { font-size: 0.5em; vertical-align: 0; position: relative; top: -0.9em; }
.equation__vars { grid-column: 6 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem var(--gutter); margin: 0; }
.equation__vars div { font: 400 var(--step-ui)/1.5 var(--display); }
.equation__vars dt { font-weight: 700; }
.equation__vars dd { margin: 0.2rem 0 0; color: var(--accent-ink); }
.equation__source { grid-column: 1 / 6; grid-row: 4; align-self: end; font: 500 var(--step-small)/1.5 var(--display); color: var(--accent-ink); max-width: 30ch; }
.equation__actions { grid-column: 6 / -1; margin-top: clamp(32px, 4vw, 56px); }
.copy-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 900px) {
  .equation__title, .equation__intro, .equation__vars, .equation__source, .equation__actions { grid-column: 1 / -1; grid-row: auto; }
  .equation__intro { margin-top: 1rem; }
  .equation__vars { grid-template-columns: 1fr; }
  .equation__source { margin-top: 2rem; }
}

/* Layers: statement, table pushed right */
.layers__title { grid-column: 1 / -1; font-size: var(--step-head); line-height: 0.98; letter-spacing: -0.03em; padding-left: 3vw; max-width: 22ch; }
.layers__pic { grid-column: 1 / 5; grid-row: 2 / 4; align-self: end; margin: 0; }
.layers__pic img { width: 100%; height: auto; }
.layers__name { grid-column: 7 / 8; grid-row: 2; margin-top: 96px; font: 500 var(--step-small) var(--display); color: var(--muted); }
.layers__table { grid-column: 8 / -1; grid-row: 2; margin: 96px 0 0; padding: 0; list-style: none; font-family: var(--display); }
.layers__table li + li { margin-top: 2px; }
.layers__table li.is-group { margin-top: 28px; }
.layers__table a {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto 1.25rem; align-items: center; gap: 0 1rem;
  min-height: 48px; padding: 0.35rem 0.65rem; margin-inline: -0.65rem;
  color: var(--ink); text-decoration: none; font-size: var(--step-ui);
  transition: background-color var(--t-fast) var(--ease-ui);
}
.layers__table a:hover { background: var(--surface); }
.layers__table .k { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.layers__table .n { font-weight: 600; }
.layers__table .v { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.layers__table .icon { color: var(--accent); transition: transform var(--t-ui) var(--ease-ui); }
@media (hover: hover) and (pointer: fine) { .layers__table a:hover .icon { transform: translateX(3px); } }
.layers__table .is-base a .k, .layers__table .is-base a .n { color: var(--accent); }
.layers__foot { grid-column: 8 / -1; grid-row: 3; margin-top: 2rem; }
.layers__rule { font: 500 var(--step-ui)/1.5 var(--display); margin-bottom: 1.5rem; max-width: 40ch; }
@media (max-width: 900px) {
  .layers__title { padding-left: 0; }
  .layers__name { display: none; }
  .layers__table, .layers__foot { grid-column: 1 / -1; grid-row: auto; }
  .layers__table { margin-top: 48px; }
  .layers__pic { grid-column: 4 / -1; grid-row: auto; margin-top: 48px; max-width: 320px; justify-self: end; width: 100%; }
}
@media (max-width: 600px) {
  .layers__table a { grid-template-columns: 3.25rem minmax(0, 1fr) 1.25rem; gap: 0 0.75rem; }
  .layers__table .v { grid-column: 2; grid-row: 2; text-align: left; font-size: var(--step-small); }
  .layers__table .icon { grid-column: 3; grid-row: 1 / 3; }
}

/* Projects: staggered tiles with empty cells */
.work { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px 16px; align-items: start; }
.work__head { grid-column: 3; grid-row: 1; align-self: center; }
.work__head h2 { font-size: var(--step-head); line-height: 0.98; letter-spacing: -0.03em; }
.work__head p { margin-top: 1rem; font-size: var(--step-ui); font-family: var(--display); max-width: 26ch; }
.work__item { display: block; color: var(--ink); text-decoration: none; }
.work__item:hover { color: var(--ink); }
.work__pic { display: grid; place-items: center; background: var(--surface); overflow: hidden; transition: background-color var(--t-ui) var(--ease-ui); }
.work__pic img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .work__item:hover .work__pic img { transform: scale(1.025); } }
.work__item--wide .work__pic { aspect-ratio: 3 / 2; }
.work__item--tall .work__pic { aspect-ratio: 4 / 5; }
.work__item--tall .work__pic img { object-fit: contain; padding: 12%; }
.work__cap { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.75rem; font: 600 var(--step-ui)/1.35 var(--display); overflow-wrap: anywhere; }
.work__cap span { color: var(--muted); font-weight: 500; text-align: right; }
.work__item p { margin-top: 0.35rem; font-size: var(--step-ui); line-height: 1.5; color: var(--ink-2); max-width: 46ch; }
.work__item:nth-of-type(1) { grid-column: 1 / 3; grid-row: 1; }
.work__item:nth-of-type(2) { grid-column: 4; grid-row: 1; }
.work__item:nth-of-type(3) { grid-column: 2; grid-row: 2; }
.work__item:nth-of-type(4) { grid-column: 3; grid-row: 2; }
.work__item:nth-of-type(5) { grid-column: 3 / 5; grid-row: 3; }
@media (max-width: 900px) {
  .work { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 10px; }
  .work__cap { flex-direction: column; gap: 0.1rem; }
  .work__cap span { text-align: left; }
  .work__head { grid-column: 1 / -1; grid-row: auto; }
  .work__item:nth-of-type(n) { grid-column: auto; grid-row: auto; }
  .work__item--wide { grid-column: 1 / -1 !important; }
  .work__item--tall:nth-of-type(4) { grid-column: 2 !important; }
}

/* Open-source facts: wide picture, colour tile, facts */
.source__title { grid-column: 1 / -1; font-size: var(--step-head); line-height: 1; letter-spacing: -0.03em; }
.source__lead { grid-column: 1 / 7; margin-top: 24px; font-size: var(--step-lead); line-height: 1.4; }
.source__pic { grid-column: 1 / 9; margin-top: 72px; position: relative; aspect-ratio: 16 / 10; }
.source__pic img { width: 100%; height: 100%; object-fit: cover; }
.source__note { position: absolute; top: 0; right: 0; width: min(320px, 70%); padding: 20px; background: var(--bg); font: 400 var(--step-ui)/1.5 var(--display); }
.source__tile { grid-column: 9 / -1; margin-top: 72px; align-self: start; aspect-ratio: 3 / 3.2; display: grid; place-items: center; padding: 12%; }
.source__tile img { width: 100%; height: auto; }
.source__facts { grid-column: 9 / -1; margin: 1.5rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem var(--gutter); font-family: var(--display); }
.source__facts dt { font-size: var(--step-small); color: var(--muted); font-weight: 500; }
.source__facts dd { margin: 0.15rem 0 0; font-size: var(--step-ui); font-weight: 600; }
.source__actions { grid-column: 1 / 9; margin-top: 1.75rem; }
@media (max-width: 900px) {
  .source__lead, .source__pic, .source__tile, .source__facts, .source__actions { grid-column: 1 / -1; }
  .source__pic { aspect-ratio: 4 / 3; margin-top: 40px; }
  .source__note { position: static; width: auto; padding: 16px 0 0; background: none; }
  .source__tile { margin-top: 24px; aspect-ratio: 3 / 2; padding: 8%; }
  .source__tile img { max-height: 100%; width: auto; }
}

/* Inverted close */
.close { margin-top: var(--section); min-height: 86svh; display: flex; flex-direction: column; justify-content: space-between; padding-top: clamp(72px, 9vw, 140px); padding-bottom: 40px; }
.close__title { font-size: clamp(3rem, 1rem + 8vw, 9.5rem); line-height: 0.9; letter-spacing: -0.04em; color: var(--on-night); max-width: 11ch; }
.close__row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); align-items: end; margin-top: 64px; }
.close__row p { grid-column: 1 / 6; font-size: var(--step-lead); line-height: 1.4; color: var(--on-night); max-width: 34ch; }
.close__row .btn { grid-column: 10 / -1; justify-self: end; min-height: 56px; }
.close + .site-footer .site-footer__inner { padding-top: 160px; }
@media (max-width: 760px) {
  .close { min-height: 80svh; }
  .close__title { font-size: 11.5vw; }
  .close__row p, .close__row .btn { grid-column: 1 / -1; }
  .close__row .btn { justify-self: stretch; }
}

/* Section entrances (added by site JS only to elements below the fold) */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(16px); }
  .reveal.is-in { opacity: 1; transform: none; transition: opacity 520ms var(--ease-out), transform 520ms var(--ease-out); transition-delay: var(--d, 0ms); }
}

/* ─── Protocols index (explorer) ───────────────────────────────────────────── */
.explorer { padding-bottom: var(--section); }
.explorer__bar {
  position: sticky; top: var(--nav-h); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem;
  padding: 14px 0; background: var(--bg);
}
.explorer__bar[hidden] { display: none; }
.explorer__search { position: relative; flex: 1 1 18rem; max-width: 30rem; }
.explorer__search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.explorer__search input {
  width: 100%; min-height: 48px; padding: 0 1rem 0 2.75rem;
  border: 1.5px solid var(--line); border-radius: 0; background: #f7f8fa; color: var(--ink);
  font: 500 var(--step-ui) var(--display);
  transition: border-color var(--t-fast) var(--ease-ui);
}
.explorer__search input::placeholder { color: var(--muted); }
.explorer__search input:hover { border-color: var(--muted); }
.explorer__search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); } /* taste-skill-ignore: focus ring */
.explorer__search input::-webkit-search-cancel-button { cursor: pointer; }
.explorer__filters { display: flex; flex-wrap: wrap; gap: 4px; }
.explorer__filters button {
  min-width: 44px; min-height: 44px; padding: 0 0.75rem; border: 0; border-radius: 0;
  background: var(--surface); color: var(--ink); font: 600 var(--step-small) var(--display); cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--t-fast) var(--ease-ui), color var(--t-fast) var(--ease-ui), transform 120ms var(--ease-ui);
}
.explorer__filters button:hover { background: var(--surface-2); }
.explorer__filters button:active { transform: scale(0.96); }
.explorer__filters button[aria-pressed='true'] { background: var(--ink); color: var(--on-night); }
.explorer__count { font: 500 var(--step-small) var(--display); color: var(--muted); margin-left: auto; }
.explorer__empty { padding: 3rem 0; font: 500 var(--step-lead) var(--display); }

.layer-group { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); padding-top: clamp(40px, 5vw, 72px); scroll-margin-top: calc(var(--nav-h) + 90px); }
.layer-group[hidden] { display: none; }
.layer-group__head { grid-column: 1 / 5; align-self: start; position: sticky; top: calc(var(--nav-h) + 88px); }
.layer-group__title { font-size: clamp(1.5rem, 1.2rem + 0.9vw, 2.1rem); line-height: 1.05; letter-spacing: -0.025em; }
.layer-group__text { margin-top: 0.75rem; font: 400 var(--step-ui)/1.5 var(--display); color: var(--ink-2); max-width: 34ch; }
.layer-group__count { margin-top: 0.75rem; font: 600 var(--step-small) var(--display); color: var(--accent); }
.proto-list { grid-column: 6 / -1; margin: 0; padding: 0; list-style: none; font-family: var(--display); }
.proto-row[hidden] { display: none; }
.proto-row + .proto-row { margin-top: 2px; }
.proto-row a {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto 1.25rem; align-items: center; gap: 0.25rem 1.25rem;
  min-height: 56px; padding: 0.6rem 0.75rem; margin-inline: -0.75rem;
  color: var(--ink); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease-ui);
}
.proto-row a:hover { background: var(--surface); }
.proto-row__id { font: 700 var(--step-ui)/1.3 var(--display); letter-spacing: -0.005em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.proto-row__title { font: 400 var(--step-ui)/1.4 var(--display); color: var(--ink-2); }
.proto-row__date { font: 500 var(--step-small) var(--display); color: var(--muted); white-space: nowrap; }
.proto-row .icon { color: var(--accent); transition: transform var(--t-ui) var(--ease-ui); }
@media (hover: hover) and (pointer: fine) { .proto-row a:hover .icon { transform: translateX(3px); } }
.proto-row mark { background: var(--accent-tint); color: inherit; padding: 0 1px; }
@media (max-width: 1100px) { .proto-row a { grid-template-columns: minmax(0, 1fr) auto 1.25rem; } .proto-row__title { grid-column: 1; grid-row: 2; } }
@media (max-width: 900px) {
  .layer-group__head { grid-column: 1 / -1; position: static; margin-bottom: 1.25rem; }
  .proto-list { grid-column: 1 / -1; }
  .explorer__count { margin-left: 0; width: 100%; }
}
@media (max-width: 760px) {
  .explorer__bar { position: static; }
  .explorer__search { max-width: none; }
  .proto-row__date { display: none; }
  .proto-row a { grid-template-columns: minmax(0, 1fr) 1.25rem; }
}

.notes { padding-bottom: var(--section); }
.notes__item { grid-column: 6 / -1; }
.notes__item + .notes__item { margin-top: 3rem; }
.notes__item h2 { font-size: clamp(1.5rem, 1.2rem + 0.9vw, 2.1rem); letter-spacing: -0.025em; }
.notes__item p { margin-top: 0.75rem; max-width: 62ch; }
.notes__actions { margin-top: 1.25rem; }
.notes__item code { font-size: 0.9em; background: var(--surface); padding: 0.1em 0.35em; }
.notes__side { grid-column: 1 / 5; grid-row: 1 / 4; align-self: start; font: 500 var(--step-small)/1.5 var(--display); color: var(--muted); max-width: 30ch; }
@media (max-width: 900px) { .notes__item, .notes__side { grid-column: 1 / -1; grid-row: auto; } .notes__side { margin-bottom: 2rem; } }

.download { padding-block: clamp(64px, 8vw, 120px); }
.download__title { grid-column: 1 / 6; font-size: var(--step-head); line-height: 1; letter-spacing: -0.03em; }
.download__text { grid-column: 6 / -1; font-size: var(--step-lead); line-height: 1.4; max-width: 38ch; }
.download__actions { grid-column: 6 / -1; margin-top: 2rem; }
@media (max-width: 900px) { .download__title, .download__text, .download__actions { grid-column: 1 / -1; } .download__text { margin-top: 1rem; } }

/* ─── Protocol reading page ────────────────────────────────────────────────── */
.protocol-shell {
  max-width: var(--maxw); margin-inline: auto; padding: clamp(32px, 4vw, 64px) var(--margin) var(--section);
  display: grid; grid-template-columns: minmax(15rem, 5fr) minmax(0, 7fr); column-gap: var(--gutter); align-items: start;
}
.protocol-shell > .doc-rail, .protocol-shell > .protocol-toc { grid-column: 1; grid-row: 1; }
.protocol-shell > .protocol-content { grid-column: 2; grid-row: 1; min-width: 0; max-width: 47rem; }
.doc-rail, .protocol-shell > .protocol-toc {
  position: sticky; top: calc(var(--nav-h) + 24px);
  max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; overscroll-behavior: contain;
  max-width: 21rem; margin-left: -0.9rem; padding: 0 1rem 1rem 0.9rem;
  font-family: var(--display);
  scrollbar-width: thin;
}
.doc-rail .protocol-toc { position: static; max-height: none; overflow: visible; max-width: none; padding: 0; }
.doc-rail__block + .doc-rail__block, .doc-rail .protocol-toc { margin-top: 2.25rem; }
.doc-rail__title, .protocol-toc__heading { font: 600 var(--step-small) var(--display); color: var(--muted); margin-bottom: 0.6rem; }
.doc-rail__title--gap { margin-top: 1.5rem; }
.doc-rail__title a { color: var(--ink); text-decoration: none; }
.doc-rail__title a:hover { color: var(--accent); text-decoration: underline; }
.doc-layer { margin: 0; padding: 0; list-style: none; }
.doc-layer a {
  display: block; padding: 0.4rem 0.65rem; margin-inline: -0.65rem;
  color: var(--ink); text-decoration: none; font: 500 var(--step-small)/1.35 var(--display);
  transition: background-color var(--t-fast) var(--ease-ui);
}
.doc-layer a:hover { background: var(--surface); }
.doc-layer a[aria-current='page'] { background: var(--ink); color: var(--on-night); }
.doc-layer a span { display: block; font-weight: 400; color: var(--muted); font-size: 0.92em; }
.doc-layer a[aria-current='page'] span { color: var(--on-night-muted); }
.doc-rail__layers { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.doc-rail__layers a {
  display: grid; place-items: center; min-width: 40px; min-height: 36px; padding: 0 0.4rem;
  background: var(--surface); color: var(--ink); text-decoration: none; font: 600 var(--step-small) var(--display);
  transition: background-color var(--t-fast) var(--ease-ui);
}
.doc-rail__layers a:hover { background: var(--surface-2); }
.doc-rail__layers a[aria-current='true'] { background: var(--accent); color: var(--accent-ink); }
.doc-rail__all { display: inline-flex; align-items: center; min-height: 44px; margin-top: 0.5rem; font: 600 var(--step-small) var(--display); color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.3em; }

.protocol-toc__toggle { display: none; }
.protocol-toc__list { margin: 0; padding: 0; list-style: none; }
.protocol-toc__list a {
  display: block; padding: 0.3rem 0 0.3rem 0.85rem; margin-left: -0.85rem;
  position: relative;
  color: var(--ink-2); text-decoration: none; font: 400 var(--step-small)/1.4 var(--display);
  transition: color var(--t-fast) var(--ease-ui);
}
.protocol-toc__list a::before {
  content: ''; position: absolute; left: 0; top: 0.78em; width: 6px; height: 6px; background: var(--accent);
  opacity: 0; transform: scale(0.5); transition: transform 120ms var(--ease-out), opacity 120ms var(--ease-out);
}
.protocol-toc__list a:hover { color: var(--accent); }
.protocol-toc__list .toc__sub a { padding-left: 1.75rem; color: var(--muted); }
.protocol-toc__list a.toc-active { color: var(--ink); font-weight: 600; }
.protocol-toc__list a.toc-active::before { opacity: 1; transform: scale(1); }
.protocol-toc__list .toc__sub a::before { left: 0.9rem; }

/* Head of a document */
.doc-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; font: 500 var(--step-small) var(--display); color: var(--muted); margin-bottom: 1.5rem; }
.doc-crumbs a { color: var(--ink); text-decoration-color: var(--accent); }
.doc-crumbs .icon { width: 0.9em; height: 0.9em; transform: rotate(-90deg); color: var(--muted); }
.protocol-article { font-size: var(--step-body); line-height: 1.65; color: var(--ink); overflow-wrap: break-word; }
.protocol-article > h1:first-of-type, .doc-head__id {
  font-size: clamp(2.1rem, 1.4rem + 2.4vw, 3.6rem); line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.doc-head__title { margin-top: 0.85rem; font: 400 var(--step-lead)/1.3 var(--text); color: var(--ink-2); }
.protocol-meta, .doc-head__meta { margin-top: 1rem; font: 500 var(--step-small)/1.6 var(--display); color: var(--muted); }
.protocol-meta { padding-bottom: 2.5rem; margin-bottom: 0.5rem; }

/* Long-form text */
.protocol-article p, .protocol-article ul, .protocol-article ol, .protocol-article pre, .protocol-article blockquote,
.protocol-article .table-wrap, .protocol-article .formula, .protocol-article dl { margin: 0 0 1.05em; }
.protocol-article h2 { font-size: clamp(1.55rem, 1.25rem + 0.9vw, 2.05rem); line-height: 1.12; letter-spacing: -0.022em; margin: 2.4em 0 0.7em; scroll-margin-top: calc(var(--nav-h) + 20px); }
.protocol-article h3 { font-size: clamp(1.22rem, 1.1rem + 0.35vw, 1.4rem); line-height: 1.2; letter-spacing: -0.012em; margin: 2em 0 0.55em; scroll-margin-top: calc(var(--nav-h) + 20px); }
.protocol-article h4 { font-size: 1.05rem; line-height: 1.3; letter-spacing: 0; margin: 1.7em 0 0.45em; scroll-margin-top: calc(var(--nav-h) + 20px); }
.protocol-article h5, .protocol-article h6 { font-size: 1rem; margin: 1.5em 0 0.4em; }
.protocol-article h2 + h3, .protocol-article h3 + h4 { margin-top: 0.9em; }
.protocol-article ul, .protocol-article ol { padding-left: 1.4em; }
.protocol-article li { margin: 0.28em 0; padding-left: 0.15em; }
.protocol-article li::marker { color: var(--muted); }
.protocol-article li > ul, .protocol-article li > ol { margin: 0.3em 0 0.5em; }
.protocol-article strong { font-weight: 650; }
.protocol-article a { overflow-wrap: anywhere; }
.protocol-article blockquote { margin-left: 0; padding: 0.9em 1.15em; background: var(--surface); color: var(--ink-2); }
.protocol-article code { font-size: 0.86em; background: var(--surface); padding: 0.08em 0.32em; border-radius: 2px; overflow-wrap: anywhere; }
.protocol-article pre { background: var(--surface); padding: 1rem 1.15rem; overflow-x: auto; font-size: 0.86rem; line-height: 1.6; tab-size: 2; }
.protocol-article pre code { background: none; padding: 0; font-size: inherit; white-space: pre; overflow-wrap: normal; }
.protocol-article sup, .protocol-article sub { line-height: 0; }
.protocol-article .formula {
  font: 500 clamp(1.1rem, 1rem + 0.5vw, 1.4rem)/1.5 var(--display); text-align: center;
  padding: 1.1em 1em; background: var(--surface); overflow-x: auto; white-space: nowrap;
}
.protocol-article .copy-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
/* pandoc syntax highlighting, on the palette */
.sourceCode .kw, .sourceCode .cf, .sourceCode .im { color: var(--accent); font-weight: 600; }
.sourceCode .dv, .sourceCode .fl, .sourceCode .bn { color: #8a2f00; }
.sourceCode .st, .sourceCode .ss, .sourceCode .vs, .sourceCode .ch { color: #1d6b43; }
.sourceCode .co { color: var(--muted); font-style: italic; }
.sourceCode .bu, .sourceCode .fu { color: #5b2bb5; }
.sourceCode .op { color: var(--ink-2); }
.sourceCode .at, .sourceCode .va, .sourceCode .pp { color: #7a4a00; }

/* Tables: lines are allowed in real tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-inline: 0; background:
  linear-gradient(to right, var(--bg) 30%, rgba(238, 240, 243, 0)), linear-gradient(to left, var(--bg) 30%, rgba(238, 240, 243, 0)) 100% 0, /* taste-skill-ignore: scroll cue on real tables */
  radial-gradient(farthest-side at 0 50%, rgba(11, 12, 14, 0.18), transparent), radial-gradient(farthest-side at 100% 50%, rgba(11, 12, 14, 0.18), transparent) 100% 0; /* taste-skill-ignore: scroll cue on real tables */
  background-repeat: no-repeat; background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%; background-attachment: local, local, scroll, scroll; }
.protocol-table, .survival-article table {
  width: 100%; border-collapse: collapse; font: 400 0.95rem/1.45 var(--display); font-variant-numeric: tabular-nums;
}
.protocol-table th, .protocol-table td, .survival-article th, .survival-article td { padding: 0.6rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.protocol-table th, .survival-article th { font-weight: 650; background: var(--surface); border-bottom: 2px solid var(--ink); white-space: nowrap; }
.protocol-table tbody tr:hover td { background: rgba(213, 217, 224, 0.45); }

/* Previous / next */
.protocol-nav-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4rem; }
.protocol-nav-bottom a {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 1.1rem 1.25rem; min-height: 96px;
  background: var(--surface); color: var(--ink); text-decoration: none; font-family: var(--display);
  transition: background-color var(--t-fast) var(--ease-ui);
}
.protocol-nav-bottom a:hover { background: var(--surface-2); }
.protocol-nav-bottom a.is-next { text-align: right; align-items: flex-end; grid-column: 2; }
.protocol-nav-bottom .k { font: 500 var(--step-small) var(--display); color: var(--muted); display: inline-flex; align-items: center; gap: 0.4em; }
.protocol-nav-bottom .id { font: 700 var(--step-ui)/1.3 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.protocol-nav-bottom .t { font: 400 var(--step-small)/1.4 var(--display); color: var(--ink-2); }
.protocol-nav-bottom__spacer { display: none; }
.protocol-nav-bottom .btn { justify-self: start; }
.protocol-nav-bottom .btn:last-child:not(:first-child) { justify-self: end; }

/* Reading progress (doc pages): scroll-driven, no script; hidden where unsupported */
.read-progress { display: none; }
@supports (animation-timeline: scroll()) {
  .read-progress {
    display: block; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 120; pointer-events: none;
    background: var(--accent); transform-origin: 0 50%;
    animation: read-progress linear both; animation-timeline: scroll(root);
  }
  @keyframes read-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

@media (max-width: 1100px) {
  .protocol-shell { grid-template-columns: 16rem minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .protocol-shell { display: flex; flex-direction: column; padding-top: 24px; }
  .protocol-shell > .doc-rail { display: contents; }
  .doc-rail .doc-rail__block { order: 3; width: 100%; margin-top: 3rem; }
  .protocol-shell > .protocol-content { order: 2; width: 100%; max-width: none; }
  .protocol-toc, .doc-rail .protocol-toc, .protocol-shell > .protocol-toc { order: 1; position: static; max-height: none; overflow: visible; max-width: none; width: 100%; margin: 0 0 1.5rem; padding: 0; }
  .protocol-toc > .protocol-toc__heading { display: none; }
  .protocol-toc__toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 1rem;
    border: 0; background: var(--surface); color: var(--ink); font: 600 var(--step-ui) var(--display); cursor: pointer;
  }
  .protocol-toc__toggle svg { transition: transform var(--t-ui) var(--ease-ui); }
  .protocol-toc__toggle[aria-expanded='true'] svg { transform: rotate(180deg); }
  #toc-list { display: none; padding: 0.75rem 1rem 1rem; background: var(--surface); max-height: 60vh; overflow-y: auto; }
  #toc-list.is-open { display: block; }
  #toc-list .protocol-toc__heading { display: none; }
  .protocol-nav-bottom { grid-template-columns: 1fr; }
  .protocol-nav-bottom a.is-next { grid-column: auto; }
}

/* Survival Manual: the same reading shell without the layer rail */
.protocol-shell--doc .protocol-content { max-width: 50rem; }
.survival-article h1, .survival-article h2, .survival-article h3 { scroll-margin-top: calc(var(--nav-h) + 20px); }
.survival-article h1 { font-size: clamp(1.9rem, 1.3rem + 2vw, 3rem); line-height: 1.05; letter-spacing: -0.028em; margin: 2.6em 0 0.6em; }
.survival-article h1:first-child { margin-top: 0; }
.survival-article table { margin: 0 0 1.2em; }
.survival-article .callout { padding: 0.9rem 1.1rem; margin: 0 0 1.1em; background: var(--surface); }
.survival-article li.callout { list-style: none; margin-left: -1.4em; }
.survival-article .callout--danger { background: #f6dedb; }
.survival-article .callout--warn { background: #f3e7cf; }
.survival-article .callout--ok { background: #dcebe2; }
.protocol-toolbar { margin-bottom: 1.5rem; font: 500 var(--step-small) var(--display); }
.protocol-toolbar a { color: var(--ink); text-decoration-color: var(--accent); }

/* ─── Inner pages (about, projects, converter info, Ayalon, 404) ───────────── */
.statement { padding-block: clamp(64px, 8vw, 128px); }
.statement p { grid-column: 1 / -1; font: 700 clamp(1.9rem, 1rem + 3.4vw, 4.4rem)/1.04 var(--display); letter-spacing: -0.03em; max-width: 24ch; }
.statement span { display: block; grid-column: 6 / -1; margin-top: 1.5rem; font: 500 var(--step-small) var(--display); }

.pair { row-gap: 2rem; }
.pair__item { grid-column: span 6; }
.pair__item h3 { font: 600 var(--step-small) var(--display); color: var(--muted); margin-bottom: 0.8rem; }
.pair__item p { font-size: var(--step-lead); line-height: 1.4; max-width: 34ch; }
.pair__item--accent { color: var(--accent); }
.pair__item--accent p { color: var(--ink); }
@media (max-width: 900px) { .pair__item { grid-column: 1 / -1; } }

.index-list { margin: 0; padding: 0; list-style: none; font-family: var(--display); }
.index-list li + li { margin-top: 2px; }
.index-list a, .index-list .is-plain {
  display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) 1.25rem; gap: 0.3rem 1.25rem; align-items: baseline;
  padding: 1rem 0.75rem; margin-inline: -0.75rem; color: var(--ink); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease-ui);
}
.index-list a:hover { background: var(--surface); }
.index-list b { font: 700 1.15rem/1.25 var(--display); letter-spacing: -0.01em; }
.index-list span { font: 400 var(--step-ui)/1.5 var(--display); color: var(--ink-2); }
.index-list em { grid-column: 2; font: 600 var(--step-small) var(--display); font-style: normal; color: var(--muted); }
.index-list .icon { color: var(--accent); align-self: center; }
@media (max-width: 600px) { .index-list a, .index-list .is-plain { grid-template-columns: minmax(0, 1fr) 1.25rem; } .index-list span, .index-list em { grid-column: 1; } }

.project { padding-top: clamp(64px, 8vw, 120px); row-gap: 1.5rem; scroll-margin-top: calc(var(--nav-h) + 16px); }
.project__pic { grid-column: 1 / 6; aspect-ratio: 16 / 10; }
.project__pic img { width: 100%; height: 100%; object-fit: cover; }
.project__body { grid-column: 6 / -1; }
.project:nth-of-type(even) .project__pic { grid-column: 8 / -1; grid-row: 1; }
.project:nth-of-type(even) .project__body { grid-column: 1 / 7; grid-row: 1; }
.project__kind { font: 600 var(--step-small) var(--display); color: var(--accent); }
.project__title { margin-top: 0.4rem; font-size: var(--step-head); line-height: 1; letter-spacing: -0.03em; }
.project__text { margin-top: 1rem; font-size: var(--step-lead); line-height: 1.4; max-width: 36ch; }
.project__facts { margin: 1.5rem 0 0; padding: 0; list-style: none; font: 400 var(--step-ui)/1.5 var(--display); max-width: 52ch; }
.project__facts li + li { margin-top: 0.35rem; }
.project__facts li::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--accent); margin-right: 0.7em; vertical-align: 0.18em; }
.project__actions { margin-top: 1.75rem; }
.project--paused .project__kind { color: var(--warn); }
@media (max-width: 900px) {
  .project__pic, .project__body, .project:nth-of-type(even) .project__pic, .project:nth-of-type(even) .project__body { grid-column: 1 / -1; grid-row: auto; }
}

.tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 0.6rem; background: var(--surface); font: 600 var(--step-small) var(--display); color: var(--ink); }
.tag--muted { color: var(--muted); }
.tag--indigo, .tag--accent { background: var(--accent-tint); color: var(--accent-hover); }

.notice { grid-column: 6 / -1; padding: 1.25rem 1.4rem; background: #f3e7cf; font: 400 var(--step-ui)/1.55 var(--display); max-width: 60ch; }
.notice strong { font-weight: 700; }
@media (max-width: 900px) { .notice { grid-column: 1 / -1; } }

.metrics { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 2.5rem; }
.metric { background: var(--surface); padding: 1.25rem; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; font-family: var(--display); }
.metric__label { font: 500 var(--step-small)/1.35 var(--display); color: var(--muted); }
.metric p { margin-top: 0.75rem; font: 400 var(--step-small)/1.45 var(--display); color: var(--ink-2); }
.metric__value { font: 700 clamp(1.6rem, 1.2rem + 1.2vw, 2.4rem)/1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .metrics { grid-template-columns: 1fr 1fr; } }

.data-table { grid-column: 6 / -1; margin-top: 1.5rem; }
@media (max-width: 900px) { .data-table { grid-column: 1 / -1; } }

.notfound { padding-block: clamp(80px, 12vw, 180px); }
.notfound__code { grid-column: 1 / -1; font: 700 clamp(6rem, 3rem + 14vw, 16rem)/0.82 var(--display); letter-spacing: -0.06em; color: var(--accent); }
.notfound__title { grid-column: 6 / -1; margin-top: 2rem; font-size: var(--step-head); line-height: 1; letter-spacing: -0.03em; }
.notfound__text { grid-column: 6 / -1; margin-top: 1rem; font-size: var(--step-lead); max-width: 36ch; }
.notfound__actions { grid-column: 6 / -1; margin-top: 2rem; }
@media (max-width: 900px) { .notfound__title, .notfound__text, .notfound__actions { grid-column: 1 / -1; } }

/* About */
.about-name { row-gap: 2.5rem; }
.about-name__pic { grid-column: 1 / 5; align-self: start; position: sticky; top: calc(var(--nav-h) + 24px); }
.about-name__pic img { aspect-ratio: 540 / 660; }
.about-name__body { grid-column: 6 / -1; }
.about-name__body .prose { margin-top: 1.5rem; font-size: clamp(1.15rem, 1.05rem + 0.3vw, 1.3rem); }
.about-name__list { margin-top: 3rem; }
.about-why { margin-top: var(--section); padding-bottom: var(--section); }
.about-why__title { grid-column: 1 / -1; margin-bottom: 1rem; }
.about-contents { margin-top: 2.5rem; }
.close__actions { grid-column: 7 / -1; justify-self: end; }
@media (max-width: 900px) {
  .about-name__pic { grid-column: 1 / -1; position: static; max-width: 360px; }
  .about-name__body { grid-column: 1 / -1; }
  .close__actions { grid-column: 1 / -1; justify-self: start; }
}

/* Projects */
.projects-jump { margin-top: 2.5rem; }
.project__title a { color: inherit; text-decoration: none; }
.project__title a:hover { color: var(--accent); }
.project__pic { display: block; }
.project + .section { margin-top: 0; }

/* Converter tool page: keeps its own inline layout; these rules put it on the site's type and corners */
.conv-wrapper .conv-header { text-align: left; padding-top: clamp(40px, 6vw, 88px); }
.conv-wrapper .conv-header h1 { font: 700 clamp(2.2rem, 1.5rem + 2.4vw, 3.4rem)/1 var(--display); letter-spacing: -0.03em; }
.conv-wrapper .conv-header p { margin-top: 0.75rem; font: 400 var(--step-lead)/1.4 var(--text); letter-spacing: 0; }
.conv-wrapper .lang-bar label, .conv-wrapper .field label, .conv-wrapper .hint, .conv-wrapper .input-type-row span {
  text-transform: none; letter-spacing: 0; font: 600 var(--step-small)/1.4 var(--display); color: var(--ink);
}
.conv-wrapper .hint { font-weight: 500; color: var(--muted); }
.conv-wrapper input, .conv-wrapper select, .conv-wrapper .lang-select, .conv-wrapper .conv-tab, .conv-wrapper .radio-btn,
.conv-wrapper .btn-convert, .conv-wrapper .conv-result, .conv-wrapper .conv-error, .conv-wrapper code { border-radius: 0 !important; }
.conv-wrapper .field input, .conv-wrapper .field select, .conv-wrapper .lang-select { min-height: 48px; font-family: var(--display); font-size: var(--step-ui); background: #f7f8fa; border: 1.5px solid var(--line); }
.conv-wrapper .field input:focus, .conv-wrapper .field select:focus, .conv-wrapper .lang-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); outline: none; } /* taste-skill-ignore: focus ring */
.conv-wrapper .conv-tab, .conv-wrapper .radio-btn { min-height: 44px; font-family: var(--display); font-weight: 600; }
.conv-wrapper .btn-convert {
  min-height: 48px; padding: 0 1.6rem; text-transform: none; letter-spacing: 0; font: 600 var(--step-ui) var(--display);
  background: var(--accent); transition: background-color var(--t-fast) var(--ease-ui), transform 120ms var(--ease-ui);
}
.conv-wrapper .btn-convert:hover { background: var(--accent-hover); }
.conv-wrapper .btn-convert:active { transform: scale(0.97); }
.conv-wrapper .conv-result { background: var(--surface); border: 0; }
.conv-wrapper .conv-result h2, .conv-wrapper .conv-result h3 { font: 700 1.25rem var(--display); letter-spacing: -0.01em; color: var(--ink); }
.conv-wrapper .result-grid dt { font: 500 var(--step-small) var(--display); color: var(--muted); }
.conv-wrapper .result-grid dd { font: 700 1.15rem/1.3 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.conv-wrapper .conv-info h2 { font: 700 1.5rem var(--display); letter-spacing: -0.015em; }
.conv-wrapper .conv-info p { font-size: var(--step-body); line-height: 1.6; }

/* ─── Print ────────────────────────────────────────────────────────────────── */
@media print {
  :root { --bg: #fff; }
  body { background: #fff; font-size: 11pt; }
  .site-nav, .site-footer, .skip-link, .doc-rail, .protocol-toc, .protocol-nav-bottom, .explorer__bar, .read-progress, .close { display: none !important; }
  .protocol-shell { display: block; padding: 0; }
  .protocol-shell > .protocol-content { max-width: none; }
  .protocol-article a { color: inherit; text-decoration: none; }
  .protocol-table th, .survival-article th { background: #eee; color: #111; }
  .protocol-article h2, .protocol-article h3 { break-after: avoid; }
  .protocol-article pre, .protocol-table { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
