/* ==========================================================================
   Price Inquiry — multi-step wizard enhancement
   Progressive enhancement only: everything here is scoped so that without
   the companion JS (price-inquiry-wizard.js) the form renders as a normal,
   single-column, fully visible, fully usable long-form page. Step hiding is
   applied purely via the `hidden` attribute set by JS — never by CSS alone.

   Draws entirely on the shared tokens from variables.css — no local token
   layer, so a single design-system change propagates here too.
   ========================================================================== */

/* ----------------------------
   Container width
   640px is a deliberately narrow, form-specific measure — not part of the
   shared content-width scale, which is sized for page-level layout.
---------------------------- */
.form-card,
#quote-wrapper {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* Extra presence for the quote form's own card — a thin earth-green top
   edge and a touch more lift than the sitewide .form-card default, kept
   scoped to this page so the plain contact form is untouched. */
.quote-page .form-card {
  border-top: 3px solid var(--color-primary);
  box-shadow: var(--shadow-md);
}

/* ----------------------------
   Header
---------------------------- */
.quote-page .form-page__intro{
  color: var(--color-dark);
  margin: 0 auto;
}

/* ----------------------------
   Restore notice
   Shown only when a saved draft was found and restored on load. Understated
   card styling (card bg + a single accent edge) rather than a loud banner.
---------------------------- */
.wizard-restore {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
}

@media (prefers-reduced-motion: no-preference) {
  .wizard-restore {
    animation: wizard-restore-in var(--duration-base) var(--ease-entrance) both;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-restore {
    animation: wizard-restore-in-reduced var(--duration-fast) ease-out both;
  }
}

@keyframes wizard-restore-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes wizard-restore-in-reduced {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wizard-restore__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-lg);
}

/* `display: flex` above has equal specificity to the UA [hidden] rule but
   wins on author-vs-user-agent cascade origin, so the hidden attribute
   needs an explicit reassertion here or toggling `hidden` silently stops
   hiding this element. */
.wizard-restore__row[hidden] {
  display: none;
}

.wizard-restore__message {
  margin: 0;
  max-width: 46ch;
  color: var(--primary-text);
  font-size: var(--text-body-sm);
}

.wizard-restore__link {
  flex: 0 0 auto;
  border: none;
  background: none;
  padding: var(--space-3xs) 0;
  color: var(--color-primary);
  font-size: var(--text-body-sm);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: var(--transition-hover);
}

.wizard-restore__link:hover {
  color: var(--color-dark);
}

.wizard-restore__link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.wizard-restore__confirm-text {
  margin: 0 0 var(--space-sm);
  color: var(--primary-text);
  font-size: var(--text-body-sm);
  font-weight: 600;
}

.wizard-restore__confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.wizard-restore__btn {
  min-height: 40px;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  font-size: var(--text-body-sm);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-hover);
}

.wizard-restore__btn--cancel {
  border: 1px solid var(--color-border);
  background: var(--color-ivory);
  color: var(--primary-text);
}

.wizard-restore__btn--cancel:hover {
  background: var(--color-white-rock);
}

.wizard-restore__btn--danger {
  border: 1px solid var(--color-dark-red);
  background: transparent;
  color: var(--color-dark-red);
}

.wizard-restore__btn--danger:hover {
  background: var(--color-dark-red);
  color: var(--color-ivory);
}

.wizard-restore__btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ----------------------------
   Progress indicator
---------------------------- */
.wizard-progress {
  margin-bottom: var(--space-lg);
}

/* Step dots — a purely decorative, supplementary view of progress; the
   accessible state (role=status/aria-live on the parent) is announced via
   the text label below, so this row is aria-hidden to avoid double
   announcements. */
.wizard-progress__steps {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.wizard-progress__step {
  flex: 1 1 0;
  display: flex;
  align-items: center;
}

.wizard-progress__step:not(:first-child)::before {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  margin-right: var(--space-xs);
  background: var(--color-border);
  transition: background-color var(--duration-base) var(--ease-standard);
}

.wizard-progress__step.is-complete::before,
.wizard-progress__step.is-active::before {
  background: var(--color-accent);
}

.wizard-progress__step-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-bandicoot);
  font-size: var(--text-caption);
  font-weight: 700;
  transition: var(--transition-hover), transform var(--duration-fast) var(--ease-standard);
}

.wizard-progress__step:last-child .wizard-progress__step-num {
  margin-right: 0;
}

.wizard-progress__step.is-active .wizard-progress__step-num {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-ivory);
  transform: scale(1.1);
}

.wizard-progress__step.is-complete .wizard-progress__step-num {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-ivory);
}

@media (max-width: 480px) {
  .wizard-progress__step-num {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }
}

.wizard-progress__label {
  display: block;
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--color-olive);
  margin-bottom: var(--space-xs);
}

.wizard-progress__track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
}

.wizard-progress__bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  transition: width var(--duration-base) var(--ease-standard);
}

/* ----------------------------
   Step / fieldset presentation
---------------------------- */
.form-wrapper fieldset.form-section.wizard-step {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

.form-wrapper fieldset.form-section.wizard-step > legend {
  font-family: var(--font-body);
  font-size: var(--text-eyebrow);
  font-weight: 800;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-bandicoot);
  padding: 0 0 var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  width: 100%;
}

.form-wrapper fieldset.form-section.wizard-step .form-field {
  margin-bottom: var(--space-lg);
}

.form-wrapper fieldset.form-section.wizard-step .form-field:last-child {
  margin-bottom: 0;
}

/* ----------------------------
   Two-column row grouping
   JS wraps paired fields in a `.wizard-row` grid container.
---------------------------- */
.wizard-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.wizard-row > .form-field {
  margin-bottom: 0 !important;
}

@media (min-width: 768px) {
  .wizard-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ----------------------------
   Inputs — consistent radius/focus
---------------------------- */
.form-wrapper input,
.form-wrapper select,
.form-wrapper textarea {
  border-radius: var(--radius);
  transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}

.form-wrapper textarea {
  min-height: 110px;
}

.form-wrapper input:hover,
.form-wrapper select:hover,
.form-wrapper textarea:hover {
  border-color: var(--color-accent);
}

.form-wrapper input:focus-visible,
.form-wrapper select:focus-visible,
.form-wrapper textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-color: var(--color-primary);
}

/* ----------------------------
   Inline validation state
   Layered on top of the browser's native validation bubble (triggered by
   validateStep()/reportValidity() in JS), since the bubble disappears as
   soon as the visitor clicks elsewhere. Uses a border accent, a label-level
   warning glyph and color together, so state is never conveyed by color
   alone.
---------------------------- */
.wizard-step .form-field.wizard-field-invalid {
  padding-left: var(--space-sm);
  border-left: 3px solid var(--color-dark-red);
}

.wizard-step .wizard-field-invalid .form-label {
  color: var(--color-dark-red);
}

.wizard-step .wizard-field-invalid .form-label::after {
  content: "⚠";
  margin-left: var(--space-xs);
}

.wizard-step .wizard-field-invalid input,
.wizard-step .wizard-field-invalid select,
.wizard-step .wizard-field-invalid textarea {
  border-color: var(--color-dark-red);
}

/* ----------------------------
   Conditional fields
   Rainbow Bar (gated on step-2 headcount) and the "Other" detail fields
   are hidden/shown by JS via the plain `hidden` attribute — see
   bindConditionalField() in quote-wizard.js. The reveal echoes the restore
   notice's entrance so appearing doesn't feel like an abrupt layout jump.
---------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .wizard-conditional-field:not([hidden]) {
    animation: wizard-restore-in var(--duration-base) var(--ease-entrance) both;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-conditional-field:not([hidden]) {
    animation: wizard-restore-in-reduced var(--duration-fast) ease-out both;
  }
}

/* Rainbow Bar intro copy — a "display" field, so it renders whatever
   markup is in the blueprint's `content:` directly. */
.rainbow-bar-intro {
  background: var(--color-chick);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.rainbow-bar-intro strong {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-dark);
  font-size: var(--text-body-lg);
}

.rainbow-bar-intro p {
  margin: 0 0 var(--space-xs);
  max-width: none;
  color: var(--primary-text);
  font-size: var(--text-body-sm);
}

.rainbow-bar-intro p:last-child {
  margin-bottom: 0;
}

/* ----------------------------
   Segmented radio buttons
---------------------------- */
.form-wrapper [data-grav-field="radio"] {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.form-wrapper [data-grav-field="radio"] .radio {
  flex: 1 1 auto;
  min-width: 5.5rem;
  margin: 0;
}

.form-wrapper [data-grav-field="radio"] .radio input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.form-wrapper [data-grav-field="radio"] .radio label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  width: 100%;
  margin: 0;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-ivory);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-hover);
}

.form-wrapper [data-grav-field="radio"] .radio label:hover {
  border-color: var(--color-accent);
  background: var(--color-card);
}

.form-wrapper [data-grav-field="radio"] .radio input[type="radio"]:checked + label {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-ivory);
}

.form-wrapper [data-grav-field="radio"] .radio input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .form-wrapper [data-grav-field="radio"] .radio {
    min-width: 45%;
  }
}

/* ----------------------------
   Chip-style checkboxes (amenities / av_equipment)
---------------------------- */
.form-wrapper .checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.form-wrapper .checkboxes input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.form-wrapper .checkboxes label {
  display: inline-flex !important;
  align-items: center;
  min-height: 40px;
  margin: 0 !important;
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-ivory);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-hover);
}

.form-wrapper .checkboxes label:hover {
  border-color: var(--color-accent);
  background: var(--color-card);
}

.form-wrapper .checkboxes input[type="checkbox"]:checked + label {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-ivory);
}

.form-wrapper .checkboxes input[type="checkbox"]:focus-visible + label {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ----------------------------
   Help popover
---------------------------- */
.field-label-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  position: relative;
}

.help-trigger {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-ivory);
  color: var(--color-olive);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-hover);
}

.help-trigger:hover,
.help-trigger[aria-expanded="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-ivory);
}

.help-trigger:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.help-popover {
  position: absolute;
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: 260px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-ivory);
  color: var(--color-dark);
  font-size: var(--text-caption);
  font-weight: 400;
  line-height: var(--leading-snug);
  box-shadow: var(--shadow-md);
}

.help-popover.is-below {
  top: calc(100% + var(--space-xs));
}

.help-popover.is-above {
  bottom: calc(100% + var(--space-xs));
}

/* ----------------------------
   Wizard nav (Back / Continue)
---------------------------- */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.wizard-nav__spacer {
  flex: 1 1 auto;
}

.wizard-nav button {
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius);
  font-size: var(--text-button);
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition-hover);
}

.wizard-nav__continue {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-ivory);
  margin-left: auto;
}

.wizard-nav__continue:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.wizard-nav__back {
  background: transparent;
  border-color: var(--color-border);
  color: var(--primary-text);
}

.wizard-nav__back:hover {
  background: var(--color-card);
  border-color: var(--color-accent);
}

.wizard-nav button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* The submit button on the final step is Grav's own `.button` (shared
   sitewide via style.css). Scoped to #quote-wrapper (unique to this form)
   so the plain contact form's submit button is unaffected. */
#quote-wrapper .buttons .button {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

#quote-wrapper .buttons .button:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

@media (max-width: 480px) {
  .wizard-nav {
    gap: var(--space-sm);
  }

  .wizard-nav button {
    padding: var(--space-sm) var(--space-md);
  }
}
