/* Shared styles for all pages: fonts, colour tokens, base type, page column, top bar.
   Page-specific rules stay in the <style> block of each page. */

/* Fonts: self-hosted, latin subset only. Licence: SIL OFL 1.1, see fonts/OFL-*.txt. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(fonts/archivo-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/atkinson-hyperlegible-400-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/atkinson-hyperlegible-400-italic-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/atkinson-hyperlegible-700-latin.woff2) format("woff2");
}

/* Tokens */
:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --ink: #15202b;
  --muted: #586675;
  --line: #d6dee5;
  --accent: #1d5a9e;
  --accent-soft: #e2ebf6;
  --bench: #97a6b4;
  --bad: #a3221b;
  --bad-bg: #fbe2df;
  --warn: #7c5200;
  --warn-bg: #fcefd2;
  --group-bg: #eef2f5;
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141a; --surface: #161f28; --ink: #e5ebf0; --muted: #9aa8b5; --line: #2a3644;
    --accent: #80b2ec; --accent-soft: #1b2c40; --bench: #5d6d7c;
    --bad: #ff9d93; --bad-bg: #4b1915; --warn: #f1c46a; --warn-bg: #3c2c0d; --group-bg: #1b252f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e141a; --surface: #161f28; --ink: #e5ebf0; --muted: #9aa8b5; --line: #2a3644;
  --accent: #80b2ec; --accent-soft: #1b2c40; --bench: #5d6d7c;
  --bad: #ff9d93; --bad-bg: #4b1915; --warn: #f1c46a; --warn-bg: #3c2c0d; --group-bg: #1b252f;
  color-scheme: dark;
}

/* Base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.65rem); font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Page column. Add "narrow" for a reading page. */
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-block: 20px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 40px;
}
.wrap.narrow { max-width: 680px; gap: 32px; }

/* Top bar: eyebrow or back link, then the language switch */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-family: var(--font-display); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.back { font: 600 0.9rem var(--font-display); text-decoration: none; }
.back:hover { text-decoration: underline; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.lang button {
  border: 0; background: transparent; color: var(--muted); font: 600 0.85rem var(--font-display);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 36px;
}
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }

footer { font-size: 0.82rem; color: var(--muted); }
