/* /instant-quote/ — loaded only on that page (front matter `stylesheet`).
   Tokens and house components (.button, form fields, .checkbox-label,
   .mcta-dialog, .mcta-city) come from index.css; this file only lays them out.
   Hallmark · macrostructure: Workbench (tool page) · tone: utilitarian · anchor hue: site brand blue */

.iq {
  --iq-low: var(--brand-blue);
  --iq-low-fill: rgba(61, 77, 255, 0.22);
  --iq-high: #e8890c;
  --iq-high-fill: rgba(245, 158, 11, 0.26);
  --iq-off: var(--ink-soft);
  --iq-off-fill: rgba(15, 23, 42, 0.45);
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) 1.25rem clamp(3rem, 6vw, 5rem);
}

/* A class that sets `display` outranks the UA rule behind `hidden`. */
.iq [hidden] {
  display: none !important;
}

/* One vertical rhythm instead of per-element margins. */
.iq-panel > * + *,
.iq-summary > * + *,
.iq-gallery > * + *,
.iq-callout > * + * {
  margin-top: 1rem;
}

.iq-panel__title + *,
.iq-summary__title + *,
.iq-gallery > h3 + p,
.iq-callout > h3 + p,
.iq-fine {
  margin-top: 0.35rem;
}

/* ── Header: small and left-aligned; the tool is the page ── */
.iq-hero {
  margin-bottom: 1.75rem;
}

.iq-hero__title {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 22ch;
}

.iq-hero__desc {
  margin-top: 0.6rem;
}

.iq-hero__desc,
.iq-panel__desc,
.iq-gallery > p,
.iq-callout p,
.iq-done p {
  color: var(--muted);
  max-width: 62ch;
}

/* Past the address step the header is just context; keep the price above the fold. */
.iq[data-step="photos"] .iq-hero__desc,
.iq[data-step="quote"] .iq-hero__desc {
  display: none;
}

.iq[data-step="photos"] .iq-hero__title,
.iq[data-step="quote"] .iq-hero__title {
  font-size: 1.25rem;
  max-width: none;
}

.iq-progress {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.iq-progress span {
  font-family: var(--font-mono);
}

.iq-progress .is-current {
  color: var(--ink);
  font-weight: 600;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--brand-blue);
  text-underline-offset: 0.5em;
}

/* ── Steps ── */
.iq-panel {
  max-width: 760px;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.iq-panel--quote {
  max-width: none;
}

.iq-callout[hidden] + .iq-quote {
  margin-top: 0;
}

.iq-panel__title {
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.25;
}

.iq-link {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-blue);
  background: none;
  border: none;
  padding: 0.25rem 0;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(61, 77, 255, 0.35);
  text-underline-offset: 3px;
}

.iq-link:hover {
  color: var(--brand-blue-dark);
  text-decoration-color: currentColor;
}

.iq .button:disabled {
  opacity: 0.45;
  box-shadow: none;
  pointer-events: none;
}

.iq-fine {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.iq-callout {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
}

.iq-callout h3 {
  font-size: 1.1rem;
}

.iq-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.iq-actions__hint {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* Step 1 */
.iq-address {
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.75rem;
}

.iq-address .form-error {
  grid-column: 1 / -1;
}

/* Step 2 */
.iq-area-ok {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.iq-tips {
  display: grid;
  gap: 0.35rem;
  padding-left: 1.2rem;
  color: var(--muted);
}

.iq-drop.is-over,
.iq-drop:focus-within {
  outline: 3px solid var(--brand-blue);
  outline-offset: 3px;
}

/* Once photos are in, "See my quote" is the main action and adding more is secondary. */
.iq-panel:has(.iq-thumb) .iq-drop,
.iq-panel:has(.iq-thumb) .iq-drop:hover {
  color: var(--brand-blue);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--brand-blue);
}

.iq-thumbs {
  list-style: none;
}

.iq-thumb {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.iq-thumb__img {
  flex: 0 0 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}

.iq-thumb__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.iq-thumb.is-working .iq-thumb__img::after,
.iq-thumb.is-queued .iq-thumb__img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: iq-shimmer 1.2s linear infinite;
}

@keyframes iq-shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .iq-thumb.is-working .iq-thumb__img::after,
  .iq-thumb.is-queued .iq-thumb__img::after {
    animation: none;
  }
}

.iq-thumb__body {
  min-width: 0;
}

.iq-thumb__status {
  font-size: 0.9rem;
  font-weight: 600;
}

.iq-thumb.is-working .iq-thumb__status,
.iq-thumb.is-queued .iq-thumb__status,
.iq-thumb__note {
  font-weight: 400;
  color: var(--ink-soft);
}

.iq-thumb__note {
  display: block;
  font-size: 0.82rem;
}

.iq-thumb.is-error .iq-thumb__status {
  color: var(--danger);
  font-weight: 500;
}

.iq-thumb__actions {
  display: flex;
  gap: 0.9rem;
}

/* ── Step 3: traced photos + an estimate sheet ── */
.iq-quote {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "gallery summary";
  gap: 2rem;
  align-items: start;
}

.iq-summary {
  grid-area: summary;
  position: sticky;
  top: 150px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.iq-summary__title {
  font-size: 1.25rem;
}

.iq-summary .button {
  width: 100%;
  text-align: center;
}

.iq-counts div,
.iq-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.iq-counts div,
.iq-lines th,
.iq-lines td {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.iq-counts dt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.iq-counts dt,
.iq-lines th {
  font-weight: 400;
  color: var(--muted);
  text-align: left;
}

/* Figures in Space Mono, like the site's counters and stats. */
.iq-counts dd,
.iq-lines td,
.iq-total strong {
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: right;
}

.iq-lines {
  width: 100%;
  border-collapse: collapse;
}

.iq-total {
  font-weight: 600;
}

.iq-total strong {
  font-size: 2rem;
  line-height: 1.2;
}

.iq-options fieldset {
  border: 0;
}

.iq-options legend {
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.iq-gallery {
  grid-area: gallery;
  min-width: 0;
}

.iq-gallery > h3 {
  font-size: 1.15rem;
}

.iq-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.iq-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.iq-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid;
  border-radius: 3px;
  flex-shrink: 0;
}

.iq-swatch--low { border-color: var(--iq-low); background: var(--iq-low-fill); }
.iq-swatch--high { border-color: var(--iq-high); background: var(--iq-high-fill); }
.iq-swatch--off { border: 2px dashed var(--iq-off); }

.iq-gallery__photos {
  display: grid;
  gap: 1.5rem;
}

.iq-gallery__note {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.iq-photo__frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--ink-deep);
  user-select: none;
  -webkit-user-select: none;
}

.iq-photo__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.iq-photo__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.iq-pane {
  stroke-width: 2.5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: pointer;
  transition: fill 150ms ease, stroke 150ms ease;
}

.iq-pane--low { stroke: var(--iq-low); fill: var(--iq-low-fill); }
.iq-pane--high { stroke: var(--iq-high); fill: var(--iq-high-fill); }

.iq-pane:hover {
  stroke-width: 4;
}

.iq-pane.is-off {
  stroke: #fff;
  stroke-dasharray: 6 5;
  fill: var(--iq-off-fill);
}

.is-review .iq-pane {
  cursor: default;
}

/* Square numbered tags, like survey markup, not floating pills. */
.iq-badge {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border: 1px solid #fff;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 20px;
  color: #fff;
  cursor: pointer;
}

.iq-badge--low { background: var(--iq-low); }
/* White on amber is under 3:1; ink on amber passes. */
.iq-badge--high { background: var(--iq-high); color: var(--ink); }

.iq-badge.is-off {
  background: var(--iq-off);
  color: #fff;
  text-decoration: line-through;
}

.iq-badge:disabled {
  cursor: default;
}

/* Two-tone ring so focus shows on both bright and dark photos. */
.iq-badge:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
  box-shadow: 0 0 0 5px var(--ink);
}

/* On touch screens a small badge is hard to hit; grow the tap area to ~40px
   without changing how it looks. Same for the text-only link buttons. */
@media (pointer: coarse) {
  .iq-badge::before {
    content: "";
    position: absolute;
    inset: -11px;
    border-radius: 999px;
  }

  .iq-link {
    min-height: 40px;
  }
}

.iq-photo__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Start service dialog (shell is .mcta-dialog) ── */
.iq-dialog {
  width: min(640px, calc(100vw - 2rem));
  padding: clamp(1.5rem, 4vw, 2.25rem);
}

.iq-dialog .mcta-dialog__close {
  min-width: 44px;
  min-height: 44px;
}

.iq-done {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}

.iq-done a {
  color: var(--brand-blue);
  font-weight: 600;
}

/* ── Responsive ── */
/* ── Sticky price bar: phones and tablets, where the summary sits above the photos ── */
.iq-bar {
  display: none;
}

@media (max-width: 960px) {
  .iq-quote {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "summary" "gallery";
  }

  .iq-summary {
    position: static;
  }

  .iq-bar {
    position: fixed;
    inset: auto 0 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    transition: transform 200ms ease;
  }

  .iq-bar.is-tucked {
    transform: translateY(100%);
  }

  .iq-bar__price {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    font-size: 0.8rem;
    color: var(--muted);
  }

  .iq-bar__price strong {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    color: var(--ink);
  }

  .iq-bar .button {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Room for the bar at the end of the page. */
  .iq[data-step="quote"] {
    padding-bottom: 6rem;
  }
}

@media (max-width: 640px) {
  /* The tool needs the whole screen: let the site header scroll away here. */
  .site-header {
    position: static;
  }

  .iq {
    padding: 1.25rem 1rem 3rem;
  }

  .iq-hero {
    margin-bottom: 1.25rem;
  }

  .iq-hero__title {
    font-size: 1.6rem;
  }

  .iq-hero__desc {
    font-size: 0.95rem;
  }

  .iq-progress {
    margin-top: 1rem;
    gap: 0.25rem 1.1rem;
  }

  .iq-panel {
    padding-top: 1.25rem;
  }

  .iq-address {
    grid-template-columns: 1fr;
  }

  /* Main actions as full-width thumb targets. */
  .iq-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .iq-actions .button {
    width: 100%;
    text-align: center;
  }

  /* 16px stops iOS Safari zooming the page when a field is tapped. */
  .iq input:not([type="checkbox"]):not([type="radio"]),
  .iq select,
  .iq textarea {
    font-size: 16px;
  }

  /* Bigger photos to tap on: run them edge to edge. */
  .iq-photo__frame {
    margin: 0 -1rem;
    border-radius: 0;
  }

  /* Number tags overlap on a phone-sized photo, so show dots. The pane number
     stays in each tag's aria-label, and the tap area stays ~40px. */
  .iq-badge {
    width: 12px;
    min-width: 0;
    height: 12px;
    padding: 0;
    border-width: 2px;
    border-radius: 50%;
    font-size: 0;
  }

  .iq-badge::before {
    inset: -14px;
  }

  /* Start service slides up as a bottom sheet. */
  .iq-dialog {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  }

  .iq-dialog[open] {
    animation: iq-sheet 220ms ease-out;
  }
}

@keyframes iq-sheet {
  from {
    transform: translateY(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .iq-bar {
    transition: none;
  }

  .iq-dialog[open] {
    animation: none;
  }
}
