/* ==========================================================================
   tech.mathsschools.co.uk — design system
   A cool "technical dossier" identity: slate paper, indigo + cyan accents,
   a network-node wordmark, and monospace for every technical value (domains,
   IPs, record types). Deliberately distinct from the parent site's teal
   serif and the EMS sub-site's warm orange triangles.
   ========================================================================== */

:root {
  --ink: #12161d;
  --ink-soft: #3d4653;
  --muted: #6b7686;
  --paper: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --surface-3: #e5ebf3;
  --border: #dde3ec;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-2: #0e7490;
  --accent-tint: #e9e9fd;
  --wire: #9aa6b8;
  --good: #15803d;
  --good-tint: #dcfce7;
  --warn: #b45309;
  --warn-tint: #fef3c7;
  --bad: #be123c;
  --bad-tint: #ffe4e6;
  --code-bg: #eef1f8;
  --code-ink: #3730a3;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --container: 1120px;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6edf6;
    --ink-soft: #c2ccd9;
    --muted: #8b97a8;
    --paper: #0c1017;
    --surface: #131a24;
    --surface-2: #1a2431;
    --surface-3: #212d3c;
    --border: #263140;
    --accent: #818cf8;
    --accent-dark: #a5b4fc;
    --accent-2: #22d3ee;
    --accent-tint: #1e2740;
    --wire: #3d4d63;
    --good: #34d399;
    --good-tint: #0c2a1e;
    --warn: #fbbf24;
    --warn-tint: #2c2410;
    --bad: #fb7185;
    --bad-tint: #2c1620;
    --code-bg: #0f1823;
    --code-ink: #a5b4fc;
  }
}
:root[data-theme="dark"] {
  --ink: #e6edf6; --ink-soft: #c2ccd9; --muted: #8b97a8; --paper: #0c1017; --surface: #131a24;
  --surface-2: #1a2431; --surface-3: #212d3c; --border: #263140; --accent: #818cf8; --accent-dark: #a5b4fc;
  --accent-2: #22d3ee; --accent-tint: #1e2740; --wire: #3d4d63; --good: #34d399; --good-tint: #0c2a1e;
  --warn: #fbbf24; --warn-tint: #2c2410; --bad: #fb7185; --bad-tint: #2c1620; --code-bg: #0f1823; --code-ink: #a5b4fc;
}
:root[data-theme="light"] {
  --ink: #12161d; --ink-soft: #3d4653; --muted: #6b7686; --paper: #f6f8fb; --surface: #ffffff;
  --surface-2: #eef2f8; --surface-3: #e5ebf3; --border: #dde3ec; --accent: #4f46e5; --accent-dark: #4338ca;
  --accent-2: #0e7490; --accent-tint: #e9e9fd; --wire: #9aa6b8; --good: #15803d; --good-tint: #dcfce7;
  --warn: #b45309; --warn-tint: #fef3c7; --bad: #be123c; --bad-tint: #ffe4e6; --code-bg: #eef1f8; --code-ink: #3730a3;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(var(--border) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  background-attachment: fixed;
}
h1, h2, h3, h4 { font-weight: 700; line-height: 1.15; color: var(--ink); letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin: 0 0 0.4em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 1.7em 0 0.6em; }
h3 { font-size: 1.18rem; margin: 1.3em 0 0.4em; }
h4 { font-size: 1rem; margin: 0 0 0.3em; }
p { margin: 0 0 1em; }
a { color: var(--accent-dark); }
a:hover { text-decoration-thickness: 2px; }
.mt-0 { margin-top: 0; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
img, svg { max-width: 100%; }
code { font-family: var(--font-mono); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 760px; }
.section { padding: 3em 0; }
.section--alt { background: var(--surface-2); border-block: 1px solid var(--border); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 12px; top: 12px; }

/* ---- Header --------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.2) blur(8px); position: sticky; top: 0; z-index: 20; }
.site-header__bar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.brand__mark { flex: none; }
.brand__name { font-family: var(--font-mono); font-size: 0.98rem; letter-spacing: -0.02em; }
.brand__dot { color: var(--accent-2); }
.brand__tld { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--ink-soft); text-decoration: none; font-size: 0.92rem; font-weight: 600; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }

/* ---- Hero ------------------------------------------------------------ */
.hero { padding: 3.4em 0 1.6em; position: relative; }
.hero__kicker { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--accent-dark); background: var(--accent-tint); padding: 5px 12px; border-radius: 6px; margin-bottom: 1.1em; }
.hero__lede { font-size: 1.16rem; color: var(--ink-soft); max-width: 680px; }
.hero__meta { margin-top: 1.3em; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }

.btn { display: inline-block; padding: 11px 20px; border-radius: 8px; font-weight: 600; text-decoration: none; font-size: 0.94rem; border: 1.5px solid transparent; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--outline { border-color: var(--border); color: var(--ink); background: var(--surface); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent-dark); }
.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---- Stat strip ------------------------------------------------------ */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; margin-top: 2em; padding-top: 1.8em; border-top: 1px solid var(--border); }
.stat__value { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; color: var(--accent-dark); letter-spacing: -0.03em; }
.stat__label { font-size: 0.84rem; color: var(--muted); margin-top: 2px; }

/* ---- Cards ------------------------------------------------------------ */
.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-decoration: none; color: inherit; transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(30, 30, 80, 0.10); border-color: var(--accent); }
.card h3 { margin-top: 0; margin-bottom: 0.35em; font-size: 1.1rem; }
.card p { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 0; }
.card__eyebrow { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; color: var(--accent-2); margin-bottom: 6px; display: block; }
.card__foot { margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Callouts --------------------------------------------------------- */
.callout { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 18px 20px; margin: 1.5em 0; }
.callout--cyan { border-left-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 6%, var(--surface)); }
.callout--warn { border-left-color: var(--warn); background: var(--warn-tint); }
.callout--bad { border-left-color: var(--bad); background: var(--bad-tint); }
.callout__title { font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.callout p:last-child { margin-bottom: 0; }

/* ---- Key facts / dossier ---------------------------------------------- */
.key-facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 1.2em 0; }
.key-facts dt { font-weight: 600; color: var(--muted); white-space: nowrap; }
.key-facts dd { margin: 0; }

.dossier { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); margin: 1.3em 0; }
.dossier__row { display: grid; grid-template-columns: 190px 1fr; gap: 0; border-top: 1px solid var(--border); }
.dossier__row:first-child { border-top: none; }
.dossier__k { padding: 12px 16px; background: var(--surface-2); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); border-right: 1px solid var(--border); }
.dossier__v { padding: 12px 16px; font-size: 0.95rem; }
.dossier__v .mono { font-size: 0.88rem; }
@media (max-width: 620px) {
  .dossier__row { grid-template-columns: 1fr; }
  .dossier__k { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ---- Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
caption { text-align: left; padding: 12px 14px; color: var(--muted); font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
table.stack-table td:first-child { font-weight: 600; }
td .mono, th .mono { font-size: 0.84rem; }

/* ---- Mono + badges ---------------------------------------------------- */
.mono { font-family: var(--font-mono); background: var(--code-bg); color: var(--code-ink); padding: 1px 6px; border-radius: 5px; font-size: 0.86em; word-break: break-word; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.badge--accent { background: var(--accent-tint); color: var(--accent-dark); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge--good { background: var(--good-tint); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.badge--warn { background: var(--warn-tint); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge--bad { background: var(--bad-tint); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.badge--mono { background: var(--code-bg); color: var(--code-ink); }
.badge-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 0.4em 0; }

/* ---- Signal list ------------------------------------------------------ */
.signal-list { list-style: none; padding: 0; margin: 0.6em 0; display: grid; gap: 8px; }
.signal-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.signal__name { font-family: var(--font-mono); font-weight: 600; font-size: 0.86rem; color: var(--accent-dark); }
.signal__note { font-size: 0.86rem; color: var(--ink-soft); }

.notebox { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 16px 18px; margin: 1.3em 0; font-size: 0.92rem; color: var(--ink-soft); }
.notebox p:last-child { margin-bottom: 0; }

/* ---- Pills / tags ----------------------------------------------------- */
.pill-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 0.8em 0; }
.pill-list a, .pill-list span { display: inline-block; padding: 6px 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; font-size: 0.85rem; text-decoration: none; color: var(--ink-soft); }
.pill-list a:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ---- Prose ------------------------------------------------------------ */
.prose { max-width: 740px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.breadcrumbs { padding: 16px 0 0; font-size: 0.84rem; color: var(--muted); font-family: var(--font-mono); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-dark); }
.breadcrumbs .sep { margin: 0 8px; opacity: 0.6; }

.source-list { list-style: none; padding: 0; font-size: 0.88rem; }
.source-list li { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.src-n { color: var(--muted); flex: none; font-family: var(--font-mono); }

.divider { height: 1px; background: var(--border); border: none; margin: 2.4em 0; }
.flex-between { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---- School index grid ------------------------------------------------ */
.school-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---- Footer ----------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface-2); padding: 3em 0 1.6em; margin-top: 3em; }
.site-footer h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.8em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-soft); text-decoration: none; font-size: 0.9rem; }
.site-footer a:hover { color: var(--accent-dark); }
.site-footer .grid { grid-template-columns: 1.5fr repeat(3, 1fr); }
@media (max-width: 760px) { .site-footer .grid { grid-template-columns: repeat(2, 1fr); } }
.foot-note { font-size: 0.84rem; color: var(--muted); max-width: 340px; }
.site-footer .bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 2.4em; padding-top: 1.4em; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--muted); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
