/* Linen · the tokens and base rules every page shares (app.css: home, legal, 404; order.css: the
   order page; consent.css and a11y.css read the same names). Colours follow html[data-palette]
   (home.js / shop.js). The CSP allows no inline styles. */

/* The planner's faces, subset to the site's scripts (scripts/build_site_fonts.py). */
@font-face {
  font-family: "Assistant";
  src: url("/fonts/assistant.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Frank Ruhl Libre";
  src: url("/fonts/frank.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Palettes: the planner's own, in OKLCH ------------------------------------------------ */
:root,
html[data-palette="sunrise"] {
  --color-paper: oklch(95.3% 0.010 87);
  --color-paper-2: oklch(91.4% 0.017 85);
  --color-paper-3: oklch(97.3% 0.007 89);
  --color-field: oklch(90.9% 0.033 55);
  --color-ink: oklch(27.6% 0.008 59);
  --color-ink-2: oklch(36% 0.009 62);
  --color-muted: oklch(46.3% 0.010 68);
  --color-rule: oklch(86.1% 0.019 78);
  --color-stroke: oklch(62% 0.016 76);
  --color-accent: oklch(50.1% 0.128 44);
  --color-accent-ink: oklch(98% 0.009 85);
  --color-focus: oklch(52% 0.18 44);
}
html[data-palette="magenta"] {
  --color-paper: oklch(96.8% 0.011 107);
  --color-paper-2: oklch(93.4% 0.015 107);
  --color-paper-3: oklch(98.4% 0.007 107);
  --color-field: oklch(91.3% 0.036 349);
  --color-ink: oklch(22.8% 0.008 334);
  --color-ink-2: oklch(33% 0.008 334);
  --color-muted: oklch(44.5% 0.006 17);
  --color-rule: oklch(87.3% 0.011 90);
  --color-stroke: oklch(62% 0.012 90);
  --color-accent: oklch(52.8% 0.221 349);
  --color-accent-ink: oklch(98.2% 0.008 337);
  --color-focus: oklch(52.8% 0.2 349);
}
html[data-palette="cold"] {
  --color-paper: oklch(94.2% 0.024 86);
  --color-paper-2: oklch(90.3% 0.028 84);
  --color-paper-3: oklch(96.5% 0.014 85);
  --color-field: oklch(88.1% 0.033 303);
  --color-ink: oklch(24.8% 0.023 296);
  --color-ink-2: oklch(34% 0.02 296);
  --color-muted: oklch(41.9% 0.013 311);
  --color-rule: oklch(85% 0.025 86);
  --color-stroke: oklch(61% 0.022 85);
  --color-accent: oklch(50.4% 0.22 293);
  --color-accent-ink: oklch(97.3% 0.015 303);
  --color-focus: oklch(50.4% 0.2 293);
}

/* Type, space, motion, and the colours that do not follow the palette ---------------- */
:root {
  color-scheme: light;
  --font-display: "Frank Ruhl Libre", Georgia, serif;
  --font-body: "Assistant", system-ui, sans-serif;
  --font-wordmark: "Instrument Serif", Georgia, serif;
  --font-readable: Arial, Helvetica, sans-serif;
  --display-weight: 300;
  --weight-strong: 700;
  --tracking-display: -0.015em;

  --space-3xs: 2px; --space-2xs: 4px; --space-xs: 8px; --space-sm: 12px; --space-md: 16px; --space-lg: 24px;
  --space-xl: 40px; --space-2xl: 64px; --space-3xl: 96px; --space-4xl: 144px;
  --text-xs: 0.8125rem; --text-sm: 0.9375rem; --text-md: 1.0625rem; --text-lg: 1.25rem; --text-xl: 1.5625rem;
  --text-display-s: clamp(2.25rem, 4vw + 0.5rem, 3.75rem);
  --text-display: clamp(2.75rem, 5vw + 1rem, 5.25rem);
  --text-section: clamp(2rem, 2.5vw + 1rem, 3.5rem);
  --text-title: clamp(1.25rem, 0.75vw + 0.875rem, 1.625rem);
  --text-lead: clamp(1.125rem, 0.35vw + 1rem, 1.375rem);
  --text-wordmark: clamp(4.5rem, 11vw, 10rem);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-micro: 120ms; --dur-short: 220ms; --dur-long: 420ms; --dur-palette: 600ms;

  --container: 1440px; --gutter: 64px; --gap-columns: 32px;
  --section-gap-s: 120px; --section-gap: 144px; --section-gap-l: 176px;
  --z-base: 1; --z-raised: 10; --z-dropdown: 100; --z-sticky: 200; --z-sticky-nav: 300; --z-modal: 400; --z-toast: 500; --z-tooltip: 600;

  --radius-card: 4px; --radius-field: 2px; --radius-pill: 999px; --radius-device: 28px; --radius-screen: 6px;
  --rule-hair: 1px;
  --shadow-card: 0 1px 2px oklch(20% 0.01 70 / 0.08);
  --shadow-float: 0 12px 32px -16px oklch(20% 0.01 70 / 0.4);
  /* The iPad's frame: one graphite for every palette, so the page inside carries the colour. */
  --color-device: oklch(25% 0.004 70);
  --color-device-edge: oklch(38% 0.004 70);
  /* Form underlines: about 3.5:1 against the paper (WCAG 1.4.11 asks 3:1 for controls). */
  --color-field-line: color-mix(in oklab, var(--color-ink) 55%, var(--color-paper));
  --color-scrim: color-mix(in oklab, var(--color-ink) 45%, transparent);

  /* The accessibility widget's modes (a11y.css). High contrast is the visitor's own choice of
     pure black and white, so these stay absolute. */
  --a11y-mark: oklch(45% 0.2 27);
  --a11y-hc-paper: #000;
  --a11y-hc-ink: #fff;
  --a11y-hc-link: #ff0;
  --a11y-hc-mark: oklch(68% 0.2 25);
  --a11y-hc-placeholder: oklch(87% 0.005 90);
  --a11y-link-ring: oklch(62% 0.18 255);
}
@media (max-width: 60rem) { :root { --gutter: 24px; --section-gap-s: 80px; --section-gap: 96px; --section-gap-l: 120px; --radius-device: 20px; } }
@media (max-width: 40rem) { :root { --gutter: 16px; --section-gap-s: 56px; --section-gap: 72px; --section-gap-l: 96px; --gap-columns: 16px; --radius-device: 14px; } }

/* Base: what the Floor already decided, shared by every page -------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--color-muted) var(--color-paper); scroll-padding-top: var(--space-3xl); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--color-accent);
  transition: background-color var(--dur-palette) var(--ease-in-out), color var(--dur-palette) var(--ease-in-out);
}
::selection { background: color-mix(in oklab, var(--color-accent) 22%, transparent); color: var(--color-ink); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a, button, label, summary, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-synthesis: none;
  letter-spacing: var(--tracking-display);
  line-height: 1.08;
  overflow-wrap: break-word;
  min-width: 0;
  text-wrap: balance;
}
h1 { max-width: 20ch; font-size: var(--text-display); }
h2 { max-width: 30ch; font-size: var(--text-section); }
h3 { max-width: 40ch; font-size: var(--text-title); line-height: 1.2; }
p { margin: 0; text-wrap: pretty; }
p:not([class]) { max-width: 65ch; }
li, dd { text-wrap: pretty; }
img, video { max-width: 100%; height: auto; display: block; }
svg { display: block; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.num, .price, .tabular { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The Latin brand words (Linen, Sunrise, Magenta, Cold) keep the page's body face; only the
   wordmark takes Instrument Serif. */
.wordmark { font-family: var(--font-wordmark); font-style: italic; font-weight: 400; font-synthesis: none; line-height: 1; text-decoration: none; }

.skip-link {
  position: fixed; top: var(--space-sm); inset-inline-start: var(--space-sm); z-index: var(--z-tooltip);
  padding: var(--space-sm) var(--space-lg); border-radius: var(--radius-pill);
  background: var(--color-ink); color: var(--color-paper); text-decoration: none;
  transform: translateY(-160%); transition: transform var(--dur-short) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* The paper's grain, the planner's own texture. */
.grain {
  position: fixed; inset: 0; z-index: var(--z-dropdown); pointer-events: none;
  background-image: url("/grain.png"); background-size: 128px 128px;
  opacity: 0.5; mix-blend-mode: multiply;
}

/* The banner from the live settings (live.js). Hidden until the owner turns it on. */
.site-banner { padding: var(--space-xs) var(--space-md); text-align: center; background: var(--color-paper-2); color: var(--color-ink); border-bottom: var(--rule-hair) solid var(--color-stroke); font-size: var(--text-sm); }
.site-banner.is-warn { border-bottom-color: var(--color-accent); }

.hint { font-size: var(--text-sm); color: var(--color-muted); margin: var(--space-xs) 0 0; max-width: 60ch; }
.hint:empty { display: none; }
.error { color: var(--color-accent); }
.muted { color: var(--color-muted); }

/* Controls: one shape, fully round. The filled one is the page's action. ------------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: 52px; padding: 0 var(--space-xl);
  border: var(--rule-hair) solid var(--color-ink); border-radius: var(--radius-pill);
  background: transparent; color: var(--color-ink);
  font: inherit; font-size: var(--text-md); font-weight: 400; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.pill:hover { background: var(--color-paper-2); }
.pill:active:not(:disabled) { transform: translateY(1px); }
.pill-solid { background: var(--color-ink); color: var(--color-paper); }
.pill-solid:hover { background: var(--color-ink-2); color: var(--color-paper); }
.pill-wide { width: 100%; }
.pill:disabled, .pill[aria-disabled="true"] {
  opacity: 0.55; cursor: not-allowed; transform: none;
  background: var(--color-paper-2); color: var(--color-muted); border-color: var(--color-stroke);
}
.pill[aria-busy="true"] { cursor: progress; }
.quiet-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0;
  background: none; border: 0; font: inherit; font-size: var(--text-sm); color: var(--color-ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em; cursor: pointer;
  transition: color var(--dur-short) var(--ease-out);
}
.quiet-link:hover { color: var(--color-accent); }
.quiet-link:active { color: var(--color-muted); }

/* The iPad: one frame a page, the planner's real page inside --------------------------- */
.device {
  margin: 0;
  padding: var(--space-md);
  border-radius: var(--radius-device);
  background: var(--color-device);
  box-shadow: inset 0 0 0 1px var(--color-device-edge), var(--shadow-float);
}
.device-screen { position: relative; overflow: hidden; border-radius: var(--radius-screen); background: var(--color-paper); }
.device-screen > img { width: 100%; height: auto; }
@media (max-width: 40rem) { .device { padding: var(--space-xs); } }

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