/* ============================================================
   PHASE AND FLOW — Quiz Funnel
   Aesthetic: Editorial wellness · warm sand · aubergine · sage
   Type: Fraunces (display) · Manrope (body)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Color */
  --c-bg: #f4ece0;
  --c-bg-tint: #ede2d1;
  --c-surface: #fbf6ec;
  --c-ink: #1f1b16;
  --c-ink-soft: #4a4239;
  --c-ink-mute: #8a8073;
  --c-aubergine: #5b3247;
  --c-aubergine-deep: #3e1f30;
  --c-aubergine-tint: #f1e3ea;
  --c-sage: #7a8b6b;
  --c-clay: #c58b6f;
  --c-clay-tint: #f3e1d6;
  --c-line: rgba(31, 27, 22, 0.12);
  --c-line-soft: rgba(31, 27, 22, 0.06);

  /* Type */
  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Space */
  --s-xs: 0.5rem;
  --s-sm: 0.875rem;
  --s-md: 1.5rem;
  --s-lg: 2.5rem;
  --s-xl: 4rem;
  --s-2xl: 6rem;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 180ms;
  --t-mid: 360ms;
  --t-slow: 620ms;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Atmospheric background gradient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 80% 0%, rgba(197, 139, 111, 0.18), transparent 60%),
    radial-gradient(ellipse 80% 60% at 10% 100%, rgba(122, 139, 107, 0.14), transparent 65%),
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(91, 50, 71, 0.04), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

button { font-family: inherit; }

/* ---------- Grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0 0.08 0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ---------- Decorative blobs ---------- */
.blob {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(2px);
  opacity: 0.55;
}
.blob--one {
  top: -6vw;
  right: -10vw;
  width: 52vw;
  max-width: 720px;
  fill: var(--c-clay-tint);
  animation: drift 24s ease-in-out infinite alternate;
}
.blob--two {
  bottom: -8vw;
  left: -12vw;
  width: 48vw;
  max-width: 660px;
  fill: var(--c-aubergine-tint);
  animation: drift 28s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { transform: translate(2.5vw, -1.8vw) rotate(8deg) scale(1.06); }
}

/* ---------- Brand bar ---------- */
.brand-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  padding: 1.6rem clamp(1.25rem, 4vw, 3rem);
  max-width: 1280px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--c-ink);
}

.brand__mark {
  width: 36px;
  height: 36px;
  color: var(--c-aubergine);
  flex-shrink: 0;
}

.brand__wordmark {
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 144, "SOFT" 70;
}

.brand__wordmark em {
  font-style: italic;
  font-weight: 400;
  color: var(--c-ink-mute);
  margin: 0 0.1em;
  font-size: 0.85em;
}

/* ---------- Progress ---------- */
.progress {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 220px;
}

.progress[hidden] { display: none; }

.progress__rail {
  flex: 1;
  height: 3px;
  background: var(--c-line);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
}

.progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--c-aubergine), var(--c-clay));
  border-radius: var(--r-pill);
  transition: width var(--t-mid) var(--ease);
}

.progress__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--c-ink-mute);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- Stage / screens ---------- */
.stage {
  position: relative;
  z-index: 5;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem) clamp(3rem, 8vw, 6rem);
  min-height: calc(100vh - 200px);
}

.screen {
  display: none;
  animation: screenIn var(--t-slow) var(--ease) both;
}

.screen[data-active] {
  display: block;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen__inner {
  max-width: 720px;
  margin: 0 auto;
}

.screen__inner--centered {
  text-align: center;
}

.screen__inner--result {
  max-width: 700px;
}

/* ---------- Typography ---------- */
.eyebrow {
  font-family: var(--f-body);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--c-sage);
  margin: 0 0 1.5rem;
}

.eyebrow--result {
  color: var(--c-aubergine);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: none;
  font-weight: 500;
}

.eyebrow--result .score-value {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.4em;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  color: var(--c-aubergine-deep);
}

.display {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin: 0 0 1.5rem;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}

.display em {
  font-style: italic;
  font-weight: 300;
  color: var(--c-aubergine);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.display--md {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin-bottom: 2.5rem;
}

.display--lg {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
  margin: 0.5rem 0;
}

.lede {
  font-family: var(--f-display);
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.4;
  font-weight: 350;
  font-variation-settings: "opsz" 144, "SOFT" 70;
  color: var(--c-ink-soft);
  margin: 0 0 1.5rem;
  letter-spacing: -0.005em;
}

.lede--result {
  font-style: italic;
  color: var(--c-aubergine);
  margin: 1.5rem 0 2rem;
}

.body {
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--c-ink-soft);
  margin: 0 0 2rem;
  max-width: 56ch;
}

.body strong {
  color: var(--c-ink);
  font-weight: 600;
}

.meta {
  font-size: 0.85rem;
  color: var(--c-ink-mute);
  margin: 1.25rem 0 0;
  letter-spacing: 0.01em;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--f-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  padding: 1rem 1.85rem;
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}

.btn svg { width: 18px; height: 18px; }

.btn--primary {
  background: var(--c-aubergine);
  color: #fbf6ec;
  box-shadow: 0 1px 2px rgba(62, 31, 48, 0.3),
              0 8px 24px -8px rgba(62, 31, 48, 0.45);
}

.btn--primary:hover {
  background: var(--c-aubergine-deep);
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(62, 31, 48, 0.35),
              0 14px 32px -10px rgba(62, 31, 48, 0.55);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--c-ink-soft);
  padding: 1rem 1.5rem;
}

.btn--ghost:hover {
  color: var(--c-aubergine);
}

.btn--cta {
  font-size: 1.05rem;
  padding: 1.15rem 2.1rem;
  margin-top: 0.5rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ---------- Options (answer cards) ---------- */
.options {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.options--compact {
  gap: 0.55rem;
}

.option {
  appearance: none;
  border: 1.5px solid var(--c-line);
  background: var(--c-surface);
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 1rem;
  padding: 1.15rem 1.4rem;
  border-radius: var(--r-md);
  font-family: var(--f-body);
  font-size: 1.04rem;
  line-height: 1.45;
  color: var(--c-ink);
  transition: transform var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  position: relative;
  overflow: hidden;
}

.option::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(91, 50, 71, 0.06), transparent 50%);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
  pointer-events: none;
}

.option:hover {
  border-color: var(--c-aubergine);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -10px rgba(91, 50, 71, 0.4);
}

.option:hover::before {
  opacity: 1;
}

.option:focus-visible {
  outline: 2px solid var(--c-aubergine);
  outline-offset: 3px;
}

.option--selected {
  border-color: var(--c-aubergine);
  background: var(--c-aubergine-tint);
}

.option--selected .option__letter {
  background: var(--c-aubergine);
  color: var(--c-surface);
}

.option__letter {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 0.95rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg-tint);
  color: var(--c-aubergine);
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  font-variation-settings: "opsz" 144, "SOFT" 50;
}

.option__text {
  display: block;
  padding-top: 0.3rem;
}

.option--demo {
  grid-template-columns: 1fr;
  text-align: center;
  padding: 1.05rem 1.4rem;
  font-weight: 500;
}

/* ---------- Loading ---------- */
.screen--loading .screen__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.loader {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background:
    conic-gradient(from 90deg, transparent, var(--c-aubergine));
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%);
          mask: radial-gradient(circle, transparent 55%, #000 56%);
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading__text {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--c-ink-soft);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

/* ---------- Result ---------- */
.archetype {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}

.archetype__icon {
  font-size: 2.8rem;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(91, 50, 71, 0.18));
  animation: bloom 900ms var(--ease) both;
}

@keyframes bloom {
  0%   { opacity: 0; transform: scale(0.5) rotate(-12deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

.archetype__range {
  font-size: 0.9rem;
  color: var(--c-ink-mute);
  margin: 0;
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: uppercase;
}

.result__body {
  margin: 0 0 2.25rem;
}

.result__body p {
  font-size: 1.04rem;
  line-height: 1.65;
  color: var(--c-ink-soft);
  margin: 0 0 1.1rem;
}

.result__bridge {
  border-left: 2px solid var(--c-clay);
  padding-left: 1.1rem;
  margin-top: 1.5rem !important;
  font-style: italic;
  color: var(--c-ink) !important;
}

/* ---------- Footer ---------- */
.foot {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 2rem var(--s-md);
  font-size: 0.82rem;
  color: var(--c-ink-mute);
  letter-spacing: 0.02em;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .brand-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }
  .progress { width: 100%; min-width: 0; }
  .display { font-size: clamp(2rem, 9vw, 2.8rem); }
  .display--md { font-size: clamp(1.5rem, 6vw, 2rem); }
  .lede { font-size: 1.1rem; }
  .option { padding: 1rem 1.1rem; gap: 0.85rem; }
  .option__letter { width: 28px; height: 28px; font-size: 0.85rem; }
  .stage { padding-top: 1.5rem; }
}

/* ---------- Modal (email capture) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
}

.modal[data-open] {
  display: flex;
  animation: modalFadeIn 280ms var(--ease) both;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 27, 22, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: clamp(1.75rem, 4vw, 2.5rem) clamp(1.5rem, 4vw, 2.5rem) clamp(1.5rem, 3vw, 2.25rem);
  box-shadow:
    0 1px 2px rgba(31, 27, 22, 0.04),
    0 30px 60px -20px rgba(31, 27, 22, 0.35),
    0 12px 30px -10px rgba(91, 50, 71, 0.25);
  animation: modalRise 460ms var(--ease) both;
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(36px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--c-ink-mute);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.modal__close:hover {
  background: var(--c-bg-tint);
  color: var(--c-aubergine);
}
.modal__close svg { width: 18px; height: 18px; }

.modal__inner[hidden] { display: none; }

.modal__title {
  margin: 0.4rem 0 1rem;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  line-height: 1.15;
}

.modal__lede {
  font-family: var(--f-body);
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--c-ink-soft);
  margin: 0 0 1.5rem;
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field__label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-ink-mute);
}

.field__input {
  appearance: none;
  font-family: var(--f-body);
  font-size: 1.05rem;
  color: var(--c-ink);
  background: var(--c-bg);
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 0.95rem 1.1rem;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.field__input::placeholder { color: var(--c-ink-mute); }

.field__input:focus {
  border-color: var(--c-aubergine);
  background: var(--c-surface);
}

.field__input--error { border-color: #b95757; }
.field__error {
  font-size: 0.85rem;
  color: #b95757;
  margin-top: 0.2rem;
}

.modal__form .btn--cta {
  width: 100%;
  margin-top: 0.25rem;
}

.modal__form .btn--cta[data-loading="true"] {
  pointer-events: none;
  opacity: 0.75;
}

.modal__meta {
  font-size: 0.82rem;
  color: var(--c-ink-mute);
  margin: 0.25rem 0 0;
  text-align: center;
}

.modal__success {
  text-align: center;
  padding: 1rem 0 0.5rem;
}
.modal__success-icon {
  font-size: 2.6rem;
  display: block;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 4px 14px rgba(91, 50, 71, 0.25));
  animation: bloom 700ms var(--ease) both;
}

/* Body scroll lock when modal open */
body[data-modal-open] { overflow: hidden; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .blob { animation: none; }
}
