:root {
  --bg:          #F3F4F2; /* page background */
  --surface:     #FFFFFF; /* cards, form fields, export page */
  --stone:       #9E9C8F; /* borders, dividers, inactive states ONLY — never text (2.8:1) */
  --rust:        #C95140; /* primary CTA buttons, timer ring, active selection */
  --teal:        #164A59; /* headings, body text, secondary buttons, footer */

  /* derived for legibility — use these, not the base colors, for small text */
  --rust-text:   #A8432F; /* rust links/labels on light backgrounds (6.0:1 on white, 5.4:1 on --bg) */
  --muted-text:  #6B6A60; /* captions, helper text (5.5:1 on white, 4.9:1 on --bg) */

  --rust-tint:   #FBEDEA;
  --gutter: 16px;
  --radius: 12px;
  --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

/* Components set display (e.g. .btn is flex), which would override the hidden attribute. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--teal);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
}

h1, h2 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
p { margin: 0 0 16px; }
h1:focus { outline: none; }

a { color: var(--rust-text); text-underline-offset: 3px; }

:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

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

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 10;
  background: var(--teal); color: #fff; padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 8px; }

/* ---------- Brand band ---------- */

.brand-band {
  background: var(--surface);
  display: flex;
  justify-content: center;
  padding: 20px var(--gutter);
  border-bottom: 1px solid var(--stone);
}
.logo-link { display: inline-block; padding: 4px; text-decoration: none; }
.logo { display: block; width: 240px; max-width: 100%; height: auto; }

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

main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; }
.screen { padding: 28px var(--gutter) 40px; }
body:not([data-screen="food-noise"]):not([data-screen="export"]) main { padding-bottom: 72px; }

.lead { font-size: 19px; }
.subhead { font-size: 21px; line-height: 1.4; }
.small { font-size: 16px; color: var(--muted-text); }
.byline { font-size: 16px; color: var(--muted-text); margin-top: 24px; }

.stack { display: grid; gap: 12px; margin-bottom: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
}

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

.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
}
/* White on rust passes only as large text: keep these labels bold and at least 19px. */
.btn-primary { background: var(--rust); color: #fff; }
.btn-primary:hover { background: #B44736; }
.btn-secondary { background: var(--surface); color: var(--teal); border-color: var(--teal); }
.btn-secondary:hover { background: var(--teal); color: #fff; }

.link {
  background: none; border: 0; padding: 0; font: inherit; color: var(--rust-text);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px;
}

/* ---------- Welcome ---------- */

.screen-welcome h1 { font-size: 34px; margin-top: 8px; }
.screen-welcome .subhead { margin-bottom: 28px; }

/* ---------- Forms ---------- */

.field { margin: 0 0 22px; border: 0; padding: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 8px; }
input[type="text"], input[type="email"] {
  width: 100%; min-height: var(--tap);
  padding: 10px 14px;
  font: inherit;
  color: var(--teal);
  background: var(--surface);
  border: 2px solid var(--stone);
  border-radius: 10px;
}
input[type="text"]:focus, input[type="email"]:focus { border-color: var(--teal); }
input[aria-invalid="true"] { border-color: var(--rust); }

.options { display: grid; gap: 10px; }
.option, .consent {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--surface);
  border: 2px solid var(--stone);
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
}
.consent { align-items: flex-start; font-size: 16px; }
.option:has(input:checked) { border-color: var(--rust); background: var(--rust-tint); }
.option input, .consent input { width: 22px; height: 22px; margin: 0; accent-color: var(--rust); flex: none; }
.consent input { margin-top: 2px; }

.field-error { color: var(--rust-text); font-size: 16px; font-weight: 600; margin: 8px 0 0; }

.error-summary {
  border: 2px solid var(--rust); background: var(--surface);
  border-radius: var(--radius); padding: 16px; margin-bottom: 20px;
}
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary p { margin-bottom: 8px; }

/* ---------- Check ---------- */

.group { margin: 28px 0 8px; }
.group h2 { border-bottom: 1px solid var(--stone); padding-bottom: 6px; }
.item {
  border: 0; margin: 0 0 18px; padding: 14px;
  background: var(--surface); border-radius: var(--radius);
  border: 2px solid transparent;
}
.item.invalid { border-color: var(--rust); }
.item legend { float: left; width: 100%; font-weight: 500; margin-bottom: 12px; }
.choice { clear: both; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label {
  position: relative; margin: 0;
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap);
  border: 2px solid var(--stone); border-radius: 10px;
  font-weight: 600; cursor: pointer;
}
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--rust); background: var(--rust-tint); }
.choice label:has(input:checked) span::before { content: "✓ "; color: var(--rust-text); }
.choice label:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ---------- Report ---------- */

.demo-note {
  font-size: 15px; color: var(--teal); background: var(--surface);
  border: 1px dashed var(--stone); border-radius: 8px; padding: 8px 12px;
}
.screen-report h1 { margin-bottom: 4px; }
.screen-report > .small { margin-bottom: 20px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { position: relative; padding: 8px 0 8px 32px; border-top: 1px solid #E4E4DF; }
.list li:first-child { border-top: 0; }
.list li::before {
  position: absolute; left: 0; top: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.list-in li::before { content: "✓"; background: var(--teal); color: #fff; }
.list-attention li::before { content: ""; border: 2px solid var(--rust); width: 22px; height: 22px; }
.empty { color: var(--muted-text); margin: 0; }

.next-step { border: 2px solid var(--teal); }
.next-step h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-text); }
.next-step > p:first-of-type { font-size: 21px; font-weight: 600; line-height: 1.35; }
.secondary-cta { margin: 14px 0 0; text-align: center; }
.secondary-cta a { display: inline-block; min-height: 44px; line-height: 44px; font-weight: 600; }

.more { margin: 24px 0; }
.plan-note { font-weight: 600; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { border-top: 1px solid var(--stone); }
.link-list li:last-child { border-bottom: 1px solid var(--stone); }
.link-list a {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; font-weight: 600; text-decoration: none;
}
.link-list a::after { content: "→"; }

.recheck { text-align: center; margin-top: 28px; }
.recheck p { color: var(--muted-text); }

/* ---------- Food Noise Now ---------- */

.fnn-step { font-size: 15px; color: var(--muted-text); text-transform: uppercase; letter-spacing: 0.08em; }
.fnn h1 { font-size: 34px; }
.fnn-copy { font-size: 22px; line-height: 1.4; margin-bottom: 28px; }
.fnn-signs { margin-top: 32px; font-weight: 600; }

.timer-why { font-size: 18px; }
.sources { margin-top: 20px; font-size: 15px; color: var(--muted-text); }
.sources summary {
  display: flex; align-items: center; min-height: 44px;
  color: var(--rust-text); font-weight: 600; cursor: pointer;
}
.sources p, .sources ul { margin: 0 0 8px; }
.sources ul { padding-left: 20px; }
.sources cite { font-style: italic; }
.timer { position: relative; width: 220px; height: 220px; margin: 8px auto 24px; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: #E4E4DF; stroke-width: 8; }
.timer-ring { fill: none; stroke: var(--rust); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.5s linear; }
.timer-prompt { min-height: 4.2em; }
.fade-in { animation: fade-in 0.8s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }
.timer-digits {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums;
}

.escalation .list li { padding-left: 24px; }
.escalation .list li::before { content: "•"; font-size: 22px; top: 2px; }
.crisis-link { display: inline-block; min-height: 44px; line-height: 44px; padding: 0 2px; }
.privacy-note { font-size: 16px; color: var(--muted-text); margin-top: 16px; }
.clear-link { margin-top: 16px; }
.clear-link a { display: inline-block; min-height: 44px; line-height: 44px; }
.notice {
  background: var(--surface); border: 1px solid var(--stone); border-left: 4px solid var(--teal);
  border-radius: 8px; padding: 10px 14px; font-weight: 600;
}
.crisis { border-left: 4px solid var(--rust); padding: 8px 0 8px 14px; font-weight: 600; }

.fnn-button {
  position: fixed; right: var(--gutter); bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 5;
  min-height: 52px; padding: 10px 20px;
  background: var(--surface); color: var(--rust-text);
  border: 2px solid var(--rust); border-radius: 999px;
  font: inherit; font-size: 19px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(22, 74, 89, 0.35);
  cursor: pointer;
}
.fnn-button:hover { background: var(--rust-tint); }

/* ---------- Export ---------- */

.export-actions { display: grid; gap: 8px; margin-bottom: 20px; }
.link-back { display: block; text-align: center; min-height: 44px; line-height: 44px; font-weight: 600; }
.export-sheet {
  background: var(--surface); border: 1px solid var(--stone); border-radius: var(--radius);
  padding: 24px 20px;
}
.export-sheet h1 { font-size: 26px; }
.export-sheet h2 { font-size: 18px; margin-top: 20px; }
.export-sheet ul, .export-sheet ol { padding-left: 22px; margin: 0 0 8px; }
.export-sheet li { margin-bottom: 6px; }
.export-meta { color: var(--muted-text); }
.notes span { display: block; height: 34px; border-bottom: 1px solid var(--stone); }
.export-disclaimer { font-size: 14px; color: var(--muted-text); margin: 20px 0 0; }

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

.site-footer {
  background: var(--teal); color: #fff;
  padding: 24px var(--gutter) calc(24px + env(safe-area-inset-bottom));
  font-size: 15px;
}
/* Room for the floating Food Noise button so it never covers the footer text. */
body:has(.fnn-button:not([hidden])) .site-footer {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
.site-footer p { max-width: 560px; margin: 0 auto 10px; }
.site-footer .clear-data a { color: #fff; display: inline-block; min-height: 44px; line-height: 44px; }
.site-footer .disclaimer { font-weight: 600; }
.site-footer .tagline { font-style: italic; }
.site-footer .practice { margin-bottom: 0; opacity: 0.92; }

/* ---------- Print: the export only ---------- */

@media print {
  @page { margin: 0.6in; }
  body { background: #fff; font-size: 12pt; display: block; min-height: 0; }
  .brand-band { border: 0; padding: 0 0 8pt; justify-content: flex-start; }
  .logo { width: 160px; }
  .skip-link, .fnn-button, .no-print, .site-footer { display: none !important; }
  main { max-width: none; padding: 0 !important; }
  .screen { padding: 0; }
  .export-sheet { border: 0; padding: 0; }
  .export-sheet h1 { font-size: 20pt; }
  .export-sheet h2 { font-size: 13pt; margin-top: 12pt; }
  .export-sheet li { margin-bottom: 3pt; }
  .notes span { height: 24pt; }
  a { color: inherit; text-decoration: none; }
}
