/* Perceivable. Every colour pair here meets WCAG 2.2 AA in both light and dark mode;
   run `npm run site:check` after changing anything. */

:root {
  --ink: #14213d;          /* header, hero and footer bands */
  --ink-text: #f4f6fb;
  --ink-muted: #c3cde0;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #1b2433;
  --muted: #4a5568;
  --border: #c9d0dc;
  --border-strong: #6b7486;
  --accent: #0b6b6b;       /* links, buttons, highlights */
  --accent-text: #ffffff;  /* text on --accent */
  --accent-soft: #e3f2f1;
  --brand-mark: #3ec7bb;   /* logo block on the ink band */
  --focus: #ffbf47;
  --focus-text: #0b0c0c;
  --critical: #a4262c;
  --serious: #8a4b00;
  --moderate: #4a5568;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(20 33 61 / 6%), 0 4px 16px rgb(20 33 61 / 6%);
  --measure: 44rem;
  --wide: 72rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0b1220;
    --ink-text: #eef2f8;
    --ink-muted: #b4c0d3;
    --bg: #0f1726;
    --surface: #162135;
    --surface-2: #1c2940;
    --text: #e8edf5;
    --muted: #b4c0d3;
    --border: #2f3e58;
    --border-strong: #8794ab;
    --accent: #6bd6cb;
    --accent-text: #0b1220;
    --accent-soft: #15333a;
    --brand-mark: #6bd6cb;
    --critical: #ff9b94;
    --serious: #f7b955;
    --moderate: #b4c0d3;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { scroll-padding-top: 1rem; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}

/* Layout */

.container {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 40rem) { .container { padding: 0 1.5rem; } }

.prose-page { padding-top: 1rem; padding-bottom: 3rem; }
.prose-page > * { max-width: var(--measure); }
.prose-page > .wide { max-width: none; }

/* Header */

.site-header { background: var(--ink); color: var(--ink-text); }
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
.brand svg { flex: none; }
.brand-mark-on { fill: var(--brand-mark); }
.brand-mark-off { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}
.site-nav a {
  color: var(--ink-text);
  text-decoration: none;
  font-weight: 600;
  padding: 0.35rem 0;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--ink-muted); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--brand-mark); }

/* Hero (homepage) */

.hero { background: var(--ink); color: var(--ink-text); padding: 2.5rem 0 3.5rem; }
.hero h1 {
  font-size: clamp(2.25rem, 7vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
  max-width: 18ch;
}
.hero .lead { color: var(--ink-muted); max-width: 38rem; margin: 0 0 2rem; }
.hero a { color: var(--ink-text); }
.eyebrow {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-mark);
  margin: 0 0 1rem;
}

.stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  max-width: 52rem;
}
.stats li {
  border-left: 4px solid var(--brand-mark);
  padding: 0.25rem 0 0.25rem 1rem;
}
.stats strong { display: block; font-size: 2rem; line-height: 1.2; color: var(--ink-text); }
.stats span { color: var(--ink-muted); font-size: 1rem; }

/* Sections and cards */

.section { padding: 3rem 0; }
.section + .section { padding-top: 0; }
.section h2 { margin-top: 0; }
.section-intro { max-width: var(--measure); color: var(--muted); margin-top: -0.5rem; }

.cards {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); }
.card .step {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
}
.panel {
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.panel h3 { margin-top: 0; }
.panel ul { margin-bottom: 0; padding-left: 1.25rem; }
.panel-accent { border-top: 4px solid var(--accent); }
.panel-caution { border-top: 4px solid var(--serious); }

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: none;
  padding: 0.7rem 1.25rem;
  border-radius: 6px;
  border: 2px solid var(--accent);
}
.button:hover { text-decoration: underline; }
.button-secondary { background: transparent; color: var(--accent); }
.hero .button { background: var(--brand-mark); border-color: var(--brand-mark); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* Typography */

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); margin: 1.5rem 0 1rem; }
h2 { font-size: 1.6rem; margin: 2.75rem 0 0.75rem; }
h3 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
.lead { font-size: 1.25rem; }
.meta { color: var(--muted); font-size: 1rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
li + li { margin-top: 0.35rem; }
/* Lists used for layout line up their items instead. */
.site-nav li + li, .cards > li + li, .stats > li + li { margin-top: 0; }

a { color: var(--accent); text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
a:focus-visible {
  outline: 3px solid var(--focus);
  background: var(--focus);
  color: var(--focus-text);
  text-decoration: none;
  box-shadow: 0 3px 0 var(--focus-text);
  border-bottom-color: transparent;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.6rem 1rem;
  background: var(--focus);
  color: var(--focus-text);
  font-weight: 700;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Long documents: contents list beside the text on wide screens */

.doc { display: grid; gap: 0 3rem; }
.contents {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.contents h2 { font-size: 1rem; margin: 0 0 0.5rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.contents ol { margin: 0; padding-left: 1.25rem; font-size: 1rem; }
.contents li + li { margin-top: 0.25rem; }
@media (min-width: 64rem) {
  .doc { grid-template-columns: minmax(0, var(--measure)) 16rem; }
  .doc .contents {
    grid-column: 2;
    grid-row: 1 / span 100;
    align-self: start;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
  .doc-body { grid-column: 1; }
}

/* Callouts, definitions, code */

.notice {
  border-left: 6px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
}
.notice p { margin: 0.25rem 0; }

dl { margin: 1rem 0; }
dt { font-weight: 700; margin-top: 1rem; }
dd { margin: 0.25rem 0 0; }

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
code.block { display: block; padding: 0.75rem 1rem; }
pre { background: var(--surface-2); padding: 0.75rem 1rem; border-radius: 6px; overflow-x: auto; }
pre code { padding: 0; background: none; }

/* Tables */

.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
.table-wrap:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; background: var(--surface); }
caption { text-align: left; font-weight: 700; padding-bottom: 0.5rem; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
thead th { background: var(--surface-2); border-bottom: 2px solid var(--border-strong); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table.league th[scope="row"] { font-weight: 400; width: 50%; }
table.league td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 30rem) {
  table.league { font-size: 0.9375rem; }
  table.league th, table.league td { padding: 0.5rem 0.4rem; }
}

/* Forms */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.field { display: flex; flex-direction: column; gap: 0.25rem; }
label { font-weight: 700; font-size: 1rem; }
select, button {
  font: inherit;
  font-size: 1rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
}

details { margin: 1rem 0; }
summary { cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; }
summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.unranked { font-size: 1rem; }

/* Council pages */

.summary {
  margin: 1.5rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 1.25rem;
}
.summary > div {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) 2fr;
  gap: 0.5rem 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.summary > div:last-child { border-bottom: 0; }
.summary dt, .summary dd { margin: 0; }
@media (max-width: 30rem) { .summary > div { grid-template-columns: 1fr; gap: 0; } }

.issues { padding-left: 1.25rem; }
.impact {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0.45em;
  margin-right: 0.3rem;
  border: 2px solid currentColor;
  border-radius: 4px;
}
.impact-critical { color: var(--critical); }
.impact-serious { color: var(--serious); }
.impact-moderate, .impact-minor { color: var(--moderate); }

/* Footer */

.site-footer {
  background: var(--ink);
  color: var(--ink-muted);
  margin-top: 3rem;
  padding: 2.5rem 0;
  font-size: 1rem;
}
.site-footer a { color: var(--ink-text); }
.footer-inner { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.footer-inner p { margin: 0 0 0.5rem; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li + li { margin-top: 0.4rem; }
.footer-brand { color: var(--ink-text); font-weight: 700; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
