/* AIDRE project site: the one stylesheet.
 *
 * Every color is a token on :root, redefined for the dark theme under
 * prefers-color-scheme. check.py reads the token pairs listed in its CONTRAST_PAIRS
 * table from this file and fails the build when one falls below its WCAG ratio, so a
 * token edited here is measured, not eyeballed.
 *
 * There is no theme toggle: a toggle needs runtime JavaScript, which the site does
 * not carry (Q74). The visitor's operating-system setting chooses the theme.
 *
 * No inline style attribute appears in any page: the content-security policy is
 * style-src 'self', which blocks them. Every rule lives here.
 */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-raised: #ffffff;
  --border: #d1d9e0;
  --border-strong: #818b98;
  --text: #1f2328;
  --muted: #59636e;
  --accent: #1a7f37;          /* links, primary button fill */
  --accent-hover: #116329;
  --on-accent: #ffffff;
  --accent-soft: #dafbe1;     /* tinted backgrounds only, never text */
  --slate: #6e7781;           /* the mark's broken stroke, as a non-text graphic */
  --focus: #0969da;
  --shadow: 0 1px 2px rgb(31 35 40 / 0.06), 0 8px 24px rgb(31 35 40 / 0.06);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu,
    Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
  --step-4: clamp(2.25rem, 1.6rem + 2.8vw, 3.5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: clamp(3rem, 2rem + 4vw, 5.5rem);

  --radius: 10px;
  --radius-sm: 6px;
  --measure: 68ch;
  --container: 72rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-raised: #1c2128;
    --border: #30363d;
    --border-strong: #6e7681;
    --text: #e6edf3;
    --muted: #9198a1;
    --accent: #3fb950;
    --accent-hover: #56d364;
    --on-accent: #0d1117;
    --accent-soft: #12261e;
    --slate: #8b949e;
    --focus: #58a6ff;
    --shadow: 0 1px 2px rgb(1 4 9 / 0.4), 0 8px 24px rgb(1 4 9 / 0.4);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1 0 auto; }

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
h1 { font-size: var(--step-4); font-weight: 750; letter-spacing: -0.025em; }
h2 { font-size: var(--step-3); font-weight: 700; }
h3 { font-size: var(--step-1); font-weight: 650; }
h4 { font-size: var(--step-0); font-weight: 650; }

p, ul, ol, dl, table, figure { margin: 0 0 var(--space-4); }
p { max-width: var(--measure); }
li + li { margin-top: var(--space-1); }

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

/* One focus treatment everywhere: never removed, only replaced. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05em 0.35em;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-7) 0;
}

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

/* The skip link's target takes focus programmatically; it is not a control, so it
   draws no ring. */
main:focus { outline: none; }

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: var(--space-3); color: var(--on-accent); }

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--space-8); }
.section--surface {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.prose > * { max-width: var(--measure); }
.prose h2 { margin-top: var(--space-7); }
.prose > h2:first-child, .prose > h3:first-child { margin-top: 0; }
.prose h3 { margin-top: var(--space-6); }

.grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  padding: 0;
  list-style: none;
}
.grid > li + li { margin-top: 0; }
/* Four cards read as two pairs, never as three and one left over. */
.grid--pairs { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }

/* ---------- The motif: the mark's broken-to-solid stroke, as a rule ---------- */

.motif {
  display: block;
  height: 4px;
  background:
    linear-gradient(90deg, var(--accent) 0 100%) right / 50% 100% no-repeat,
    repeating-linear-gradient(90deg, var(--slate) 0 12px, transparent 12px 22px) left / 50% 100% no-repeat;
}
.motif--short { width: 7rem; margin-bottom: var(--space-5); }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  padding-block: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: var(--step-1);
  letter-spacing: 0.04em;
}
.brand:hover { color: var(--text); }
.brand img { width: 2.25rem; height: 2.25rem; border-radius: 7px; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav li + li { margin-top: 0; }
.site-nav a {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 550;
}
.site-nav a:hover { background: var(--surface); color: var(--text); }
.site-nav a[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;               /* WCAG 2.5.5's 44px, met at AA level anyway */
  padding: var(--space-2) var(--space-5);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
  text-decoration: none;
}
.button--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.button--secondary:hover {
  background: var(--surface);
  border-color: var(--text);
  color: var(--text);
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* ---------- Hero ---------- */

.hero { padding-block: var(--space-8); }
.hero__inner {
  display: grid;
  gap: var(--space-7);
  align-items: center;
}
@media (min-width: 52rem) {
  .hero__inner { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
}
.hero__art {
  display: none;                     /* decorative; on a phone the header already shows the mark */
  justify-self: center;
  width: min(100%, 20rem);
}
@media (min-width: 52rem) {
  .hero__art { display: block; }
}
.hero__art img {
  width: 100%;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.eyebrow {
  display: block;
  font-size: var(--step--1);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-3);
}
.lede {
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 42ch;
}
.muted { color: var(--muted); }

/* ---------- Cards ---------- */

.card {
  height: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: var(--space-2); }
.card p:last-child { margin-bottom: 0; }

/* ---------- Note ---------- */

.note {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-4) var(--space-5);
  max-width: var(--measure);
}
.note > :last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;                  /* a wide table scrolls inside itself, never the page */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
}
.table-wrap:focus-visible { outline-offset: 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  margin: 0;
}
caption {
  text-align: left;
  font-weight: 650;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
thead th { background: var(--surface); font-weight: 650; }
tbody tr:last-child > * { border-bottom: 0; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--step--1);
  color: var(--muted);
}
.site-footer__inner {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-7) var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
}
.site-footer h2 {
  font-size: var(--step--1);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: var(--space-3);
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer a { overflow-wrap: anywhere; }
.site-footer a { color: var(--text); }
.site-footer a:hover { color: var(--accent); }
.site-footer__legal p {
  margin: 0;
  max-width: none;
  border-top: 1px solid var(--border);
  padding-block: var(--space-4);
}

/* ---------- Page sections ---------- */

.section--tight-bottom { padding-bottom: var(--space-6); }
.section--flush-top { padding-top: 0; }

.section__intro {
  max-width: 46rem;
  margin-bottom: var(--space-6);
}
.section__intro > :last-child { margin-bottom: 0; }

.fineprint {
  font-size: var(--step--1);
  color: var(--muted);
}

.note--spaced { margin-top: var(--space-6); }

/* A short position statement: the strongest claim on a page, set apart but not shouted. */
.statement {
  margin-top: var(--space-6);
  max-width: 52rem;
  padding: var(--space-5) var(--space-6);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.statement h3 { font-size: var(--step-2); margin-bottom: var(--space-3); }
.statement p:last-child { margin-bottom: 0; }

/* A closing call to action: a raised panel, text and button side by side when there is room. */
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5) var(--space-6);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-6);
  box-shadow: var(--shadow);
}
.cta > div { flex: 1 1 20rem; }
.cta h2 { font-size: var(--step-2); margin-bottom: var(--space-2); }
.cta p:last-child { margin-bottom: 0; }

/* The criteria table: the criterion is the row header, its number set apart. It stays a
   real table at every width - changing a table's display to stack it on a phone makes
   Safari stop announcing it as a table - and its two columns wrap to fit 320px. */
.criteria { font-size: var(--step-0); }
.criteria tbody th {
  width: 32%;
  font-weight: 650;
}
.criteria .sc {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--accent);
}
.criteria .level {
  display: inline-block;
  padding: 0 0.4em;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  vertical-align: 0.1em;
}
/* A criterion with several kinds of repair lists them, each with a bold lead-in. */
.cell-list { margin: 0; padding-left: 1.1rem; }
.cell-list li + li { margin-top: var(--space-2); }
@media (max-width: 30rem) {
  .criteria th, .criteria td { padding: var(--space-3); }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  a, .button, .site-nav a { transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease; }
}

/* ---------- Print ---------- */

@media print {
  .site-header nav, .skip-link, .button-row { display: none; }
  body { color: #000; background: #fff; }
  a { color: #000; }
}
