/* ==========================================================================
   medeles.dev — VHS design system
   Hand-written. No framework, no build step, no external requests.

   Reference: 1980s VHS cassette sleeves.
     dark  = black "COLORS 180 HQ" sleeve
     light = cream "ZONTA 120" sleeve

   CONTRAST RULE (measured, not guessed):
   The spectrum palette inverts across themes — no rainbow hue is text-safe
   in both. Yellow is 12.10:1 on black but 1.34:1 on cream; blue is 7.52:1 on
   cream but 2.16:1 on black. Therefore: --vhs-* spectrum colors are
   DECORATION ONLY and must never carry text. Text uses --ink / --ink-dim /
   --accent, all of which are verified AA in their own theme.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts — self-hosted, subset, zero external requests
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Anton';
  src: url('fonts/anton-subset.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Impact averages 50.88% of em on uppercase vs Anton's 47.36% — the closest
   system match. size-adjust reconciles the difference so the swap doesn't
   reflow headings (CLS). */
@font-face {
  font-family: 'Anton Fallback';
  src: local('Impact'), local('Haettenschweiler'), local('Arial Narrow Bold');
  size-adjust: 93.1%;
  ascent-override: 117.63%;
  descent-override: 32.91%;
  line-gap-override: 0%;
}

/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* Spectrum — DECORATION ONLY. Never text. See contrast rule above. */
  --vhs-red:    #E4322B;
  --vhs-orange: #F07E1A;
  --vhs-yellow: #F6C518;
  --vhs-green:  #1D9E5A;
  --vhs-cyan:   #1B9FD8;
  --vhs-blue:   #2B3F9E;
  --vhs-violet: #7B2D8E;

  --font-display: 'Anton', 'Anton Fallback', Impact, 'Arial Narrow Bold', sans-serif;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* Type scale */
  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0:  clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --step-1:  clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --step-2:  clamp(1.5rem, 1.25rem + 1.2vw, 2.1rem);
  --step-3:  clamp(2rem, 1.5rem + 2.4vw, 3.2rem);
  --step-4:  clamp(2.8rem, 1.7rem + 5vw, 5.5rem);
  --step-5:  clamp(4rem, 2rem + 9vw, 9rem);

  --measure: 62ch;
  --radius: 2px;
  --border-w: 2px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --section-y: clamp(3.5rem, 9vw, 7rem);

  --ease: cubic-bezier(0.2, 0, 0.1, 1);
}

/* THEMING CONTRACT
   The palette resolves in CSS alone — JS only ever writes an explicit
   [data-theme] override. If scripting is off or the inline head script fails,
   :root still carries a full dark palette and the media query still honours
   the OS. (Defining tokens *only* under [data-theme] would leave a no-JS
   visitor with every var() unresolved and no palette at all.)

   Cascade order, weakest to strongest:
     1. :root                              -> dark  (default)
     2. @media light + :not([data-theme='dark'])  -> light (OS preference)
     3. [data-theme='light' | 'dark']      -> explicit user choice, wins
*/

/* Dark — the black "COLORS 180 HQ" sleeve. Also the no-JS default. */
:root,
[data-theme='dark'] {
  --bg:        #0B0B0C;
  --bg-panel:  #121214;
  --bg-inset:  #191919;
  --ink:       #F2EFE6;  /* 17.11:1 on --bg  AAA */
  --ink-dim:   #A9A69C;  /*  8.08:1 on --bg  AAA */
  --accent:    #F07E1A;  /*  7.22:1 on --bg  AAA */
  --rule:      #2E2E30;
  --rule-soft: #1F1F21;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  --grid-line: rgba(242, 239, 230, 0.06);
  --grain-opacity: 0.035;
  color-scheme: dark;
}

/* Light — the cream "ZONTA 120" sleeve. Same values in both blocks below:
   one for the OS preference (no JS needed), one for an explicit choice. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg:        #EFE9DC;
    --bg-panel:  #F7F3EA;
    --bg-inset:  #E3DCCB;
    --ink:       #101010;
    --ink-dim:   #55524B;
    --accent:    #A3520B;
    --rule:      #C9C0AC;
    --rule-soft: #DED6C4;
    --shadow: 0 10px 30px rgba(60, 50, 30, 0.14);
    --grid-line: rgba(16, 16, 16, 0.07);
    --grain-opacity: 0.05;
    color-scheme: light;
  }
}

[data-theme='light'] {
  --bg:        #EFE9DC;
  --bg-panel:  #F7F3EA;
  --bg-inset:  #E3DCCB;
  --ink:       #101010;  /* 15.73:1 on --bg  AAA */
  --ink-dim:   #55524B;  /*  6.44:1 on --bg  AA  */
  --accent:    #A3520B;  /*  4.61:1 on --bg  AA  (same hue as dark's orange,
                                darkened to clear AA on cream — the old
                                #E07A3E was 2.47:1 here, a real failure) */
  --rule:      #C9C0AC;
  --rule-soft: #DED6C4;
  --shadow: 0 10px 30px rgba(60, 50, 30, 0.14);
  --grid-line: rgba(16, 16, 16, 0.07);
  --grain-opacity: 0.05;
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

::selection { background: var(--accent); color: var(--bg); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 0.86;
  letter-spacing: 0.01em;
  word-break: break-word;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; line-height: 0.9; letter-spacing: 0.01em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: 0.02em; }

h2 + p, h3 + p { margin-top: 0.7em; }

p { max-width: var(--measure); }

/* The "HIGH QUALITY MEDIA" / "MADE IN JAPAN" micro-type on the sleeves */
.label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.label--accent { color: var(--accent); }

.tape-counter {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.mono { font-family: var(--font-mono); }
.dim { color: var(--ink-dim); }
.accent { color: var(--accent); }

/* --------------------------------------------------------------------------
   5. Layout
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--inset { background: var(--bg-panel); border-block: var(--border-w) solid var(--rule); }

.section-head { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.section-head h2 { margin-block: 0.4em 0.3em; }

.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
/* 28rem so auto-fit tops out at two columns — at 22rem the four Work cards
   packed 3-across and orphaned the fourth. */
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }

/* Stats always sit on one row — auto-fit collapsed them to 2+1 in the
   narrow About column. */
.grid--stats { grid-template-columns: repeat(3, 1fr); gap: clamp(.5rem, 1.5vw, 1rem); }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* --------------------------------------------------------------------------
   6. Spectrum bands — the signature cassette-sleeve element.
      repeating-linear-gradient: no images, no extra requests, GPU-cheap.
   -------------------------------------------------------------------------- */

.spectrum-bar {
  height: 6px;
  width: 100%;
  border: 0;
  background: linear-gradient(
    90deg,
    var(--vhs-red)    0 14.285%,
    var(--vhs-orange) 14.285% 28.57%,
    var(--vhs-yellow) 28.57% 42.855%,
    var(--vhs-green)  42.855% 57.14%,
    var(--vhs-cyan)   57.14% 71.425%,
    var(--vhs-blue)   71.425% 85.71%,
    var(--vhs-violet) 85.71% 100%
  );
}

.spectrum-bar--tall { height: 10px; }

/* The diagonal rainbow sweep from the ZONTA sleeve.
   Stripes run at 45deg across the whole box, then a hard-stop mask keeps
   them in the top-right wedge only — so the sleeve's label text on the left
   stays clear. Decorative: aria-hidden. */
.spectrum-diagonal {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.spectrum-diagonal::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    var(--vhs-violet) 0 14px,
    var(--vhs-blue)   14px 28px,
    var(--vhs-cyan)   28px 42px,
    var(--vhs-green)  42px 56px,
    var(--vhs-yellow) 56px 70px,
    var(--vhs-orange) 70px 84px,
    var(--vhs-red)    84px 98px
  );
  -webkit-mask-image: linear-gradient(to bottom left, #000 0 34%, transparent 34%);
  mask-image: linear-gradient(to bottom left, #000 0 34%, transparent 34%);
}

/* --------------------------------------------------------------------------
   7. Halftone grid — the printed-dot texture on the black sleeve.
      Two 1px repeating gradients. Cheap; no blur, no filter.
   -------------------------------------------------------------------------- */

.gridfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg,  var(--grid-line) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 9px);
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
}

/* --------------------------------------------------------------------------
   8. Cassette panel — bordered block with the shell's clipped corner
   -------------------------------------------------------------------------- */

.panel {
  --pad: clamp(1.1rem, 2.5vw, 1.6rem);
  background: var(--bg-panel);
  border: var(--border-w) solid var(--rule);
  border-radius: var(--radius);
  padding: var(--pad);
  position: relative;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

/* Pull an element out to the panel's edges. Uses --pad so it tracks the
   padding clamp instead of guessing a negative margin. */
.panel__bleed { margin: calc(var(--pad) * -1) calc(var(--pad) * -1) var(--pad); width: auto; }

/* The notched corner of a VHS shell */
.panel--notch { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%); }

.panel--hover:hover,
.panel--hover:focus-within {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.panel__index {
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--accent);
  line-height: 1;
}

/* Ruled tape label — the "STUDIO PERFORMANCE" plate */
.tape-label {
  border: var(--border-w) solid var(--ink);
  padding: 0.7rem 1rem;
  text-align: center;
  background: transparent;
  position: relative;
}

.tape-label__text {
  font-family: var(--font-display);
  font-size: var(--step-1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tape-label::before,
.tape-label::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 5px;
  background: repeating-linear-gradient(0deg, var(--ink) 0 1px, transparent 1px 3px);
}
.tape-label::before { top: -9px; }
.tape-label::after { bottom: -9px; }

/* --------------------------------------------------------------------------
   9. Nav
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: var(--border-w) solid var(--rule);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
}

.nav__brand {
  font-family: var(--font-display);
  font-size: var(--step-1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* The wordmark is one flex item. Left as a bare text node it became a
   separate item and picked up the 0.5rem gap — "MEDELES .DEV". */
.nav__brand-text { white-space: nowrap; }

.nav__brand-dot {
  width: 10px; height: 10px;
  background: var(--accent);
  flex: none;
}

.nav__links { display: flex; gap: 1.25rem; list-style: none; padding: 0; margin: 0; }

.nav__link {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-decoration: none;
  color: var(--ink-dim);
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}

.nav__link:hover, .nav__link:focus-visible { color: var(--ink); border-bottom-color: var(--accent); }

.nav__actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  background: transparent;
  border: var(--border-w) solid var(--rule);
  border-radius: var(--radius);
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 1.05rem; height: 1.05rem; }

/* The toggle does nothing without JS, so it only exists once JS says so. */
#theme-toggle { display: none; }
.js #theme-toggle { display: grid; }

/* Theme toggle shows the theme you'd switch TO. Mirrors the token cascade,
   so the icon is still correct before/without any [data-theme] attribute —
   otherwise both icons render stacked. */
.icon-btn__sun { display: block; }
.icon-btn__moon { display: none; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .icon-btn__sun { display: none; }
  :root:not([data-theme='dark']) .icon-btn__moon { display: block; }
}

[data-theme='dark'] .icon-btn__sun { display: block; }
[data-theme='dark'] .icon-btn__moon { display: none; }
[data-theme='light'] .icon-btn__sun { display: none; }
[data-theme='light'] .icon-btn__moon { display: block; }

.nav__toggle { display: none; }

.nav__mobile {
  display: none;
  border-top: var(--border-w) solid var(--rule);
  background: var(--bg);
}
.nav__mobile[data-open='true'] { display: block; }
.nav__mobile ul { list-style: none; margin: 0; padding: 0.5rem 0 1rem; }
.nav__mobile .nav__link { display: block; padding: 0.7rem var(--gutter); border-bottom: 0; }

@media (max-width: 62rem) {
  .nav__links { display: none; }
  .nav__toggle { display: grid; }
}

/* --------------------------------------------------------------------------
   10. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-decoration: none;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}

.btn:hover { transform: translateY(-2px); }
.btn svg { width: 1rem; height: 1rem; }

.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------------------
   11. Chips / badges
   -------------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  background: var(--bg-inset);
}

.chip--live { border-color: var(--accent); color: var(--accent); }

.rec-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--vhs-red);
  flex: none;
}

@media (prefers-reduced-motion: no-preference) {
  .rec-dot { animation: rec 2s steps(1, end) infinite; }
  @keyframes rec { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0.25; } }
}

/* --------------------------------------------------------------------------
   12. Hero — the cassette sleeve itself
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding-top: clamp(6rem, 14vh, 9rem);
  padding-bottom: var(--section-y);
  overflow: hidden;
  border-bottom: var(--border-w) solid var(--rule);
}

.hero__inner { position: relative; z-index: 2; }

.hero__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: var(--border-w) solid var(--ink);
  padding-bottom: 0.6rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.hero__title {
  font-size: var(--step-4);
  margin-bottom: 0.3em;
  max-width: 17ch;
}

.hero__role {
  font-family: var(--font-display);
  font-size: var(--step-2);
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.02em;
  line-height: 1;
  margin-bottom: 0.7em;
  padding-bottom: 0.5em;
  border-bottom: var(--border-w) solid var(--rule);
  max-width: 17ch;
}

.hero__lede {
  font-size: var(--step-1);
  color: var(--ink-dim);
  max-width: 46ch;
  margin-bottom: 1.75rem;
}

.hero__lede strong { color: var(--ink); font-weight: 600; }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

@media (max-width: 54rem) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__sleeve { display: none; }
}

/* The right-hand cassette graphic: pure CSS, no image */
.hero__sleeve {
  border: var(--border-w) solid var(--ink);
  aspect-ratio: 3 / 4;
  position: relative;
  overflow: hidden;
  background: var(--bg-inset);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 26px), calc(100% - 26px) 100%, 0 100%);
}

.hero__sleeve-head {
  position: absolute;
  top: 0; left: 0;
  max-width: 62%;
  padding: 1rem;
  z-index: 2;
}

.hero__sleeve-num {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 4.5rem);
  line-height: 0.85;
  margin-block: 0.25rem;
}

.hero__sleeve-foot {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.8rem;
  z-index: 2;
}

.hero__cta { margin-top: 0.5rem; }

/* --------------------------------------------------------------------------
   13. Stats
   -------------------------------------------------------------------------- */

.stat {
  border: var(--border-w) solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--bg-panel);
  text-align: center;
}

.stat__num {
  font-family: var(--font-display);
  font-size: var(--step-3);
  color: var(--accent);
  line-height: 1;
}

.stat__label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  margin-top: 0.4rem;
}

/* --------------------------------------------------------------------------
   14. Code window
   -------------------------------------------------------------------------- */

.code-window {
  border: var(--border-w) solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-inset);
  overflow: hidden;
}

.code-window__bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-panel);
}

.code-window__dot { width: 10px; height: 10px; border-radius: 50%; }

.code-window pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.7;
}

/* Syntax tints. These sit on --bg-inset and are verified AA in both themes. */
.tok-key { color: var(--accent); }
.tok-str { color: var(--ink); }
.tok-prop { color: var(--ink-dim); }
.tok-com { color: var(--ink-dim); font-style: italic; }

/* --------------------------------------------------------------------------
   15. Architecture tree
   -------------------------------------------------------------------------- */

.tree {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.9;
  white-space: pre;
  overflow-x: auto;
  color: var(--ink-dim);
  margin: 0;
}
.tree b { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------------------
   16. Philosophy rows
   -------------------------------------------------------------------------- */

.principle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem 1.25rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule-soft);
  align-items: start;
}
.principle:last-child { border-bottom: 0; }

.principle__num {
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--accent);
  line-height: 1;
  min-width: 2.5ch;
}

/* --------------------------------------------------------------------------
   17. Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: var(--border-w) solid var(--rule);
  padding-block: 2rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   18. Grain — a static SVG turbulence tile. No animation, no filter at paint.
   -------------------------------------------------------------------------- */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   19. Reveal — progressive enhancement ONLY.
       Content is visible by default. The .js- prefix is added by the inline
       head script, so a no-JS visitor (or a crawler) never sees opacity:0.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  }
  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   20. Utilities
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--gutter);
  z-index: 200;
  background: var(--accent);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--step--1);
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; }

.divider-rule {
  height: 0;
  border: 0;
  border-top: var(--border-w) solid var(--rule);
  margin-block: 1.5rem;
}

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

@media print {
  .nav, .grain, .spectrum-diagonal, .gridfield { display: none !important; }
  body { background: #fff; color: #000; }
}
