:root {
  --navy: #15305A;
  --navy-deep: #0E2342;
  --gold: #C9962B;
  --gold-light: #D9B562;
  --brick: #9E2A2B;
  --cream: #F1EBDD;
  --panel: #F4F1EC;
  --muted: #4A5568;
  --line: #D8D2C6;
  --white: #FFFFFF;
  --serif: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --tap: 52px;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--brick); }

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

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }

.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: 8px; top: -60px; z-index: 10;
  background: var(--navy); color: var(--white); padding: 10px 14px; border-radius: 4px;
  font-weight: 600;
}
.skip:focus { top: 8px; color: var(--white); }

/* Small uppercase labels */
.label, .kicker, .topbar, .q-hint, .meter-label, .section-head, .r-meta, .tag, .quote-meta {
  font-family: var(--sans);
}

/* ---------- Masthead ---------- */

.masthead { padding-top: 10px; }

.topbar {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.nameplate { text-align: center; padding-top: 18px; padding-bottom: 12px; }

.brand { display: inline-block; line-height: 0; }
.brand-logo { display: block; width: min(100%, 340px); height: auto; margin: 0 auto; }

.tagline {
  margin: 10px 0 0;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: #8A6516;
  text-wrap: balance;
}

.double-rule {
  height: 7px;
  border-top: 3px solid var(--navy);
  border-bottom: 1px solid var(--navy);
}

.rule-thin { border-top: 1px solid var(--line); margin: 28px 0; }

/* ---------- Story ---------- */

.story { padding: 26px 0 8px; }
.story.narrow { max-width: 460px; margin: 0 auto; }

.kicker {
  margin: 0 0 10px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brick);
}

.headline {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.35rem, 10vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--navy);
  text-wrap: balance;
}

.lede {
  font-size: 1.1875rem; line-height: 1.55; margin: 0;
  color: var(--navy);
}

/* ---------- Survey ---------- */

.survey { margin: 0; }

.q {
  padding: 26px 0 28px;
  border-bottom: 1px solid var(--line);
}
.q:first-of-type { padding-top: 4px; }

.q fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.q-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 0; margin: 0 0 6px;
  font-family: var(--serif); font-weight: 400;
  font-size: 1.5rem; line-height: 1.2;
  color: var(--navy);
}
legend.q-head { float: left; width: 100%; }
legend.q-head + * { clear: both; }

.qnum {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-top: -1px;
  border-radius: 50%;
  background: var(--navy); color: var(--gold-light);
  font-family: var(--sans); font-weight: 700; font-size: 0.9375rem;
  letter-spacing: 0;
}

.q-title { flex: 1 1 auto; padding-top: 2px; text-wrap: pretty; }

.q-hint {
  margin: 0 0 14px 50px;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}

.q-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: var(--panel);
  border-left: 3px solid var(--gold);
  font-size: 0.9375rem; color: var(--muted);
}

.choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.choice {
  display: flex; align-items: center; gap: 14px;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: 1.0625rem; line-height: 1.35;
  transition: border-color .12s ease, background-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.choice:hover { border-color: var(--navy); }
.choice:has(input:checked) { border-color: var(--navy); background: var(--panel); box-shadow: inset 4px 0 0 var(--gold); }
.choice:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }

.choice input {
  flex: 0 0 auto;
  width: 24px; height: 24px; margin: 0;
  accent-color: var(--navy);
  cursor: pointer;
}
.choice input:focus-visible { outline: none; }

input[type="text"], input[type="email"], input[type="password"], textarea {
  display: block; width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1.5px solid #9AA3B2;
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  font: inherit; font-size: 1.0625rem; /* 17px keeps iOS from zooming */
  line-height: 1.4;
  margin-top: 8px;
}
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6B7280; }
input:focus, textarea:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--navy); }

.input-zip { max-width: 10ch; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }

.has-error input, .has-error textarea { border-color: var(--brick); border-width: 2px; }
.q-error { margin: 6px 0 0; color: var(--brick); font-weight: 600; font-size: 0.9375rem; }

.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.alert {
  margin: 0 0 24px; padding: 14px 16px;
  border: 2px solid var(--brick); border-radius: 8px;
  background: #FBF3F2; color: var(--navy);
}
.alert p { margin: 0 0 6px; }
.alert p:last-child { margin-bottom: 0; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert a { color: var(--brick); font-weight: 600; }

.submit-row { padding: 28px 0 8px; }
.submit-note { margin: 12px 0 0; color: var(--muted); font-size: 0.9375rem; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 0 28px;
  border-radius: 8px; border: 2px solid var(--navy);
  font: inherit; font-weight: 700; font-size: 1.0625rem; letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--navy); color: var(--white); width: 100%; }
.btn-primary:hover { background: var(--navy-deep); color: var(--white); }
.btn-primary[disabled] { opacity: .7; cursor: progress; }
.btn-ghost { background: var(--white); color: var(--navy); }
.btn-ghost:hover { background: var(--panel); color: var(--navy); }

/* ---------- Thanks ---------- */

.share-head { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.2; margin: 0 0 12px; }
.share-url { font-size: 1.125rem; font-weight: 600; margin: 0 0 18px; word-break: break-word; }
.share-status { min-height: 1.5em; color: var(--muted); margin: 10px 0 0; text-align: center; }

/* ---------- Login ---------- */

.login { margin-top: 18px; }
.login .btn { margin-top: 16px; }

/* ---------- Results ---------- */

.results .lede { color: var(--muted); }
.r-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.r-actions .btn-primary { width: auto; }
.r-actions form { margin: 0; }

.section-head {
  display: flex; align-items: center; gap: 12px;
  margin: 36px 0 14px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brick);
}
.section-head::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.meters { display: grid; gap: 14px; }
@media (min-width: 640px) { .meters { grid-template-columns: 1fr 1fr; } }

.meter { background: var(--navy); color: var(--white); border-radius: 10px; padding: 18px; }
.meter-label { margin: 0; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-light); }
.meter-figure { margin: 6px 0 12px; }
.meter-value { font-family: var(--serif); font-size: 3rem; line-height: 1; }
.meter-goal { color: var(--cream); font-weight: 600; }
.meter-track { height: 10px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--gold-light); border-radius: 99px; min-width: 2px; }
.meter-sub { margin: 10px 0 0; font-size: 0.875rem; color: var(--cream); }

.r-block { padding: 6px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.r-q { display: flex; gap: 12px; align-items: flex-start; font-family: var(--serif); font-weight: 400; font-size: 1.3rem; line-height: 1.25; margin: 0 0 4px; }
.r-q .qnum { width: 30px; height: 30px; font-size: 0.8125rem; }
.r-meta { margin: 0 0 12px; font-size: 0.875rem; color: var(--muted); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar-text { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9375rem; margin-bottom: 4px; }
.bar-count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-pct { font-weight: 500; color: var(--muted); }
.bar-track { height: 12px; background: var(--panel); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy); border-right: 3px solid var(--gold); }
.bar-fill[style="width:0%"] { border-right: 0; }

.zips { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.zip-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dotted var(--line); break-inside: avoid; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 3px; background: var(--brick); color: var(--white); font-size: 0.625rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; vertical-align: 2px; }

.quotes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.quote { background: var(--panel); border-left: 3px solid var(--gold); padding: 12px 14px; border-radius: 0 6px 6px 0; }
.quote-text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.quote-meta { margin: 6px 0 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.empty { color: var(--muted); }

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

.site-footer { padding: 8px 0 40px; color: var(--muted); font-size: 0.875rem; text-align: center; }
.site-footer p { margin: 0 0 4px; }
.footer-name { font-family: var(--serif); font-size: 1.25rem; color: var(--navy); }
.footer-small { margin-top: 10px !important; font-size: 0.8125rem; }

/* ---------- Larger screens ---------- */

@media (min-width: 640px) {
  .wrap { padding: 0 24px; }
  .brand-logo { width: 440px; }
  .tagline { font-size: 0.75rem; margin-top: 12px; }
  .nameplate { padding-top: 26px; padding-bottom: 18px; }
  .story { padding-top: 34px; }
  .q-head { font-size: 1.65rem; }
  .btn-primary { width: auto; min-width: 280px; }
  .submit-row { text-align: center; }
  .share { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
