/* Funnel styles. Mobile first (375px), widens at 720px.
   Theme variables are written by the build from the client config (see lib/theme.js):
   --brand        action colour: buttons, progress, label bars, icons, selection
   --brand-2      dark surface: answer cards, Yes/No buttons
   --on-brand     readable text on --brand (white or dark, picked automatically)
   --on-brand-2   readable text on --brand-2
   --brand-text   --brand darkened where needed so small text reads on white (links, labels)
   --brand-text-lg  the same for large headings (needs less contrast, so stays closer to --brand)
   --font-display / --font-body, --radius */
:root {
  --brand: #1F6FEB;
  --brand-2: #0B0F14;
  --on-brand: #FFFFFF;
  --on-brand-2: #FFFFFF;
  --brand-text: #1F6FEB;
  --font-display: system-ui, sans-serif;
  --font-body: system-ui, sans-serif;
  --radius: 12px;
  --ink: #0F172A;
  --muted: #52606D;
  --line: #CDD4DD;
  --soft: #F1F4F8;
  --bad: #B42318;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
}
body.has-consent { padding-bottom: 140px; }
img, svg { display: block; max-width: 100%; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }
input, textarea { caret-color: var(--brand-text); }
a { color: inherit; }
.h1, .q, .h2, .btn, .yn, .card-label, .eyebrow, .num, .next h3, .label, .back { font-family: var(--font-display); }

.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;
}

/* ---- header ---- */
.top { width: 100%; max-width: 880px; margin: 0 auto; padding: 16px 16px 0; }
.logo { height: 44px; width: auto; max-width: 220px; margin: 0 auto; object-fit: contain; }
.progress { height: 4px; margin-top: 14px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.progress[hidden] { display: none; }
.progress span { display: block; height: 100%; width: 100%; background: var(--brand); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }

/* ---- screen ---- */
main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 12px 16px 8px; text-align: center; outline: none; }
.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 56px; padding: 0 8px 0 4px;
  float: left; margin: -4px 0 0 -4px; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none;
}
.back:hover { color: var(--ink); }
.back + * { clear: both; }
.h1 { margin: 8px auto 10px; max-width: 720px; font-size: clamp(26px, 7.2vw, 42px); font-weight: 800; line-height: 1.12; letter-spacing: -.015em; text-wrap: balance; }
.hl { color: var(--brand-text-lg, var(--brand-text)); } /* only used in large headings */
.sub { max-width: 560px; margin: 0 auto 20px; color: var(--muted); font-size: 16px; text-wrap: pretty; }
.eyebrow { margin: 4px 0 0; color: var(--brand-text); font-weight: 700; font-size: 15px; clear: both; }

/* step 1 */
.hero { width: 100%; height: auto; aspect-ratio: 900 / 560; max-height: 40vh; object-fit: cover; object-position: center 35%; margin: 10px 0 18px; border-radius: calc(var(--radius) + 4px); background: var(--soft); }
/* While the cookie banner is up, shrink the photo so the Yes/No buttons stay visible above it. */
.has-consent .hero { max-height: 26vh; }
.q { margin: 0; font-size: clamp(23px, 6.4vw, 32px); font-weight: 800; line-height: 1.2; }
.hint { margin: 2px 0 14px; color: var(--muted); font-size: 14px; }
.yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 64px; padding: 0 16px;
  border: 0; border-radius: var(--radius); background: var(--brand-2); color: var(--on-brand-2);
  font-size: 24px; font-weight: 800; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.yn svg { width: 24px; height: 24px; flex: none; }

/* icon cards */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden;
  border: 0; border-radius: var(--radius); background: var(--brand-2);
  font: inherit; text-align: center; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.card-icon { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 14px; color: var(--brand); }
.card-icon svg { width: 52%; max-width: 88px; height: auto; }
.card-icon .coin { fill: var(--brand-2); }
/* Full-width option rows (used where labels are long, e.g. the grant question). */
.rows { display: grid; gap: 12px; max-width: 560px; margin: 0 auto; }
.card.row { flex-direction: row; align-items: center; gap: 14px; min-height: 72px; padding: 12px 52px 12px 14px; text-align: left; }
.row .card-icon { flex: none; width: 48px; height: 48px; aspect-ratio: 1; padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--brand) 18%, transparent); }
.row .card-icon svg { width: 26px; max-width: none; }
.row .card-icon { margin: 0; }
.row-text { display: grid; flex: 1; gap: 2px; }
.row .card-label { justify-content: flex-start; min-height: 0; padding: 0; background: none; color: var(--on-brand-2); font-size: 17px; }
.row-note { color: color-mix(in srgb, var(--on-brand-2) 78%, transparent); font-size: 14px; line-height: 1.35; }
.card.row.is-selected::before, .card.row.is-selected::after { top: 50%; right: 14px; translate: 0 -50%; }
.grant-help { max-width: 560px; margin: 14px auto 0; text-align: left; font-size: 15px; }
.grant-help summary { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; color: var(--brand-text); cursor: pointer; list-style: none; }
.grant-help summary::-webkit-details-marker { display: none; }
/* Drawn chevron: points down when closed, up when open. */
.grant-help summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; translate: 0 -2px; rotate: 45deg; transition: rotate .2s var(--ease), translate .2s var(--ease); }
.grant-help[open] summary::after { rotate: -135deg; translate: 0 2px; }
.grant-help ol { margin: 2px 0 6px; padding-left: 22px; color: var(--muted); line-height: 1.45; }
.grant-help li { margin: 4px 0; }
.rows ~ .assure { max-width: 560px; margin: 10px auto 0; }
.card-label {
  display: flex; flex: 1; align-items: center; justify-content: center; min-height: 56px; padding: 10px 8px;
  background: var(--brand); color: var(--on-brand); font-size: 15px; font-weight: 700; line-height: 1.25;
}
@media (hover: hover) {
  .card:hover, .yn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15, 23, 42, .2); }
}
.card:active, .yn:active { transform: scale(.98); }
.card.is-selected, .yn.is-selected { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--brand); }
/* Check badge on the chosen answer: a drawn tick (mask) on a brand disc. aria-pressed announces it. */
.card.is-selected::before, .card.is-selected::after {
  content: ''; position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
}
.card.is-selected::before { background: var(--brand); }
.card.is-selected::after { background: var(--on-brand); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 16px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 16px no-repeat; }

/* ---- forms ---- */
.stack { display: grid; gap: 12px; max-width: 480px; margin: 0 auto; text-align: left; }
.field-wrap { display: grid; gap: 6px; }
.label { font-size: 14px; font-weight: 700; }
.field, .input {
  width: 100%; min-height: 56px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); font: inherit; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.select { padding: 0 14px; }
.textarea { min-height: 128px; padding: 14px; resize: vertical; line-height: 1.45; }
.input { display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.input input {
  flex: 1; min-width: 0; min-height: 56px; padding: 0; border: 0; outline: 0;
  background: transparent; color: inherit; font: inherit; font-size: 16px;
}
.input-icon { display: flex; color: var(--muted); }
.input-icon svg { width: 20px; height: 20px; }
.prefix { display: flex; align-items: center; gap: 8px; padding-right: 10px; border-right: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.field:focus, .input:focus-within { border-color: var(--brand-text); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.input.invalid, .field[aria-invalid="true"] { border-color: var(--bad); }
::placeholder { color: #7A8491; opacity: 1; }
.err { margin: 0; color: var(--bad); font-size: 14px; font-weight: 600; }
.err[hidden] { display: none; }
.err-form { padding: 12px 14px; border-radius: var(--radius); background: #FEF3F2; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 4px 0; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--brand-2); cursor: pointer; }
.check a { color: var(--brand-text); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.assure { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; }
.assure svg { width: 16px; height: 16px; flex: none; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 56px; padding: 0 24px; border: 0; border-radius: var(--radius);
  background: var(--brand); color: var(--on-brand); font-size: 18px; font-weight: 800;
  text-decoration: none; cursor: pointer; transition: filter .15s, transform .1s;
}
.btn__dot { display: inline-grid; place-items: center; flex: none; }
.btn svg { width: 20px; height: 20px; flex: none; transition: transform .15s var(--ease); }
.btn:hover { filter: brightness(1.06); }
.btn:hover .btn__dot svg { transform: translateX(3px); }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .7; cursor: progress; }
.btn-lg { min-height: 60px; font-size: 19px; }
.btn-ghost { background: #fff; color: var(--brand-text); box-shadow: inset 0 0 0 2px var(--brand-text); }
.btn-choice { min-height: 56px; background: var(--brand-2); color: var(--on-brand-2); font-size: 16px; }
:is(.btn, .card, .yn, .back, a, input, select, textarea, .linkish):focus-visible { outline: 3px solid var(--brand-text); outline-offset: 3px; }
.input input:focus-visible { outline: none; }

/* ---- review strip ---- */
.reviews { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; padding: 22px 16px 28px; font-size: 14px; font-weight: 700; text-align: center; }
.reviews[hidden] { display: none; }
.stars { display: inline-flex; color: var(--brand); }
.stars svg { width: auto; height: 18px; }

/* ---- consent ---- */
.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(15, 23, 42, .1);
}
.consent[hidden] { display: none; }
.consent-inner { display: grid; gap: 8px; max-width: 640px; margin: 0 auto; }
.consent p { margin: 0; font-size: 13px; line-height: 1.4; }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.noscript { padding: 16px; text-align: center; }
.foot { margin: -12px 0 16px; text-align: center; }
.has-consent .foot { visibility: hidden; } /* the banner itself is already open */
.linkish { min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }

/* ---- thank-you ---- */
.thanks .h1 { max-width: 760px; font-size: clamp(24px, 6.2vw, 38px); }
.btn-call { max-width: 420px; min-height: 64px; margin: 4px auto 24px; font-size: 20px; }
.btn-call svg { width: 22px; height: 22px; }
.rule { margin: 32px 0 24px; border: 0; border-top: 1px solid var(--line); }
.h2 { margin: 0 0 20px; font-size: clamp(24px, 6vw, 36px); font-weight: 800; line-height: 1.15; }
.next { display: grid; gap: 24px; margin: 0; padding: 0; list-style: none; }
.next h3 { margin: 10px 0 2px; font-size: 17px; font-weight: 800; }
.next p { max-width: 340px; margin: 0 auto; color: var(--muted); }
.num { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: calc(var(--radius) / 2); background: var(--brand); color: var(--on-brand); font-size: 22px; font-weight: 800; }

/* ---- embedded in a client's website (embed.js) ---- */
.embedded body { min-height: 0; padding-bottom: 0; }
.embedded .consent { position: static; order: -1; box-shadow: none; border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 16px 0; }
.embedded .has-consent .hero, .embedded .hero { max-height: 40vh; }

@media (min-width: 720px) {
  main { padding-top: 20px; }
  .cards { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .yesno { max-width: 640px; margin: 0 auto; }
  .hero { max-width: 760px; margin-left: auto; margin-right: auto; }
  .next { grid-template-columns: 1fr 1fr; gap: 32px 40px; }
  .btn-call { width: auto; padding: 0 40px; }
}

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