/* MILDAF one-sheet. A quiet clinical handout: cool paper, ink-blue type, and one census-board
   visual that carries the color. Green means room, red means full; every color sits beside text. */

:root {
  --paper: #f5f8f9;
  --surface: #ffffff;
  --ink: #14303c;
  --muted: #4d6270;
  --rule: #d2dce1;
  --action: #1b5a96;
  --open: #1a6a4d;
  --open-soft: #e1f0e8;
  --full: #a3302b;
  --full-soft: #f8e3e1;
  --on-action: #ffffff;

  --font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 16px;
  --measure: 64ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1c23;
    --surface: #15262f;
    --ink: #e8eff2;
    --muted: #a3b5bf;
    --rule: #2a3f4a;
    --action: #7db3e8;
    --open: #6fcca4;
    --open-soft: #173a2e;
    --full: #ff8f86;
    --full-soft: #43201e;
    --on-action: #0f1c23;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1c23;
  --surface: #15262f;
  --ink: #e8eff2;
  --muted: #a3b5bf;
  --rule: #2a3f4a;
  --action: #7db3e8;
  --open: #6fcca4;
  --open-soft: #173a2e;
  --full: #ff8f86;
  --full-soft: #43201e;
  --on-action: #0f1c23;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem; /* 17px */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, figure, ol { margin: 0; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; }
h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 700; }
b { font-weight: 700; }

a { color: var(--action); text-underline-offset: 0.18em; }

:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.skip {
  position: absolute; left: var(--gutter); top: -60px;
  background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 8px; z-index: 10;
}
.skip:focus { top: 10px; }

.wrap {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* Masthead */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px;
  padding-block: 14px; font-size: 0.875rem; color: var(--muted);
}
.maker { color: var(--ink); font-weight: 700; }

main.wrap { display: grid; gap: 64px; padding-block: 32px 72px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 20px;
  border-radius: 10px; border: 2px solid var(--action);
  font: inherit; font-size: 1rem; font-weight: 700; line-height: 1.2; text-align: center;
  text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--action); }
.btn-quiet:hover { background: color-mix(in srgb, var(--action) 8%, transparent); }
.btn-text { background: transparent; border-color: transparent; color: var(--muted); text-decoration: underline; padding-inline: 8px; }
.btn-text:hover { color: var(--ink); }
.btn-small { min-height: 44px; padding: 10px 16px; font-size: 0.9375rem; }

.fine { font-size: 0.875rem; color: var(--muted); max-width: var(--measure); }
.addr { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }

/* Hero */
.hero { display: grid; gap: 32px; align-items: center; }
.hero-copy { display: grid; gap: 18px; }
h1 {
  font-size: clamp(2.25rem, 9vw, 3.5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.025em;
  max-width: 14ch;
}
.lede { font-size: 1.1875rem; line-height: 1.45; color: var(--muted); max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn { flex: 1 1 auto; }

/* Census board: the one bold element */
.board {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 18px 16px 16px;
  display: grid; gap: 14px;
  box-shadow: 0 1px 0 var(--rule), 0 20px 40px -32px rgba(20, 48, 60, 0.55);
}
.board-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; }
.board-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.sample-tag {
  font-size: 0.8125rem; font-weight: 700; color: var(--muted);
  border: 1.5px dashed var(--muted); border-radius: 999px; padding: 2px 10px;
}
.request { display: flex; gap: 10px; align-items: center; font-size: 0.9375rem; }

.units { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.units th, .units td { text-align: left; padding: 10px 6px; vertical-align: middle; }
.units thead th { font-size: 0.8125rem; font-weight: 700; color: var(--muted); padding-block: 0 6px; border-bottom: 1px solid var(--rule); }
.units tbody tr + tr th, .units tbody tr + tr td { border-top: 1px solid var(--rule); }
.units tbody th { font-size: 1.0625rem; font-weight: 800; width: 28%; }
.units tr.is-target th, .units tr.is-target td { background: var(--full-soft); }
.units tr.is-target th { border-radius: 10px 0 0 10px; }
.units tr.is-target td:last-child { border-radius: 0 10px 10px 0; }

.pips { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 6px; }
.pips i, .pip {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  border: 1.5px solid var(--muted); background: transparent;
}
.pips i.on { background: var(--ink); border-color: var(--ink); }
.pips i.try, .pip-try { border: 1.5px dashed var(--full); background: transparent; }
.pip-try { flex: none; }
.count { white-space: nowrap; font-size: 0.9375rem; }

.state { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 0.9375rem; white-space: nowrap; }
.state svg { width: 16px; height: 16px; flex: none; }
.state-full { color: var(--full); }
.state-open { color: var(--open); }

.verdict {
  border-left: 4px solid var(--full);
  background: var(--full-soft);
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  font-size: 0.9375rem;
}
.verdict strong { color: var(--full); display: block; font-size: 1.0625rem; }
.board figcaption { font-size: 0.875rem; color: var(--muted); }

/* The one orchestrated moment: the extra learner is turned away once. */
@media (prefers-reduced-motion: no-preference) {
  .pips i.try { animation: refuse 0.6s ease-in-out 0.8s 1 both; }
  @keyframes refuse {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
  }
}

/* Who it helps */
.helps { display: grid; gap: 18px; }
.roles { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.role { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 4px; }
.role dt { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.role dd { color: var(--muted); max-width: var(--measure); }
.tag {
  font-size: 0.8125rem; font-weight: 700; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 999px; padding: 1px 9px; background: var(--surface);
}

/* Stages and choices */
.stages { display: grid; gap: 24px; }
.stages-intro { display: grid; gap: 10px; }
.stages-intro p { color: var(--muted); max-width: var(--measure); }

.timeline { list-style: none; padding: 0; display: grid; gap: 40px; }
.stage {
  position: relative;
  padding-left: 22px;
  border-left: 3px solid var(--rule);
  display: grid; gap: 16px;
}
.stage-now { border-left-color: var(--open); }
.stage-pilot { border-left-color: var(--action); }
.stage-later { border-left-style: dashed; border-left-color: var(--muted); }

.stage-head { display: grid; gap: 8px; justify-items: start; }
.stage-head p { color: var(--muted); font-size: 0.9375rem; max-width: var(--measure); }
.stage-head h3 { font-size: 1.1875rem; font-weight: 700; display: grid; gap: 2px; }
.stage-name { font-size: 0.9375rem; font-weight: 800; }
.stage-now .stage-name { color: var(--open); }
.stage-pilot .stage-name { color: var(--action); }
.stage-later .stage-name { color: var(--muted); }

.items { display: grid; border-top: 1px solid var(--rule); }
.item {
  border: 0; margin: 0; padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  display: grid; gap: 10px;
}
.item-text { display: grid; gap: 2px; min-width: 0; }
.item-name { display: block; font-weight: 700; }
.item-desc { display: block; font-size: 0.9375rem; color: var(--muted); max-width: var(--measure); }

.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 360px; }
.choice { position: relative; }
.choice input {
  position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; inset: 0; cursor: pointer;
}
.choice span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 6px;
  border: 1.5px solid var(--rule); border-radius: 10px; background: var(--surface);
  font-weight: 700; font-size: 0.9375rem; white-space: nowrap;
  color: var(--ink);
}
.choice span::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--muted); background: transparent;
}
.choice:hover span { border-color: var(--muted); }
.choice input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 2px; }
.choice input:checked + span { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, var(--surface)); }
.choice input:checked + span::before { border: 4px solid var(--ink); }
.choice-yes input:checked + span { border-color: var(--open); background: var(--open-soft); color: var(--open); }
.choice-yes input:checked + span::before { border-color: var(--open); }
.choice-no input:checked + span { border-color: var(--full); background: var(--full-soft); color: var(--full); }
.choice-no input:checked + span::before { border-color: var(--full); }

/* Send */
.send {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 22px 16px;
  display: grid; gap: 16px;
}
.review { display: grid; gap: 10px; border-block: 1px solid var(--rule); padding-block: 14px; }
.review-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.review-head h3 { font-size: 1rem; }
.status { font-size: 0.9375rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.review-list { display: grid; gap: 10px; font-size: 0.9375rem; }
.review-group { display: grid; gap: 2px; }
.review-group h4 { margin: 0; font-size: 0.875rem; }
.review-group.yes h4 { color: var(--open); }
.review-group.no h4 { color: var(--full); }
.review-group.maybe h4 { color: var(--muted); }
.review-group ul { margin: 0; padding-left: 1.1em; }
.empty { color: var(--muted); }

.note-label { font-weight: 700; font-size: 0.9375rem; }
.note-label span { font-weight: 400; color: var(--muted); }
textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--rule); border-radius: 10px; padding: 10px 12px;
  resize: vertical;
}
textarea:focus-visible { border-color: var(--action); }
.note-label + textarea { margin-top: -8px; }

.send-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.send-actions .btn-primary, .send-actions .btn-quiet { flex: 1 1 180px; }
.feedback { font-size: 0.9375rem; font-weight: 700; min-height: 1.5em; }
.feedback:empty { display: none; }
.copy-fallback { display: grid; gap: 6px; font-size: 0.875rem; }
[hidden] { display: none !important; }

/* Footer */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px;
  padding-block: 18px 40px; border-top: 1px solid var(--rule);
  font-size: 0.875rem; color: var(--muted);
}

/* Wider screens */
@media (min-width: 560px) {
  :root { --gutter: 24px; }
  .board { padding: 22px; }
  .send { padding: 28px; }
  .item { grid-template-columns: minmax(0, 1fr) 300px; align-items: center; column-gap: 20px; }
}

@media (min-width: 900px) {
  main.wrap { gap: 88px; padding-block: 56px 96px; }
  .hero { grid-template-columns: 1fr 1fr; gap: 56px; }
  .helps, .stages, .send { max-width: 760px; }
  .roles { grid-template-columns: 1fr 1fr; column-gap: 32px; border-top: 0; }
  .role { border-top: 1px solid var(--rule); border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  body { background: #fff; color: #000; }
  .masthead, .hero-actions, .send-actions, .stage-head .btn, .copy-fallback, .skip { display: none !important; }
  .board, .send { box-shadow: none; break-inside: avoid; }
  main.wrap { gap: 32px; padding-block: 16px; }
}
