/* ─── Joe's Websites — Quote wizard ──────────────────────────────────────────
 * Full-screen 5-step quote flow (/quote). Loaded on top of style.css.
 */

.qz-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;        /* left card floats centred; image column fills height */
  gap: 0;                     /* image sits flush against the form column */
  min-height: 100dvh;
  max-height: 100dvh;
}

/* Bounded, centered card: caps its own height on tall screens and floats
 * centred with even whitespace above/below, instead of stretching full-height. */
.qz-left {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-self: center;       /* centre the bounded card in its column (grid default is stretch/start) */
  width: min(100%, 860px);
  /* Firm height (not max-height): card size no longer depends on step content,
     so the top bar and Back/Next stay anchored in place across steps */
  height: min(100dvh, 1060px);
  padding: clamp(1rem, 2.5vh, 1.75rem) clamp(1rem, 2.5vw, 2rem);
}

/* Progress */
.qz-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.qz-progress { display: flex; gap: .5rem; }
.qz-progress span {
  width: 52px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background var(--transition);
}
.qz-progress span.is-done { background: var(--ink); }

.qz-close {
  color: var(--ink);
  display: inline-flex;
  padding: .4rem;
  border-radius: 50%;
  transition: background var(--transition);
}
.qz-close:hover { background: var(--chip); }

/* Step body */
.qz-body {
  flex: 1;
  min-height: 0;               /* allow the flex child to shrink below content height */
  overflow-y: auto;           /* tall steps scroll here — card stays bounded, buttons pinned */
  display: flex;
  flex-direction: column;
  justify-content: safe center; /* centred when it fits; top-aligned (scrollable) when it overflows */
  padding: 2.5rem 0;
  text-align: left; /* every step stays left-aligned — no stray centring */
}
.qz-step { border: none; }
/* Gentle fade-up when a step appears (display:none → block restarts the animation) */
@keyframes qz-step-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.qz-step:not(.hidden) { animation: qz-step-in .3s ease both; }

.qz-question {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 1.1rem;
}

/* Choice pills (single-select) */
.qz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.qz-choice {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
/* Hover matches the selected state's 2px weight, but keeps the resting border colour */
.qz-choice:not(.is-selected):hover {
  border-color: var(--border);
  box-shadow: inset 0 0 0 1px var(--border);
}
.qz-choice.is-selected {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);   /* 1px border + 1px inset ring = 2px look, no reflow */
}

/* Hint box */
.qz-hint {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  background: var(--green-mint);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  font-size: .92rem;
  color: var(--ink);
  margin-top: 1.2rem;
}
.qz-hint svg { flex-shrink: 0; margin-top: .15rem; color: var(--green); }

/* Follow-up fields */
.qz-follow { margin-top: 1.2rem; }
.qz-follow-label { font-size: 1rem; font-weight: 500; color: var(--ink); margin: 1.4rem 0 .7rem; }

/* Smooth reveal for conditional [data-when] blocks — grid-rows 0fr→1fr height animation.
 * JS toggles .is-open (see updateFollows in quote.js); .qz-anim-ready gates the transition
 * so restored sessions render open blocks instantly without a replay flash. */
.qz-reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  margin-top: 0;
}
.qz-reveal-inner { min-height: 0; overflow: hidden; }
.qz-anim-ready .qz-reveal {
  transition: grid-template-rows .35s ease, opacity .35s ease,
              margin-top .35s ease, visibility 0s .35s;
}
.qz-reveal.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  margin-top: 1.2rem;
  transition-delay: 0s;
}

.qz-input,
.qz-textarea {
  width: 100%;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .95rem 1.1rem;
  font-family: var(--font-sans);
  font-size: .95rem;
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}
/* Focused or filled reads active with the same stroke the option cards use
   (1px border + 1px inset ring = 2px look, no reflow). .is-filled is set in quote.js. */
.qz-input:focus, .qz-textarea:focus,
.qz-input.is-filled, .qz-textarea.is-filled {
  outline: none;
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.qz-textarea { min-height: 100px; resize: vertical; }
.qz-input::placeholder, .qz-textarea::placeholder { color: var(--text-light); }

/* Text boxes nested inside option cards read tighter than the card itself */
.qz-card .qz-input,
.qz-card .qz-textarea { border-radius: 6px; }
/* Inside a card the CARD carries the active stroke (see .qz-card.is-filled below),
   so the nested field stays quiet — no double ring. */
.qz-card .qz-input:focus, .qz-card .qz-textarea:focus,
.qz-card .qz-input.is-filled, .qz-card .qz-textarea.is-filled {
  border-color: var(--border);
  box-shadow: none;
}

/* Option cards (features / extras / brand) */
.qz-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-top: 1.2rem; }
.qz-cards-3 { grid-template-columns: repeat(3, 1fr); }
.qz-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
/* Hover matches the selected state's 2px weight, but keeps the resting border colour.
   It must stand down for every "active" state — selected, filled, or focused — or it
   would overwrite their dark stroke on pointer-over (it outspecifies .is-filled). */
.qz-card:not(.is-locked):not(.is-selected):not(.is-filled):not(:focus-within):hover {
  border-color: var(--border);
  box-shadow: inset 0 0 0 1px var(--border);
}
.qz-card.is-selected {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);   /* 1px border + 1px inset ring = 2px look, no reflow */
}
/* Free-text cards can't be "clicked on" — focusing or filling their textarea is
   the equivalent action, so they take the same stroke as a selected card.
   .is-locked cards are excluded: they are containers (always-included features,
   step 3's radio groups), and focusing a radio inside one must not stroke the card. */
.qz-card:not(button):not(.is-locked):focus-within,
.qz-card:not(.is-locked).is-filled {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
/* Toggle buttons no longer take the focus-within stroke (it made a just-deselected
   card look still selected while it kept DOM focus) — keyboard users get an
   outline instead. */
.qz-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* A selected card already carries the 2px stroke — the focus ring on top reads
   as a double border, so it stands down while selected. */
.qz-card.is-selected:focus-visible { outline: none; }
/* Always-included cards: read as included (green) + non-interactive, not clickable. */
.qz-card.is-locked { cursor: default; }
.qz-card.is-locked.is-selected {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}
.qz-card-head { display: flex; align-items: center; flex-wrap: nowrap; gap: .4rem; margin-bottom: .35rem; }
.qz-card-head h3 { flex: 1 1 auto; min-width: 0; }
.qz-card h3 { font-size: .95rem; font-weight: 600; }
.qz-card p { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.qz-badge {
  background: var(--green-mint);
  border-radius: var(--radius-pill);
  font-size: .63rem;
  font-weight: 600;
  color: var(--green);
  padding: .15rem .5rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.qz-card .qz-textarea { margin-top: .5rem; min-height: 70px; font-size: .85rem; }
/* Option thumbnails — mobile only (desktop uses the hover photo panel instead) */
.qz-card-thumb { display: none; }

/* Radio sub-options inside brand cards */
.qz-radio { display: flex; align-items: flex-start; gap: .5rem; font-size: .8rem; color: var(--text-muted); padding: .25rem 0; cursor: pointer; }
.qz-radio input { accent-color: var(--ink); margin-top: .2rem; flex-shrink: 0; }

/* Step 5 contact fields */
.qz-contact { display: flex; flex-direction: column; gap: 1rem; }

/* Bottom bar */
.qz-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.qz-actions .qz-spacer { flex: 1; }
.qz-btn {
  border: none;
  font-family: var(--font-head);
  font-size: .95rem;
  font-weight: 600;
  padding: .8rem 1.7rem;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), opacity var(--transition), transform var(--transition);
}
/* House hover = 2px lift (like .btn-primary/.btn-light on the main page), no colour change */
.qz-btn-back { background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm); }
.qz-btn-back:hover { transform: translateY(-2px); }
.qz-btn-next { background: var(--ink); color: var(--white); }
.qz-btn-next:hover:not(:disabled) { transform: translateY(-2px); }
.qz-btn-next:disabled { background: #c9c8cd; cursor: not-allowed; }

/* Thank-you page — full-screen overlay shown after a successful submit */
.qz-thankyou {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--cream);
  padding: 2rem clamp(1.5rem, 6vw, 5rem);
  overflow-y: auto;
}
.qz-ty-close {
  position: absolute;
  top: 1.4rem;
  right: 1.75rem;
  color: var(--ink);
  display: inline-flex;
  padding: .5rem;
  border-radius: 50%;
  transition: background var(--transition);
}
.qz-ty-close:hover { background: var(--chip); }
.qz-ty-inner {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 7vw, 6rem);
  max-width: 1040px;
  margin: 0 auto;
}
.qz-ty-fig { width: clamp(150px, 22vw, 250px); height: auto; flex-shrink: 0; }
.qz-ty-text { max-width: 440px; }
.qz-ty-text h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); font-weight: 600; letter-spacing: -0.03em; margin-bottom: 1.2rem; }
.qz-ty-text p { color: var(--ink); font-size: 1.1rem; line-height: 1.6; }
.qz-ty-sign { margin-top: 1.4rem; color: var(--text-muted); }
.qz-ty-return { display: inline-flex; margin-top: 2.2rem; }

@media (max-width: 700px) {
  .qz-ty-inner { flex-direction: column; text-align: center; gap: 1.8rem; padding-bottom: 5rem; }
  .qz-ty-fig { width: 150px; }
  .qz-ty-return { position: static; display: block; width: fit-content; margin: 2rem auto 0; }
}

/* Right imagery panel — two stacked layers crossfade via opacity */
.qz-panel {
  position: relative;
  height: 100dvh;                        /* full-bleed top→bottom */
  /* 50% split, but NEVER wider than the photo's portrait ratio — cover may
     side-crop a little, but can never top/bottom-crop the subject */
  width: min(50vw, calc(100dvh * 1000 / 1070));
  background: var(--chip);
  border-radius: 0;                      /* square, edge-to-edge per mockup */
  padding: 0;
  overflow: hidden;
}
/* Narrow-desktop band: give the form more room */
@media (min-width: 901px) and (max-width: 1100px) {
  .qz-panel { width: min(42vw, calc(100dvh * 1000 / 1070)); }
}
.qz-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  opacity: 0;
  transition: opacity .6s ease;
  will-change: opacity;
}
.qz-image.is-active { opacity: 1; }
/* Artwork layers — contained inside the panel so they are never cropped by the
   base image's `cover` fit (see .qz-image above). Position per modifier. */
.qz-artwork {
  position: absolute;
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
}
.qz-artwork.is-active { opacity: 1; }
.qz-artwork-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(78%, 620px);
  height: auto;
}
/* Flush to the bottom edge; both maxes so the tall artwork scales down to fit
   whichever dimension runs out first */
.qz-artwork-bottom {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  max-width: 88%;
  max-height: 92%;
}

/* Persistent selection summary overlay on the image */
.qz-overlay {
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.25rem;
  max-height: calc(100% - 2.5rem);
  overflow-y: auto;
  background: rgba(20, 20, 20, .62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition);
}
.qz-overlay.is-visible { opacity: 1; transform: none; }
/* Faded out while hovering an option so the swapped image is unobstructed */
.qz-overlay.is-dimmed { opacity: 0; pointer-events: none; }
.qz-overlay-heading {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: .9rem;
}
.qz-overlay-inner { display: flex; flex-direction: column; }
.qz-overlay-section { padding: 1.1rem 0; }
.qz-overlay-section:first-child { padding-top: 0; }
.qz-overlay-section:last-child { padding-bottom: 0; }
.qz-overlay-section + .qz-overlay-section { border-top: 1px solid rgba(255, 255, 255, .12); }
.qz-overlay-title {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .55);
  margin-bottom: .4rem;
}
.qz-overlay-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.qz-overlay-list li { display: flex; align-items: flex-start; gap: .5rem; font-size: .88rem; line-height: 1.35; color: #f2f1ec; }
.qz-overlay-check { flex-shrink: 0; margin-top: .1rem; color: var(--green); }
.qz-overlay-note { font-size: .78rem; color: rgba(255, 255, 255, .6); margin-top: .35rem; line-height: 1.4; }
/* Project-level benchmark for the derived tier — a sum line under every section */
.qz-overlay-total {
  border-top: 1px solid rgba(255, 255, 255, .22);
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

/* Auto-animated summary rows — new entries grow/fade in, removals collapse out
   (keyed morph in renderOverlay/morphChildren, quote.js). Gated on .qz-anim-ready
   like .qz-reveal. Enter heights are seeded inline by enterNode() (0 → real
   scrollHeight), the exact mirror of .is-leaving, so simultaneous enters and
   leaves move at the same speed and the panel never overshoots. */
.qz-anim-ready .qz-overlay .is-entering {
  overflow: hidden;
  transition: max-height .3s ease, opacity .2s ease .1s;
}
/* JS seeds an inline max-height (scrollHeight) before this class lands, so the
   collapse has a from-value; padding/margin/border collapse with it because
   sections carry their own padding + top border. */
.qz-anim-ready .qz-overlay .is-leaving {
  overflow: hidden;
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  border-width: 0 !important;
  transition: max-height .3s ease, opacity .2s ease, padding .3s ease,
              margin .3s ease, border-width .3s ease;
}

.qz-status { margin-top: 1rem; font-size: .92rem; }
.qz-status.form-error { color: var(--danger); }

/* Responsive */
@media (max-width: 900px) {
  .qz-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; max-height: none; align-content: stretch; }
  .qz-left { height: auto; max-height: none; padding: 1rem 1.25rem 1rem; }
  .qz-body { justify-content: flex-start; padding: 1.75rem 0; }
  .qz-progress span { width: 36px; }
  .qz-choices, .qz-cards { grid-template-columns: 1fr; }
  .qz-cards-3 { grid-template-columns: 1fr; }

  /* Extras cards: text left, full-bleed image flush to the right edge */
  .qz-card-imged { flex-direction: row; align-items: stretch; gap: .9rem; min-height: 132px; padding-right: 0; overflow: hidden; }
  .qz-card-body { flex: 1 1 auto; min-width: 0; align-self: center; }
  .qz-card-thumb { display: block; width: 120px; height: auto; align-self: stretch; flex-shrink: 0; object-fit: cover; margin: -1.1rem 0; border-radius: 0; }

  /* No photo on mobile — the panel becomes a plain summary card (from step 2) */
  /* Bottom-aligned in the leftover 1fr row when content is short */
  .qz-panel { order: 2; position: static; align-self: end; aspect-ratio: auto; width: auto; height: auto; max-height: none; background: none; border-radius: 0; overflow: visible; padding: 0 1.25rem 1.25rem; }
  .qz-image, .qz-artwork { display: none; }
  .qz-overlay {
    position: static;
    max-height: none;
    opacity: 1;
    transform: none;
    /* No photo behind it on mobile — solid forest card matching the homepage CTA */
    background:
      radial-gradient(620px 460px at 12% 15%, var(--forest-mid) 0%, rgba(37, 63, 49, 0) 65%),
      radial-gradient(560px 420px at 88% 90%, var(--forest-mid) 0%, rgba(37, 63, 49, 0) 65%),
      var(--forest);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: none;
    border-radius: var(--radius);
    margin-top: .5rem;
  }
  .qz-overlay:not(.is-visible) { display: none; }
  .qz-overlay.is-dimmed { opacity: 1; } /* no reliable hover-out on touch */
}

@media (prefers-reduced-motion: reduce) {
  .qz-step:not(.hidden) { animation: none; }
  .qz-reveal, .qz-image, .qz-artwork, .qz-overlay, .qz-btn,
  .qz-overlay .is-entering, .qz-overlay .is-leaving { transition-duration: .01ms !important; }
}
