/*
 * fonts.css — the two families the design uses, served from this machine
 *
 * They came from Google Fonts and are variable: one file carries every weight
 * the design names, so three files cover seven faces. Latin only — Spanish
 * accents (á é í ó ú ñ ü) live inside that range, so nothing the copy needs is
 * cut. Self-hosted because the third-party stylesheet was render-blocking, was
 * a second DNS+TLS handshake before first paint, and once took the share card
 * down with it when it could not be reached.
 */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/cormorant-garamond-v21.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: "Cormorant Garamond";
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url("/static/fonts/cormorant-garamond-italic-v21.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: "DM Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/static/fonts/dm-sans-v17.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.css — Design tokens
 *
 * Single source of truth for colors, typography, and spacing.
 * Values here are fallbacks; each template overrides :root with
 * live values from data.json via an inline <style> block.
 *
 * To retheme the app, change data.json → theme.*
 * To change typography or spacing, change the vars below.
 */

:root {
  /* Colors — overridden per-page from data.json */
  --bg:       #F7F1E6;   /* warm paper */
  --text:     #2A241D;   /* near-black ink */
  --accent:   #4D6A93;   /* dusty cornflower */
  --card-bg:  #EDE4D2;   /* deeper warm paper */
  --muted:    rgba(42,36,29,0.55);
  --hairline: color-mix(in srgb, var(--text) 18%, transparent);

  /* Typography */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;

  /* Weights — one step heavier than the original almanac spec so text holds
     up over a photo. Change a token here and it moves everywhere. */
  --weight-display:  500;  /* hero and page titles */
  --weight-number:   400;  /* the big stat figures */
  --weight-serif:    400;  /* serif prose and italic subtitles */
  --weight-emphasis: 500;  /* serif labels: unit, footnote, letter name */
  --weight-ui:       500;  /* DM Sans: caps, labels, buttons */

  /* Type scale */
  --text-display: 72px;   /* hero title */
  --text-display-accent: 56px; /* the & glyph */
  --text-stat:    92px;   /* big stat number */
  --text-body:    18px;   /* italic subtitle, presently clock */
  --text-ui:      17px;   /* unit labels, inputs */
  --text-footnote:15px;   /* stat footnote, error */
  --text-small:   13.5px; /* city note, hint */
  --text-eyebrow: 9.5px;  /* all caps labels */
  --text-btn:     10px;   /* button labels */

  /* Motion — the only two curves the app uses. Anything that enters, exits or
     answers a press takes --ease-out; anything already on screen that travels to
     a new place takes --ease-in-out. Both are the strong variants: a built-in
     ease-out is too weak to read as deliberate. */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Spacing */
  --max-w:  480px;
  --pad-h:  28px;    /* horizontal page padding */
  --pad-v:  56px;    /* top padding for app shell */
}

/*
 * base.css — Reset, body, paper grain, shared primitives
 *
 * Rules here apply globally to every page.
 * Primitives (.eyebrow, .rule, .accent, .italic) are used
 * across all templates and should not be moved to page files.
 */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  /* iOS Safari tints its top and bottom bars from the page's own colour, and its
     default is white: over a photo wash that reads as a white band. The home
     page sets this to the colour of the wash it is wearing. */
  background-color: var(--bg);
  /* The overscroll gutter is the one strip where iOS shows the page colour with
     nothing over it — there is nothing worth bouncing at the ends of these
     pages. */
  overscroll-behavior-y: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: var(--weight-ui);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; background: none; border: none; font: inherit; }

/* ── Paper grain overlay ── */
/* Subtle noise texture over the entire page, matching the warm paper feel */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(42,36,29,0.18) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
  z-index: 0;
}

/* ── Primitives ── */

/* Hairline separator — 0.5px per design spec, no border-radius anywhere */
.rule {
  height: 0.5px;
  background: var(--hairline);
  width: 100%;
  border: none;
}

/* Eyebrow label — DM Sans, 9.5px, 0.32em tracking, uppercase, muted */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Inline accent color — used on the & glyph, seconds, open › */
.accent { color: var(--accent); }

/* Italic prose — Cormorant Garamond weight 300 */
.italic { font-style: italic; }

/* Hidden from the page, still measured. The story card takes its top line from
   an element that has to exist with real type on it, and the page has no reason
   to show the names a second time. */
.card-source {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Reduced motion ── */
/* Fewer and gentler, not zero. Colour and opacity still cross-fade because they
   carry the state change; anything that moves or scales lands instantly, which
   is what the transition-property allowlist below takes away. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-property: opacity, color, background-color, border-color, outline-color !important;
    transition-delay: 0ms !important;
  }
}

/*
 * forms.css — Form controls and button primitives
 *
 * All input, button, and field styles live here.
 * Used by both login.html (single input + button)
 * and settings.html (full form).
 *
 * Design rules: 0.5px borders, no border-radius, no shadows.
 */

/* ── Field wrapper ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-hint {
  font-family: var(--font-serif);
  font-size: var(--text-small);
  font-style: italic;
  color: var(--muted);
}

/* ── Text inputs ── */
/* Covers all text-like inputs used in settings and login */
.field input[type="text"],
.field input[type="date"],
.field input[type="number"],
.field input[type="password"],
.login-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--card-bg);
  border: 0.5px solid var(--hairline);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--text-ui);
  font-weight: var(--weight-serif);
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}

/* Login input is slightly larger */
.login-form input[type="password"] {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: var(--weight-ui);
  padding: 13px 16px;
}

.field input:focus,
.login-form input[type="password"]:focus { border-color: var(--accent); }

/* ── Color picker ── */
.color-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.color-field .field-label { flex: 1; min-width: 80px; }

.color-field input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 2px;
  background: var(--card-bg);
  border: 0.5px solid var(--hairline);
  cursor: pointer;
  border-radius: 0;
  -webkit-appearance: none;
}

.color-hex {
  font-family: monospace;
  font-size: 11px;
  color: var(--muted);
}

/* ── Buttons ── */

/* Primary — filled, inverted colors */
.btn-primary {
  padding: 13px 24px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: var(--text-btn);
  font-weight: var(--weight-ui);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  border-radius: 0;
  transition: opacity 150ms ease, transform 160ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { opacity: 0.8; }
}

/* The press answers every input type, and it is the only answer a phone gets
   now that the hover tint is behind the capability query. */
.btn-primary:active { transform: scale(0.97); }

/* Ghost — muted text link, no background */
.btn-ghost {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { color: var(--text); }
}

/* ── Error message ── */
.form-error {
  font-family: var(--font-serif);
  font-size: var(--text-footnote);
  font-style: italic;
  color: #b94040;
}

/*
 * layout.css — Page shell, header, hero, section nav, footer
 *
 * Structural elements shared across home.html.
 * Does not include section content — see components.css and pages/home.css.
 */

/* ── App shell ── */
.app {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  /* viewport-fit=cover lets the page reach the screen edges, so the shell pays
     the notch and the home indicator back out of its own padding. */
  padding:
    max(var(--pad-v), env(safe-area-inset-top))
    max(var(--pad-h), env(safe-area-inset-right))
    calc(80px + env(safe-area-inset-bottom))
    max(var(--pad-h), env(safe-area-inset-left));
}

/* ── Site header ── */
.site-header { margin-bottom: 12px; }
.site-header .rule { margin-top: 12px; }

/* ── Hero ── */
.hero {
  padding-top: 22px;
  margin-bottom: 22px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: var(--text-display);
  font-weight: var(--weight-display);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 14px;
}

/* The & glyph — italic, smaller, accent color, nudged up */
.hero-title .accent {
  font-style: italic;
  font-weight: var(--weight-display);
  font-size: var(--text-display-accent);
  color: var(--accent);
  position: relative;
  top: -2px;
  margin: 0 8px;
}

.hero-sub {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  font-weight: var(--weight-serif);
  font-style: italic;
  line-height: 1.35;
  color: var(--muted);
  max-width: 280px;
}

/* ── Section nav (tab switcher) ── */
/* No panel: the bar is two labels on the wash, and the only shape on it is the
   thin rounded rectangle round the one you are in. That rectangle is a single
   element (.tab-indicator) rather than a box per tab, so it can travel. */
.section-nav {
  position: relative;
  display: flex;
  gap: 28px;
  padding-top: 30px;
}

.section-tab {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  padding: 0;
  background: none;
}

.section-tab .tab-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.tab-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  background: color-mix(in srgb, var(--bg) 30%, transparent);
  pointer-events: none;
  opacity: 0;
}

.tab-indicator[data-placed] { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  /* The marker answers the click and then settles: a travel that eases *in*
     sits still for the first sixth of a second, and a tab that does not move when
     you press it reads as hesitation. 280ms is inside the UI budget the old 320ms
     broke.

     Only the travel is animated. The box has no transform equivalent while it
     carries a 1px border and a 7px radius — a scale would smear both — so it used
     to animate width and height instead, which laid the page out again on every
     frame of the move: 195 of the 215 layouts a switch used to cost. The size now
     steps once and only translate is eased; the two labels differ by a few pixels
     in width, so what the eye follows is the travel, and it is unchanged. */
  .tab-indicator {
    transition:
      transform 280ms var(--ease-out),
      opacity 140ms var(--ease-out);
  }
}

/* Without the script there is no indicator to place, so the box is drawn on the
   active tab instead. It is a fallback, not a second marker: as soon as the
   indicator reports its position the outline here goes away. */
.section-tab.active .tab-body::after {
  content: '';
  position: absolute;
  inset: -8px -11px;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--text) 20%, transparent);
  background: color-mix(in srgb, var(--bg) 30%, transparent);
  pointer-events: none;
}

.section-nav:has(.tab-indicator[data-placed]) .section-tab.active .tab-body::after {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .tab-body::after { transition: border-color 150ms ease, background-color 150ms ease; }
  .tab-label,
  .tab-sub { transition: color 150ms ease; }
}

/* The labels are real buttons, so a pointer gets an answer before the click:
   one step of ink, no movement, and only where hovering is possible. */
@media (hover: hover) and (pointer: fine) {
  .section-tab:not(.active):hover .tab-label,
  .section-tab:not(.active):hover .tab-sub {
    color: color-mix(in srgb, var(--text) 90%, transparent);
  }
}

.section-tab.active .tab-label { color: var(--text); }
.section-tab.active .tab-sub   { color: var(--accent); }

.tab-label {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 74%, transparent);
}

.tab-sub {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 74%, transparent);
}

/* ── Site footer ── */
/* The page ends here, and so does the footer: it stays out of the way until the
   bottom of the page is reached, then the share bubble and the settings link
   fade in. No strip behind them — a white bubble is its own material. */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px var(--pad-h) calc(14px + env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.site-footer.is-revealed {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .site-footer { transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out); }
}

.footer-action {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .footer-action:hover { color: var(--text); }
}

/* Settings hold the left end; the bubble keeps the right end when it is gone */
.settings-link { margin-right: auto; }

/* White bubble with the share glyph, bottom right */
.share-bubble {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 6px rgb(18 22 28 / 0.12), 0 10px 24px rgb(18 22 28 / 0.14);
}

.share-bubble svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The bubble is pressable, so the press is what answers first, everywhere; the
   lift is a pointer-only flourish and stays behind the capability query, where
   a tap cannot leave it stuck in the air. */
.share-bubble:disabled { opacity: 0.55; cursor: progress; }

@media (prefers-reduced-motion: no-preference) {
  .share-bubble { transition: transform 160ms var(--ease-out); }
}

@media (hover: hover) and (pointer: fine) {
  .share-bubble:hover { transform: translateY(-1px); }
}

.share-bubble:active { transform: scale(0.96); }

/* Settings are desktop-only; the share bubble stays on every screen */
@media (max-width: 768px) {
  .settings-link { display: none; }
}

/*
 * components.css — Reusable UI components
 *
 * Stat cards, letter list, presently ticker, empty state.
 * Each block is self-contained and makes no assumptions about
 * which page it lives on.
 */

/* ── Section header row ── */
/* Flex row with eyebrow on left, accent label on right */
.section-header {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  margin-bottom: 18px;
}

.section-header-right {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Stat grid ── */
.stat-grid {
  display: grid;
  /* Equal columns, whatever each card's caption needs: 1fr alone is
     minmax(auto, 1fr), so the wide caption of one card made its column wider
     than its neighbour's and the pair sat off centre. Every row also takes the
     height of the tallest card, so the six plates are one size. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  column-gap: 22px;
  row-gap: 28px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--card-bg);
  padding: 14px;
  min-height: 138px;
  /* The figure is sized against this box, so a four-digit number shrinks until
     it fits instead of hanging over the edge of its card. */
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  /* The number hangs from the top and the footnote sits on the bottom, so the
     figures of a row share one line whatever the caption under them does. Pushed
     up from the bottom, a card with one caption line carried its number lower
     than its neighbour's. */
  justify-content: flex-start;
  cursor: default;
  border-radius: 4px;
}

/* Big number — Cormorant Light, lining figures sit on baseline */
/* Big number — Cormorant Light, lining figures sit on baseline.
   A figure is set 0.41em wide per character in the wider of the two engines, so
   235cqi is the largest size that fits N characters into a card; dividing it by
   the widest figure in the grid gives the size every one of them fits at. The denominator is
   the grid's, not each card's: measured per card, a two-digit number kept the
   full size while the four-digit one beside it shrank, and the pair stopped
   reading as one set. */
.stat-value {
  font-family: var(--font-serif);
  font-size: min(var(--text-stat), calc(235cqi / max(var(--widest-figure, 4), 1)));
  font-weight: var(--weight-number);
  line-height: 0.85;
  letter-spacing: -0.02em;
  font-feature-settings: "lnum";
  color: var(--text);
}

/* Italic unit label below the number */
.stat-unit {
  font-family: var(--font-serif);
  font-size: var(--text-ui);
  font-weight: var(--weight-emphasis);
  font-style: italic;
  line-height: 1;
  color: var(--accent);
  margin-top: 6px;
}

/* Uppercase eyebrow below the unit */
.stat-label {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* Italic prose footnote at the bottom of the card */
.stat-footnote {
  font-family: var(--font-serif);
  font-size: var(--text-footnote);
  font-weight: var(--weight-emphasis);
  font-style: italic;
  line-height: 1.35;
  color: var(--text);
  text-wrap: pretty;
  margin-top: 8px;
}

/* ── Presently ticker ── */
.presently-row {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  padding: 14px 0 22px;
  border-top: 0.5px solid var(--hairline);
}

.presently-label {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Italic clock — seconds are wrapped in .accent by JS */
.presently-clock {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  font-weight: var(--weight-serif);
  font-style: italic;
  color: var(--muted);
}
.presently-clock .accent { color: var(--accent); }

/* ── Letter list ── */
.letter-list {
  list-style: none;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
}

.letter-item                { border-bottom: 0.5px solid var(--hairline); }
.letter-item:first-child    { border-top:    0.5px solid var(--hairline); }

.letter-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  transition: opacity 150ms var(--ease-out);
}
.letter-link:active { opacity: 0.5; }

.letter-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.letter-date {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

.letter-motive {
  font-family: var(--font-sans);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-ui);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

.letter-name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: var(--weight-emphasis);
  font-style: italic;
  line-height: 1.1;
  color: var(--text);
  margin-top: 3px;
}

/* The › open glyph on the right */
.letter-open {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  font-style: italic;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Empty state ── */
.empty-text {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  font-weight: var(--weight-serif);
  font-style: italic;
  color: var(--muted);
  padding: 32px 0;
  text-align: center;
}

/*
 * pages/login.css — Login page layout
 *
 * Full-viewport centered card.
 * Inputs and buttons come from forms.css.
 * Hero title styling reuses the same token scale as layout.css.
 */

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-h);
}

.login-card {
  width: 100%;
  max-width: var(--max-w);
}

.login-eyebrow { margin-bottom: 12px; }

.login-title {
  font-family: var(--font-serif);
  font-size: var(--text-display);
  font-weight: var(--weight-display);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

.login-title .accent {
  font-style: italic;
  font-weight: var(--weight-display);
  font-size: var(--text-display-accent);
  color: var(--accent);
  position: relative;
  top: -2px;
  margin: 0 8px;
}

.login-sub {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  font-weight: var(--weight-serif);
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 280px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/*
 * glass.css — Frosted glass over a photo wallpaper (home page)
 *
 * A photo from static/backgrounds/ is drawn full-bleed, blurred into a
 * colour wash, and the UI sits on translucent materials on top of it.
 *
 * Porcelain palette: white glass, the shipped blue accent #456087.
 *
 * Contrast is sampled, not bounded. At the shipped --glass-tint-a of 0.45 the
 * photo supplies most of the background: a pure black pixel would sink muted
 * text to 1.72:1 and no photo is anywhere near that dark. The check is a pixel
 * audit — every text node sampled against the wallpaper it was rendered over.
 * Across the five photos the worst measured margin is 4.09:1 on the 56px
 * ampersand and 4.70:1 on 18px body text, so the palette splits: colour on the
 * materials, near-black (--muted-photo) on the open photo. See CLAUDE.md.
 *
 * Only the section bar, the footer and the tuning panel frost. The cards and
 * the letter list sit on a wash that is already blurred, so blurring it again
 * would add layers without changing a pixel.
 *
 * Two knobs are exposed as variables so they can be tuned live with
 * ?tune=1 — --glass-tint-a (how much photo comes through the frost) and
 * --glass-radius (corner radius of every material).
 */

html.glass {
  --bg:           #FFFFFF;
  --text:         #12161C;
  --muted:        #4A5058;
  --accent:       #2F4B73;   /* small accent text on a material */
  --accent-brand: #456087;   /* the shipped blue, kept for material surfaces */
  --card-bg:      rgb(255 255 255 / 0.62);
  /* The plate: the two surfaces that carry text on the home page, the stat cards
     and the letter list. They are one material, so they are one value. */
  --glass-plate:  rgb(255 255 255 / 0.86);
  --glass-tint:   #FFFFFF;
  --glass-tint-a: 0.45;
  --glass-radius: 8px;
  --glass-nav:    rgb(255 255 255 / 0.62);
  --glass-edge:   rgb(255 255 255 / 0.72);
  --glass-shadow: 0 1px 1px rgb(18 22 28 / 0.05), 0 10px 30px rgb(18 22 28 / 0.10);

  /* At 0.45 the photo supplies most of the background, so anything drawn
     directly on it has to be near-black: there is no room left for a
     lighter secondary tone or for a blue that is not near-black as well.
     Colour therefore lives on the materials, not on the wallpaper. */
  --muted-photo:  #1A1F25;
  --accent-photo: #22374F;

  /* Hairlines need more presence over a photo than over flat paper */
  --hairline: color-mix(in srgb, var(--text) 45%, transparent);

  background: var(--bg);
}

/* ── Wallpaper ── */
/* Fixed, so scrolling never re-blurs the photo; the blur is computed once */

.wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* The wash is baked into the file: the photos in static/backgrounds/ are
   already blurred, desaturated-then-retinted by ffmpeg. A live filter over a
   fixed, oversized layer is re-evaluated with the scroll and was the single
   biggest cost on a phone — this layer is now a plain image and costs nothing
   to scroll past. */
.wall-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.wall-tint {
  position: absolute;
  inset: 0;
  background: var(--glass-tint);
  opacity: var(--glass-tint-a);
}

/* Paper grain belongs to the paper design, not to glass */
body::before { display: none; }

/* ── Materials ── */

/* The cards sit on the wash, which is already blurred, so frosting them again
   blurred a blurred image: no visible gain, and nine extra blurred layers to
   composite. They keep the fill, the edge and the shadow. */
html.glass .stat-card {
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  padding: 18px 14px;
  background: var(--glass-plate);
}

/* Visible keyboard focus on glass, where a 1px edge is not enough */
html.glass :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* The footer has no strip of its own: it sits on the photo at the very bottom,
   so its one line of text takes the on-photo tone. */
html.glass .footer-action { color: var(--muted-photo); }
html.glass .footer-action:hover { color: var(--text); }

/* The bar has no rule above or below it: the panel carries its own edge, and a
   hairline bracketing a rounded panel read as a stray line. */

html.glass .hero-title .accent { color: var(--accent-photo); }

/* ── Text on the open wallpaper ── */
/* Only the masthead and the hero sit straight on the photo; everything else
   lives on a material, where the full palette is safe. The footer is a material
   (94% tint), so its actions use --muted like any other text on glass. */

html.glass .eyebrow   { color: var(--muted-photo); }
html.glass .hero-sub  { color: var(--muted-photo); }
html.glass .empty-text { color: var(--muted-photo); }

/* The letter list is the one long block of small text on the page, and it is the
   same plate as a stat card: same fill, same radius, same shadow. It keeps an
   edge of its own because the panel is a single large surface, where a card in a
   grid has its neighbours to define it. The panel supplies the outer edges, so
   the list drops its own first and last rules and the closing rule below it. */
html.glass .letter-list {
  padding: 6px 16px;
  border: 1px solid var(--glass-edge);
  border-radius: var(--glass-radius);
  background: var(--glass-plate);
  box-shadow: var(--glass-shadow);
}

html.glass .letter-item:first-child { border-top: none; }
html.glass .letter-item:last-child  { border-bottom: none; }
html.glass #section-cartas > .rule  { display: none; }

/* ── Login: the same materials with nothing behind them ── */
/* The login page has no wallpaper, so the page is plain white and the card has
   to carry its own elevation. The material becomes a tint plus a hairline plus
   the same shadow instead of a frost, and the palette that only worked on a
   photo (--muted-photo, --accent-photo) is not used here: on a light surface
   the ordinary ink and accent have all the room they need. */

html.glass.glass-plain {
  --glass-panel:  color-mix(in srgb, var(--text) 3%, #fff);
  --glass-edge:   color-mix(in srgb, var(--text) 9%, transparent);
  --glass-shadow: 0 1px 1px rgb(18 22 28 / 0.04), 0 14px 36px rgb(18 22 28 / 0.09);
  --hairline:     color-mix(in srgb, var(--text) 16%, transparent);
}

html.glass.glass-plain .login-card {
  background: var(--glass-panel);
  border: 1px solid var(--glass-edge);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  padding: 32px 28px 34px;
}

/* The field sits on the panel, so it goes back to the page colour to read as
   an input rather than as another raised surface. */
html.glass.glass-plain .login-form input[type="password"] {
  background: var(--bg);
  border-color: var(--hairline);
}

html.glass.glass-plain .login-eyebrow,
html.glass.glass-plain .login-sub { color: var(--muted); }

/* ── Tuning panel (?tune=1) ── */
/* Sits at the bottom, in thumb reach, and is part of the same material
   system: it frosts, it rounds with the cards, it never touches content. */

html.glass .tune {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 20;
  width: min(100% - 32px, 480px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px 14px;
  border: 1px solid var(--glass-edge);
  border-radius: var(--glass-radius);
  background: color-mix(in srgb, var(--glass-tint) 88%, transparent);
  box-shadow: 0 1px 1px rgb(18 22 28 / 0.05), 0 14px 40px rgb(18 22 28 / 0.18);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  backdrop-filter: blur(28px) saturate(160%);
  font-family: var(--font-sans);
  color: var(--muted);
}

.tune-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 12px;
  padding-top: 6px;
}

.tune-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.tune-value {
  grid-column: 2;
  grid-row: 1;
  font-size: 10px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}

.tune input[type="range"] {
  grid-column: 1 / -1;
  grid-row: 2;
}

.tune-note {
  padding-top: 8px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.tune-note.warn { color: #9A3B2E; }

.tune input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: none;
  border: none;
  padding: 0;
}

.tune input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--text) 22%, transparent);
}

.tune input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10.5px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid rgb(18 22 28 / 0.14);
  box-shadow: 0 1px 4px rgb(18 22 28 / 0.28);
}

.tune input[type="range"]:focus-visible { outline-offset: 6px; }

/* Room for the panel, and no fixed footer competing at the same edge */
html.glass.is-tuning .app         { padding-bottom: 200px; }
html.glass.is-tuning .site-footer { display: none; }

/* ── Motion ── */
/* Section switching is animated by the panels container in pages/home.css; the
   letter rows answer a press with a small, deliberate scale. */

html.glass .letter-link { transition: opacity 0.15s ease-out, transform 0.15s ease-out; }
html.glass .letter-link:active { transform: scale(0.995); }

/* ── Accessibility ── */

@media (prefers-reduced-transparency: reduce) {
  .wall-photo { display: none; }
  .wall-tint  { opacity: 1; }
  html.glass .stat-card,
  html.glass .letter-list,
  html.glass .site-footer,
  html.glass .tune {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  html.glass .stat-card,
  html.glass .letter-list,
  html.glass .site-footer,
  html.glass .tune { background: var(--glass-tint); }
}

@media (prefers-contrast: more) {
  .wall-tint { opacity: 1; }
  html.glass .stat-card,
  html.glass .letter-list,
  html.glass .site-footer,
  html.glass .tune {
    background: var(--glass-tint);
    border-color: var(--text);
  }
  html.glass .stat-card {
    border: 1px solid var(--text);
  }
}

/* One name per collection: the class is on the card and on the plate it opens. */
.card-games { view-transition-name: games-card; }
.card-trips { view-transition-name: trips-card; }

/* ── The plate that crosses screens ── */
/* Option A (Desvanecido limpio), as tapped in the preview: simultaneous, not
   sequential. Both screens move at once for 380ms, in `ease` — the curve the
   preview used, not --ease-out. The old screen fades out while scaling to
   .985 and sliding up 8px; the new screen fades in while sliding up from
   20px. Nothing travels between them as a shared element: the group and
   image-pair animations are turned off, same as reduced motion already did.
   The timing is here rather than on either page because these rules are read
   from the document being navigated *to*, and the trip happens in both
   directions. The shelf itself staggers in collection.css, so the whole
   entrance runs ~685ms for six trips and ~850ms for nine games. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(games-card),
  ::view-transition-group(trips-card),
  ::view-transition-group(root),
  ::view-transition-image-pair(games-card),
  ::view-transition-image-pair(trips-card),
  ::view-transition-image-pair(root) {
    animation: none;
  }

  ::view-transition-old(games-card),
  ::view-transition-old(trips-card),
  ::view-transition-old(root) { animation: 380ms ease both vt-out-a; }
  ::view-transition-new(games-card),
  ::view-transition-new(trips-card),
  ::view-transition-new(root) { animation: 380ms ease both vt-in-a; }
}

/* Reduced motion still gets the doorway, as a dissolve: the two snapshots fade
   into each other and nothing travels. The group animation is what carries the
   move, so it is turned off rather than shortened. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(games-card),
  ::view-transition-group(trips-card),
  ::view-transition-group(root),
  ::view-transition-image-pair(games-card),
  ::view-transition-image-pair(trips-card),
  ::view-transition-image-pair(root) {
    animation: none;
  }
  ::view-transition-old(games-card),
  ::view-transition-old(trips-card),
  ::view-transition-new(games-card),
  ::view-transition-new(trips-card),
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: 140ms linear both vt-fade-out;
  }
  ::view-transition-new(games-card),
  ::view-transition-new(trips-card),
  ::view-transition-new(root) {
    animation-name: vt-fade-in;
  }
}

@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in  { from { opacity: 0; } }
/* Option A: the old screen scales to .985 and slides up 8px as it fades; the
   new screen slides up from 20px as it fades in. Both run 380ms, at once. */
@keyframes vt-out-a { to { opacity: 0; transform: scale(.985) translateY(-8px); } }
@keyframes vt-in-a  { from { opacity: 0; transform: translateY(20px); } }

