/* Wizard overlay — Typeform-style one-question-per-screen view.
   Activated by adding `wizard-mode` to the <body>. */

body.wizard-mode {
  --wiz-bg: #FEFEFE;
  --wiz-ink: #121212;
  --wiz-soft: #404040;
  --wiz-mute: #6B6B6B;
  --wiz-green: #9EC43D;
  --wiz-green-hover: #8AB031;
  --wiz-line: rgba(18,18,18,0.08);
  overflow-x: hidden;
}

/* Hide the standard step header & multi-step progress bar */
body.wizard-mode .progress { display: none !important; }
body.wizard-mode .step-intro { display: none !important; }
body.wizard-mode section.step .step-footer { display: none !important; }
/* Apply-form-specific chrome to suppress in wizard mode */
body.wizard-mode .banner { display: none !important; }
body.wizard-mode .step-section-tag { display: none !important; }
body.wizard-mode .welcome:not(.active) { display: none !important; }
/* Once submission completes and an endscreen is shown, hide the wizard chrome
   so the success message is the only thing on screen. */
body.wizard-mode:has(.endscreen.show) .wiz-bar,
body.wizard-mode:has(.endscreen.show) .wiz-footer { display: none !important; }
body.wizard-mode:has(.endscreen.show) .layout-split > .card { padding-bottom: 32px !important; }
body.wizard-mode section.step { display: contents !important; }
body.wizard-mode section.step.active,
body.wizard-mode section.step:not(.active) { all: unset; }
body.wizard-mode section.step { all: unset; display: contents !important; }
body.wizard-mode .flow[hidden] { display: none !important; }
body.wizard-mode .flow:not([hidden]) { display: contents !important; }
/* .reveal keeps its native max-height/opacity transition — show/hide is driven
   by the existing form's handleConditionalReveals(). */
body.wizard-mode .savings-panel { display: none !important; }
body.wizard-mode .note { display: none !important; }
body.wizard-mode .trust-line { display: none !important; }
/* The legacy consent <p> lives inside step 3 markup which appears first in
   document order — in wizard mode its parent section collapses to
   display:contents and the paragraph flows to the very top of the page,
   overlapping the hero. Hide it; the wizard re-renders a small version at the
   bottom inside .wiz-footer. */
body.wizard-mode .tc-consent { display: none !important; }

/* Wizard chrome — sticky thin progress bar at the top */
.wiz-bar {
  position: sticky;
  top: 0; left: 0; right: 0;
  z-index: 90;
  height: 6px;
  background: rgba(18,18,18,0.06);
  overflow: hidden;
}
.wiz-bar-fill {
  height: 100%;
  background: var(--wiz-green);
  width: 0%;
  transition: width 0.35s cubic-bezier(0.16,1,0.3,1);
}
.wiz-progress-label {
  position: absolute;
  top: 10px; right: 16px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--wiz-mute);
}

/* Question card — fills available column height, one at a time. The active .q
   is a flex column whose children may shrink. This is critical for the roof
   preview, which gets a max-height so the Yes/No tiles below it stay above the fold. */
body.wizard-mode .q { display: none; }
body.wizard-mode .q.is-active {
  display: flex; flex-direction: column;
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  padding: 4px 0 12px;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: center;
  gap: 10px;
  animation: wiz-slide-in 0.4s cubic-bezier(0.16,1,0.3,1);
}

/* Roof preview — let it shrink within the available column height. Cap so the
   tiles + footer always stay visible without scrolling. */
body.wizard-mode .roof-preview {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 42vh;
  aspect-ratio: auto;
  margin-top: 4px;
}

/* Tighter stacked-tile groups so 5-option questions fit one viewport */
body.wizard-mode .q.is-active .tile-group.stacked .tile { min-height: 48px; padding: 12px 18px; font-size: 15.5px; }
body.wizard-mode .q.is-active .tile { min-height: 56px; padding: 14px 18px; font-size: 16px; }
body.wizard-mode .q.is-active .tile-icon { transform: scale(1); }
@keyframes wiz-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.wizard-mode .q.is-leaving {
  display: flex; flex-direction: column;
  position: absolute; inset: 0;
  animation: wiz-slide-out 0.25s cubic-bezier(0.16,1,0.3,1) forwards;
  pointer-events: none;
}
@keyframes wiz-slide-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-20px); }
}

/* Companion .q — rendered inline below the main question (e.g. T&Cs under phone) */
body.wizard-mode .q.is-companion {
  flex: 0 0 auto;
  justify-content: flex-start;
  padding-top: 4px;
  animation: none;
}
body.wizard-mode .q.is-active.is-companion .q-label,
body.wizard-mode .q.is-active.is-companion .field-label {
  font-size: 14px !important;
  font-weight: 600;
  color: var(--wiz-mute);
  text-transform: none;
  letter-spacing: 0;
}

/* Question label / field label become the BIG headline of the card */
body.wizard-mode .q.is-active .q-label,
body.wizard-mode .q.is-active .field-label:not(.tc-text) {
  font-family: 'Avenir Next','Avenir',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  font-weight: 500;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.12;
  letter-spacing: -0.012em;
  color: var(--wiz-ink);
  margin-bottom: 4px;
  text-transform: none;
  flex-shrink: 0;
}
body.wizard-mode .q.is-active .q-label .req,
body.wizard-mode .q.is-active .field-label .req {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--wiz-mute);
  margin-top: 6px;
  letter-spacing: 0;
}
body.wizard-mode .q.is-active .field-help {
  font-size: 14px;
  color: var(--wiz-mute);
  margin-top: -4px;
}

/* Tile groups inside an active wizard question — full width, big touch targets */
body.wizard-mode .q.is-active .tile-group,
body.wizard-mode .q.is-active .tile-plus-row {
  width: 100%;
}
body.wizard-mode .q.is-active .tile {
  min-height: 64px;
  font-size: 17px;
  padding: 18px 22px;
}
body.wizard-mode .q.is-active .tile-icon { transform: scale(1.1); }

/* Inputs/selects inside active question — large */
body.wizard-mode .q.is-active .field-input,
body.wizard-mode .q.is-active .field-select {
  font-size: 22px;
  padding: 18px 18px;
  border-radius: 14px;
  border: 1.5px solid rgba(18,18,18,0.12);
  background: var(--wiz-bg);
}
body.wizard-mode .q.is-active .field-input:focus,
body.wizard-mode .q.is-active .field-select:focus {
  outline: none;
  border-color: var(--wiz-green);
  box-shadow: 0 0 0 4px rgba(158,196,61,0.18);
}
body.wizard-mode .q.is-active .field-grid {
  display: grid; gap: 12px;
}
body.wizard-mode .q.is-active .field-grid.three {
  grid-template-columns: 1.4fr 0.8fr 1fr;
}
@media (max-width: 600px) {
  body.wizard-mode .q.is-active .field-grid.three { grid-template-columns: 1fr; }
}

/* T&Cs */
body.wizard-mode .q.is-active .tc-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 14px; border: 1.5px solid var(--wiz-line); border-radius: 14px; }
body.wizard-mode .q.is-active .tc-row .tc-text { font-size: 15px; line-height: 1.5; color: var(--wiz-soft); font-weight: 500; }
body.wizard-mode .q.is-active .tc-checkbox { width: 22px; height: 22px; }

/* Bill upload */
body.wizard-mode .q.is-active .bill-upload {
  min-height: 180px;
}

/* Wizard footer — pinned to the bottom of the card, inside the left column */
.wiz-footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 12px clamp(28px, 5vw, 72px) 12px;
  background: var(--wiz-bg);
  border-top: 1px solid rgba(18,18,18,0.06);
  z-index: 80;
}
.wiz-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.wiz-footer-consent {
  font-size: 11px;
  line-height: 1.4;
  color: var(--wiz-mute);
  text-align: center;
  margin: 0;
  padding: 2px 8px 0;
}
.wiz-footer-consent a {
  color: var(--wiz-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}
body.wizard-mode .form-split > .card, body.wizard-mode .layout-split > .card { position: relative; padding-bottom: 110px; }

/* Desktop wizard mode: once a form question is active (welcome dismissed),
   turn the card + form into flex columns so the promo strip sits at the top,
   the form fills the remaining vertical space, and the active .q (which
   already has justify-content:center) can vertically centre its contents
   within the tall card. Gated on :has(.q.is-active) so the welcome screen's
   own layout stays untouched. */
@media (min-width: 881px) {
  body.wizard-mode:has(.q.is-active) .form-split > .card,
  body.wizard-mode:has(.q.is-active) .layout-split > .card {
    display: flex;
    flex-direction: column;
  }
  body.wizard-mode:has(.q.is-active) #applyForm,
  body.wizard-mode:has(.q.is-active) #quoteForm {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }
}
.wiz-back, .wiz-skip {
  background: transparent;
  border: 0;
  color: var(--wiz-mute);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, background 0.15s;
}
.wiz-back:hover, .wiz-skip:hover { color: var(--wiz-ink); background: rgba(18,18,18,0.05); }
.wiz-back svg { width: 14px; height: 14px; }
.wiz-back[hidden] { visibility: hidden; }
/* [hidden] needs to win over `display: inline-flex` on the skip pill. */
.wiz-skip[hidden] { display: none !important; }

.wiz-next {
  background: var(--wiz-green);
  color: var(--wiz-ink);
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.005em;
  padding: 15px 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(18,18,18,0.06), 0 8px 22px rgba(158,196,61,0.38);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.wiz-next:hover {
  background: var(--wiz-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(18,18,18,0.08), 0 12px 30px rgba(158,196,61,0.48);
}
.wiz-next:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(18,18,18,0.06), 0 6px 16px rgba(158,196,61,0.32);
}
.wiz-next:disabled { background: rgba(158,196,61,0.45); cursor: not-allowed; box-shadow: none; transform: none; }
.wiz-next svg { width: 14px; height: 14px; transition: transform 0.25s cubic-bezier(0.16,1,0.3,1); }
.wiz-next:hover svg { transform: translateX(3px); }
.wiz-next-hint {
  font-size: 11.5px;
  color: var(--wiz-mute);
  letter-spacing: 0.06em;
  margin-left: 10px;
}

@media (max-width: 880px) {
  /* On mobile/tablet the split collapses to one column. Let the page scroll
     normally on small screens so the user always has access to the keyboard
     + form footer. The "no scroll" constraint is desktop-first. */
  body.wizard-mode .form-split, body.wizard-mode .layout-split { height: auto; max-height: none; overflow: visible; }
  body.wizard-mode .form-split > .card, body.wizard-mode .layout-split > .card { height: auto; max-height: none; overflow: visible; padding-bottom: 140px; }
  body.wizard-mode .q.is-active { padding: 16px 0 24px; flex: none; min-height: 50vh; justify-content: flex-start; }
  .wiz-footer { padding: 10px 16px 12px; }
  .wiz-next { padding: 13px 22px; font-size: 15px; }
  .wiz-next-hint { display: none; }
  .wiz-footer-consent { font-size: 10.5px; padding: 0 4px; }
}

/* Hide everything below the wizard chrome */
body.wizard-mode .form-card-foot,
body.wizard-mode .savings-panel { display: none !important; }

/* ============================================================
   3-column form layout shared across quote / apply / sell forms.
   Each form's outer grid container becomes a 3-col grid:
     [.ngs-side-left]   [.card / form]   [.ngs-side-right]
   Mobile: side rails hide, form takes full width.
   ============================================================ */
.ngs-side-left {
  background: #F4F2EE;
  padding: clamp(20px, 3vh, 40px) 22px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid rgba(18,18,18,0.06);
}
.ngs-step-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.ngs-step-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-mute, #6B6B6B);
}
.ngs-step-nav-dot {
  flex-shrink: 0;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(18,18,18,0.18);
  background: var(--bg, #FEFEFE);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ngs-step-nav-item.is-active .ngs-step-nav-dot {
  border-color: var(--green, #9EC43D); background: var(--green, #9EC43D);
  box-shadow: 0 0 0 4px rgba(158,196,61,0.18);
}
.ngs-step-nav-item.is-active { color: var(--ink, #121212); font-weight: 700; }
.ngs-step-nav-item.is-done .ngs-step-nav-dot { border-color: var(--green, #9EC43D); background: var(--green, #9EC43D); }
.ngs-step-nav-item.is-done { color: var(--ink-soft, #404040); }

/* "What you've shared" progress card */
.ngs-answers {
  background: var(--bg, #FEFEFE);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(18,18,18,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ngs-answers[hidden] { display: none; }
.ngs-answers-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B6B6B);
  margin: 0 0 4px;
}
.ngs-answers-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ngs-answers-list li {
  position: relative;
  padding-left: 22px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink, #121212);
}
.ngs-answers-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 3px;
  width: 14px; height: 14px;
  background: var(--green, #9EC43D) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") no-repeat center / 9px;
  border-radius: 50%;
}
.ngs-answers-list li .qa-label { color: var(--ink-mute, #6B6B6B); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; display: block; line-height: 1.2; }
.ngs-answers-list li .qa-value { display: block; font-weight: 600; color: var(--ink, #121212); }

/* Right rail — Quick Tips + social proof */
.ngs-side-right {
  background: #F4F2EE;
  padding: clamp(20px, 3vh, 40px) 22px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-left: 1px solid rgba(18,18,18,0.06);
}
.ngs-side-card {
  background: var(--bg, #FEFEFE);
  border-radius: 14px;
  padding: 18px;
  border: 1px solid rgba(18,18,18,0.06);
}
.ngs-side-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #121212);
  margin: 0 0 12px;
}
.ngs-side-card-title svg { width: 18px; height: 18px; color: var(--green, #9EC43D); }
.ngs-side-card-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ngs-side-card-list li {
  position: relative;
  padding-left: 25px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-soft, #404040);
}
.ngs-side-card-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 4px;
  width: 16px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239EC43D' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") no-repeat center;
}
.ngs-side-card-list li strong { color: var(--ink, #121212); font-weight: 700; }

.ngs-trust-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ngs-trust-card-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--green, #9EC43D); }
.ngs-trust-card-stars { display: inline-flex; gap: 2px; }
.ngs-trust-card-stars svg { width: 18px; height: 18px; color: #F4B400; }
.ngs-trust-card-line { font-size: 13.5px; color: var(--ink-soft, #404040); line-height: 1.45; }
.ngs-trust-card-line strong { color: var(--ink, #121212); font-weight: 700; }

/* Section eyebrow + larger label/sub for question headers */
.q-section-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green, #9EC43D);
  margin-bottom: 10px;
}
.q-label-lg {
  font-family: 'Avenir Next','Avenir',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif !important;
  font-weight: 500 !important;
  font-size: clamp(24px, 3.2vw, 34px) !important;
  line-height: 1.12 !important;
  letter-spacing: -0.015em !important;
  text-transform: none !important;
  color: var(--ink, #121212) !important;
  margin-bottom: 8px !important;
  display: block;
}
.q-sub {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-mute, #6B6B6B);
  margin: 0 0 20px;
  max-width: 540px;
}
.wiz-intro-q { padding: 0; }
.wiz-intro-q .wiz-hero { margin-bottom: 0; }

/* Wiz-hero (intro screen) */
.wiz-hero { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.wiz-hero-eyebrow {
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--green, #9EC43D);
}
.wiz-hero-headline {
  font-family: 'Avenir Next','Avenir',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  font-weight: 500;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink, #121212);
  margin: 0;
}
.wiz-hero-sub {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-mute, #6B6B6B);
  margin: 0;
  max-width: 560px;
}
.wiz-hero-trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 16px;
  background: #F4F2EE;
  border-radius: 14px;
  margin-top: 4px;
}
.wiz-trust-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.wiz-trust-item strong { font-size: 22px; font-weight: 700; color: var(--ink, #121212); line-height: 1; }
.wiz-trust-item span { font-size: 12px; color: var(--ink-mute, #6B6B6B); font-weight: 600; }
.wiz-hero-fomo {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: rgba(158,196,61,0.10);
  border-radius: 12px;
  font-size: 13.5px; line-height: 1.5;
  color: var(--ink, #121212);
}
.wiz-hero-fomo-icon { flex-shrink: 0; width: 18px; height: 18px; color: var(--green, #9EC43D); display: block; }
.wiz-hero-fomo-icon svg { width: 100%; height: 100%; }
.wiz-hero-fomo strong { color: var(--ink, #121212); font-weight: 700; }
body.wizard-mode .q.is-active .wiz-hero { gap: 10px; margin-bottom: 16px; }
@media (max-width: 560px) {
  .wiz-hero { gap: 10px; margin-bottom: 16px; }
  .wiz-hero-headline { font-size: 22px; line-height: 1.15; }
  .wiz-hero-sub { font-size: 14px; }
  .wiz-hero-trust { grid-template-columns: repeat(3, 1fr); padding: 10px 12px; gap: 8px; }
  .wiz-trust-item strong { font-size: 18px; }
  .wiz-trust-item span { font-size: 10.5px; }
  .wiz-hero-fomo { font-size: 12.5px; padding: 10px 12px; }
}

/* Congrats screen (celebratory variant) */
.wiz-congrats-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  background: rgba(158,196,61,0.15);
  color: var(--green, #9EC43D) !important;
  border-radius: 999px;
  font-size: 11.5px; letter-spacing: 0.14em;
}
.wiz-congrats-eyebrow svg { color: var(--green, #9EC43D); flex-shrink: 0; }
.wiz-congrats-steps { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 14px; }
.wiz-congrats-steps li { display: grid; grid-template-columns: 32px 1fr; column-gap: 14px; align-items: start; }
.wiz-congrats-step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink, #121212); color: var(--bg, #FEFEFE);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; line-height: 1; flex-shrink: 0;
}
.wiz-congrats-steps li > div { font-size: 14.5px; line-height: 1.5; color: var(--ink-mute, #6B6B6B); }
.wiz-congrats-steps li > div strong { display: block; color: var(--ink, #121212); font-weight: 700; margin-bottom: 2px; }

@media (max-width: 1100px) {
  .ngs-side-left { display: none !important; }
}
@media (max-width: 820px) {
  .ngs-side-right { display: none !important; }
}
