/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg:         #241c15;
  --bg-2:       #2c2318;
  --bg-3:       #342a1d;
  --cream:      #f3e9d8;
  --cream-2:    #d9c8ae;
  --cream-3:    #9c8d78;
  --accent:     #c96a3e;
  --accent-2:   #8a4a2b;
  --olive:      #7c8a56;
  --gold:       #e7c98f;
  --line:       rgba(243, 233, 216, 0.12);
  --line-strong: rgba(243, 233, 216, 0.22);

  --serif: "Fraunces", "Times New Roman", serif;
  --sans:  "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --nav-h: 76px;
  --container: 1180px;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--cream-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.05; letter-spacing: -0.01em; font-family: var(--serif); font-weight: 500; color: var(--cream); }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

/* =============================================================
   3. Utilities
   ============================================================= */
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--cream); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .3s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem; }
.sr-only, .hp-field {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.kicker {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); display: inline-flex; align-items: center; gap: 0.6em;
}
.kicker::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

section { position: relative; padding-block: clamp(4rem, 9vw, 8rem); }

/* =============================================================
   4. Typography
   ============================================================= */
em { font-style: italic; color: var(--accent); }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--cream-2); max-width: 62ch; line-height: 1.7; }
.section-title { font-size: clamp(1.9rem, 4vw, 3rem); max-width: 20ch; }

/* split-text safety net */
.reveal[data-split] { opacity: 1; transform: none; }

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  padding: 0.95rem 1.9rem; border-radius: 999px;
  font-family: var(--sans); font-weight: 600; font-size: 0.95rem;
  transition: transform .45s var(--ease-soft), box-shadow .45s var(--ease-soft), background .3s, opacity .3s;
}
.btn-primary {
  background: var(--accent); color: #241004;
  box-shadow: 0 10px 30px -8px rgba(201, 106, 62, 0.55);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -10px rgba(201, 106, 62, 0.7); }
.btn-primary:active { transform: translateY(-1px); transition-duration: .12s; }
.btn:disabled { opacity: 0.6; cursor: default; transform: none !important; }

.field { position: relative; }
.field input, .field select {
  width: 100%; padding: 1rem 1.1rem; border-radius: 12px;
  border: 1px solid var(--line-strong); background: rgba(243,233,216,0.04); color: var(--cream);
  font-family: var(--sans); font-size: 1rem;
  transition: border-color .25s var(--ease-out), background .25s var(--ease-out);
}
.field select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M5 8l5 5 5-5' fill='none' stroke='%23d9c8ae' stroke-width='1.6'/></svg>"); background-repeat: no-repeat; background-position: right 1rem center; }
.field input::placeholder { color: var(--cream-3); }
.field input:focus, .field select:focus { border-color: var(--accent); background-color: rgba(201,106,62,0.06); outline: none; }

.card {
  background: rgba(52, 42, 29, 0.55);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(1.6rem, 3vw, 2.4rem);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
@supports not (backdrop-filter: blur(1px)) {
  .card { background: rgba(44, 35, 24, 0.94); }
}

/* =============================================================
   6. Scene illustration + contrast layers
   ============================================================= */
.scene-illustration {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.scene-illustration svg { width: 100%; height: 100%; display: block; }
.scene-illustration .lamp-glow {
  animation: lampPulse 5s ease-in-out infinite;
  transform-origin: center;
}
@keyframes lampPulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }

.scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: rgba(36, 28, 21, 0.42);
}
.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}

main, .nav, footer { position: relative; z-index: 3; }

/* =============================================================
   7. Nav
   ============================================================= */
.nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  transition: background-color .4s var(--ease-out), backdrop-filter .4s var(--ease-out), box-shadow .4s var(--ease-out);
}
.nav.is-scrolled {
  background: rgba(36, 28, 21, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.nav-brand { font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: var(--cream); }
.nav-brand span { color: var(--accent); }
.nav-cta { padding: 0.6rem 1.2rem; font-size: 0.85rem; }

/* =============================================================
   8. Hero
   ============================================================= */
.hero {
  min-height: 100svh; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: var(--nav-h);
}
.hero-inner { max-width: 44rem; }
.hero-title { font-size: clamp(2.2rem, 5vw, 3.6rem); font-style: italic; margin-block: 1.1rem 1.4rem; }
.hero-sub { margin-bottom: 2.2rem; max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; }

/* =============================================================
   9. Lead capture + survey
   ============================================================= */
.lead-section .container { max-width: 780px; }
.lead-card { text-align: center; }

.quiz-progress-wrap { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.6rem; }
.quiz-progress { flex: 1; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.quiz-progress span {
  display: block; height: 100%; width: 100%; transform-origin: 0 0; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--olive));
  transition: transform .4s var(--ease-out);
}
.quiz-progress-text { font-family: var(--mono); font-size: 0.72rem; color: var(--cream-3); white-space: nowrap; }

.quiz-step {
  animation: quizStepIn .5s var(--ease-soft);
  text-align: left;
  border: 0; margin: 0; padding: 0; min-width: 0;
}
@keyframes quizStepIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.quiz-question { font-family: var(--serif); font-style: italic; font-size: clamp(1.2rem, 2.4vw, 1.6rem); margin-bottom: 1.4rem; }

.quiz-options { display: flex; flex-direction: column; gap: 0.7rem; }
.quiz-option { position: relative; }
.quiz-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.quiz-option label {
  display: block; padding: 0.95rem 1.2rem; border-radius: 12px;
  border: 1px solid var(--line-strong); color: var(--cream-2);
  transition: border-color .25s var(--ease-out), background .25s var(--ease-out), transform .2s var(--ease-out);
  cursor: pointer;
}
.quiz-option label:hover { border-color: var(--accent); transform: translateX(2px); }
.quiz-option input:checked + label {
  border-color: var(--accent); background: rgba(201, 106, 62, 0.14); color: var(--cream);
}
.quiz-option input[type="checkbox"]:checked + label::before {
  content: "✓ "; color: var(--accent); font-weight: 700;
}
.quiz-option input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.quiz-freetext {
  margin-top: 0.5rem; width: 100%; padding: 0.7rem 1rem; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(243,233,216,0.04); color: var(--cream);
  font-family: var(--sans); font-size: 0.92rem;
}
.quiz-freetext:focus { border-color: var(--accent); outline: none; }

.quiz-step.has-error .quiz-options { outline: 1px solid #c9573e; outline-offset: 8px; border-radius: 12px; }

.quiz-fields { display: grid; gap: 1rem; }
@media (min-width: 640px) { .quiz-fields { grid-template-columns: repeat(2, 1fr); } }
.quiz-fields label.field-label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cream-3); margin-bottom: 0.4rem; display: block; }

.quiz-continue { margin-top: 1.4rem; }

.quiz-success, .quiz-error { text-align: center; padding-top: 1rem; }
.quiz-success h3 { font-size: 1.6rem; font-style: italic; }
.quiz-success p, .quiz-error p { color: var(--cream-3); margin-top: 0.6rem; max-width: 48ch; margin-inline: auto; }
.quiz-error p { color: #e6a08c; }
.quiz-sending-msg { text-align: center; margin-top: 1rem; color: var(--cream-3); font-family: var(--mono); font-size: 0.78rem; }
[data-quiz-form].is-sending .quiz-continue { opacity: 0.7; }

/* =============================================================
   10. Footer
   ============================================================= */
footer { padding-block: 3rem; border-top: 1px solid var(--line); }
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; justify-content: space-between;
}
.footer-brand { font-family: var(--serif); font-style: italic; color: var(--cream); }
.footer-meta { font-size: 0.8rem; color: var(--cream-3); }

/* =============================================================
   11. Reveal on scroll (universal)
   ============================================================= */
[data-reveal] {
  opacity: 0; transform: translateY(36px);
  transition: opacity .8s var(--ease-soft), transform .8s var(--ease-soft);
}
[data-reveal].is-revealed { opacity: 1; transform: none; }

.split-word { display: inline-block; will-change: transform, opacity; }

/* =============================================================
   12. Responsive
   ============================================================= */
@media (min-width: 540px)  { section { padding-inline: 0; } }
@media (min-width: 1280px) { .container { padding-inline: 2rem; } }

/* =============================================================
   13. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .scene-illustration .lamp-glow { animation: none; }
}

/* =============================================================
   14. Quiz pagination — one question visible at a time (JS-enhanced)
   ============================================================= */
html.is-ready .quiz-step { display: none; }
html.is-ready .quiz-step.is-active { display: block; }
