/* nudii.app 2.0: tokens, base and components. The rules and the reasons are in DESIGN.md; every hex is the app's
   (docs/v2/DESIGN_SYSTEM.md §2.1 in the app repo). Pages use the names, never raw values. */

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

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

  --navy: #0A1628;
  --abyss: #050B18;
  --deep: #0C1A33;
  --water: #13325C;
  --tide: #1D4B7D;
  --rim: #2F6A9C;
  --mist: #8EC3E6;
  --foam: #F3F5F5;
  --foam-hi: #FFFFFF;
  --foam-shade: #BCD0E0;
  --ink: #0A1628;
  --ink-2: #3D5170;
  --anna: #E89223;
  --anna-deep: #B9520F;
  --sun: #FCD83B;
  --need: #F983AC;
  --meter: #2EBEF3;
  --paper: #1A2B45;
  --paper-2: #132139;
  --rule-2: #2C4466;
  --pencil: #A9BACB;
  --disabled-ink: #6F84A3;
  --disabled-fill: #0D1A2E;
  --drop-1: rgba(5, 11, 24, 0.6);
  --drop-2: rgba(5, 11, 24, 0.55);
  --scrim: rgba(5, 11, 24, 0.6);
  --grid: rgba(142, 195, 230, 0.05);

  --font-pixel: "DotGothic16", ui-monospace, "SF Mono", Menlo, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --t: 4px;                                   /* one texel */
  --s1: var(--t);
  --s2: calc(var(--t) * 2);
  --s3: calc(var(--t) * 3);
  --s4: calc(var(--t) * 4);
  --s6: calc(var(--t) * 6);
  --s8: calc(var(--t) * 8);
  --section: calc(var(--t) * 24);
  --content: 1120px;
  --measure: 66ch;
  --gutter: 16px;
}
@media (max-width: 599px) {
  :root { --t: 3px; --section: calc(var(--t) * 16); }
}

/* Night: the same six tokens the app re-points when the lights go out. */
.night {
  --rim: #13305A;
  --mist: #7D8FB0;
  --meter: #1F98D8;
  --water: #0B1A35;
  --deep: #081328;
  --tide: #0F2443;
}

/* ─── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--foam);
  font: 400 17px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }   /* components set display; hidden must still win */
img { max-width: 100%; height: auto; }
img.pixel, .pixel img, canvas.pixel { image-rendering: pixelated; }
a { color: var(--mist); text-underline-offset: 0.18em; }
a:hover, a:focus-visible { color: var(--foam); }
:focus-visible { outline: 2px solid var(--anna); outline-offset: 3px; }
[id] { scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 80px); }   /* clear the sticky nav on #anchors */
::selection { background: var(--water); color: var(--foam); }

.wrap {
  max-width: var(--content);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.band { padding-block: var(--section); }
.band--water { background: var(--water); }
.band--abyss { background: var(--abyss); }
.band--paper { background: var(--paper-2); }

.skip-link { position: absolute; left: var(--s4); top: -100px; z-index: 100; }
.skip-link:focus { top: var(--s4); }
.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;
}

/* ─── Type ───────────────────────────────────────────────── */
/* DotGothic16 only at 16, 32, 48 and 64 px, where its dots land on whole pixels. */
.px, .h-hero, .h-section, .label {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0;
  font-synthesis: none;
}
.h-hero { font-size: 32px; line-height: 1.05; margin: 0 0 var(--s4); text-wrap: balance; }
@media (min-width: 600px) { .h-hero { font-size: 48px; line-height: 1; } }
@media (min-width: 960px) { .h-hero { font-size: 64px; } }
.h-section { font-size: 32px; line-height: 1.05; margin: 0 0 var(--s4); text-wrap: balance; }
@media (min-width: 600px) { .h-section { font-size: 48px; line-height: 1; } }
@media (min-width: 960px) { .h-section { font-size: 64px; } }
.label { font-size: 16px; line-height: 1.1; }
.lead { font-size: 20px; line-height: 1.5; margin: 0 0 var(--s4); max-width: var(--measure); }
.prose p, .prose li { max-width: var(--measure); }
.small { font-size: 14px; line-height: 1.45; color: var(--mist); }
.latin { font-style: italic; }
.num { font-variant-numeric: tabular-nums; }

/* ─── The frame: a 1 t outline with the corner texel left open, plus a hard drop ── */
.frame {
  box-shadow:
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss),
    0 calc(2 * var(--t)) 0 var(--drop-1);
}
.frame--e2 {
  box-shadow:
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss),
    0 calc(4 * var(--t)) 0 var(--drop-2);
}
.frame--flat {
  box-shadow:
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss);
}

/* Plate: the site or the app talking. */
.plate {
  background: var(--navy);
  border-top: var(--t) solid var(--rim);
  padding: var(--s4) var(--s6) var(--s6);
}
.plate--deep-diver {
  outline: var(--t) solid var(--sun);
  outline-offset: calc(-3 * var(--t));
  padding: var(--s6) var(--s8) var(--s8);
}
.plate--deep-diver .plate__title { color: var(--sun); }
.plate--deep-diver .plate__title::before { content: "\2605\00a0"; }

/* Paper: the notebook. A 2 t stepped notch on the top corners, the 8 t grid, a stitched line under the top. */
.notebook {
  position: relative;
  isolation: isolate;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--s8) var(--s8);
  padding: var(--s6) var(--s6) var(--s8);
  clip-path: polygon(
    0 var(--s2), var(--t) var(--s2), var(--t) var(--t), var(--s2) var(--t), var(--s2) 0,
    calc(100% - var(--s2)) 0, calc(100% - var(--s2)) var(--t), calc(100% - var(--t)) var(--t),
    calc(100% - var(--t)) var(--s2), 100% var(--s2), 100% 100%, 0 100%);
}
.notebook-frame { position: relative; isolation: isolate; padding: var(--t); }
.notebook-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--abyss);
  clip-path: polygon(
    0 calc(var(--s2) + var(--t)), var(--t) calc(var(--s2) + var(--t)), var(--t) var(--s2), var(--s2) var(--s2),
    var(--s2) var(--t), calc(var(--s2) + var(--t)) var(--t), calc(var(--s2) + var(--t)) 0,
    calc(100% - var(--s2) - var(--t)) 0, calc(100% - var(--s2) - var(--t)) var(--t), calc(100% - var(--s2)) var(--t),
    calc(100% - var(--s2)) var(--s2), calc(100% - var(--t)) var(--s2), calc(100% - var(--t)) calc(var(--s2) + var(--t)),
    100% calc(var(--s2) + var(--t)), 100% calc(100% - var(--t)), calc(100% - var(--t)) calc(100% - var(--t)),
    calc(100% - var(--t)) 100%, var(--t) 100%, var(--t) calc(100% - var(--t)), 0 calc(100% - var(--t)));
}
.notebook::before {
  content: "";
  position: absolute;
  left: var(--s4);
  right: var(--s4);
  top: var(--s3);
  border-top: var(--t) dashed var(--rule-2);
}
.notebook, .notebook p, .notebook li { color: var(--foam); }
.notebook .small { color: var(--pencil); }

/* ─── Keys ───────────────────────────────────────────────── */
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  min-width: 44px;
  padding: var(--s3) var(--s6);
  font: 600 17px/1.2 var(--font-sans);
  text-decoration: none;
  border: 0;
  cursor: pointer;
}
.key--primary {
  background: var(--anna);
  color: var(--ink);
  box-shadow:
    inset 0 calc(-1 * var(--t)) 0 var(--anna-deep),
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss),
    0 calc(2 * var(--t)) 0 var(--drop-1);
}
.key--primary:hover, .key--primary:focus-visible { color: var(--ink); }
.key--primary:active {
  transform: translateY(var(--t));
  box-shadow:
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss);
}
.key--secondary {
  background: var(--water);
  color: var(--foam);
  box-shadow:
    inset 0 var(--t) 0 var(--tide),
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss),
    0 calc(2 * var(--t)) 0 var(--drop-1);
}
.key--secondary:hover, .key--secondary:focus-visible { color: var(--foam); background: var(--tide); }
.key--secondary[aria-pressed="true"] { background: var(--tide); }
.key--quiet { background: none; color: var(--mist); text-decoration: underline; padding-inline: 0; }
.key:disabled, .key[aria-disabled="true"] {
  background: var(--disabled-fill);
  color: var(--disabled-ink);
  cursor: not-allowed;
  transform: none;
}

/* ─── Small parts ────────────────────────────────────────── */
.chip {
  display: inline-block;
  font: 400 16px/1.1 var(--font-pixel);
  padding: var(--t) var(--s2);
  color: var(--pencil);
  box-shadow: inset 0 0 0 var(--t) var(--rule-2);
}
.chip--selected { background: var(--water); color: var(--foam); box-shadow: inset 0 var(--t) 0 var(--rim); }
/* A chip that is a key (habitats, day and night): 44 px tall, pressed joins the plate family. */
.chips-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip--key { min-height: 44px; padding-inline: var(--s3); background: none; border: 0; cursor: pointer; }
.chip--key:hover { color: var(--foam); }
.chip--key[aria-pressed="true"] { background: var(--water); color: var(--foam); box-shadow: inset 0 var(--t) 0 var(--rim); }
.tag-now { display: inline-block; font: 400 16px/1.1 var(--font-pixel); padding: var(--t) var(--s2); background: var(--anna); color: var(--ink); }
.stamp {
  display: inline-block;
  font: 400 16px/1.1 var(--font-pixel);
  color: var(--mist);
  padding: var(--t) var(--s2);
  outline: 2px solid var(--mist);
  outline-offset: 2px;
  box-shadow: inset 0 0 0 2px var(--mist);
}
.unknown {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px dashed var(--pencil);
  color: var(--pencil);
  font: 400 48px/1 var(--font-pixel);
}

/* Print: real tank art in a foam border with pixel photo corners. */
.print {
  position: relative;
  display: inline-block;
  background: var(--foam);
  padding: var(--s2);
  box-shadow:
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss),
    0 calc(2 * var(--t)) 0 var(--drop-1);
}
.print img, .print .px-sprite { display: block; image-rendering: pixelated; background-color: var(--water); }

/* ─── The tank: a biome plate (.px-tank-<biome>) with the pet standing on its sand. --k is CSS px per texel and
   stays a whole number; the pet's place and shadow come from css/pixel-anims.css (the generator's pet_in_tank). ── */
.tank {
  --k: 2;
  position: relative;
  flex: none;
  width: calc(var(--tank-w, 132) * var(--k) * 1px);
  height: calc(var(--tank-h, 150) * var(--k) * 1px);
  background-color: var(--water);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  image-rendering: pixelated;
  overflow: hidden;
}
@media (min-width: 600px) { .tank { --k: 3; } }
.tank .px-sprite {
  position: absolute;
  left: calc(var(--px-x) * var(--k) * 1px);
  top: calc(var(--px-y) * var(--k) * 1px);
  width: calc(var(--px-w) * var(--k) * 1px);
  height: calc(var(--px-h) * var(--k) * 1px);
}
.portrait { display: block; width: calc(28px * var(--k, 4)); image-rendering: pixelated; background-repeat: no-repeat; }
.glyph { display: block; width: calc(11px * var(--k, 4)); height: auto; image-rendering: pixelated; }

/* The hero's tank is the larger one: 4 px per texel from 1180 px (528 x 600). */
@media (min-width: 1180px) { .tank--hero { --k: 4; } }
/* A small tank stays at 2 px per texel at every width (the duo's two tanks share one band). */
.tank--small { --k: 2; }
.tank-block { display: grid; width: min-content; max-width: 100%; }   /* the tank sets the width; the care bar follows it */

/* Care bar: the app's stand under a tank, as wide as the tank. Each key is a plate with its stand glyph and a label;
   pressed, it drops one texel onto the sand. */
.care-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin-top: calc(var(--t) * 5); }
.care-key {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: var(--s3) var(--s2);
  background: var(--navy);
  color: var(--foam);
  border: 0;
  cursor: pointer;
  font: 400 16px/1.1 var(--font-pixel);
  text-align: center;
  box-shadow:
    inset 0 var(--t) 0 var(--rim),
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss),
    0 calc(2 * var(--t)) 0 var(--drop-1);
}
.care-key .glyph { --k: 3; }
.care-key[aria-pressed="true"] {
  background: var(--water);
  transform: translateY(var(--t));
  box-shadow:
    inset 0 var(--t) 0 var(--tide),
    0 calc(-1 * var(--t)) 0 var(--abyss),
    0 var(--t) 0 var(--abyss),
    calc(-1 * var(--t)) 0 0 var(--abyss),
    var(--t) 0 0 var(--abyss);
}
.care-key:disabled { background: var(--disabled-fill); color: var(--disabled-ink); cursor: not-allowed; }
.care-key:disabled .glyph { opacity: 0.72; }

/* Pause motion: holds every sprite on the page (the hero loops for longer than 5 s). */
.motion-paused .px-sprite { animation-play-state: paused !important; }

/* Facts: short pixel labels, each after a 2-texel mist square. */
.facts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); list-style: none; margin: var(--s4) 0 0; padding: 0; color: var(--mist); }
.facts li { display: flex; align-items: center; gap: var(--s2); font: 400 16px/1.1 var(--font-pixel); }
.facts li::before { content: ""; width: var(--s2); height: var(--s2); background: var(--mist); }

/* Dither strip: a 4-texel band of 1-texel checker between the water and the navy below it. */
.dither {
  height: calc(var(--t) * 4);
  background: repeating-conic-gradient(var(--water) 0 25%, var(--navy) 0 50%) 0 0 / calc(var(--t) * 2) calc(var(--t) * 2);
}

/* Meter: one hue, every stat. */
.meter { display: flex; gap: var(--t); }
.meter > i { width: var(--s3); height: var(--s3); background: var(--deep); }
.meter > i.on { background: var(--meter); }
.meter--need > i.on { background: var(--need); }

/* ─── The pet's voice (foam). Only a nudii speaks in it. ── */
.bubble {
  position: relative;
  display: inline-block;
  max-width: 32ch;
  background: var(--foam);
  color: var(--ink);
  font: 400 14px/1.35 var(--font-sans);
  padding: var(--s2) var(--s3);
  box-shadow:
    inset 0 var(--t) 0 var(--foam-hi),
    inset 0 calc(-1 * var(--t)) 0 var(--foam-shade),
    0 calc(-1 * var(--t)) 0 var(--ink),
    0 var(--t) 0 var(--ink),
    calc(-1 * var(--t)) 0 0 var(--ink),
    var(--t) 0 0 var(--ink),
    0 calc(2 * var(--t)) 0 var(--drop-1);
  margin-bottom: var(--s4);
}
/* The 7 × 4 t down-tail, drawn texel by texel: row 0 overwrites the frame's bottom outline. */
.bubble::after {
  content: "";
  position: absolute;
  left: calc(50% - 3.5 * var(--t));
  top: 100%;
  width: var(--t);
  height: var(--t);
  background: var(--ink);
  box-shadow:
    calc(1 * var(--t)) 0 0 var(--foam-shade), calc(2 * var(--t)) 0 0 var(--foam-shade),
    calc(3 * var(--t)) 0 0 var(--foam-shade), calc(4 * var(--t)) 0 0 var(--foam-shade),
    calc(5 * var(--t)) 0 0 var(--foam-shade), calc(6 * var(--t)) 0 0 var(--ink),
    calc(1 * var(--t)) var(--t) 0 var(--ink), calc(2 * var(--t)) var(--t) 0 var(--foam),
    calc(3 * var(--t)) var(--t) 0 var(--foam), calc(4 * var(--t)) var(--t) 0 var(--foam),
    calc(5 * var(--t)) var(--t) 0 var(--ink),
    calc(2 * var(--t)) calc(2 * var(--t)) 0 var(--ink), calc(3 * var(--t)) calc(2 * var(--t)) 0 var(--foam),
    calc(4 * var(--t)) calc(2 * var(--t)) 0 var(--ink),
    calc(3 * var(--t)) calc(3 * var(--t)) 0 var(--ink);
}

/* ─── Navigation ─────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--navy);
  border-top: var(--t) solid var(--rim);
  box-shadow: 0 var(--t) 0 var(--abyss);
}
.site-nav__bar { display: flex; align-items: center; gap: var(--s6); min-height: 64px; }
.site-nav__brand { display: inline-flex; align-items: center; gap: var(--s2); color: var(--foam); text-decoration: none; font: 400 32px/1 var(--font-pixel); }
/* The wordmark (Daniel, 24 Oct, option B): DotGothic16 sets "nudii" as "nud i i", so it is tracked in by two of the
   font's dots (a dot is 2 px at 32 px), which keeps every dot on whole pixels. */
.site-nav__brand span, .brand span { letter-spacing: -4px; }
.site-nav__brand img { width: 32px; height: 32px; image-rendering: pixelated; }
.site-nav__links { display: flex; gap: var(--s2); list-style: none; margin: 0 0 0 auto; padding: 0; }
.site-nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--s3);
  font: 400 16px/1.1 var(--font-pixel);
  color: var(--mist);
  text-decoration: none;
}
.site-nav__links a:hover, .site-nav__links a:focus-visible { color: var(--foam); }
.site-nav__links a[aria-current="page"] { background: var(--water); color: var(--foam); }
.site-nav__menu { display: none; }
@media (max-width: 359px) { .site-nav__brand span { display: none; } }
@media (max-width: 899px) {
  .site-nav__links { display: none; }
  .site-nav__menu { display: inline-flex; }
  .site-nav__bar { gap: var(--s3); }
  .site-nav__bar .key { min-height: 44px; padding-inline: var(--s3); font-size: 16px; }
  .site-nav__bar .key--primary { margin-left: auto; }
}
.nav-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--scrim);
  padding: calc(env(safe-area-inset-top, 0px) + 72px) max(var(--gutter), env(safe-area-inset-right, 0px)) calc(var(--gutter) + env(safe-area-inset-bottom, 0px)) max(var(--gutter), env(safe-area-inset-left, 0px));
  overflow-y: auto;                         /* the page behind is scroll-locked, so a short screen scrolls the sheet */
  overscroll-behavior: contain;
}
.nav-sheet__panel { display: grid; gap: var(--s2); }
.nav-sheet__panel a:not(.key) { font: 400 32px/1.05 var(--font-pixel); color: var(--foam); text-decoration: none; padding: var(--s2) 0; }
.nav-sheet__panel .key { justify-self: start; margin-top: var(--s4); }

/* ─── Store picker: a plate menu built at run time from js/storefront.js ── */
.store-menu { list-style: none; margin: var(--s3) 0 0; padding: var(--s3); display: grid; gap: var(--t); background: var(--navy); border-top: var(--t) solid var(--rim); max-height: min(60vh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.store-menu a { display: flex; align-items: center; min-height: 44px; padding-inline: var(--s3); color: var(--foam); text-decoration: none; }
.store-menu a:hover, .store-menu a:focus-visible { background: var(--water); }

/* ─── Forms ──────────────────────────────────────────────── */
.field { display: grid; gap: var(--s2); }
.field label { font: 600 14px/1.3 var(--font-sans); color: var(--mist); }
.input {
  min-height: 44px;
  padding: var(--s2) var(--s3);
  background: var(--deep);
  color: var(--foam);
  font: 400 17px/1.3 var(--font-sans);
  border: 0;
  box-shadow: inset 0 0 0 var(--t) var(--rim);
}
.input::placeholder { color: var(--mist); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 var(--t) var(--need); }
.field__error { color: var(--need); font-size: 14px; margin: 0; }
.toast { display: inline-block; background: var(--navy); color: var(--foam); padding: var(--s3) var(--s4); border-top: var(--t) solid var(--rim); }

/* ─── Ruled rows (FAQ, support) ──────────────────────────── */
.ruled { margin: 0; padding: 0; }
.ruled details { border-top: var(--t) solid var(--rule-2); }
.ruled details:last-child { border-bottom: var(--t) solid var(--rule-2); }
.ruled summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: 44px;
  padding-block: var(--s3);
  font: 600 17px/1.35 var(--font-sans);
  cursor: pointer;
  list-style: none;
}
.ruled summary::-webkit-details-marker { display: none; }
.ruled summary::after { content: "\25B8"; font-family: var(--font-pixel); color: var(--mist); flex: none; }
.ruled details[open] summary::after { content: "\25BE"; }
.ruled .ruled__body { padding-bottom: var(--s4); max-width: var(--measure); }

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer { background: var(--abyss); padding-block: var(--s8) calc(var(--s8) + env(safe-area-inset-bottom, 0px)); color: var(--mist); font-size: 14px; }
.site-footer a { color: var(--mist); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); list-style: none; margin: 0 0 var(--s4); padding: 0; }

/* The page ends on the seabed: assets/gift/sea.png repeated at the sprite's scale, with a nudii asleep on the sand. */
.seabed {
  --k: 2;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: calc(60px * var(--k));
  padding-bottom: calc(10px * var(--k));
  background: var(--abyss) url(/assets/gift/sea.png) repeat-x left bottom / calc(2px * var(--k)) calc(240px * var(--k));
  image-rendering: pixelated;
}
.seabed .px-sprite { flex: none; width: calc(var(--px-w) * var(--k) * 1px); height: calc(var(--px-h) * var(--k) * 1px); }
@media (min-width: 900px) { .seabed { --k: 3; } }

/* ─── Layout helpers ─────────────────────────────────────── */
.stack { display: grid; gap: var(--s4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: center; }
.split { display: grid; gap: var(--s8); align-items: center; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } .split--wide-left { grid-template-columns: 1.2fr 0.8fr; } }
/* A split that holds a tank gives the tank's column exactly the tank's width (a whole number of px per texel, never
   shrunk) and the text the rest, so no width between 900 px and the content cap pushes the tank out. */
@media (min-width: 900px) {
  .split--tank-right { grid-template-columns: minmax(0, 1fr) auto; }
  .split--tank-left { grid-template-columns: auto minmax(0, 1fr); }
}
.split > * { min-width: 0; }
.grid-auto { display: grid; gap: var(--s6); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.grid-auto > * { min-width: 0; }

/* ─── Motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ─── Print (Support and Privacy) ────────────────────────── */
@media print {
  body { background: #fff; color: #000; }
  .site-nav, .site-footer, .seabed, .key, .nav-sheet { display: none !important; }
  .notebook, .plate { background: #fff; color: #000; box-shadow: none; clip-path: none; }
  .notebook p, .notebook li { color: #000; }
  a { color: #000; }
}
