/* ============================================================
   British Intelligent Governance — design system
   White canvas · navy + green (from the logo) · institutional
   No third-party CDN. System serif stack until EB Garamond is self-hosted.
   ============================================================ */

:root {
  /* Brand palette (sampled from logo.png) */
  --bg:        #ffffff;
  --navy:      #14233f;
  --navy-700:  #0e1a30;
  --green:     #1e3d2d;
  --green-600: #2e5a43;
  --ink:       #1a2230;
  --muted:     #5a6472;
  --line:      #e3e7ec;
  --surface:   #f6f8fa;

  /* Type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  "SFMono-Regular", "JetBrains Mono", "IBM Plex Mono", Consolas, monospace;

  /* Scale */
  --maxw: 1140px;
  --measure: 68ch;
  --r: 6px;
  --space: clamp(3rem, 7vw, 6rem);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--green-600); text-underline-offset: 3px; }
a:hover { color: var(--green); }

/* Headings */
h1, h2, h3, h4 { font-family: var(--serif); color: var(--navy); line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin: 0 0 .6em; }
h3 { font-size: 1.3rem; margin: 0 0 .4em; }
.eyebrow {
  font-family: var(--sans); font-weight: 700; font-size: .8rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--green-600);
  margin: 0 0 1rem;
}

/* Layout */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.2rem, 4vw, 2.5rem); }
.section { padding-block: var(--space); }
.section--surface { background: var(--surface); border-block: 1px solid var(--line); }
.section--navy { background: var(--navy); color: #d7deea; }
.section--navy h1, .section--navy h2, .section--navy h3 { color: #fff; }
.section--navy .eyebrow { color: #8fd0ad; }
.lead { font-size: 1.25rem; color: var(--muted); max-width: var(--measure); }
.section--navy .lead { color: #b9c4d6; }
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.1em; }

/* Skip link */
.skip { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: .7rem 1rem; z-index: 100; }
.skip:focus { left: 0; }

/* Focus visibility */
:focus-visible { outline: 3px solid var(--green-600); outline-offset: 2px; border-radius: 2px; }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--navy); color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: #fff; }
.brand .crown { font-size: 1.15rem; line-height: 1; opacity: .92; }
.brand .wordmark { font-family: var(--serif); font-weight: 600; letter-spacing: .04em; font-size: 1.02rem; text-transform: uppercase; }
.brand .wordmark small { display: block; font-size: .58rem; letter-spacing: .26em; color: #8fd0ad; font-weight: 600; }
.nav-links { display: flex; gap: 1.6rem; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: #cdd6e6; text-decoration: none; font-size: .95rem; font-weight: 500; }
.nav-links a:hover { color: #fff; }
@media (max-width: 760px) { .nav-links { display: none; } }

/* ---------- Buttons ---------- */
.btn { display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 1rem;
  padding: .8rem 1.4rem; border-radius: var(--r); text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn--primary { background: var(--green-600); color: #fff; }
.btn--primary:hover { background: var(--green); color: #fff; }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn--ghost:hover { border-color: #fff; background: rgba(255,255,255,.08); color: #fff; }
.btn--dark { background: var(--navy); color: #fff; }
.btn--dark:hover { background: var(--navy-700); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.8rem; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy) 45%, var(--green) 130%); color: #fff; text-align: center; padding-block: clamp(3rem, 8vw, 6rem); }
.hero img.logo { width: clamp(160px, 26vw, 240px); margin: 0 auto 2rem; border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.hero h1 { color: #fff; max-width: 16ch; margin-inline: auto; }
.hero .lead { color: #c7d2e4; margin-inline: auto; }
.hero .btn-row { justify-content: center; }
.tagline { font-family: var(--serif); font-style: italic; color: #8fd0ad; font-size: 1.15rem; margin-top: 2rem; }

/* ---------- Stat / pill ---------- */
.score-badge { display: inline-flex; align-items: baseline; gap: .5rem; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); padding: .5rem 1rem; border-radius: 999px; margin-top: 1.6rem; font-size: .95rem; color: #c7d2e4; }
.score-badge b { font-family: var(--serif); font-size: 1.3rem; color: #fff; }

/* ---------- Flow (decision loop) ---------- */
.flow { display: grid; gap: .75rem; max-width: 760px; margin: 2rem auto 0; }
.flow .node { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--green-600); border-radius: var(--r); padding: 1rem 1.2rem; }
.flow .node b { color: var(--navy); font-family: var(--serif); }
.flow .arrow { text-align: center; color: var(--muted); font-size: 1.1rem; }
.flow .node--people { border-left-color: var(--navy); background: var(--surface); }

/* ---------- Cards grid ---------- */
.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 2rem; }
.card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.3rem 1.4rem; text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(20,35,63,.10); border-color: var(--green-600); }
.card .num { font-family: var(--mono); font-size: .8rem; color: var(--green-600); font-weight: 700; }
.card h3 { margin: .3rem 0 .35rem; font-size: 1.12rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }

/* ---------- Rubric table ---------- */
.table-wrap { overflow-x: auto; margin-top: 1.6rem; }
table.rubric { width: 100%; border-collapse: collapse; font-size: .95rem; background: #fff; }
table.rubric th, table.rubric td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); }
table.rubric thead th { background: var(--navy); color: #fff; font-family: var(--sans); font-weight: 600; }
table.rubric td.score { font-family: var(--mono); font-weight: 700; color: var(--green); text-align: center; }
table.rubric tr:last-child td { border-bottom: none; }

/* ---------- Two-column ---------- */
.cols { display: grid; gap: 2.5rem; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 2rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-700); color: #9fb0c8; padding-block: 3rem 2rem; font-size: .92rem; }
.site-footer a { color: #c7d2e4; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer-brand .wordmark { font-family: var(--serif); color: #fff; font-size: 1.1rem; letter-spacing: .04em; text-transform: uppercase; }
.footer-links { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.footer-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer-bottom { padding-top: 1.5rem; color: #7e90ab; font-size: .85rem; }

/* Utility */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
hr.rule { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* ---------- Document / rulebook reader ---------- */
.doc-layout { display: grid; grid-template-columns: 290px 1fr; gap: 3rem; align-items: start; padding-block: 2.5rem 3rem; }
@media (max-width: 920px) { .doc-layout { grid-template-columns: 1fr; gap: 1.5rem; } .doc-nav { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 1rem; } }
.doc-nav { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 108px); overflow: auto; border-right: 1px solid var(--line); padding-right: 1rem; font-size: .9rem; }
.doc-nav h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-family: var(--sans); margin: 0 0 .8rem; }
.doc-nav ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .12rem; }
.doc-nav a { display: flex; gap: .55rem; text-decoration: none; color: var(--ink); padding: .35rem .55rem; border-radius: 4px; line-height: 1.3; }
.doc-nav a .pnum { color: var(--green-600); font-family: var(--mono); font-size: .72rem; min-width: 2.4em; }
.doc-nav a:hover { background: var(--surface); }
.doc-nav a[aria-current="page"] { background: var(--navy); color: #fff; }
.doc-nav a[aria-current="page"] .pnum { color: #8fd0ad; }
.doc-content { min-width: 0; }
.doc-content > p, .doc-content > ul, .doc-content > ol, .doc-content > blockquote { max-width: 72ch; }
.doc-content h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
.doc-content h2 { margin-top: 2.4rem; padding-top: 1.3rem; border-top: 1px solid var(--line); }
.doc-content h3 { margin-top: 1.7rem; color: var(--green); }
.doc-content h4 { margin-top: 1.3rem; color: var(--navy); font-size: 1.05rem; }
.doc-content blockquote { margin: 1.5rem 0; padding: 1rem 1.3rem; background: var(--surface); border-left: 4px solid var(--green-600); border-radius: 0 var(--r) var(--r) 0; color: #46505f; font-style: italic; }
.doc-content code { font-family: var(--mono); font-size: .88em; background: var(--surface); padding: .1em .35em; border-radius: 4px; }
.doc-content pre { background: var(--navy-700); color: #cdd6e6; padding: 1.1rem 1.3rem; border-radius: var(--r); overflow: auto; font-size: .82rem; line-height: 1.5; }
.doc-content pre code { background: none; color: inherit; padding: 0; }
.doc-content ul, .doc-content ol { padding-left: 1.4rem; }
.doc-content li { margin: .3rem 0; }
.doc-content li > ul, .doc-content li > ol { margin-top: .3rem; }
.doc-prevnext { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.doc-prevnext .nxt { text-align: right; margin-left: auto; }
.doc-prevnext a { text-decoration: none; font-weight: 600; }
.doc-prevnext small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.doc-hero { background: var(--navy); color: #fff; padding-block: 2rem; }
.doc-hero a.back { color: #8fd0ad; text-decoration: none; font-size: .9rem; }
.doc-hero .pnum { font-family: var(--mono); color: #8fd0ad; font-size: .9rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 1rem; max-width: 640px; margin-top: 1.5rem; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .92rem; color: var(--navy); }
.field input, .field select, .field textarea { font: inherit; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); width: 100%; }
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--green-600); outline-offset: 1px; border-color: var(--green-600); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#form-status { min-height: 1.4em; font-size: .95rem; color: var(--green); font-weight: 600; }
.cf-turnstile { margin: .2rem 0; }
.muted-note { color: var(--muted); font-size: .9rem; }
