/* ============================================================
   Quote Builder — Design System
   All brand colors injected as CSS custom properties by JS.
   ============================================================ */

/* ── DEFAULTS (overridden by JS from config.branding) ── */
:root {
  --color-primary:     #0f4c81;
  --color-secondary:   #1a7fc4;
  --color-accent:      #f59e0b;
  --color-bg:          #f8fafc;
  --color-surface:     #ffffff;
  --color-text:        #0f172a;
  --color-text-muted:  #64748b;
  --color-error:       #ef4444;
  --color-success:     #10b981;
  --radius:            12px;
  --font-heading:      "Outfit", system-ui, sans-serif;
  --font-body:         "DM Sans", system-ui, sans-serif;

  /* Derived — set by JS alongside the above */
  --color-primary-rgb: 15, 76, 129;
  --color-accent-rgb:  245, 158, 11;
  --color-success-rgb: 16, 185, 129;

  /* Static tokens */
  --color-border:      #e2e8f0;
  --color-border-hover:#cbd5e1;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.05);
  --shadow-card-hover: 0 12px 48px rgba(0,0,0,.13), 0 4px 16px rgba(0,0,0,.06);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-step: 280ms;
  --ease-out:  cubic-bezier(.2, 0, 0, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

/* ── LAYOUT ── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ══════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-wrap {
  display: flex;
  align-items: center;
  gap: .625rem;
}
.logo-img {
  height: 36px;
  width: auto;
}
.logo-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
  letter-spacing: -.01em;
}
.header-phone {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
  font-size: .9375rem;
  color: var(--color-primary);
  padding: .5rem .875rem;
  border: 2px solid rgba(var(--color-primary-rgb), .18);
  border-radius: 99px;
  transition: background 150ms ease, border-color 150ms ease;
}
.header-phone:hover {
  background: rgba(var(--color-primary-rgb), .06);
  border-color: rgba(var(--color-primary-rgb), .35);
}

/* ══════════════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(160deg,
    rgba(var(--color-primary-rgb), .04) 0%,
    transparent 60%);
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--color-border);
}
.hero-inner {
  max-width: 680px;
  text-align: center;
}
.hero-headline {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--color-text);
  margin-bottom: .75rem;
  line-height: 1.15;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* Trust badges */
.trust-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .625rem 1.25rem;
  margin-bottom: 1.5rem;
}
.trust-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.trust-icon {
  color: var(--color-primary);
  display: flex;
  align-items: center;
}
.trust-icon svg { width: 15px; height: 15px; }

/* CTA button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  padding: .875rem 1.75rem;
  border-radius: 99px;
  transition: all 250ms cubic-bezier(.2, 0, 0, 1);
  white-space: nowrap;
}
.btn-accent {
  background: var(--color-accent);
  color: #1a0a00;
  box-shadow: 0 4px 20px rgba(var(--color-accent-rgb), .35);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(var(--color-accent-rgb), .45);
}
.btn-accent:active { transform: translateY(0); }
.btn-hero {
  font-size: 1.0625rem;
  padding: 1rem 2rem;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-submit {
  width: 100%;
  background: var(--color-accent);
  color: #1a0a00;
  font-size: 1.0625rem;
  padding: 1.0625rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(var(--color-accent-rgb), .3);
  position: relative;
  overflow: hidden;
  transition: all 250ms cubic-bezier(.2, 0, 0, 1);
}
.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(var(--color-accent-rgb), .42);
}
.btn-submit:active:not(:disabled) { transform: translateY(0); }
.btn-submit:disabled {
  opacity: .7;
  cursor: not-allowed;
}
.btn-label { position: relative; z-index: 1; transition: opacity 150ms; }
.btn-spinner {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
}
.btn-submit.loading .btn-label { opacity: 0; }
.btn-submit.loading .btn-spinner { display: flex; }

/* Spinner dots */
.btn-spinner::before,
.btn-spinner::after,
.btn-spinner span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: dot-bounce 1s ease-in-out infinite;
}
.btn-spinner::before { content: ''; animation-delay: 0s; }
.btn-spinner span    { animation-delay: .16s; }
.btn-spinner::after  { content: ''; animation-delay: .32s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* ══════════════════════════════════════════════════════════
   QUOTE SECTION LAYOUT
═══════════════════════════════════════════════════════════ */
.quote-section {
  padding: 2.5rem 0 4rem;
}
.quote-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.75rem;
  align-items: start;
}

/* ── FORM CARD ── */
.form-card {
  background: var(--color-surface);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}

/* Progress bar */
.progress-wrap {
  padding: 0;
}
.progress-track {
  height: 4px;
  background: var(--color-border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 100%);
  border-radius: 0 2px 2px 0;
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}

/* Back button */
.back-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: .75rem 1.25rem .25rem;
  transition: color 150ms;
}
.back-btn:hover { color: var(--color-primary); }

/* Step viewport */
.step-viewport {
  padding: 1.5rem 1.75rem 2rem;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   STEP CONTENT — QUESTION + OPTIONS
═══════════════════════════════════════════════════════════ */
/* Step content is visible by default.
   Transitions are applied via inline styles in animations.js
   using the force-layout pattern (getBoundingClientRect),
   so they work reliably in all environments. */
.step-content {
  opacity: 1;
  transform: translateX(0);
}

.step-question {
  font-size: clamp(1.25rem, 3vw, 1.5625rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-text);
  letter-spacing: -.015em;
}

/* Options grid */
.options-grid {
  display: grid;
  gap: .75rem;
}
.options-grid-2 { grid-template-columns: 1fr 1fr; }
.options-grid-1 { grid-template-columns: 1fr; }

/* Option card */
.option-card {
  display: grid;
  grid-template-areas:
    "icon label check"
    "icon desc  check";
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0 .75rem;
  padding: 1rem 1.125rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  position: relative;
  transition:
    border-color 150ms ease,
    box-shadow   150ms ease,
    background   150ms ease,
    transform    150ms cubic-bezier(.34, 1.56, .64, 1);
  -webkit-tap-highlight-color: transparent;
}
.option-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .10);
}
.option-card:focus-visible {
  outline: 3px solid rgba(var(--color-accent-rgb), .8);
  outline-offset: 2px;
}
.option-card[aria-checked="true"] {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), .05);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .12);
}
.option-card.selecting {
  transform: scale(.975);
}

.option-icon {
  grid-area: icon;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--color-primary-rgb), .09);
  border-radius: 8px;
  color: var(--color-primary);
  flex-shrink: 0;
}
.option-icon svg { width: 18px; height: 18px; }

.option-label {
  grid-area: label;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .9375rem;
  color: var(--color-text);
  line-height: 1.3;
}
.option-desc {
  grid-area: desc;
  font-size: .78125rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-top: .1rem;
}

/* Check indicator */
.option-check {
  grid-area: check;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0);
  transition:
    opacity  .18s ease,
    transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
.option-check svg { width: 12px; height: 12px; stroke-width: 3; }
.option-card[aria-checked="true"] .option-check {
  opacity: 1;
  transform: scale(1);
}

/* Options with no icon — single column layout */
.options-grid-1 .option-card {
  grid-template-areas: "label check" "desc check";
  grid-template-columns: 1fr auto;
}
.options-grid-1 .option-card .option-icon {
  display: none;
}
.options-grid-1 .option-card:has(.option-icon) {
  grid-template-areas: "icon label check" "icon desc check";
  grid-template-columns: auto 1fr auto;
}
.options-grid-1 .option-card:has(.option-icon) .option-icon {
  display: flex;
}

/* ── Multi-select step ───────────────────────────────────── */
.step-hint {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-top: -.75rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.btn-multi-continue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  margin-top: 1.25rem;
  padding: .9375rem 1.5rem;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius);
  transition: all 250ms cubic-bezier(.2, 0, 0, 1);
}
.btn-multi-continue:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-multi-continue:active { transform: translateY(0); }
.btn-multi-continue svg { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   CONTACT FORM
═══════════════════════════════════════════════════════════ */
.contact-step .step-question {
  margin-bottom: 1.25rem;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.form-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-field {
  position: relative;
}
.form-field.field-full {
  grid-column: 1 / -1;
}

/* Floating label inputs */
.form-field input,
.form-field textarea {
  width: 100%;
  padding: 1.375rem 1rem .5rem;
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  line-height: 1.5;
  resize: none;
}
.form-field textarea { min-height: 88px; }
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .10);
  background: var(--color-surface);
}
.form-field.invalid input,
.form-field.invalid textarea {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .10);
}

/* Floating label */
.form-field label {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--color-text-muted);
  pointer-events: none;
  transform-origin: left top;
  transition:
    transform 250ms cubic-bezier(.2, 0, 0, 1),
    color     250ms cubic-bezier(.2, 0, 0, 1),
    font-size 250ms cubic-bezier(.2, 0, 0, 1);
}
.form-field input:focus ~ label,
.form-field input:not(:placeholder-shown) ~ label,
.form-field textarea:focus ~ label,
.form-field textarea:not(:placeholder-shown) ~ label,
.form-field.filled label {
  transform: translateY(-.625rem) scale(.78);
  color: var(--color-primary);
  font-weight: 600;
}
.form-field.invalid label { color: var(--color-error); }
.form-field input:focus ~ label { color: var(--color-primary); }

/* Trick for floating label: inputs need a placeholder for :not(:placeholder-shown) */
.form-field input::placeholder,
.form-field textarea::placeholder { color: transparent; }

.field-error {
  display: block;
  font-size: .75rem;
  color: var(--color-error);
  margin-top: .3rem;
  min-height: 1em;
  padding-left: .25rem;
}
.optional {
  font-weight: 400;
  font-size: .75rem;
  color: var(--color-text-muted);
}
/* Honeypot — visually hidden and unreachable by keyboard */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.consent-text {
  font-size: .78125rem;
  color: var(--color-text-muted);
  margin-bottom: 1.125rem;
  line-height: 1.5;
}
.form-error {
  margin-top: .75rem;
  font-size: .875rem;
  color: var(--color-error);
  text-align: center;
  min-height: 1.2em;
}

/* ══════════════════════════════════════════════════════════
   RESULT PAGE
═══════════════════════════════════════════════════════════ */
.result-step {
  text-align: center;
}
.result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  background: rgba(var(--color-success-rgb), .12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-success);
  transition: opacity .4s ease, transform .5s cubic-bezier(.34, 1.56, .64, 1);
}
.result-icon svg { width: 32px; height: 32px; }
.result-icon.hidden-pre { opacity: 0; transform: scale(.3); }
.result-headline {
  font-size: 1.375rem;
  font-weight: 800;
  margin-bottom: .5rem;
  letter-spacing: -.015em;
}
.price-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .375rem;
  margin: 1.25rem 0 1.125rem;
}
.price-low,
.price-high {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -.02em;
  opacity: 0;
}
.price-sep {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  font-weight: 400;
}
.price-low.animated,
.price-high.animated { opacity: 1; }

.result-message {
  font-size: .9375rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: 440px;
  margin: 0 auto 1.25rem;
}
.result-message strong { color: var(--color-text); font-weight: 700; }

.emergency-note {
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .3);
  border-radius: 8px;
  padding: .625rem 1rem;
  font-size: .8125rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 1.25rem;
}
.result-cta-call {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary);
  padding: .875rem 1.75rem;
  border: 2px solid var(--color-primary);
  border-radius: 99px;
  transition: all 250ms ease;
}
.result-cta-call:hover {
  background: var(--color-primary);
  color: #fff;
}
.result-secondary {
  display: block;
  margin-top: 1rem;
  font-size: .8125rem;
  color: var(--color-text-muted);
}

/* ══════════════════════════════════════════════════════════
   SOCIAL PROOF SIDEBAR
═══════════════════════════════════════════════════════════ */
.proof-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.proof-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .25rem;
}
.proof-rating {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
}
.proof-stars {
  display: flex;
  gap: 2px;
  color: #f59e0b;
}
.proof-stars svg { width: 15px; height: 15px; fill: currentColor; }
.proof-count {
  font-size: .8125rem;
  color: var(--color-text-muted);
}
.review-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow-sm);
}
.review-stars {
  display: flex;
  gap: 2px;
  color: #f59e0b;
  margin-bottom: .5rem;
}
.review-stars svg { width: 13px; height: 13px; fill: currentColor; }
.review-text {
  font-size: .875rem;
  color: var(--color-text);
  line-height: 1.55;
  margin-bottom: .5rem;
  font-style: italic;
}
.review-name {
  font-size: .78125rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.proof-badge {
  background: rgba(var(--color-primary-rgb), .06);
  border: 1px solid rgba(var(--color-primary-rgb), .15);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.proof-badge-icon {
  font-size: 1.5rem;
  margin-bottom: .4rem;
}
.proof-badge-text {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--color-primary);
}
.proof-badge-sub {
  font-size: .74rem;
  color: var(--color-text-muted);
  margin-top: .2rem;
}

/* ══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  background: var(--color-surface);
}
.footer-inner { text-align: center; }
.footer-copy {
  font-size: .8125rem;
  color: var(--color-text-muted);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .quote-layout {
    grid-template-columns: 1fr;
  }
  .proof-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
  }
  .proof-header { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .hero { padding: 2.25rem 0 1.75rem; }
  .quote-section { padding: 1.5rem 0 3rem; }
  .step-viewport { padding: 1.25rem 1.125rem 1.5rem; }
  .options-grid-2 { grid-template-columns: 1fr; }
  .form-fields { grid-template-columns: 1fr; }
  .header-phone span { display: none; }
  .proof-panel { grid-template-columns: 1fr; }
  .proof-panel .proof-badge { display: none; }
  .price-display { gap: .25rem; }
}

@media (max-width: 400px) {
  .container { padding: 0 1rem; }
  .step-viewport { padding: 1rem .875rem 1.25rem; }
}

/* ══════════════════════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .progress-fill { transition: none; }
}

/* ══════════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.hidden { display: none !important; }
