/* ============================================================
   Torres Property — Seller Campaign Quiz
   Palette: primary / page background #292929, secondary black & white.
   Type: ivypresto-display (headings) + inter-variable (body).
   ============================================================ */

:root {
  /* Primary (also the page background) */
  --bg: #292929;
  /* Black-derived surfaces for depth (secondary: #000) */
  --bg-soft: #1f1f1f;
  --panel: #1f1f1f;
  --panel-hover: #151515;
  --ink: #000000;

  /* White (secondary) used for text, lines and the single accent */
  --text: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.72);
  --text-faint: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.34);
  --accent: #ffffff;

  /* Type */
  --display: "ivypresto-display", Georgia, "Times New Roman", serif;
  --body: "inter-variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --max: 680px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh; /* avoids phantom scroll behind mobile browser chrome */
  display: flex;
  flex-direction: column;
  /* subtle vignette for depth, kept within the grey/black range */
  background-image: radial-gradient(120% 90% at 50% 0%, #303030 0%, var(--bg) 55%);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 26px 20px;
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
}

.brand__logo {
  display: block;
  width: auto;
}

.brand__logo--full {
  height: 62px;
  max-width: 320px;
}

.brand__logo--icon {
  display: none;
  height: 38px;
}

@media (max-width: 520px) {
  .brand__logo--full {
    height: 50px;
  }
}

/* Compact, icon-only header while inside the quiz */
body.is-quiz .site-header {
  padding: 12px 20px;
}

body.is-quiz .brand__logo--full {
  display: none;
}

body.is-quiz .brand__logo--icon {
  display: block;
  height: 36px;
}

@media (max-width: 520px) {
  body.is-quiz .brand__logo--icon {
    height: 30px;
  }
}

/* ---------- App layout ---------- */
.app {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

body.is-quiz .app {
  padding-top: 28px;
  /* leave room for the fixed bottom nav bar */
  padding-bottom: 104px;
}

.screen {
  animation: fade-up 0.5s var(--ease) both;
  /* Centre vertically when there is spare room (desktop / short content),
     collapse to the top when content fills the viewport (mobile). Auto
     margins never go negative, so tall content is never clipped. */
  margin: auto 0;
}

.screen[hidden] {
  display: none;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Typography helpers ---------- */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 18px;
  padding-left: 0.34em;
}

.display {
  font-family: var(--display);
  font-weight: 100;
  font-size: clamp(1.75rem, 5.2vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: 0.01em;
  margin: 0 0 24px;
}

.lede {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin: 0 0 18px;
  max-width: 56ch;
}

.lede--soft {
  color: var(--text-faint);
  font-style: italic;
  font-family: var(--display);
  font-size: 0.95rem;
}

/* ---------- Intro ---------- */
.intro {
  text-align: left;
}

.intro__meta {
  margin-top: 22px;
  color: var(--text-faint);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--body);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  padding: 16px 30px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease),
    color 0.3s var(--ease), transform 0.15s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn--primary {
  margin-top: 12px;
  border-color: var(--accent);
  color: var(--text);
}

.btn--primary:hover {
  background: var(--accent);
  color: var(--bg);
}

.btn--ghost {
  border-color: transparent;
  color: var(--text-faint);
  padding-left: 0;
  letter-spacing: 0.16em;
}

.btn--ghost:hover {
  border-color: transparent;
  color: var(--text);
}

/* Quiet text-only action (e.g. "Start over") */
.btn--text {
  border-color: transparent;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  padding: 8px 12px;
}

.btn--text:hover {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn:disabled:hover {
  border-color: var(--accent);
  color: var(--text);
  background: transparent;
}

.btn__arrow {
  transition: transform 0.3s var(--ease);
}

.btn:not(:disabled):hover .btn__arrow {
  transform: translateX(4px);
}

/* ---------- Progress (sits on the header's bottom edge as its underline) ---------- */
.progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
}

.progress__bar {
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

.progress__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.45s var(--ease);
}

/* ---------- Question ---------- */
.question__title {
  font-family: var(--display);
  font-weight: 100;
  font-size: clamp(1.25rem, 3.6vw, 1.7rem);
  line-height: 1.22;
  margin: 0 0 10px;
}

.question__note {
  color: var(--text-faint);
  font-family: var(--body);
  font-size: 0.85rem;
  margin: 0 0 18px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 24px 0 8px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease),
    color 0.25s var(--ease);
}

.option:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  color: var(--text);
}

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option__dot {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s var(--ease);
}

.option__dot::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.25s var(--ease);
}

.option__text {
  font-size: 0.84rem;
  line-height: 1.4;
}

.option.is-selected {
  border-color: var(--accent);
  background: var(--panel-hover);
  color: var(--text);
}

.option.is-selected .option__dot {
  border-color: var(--accent);
}

.option.is-selected .option__dot::after {
  transform: scale(1);
}

/* ---------- Address capture ---------- */
.address {
  margin: 18px 0 4px;
  animation: fade-up 0.4s var(--ease) both;
}

.address__label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 10px;
}

.address__input {
  width: 100%;
  padding: 15px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  transition: border-color 0.25s var(--ease);
}

.address__input::placeholder {
  color: var(--text-faint);
}

.address__input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- Question nav (fixed bar on the bottom edge) ---------- */
.question__nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: none;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 12px 24px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

body.is-quiz .question__nav {
  display: block;
}

.question__nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Back and Next sit side by side as an equal-width pair */
.question__nav .btn {
  margin-top: 0;
  flex: 1;
  justify-content: center;
  padding: 14px 20px;
}

/* ---------- Result ---------- */
.result {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score {
  margin: 0 0 24px;
}

.score__ring {
  position: relative;
  width: 160px;
  height: 160px;
}

.score__svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score__track {
  fill: none;
  stroke: var(--line);
  stroke-width: 4;
}

.score__value {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 326.7; /* 2*pi*52 */
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.1s var(--ease);
}

.score__number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 100;
  font-size: 2.6rem;
  color: var(--text);
}

.score__number small {
  font-size: 1rem;
  color: var(--text-soft);
  margin-left: 1px;
}

.result__heading {
  font-family: var(--display);
  font-weight: 100;
  font-size: clamp(1.3rem, 3.6vw, 1.7rem);
  line-height: 1.24;
  margin: 0 0 18px;
  max-width: 32ch;
  text-wrap: balance; /* avoid orphaned last word when it wraps */
}

.result__body {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin: 0 0 26px;
  max-width: 58ch;
}

/* Both info cards share one quiet style */
.result__next,
.result__cta {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
  text-align: left;
  width: 100%;
  max-width: 58ch;
  margin-bottom: 14px;
}

.result__next-label {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-soft);
  margin: 0 0 8px;
}

.result__next-text,
.result__cta-text {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.result__cta-text strong {
  color: var(--text);
  font-weight: 600;
}

.result__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 340px;
  margin-top: 8px;
}

.result__actions .btn--primary {
  width: 100%;
  justify-content: center;
  margin-top: 0;
}

/* ---------- Second-opinion modal (full screen) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.modal[hidden] {
  display: none;
}

.modal__close {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.25s var(--ease);
}

.modal__close:hover {
  color: var(--text);
}

.lead-form,
.lead-success {
  margin: auto;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
}

/* explicit display:flex above would otherwise override the hidden attribute */
.lead-form[hidden],
.lead-success[hidden] {
  display: none;
}

.modal__title {
  font-family: var(--display);
  font-weight: 100;
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  line-height: 1.15;
  margin: 0 0 12px;
}

.modal__text {
  color: var(--text-soft);
  font-size: 0.92rem;
  margin: 0 0 26px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.field__input {
  width: 100%;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  transition: border-color 0.25s var(--ease);
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
}

.lead-form .btn {
  margin-top: 10px;
  justify-content: center;
}

.lead-form .msg {
  margin: 0 0 4px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.lead-form .msg--error {
  color: #ff9a9a;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .app {
    padding: 24px 20px 36px;
  }

  /* Top-align on phones so the content does not float in the middle */
  .screen {
    margin: 0;
  }

  /* Full-width primary action on the intro screen */
  .intro .btn {
    width: 100%;
    justify-content: center;
  }

  .question__nav {
    padding-left: 18px;
    padding-right: 18px;
  }

  /* Tighten the result screen on phones */
  .score__ring {
    width: 122px;
    height: 122px;
  }

  .score__number {
    font-size: 2rem;
  }

  .score {
    margin: 0 0 18px;
  }

  .result__heading {
    font-size: 1.15rem;
    margin-bottom: 14px;
  }

  .result__body {
    font-size: 0.82rem;
    line-height: 1.5;
    margin-bottom: 20px;
  }
}

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