/* ==========================================================================
   estimator.css — WordPress Project Scope Estimator (post 1700).
   Loaded only on /tools/wordpress-project-scope-estimator/.
   Tokens from tokens.css; one new component token --fs-price added there.
   No new colours, no off-grid spacing, no rounded corners (--radius-sm: 0).
   ========================================================================== */

.estimator-lede {
  font-size: clamp( 1.05rem, 0.95rem + 0.4vw, 1.2rem );
  max-width: 60ch;
}

.estimator-wrapper {
  margin-block-start: 2rem;
  max-width: var( --container );
}

.estimator-nojs-notice {
  border-left: 4px solid var( --color-teal );
  background: var( --color-teal-soft );
  padding: 1rem 1.25rem;
  margin-block-end: 1.5rem;
  font-size: 0.95rem;
}

/* Progress strip --------------------------------------------------------- */
.estimator-progress {
  display: flex;
  gap: 0.75rem;
  margin-block-end: 1.5rem;
  align-items: center;
}
.estimator-progress__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var( --color-border );
  flex: 0 0 8px;
}
.estimator-progress__dot.is-complete {
  background: var( --color-border-strong );
}
.estimator-progress__dot.is-active {
  background: var( --color-accent );
  width: 24px;
  flex-basis: 24px;
}

/* Form panel ------------------------------------------------------------- */
.estimator-form-panel {
  background: var( --color-surface );
  border: 1px solid var( --color-border );
  padding: 1.5rem;
  max-width: 720px;
  container-type: inline-size;
}
@media ( max-width: 600px ) {
  .estimator-form-panel {
    padding: 1rem;
  }
}

.estimator-question {
  display: none;
}
.estimator-question.is-active {
  display: block;
}

.estimator-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
.estimator-legend {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: var( --fs-h3 );
  color: var( --color-text );
  padding: 0;
  margin-block-end: 1rem;
  display: block;
  width: 100%;
  outline: none;
  /* Sticky-header offset — when JS focuses the legend on question
     advance, the native scroll lands the legend behind the 84px
     sticky header otherwise (mobile audit RISK 3, 2026-05-03). */
  scroll-margin-top: 96px;
}
.estimator-legend:focus-visible {
  outline: 2px solid var( --color-teal );
  outline-offset: 2px;
}
.estimator-field-hint {
  color: var( --color-muted );
  font-size: 0.875rem;
  margin-block-end: 1rem;
}

/* Option cards (radio) --------------------------------------------------- */
.estimator-option-grid {
  display: grid;
  grid-template-columns: repeat( auto-fit, minmax( 240px, 1fr ) );
  gap: 0.5rem;
}
/* Container query: collapse to 1 col only when the form panel itself
   is below 520px — keeps 2 cols at 768px viewport where the 720px
   panel has room for both. Falls back gracefully in browsers without
   container query support (auto-fit minmax handles it reasonably). */
@container ( max-width: 520px ) {
  .estimator-option-grid {
    grid-template-columns: 1fr;
  }
}
/* Keep the media-query fallback for browsers without container queries
   (Chrome < 105, Firefox < 110, Safari < 16). At 600px viewport the
   panel is narrow enough that 1 col is always correct. */
@media ( max-width: 600px ) {
  .estimator-option-grid {
    grid-template-columns: 1fr;
  }
}
.estimator-option-card {
  position: relative;
  display: block;
  border: 1px solid var( --color-border );
  background: var( --color-surface );
  padding: 0.875rem 1rem;
  min-block-size: 64px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.estimator-option-card:hover {
  border-color: var( --color-border-strong );
}
.estimator-option-card:focus-within {
  outline: 2px solid var( --color-teal );
  outline-offset: 2px;
}
.estimator-option-card input[type="radio"],
.estimator-option-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.estimator-option-card__label {
  display: block;
  font-weight: 600;
  color: var( --color-text );
}
.estimator-option-card__desc {
  display: block;
  font-size: 0.875rem;
  color: var( --color-text-medium );
  margin-block-start: 0.25rem;
}
.estimator-option-card:has( input:checked ),
.estimator-option-card input:checked + .estimator-option-card__label {
  /* :has() variant covers modern browsers; fallback below */
}
.estimator-option-card:has( input:checked ) {
  /* outline takes zero layout space — no border-width change, no padding
     compensation, no sub-pixel jitter at 1.25x / 1.5x / 2x display densities. */
  outline: 2px solid var( --color-accent );
  outline-offset: -2px;
  background: var( --color-accent-soft );
}
.estimator-option-card:has( input:checked )::after {
  content: "✓";
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-weight: 700;
  color: var( --color-accent );
}

/* Multi-select chips ----------------------------------------------------- */
.estimator-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.estimator-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var( --color-border-strong );
  background: var( --color-surface );
  color: var( --color-text );
  padding: 0.625rem 0.875rem;
  min-block-size: 44px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.2;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.estimator-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.estimator-chip:hover {
  border-color: var( --color-accent );
}
.estimator-chip:focus-within {
  outline: 2px solid var( --color-teal );
  outline-offset: 2px;
}
.estimator-chip:has( input:checked ) {
  background: var( --color-accent );
  color: #fff;
  border-color: var( --color-accent );
}

/* Navigation ------------------------------------------------------------- */
.estimator-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-block-start: 1.5rem;
}
.estimator-nav .button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.estimator-nav__back {
  margin-inline-end: auto;
}
.estimator-error {
  border-left: 4px solid var( --color-teal );
  background: var( --color-teal-soft );
  padding: 0.75rem 1rem;
  margin-block-start: 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Calculating animation -------------------------------------------------- */
@media ( prefers-reduced-motion: no-preference ) {
  .estimator-calculating::after {
    content: "";
    display: inline-block;
    width: 1.5em;
    text-align: left;
    animation: estimator-ellipsis 1.2s steps( 4, end ) infinite;
  }
  @keyframes estimator-ellipsis {
    0%   { content: ""; }
    25%  { content: "."; }
    50%  { content: ".."; }
    75%  { content: "..."; }
    100% { content: ""; }
  }
}

/* Result panel ----------------------------------------------------------- */
.estimator-result {
  background: var( --color-surface-alt );
  padding: 1.5rem;
  border-top: 3px solid var( --color-border-strong );
  max-width: 720px;
  margin-block-start: 2rem;
  outline: none;
}
.estimator-result:focus-visible {
  outline: 2px solid var( --color-teal );
  outline-offset: 2px;
}
@media ( max-width: 600px ) {
  .estimator-result {
    padding: 1rem;
  }
}

.estimator-result--tier-A { border-top-color: var( --color-border-strong ); }
.estimator-result--tier-B { border-top-color: var( --color-accent ); }
.estimator-result--tier-C { border-top-color: var( --color-gold ); }
.estimator-result--tier-D { border-top-color: var( --color-teal ); }

/* Tier label — owned by the estimator component (decoupled from
   .cpt-hero__eyebrow per #347 to avoid cross-component breakage if
   the CPT hero eyebrow ever drifts). Visual output mirrors the
   eyebrow rule in main.css line 297. */
.estimator-result__tier-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba( 18, 52, 86, 0.1 );
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  color: var( --color-accent );
  background: var( --color-accent-soft );
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}
.estimator-result--tier-C .estimator-result__tier-label {
  background: var( --color-gold-soft );
}
.estimator-result--tier-D .estimator-result__tier-label {
  background: var( --color-teal-soft );
  color: var( --color-teal );
}

.estimator-result__price {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: var( --fs-price );
  color: var( --color-text-strong );
  margin: 0.5rem 0;
  line-height: 1.1;
}
.estimator-result__timeline {
  /* Elevated from footnote to data-point — visually paired with the price
     figure. Gov/edu procurement buyers scan for timeline on first pass;
     treating it as body text buries a major trust signal.
     font-heading stack keeps it in family with .estimator-result__price
     (Sora) while the 600 weight signals data, not prose. */
  font-family: var( --font-heading );
  font-weight: 600;
  font-size: 1rem;
  color: var( --color-text );
  margin: 0.25rem 0 1rem;
}
.estimator-result__no-price {
  color: var( --color-muted );
  font-size: 1rem;
  margin: 0.5rem 0 1rem;
}
.estimator-result__summary {
  font-size: 1rem;
  color: var( --color-text-medium );
  margin-block-end: 1.25rem;
  max-width: 60ch;
}
.estimator-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-end: 1rem;
}
@media ( max-width: 600px ) {
  .estimator-result__actions .button {
    width: 100%;
  }
}
.estimator-result__servicelink {
  margin-block-start: 0.5rem;
}
.estimator-result__servicelink a {
  /* Inline link inside <small> renders ~20px tall by default — below the
     44px floor and the WCAG 2.5.8 24px minimum. Padding-block + inline-block
     pushes it to the floor without disturbing the surrounding flow
     (mobile audit STOPPER, 2026-05-03). */
  display: inline-block;
  padding-block: 0.75rem;
  min-block-size: 44px;
}
.estimator-result__callout {
  margin-block-start: 1rem;
  border-left: 4px solid var( --color-teal );
  background: var( --color-teal-soft );
  padding: 0.75rem 1rem;
}
.estimator-result__startover {
  margin-block-start: 1.25rem;
  font-size: 0.9rem;
}
.estimator-result__startover a {
  display: inline-block;
  padding-block: 0.75rem;
  min-block-size: 44px;
  color: var( --color-text-medium );
}

/* EEAT block ------------------------------------------------------------- */
.estimator-eeat {
  margin-block-start: 2rem;
  max-width: 60ch;
}

/* No-JS fallback --------------------------------------------------------- */
.no-js .estimator-question { display: block; }
.no-js .estimator-question + .estimator-question { margin-block-start: 1.5rem; }
.no-js .estimator-progress,
.no-js .estimator-nav__next,
.no-js .estimator-nav__back { display: none; }
.no-js .estimator-nav__calculate { display: inline-block !important; }
