/* Shared brand layer: fonts + palette + wordmark.
   Mirrors edtech-landing/public/styles.css so the platform looks
   like a continuation of the marketing site.

   The font urls carry a ?v= content stamp like every stylesheet and script
   (scripts/dev/sync_asset_versions.py derives it from the file's bytes) —
   /static serves a stamped URL as immutable and an unstamped one as
   revalidate-every-time, so a font replaced under the same name reaches the
   browser on the next page load instead of whenever its heuristic expiry ran
   out. Never type the stamp: run the sync script after changing a font. */

@font-face {
  font-family: "ITC Ronda";
  src: url("/static/fonts/itc-ronda-regular.woff2?v=e8c92f89") format("woff2"),
       url("/static/fonts/itc-ronda-regular.woff?v=afd1bdbb") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/Poppins-Light.woff2?v=593b65d6") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/Poppins-Regular.woff2?v=536d40c6") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/Poppins-Medium.woff2?v=f8d4b088") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/Poppins-SemiBold.woff2?v=e492ff72") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/Poppins-Bold.woff2?v=ea9404d0") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* THESE FIVE FOLLOW THE THEME, and until 2026-08-30 they did not.
     ================================================================
     `--bg`, `--bg-card`, `--text`, `--text-dim` and `--border` were four
     hard-coded purple values in one unconditional `:root` with NO `[data-theme]`
     variants at all — so a carer switching to the white theme got a white page
     with dark purple cards still on it, and white text still on them. Reported
     by the founder ("if I change background, the card of each child remains
     purple"), and it is ROADMAP 5b, which had been patched instance by instance
     for months.

     A CONTRAST TEST CANNOT SEE THIS. A purple card with white text on it scores
     perfectly; what is wrong is that the card did not MOVE. The guard for it
     measures whether a painted background is identical across two themes whose
     page ground changed — `tests/playwright/test_theme_blindness.py`.

     They alias shell.css's themed tokens rather than growing three copies of
     their own, so there is ONE definition of "the card colour on this theme" and
     these names stay as the carer surfaces' vocabulary for it. The fallbacks are
     the original purple values, because nine pages load branding.css WITHOUT
     shell.css (login, welcome, set-password, the classic shell…) and those are
     purple-only by design — they must keep working, unchanged, to the byte. */
  --bg: var(--paper, #260b37);
  --bg-card: var(--surface, #371651);
  /* DERIVED FROM THE CARD, not borrowed from an unrelated token. The first
     attempt aliased this to `--rail-edge`, which is a BORDER colour: on the
     purple theme it is slightly darker than the old hover, and that was enough
     to drop the director's "Fully erase" button from passing to 3.89:1 against
     a 4.5 floor — caught by test_professional_contrast.py, which is what it is
     for. A hover is the card nudged toward the ink, on whatever theme. */
  --bg-card-hover: color-mix(in srgb, var(--surface, #371651) 88%, var(--ink, #f7e9ff));
  --text: var(--ink, #f7e9ff);
  --text-dim: var(--muted, #ddc9ec);
  /* THE ACCENT AS TEXT, not as a fill. `--gold` is used for both, and on the
     white theme the fill is right (#F6BD00 on a gold button) while the TEXT is
     1.64:1 — under every floor. shell.css already solves exactly this with
     `--accent-ink`, which is the accent on dark themes and a darkened gold
     (#B8890B) on white. Sites that PAINT with gold want `--accent`; sites that
     WRITE in it want this, which is what almost every carer use is. */
  --gold: var(--accent-ink, #f6bd00);
  --gold-fill: var(--accent, #f6bd00);
  /* THE SAME INK-VERSUS-FILL SPLIT, for the rest of the data palette
     (2026-09-01, the VSH theme re-ink). --mint / --pink / --orange were doing
     both jobs — pale text on dark cards AND the fill behind a badge — and one
     value cannot serve both once the white theme turns the ground light: as
     text they measured 1.3–3.5:1 on white surfaces. So the bare token is the
     TEXT role (re-inked per theme below) and the `-fill` twin is the paint,
     identical on every theme because the ink that sits ON a fill is
     --pastel-ink, which clears 10:1 on all three fills. */
  --mint: #b3edd1;
  --mint-fill: #b3edd1;
  --pink: #f7cfc6;
  --pink-fill: #f7cfc6;
  /* Dark, theme-stable ink for text sitting ON a pastel or gold fill
     (badges, count pills): 13.5:1 on --mint-fill, 12.4 on --pink-fill,
     10.3 on --gold-fill. */
  --pastel-ink: #260b37;
  /* Lightened from #00998c for WCAG: 3.22:1 → 4.60:1 on the tinted card the
     "Local authority" chip sits on (measured on the rendered page — a thin
     margin over 4.5, so don't darken this again without re-measuring), and
     3.97:1 → 5.67:1 on the dashboard's "Teach next". */
  --teal: #2bb8a3;
  /* Text orange, lifted #ff4000 → #ff6640 (2026-09-01): as TEXT it sat at
     4.31:1 on the dashboard card behind every "Lapsed" churn line and 3.89 on
     the erase button's composite — both under the 4.5 floor on the DEFAULT
     theme. #ff6640 measures 4.68 / 4.70 there and 5.2+ on the black theme.
     Fills that want the deep alarm orange use --orange-fill. */
  --orange: #ff6640;
  --orange-fill: #ff4000;
  /* The learner cards' "Early days" readiness band — a grey with no other
     token to borrow; re-inked for white below. */
  --readiness-early: #94a3b8;
  /* Trend-chart series strokes (Y10 / Y11 lines) — graphics, so the floor is
     3:1; the defaults are fine on dark and the white block darkens them. */
  --trend-y10: #7cc6ff;
  --trend-y11: #ff9e6d;
  --border: var(--line, rgba(247, 207, 198, 0.24));
  /* Status colours the professional surfaces had been faking with hand-typed
     hex. Naming them is what lets a restyle reach them at all — the
     safeguarding panel was painted by literal hex inside style="…" attributes
     built in JavaScript, invisible to this stylesheet.
     --status-risk is the only VALUE change here: #ff7a59 → #ff8f72 lifts
     "Not making progress" (4.37 → 5.04) and "Overdue (>24h, no action)"
     (4.06 → 4.68) over the 4.5:1 standard. The other two are the same painted
     colours, named instead of typed.
     --status-good is the saturated success FILL (status dots, chart segments,
     the carer sparkline); --mint stays the pale success TEXT. Two roles. */
  --status-risk: #ff8f72;
  --status-good: #5fd0a8;
  /* LIFTED 2026-08-02, #c9772b → #e09a52, and this one is worth reading before
     anyone tidies it back. The amber is used as a foreground ON A WASH OF
     ITSELF, so the pair could never open up: same hue, one of them at 6-14%
     over a dark purple card. Measured on the rendered page at all three sites,
     before → after:

       safeguarding.html  .tag.incident  10px on the 14% wash   3.72 → 5.08
       learner-detail     .sg-open       12.5px on the 6% wash  4.11 → 5.83
       educator.html      <strong>       on --bg-card           4.41 → 6.38   (page since retired)

     All three were under the 4.5:1 AA floor and all three are LATENT — they
     only render when a child has a live safeguarding incident, which is why
     the first of them read as a flaky test for weeks rather than as a defect
     (see ROADMAP.md). #d98b3f also clears the floor, at 4.51, and was rejected
     for the reason --teal records above: a 0.1-wide margin cannot absorb
     another step. Do not darken this without re-measuring; the ratio is
     asserted by tests/playwright/test_safeguarding_board_contrast.py. */
  --status-safeguard: #e09a52;
  /* Channel triplet so the safeguarding panel's tinted fills read as
     rgba(var(--status-safeguard-rgb), α) rather than a literal rgba(). Must
     stay the channels of --status-safeguard above — the wash IS the colour. */
  --status-safeguard-rgb: 224, 154, 82;
  /* The five LEARNER-STATUS colours, from the dashboards' `pre / active /
     stuck / inactive / complete` taxonomy (api/views/dashboards.py). Same three-way
     duplication the block above was written to end: learner-detail.html,
     dashboard.html and carer-dashboard.html each declared this identical set
     in their own :root, so "inactive" meant whatever the last page you opened
     said it meant.

     --status-inactive is the one VALUE change, and it is an accessibility fix
     being put back rather than a restyle: every copy read #cfb4dd, which is
     --text-dim as it was BEFORE line 52 raised it for contrast. The lightened
     value was applied to --text-dim and never to the pages that had already
     copied the old one out.

     --status-stuck aliases --status-risk because they are the same idea named
     twice: a learner who is stuck IS the at-risk state. Added here rather than
     in shell.css because branding.css owns every --status-* token and
     test_status_colours_stay_in_branding pins that. */
  --status-active: #b3edd1;
  --status-inactive: #ddc9ec;
  --status-pre: #f7cfc6;
  --status-complete: #f6bd00;
  --status-stuck: var(--status-risk);
  /* The blur recipe shared by the true-glass panels below. */
  --glass-blur: blur(18px) saturate(1.5);

  /* THE SEVEN STATUS COLOURS ARE DARK-GROUND PASTELS, AND THE WHITE THEME IS
     NOT A DARK GROUND. Measured on the rendered carer pages: as pill TEXT on
     their own 18% tint over a white card they came in between 1.21:1 and
     1.96:1 against a 4.5 floor — "Needs a hand" in pale peach on near-white,
     unreadable rather than merely low. They pass on purple (4.70 worst) and
     black (5.27 worst), so this is a theme override, not a re-palette: same
     hue, same saturation, lightness dropped until every white surface clears
     5.0 (the extra half-point over the floor is headroom for a future tint
     tweak). --status-stuck follows because it aliases --status-risk.
     Found by sweeping for roles whose colour is identical across two themes
     whose ground changed — a pill that never repaints cannot be reading
     correctly on both. */
}

:root[data-theme="white"] {
  --status-active: #186741;
  --status-inactive: #7A3CA9;
  /* Was #A33017 — visually the SAME red as --status-risk (#AA2300) once both
     darkened for white, so "Not started" and "Not making progress" were
     indistinguishable in the donut and year-tier segments (2026-09-01 render
     pass). Rose keeps the pastel's warm family, clears 6.4:1 on the worst
     white surface, and separates from risk by hue. */
  --status-pre: #9E2A52;
  --status-complete: #715700;
  --status-risk: #AA2300;
  --status-good: #1E664C;
  --status-safeguard: #834E17;
  /* The data palette's TEXT roles, re-inked for a light ground exactly as the
     seven status colours above were (2026-09-01, measured on the rendered VSH
     pages): same hue, lightness dropped until the WORST white surface each is
     written on clears 4.5 with headroom — mint 6.2, teal 5.4, orange 5.1,
     pink 6.3, the readiness grey 4.9. The `-fill` twins deliberately do NOT
     change: a badge stays a pastel chip with --pastel-ink on it, whatever the
     theme. Trend strokes are graphics (3:1 floor) and clear it at 4+. */
  --mint: #186741;
  --teal: #14705F;
  --orange: #C23000;
  --pink: #A33017;
  --readiness-early: #5B6B7D;
  --trend-y10: #256A96;
  --trend-y11: #A64510;
  /* Must stay the channels of --status-safeguard above — the wash IS the
     colour, and a stale triple here is a wash that no longer matches its own
     text. */
  --status-safeguard-rgb: 131, 78, 23;
}

/* ---- Shared UI from utils.js: accessible modal, toast, offline banner ---- */
.sm-modal-overlay {
  /* A real <dialog> now (2026-11-24, see utils.js::confirmDialog), so its own
     UA stylesheet otherwise wins over `inset: 0`: a <dialog>'s default
     width/height is fit-content, not auto, and `inset` only stretches a
     positioned box when width/height are auto — without this it sat pinned
     small in the top-left corner instead of covering the screen. */
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  z-index: 10000; display: flex; align-items: center;
  justify-content: center; padding: 20px; margin: 0; border: none;
  /* A scrim dims — it must NOT pre-blur: the panel's own backdrop-filter is
     what makes it read as glass, and it needs crisp content behind it. Kept
     light for the same reason. */
  background: rgba(10, 3, 18, 0.45);
}
.sm-modal {
  width: 100%; max-width: 420px; background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 18px; padding: 26px 24px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  /* A tall dialog scrolls inside the screen: without it, the topic check's picker (2026-10-20)
     pushed its own Send button below the viewport, where nothing could reach it. */
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.sm-modal h2 { margin: 0 0 10px; font-size: 19px; }
.sm-modal p { margin: 0 0 16px; color: var(--text-dim); line-height: 1.5; font-size: 14px; }
.sm-modal-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; margin: 0 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.05);
  color: var(--text); font-size: 14px; font-family: inherit;
}
.sm-modal-input:focus { outline: none; border-color: var(--gold); }
.sm-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.sm-modal-actions button {
  padding: 9px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.sm-modal-cancel { background: none; border: 1px solid var(--border); color: var(--text-dim); }
.sm-modal-cancel:hover { color: var(--text); border-color: var(--text-dim); }
.sm-modal-confirm { background: var(--gold); border: none; color: var(--bg); }
/* The danger fill keeps the deep alarm orange (--orange is a TEXT token now,
   re-inked per theme); dark ink on it measures 5.05:1 where the old white
   text sat at 3.51. */
.sm-modal-confirm.danger { background: var(--orange-fill, #ff4000); color: var(--pastel-ink, #260b37); }
.sm-modal-confirm:disabled { opacity: 0.45; cursor: default; }
/* chooseDialog: each choice is a whole-row button (login.js, the device to sign out). */
.sm-modal-choices { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.sm-modal-choice {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 56px; padding: 12px 16px; border-radius: 14px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text);
  font: inherit;
}
.sm-modal-choice:hover, .sm-modal-choice:focus-visible { border-color: var(--gold); }
.sm-modal-choice:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sm-choice-text { display: grid; gap: 2px; }
.sm-choice-text b { font-size: 15px; font-weight: 600; }
.sm-choice-text span { font-size: 13px; color: var(--text-dim); }
.sm-choice-action { flex: 0 0 auto; font-size: 13.5px; font-weight: 600; color: var(--gold); }
.sm-choice-main { display: flex; align-items: center; gap: 14px; }
.sm-choice-main .dev-icon { color: var(--text-dim); }
/* Device icons: the signed-in devices list (shell.js, buildDeviceList) and the sign-in
   page's "choose one to sign out" (utils.js, chooseDialog). A line drawing masked onto
   currentColor, so it takes each theme's ink; the kind comes from the server
   (auth/sessions.py, device_kind). */
.dev-icon {
  flex: 0 0 auto; width: 26px; height: 26px; background: currentColor;
  -webkit-mask: var(--dev-icon) center / contain no-repeat; mask: var(--dev-icon) center / contain no-repeat;
}
.dev-phone { --dev-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='2.75' width='10' height='18.5' rx='2.25'/%3E%3Cpath d='M11 18h2'/%3E%3C/svg%3E"); }
.dev-tablet { --dev-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.25' y='2.75' width='15.5' height='18.5' rx='2.25'/%3E%3Cpath d='M11 18h2'/%3E%3C/svg%3E"); }
.dev-computer { --dev-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.75' y='4.75' width='14.5' height='10.5' rx='1.5'/%3E%3Cpath d='M2.75 18.75h18.5'/%3E%3C/svg%3E"); }
.dev-unknown { --dev-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='15' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M6 6.75h.01M8.5 6.75h.01'/%3E%3C/svg%3E"); }

.sm-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  z-index: 10001; max-width: 90vw; padding: 12px 20px; border-radius: 12px;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--gold);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
.sm-toast.show { opacity: 1; transform: translate(-50%, 0); }

.sm-net-banner {
  display: none; position: fixed; left: 0; right: 0; top: 0; z-index: 9999;
  align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 11px 16px; background: #3a1450; border-bottom: 1px solid var(--gold);
  color: var(--text); font-size: 14px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.sm-net-banner.show { display: flex; }
.sm-net-banner button {
  background: var(--gold); color: var(--bg); border: none; border-radius: 8px;
  padding: 6px 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
@media (prefers-reduced-motion: reduce) { .sm-toast { transition: none; } }

/* The one checkbox style, shared by every page (2026-11-11) — it used to be
   redrawn per page (staff.css, institutions.css, two-step.css), each slightly
   different and each repeating the same fix: a plain checkbox's UNCHECKED box
   is the browser's own white/grey chrome, since accent-color only recolours
   the checked state, so it sat as a stray white square on the dark theme.
   Drawn fully custom instead, with the same background and border as every
   other input when it's empty. Lives here, not in shell.css, because it has
   to work on pages that load branding.css WITHOUT shell.css (login, two-step
   verification, set-password). */
.sm-check {
  appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center;
  flex: 0 0 auto; width: 17px; height: 17px; margin: 0; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.sm-check:hover { border-color: var(--gold-fill); }
.sm-check:checked, .sm-check:indeterminate { background: var(--gold-fill); border-color: var(--gold-fill); }
.sm-check:checked::after {
  content: ""; width: 10px; height: 10px; background: var(--pastel-ink, #260b37);
  -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='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%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='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sm-check:indeterminate::after {
  content: ""; width: 9px; height: 2px; background: var(--pastel-ink, #260b37); border-radius: 1px;
}
.sm-check:focus-visible { outline: 2px solid var(--gold-fill); outline-offset: 2px; }

html, body {
  font-family: "Poppins", system-ui, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
}

h1, h2, h3 {
  font-family: "ITC Ronda", "Poppins", system-ui, sans-serif;
  font-weight: 400;
  /* ITC Ronda is a rounded display face; positive tracking keeps it legible
     (negative spacing crowds the letters). */
  letter-spacing: 0.8px;
}

/* A learner's code where a school or college typed one instead of a name ("L100", "FE03"):
   plain letters with even-width figures, because in ITC Ronda 1 reads as I and 0 as O, and a
   misread code is the wrong student (founder, 2026-11-22: the critique's issue 5). The pages
   add the class when the name has a digit in it (SM.isCode, utils.js). !important because each
   page sets its names in Ronda with a stronger rule of its own; a name without a digit keeps Ronda. */
.is-code {
  font-family: "Poppins", system-ui, "Segoe UI", Roboto, sans-serif !important;
  font-weight: 500 !important;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0 !important;
}

/* The wordmark — STEMe with a gold superscript "Up". Matches the
   landing site's `STEMe<sup>Up</sup>` treatment exactly. */
.wordmark {
  font-family: "ITC Ronda", "Poppins", sans-serif;
}
.wordmark sup {
  color: var(--gold);
  font-size: 0.55em;
  vertical-align: super;
  margin-left: 1px;
}

/* ---- Liquid glass, v3 minimal (2026-07-11) --------------------------------
   Founder-tuned: glass lives in exactly TWO places and nowhere else —
   1. the top bar as a MATERIAL, not a fixture: a glass capsule (tinted fill,
      lit rim, soft depth) that scrolls away with the page like any header.
      No ambient washes (a fixed glow behind a centred column made the
      margins and the content read as different surfaces), no sticky.
   2. overlay chrome (modal / toast / offline banner / picker) — always above
      real content, so the blur is doing honest work every time it appears.
   Content surfaces are the original solid colours. Plus the soft page-arrival
   fade and press/hover motion. Honours prefers-reduced-motion AND
   prefers-reduced-transparency. Still never blur near the staff grid's ~300
   .card cells. */

/* 1. The glass capsule bar (in normal flow — scrolls with the page). A step
      brighter than any content surface, with a stronger rim and lift, so the
      chrome reads as its own layer at a glance. */
.top-bar {
  /* Centred cross-axis so the logo gets EQUAL space above and below (the
     learner header aligned to text baseline, which rode the tall logo up
     against the capsule's top edge). */
  align-items: center;
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid rgba(247, 207, 198, 0.34);
  background:
    linear-gradient(rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)),
    rgba(74, 34, 110, 0.55);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    inset 1px 0 0 rgba(255, 255, 255, 0.09),
    inset -1px 0 0 rgba(255, 255, 255, 0.09),
    0 12px 36px rgba(8, 2, 14, 0.5);
}

/* 2. Overlay chrome shares the material (alerts and toasts are chrome
      too): the week-picker (.cp-box), the learner explore /
      modals, toasts, the offline banner.
      The translucent fill here must WIN over each page's solid
      `background: var(--bg-card)` — hence the two-class selectors — or the
      blur has nothing to shine through. Full-screen takeovers (the teach /
      lesson view) stay opaque: reading surfaces, not chrome. */
.sm-modal,
.sm-toast,
.sm-net-banner,
.cp-overlay .cp-box {
  /* Lighter fill + a SHORTER blur than the bar: pop-ups often sit over the
     darkest parts of a page, and a long blur homogenises sparse bright
     detail into nothing — the panel then reads as solid. 12px keeps the
     background's structure legible through the material. */
  background:
    linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(58, 24, 88, 0.42);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
  backdrop-filter: blur(12px) saturate(1.6);
}
.sm-modal,
.cp-overlay .cp-box {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0.5px rgba(255, 255, 255, 0.08),
    0 12px 40px rgba(10, 2, 18, 0.4);
}

/* 3. Smooth page-to-page arrival: a short opacity-only ease-in on load.
       (Deliberately NOT MPA view transitions — they suppress rendering
       frames in headless Chromium, which freezes automation and the CI
       ui-smoke suite. Opacity never moves a bounding box, so element
       stability checks are unaffected.) */
@keyframes sm-page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
body {
  animation: sm-page-in 0.28s ease-out;
}

/* 3b. Gentle, consistent motion on the things people touch. Pages that
       declare their own transitions keep them (more specific / later). */
a,
button {
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}
button:not(:disabled):active {
  transform: scale(0.98);
}

/* 3c. Pop-ups arrive and leave; they don't just appear (2026-11-04). Every
       one used to snap onto the screen in a single frame. Now the scrim
       fades in and the panel rises a few pixels as it grows to full size, on
       one long ease-out so it settles rather than stops. Leaving is quicker
       and eases in. The keyframes are shared: each page's own overlay (the
       carer picker, the PIN box, the composer…) names them in its own
       stylesheet, so all of them move the same way.

       Three rules behind the shapes:
       - The scrim fades its COLOUR, never its opacity. The panels are glass
         (backdrop-filter, section 2), and a parent with opacity below 1
         blurs only itself, so the glass would look flat while it faded in
         and then snap clear at the end.
       - No fill mode on the way in. A transform that stays after the
         animation makes the panel the containing block for anything fixed
         inside it (the map panel that ended up off-screen:
         test_home_shell_contracts).
       - On the way out the overlay is already gone for everything but the
         eye: SM.dismissOverlay (utils.js) makes it inert, hides it from
         assistive tech and drops its ids, and pointer-events lets a click
         through to the page. */
:root {
  --sm-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sm-ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --sm-in: 0.34s;
  --sm-out: 0.16s;
}
@keyframes sm-scrim-in {
  from {
    background-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@keyframes sm-scrim-out {
  to {
    background-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@keyframes sm-fade-in {
  from {
    opacity: 0;
  }
}
@keyframes sm-fade-out {
  to {
    opacity: 0;
  }
}
@keyframes sm-pop-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}
@keyframes sm-pop-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
/* A bottom sheet (phones) comes up from the bottom edge instead. */
@keyframes sm-sheet-in {
  from {
    transform: translateY(100%);
  }
}

.sm-modal-overlay {
  animation: sm-scrim-in 0.24s ease-out;
}
.sm-modal-overlay > .sm-modal {
  animation: sm-pop-in var(--sm-in) var(--sm-ease-out);
}
.sm-modal-overlay.sm-leaving {
  animation: sm-scrim-out var(--sm-out) var(--sm-ease-in) forwards;
  pointer-events: none;
}
.sm-modal-overlay.sm-leaving > .sm-modal {
  animation: sm-pop-out var(--sm-out) var(--sm-ease-in) forwards;
}

/* The native <dialog>s (Staff & accounts, learner sign-in, institutions) do
   the same. They come in with an animation, because a dialog opens from
   display:none and a transition has nothing to start from. They go out with a
   transition, which needs a browser that keeps a closing dialog on the top
   layer until it has faded (`overlay`: Chrome 117+, Safari 18+). Other
   browsers shut it at once, as before. */
dialog[open] {
  animation: sm-pop-in var(--sm-in) var(--sm-ease-out);
}
dialog[open]::backdrop {
  animation: sm-fade-in 0.24s ease-out;
}
@supports (overlay: auto) {
  dialog,
  dialog::backdrop {
    transition:
      display var(--sm-out) allow-discrete,
      overlay var(--sm-out) allow-discrete,
      opacity var(--sm-out) var(--sm-ease-in),
      transform var(--sm-out) var(--sm-ease-in);
  }
  dialog:not([open]) {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    pointer-events: none;
  }
  dialog:not([open])::backdrop {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  a,
  button {
    transition: none;
  }
  button:not(:disabled):active {
    transform: none;
  }
  body {
    animation: none;
  }
  /* Pop-ups only fade: nothing moves or grows. */
  .sm-modal-overlay > .sm-modal,
  dialog[open] {
    animation-name: sm-fade-in;
  }
  .sm-modal-overlay.sm-leaving > .sm-modal {
    animation-name: sm-fade-out;
  }
  dialog:not([open]) {
    transform: none;
  }
}

/* The OS-level Reduce Transparency setting, honoured: solid, no blur. */
@media (prefers-reduced-transparency: reduce) {
  .top-bar,
  .sm-modal,
  .sm-toast,
  .sm-net-banner,
  .cp-overlay .cp-box {
    background: #2e1145;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Ink-friendly: glass is a screen material — print on plain paper. */
@media print {
  .top-bar {
    background: none;
    border: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
