/* The Italian Matrix — quiz styles
 * Brand tokens lifted from index.html so the quiz feels native to the rest of the site.
 * Mobile-first; desktop refinements at min-width: 768px.
 */

/* ── Brand tokens ──────────────────────────────────────────────────── */
:root {
  --white: #FFFFFF;
  --off-white: #FAFAFA;
  --light-gray: #F5F5F7;
  --mid-gray: #86868B;
  --dark-gray: #1D1D1F;
  --black: #000000;
  --accent-blue: #1B3A5C;
  --accent-green: #1A6B3C;
  --accent-red: #8B1A1A;
  --gold: #C4A35A;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  --quiz-card-radius: 20px;
  --quiz-shadow-soft: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --quiz-shadow-lift: 0 4px 12px rgba(0,0,0,0.06), 0 12px 40px rgba(0,0,0,0.08);
}

/* ── Page shell ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--dark-gray);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;

  /* Layered background:
     - Washed-out white overlay (top layer) so the quiz card pops against it.
     - The Amalfi/founders/bougainvillea hero image (bottom layer).
     - background-color is the fallback if the webp ever fails to load. */
  background-color: var(--off-white);
  background-image:
    linear-gradient(rgba(255,255,255,0.58), rgba(255,255,255,0.58)),
    url('/assets/blueprint-bg.webp');
  background-size: cover, cover;
  /* Position 60% on the image biases the framing slightly toward the right
     edge (the founders + flags) so they stay visible at narrower viewports
     without losing the village in the middle. */
  background-position: center, 60% center;
  background-repeat: no-repeat, no-repeat;
}

/* Parallax-style fixed background on desktop (image holds still while content
   scrolls). Disabled on mobile because iOS Safari handles fixed backgrounds
   poorly and we'd rather have buttery-smooth scrolling than the parallax. */
@media (min-width: 768px) {
  body {
    background-attachment: scroll, fixed;
  }
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.quiz-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.quiz-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 80px;
}

@media (min-width: 768px) {
  .quiz-main { padding: 48px 24px 96px; }
}

/* ── Top brand bar ────────────────────────────────────────────────── */
.quiz-topbar {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: blur(20px);
          backdrop-filter: blur(20px);
  /* Make the bar sticky so the logo is always visible during the quiz */
  position: sticky;
  top: 0;
  z-index: 50;
}

.quiz-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  /* Larger touch target than the visual element for accessibility on mobile */
  padding: 4px 8px;
  border-radius: 10px;
  transition: opacity 0.2s ease;
  color: var(--dark-gray);
}
.quiz-topbar-link:hover { opacity: 0.78; }
.quiz-topbar-link:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Standalone shield — square aspect. Sized by height for retina sharpness. */
.quiz-topbar-shield {
  height: 48px;
  width: 48px;
  display: block;
  -webkit-user-drag: none;
  flex-shrink: 0;
}

/* Wordmark — visually matches the shield's height. Playfair Display is the
   brand display face. The optical x-height of Playfair at this font-size sits
   roughly equal to the shield's visual mass, which is what "as big as the
   logo" reads as in practice. */
.quiz-topbar-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  color: var(--dark-gray);
  white-space: nowrap;
}

.quiz-topbar-tm {
  font-size: 0.45em;
  vertical-align: super;
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 2px;
  opacity: 0.75;
}

@media (min-width: 768px) {
  .quiz-topbar { padding: 16px 24px; }
  .quiz-topbar-link { gap: 16px; }
  .quiz-topbar-shield { height: 60px; width: 60px; }
  .quiz-topbar-name { font-size: 38px; }
}

/* Tighter on very narrow phones so the lockup doesn't crowd the edges */
@media (max-width: 380px) {
  .quiz-topbar-link { gap: 10px; padding: 4px; }
  .quiz-topbar-shield { height: 40px; width: 40px; }
  .quiz-topbar-name { font-size: 24px; }
}

/* Fallback if the image fails to load — keeps the brand mark visible */
.quiz-topbar-fallback {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-gray);
  letter-spacing: 0.01em;
}

/* ── Progress bar ─────────────────────────────────────────────────── */
.quiz-progress {
  width: 100%;
  max-width: 640px;
  margin: 8px 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--mid-gray);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.quiz-progress-track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--light-gray);
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--gold));
  border-radius: 999px;
  width: 0;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── Screen card (the white panel that holds each step) ───────────── */
.quiz-screen {
  width: 100%;
  max-width: 640px;
  background: var(--white);
  border-radius: var(--quiz-card-radius);
  padding: 32px 24px;
  box-shadow: var(--quiz-shadow-soft);
  opacity: 0;
  transform: translateY(8px);
  animation: quiz-slide-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@media (min-width: 768px) {
  .quiz-screen { padding: 48px 48px 40px; }
}

@keyframes quiz-slide-in {
  to { opacity: 1; transform: translateY(0); }
}

.quiz-screen.exiting {
  animation: quiz-slide-out 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}
@keyframes quiz-slide-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ── Headline & body type ─────────────────────────────────────────── */
.quiz-headline {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--dark-gray);
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  .quiz-headline { font-size: 36px; }
}

.quiz-subhead {
  font-size: 16px;
  color: var(--mid-gray);
  margin: 0 0 24px;
  line-height: 1.55;
}
@media (min-width: 768px) {
  .quiz-subhead { font-size: 17px; }
}

.quiz-prompt {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 6px;
  color: var(--dark-gray);
  letter-spacing: -0.005em;
}
@media (min-width: 768px) {
  .quiz-prompt { font-size: 30px; }
}

.quiz-subprompt {
  font-size: 14px;
  color: var(--mid-gray);
  margin: 0 0 24px;
}

/* ── Answer cards ─────────────────────────────────────────────────── */
.quiz-options {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--white);
  border: 2px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  padding: 16px 18px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--dark-gray);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.quiz-option:hover {
  border-color: var(--accent-green);
  background: var(--off-white);
  transform: translateY(-1px);
  box-shadow: var(--quiz-shadow-soft);
}

.quiz-option:active { transform: translateY(0); }

.quiz-option.selected {
  border-color: var(--accent-green);
  background: rgba(26, 107, 60, 0.04);
  box-shadow: 0 0 0 4px rgba(26, 107, 60, 0.08);
}

.quiz-option-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  transition: background 0.15s ease, color 0.15s ease;
}

.quiz-option:hover .quiz-option-icon,
.quiz-option.selected .quiz-option-icon {
  background: rgba(26, 107, 60, 0.10);
  color: var(--accent-green);
}

.quiz-option-icon svg { width: 22px; height: 22px; stroke-width: 1.75; }

.quiz-option-body { flex: 1 1 auto; min-width: 0; }
.quiz-option-label {
  display: block;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: var(--dark-gray);
}
.quiz-option-sub {
  display: block;
  font-size: 13px;
  color: var(--mid-gray);
  margin-top: 2px;
  line-height: 1.4;
}

.quiz-option-check {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.quiz-option.selected .quiz-option-check {
  background: var(--accent-green);
  border-color: var(--accent-green);
}
.quiz-option-check svg {
  width: 14px;
  height: 14px;
  color: var(--white);
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s ease;
}
.quiz-option.selected .quiz-option-check svg {
  opacity: 1;
  transform: scale(1);
}

/* Multi-select uses a square checkbox shape instead of the radio dot */
.quiz-options.is-multi .quiz-option-check { border-radius: 6px; }

/* Follow-up text input that appears under "Knows City" / "Knows Region Only" */
.quiz-followup {
  margin-top: 8px;
  padding: 4px 4px 0;
  display: none;
}
.quiz-option.selected + .quiz-followup,
.quiz-option.selected .quiz-followup { display: block; }

.quiz-input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--dark-gray);
  background: var(--white);
  border: 2px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.quiz-input::placeholder { color: var(--mid-gray); }
.quiz-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(27, 58, 92, 0.08);
}

/* ── Footer button row ────────────────────────────────────────────── */
.quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.quiz-back,
.quiz-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: 980px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.quiz-back {
  background: transparent;
  color: var(--mid-gray);
  padding-left: 8px;
  padding-right: 8px;
}
.quiz-back:hover { color: var(--dark-gray); }
.quiz-back[hidden] { display: none; }

.quiz-next {
  background: var(--dark-gray);
  color: var(--white);
}
.quiz-next:hover:not(:disabled) {
  background: var(--black);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.quiz-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.quiz-next svg { width: 18px; height: 18px; transition: transform 0.2s ease; }
.quiz-next:hover:not(:disabled) svg { transform: translateX(3px); }

/* ── Email capture ────────────────────────────────────────────────── */
.quiz-form-stack {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.quiz-fineprint {
  font-size: 12px;
  color: var(--mid-gray);
  text-align: center;
  margin-top: 12px;
}

/* ── Intro screen overrides ───────────────────────────────────────── */
.quiz-intro .quiz-headline { font-size: 36px; }
@media (min-width: 768px) {
  .quiz-intro .quiz-headline { font-size: 56px; }
}
.quiz-intro .quiz-subhead { font-size: 17px; max-width: 540px; }
@media (min-width: 768px) {
  .quiz-intro .quiz-subhead { font-size: 19px; }
}
.quiz-intro-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--dark-gray);
  color: var(--white);
  padding: 18px 40px;
  border-radius: 980px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
  margin-top: 8px;
}
.quiz-intro-cta:hover {
  background: var(--black);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.quiz-intro-cta svg { width: 18px; height: 18px; transition: transform 0.2s ease; }
.quiz-intro-cta:hover svg { transform: translateX(3px); }

.quiz-trust-note {
  font-size: 13px;
  color: var(--mid-gray);
  margin-top: 24px;
  letter-spacing: 0.02em;
}

/* ── Thank-you screen ─────────────────────────────────────────────── */
.quiz-thanks-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(26, 107, 60, 0.10);
  color: var(--accent-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.quiz-thanks-icon svg { width: 32px; height: 32px; }

/* ── Footer ───────────────────────────────────────────────────────── */
.quiz-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  text-align: center;
  font-size: 10px;
  line-height: 1.3;
  color: var(--mid-gray);
  border-top: 1px solid rgba(0,0,0,0.05);
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.quiz-footer-line {
  margin: 0;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 6px;
  row-gap: 2px;
}
.quiz-footer a {
  color: var(--mid-gray);
  text-decoration: none;
}
.quiz-footer a:hover {
  color: var(--dark-gray);
  text-decoration: underline;
}
.quiz-footer-sep {
  opacity: 0.45;
  user-select: none;
}

/* ── Reduced-motion respect ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
