/* Base layer (PLAN.md §3.5). WP0 owns this file. Page packages use these classes and never redefine them:
   reset; .container .stack .cluster .grid-auto .visually-hidden .skip-link .dev-banner .prose .themed;
   [data-user-text]; :focus-visible; @view-transition. Colours are tokens.css's semantic ones, so a page follows the light or dark
   scheme (color-scheme is set there too, with the scheme). */

/* ── Reset ─────────────────────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  hanging-punctuation: first last;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--step-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, picture, video, canvas { display: block; max-width: 100%; }
svg { max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
textarea { resize: vertical; }
p, h1, h2, h3, h4, h5, h6, li, dd, blockquote { overflow-wrap: break-word; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; text-wrap: balance; font-weight: 700; }
h1 { font-size: var(--step-l); letter-spacing: -0.02em; }
h2 { font-size: var(--step-h2); letter-spacing: -0.01em; }
h3 { font-size: var(--step-h3); }
p { text-wrap: pretty; }
small { font-size: var(--step-small); }
a { color: var(--accent-ink); text-underline-offset: .18em; text-decoration-thickness: from-font; }
a:hover { text-decoration-thickness: 2px; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line); }
::selection { background: color-mix(in srgb, var(--candle) 40%, transparent); color: var(--text); }
[hidden] { display: none !important; }
main:focus { outline: none; }

/* ── Accessibility ─────────────────────────────────────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
/* the sticky site header (chrome.css) never covers what focus or an anchor scrolls to, Shift+Tab included (WCAG 2.4.11) */
:root:has(> body > .site-header) { scroll-padding-top: calc(var(--header-h) + 12px); }
:focus:not(:focus-visible) { outline: none; }
[data-user-text] { unicode-bidi: isolate; overflow-wrap: anywhere; }

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

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  inset-block-start: var(--space-3);
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--candle);
  color: var(--night-900);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-2) var(--ease-out);
}
.skip-link:focus, .skip-link:focus-visible { transform: none; }

/* ── Layout primitives ─────────────────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  /* viewport-fit=cover (Layout): a notched phone on its side keeps the copy clear of the sensor housing (0 everywhere else) */
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-4)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--space-3)); }
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--grid-min, 240px), 100%), 1fr));
  gap: var(--grid-gap, var(--space-5));
}

/* ── Theming (§3.4: themeVars() emits the --t-* variables) ─────────────────────────────────────────── */
.themed { background: var(--t-background); color: var(--t-text); }

/* ── Dev banner ────────────────────────────────────────────────────────────────────────────────────── */
.dev-banner {
  position: relative;
  z-index: var(--z-hud);
  padding: var(--space-1) var(--gutter);
  background: repeating-linear-gradient(-45deg, var(--night-700) 0 10px, var(--night-800) 10px 20px);
  color: var(--candle);
  font: 700 var(--step-small)/1.6 var(--font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
}

/* ── Long-form text (about, terms, privacy, guidelines) ────────────────────────────────────────────── */
.prose { max-width: 68ch; color: var(--text-2); }
.prose > * + * { margin-block-start: 1em; }
.prose h1, .prose h2, .prose h3 { color: var(--text); }
.prose h2 { margin-block-start: 1.8em; font-size: var(--step-h3); }
.prose h3 { margin-block-start: 1.4em; font-size: 1.125rem; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li + li { margin-block-start: .4em; }
.prose strong { color: var(--text); }
.prose code { font-size: .9em; padding: .1em .35em; border-radius: 6px; background: var(--surface); }

/* ── View transitions and reduced motion (§3.6) ────────────────────────────────────────────────────── */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
@media (forced-colors: active) {
  canvas[aria-hidden="true"] { display: none; }
}
