/* Shared styling for all three pages. No framework, no external fonts —
   the CSP blocks third-party requests and the app should stay dependency-free. */

:root {
  /* Tells the browser to render native UI — checkboxes, scrollbars, autofill
     backgrounds — in the matching scheme. Without it, dark mode gets light
     autofill highlights behind dark text. */
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #f7f8f9;
  --border: #dfe3e6;
  /* Separate from --border: a decorative card edge can be soft, but a control
     boundary must hit 3:1 (WCAG 1.4.11). The input fill and the card differ by
     only 1.06:1, so this border is the sole thing marking where a field is. */
  --field-border: #767b82;
  --text: #16191d;
  --muted: #5c6570;
  --accent: #1b4d3e;
  --accent-text: #ffffff;
  --error: #a3231c;
  --error-bg: #fdf2f1;
  --success: #1c6b45;
  --success-bg: #f0f8f3;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2126;
    --border: #2e353c;
    --field-border: #6b747d;
    --text: #e9edf0;
    --muted: #9aa5b1;
    --accent: #4fae87;
    --accent-text: #0d1113;
    --error: #ff8f86;
    --error-bg: #2a1a19;
    --success: #7ed0a8;
    --success-bg: #16241d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* rem, not px: an absolute size ignores a raised browser default font size,
     and since every other size here is rem, mixing the two gives huge headings
     above small body text — worst for the users who raised it. */
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Visible to screen readers only. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.25rem 6rem;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.lede {
  color: var(--muted);
  margin: 0 0 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0 0 0.35rem;
}

.section-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.field { margin-bottom: 1.5rem; }
.field:last-child { margin-bottom: 0; }

/* Radio and checkbox groups render as <fieldset><legend> for accessibility;
   these rules keep that visually identical to a plain field. */
fieldset.field {
  border: 0;
  padding: 0;
  min-inline-size: 0;
}

label.q,
legend.q {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  padding: 0;
}

h2.section-title { line-height: 1.3; }

.error-summary-title {
  font-size: 1rem;
  font-weight: 650;
  margin: 0;
}

/* Keep a focused control clear of the sticky progress bar (WCAG 2.2 2.4.11). */
.field,
fieldset.field,
input,
textarea,
button { scroll-margin-top: 5.5rem; }

.req { color: var(--error); font-weight: 400; }

.help {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--field-border);
  border-radius: 6px;
}

textarea { min-height: 5.5rem; resize: vertical; }

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ~44px tall rather than the 24px minimum: the audience skews older and mobile,
   and adjacent options with no gap invite mis-taps. */
.choice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.5rem;
  margin-inline: -0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.choice:hover { background: var(--bg); }

/* Focus lands on a ~13px native glyph otherwise, with no row-level indication. */
.choice:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.choice input { margin-top: 0.3rem; flex-shrink: 0; }

button {
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  color: var(--accent-text);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

button:disabled { opacity: 0.55; cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.notice {
  padding: 0.8rem 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-size: 0.925rem;
}

.notice.error {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error);
}

.notice.success {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid var(--success);
}

.notice ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  margin: 0;
}

.progress {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  z-index: 10;
}

.bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.25s ease;
}

.saved {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2em;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tag.warn { color: var(--error); border-color: var(--error); }

.footer-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2rem;
}

a { color: var(--accent); }

/* Public form: the honeypot is off screen, out of the tab order and hidden from
   assistive tech. Not display:none, which some bots check for. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Turnstile renders its own iframe; this only reserves its height so the
   submit button does not jump when it loads. */
.turnstile {
  min-height: 65px;
}
