/* Dune Scholars site styles. Plain CSS, no build step.
   Layout: single 1100px column; header and footer shared by every page.
   Logical properties (inline/block) are used throughout so an Arabic, right-to-left
   version only needs <html lang="ar" dir="rtl">.
   Order: tokens, base, layout, header, buttons, hero, sections, components, page-specific
   blocks, then print. Values and contrast are documented in DESIGN.md. */

/* ---------- Tokens ---------- */
/* "Scholar + tech": deep navy, cream and scholar gold. Roles, not colour names.
   Light mode = cream canvas, navy header/footer, gold for buttons and highlights.
   Dark mode  = navy canvas, slate panels, gold highlights. */
:root {
  /* brand palette (use the role tokens below in components) */
  --navy: #0B1B3D;
  --slate: #13264D;
  --slate-2: #22345C;       /* tag and icon fills on navy */
  --slate-line: #2C3D66;
  --gold: #C9A24A;
  --cream: #F5ECD7;
  --sand: #D8CDB4;          /* secondary text on navy */

  --bg: var(--cream);       /* parchment canvas */
  --surface: #FFFAEE;       /* cards, form panels */
  --ink: var(--navy);       /* body text, outline buttons */
  --heading: var(--navy);
  --muted: #544E40;         /* secondary text (7.0:1 on parchment) */
  --line: #DFD1B1;          /* borders, dividers (decorative) */
  --field-line: #7F745C;    /* form field borders (3.9:1) */
  --accent: var(--gold);    /* buttons, highlights, markers (never small text on parchment) */
  --accent-soft: #EBDDB8;   /* tag and icon backgrounds, hovers */
  --on-accent: var(--navy); /* text on --accent (7.1:1) */
  --link: #6F5518;          /* bronze: links and status tags (5.9:1) */
  --eyebrow: #6F5518;       /* small uppercase labels */
  --focus: var(--navy);     /* focus ring on light backgrounds */
  --chrome: var(--navy);    /* header and footer */
  --chrome-ink: var(--cream);
  --chrome-muted: var(--sand);
  --chrome-line: #22314F;
  --panel: var(--navy);     /* call-to-action box */
  --panel-ink: var(--cream);
  --badge: var(--navy);
  --on-badge: var(--cream);
  --sky: #EFE4C9;           /* soft fill behind pictures and video posters */
  --card-line: #D9C592;     /* thin gold-tinted card borders (decorative) */
  --contour-1: #E6DCC6; --contour-2: #D9C69B; --contour-3: var(--gold); --contour-4: #8C6A2E; /* scene lines, stars */
  --glow: rgba(201, 162, 74, 0.28);
  --pattern-opacity: .2;    /* star pattern over navy */
  --band: var(--navy);      /* inner page-head band */
  --band-edge: transparent; /* hairline along the band's dune edge (gold in dark mode) */
  /* motion */
  --ease-calm: cubic-bezier(.2, .7, .2, 1);
  --lift-shadow: 0 14px 28px -20px rgba(11, 27, 61, .55);   /* soft shadow under a lifted card (light mode) */
  --shape-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0l2.6 9.4L24 12l-9.4 2.6L12 24l-2.6-9.4L0 12l9.4-2.6z' fill='%23C9A24A'/%3E%3C/svg%3E");
  --shape-ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Ccircle cx='24' cy='24' r='21' fill='none' stroke='%23C9A24A' stroke-width='1.5'/%3E%3Ccircle cx='24' cy='3' r='2.5' fill='%23C9A24A'/%3E%3C/svg%3E");
  --shape-block: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect x='2' y='2' width='36' height='36' rx='8' fill='none' stroke='%23F5ECD7' stroke-width='2.5'/%3E%3C/svg%3E");
  --shape-halo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='100' cy='100' r='98' fill='none' stroke='%23C9A24A' stroke-width='1.2' stroke-dasharray='1 9' stroke-linecap='round'/%3E%3C/svg%3E");

  /* type */
  --f-display: 'Cinzel', 'Readex Pro', 'IBM Plex Sans Arabic', Georgia, serif; /* h1, h2, wordmark; Readex Pro covers Arabic */
  --f-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;  /* labels, tags, badges */
  --f-body: 'IBM Plex Sans', 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-body: 1.0625rem;
  --fs-h1: clamp(2.2rem, 6vw, 3.6rem);
  --fs-hero: clamp(2rem, 4.4vw, 3.05rem); /* home headline: 3 lines at 1280, 4 at 390 */
  --fs-h2: clamp(1.6rem, 3.6vw, 2.2rem);
  --fs-h3: 1.25rem;
  --fs-lede: 1.15rem;
  --fs-small: 0.88rem;
  --fs-eyebrow: 0.78rem;
  --fs-label: 0.75rem;      /* mono labels, tags, badges: never smaller */

  /* space and shape */
  --space-section: clamp(40px, 7vw, 72px);
  --space-head: clamp(24px, 4vw, 40px);
  --gap-s: 8px;
  --gap-m: 14px;
  --gap-l: 20px;
  --gap-xl: 32px;
  --gutter: 16px;
  --content: 1100px;
  --radius: 14px;
  --radius-s: 10px;
  --pill: 999px;
  --pattern-size: 360px 380px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--navy);
    --surface: var(--slate);
    --ink: var(--cream);
    --heading: var(--cream);
    --muted: #C9C0A8;
    --line: var(--slate-line);
    --field-line: #8A9A9A;
    --accent-soft: #2A2F3E;
    --link: var(--gold);
    --eyebrow: var(--gold);
    --focus: var(--gold);
    --chrome: var(--slate);
    --chrome-muted: #C9C0A8;
    --chrome-line: var(--slate-line);
    --panel: var(--slate);
    --badge: var(--cream);
    --on-badge: var(--navy);
    --sky: #0E2147;
    --card-line: rgba(201, 162, 74, 0.3);
    --contour-1: var(--slate-2); --contour-2: var(--slate-line); --contour-3: #6B5628; --contour-4: var(--gold);
    --band: var(--slate);
    --band-edge: var(--gold);
    --lift-shadow: 0 0 0 1px rgba(201, 162, 74, .4), 0 0 24px rgba(201, 162, 74, .16); /* the existing card glow */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--navy);
  --surface: var(--slate);
  --ink: var(--cream);
  --heading: var(--cream);
  --muted: #C9C0A8;
  --line: var(--slate-line);
  --field-line: #8A9A9A;
  --accent-soft: #2A2F3E;
  --link: var(--gold);
  --eyebrow: var(--gold);
  --focus: var(--gold);
  --chrome: var(--slate);
  --chrome-muted: #C9C0A8;
  --chrome-line: var(--slate-line);
  --panel: var(--slate);
  --badge: var(--cream);
  --on-badge: var(--navy);
  --sky: #0E2147;
  --card-line: rgba(201, 162, 74, 0.3);
  --contour-1: var(--slate-2); --contour-2: var(--slate-line); --contour-3: #6B5628; --contour-4: var(--gold);
  --band: var(--slate);
  --band-edge: var(--gold);
  --lift-shadow: 0 0 0 1px rgba(201, 162, 74, .4), 0 0 24px rgba(201, 162, 74, .16); /* the existing card glow */
  color-scheme: dark;
}
/* Navy blocks (home hero, game doors, inner page-head band): navy in both modes, as on the brand artwork. */
.hero, .door, .page-band {
  --sky: var(--navy); --surface: var(--slate); --line: var(--slate-line);
  --heading: var(--cream); --ink: var(--cream); --muted: var(--sand);
  --accent: var(--gold); --on-accent: var(--navy); --accent-soft: var(--slate-2);
  --eyebrow: var(--gold); --link: var(--gold); --focus: var(--gold);
  --contour-1: var(--slate-2); --contour-2: var(--slate-line); --contour-3: #6B5628; --contour-4: var(--gold);
  color: var(--cream);
}
/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: var(--fs-body); line-height: 1.6;
}
:lang(ar) body, body:lang(ar) { line-height: 1.8; }
main { flex: 1 0 auto; }
img, svg { max-width: 100%; display: block; }
picture > source { display: none; } /* a <picture> shown as display: contents must not add empty flex or grid items */
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { color: var(--heading); font-family: var(--f-display); font-weight: 700; line-height: 1.15; letter-spacing: 0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-family: var(--f-body); font-size: var(--fs-h3); font-weight: 600; letter-spacing: normal; }
p { margin: 0; }
/* The hidden attribute must always win over component display rules (form steps, app blocks, buttons). */
[hidden] { display: none !important; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 16px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus-visible { outline-color: var(--accent); }
.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; }
/* ---------- Layout and text helpers ---------- */
.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));
}
/* Mono labels: eyebrows, tags, badges, the "soon" label. Uppercase, never under 12px. */
.eyebrow, .tag, .badge, .lang small { font-family: var(--f-mono); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.eyebrow { font-size: var(--fs-eyebrow); letter-spacing: 0.1em; color: var(--eyebrow); }
.eyebrow a { color: inherit; }
.lede { color: var(--muted); font-size: var(--fs-lede); max-width: 60ch; }
.stack { display: flex; flex-direction: column; gap: var(--gap-m); }
.stack-tight { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.hint { font-size: var(--fs-small); color: var(--muted); }
/* ---------- Header ---------- */
.site-header { background: var(--chrome); border-block-end: 2px solid var(--gold); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 14px; }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--chrome-ink); text-decoration: none; font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; }
.brand img { width: 46px; height: 46px; border-radius: 50%; flex: none; }
.brand span { font-family: var(--f-display); font-weight: 700; letter-spacing: 0.04em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.nav a { color: var(--chrome-ink); text-decoration: none; padding: 8px 12px; border-radius: var(--pill); font-weight: 500; }
.nav a:hover { background: rgba(245, 236, 215, 0.14); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.nav a:focus-visible { outline-offset: -3px; outline-color: var(--chrome-ink); }
.nav a[aria-current="page"]:focus-visible { outline-color: var(--on-accent); }
.lang { font-size: 0.9rem; color: var(--chrome-muted); padding-inline-start: 8px; border-inline-start: 1px solid var(--chrome-line); margin-inline-start: 4px; }
.lang small { font-size: var(--fs-label); }
/* The Arabic word in the nav uses the system's Arabic font: Readex Pro's Arabic file is then only
   fetched by pages with real Arabic content, not by every page for this one label. */
.lang [lang="ar"] { font-family: system-ui, -apple-system, 'Segoe UI', 'Noto Sans Arabic', 'Geeza Pro', Tahoma, sans-serif; }
@media (max-width: 900px) {
  .nav { gap: 4px 2px; }
  .nav a { padding: 10px 9px; }
  .brand { gap: 8px; }
  .brand span { font-size: 1.02rem; letter-spacing: 0.02em; }
}
@media (max-width: 480px) { .nav a { padding: 10px 8px; } }
/* Never start a wrapped header row with the language divider */
@media (max-width: 743px) { .lang { border-inline-start: 0; padding-inline-start: 12px; margin-inline-start: 0; } }
/* Below the desktop width (the main nav needs about 1100px for one row): one header row with the
   brand and a labelled Menu button (assets/js/nav.js adds the button and .has-menu); the links
   drop down below it. Without the script the links wrap as above. */
.menu-toggle { display: none; }
@media (max-width: 1100px) {
  .site-header.has-menu .wrap { padding-block: 10px; column-gap: 12px; }
  .site-header.has-menu .menu-toggle {
    display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; margin-inline-start: auto;
    font: 600 1rem/1 var(--f-body); color: var(--chrome-ink); background: transparent;
    border: 1.5px solid var(--gold); border-radius: var(--pill); cursor: pointer;
  }
  .menu-toggle:hover { background: rgba(245, 236, 215, 0.14); }
  .menu-bars, .menu-bars::before, .menu-bars::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }
  .menu-bars { position: relative; }
  .menu-bars::before, .menu-bars::after { content: ""; position: absolute; inset-inline-start: 0; }
  .menu-bars::before { top: -5px; }
  .menu-bars::after { top: 5px; }
  .menu-open .menu-bars { background: transparent; }
  .menu-open .menu-bars::before { top: 0; transform: rotate(45deg); }
  .menu-open .menu-bars::after { top: 0; transform: rotate(-45deg); }
  .site-header.has-menu .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding-block: 6px 4px; border-block-start: 1px solid var(--chrome-line); }
  .site-header.menu-open .nav { display: flex; }
  .site-header.has-menu .nav a { padding: 12px 14px; font-size: 1.05rem; }
  .site-header.has-menu .lang { padding: 10px 14px; border: 0; margin: 0; }
}
@media (max-width: 380px) { .site-header[data-menu] .brand span { font-size: 0.95rem; letter-spacing: 0.01em; } .site-header.has-menu .menu-toggle { padding: 0 12px; gap: 8px; } }
/* Narrowest phones (320-359px): the games site's longer "Dune Scholars Play" wordmark and the
   Menu button still share one row. The seal stays 46px, so the row is the same height as above.
   With the Menu button, the brand's zero flex basis means the button can never be pushed onto a
   second row: if the wordmark is still too wide (a fallback font before Cinzel loads) it wraps
   inside the brand. Without the button (no JavaScript) the brand keeps its natural width. */
@media (max-width: 359px) {
  .site-header[data-menu] .wrap { column-gap: 8px; }
  .site-header[data-menu] .brand { gap: 6px; }
  .site-header.has-menu .brand { flex: 1 1 0px; min-width: 0; max-width: max-content; }
  .site-header.has-menu .brand span { min-width: 0; }
  body.play .site-header[data-menu] .brand span { font-size: 0.82rem; letter-spacing: 0; }
  .site-header.has-menu .menu-toggle { padding: 0 8px; gap: 6px; }
}
/* Before nav.js has run (it is deferred), pages that load it (marked data-menu on the header)
   already paint the one-row header, so nothing jumps when the button arrives. The links wait,
   hidden, for at most 3s: if the script never runs (blocked or failed) they then show, wrapped as
   without JavaScript. With JavaScript off, or in a browser without this media feature, none of
   this applies and the links show at once. Pages without data-menu (the lesson packs) are left as
   they are. */
@media (scripting: enabled) and (max-width: 1100px) {
  .site-header[data-menu]:not(.has-menu) { overflow: clip; }
  .site-header[data-menu]:not(.has-menu) .wrap { padding-block: 10px; }
  .site-header[data-menu]:not(.has-menu) .nav { animation: ds-menu-wait 0s 3s backwards; }
}
@keyframes ds-menu-wait { from { visibility: hidden; flex: 0 0 0px; width: 0; min-width: 0; height: 0; padding: 0; margin: 0; } }
/* Windows High Contrast and other forced-colors modes drop backgrounds: draw the bars and the X
   in the button text colour, and mark the current page in the open menu with an outline. */
@media (forced-colors: active) {
  .menu-bars, .menu-bars::before, .menu-bars::after { background: ButtonText; forced-color-adjust: none; }
  .menu-open .menu-bars { background: transparent; }
  .nav a[aria-current="page"] { outline: 2px solid LinkText; outline-offset: -2px; text-decoration: underline; }
}
/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem/1 var(--f-body);
  padding: 14px 22px; border-radius: var(--pill);
  border: 2px solid var(--ink); color: var(--ink); background: transparent;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn[aria-disabled="true"] { cursor: default; color: var(--muted); border-color: var(--field-line); border-style: dashed; }
.btn[aria-disabled="true"]:hover { background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { box-shadow: 0 0 0 1px rgba(201, 162, 74, 0.5), 0 0 22px rgba(201, 162, 74, 0.35); }
}
:root[data-theme="dark"] .btn.primary { box-shadow: 0 0 0 1px rgba(201, 162, 74, 0.5), 0 0 22px rgba(201, 162, 74, 0.35); }
/* ---------- Home hero: navy, star pattern, seal, looping scene ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; background: var(--sky); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: url(/assets/img/pattern-stars.svg); background-size: var(--pattern-size); background-position: 0 0;
  opacity: var(--pattern-opacity);
  -webkit-mask-image: radial-gradient(ellipse 75% 90% at 78% 40%, #000 30%, transparent 78%);
          mask-image: radial-gradient(ellipse 75% 90% at 78% 40%, #000 30%, transparent 78%);
}
.hero .wrap { position: relative; padding-block: clamp(48px, 9vw, 96px) 0; display: flex; flex-direction: column; gap: var(--gap-l); }
.hero h1 { max-width: 16ch; }
/* Home: a three-line headline (four on phones), text column clear of the seal, a shorter scene. */
.hero-home .wrap { padding-block-start: clamp(36px, 6vw, 72px); gap: 18px; }
.hero-home h1 { font-size: var(--fs-hero); max-width: min(21ch, 100%); line-height: 1.12; }
.hero-home .lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); }
.hero picture { display: contents; }
/* The seal shows from 980px; below that its <picture> picks a tiny inline placeholder, so phones never download it. */
.hero-seal { display: none; }
@media (min-width: 980px) {
  .hero-seal { display: block; position: absolute; inset-inline-end: max(var(--gutter), env(safe-area-inset-right, 0px)); inset-block-start: clamp(36px, 6vw, 72px); width: 300px; height: 300px; border-radius: 50%; }
  .hero-home .wrap > :not(picture) { max-width: calc(100% - 380px); }
  .hero-home .dune-wrap.intro { margin-block-start: 8px; }
  .hero-home .scene { height: 20vw; } /* about 85px less empty sky at 1280; never under 17.5vw, which keeps the sun whole */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-home { border-block-end: 1px solid rgba(201, 162, 74, 0.5); }
}
:root[data-theme="dark"] .hero-home { border-block-end: 1px solid rgba(201, 162, 74, 0.5); }
 /* the navy hero meets the navy page */
.intro-wrap { position: relative; }
.dune-wrap { position: relative; }
.hero .dune-wrap.intro { margin-block-start: clamp(8px, 3vw, 24px); }
/* The scene crops from the top, so its height must grow with the width or wide screens cut the tree and sun. */
.scene { display: block; width: 100%; height: max(clamp(170px, 26.67vw, 420px), 17.5vw); }
.scene .cl { fill: none; stroke: var(--contour-4); stroke-width: 1.2; opacity: .6; vector-effect: non-scaling-stroke; }
.scene .sky circle { fill: var(--contour-4); }
.scene .sun-disc { fill: var(--accent); }
.scene .sun-glow { fill: var(--accent); opacity: .14; }
.scene .c { fill: none; stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.scene .c1 { stroke: var(--contour-1); } .scene .c2 { stroke: var(--contour-2); } .scene .c3 { stroke: var(--contour-3); } .scene .c4 { stroke: var(--contour-4); stroke-width: 2.5; }
.scene .pulse { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 0 1; opacity: 0; vector-effect: non-scaling-stroke; }
.scene .trunk { fill: none; stroke: var(--heading); stroke-width: 3; stroke-linecap: round; }
.scene .canopy { fill: var(--heading); }
.scene .root { fill: none; stroke: var(--contour-4); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scene .node { fill: var(--contour-4); }
.scene .g { font: 600 22px var(--f-body); fill: var(--link); opacity: 0; }
.scene rect.g { fill: none; stroke: var(--link); stroke-width: 2; }
.motion-toggle { position: absolute; inset-inline-end: max(16px, 2vw); bottom: 10px; font: 500 var(--fs-label)/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--pill); padding: 8px 12px; cursor: pointer; opacity: .9; }
.motion-toggle:hover { opacity: 1; }
@media (max-width: 600px) { .motion-toggle { bottom: auto; top: 0; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .scene .sun-glow { opacity: .22; }
  :root:not([data-theme="light"]) .scene .pulse, :root:not([data-theme="light"]) .scene .node, :root:not([data-theme="light"]) .scene .cl { filter: drop-shadow(0 0 4px rgba(212,175,90,.7)); }
}
:root[data-theme="dark"] .scene .sun-glow { opacity: .22; }
:root[data-theme="dark"] .scene .pulse, :root[data-theme="dark"] .scene .node, :root[data-theme="dark"] .scene .cl { filter: drop-shadow(0 0 4px rgba(212,175,90,.7)); }
@media (prefers-reduced-motion: reduce) { .motion-toggle { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  .hero::before { animation: ds-brand-fade 1.6s ease-out both; }
  .scene .cl { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ds-cons 12s ease-in-out infinite; }
  .scene .cl2 { animation-delay: .8s; } .scene .cl3 { animation-delay: 1.6s; }
  .scene .tw { animation: ds-twinkle 4s ease-in-out infinite; } .scene .tw:nth-child(2n) { animation-duration: 5.5s; animation-delay: 1s; } .scene .tw:nth-child(3n) { animation-duration: 6.5s; animation-delay: 2s; }
  .scene .sun-glow { transform-box: fill-box; transform-origin: center; animation: ds-glow 6s ease-in-out infinite; }
  .scene .pulse { animation: ds-pulse 6s linear infinite; } .scene .p2 { animation-delay: 3s; }
  .scene .root { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ds-roots 6s ease-in-out infinite; } .scene .r2 { animation-delay: .4s; }
  .scene .node { animation: ds-node 6s ease-in-out infinite; } .scene .n2 { animation-delay: .4s; }
  .scene .g { animation: ds-float 12s ease-in-out infinite; transform-box: fill-box; }
  .scene .g2 { animation-delay: 2s; } .scene .g3 { animation-delay: 4s; } .scene .g4 { animation-delay: 6s; } .scene .g5 { animation-delay: 8s; } .scene .g6 { animation-delay: 10s; }
  .hero.paused .scene * { animation-play-state: paused !important; }
}
@keyframes ds-brand-fade { from { opacity: 0; } to { opacity: var(--pattern-opacity); } }
@keyframes ds-cons { 0% { stroke-dashoffset: 1; opacity: 0; } 8% { opacity: .6; } 30%, 75% { stroke-dashoffset: 0; opacity: .6; } 92%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes ds-twinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes ds-glow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes ds-pulse { 0% { stroke-dasharray: 0 1; stroke-dashoffset: 0; opacity: 0; } 5% { stroke-dasharray: .06 .94; opacity: 1; } 70% { stroke-dashoffset: -.9; opacity: 1; } 80%, 100% { stroke-dasharray: .06 .94; stroke-dashoffset: -.94; opacity: 0; } }
@keyframes ds-roots { 0%, 15% { stroke-dashoffset: 1; } 45%, 80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 1; } }
@keyframes ds-node { 0%, 40% { opacity: .35; } 50%, 80% { opacity: 1; } 100% { opacity: .35; } }
@keyframes ds-float { 0% { opacity: 0; transform: translateY(0); } 10% { opacity: .85; } 35% { opacity: .85; } 50%, 100% { opacity: 0; transform: translateY(-90px); } }
/* ---------- Drifting brand shapes ---------- */
/* A few brand marks (star, ring, cream block, dashed halo) drift slowly behind the home hero and the inner
   page-head band. CSS pseudo-elements only: nothing for screen readers, never catch a click, behind the text.
   They are placed clear of the text at every width (cream at 0.12 opacity, gold at 0.5 or less), so they
   never cover a word or lower its contrast. Hero shapes obey the hero's Pause button (.hero.paused). Band shapes only move once
   motion.js has added the band's Pause button (.has-drift), from 900px; otherwise they stay still. */
.hero-home::after, .hero-home .wrap::before, .hero-home .wrap::after,
body:not(.play) .page-band .page-head::before, body:not(.play) .page-band .page-head::after,
body:not(.play) .page-band .page-head-text::before, body:not(.play) .page-band .page-head-text::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  background: center / contain no-repeat;
}
/* Home hero. Phones and tablets: a star and a faint block in the clear top strip, above the eyebrow.
   From 980px: three shapes in the clear column between the text (calc(100% - 380px)) and the 300px seal. */
.hero-home .wrap::before { background-image: var(--shape-block); width: 22px; height: 22px; inset-inline-end: 8%; inset-block-start: 8px; opacity: .12; }
.hero-home .wrap::after { background-image: var(--shape-star); width: 16px; height: 16px; inset-inline-end: 24%; inset-block-start: 12px; opacity: .5; }
.hero-home::after { display: none; }
@media (min-width: 980px) {
  .hero-home .wrap::before { width: 36px; height: 36px; inset-inline-end: calc(var(--gutter) + 322px); inset-block-start: 34%; opacity: .12; }
  .hero-home .wrap::after { width: 20px; height: 20px; inset-inline-end: calc(var(--gutter) + 330px); inset-block-start: 68%; opacity: .5; }
  .hero-home::after { display: block; background-image: var(--shape-ring); width: 56px; height: 56px; opacity: .45;
    inset-inline-end: calc(max(var(--gutter), (100% - var(--content)) / 2 + var(--gutter)) + 24px);
    inset-block-start: calc(clamp(36px, 6vw, 72px) + 318px); } /* just under the seal, above the scene */
}
/* Inner page-head band: shapes are placed in the head (the .wrap) round the seal, never over it or the text.
   From 641px the star and the block sit in two empty corners of the halo's square (the seal is round), so they
   stay clear of the text column at every width. --ds-halo-top repeats the .page-band .page-head padding and
   --ds-seal the seal size: change them together. */
body:not(.play) .page-band .page-head { position: relative; --ds-seal: clamp(140px, 15vw, 180px); --ds-halo: calc(var(--ds-seal) + 32px);
  --ds-halo-top: calc(clamp(32px, 5vw, 56px) + (100% - clamp(32px, 5vw, 56px) - clamp(16px, 2.5vw, 28px)) / 2 - var(--ds-halo) / 2); }
body:not(.play) .page-band .page-head::before { background-image: var(--shape-star); width: 14px; height: 14px; inset-block-start: 12px; inset-inline-end: calc(var(--gutter) + 64px + 18px); opacity: .55; }
body:not(.play) .page-band .page-head::after,
body:not(.play) .page-band .page-head-text::before, body:not(.play) .page-band .page-head-text::after { display: none; }
@media (min-width: 641px) {
  /* star: the outer top corner of the halo's square; block: the inner bottom corner (16px or more from the text) */
  body:not(.play) .page-band .page-head::before { width: 18px; height: 18px; opacity: .5;
    inset-inline-end: calc(var(--gutter) - 16px); inset-block-start: var(--ds-halo-top); }
  body:not(.play) .page-band .page-head-text::before { display: block; background-image: var(--shape-block); width: 22px; height: 22px; opacity: .12;
    inset-inline-end: calc(var(--gutter) - 16px + var(--ds-halo) - 22px); inset-block-start: calc(var(--ds-halo-top) + var(--ds-halo) - 22px); }
  body:not(.play) .page-band .page-head::after { display: block; background-image: var(--shape-halo); opacity: .5;
    width: var(--ds-halo); height: var(--ds-halo);
    inset-inline-end: calc(var(--gutter) - 16px); inset-block-start: var(--ds-halo-top); }
}
@media screen and (prefers-reduced-motion: no-preference) {
  .hero-home .wrap::before { animation: ds-drift-a 26s ease-in-out infinite alternate; }
  .hero-home .wrap::after { animation: ds-drift-b 19s ease-in-out infinite alternate; }
  .hero-home::after { animation: ds-drift-c 34s ease-in-out infinite alternate; }
  .hero.paused::after, .hero.paused .wrap::before, .hero.paused .wrap::after { animation-play-state: paused; }
  @media (min-width: 900px) {
    .page-band.has-drift .page-head::before { animation: ds-drift-b 22s ease-in-out infinite alternate; }
    .page-band.has-drift .page-head-text::before { animation: ds-drift-a 30s ease-in-out infinite alternate; }
    .page-band.has-drift .page-head::after { animation: ds-turn 120s linear infinite; }
    .page-band.paused .page-head::before, .page-band.paused .page-head::after,
    .page-band.paused .page-head-text::before { animation-play-state: paused; }
  }
}
/* Band Pause button (motion.js adds it; shown only where the band shapes move) */
.page-band .motion-toggle { inset-block: 10px auto; inset-inline-end: calc(var(--gutter) + clamp(140px, 15vw, 180px) + 24px); }
@media (max-width: 899px) { .page-band .motion-toggle { display: none; } }
@media (forced-colors: active) {
  .hero-home::after, .hero-home .wrap::before, .hero-home .wrap::after,
  body:not(.play) .page-band .page-head::before, body:not(.play) .page-band .page-head::after,
  body:not(.play) .page-band .page-head-text::before { display: none; } /* as specific as the rules that show them */
  .page-band .motion-toggle { display: none; } /* nothing in the band moves, so the button would control nothing */
}
@keyframes ds-drift-a { from { translate: 0 0; rotate: 0deg; } to { translate: 0 -16px; rotate: 14deg; } }
@keyframes ds-drift-b { from { translate: 0 0; rotate: 0deg; } to { translate: -8px -10px; rotate: 45deg; } }
@keyframes ds-drift-c { from { translate: 0 0; } to { translate: 12px 8px; } }
@keyframes ds-turn { to { rotate: 1turn; } }
/* ---------- Inner page heads ---------- */
.page-head { padding-block: var(--space-section) var(--space-head); display: flex; flex-direction: column; gap: var(--gap-m); }
.page-seal { width: 170px; height: 170px; border-radius: 50%; margin-block-end: 6px; }
/* Navy band with the star pattern and the seal, ending in a dune curve (about, games, resources,
   schools, contact, request, privacy; games-site privacy and account). In dark mode the band is
   slate with a gold hairline along the curve, so band, edge and page stay apart. */
.page-band {
  position: relative; isolation: isolate; overflow-x: clip; /* the turning halo's corners must not add a sideways scroll */
  background: var(--band) url(/assets/img/pattern-stars.svg) right top / var(--pattern-size); background-blend-mode: soft-light;
  padding-block-end: clamp(18px, 3vw, 34px);
}
.page-band::before, .page-band::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: clamp(18px, 3vw, 34px); pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V22C180 2 360 2 560 18s420 22 640-8v30z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V22C180 2 360 2 560 18s420 22 640-8v30z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.page-band::before { background: var(--band-edge); transform: translateY(-2px); }
.page-band::after { background: var(--bg); }
.page-band .page-head { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--gap-l) 40px; padding-block: clamp(32px, 5vw, 56px) clamp(16px, 2.5vw, 28px); }
.page-head-text { display: flex; flex-direction: column; gap: var(--gap-m); min-width: 0; }
.page-band picture { display: contents; }
.page-band .page-seal { flex: none; width: clamp(140px, 15vw, 180px); height: auto; aspect-ratio: 1; margin: 0; box-shadow: 0 0 0 6px rgba(201, 162, 74, 0.12); }
.page-band + section.band { padding-block-start: clamp(28px, 4vw, 44px); }
@media (max-width: 640px) {
  .page-band .page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; row-gap: var(--gap-m); }
  .page-head-text { display: contents; }
  .page-head-text > * { grid-column: 1 / -1; }
  .page-head-text > .eyebrow { grid-column: 1; grid-row: 1; align-self: center; }
  .page-band .page-seal { grid-column: 2; grid-row: 1; width: 64px; box-shadow: 0 0 0 3px rgba(201, 162, 74, 0.12); }
}
/* ---------- Sections ---------- */
section.band { padding-block: var(--space-section); }
section.band + section.band { padding-block-start: 0; }
/* Dune line and star between sections */
main > section + section::before {
  content: ""; display: block; height: 40px; width: min(420px, 80%); margin: 0 auto clamp(18px, 3vw, 30px);
  background: url(/assets/img/dune-divider.svg) center / contain no-repeat;
}
main > section.hero + section::before { display: none; }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-block-end: 28px; }
.section-foot { margin-block-start: 22px; }
.more-soon { margin-block-start: 22px; color: var(--muted); }
.more-soon b { color: var(--heading); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.point { border-block-start: 3px solid var(--accent); padding-block-start: 14px; display: flex; flex-direction: column; gap: var(--gap-s); min-width: 0; }
.point h3 { display: flex; align-items: center; gap: 10px; }
.point p { color: var(--muted); }
.prose { max-width: 66ch; display: flex; flex-direction: column; gap: 16px; }
.prose p { color: var(--ink); }
.prose ul { margin: 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: var(--gap-s); }
.prose li::marker { color: var(--accent); }
/* More room above a heading than below it, so sections read as sections. */
.prose h2:not(.prose > :first-child) { margin-block-start: 0.9em; }
.prose h2 + * { margin-block-start: -4px; }
/* Prose inside the page wrapper: align with the page heading, keep lines readable. */
.wrap.prose { max-width: var(--content); }
.wrap.prose > * { max-width: 66ch; }
/* ---------- Ringed icons (Lucide), as on the brand sheet: gold line on navy, second ring ---------- */
.tool-icon {
  width: 44px; height: 44px; padding: 9px; border-radius: 50%;
  background: var(--navy); color: var(--gold); border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--gold);
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.point .tool-icon { width: 36px; height: 36px; padding: 7px; }
/* ---------- Cards and tags ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-l); }
.card {
  background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; min-width: 0;
}
.card-art { aspect-ratio: 16 / 10; width: 100%; max-width: 100%; background: #0A1013; display: grid; place-items: center; overflow: hidden; position: relative; }
.card-art img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card-art.soon { background: linear-gradient(180deg, var(--sky), var(--accent-soft)); }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-body p { color: var(--muted); }
.card-body .actions { margin-block-start: auto; padding-block-start: var(--gap-s); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: var(--fs-label); padding: 4px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); }
.tag.status { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--link); color: var(--link); }
.tag.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge { position: absolute; inset-block-start: 14px; inset-inline-start: 14px; background: var(--badge); color: var(--on-badge); font-size: var(--fs-label); line-height: 1; padding: 7px 11px; border-radius: 6px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card { background: rgba(19, 38, 77, 0.72); }
  :root:not([data-theme="light"]) .card-art.soon { background: linear-gradient(180deg, var(--slate), var(--slate)); }
}
:root[data-theme="dark"] .card { background: rgba(19, 38, 77, 0.72); }
:root[data-theme="dark"] .card-art.soon { background: linear-gradient(180deg, var(--slate), var(--slate)); }
/* Lift: cards that are links (or hold one) and the game doors rise 3px with a soft shadow; buttons rise 1px.
   Colour and shadow change in every mode; the movement only without reduced motion. Main site only
   (the games site has its own lift in play.css). Cards with no link (planned tools) never lift. */
body:not(.play) .card:has(a[href]):hover, body:not(.play) .card:has(a[href]:focus-visible),
body:not(.play) .signpost:hover, body:not(.play) .signpost:focus-visible { border-color: var(--accent); box-shadow: var(--lift-shadow); }
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a { transition: background-color .15s ease, transform .2s var(--ease-calm), filter .15s ease; }
  .card, .door, .signpost { transition: transform .3s var(--ease-calm), box-shadow .3s ease, border-color .3s ease; }
  .tool-icon { transition: transform .3s var(--ease-calm), box-shadow .2s ease, border-color .2s ease; }
  .card-art img { transition: transform .6s var(--ease-calm); }
  .door-go > [aria-hidden], .signpost-go > [aria-hidden] { display: inline-block; transition: transform .3s var(--ease-calm); }
  body:not(.play) .btn:not([aria-disabled="true"]):not([disabled]):hover { transform: translateY(-1px); }
  body:not(.play) .btn:not([aria-disabled="true"]):not([disabled]):active { transform: none; }
  body:not(.play) .card:has(a[href]):hover, body:not(.play) .card:has(a[href]:focus-visible),
  .door:hover, .door:focus-visible, .signpost:hover, .signpost:focus-visible { transform: translateY(-3px); }
  /* The hover area stays still while the box lifts: a clear strip fills the gap left underneath, so a pointer
     resting on the bottom edge keeps the hover instead of losing and regaining it (which made the box shake). */
  body:not(.play) .btn:not([aria-disabled="true"]):not([disabled]):hover, .door:hover, .signpost:hover { position: relative; }
  body:not(.play) .btn:not([aria-disabled="true"]):not([disabled]):hover::after, .door:hover::after, .signpost:hover::after {
    content: ""; position: absolute; inset-inline: 0; inset-block-end: -5px; height: 5px; }
  body:not(.play) .card:has(a[href]):hover .card-art img { transform: scale(1.03); }
  .door:is(:hover, :focus-visible) .door-go > [aria-hidden], .signpost:is(:hover, :focus-visible) .signpost-go > [aria-hidden] { transform: translateX(4px); }
  :dir(rtl) .door:is(:hover, :focus-visible) .door-go > [aria-hidden], :dir(rtl) .signpost:is(:hover, :focus-visible) .signpost-go > [aria-hidden] { transform: translateX(-4px); }
  .tool-mini a:is(:hover, :focus-visible) .tool-icon { transform: translateY(-2px); }
}
/* ---------- Contact form ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--gap-xl); align-items: start; }
.mail-card { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.mail-addr { font-family: var(--f-body); font-size: 1.2rem; font-weight: 600; word-break: break-all; user-select: all; }
form.contact { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.feedback-wrap { max-width: 760px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--field-line); border-radius: var(--radius-s); padding: 12px 14px; width: 100%;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
.hidden-field { position: absolute; inset-inline-start: -9999px; }
.under13 { color: var(--ink); }
.turnstile-slot { min-height: 65px; }
.turnstile-slot:empty { display: none; }
.form-ok { color: var(--heading); background: var(--accent-soft); border: 1px solid var(--card-line); border-radius: var(--radius-s); padding: 12px 14px; }
.form-error { color: var(--heading); background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-s); padding: 12px 14px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) form.contact, :root:not([data-theme="light"]) .mail-card { background: rgba(19, 38, 77, 0.72); }
}
:root[data-theme="dark"] form.contact, :root[data-theme="dark"] .mail-card { background: rgba(19, 38, 77, 0.72); }
/* ---------- Footer ---------- */
.site-footer { background: var(--chrome); border-block-start: 2px solid var(--gold); margin-block-start: var(--space-section); }
.site-footer .wrap { padding-block: 28px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; color: var(--chrome-muted); font-size: 0.92rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.site-footer nav a { padding-block: var(--gap-s); }
.site-footer a { color: var(--chrome-ink); }
/* Faint star pattern behind every footer */
.site-footer { position: relative; isolation: isolate; }
.site-footer::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url(/assets/img/pattern-stars.svg) 0 0 / var(--pattern-size); opacity: .1; pointer-events: none; }
/* Footer layout (both sites): brand block, links in two columns, copyright. Pages still on the
   older one-row footer markup keep the layout above. */
.site-footer .foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand nav" "copy nav"; align-items: start; gap: var(--gap-m) 40px; padding-block: 36px 30px; }
.foot-brand { grid-area: brand; display: flex; gap: 12px; align-items: center; margin: 0; }
.foot-brand img { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.foot-brand b { display: block; font: 700 1.05rem/1.2 var(--f-display); letter-spacing: .04em; color: var(--chrome-ink); }
.foot-brand b em { font-style: normal; color: var(--gold); }
.foot-brand span { display: block; color: var(--chrome-muted); max-width: 40ch; }
.foot-copy { grid-area: copy; margin: 0; font-size: 0.85rem; }
.site-footer .foot nav { grid-area: nav; display: grid; grid-template-columns: repeat(2, auto); gap: 0 28px; }
.site-footer .foot nav a { text-decoration: none; overflow-wrap: anywhere; }
.site-footer .foot nav a:hover, .site-footer .foot nav a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; }
@media (max-width: 640px) {
  .site-footer .foot { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "nav" "copy"; }
  .site-footer .foot nav { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
}
/* ---------- For teachers and schools ---------- */
.tools { display: flex; flex-direction: column; border-block-start: 1px solid var(--line); }
.tool {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px 40px;
  padding-block: 28px; border-block-end: 1px solid var(--line);
}
.tool-head { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.tool-head h3 { font-size: clamp(1.35rem, 2.6vw, 1.6rem); }
.tool-pitch { color: var(--muted); font-size: 1.08rem; max-width: 36ch; }
.tool-feats { margin: 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: 10px; align-self: center; }
.tool-feats li::marker { color: var(--accent); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px 40px; align-items: start; }
.split .prose { gap: var(--gap-m); }
/* Call to action: navy panel with the star pattern */
.cta {
  background: var(--panel); color: var(--panel-ink); border: 1px solid var(--line); border-radius: var(--radius);
  background-image: linear-gradient(rgba(11, 27, 61, .9), rgba(11, 27, 61, .9)), url(/assets/img/pattern-stars.svg); background-size: auto, var(--pattern-size);
  padding: clamp(24px, 4vw, 40px); display: flex; flex-wrap: wrap; gap: 20px 32px;
  align-items: center; justify-content: space-between;
}
.cta .stack { max-width: 56ch; gap: var(--gap-s); }
.cta p { color: inherit; opacity: 0.85; }
.cta h2 { color: var(--panel-ink); }
.cta :focus-visible { outline-color: var(--accent); } /* gold on the navy/slate panel: 7.0:1 or more */
.cta .cta-ghost { color: var(--panel-ink); border-color: var(--panel-ink); }
.cta .cta-ghost:hover { background: rgba(255,255,255,.1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cta { border-color: rgba(201, 162, 74, 0.35); box-shadow: 0 0 40px rgba(201, 162, 74, 0.08); }
}
:root[data-theme="dark"] .cta { border-color: rgba(201, 162, 74, 0.35); box-shadow: 0 0 40px rgba(201, 162, 74, 0.08); }
/* Home: compact tool list */
.tool-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; border-block-start: 1px solid var(--line); }
.tool-mini a {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: start;
  padding-block: 18px; border-block-end: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.tool-mini .tool-icon { grid-row: span 2; width: 40px; height: 40px; padding: var(--gap-s); }
.tool-mini b { font-family: var(--f-body); font-weight: 600; font-size: 1.1rem; }
.tool-mini span { color: var(--muted); }
.tool-mini a:hover b { text-decoration: underline; text-underline-offset: 3px; }
/* App previews and demo videos */
.tool-shot { grid-column: 1 / -1; margin: 8px 0 0; display: flex; flex-direction: column; gap: var(--gap-s); }
.tool-shot img { width: 100%; height: auto; border: 1px solid var(--card-line); border-radius: var(--radius); background: var(--sky); }
.tool-shot figcaption { font-family: var(--f-mono); font-size: var(--fs-label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.demo-frame { position: relative; }
.tool-demo video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; border: 1px solid var(--card-line); border-radius: var(--radius); background: var(--sky); }
.demo-toggle { position: absolute; inset-inline-end: 12px; bottom: 12px; font: 500 var(--fs-label)/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--panel-ink); background: var(--panel); border: 1px solid var(--chrome-line); border-radius: var(--pill); padding: 9px 13px; cursor: pointer; opacity: .92; }
.demo-toggle:hover { opacity: 1; }
.demo-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.guide-link { display: inline-flex; align-items: center; gap: var(--gap-s); font-weight: 600; color: var(--link); text-decoration: none; border-bottom: 1px solid currentColor; padding-block: 2px; }
.guide-link::before { content: ""; width: 14px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E") center / contain no-repeat; }
.guide-link span { font-weight: 400; color: var(--muted); }
.guide-link:hover { border-bottom-width: 2px; }
/* ---------- Home: two doorways into the games ---------- */
.doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-l); }
.door {
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: clamp(22px, 3vw, 32px); border-radius: var(--radius); border: 1px solid var(--gold); text-decoration: none;
  background: var(--navy) url(/assets/img/pattern-stars.svg); background-size: var(--pattern-size); background-blend-mode: soft-light;
}
.door .tool-icon { width: 52px; height: 52px; padding: 11px; box-shadow: 0 0 0 2px var(--navy), 0 0 0 3px var(--gold); }
.door h3 { color: var(--heading); font-family: var(--f-display); font-size: clamp(1.3rem, 2.4vw, 1.6rem); margin-block-start: 4px; letter-spacing: normal; }
.door p { color: var(--muted); }
.door .tag { background: var(--slate-2); color: var(--cream); }
.door-go { margin-block-start: auto; padding-block-start: var(--gap-s); color: var(--gold); font-weight: 600; }
.door:hover { box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(201, 162, 74, 0.28); }
.door:hover .door-go { text-decoration: underline; text-underline-offset: 3px; }
.door:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .door { background-color: var(--slate); }
}
:root[data-theme="dark"] .door { background-color: var(--slate); }
 /* a step lighter than the navy page */

/* ---------- Home: free tools and resources, two link cards ---------- */
.signposts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-l); }
.signpost {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: clamp(20px, 3vw, 28px);
  background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.signpost h3 { display: flex; align-items: center; gap: 12px; }
.signpost .tool-icon { width: 40px; height: 40px; padding: var(--gap-s); }
.signpost p { color: var(--muted); }
.signpost-go { margin-block-start: auto; padding-block-start: var(--gap-s); color: var(--link); font-weight: 600; }
.signpost:hover .signpost-go, .signpost:focus-visible .signpost-go { text-decoration: underline; text-underline-offset: 3px; }
.signpost:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .signpost { background: rgba(19, 38, 77, 0.72); }
}
:root[data-theme="dark"] .signpost { background: rgba(19, 38, 77, 0.72); }
/* ---------- Games page: games grouped by subject, each row drops open with no script ---------- */
.fun-cta { margin-block-start: var(--gap-xl); }
.game-groups { display: flex; flex-direction: column; gap: clamp(32px, 5vw, 48px); }
.game-group-about { color: var(--muted); margin-block: 6px 16px; }
.game-list { display: flex; flex-direction: column; gap: 10px; }
.card-art picture, .game-thumb picture { display: contents; }
/* ---------- Request a prototype form ---------- */
.card-note { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 18px 22px; margin-block-end: 24px; max-width: 760px; }
.card-note ol { margin: 10px 0 0; padding-inline-start: 1.2em; display: grid; gap: 6px; }
.card-note li::marker { color: var(--link); font-weight: 600; }
form.request { max-width: 760px; display: flex; flex-direction: column; gap: var(--gap-l); }
.step { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 22px; margin: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.step-title { font-family: var(--f-display); font-weight: 700; font-size: 1.4rem; color: var(--heading); padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step > .step-title { float: left; width: 100%; margin-block-end: 4px; }
.step > .step-title + * { clear: both; }
.step-n { font: 500 var(--fs-label)/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--eyebrow); }
.step-intro { color: var(--muted); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.req { color: var(--link); font-weight: 600; }
fieldset.checks { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--gap-s); min-width: 0; }
fieldset.checks legend { font-weight: 500; padding: 0; margin-block-end: 2px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--gap-s); }
.checks.apps .check-grid { grid-template-columns: minmax(0, 1fr); }
label.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: var(--radius-s); background: var(--bg); cursor: pointer; }
label.check input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
label.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.check:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.consent { border-style: dashed; }
.app-blocks { display: flex; flex-direction: column; gap: 16px; }
.app-block { border-inline-start: 3px solid var(--accent); padding-inline-start: 16px; display: flex; flex-direction: column; gap: var(--gap-m); }
.app-block h3 { font-size: 1.1rem; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; display: none; }
.progress span { display: block; height: 100%; width: 20%; background: var(--accent); }
form.request.js .progress { display: block; }
.form-nav { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.form-nav [data-next], .form-nav [data-submit] { margin-inline-start: auto; }
@media (max-width: 600px) { .row2 { grid-template-columns: minmax(0, 1fr); } .step { padding: 16px; } }
@media (prefers-reduced-motion: no-preference) { .progress span { transition: width .3s ease; } }
/* ---------- Short "this has moved" pages (Nullgrid's old address and the games site's /move/) ---------- */
.moved-page { padding-block: 96px; min-height: 70vh; }
.moved-page h1 { margin-block: 8px 16px; }
.moved-page p { max-width: 60ch; }
.moved-page .btn { margin-block-start: 16px; }
.move-choice { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 16px; }
.move-choice .btn { margin-block-start: 0; white-space: normal; text-align: start; }
.move-note { margin-block: 24px; padding: 16px 20px; border: 1px solid var(--line, currentColor); border-radius: 12px; max-width: 60ch; }
.move-note h2 { font-size: 1.1rem; margin-block-end: 8px; }
/* ---------- Resources: lesson packs ---------- */
.pack { display: flex; flex-direction: column; gap: clamp(28px, 4vw, 40px); }
.pack-part { display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.pack-part ul { margin: 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: var(--gap-s); }
.pack-part li::marker { color: var(--accent); }
.pack-note { align-self: flex-start; max-width: 66ch; background: var(--accent-soft); color: var(--ink); border-inline-start: 5px solid var(--accent); border-radius: 6px; padding: 10px 14px; }
.pack-table table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--card-line); }
.pack-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pack-table th, .pack-table td { padding: 10px 14px; text-align: start; vertical-align: top; border-block-end: 1px solid var(--line); }
.pack-table thead th { font-family: var(--f-mono); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.04em; color: var(--eyebrow); }
.pack-table tbody th { font-weight: 600; color: var(--heading); min-width: 110px; }
/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .grid-3, .cards, .contact-grid, .doors, .tool, .split, .tool-mini, .signposts { grid-template-columns: minmax(0, 1fr); }
  .tool { padding-block: 24px; }
}
@media (max-width: 640px) {
  .game-row > summary { grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; padding-inline-end: 16px; }
  .pack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pack-table tr, .pack-table tbody th, .pack-table td { display: block; }
  .pack-table tbody th { border-block-end: 0; padding-block-end: 2px; }
  .pack-table td { padding-block-start: 2px; }
}
/* ---------- Fade-in on scroll ---------- */
/* Sections and cards rise in once as they first come into view: opacity and an 18px translate, 0.7s,
   with a small stagger across a row of cards. Only on screen and only without reduced motion.
   Browsers with CSS scroll-triggered animations do it in CSS (no script). Others get the same effect from
   assets/js/motion.js, which hides (class .rv) only items still below the screen and shows them as they
   scroll in. Without either, everything simply shows. Never on the printable lesson packs. */
.cards > .card:nth-child(2n), .tool-mini > a:nth-child(2n), .doors > .door:nth-child(2n), .signposts > a:nth-child(2n), .grid-3 > :nth-child(3n+2) { --rv-i: 1; }
.grid-3 > :nth-child(3n) { --rv-i: 2; }
@media (max-width: 760px) { .cards > .card, .tool-mini > a, .doors > .door, .signposts > a, .grid-3 > * { --rv-i: 0; } }
@media screen and (prefers-reduced-motion: no-preference) {
  @supports (animation-trigger: --ds-reveal play-once) and (timeline-trigger-name: --ds-reveal) {
    main > section.band .section-head, .tool-mini > a, .grid-3 > .point, .doors > .door, .signposts > a, .tools > .tool,
    .game-group > :not(.cards), .cta, .split > *, .contact-grid > *, .cards > .card, .games-grid > .game {
      timeline-trigger: --ds-reveal view() entry 10% exit 100%;
      animation: ds-rise .7s var(--ease-calm) calc(var(--rv-i, 0) * 90ms) backwards;
      animation-trigger: --ds-reveal play-once;
    }
  }
  .rv:not(.rv-in) { opacity: 0; }
  .rv-in { animation: ds-rise .7s var(--ease-calm) calc(var(--rv-i, 0) * 90ms) backwards; }
}
@keyframes ds-rise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
@media print {
  .site-header, .site-footer, .skip, .no-print, .motion-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .pack-table table { background: #fff; }
  .pack-table tr, .pack-part h2 { break-inside: avoid; }
  main > section + section::before { display: none; }
}
/* Colour theme switch (assets/js/theme.js): "light" and "dark" on <html data-theme> override the
   device setting; with no attribute the site follows the device. */
:root[data-theme="light"] { color-scheme: light; }
.theme-toggle { display: inline-flex; align-items: center; justify-self: start; align-self: center; gap: 6px; font: inherit; font-size: .92em; font-weight: 500; color: var(--chrome-ink); background: transparent; border: 1px solid var(--chrome-muted); border-radius: var(--pill); padding: 5px 12px; margin-inline-start: 4px; cursor: pointer; }
.theme-toggle:hover { background: rgba(245, 236, 215, 0.14); }
.theme-toggle:focus-visible { outline: 2px solid var(--chrome-ink); outline-offset: 2px; }
@media (min-width: 1101px) {
  .theme-toggle { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .theme-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 1100px) { .theme-toggle { align-self: flex-start; margin: 6px 0 2px 12px; } }
.theme-toggle svg { width: 16px; height: 16px; flex: none; }
/* Taps land on the button itself: its icon and label are replaced on each change, and nav.js closes the
   phone menu on clicks whose target is no longer inside the header. */
.theme-toggle * { pointer-events: none; }

/* The educational games used to sit in accordions behind thumbnails the size
   of a postage stamp, which hid the one thing a teacher wants to see. Each is
   now a panel with its picture given room and everything that was folded away
   written out beside it. */
.game-panel { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 3px 5px rgba(11, 27, 61, .08), 0 18px 32px -24px rgba(11, 27, 61, .45); }
.game-panel + .game-panel { margin-block-start: 20px; }
/* The whole picture, not a slice of it. These are screenshots of software, so
   cropping the sides takes the title bar off and the picture stops explaining
   what the game is. */
.game-panel-art { display: grid; place-items: center; overflow: hidden; padding: 14px;
  border-inline-end: 1px solid var(--card-line); background: var(--bg); }
.game-panel-art img { width: 100%; height: auto; max-height: 100%; object-fit: contain; display: block;
  border-radius: 8px; box-shadow: 0 2px 10px rgba(11, 27, 61, .18); }
.game-panel-body { padding: 20px 24px 22px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.game-panel-body h3 { margin: 0; font-size: 1.3rem; }
.game-panel-body .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.game-panel-line { margin: 0; font-weight: 600; color: var(--muted); }
.game-panel-body p { margin: 0; }
.game-panel-body .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-block-start: 6px; }

/* On a phone the picture goes on top, where it can be the width of the screen
   rather than a third of it. */
@media (max-width: 760px) {
  .game-panel { grid-template-columns: minmax(0, 1fr); }
  .game-panel-art { border-inline-end: 0; border-block-end: 1px solid var(--card-line); padding: 12px; }
  .game-panel-body { padding: 16px 18px 20px; }
}
