/* Quick Project Estimate — Wasch Construction (estimate.html) */

body.estimate-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.estimate-page #main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Hero ---------- */
.estimate-hero {
  padding: clamp(40px, 6vw, 64px) 0 clamp(20px, 3vw, 28px);
  text-align: center;
}

.estimate-hero__eyebrow {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.estimate-hero__title {
  margin: 0;
  font-size: clamp(28px, 4.6vw, 40px);
  line-height: var(--leading-display);
  letter-spacing: -0.025em;
  font-weight: 600;
}

.estimate-hero__lede {
  margin: 14px auto 0;
  max-width: 42ch;
  font-size: clamp(15px, 2.2vw, 17px);
  color: var(--muted);
  line-height: var(--leading-body);
}

/* ---------- Wizard shell ---------- */
.estimate-shell {
  width: min(720px, calc(100% - (var(--gutter) * 2)));
  margin: 0 auto;
  padding: 0 0 clamp(56px, 8vw, 96px);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Progress (segmented stepper) ---------- */
.estimate-progress {
  margin-bottom: clamp(18px, 3vw, 24px);
}

.estimate-progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.estimate-progress__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

.estimate-progress__step {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.estimate-progress__track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  /* Slice the bar into 8 visual segments using a mask with thin gaps. */
  -webkit-mask: repeating-linear-gradient(
    to right,
    #000 0 11.5%,
    transparent 11.5% 12.5%
  );
  mask: repeating-linear-gradient(
    to right,
    #000 0 11.5%,
    transparent 11.5% 12.5%
  );
}

.estimate-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 520ms var(--ease);
}

/* ---------- Card frame around the active step ---------- */
.estimate-card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 44px);
  box-shadow: var(--shadow-2);
}

/* ---------- Panels (natural flow, only active visible) ---------- */
.estimate-panels {
  display: block;
}

.estimate-panel {
  display: flex;
  flex-direction: column;
}

.estimate-panel:not(.is-active) {
  display: none;
}

.estimate-panel.is-active {
  animation: estimatePanelEnter 320ms var(--ease);
}

@keyframes estimatePanelEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .estimate-panel.is-active {
    animation: none;
  }
  .estimate-progress__fill {
    transition-duration: 120ms;
  }
}

/* ---------- Question header ---------- */
.estimate-q {
  margin: 0 0 clamp(20px, 3vw, 28px);
  font-size: clamp(22px, 3.6vw, 28px);
  line-height: var(--leading-tight);
  letter-spacing: -0.025em;
  font-weight: 600;
}

.estimate-q__hint {
  display: block;
  margin-top: 12px;
  font-size: 14.5px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  line-height: 1.6;
}

/* ---------- Option cards ---------- */
.estimate-options {
  display: grid;
  gap: 10px;
}

@media (min-width: 560px) {
  .estimate-options--two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.estimate-option {
  display: block;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--surface);
  padding: 16px 18px;
  transition:
    border-color var(--dur-1) var(--ease),
    background var(--dur-1) var(--ease),
    box-shadow var(--dur-1) var(--ease),
    transform var(--dur-1) var(--ease);
}

.estimate-option:hover {
  border-color: rgb(var(--text-rgb) / 0.18);
  transform: translateY(-1px);
}

.estimate-option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.estimate-option:has(input:checked) {
  border-color: rgb(var(--accent-rgb) / 0.6);
  background: rgb(var(--accent-rgb) / 0.06);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / 0.4);
}

.estimate-option__inner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.estimate-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.estimate-option__radio {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--surface);
  position: relative;
  transition:
    border-color var(--dur-1) var(--ease),
    background var(--dur-1) var(--ease);
}

.estimate-option:has(input:checked) .estimate-option__radio {
  border-color: var(--accent);
  background: var(--accent);
}

.estimate-option:has(input:checked) .estimate-option__radio::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: var(--accent-ink);
}

.estimate-option--checkbox .estimate-option__radio {
  border-radius: 4px;
}

.estimate-option--checkbox:has(input:checked) .estimate-option__radio::after {
  content: "✓";
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: transparent;
  color: var(--accent-ink);
  border-radius: 0;
}

.estimate-option__text {
  flex: 1;
  min-width: 0;
}

.estimate-option__title {
  display: block;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.estimate-option__desc {
  display: block;
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* ---------- Final step: result + form ---------- */
.estimate-result-block {
  margin: 0 0 24px;
  padding: 20px clamp(16px, 3vw, 24px);
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  box-shadow: none;
}

.estimate-result-block__label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.estimate-result-block__range {
  margin: 0;
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.estimate-result-block__note {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

.estimate-contact-grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 540px) {
  .estimate-contact-grid--2 {
    grid-template-columns: 1fr 1fr;
  }
}

.estimate-contact-grid .field {
  margin: 0;
}

/* Stack the form footer inside the wizard so the long fineprint never crowds the CTA */
.estimate-panel .form__footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
}

/* ---------- Step navigation row ---------- */
.estimate-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(20px, 3vw, 28px);
  padding-top: 0;
}

.estimate-nav__left,
.estimate-nav__right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.estimate-nav .btn {
  min-width: 128px;
}

[data-estimate-next]::after {
  content: "→";
  display: inline-block;
  margin-left: 8px;
  transition: transform var(--dur-1) var(--ease);
}

[data-estimate-next]:hover::after {
  transform: translateX(2px);
}

.btn--ghost-muted {
  background: transparent;
  border-color: var(--line);
  color: var(--muted-2);
  opacity: 0.85;
  transition:
    opacity var(--dur-1) var(--ease),
    color var(--dur-1) var(--ease),
    border-color var(--dur-1) var(--ease),
    background var(--dur-1) var(--ease);
}

.btn--ghost-muted:hover {
  background: rgb(var(--text-rgb) / 0.04);
  color: var(--text);
  border-color: rgb(var(--text-rgb) / 0.18);
  opacity: 1;
}

/* ---------- Success (estimate is revealed here, post-submit) ---------- */
.estimate-success {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  padding: clamp(36px, 5vw, 56px) clamp(24px, 4vw, 48px);
  text-align: center;
  box-shadow: var(--shadow-2);
}

.estimate-success__eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.estimate-success__title {
  margin: 0 0 24px;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -0.03em;
  font-weight: 600;
  line-height: var(--leading-tight);
}

.estimate-success__range-block {
  margin: 0 auto 24px;
  max-width: 480px;
  padding: clamp(24px, 4vw, 32px);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  text-align: left;
}

.estimate-success__range-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.estimate-success__range-value {
  margin: 0;
  font-size: clamp(28px, 5.5vw, 40px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.estimate-success__range-note {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

.estimate-success__text {
  margin: 0 auto;
  max-width: 48ch;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.7;
}

.estimate-success__actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ---------- Submit button loading state ---------- */
.btn.is-loading {
  cursor: progress;
  opacity: 0.85;
}

.btn.is-loading .btn__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn.is-loading .btn__label::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: estimateBtnSpin 720ms linear infinite;
  display: inline-block;
}

@keyframes estimateBtnSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn.is-loading .btn__label::before {
    animation-duration: 1800ms;
  }
}

[data-estimate-submit][disabled] {
  pointer-events: none;
}

/* Disabled inputs while the request is in flight */
.field__input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Optional field label hint (e.g. "Phone (optional)") */
.field__label-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted-2);
  margin-left: 4px;
}

/* ---------- Error ---------- */
.estimate-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgb(180 60 50 / 0.08);
  border: 1px solid rgb(180 60 50 / 0.2);
  color: rgb(90 30 25);
  font-size: 14px;
}

/* ---------- A11y helper ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.estimate-success__calc {
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}
.estimate-success__calc summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
