/* quiz.css — styles for Higher or Lower + Which Surfer Are You?
   Reuses shared primitives from site.css (.wrap, .btn, .btn-primary, .label, .card)
   and brand tokens (--navy, --cream, --cream-bg, --paper, --accent, --blue, --good, --bad).
   var() fallbacks are provided only so these pages render sensibly before site.css exists;
   site.css's own values win once it lands. */

.quiz-page [hidden] {
  display: none !important;
}

.quiz-page {
  --q-navy: var(--navy, #162030);
  --q-cream: var(--cream, #EAD8B8);
  --q-cream-bg: var(--cream-bg, #F0E4D0);
  --q-paper: var(--paper, #F7EEDF);
  --q-accent: var(--accent, #C85A14);
  --q-blue: var(--blue, #4A6888);
  --q-good: var(--good, #3E7A4F);
  --q-bad: var(--bad, #B0472B);
  /* Theme-adaptive tokens: --ink/--surface flip in dark mode (site.css), unlike
     --q-navy/--q-paper above, which stay fixed. Card text/background MUST use
     these so contrast holds in both themes (see quiz.css dark-mode audit). */
  --q-ink: var(--ink, var(--q-navy));
  --q-surface: var(--surface, var(--q-paper));
  min-height: 100%;
}

@media (prefers-color-scheme: dark) {
  .quiz-page {
    --q-accent: #E07030;
  }
}

/* ---------- ribbon ---------- */
.data-ribbon {
  display: block;
  width: 100%;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 0.5rem 1rem;
  background: var(--q-blue);
  color: var(--q-cream);
}
.data-ribbon[data-kind="fixture"] { background: var(--q-bad); }
.data-ribbon[data-kind="draft-unverified"] { background: var(--q-blue); }
.data-ribbon:empty { display: none; }

/* ---------- generic quiz shell ---------- */
.quiz-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Intro: a navy "ticket" that matches the home hero, so the quiz opens with
   the brand's confidence instead of a small box floating on cream. */
main.quiz-shell {
  max-width: 560px;
  padding-block: clamp(1.5rem, 5vw, 3.5rem) clamp(2.5rem, 7vw, 4.5rem);
}
.quiz-intro {
  background: #162030;
  color: #EAD8B8;
  border-radius: 20px;
  padding: clamp(2rem, 7vw, 3.25rem) clamp(1.25rem, 6vw, 3rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  box-shadow: 0 18px 40px rgba(22, 32, 48, 0.18);
}
.quiz-intro .quiz-kicker {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #E07030;
}
.quiz-intro h1 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  font-size: clamp(3.6rem, 17vw, 5.6rem);
  line-height: 0.88;
  letter-spacing: 0.01em;
  color: #EAD8B8;
}
.quiz-intro .quiz-lede {
  margin: 0;
  max-width: 30ch;
  font-size: 1.05rem;
  line-height: 1.45;
  color: rgba(234, 216, 184, 0.9);
}
.quiz-facts {
  list-style: none;
  margin: 0.4rem 0;
  padding: 1rem 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid rgba(234, 216, 184, 0.16);
}
.quiz-facts li { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.quiz-facts li + li { border-left: 1px solid rgba(234, 216, 184, 0.16); }
.quiz-facts strong {
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1;
  color: #EAD8B8;
}
.quiz-facts span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(234, 216, 184, 0.65);
}
.quiz-intro .quiz-start {
  width: 100%;
  max-width: 320px;
  min-height: 56px;
  font-size: 1.05rem;
  background: #C85A14;
  border-color: #C85A14;
  color: #fff;
}
.quiz-intro .quiz-note {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(234, 216, 184, 0.6);
}

/* ---------- progress ---------- */
.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
}
.progress-counter {
  font-weight: 700;
  color: var(--q-accent);
}

/* ---------- v1.3: difficulty pill ---------- */
.difficulty-pill {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.difficulty-pill:empty { display: none; }
.difficulty-pill[data-level="easy"] { color: var(--q-good); }
.difficulty-pill[data-level="medium"] { color: var(--q-blue); }
.difficulty-pill[data-level="hard"] { color: var(--q-bad); }

/* ---------- v1.3: streak / daily-done / showdown / percentile ---------- */
.streak-line {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--q-accent);
}

.daily-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}
.daily-done-line {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  color: rgba(234, 216, 184, 0.85);
}

.showdown-line {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--q-ink);
}
.percentile-line {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--q-ink);
  opacity: 0.8;
}

/* reveal "snap": a quick scale pulse on the winning card on reveal */
@keyframes hol-snap {
  0% { transform: scale(1); }
  45% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.surfer-card.snap { animation: hol-snap 120ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  .surfer-card.snap { animation: none; }
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--q-ink) 15%, transparent);
  overflow: hidden;
  margin: 0.4rem 0 0.75rem;
}
.progress-fill {
  height: 100%;
  background: var(--q-accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }

/* ---------- higher/lower question ---------- */
.hol-category {
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  color: var(--q-blue);
}
.hol-prompt {
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.6rem;
  color: var(--q-ink);
  margin: 0.25rem 0 0.35rem;
}

.hol-subline {
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.75;
  margin: 0 0 0.75rem;
}

.hol-h2h-tag {
  display: block;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--q-accent);
  border: 1px solid var(--q-accent);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  width: fit-content;
  margin: 0.15rem auto 0.1rem;
}

.hol-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: stretch;
}
.hol-cards.stack {
  grid-template-columns: 1fr;
}

.surfer-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  border-radius: 14px;
  background: var(--q-surface);
  border: 2px solid color-mix(in srgb, var(--q-ink) 15%, transparent);
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  font: inherit;
  color: inherit;
  text-align: center;
  /* Colours only animate IN (see .is-correct/.is-wrong); a new question must never
     flash the previous answer's red/green while it fades out. */
  transition: transform 0.12s ease;
}
/* Hover only on devices that really hover: on phones a tapped spot would
   leave the next screen's button looking pre-selected. */
@media (hover: hover) { .surfer-card:hover { transform: translateY(-2px); } }
.surfer-card:focus-visible {
  outline: 3px solid var(--q-accent);
  outline-offset: 2px;
}
.surfer-card:disabled { cursor: default; }

.surfer-card img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--q-cream-bg);
}
.surfer-card .surfer-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.surfer-card .surfer-country {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  opacity: 0.7;
}
.surfer-card .surfer-value {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 1.4rem;
  min-height: 1.6rem;
  color: var(--q-ink);
}

.surfer-card.is-correct {
  border-color: var(--q-good);
  background: color-mix(in srgb, var(--q-good) 12%, var(--q-surface));
}
.surfer-card.is-wrong {
  border-color: var(--q-bad);
  background: color-mix(in srgb, var(--q-bad) 12%, var(--q-surface));
}
.surfer-card.is-dimmed { opacity: 0.6; }

/* ---------- higher/lower card kinds: country + break ---------- */
.kind-flag-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--q-cream-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  line-height: 1;
}

.kind-break-tile {
  width: 100%;
  min-height: 84px;
  border-radius: 10px;
  background: var(--q-navy);
  color: var(--q-cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  overflow: hidden;
}
.kind-break-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.kind-break-name {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  text-align: center;
}
.kind-break-wave {
  width: 80px;
  height: 16px;
}
.kind-break-wave path {
  fill: none;
  stroke: var(--q-accent);
  stroke-width: 2;
  opacity: 0.6;
}

.hol-vs {
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1rem;
  color: var(--q-blue);
  margin: -0.25rem 0;
}

.hol-next {
  align-self: center;
  min-width: 160px;
}

/* ---------- email step ---------- */
.email-step {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem 1rem;
}
.email-step h2 {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  color: var(--q-ink);
  margin: 0;
}
.email-step form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}
.email-input {
  width: 100%;
  max-width: 320px;
  min-height: 48px;
  padding: 0 1rem;
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--q-ink) 20%, transparent);
  background: var(--q-surface);
  color: var(--q-ink);
  font: inherit;
  font-size: 1rem;
}
.email-input:focus-visible { outline: 3px solid var(--q-accent); outline-offset: 2px; }
.email-input[aria-invalid="true"] { border-color: var(--q-bad); }
.email-error {
  color: var(--q-bad);
  font-size: 0.85rem;
  margin: -0.4rem 0 0;
}
.honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
}
.email-step .btn-primary { min-width: 200px; }
.skip-link {
  background: none;
  border: none;
  color: var(--q-blue);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: 44px;
  padding: 0 0.5rem;
}
.consent-line {
  font-size: 0.75rem;
  opacity: 0.7;
  max-width: 36ch;
  margin: 0.25rem auto 0;
}

.hol-endscreen, .which-result {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 0;
}
.hol-endscreen h2, .which-result h2 {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2.2rem;
  color: var(--q-ink);
  margin: 0;
}
.hol-endscreen .score-line, .which-result .score-line {
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
}

.end-percent {
  font-family: "Bebas Neue", sans-serif;
  font-size: 4.5rem;
  line-height: 1;
  color: var(--q-accent);
  margin: 0;
}

/* ---------- recap list ---------- */
.recap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  margin: 0.5rem 0;
}
.recap-row {
  border-left: 3px solid var(--q-bad);
  background: color-mix(in srgb, var(--q-bad) 8%, var(--q-surface));
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.recap-row.is-correct {
  border-left-color: var(--q-good);
  background: color-mix(in srgb, var(--q-good) 8%, var(--q-surface));
}
.recap-q {
  margin: 0 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.recap-values {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  opacity: 0.85;
}

/* ---------- story card preview + result actions ---------- */
.story-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.story-canvas-preview {
  /* Big, above-the-fold: fills most of the phone's vertical space while
     leaving room for the score header above and the action buttons below. */
  width: auto;
  /* Card + three buttons fit one phone screen under the header. */
  height: min(calc(100svh - 330px), 560px);
  min-height: 300px;
  max-width: 92vw;
  aspect-ratio: 1080 / 1920;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.3);
}
.end-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 320px;
}
.end-actions .btn { width: 100%; }
.share-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: -0.3rem 0 0;
}
.share-hint p {
  font-size: 0.82rem;
  opacity: 0.75;
  margin: 0;
}

/* ---------- collapsed recap (below the fold) ---------- */
.recap-details {
  width: 100%;
  text-align: left;
  margin-top: 0.25rem;
}
.recap-details summary {
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--q-blue);
  text-align: center;
  padding: 0.5rem 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recap-details[open] summary { color: var(--q-accent); }
.recap-details .recap { margin-top: 0.5rem; }

.reports-nudge-inline {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.5rem;
}
.reports-nudge-inline a { color: var(--q-accent); font-weight: 600; }

/* ---------- which-surfer question screen ---------- */
.which-question {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: stretch;
}
.which-question h2 {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.7rem;
  text-align: center;
  color: var(--q-ink);
  margin: 0;
}
.which-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.which-options button {
  min-height: 56px;
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--q-ink) 15%, transparent);
  background: var(--q-surface);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
/* Hover only on devices that really hover: on phones a tapped spot would
   leave the next screen's button looking pre-selected. */
@media (hover: hover) { .which-options button:hover { transform: translateY(-1px); border-color: var(--q-accent); } }
.which-options button:focus-visible { outline: 3px solid var(--q-accent); outline-offset: 2px; }

.which-result img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--q-cream-bg);
  border: 4px solid var(--q-accent);
}
.which-result .surfer-country { font-family: "JetBrains Mono", monospace; opacity: 0.75; }
.which-result .surfer-stance {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--q-blue);
}
.which-result .surfer-fact {
  max-width: 40ch;
  font-size: 0.95rem;
}
.which-result .which-match {
  max-width: 40ch;
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--q-blue);
}

/* ---------- back button (which-surfer, questions 2-6) ---------- */
.back-btn {
  align-self: center;
  min-width: 120px;
}

/* ---------- load-failure state (shown in place of the intro) ---------- */
.load-error {
  color: var(--q-ink);
  font-size: 0.95rem;
}

/* ---------- share block ---------- */
.share-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--q-surface);
}
.share-block canvas.share-preview {
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.share-actions button {
  min-height: 44px;
  padding: 0 1rem;
}
.share-actions .copied-flag {
  font-size: 0.8rem;
  color: var(--q-good);
  font-family: "JetBrains Mono", monospace;
}

/* ---------- fallback primitives (used only if site.css hasn't loaded yet) ---------- */
.quiz-page .wrap { margin: 0 auto; padding-inline: 1rem; } /* inline only: vertical spacing belongs to main.quiz-shell */
.quiz-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.25rem;
  border-radius: 999px;
  border: 2px solid var(--q-ink);
  background: transparent;
  color: var(--q-ink);
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.quiz-page .btn-primary {
  background: var(--q-accent);
  border-color: var(--q-accent);
  color: var(--q-cream);
}
.quiz-page .label {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.quiz-page .card {
  background: var(--q-surface);
  border-radius: 14px;
  padding: 1rem;
}

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

@media (prefers-reduced-motion: reduce) {
  .surfer-card, .which-options button, .btn { transition: none; }
}

/* Shared-result line on the which-surfer intro (?m=<slug>) */
.friend-line {
  font-family: var(--font-display, "Bebas Neue", Impact, sans-serif);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin: 0.5rem 0 1rem;
}

.surfer-card.is-correct, .surfer-card.is-wrong, .surfer-card.is-dimmed {
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
