/* ==========================================================================
   Wizard CSS - Modal Styles, Step Transitions, Form Elements
   ========================================================================== */

/* --------------------------------------------------------------------------
   Floating Wizard Button
   -------------------------------------------------------------------------- */
.wizard-fab {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  z-index: var(--z-fixed);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  /* Both ends of the gradient keep white text above 4.5:1 */
  background: linear-gradient(135deg, var(--color-accent-dark), var(--color-accent-text));
  color: var(--color-surface);
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  box-shadow: var(--shadow-xl), 0 0 0 0 rgba(196, 112, 60, 0.4);
  transition: all var(--duration-normal) var(--ease-out);
  animation: pulse-shadow 2s infinite;
}

.wizard-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-xl), 0 8px 25px rgba(196, 112, 60, 0.3);
}

.wizard-fab:active {
  transform: translateY(0) scale(0.98);
}

.wizard-fab__icon {
  width: 20px;
  height: 20px;
}

@keyframes pulse-shadow {
  0%, 100% {
    box-shadow: var(--shadow-xl), 0 0 0 0 rgba(196, 112, 60, 0.4);
  }
  50% {
    box-shadow: var(--shadow-xl), 0 0 0 8px rgba(196, 112, 60, 0);
  }
}

/* Hide FAB when modal is open */
.wizard-modal--open ~ .wizard-fab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* --------------------------------------------------------------------------
   Modal Backdrop & Container
   -------------------------------------------------------------------------- */
.wizard-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  /* Closing: fade first, then hide. Opening (below): visible at once, so focus
     can move into the dialog synchronously instead of after a timer. */
  transition: opacity var(--duration-normal) var(--ease-out),
              visibility 0s linear var(--duration-normal);
}

.wizard-modal--open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--duration-normal) var(--ease-out),
              visibility 0s linear 0s;
}

.wizard-modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(26, 47, 35, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wizard-modal__container {
  position: relative;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  max-height: 90dvh;
  margin: var(--space-6);
  background-color: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  transition: transform var(--duration-slow) var(--ease-spring);
  display: flex;
  flex-direction: column;
}

.wizard-modal--open .wizard-modal__container {
  transform: translateY(0) scale(1);
}

/* --------------------------------------------------------------------------
   Modal Header
   -------------------------------------------------------------------------- */
.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--color-border-light);
  background-color: var(--color-background);
}

.wizard-header__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
}

.wizard-header__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.wizard-header__close:hover {
  background-color: var(--color-background-alt);
  color: var(--color-text);
}

.wizard-header__close svg {
  width: 24px;
  height: 24px;
}

/* --------------------------------------------------------------------------
   Progress Indicator
   -------------------------------------------------------------------------- */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background-color: var(--color-background);
}

.wizard-progress__step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.wizard-progress__dot {
  width: 12px;
  height: 12px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: var(--color-border);
  border: 2px solid var(--color-border);
  cursor: default;
  transition: all var(--duration-normal) var(--ease-out);
}

.wizard-progress__dot--completed {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  cursor: pointer;
}

.wizard-progress__dot--completed:hover {
  box-shadow: 0 0 0 4px rgba(26, 47, 35, 0.15);
}

.wizard-progress__dot--active {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(196, 112, 60, 0.2);
}

.wizard-progress__line {
  width: 40px;
  height: 2px;
  background-color: var(--color-border);
  transition: background-color var(--duration-normal) var(--ease-out);
}

.wizard-progress__line--completed {
  background-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Step Content
   -------------------------------------------------------------------------- */
.wizard-content {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.wizard-step {
  display: none;
  padding: var(--space-8);
  transition: opacity var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.wizard-step--active {
  display: block;
  animation: wizard-step-in var(--duration-normal) var(--ease-out);
}

.wizard-step--exit {
  opacity: 0;
  transform: translateX(-16px);
  transition-duration: var(--duration-fast);
}

@keyframes wizard-step-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.wizard-step__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
  text-align: center;
}

.wizard-step__title:focus,
.wizard-results__title:focus {
  outline: none; /* programmatic focus target for screen readers, not a control */
}

.wizard-step__description {
  font-size: var(--text-base);
  color: var(--color-text-light);
  text-align: center;
  margin-bottom: var(--space-8);
}

/* A pointer out of the wizard, under the answer cards */
.wizard-step__aside {
  margin-top: var(--space-6);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

/* --------------------------------------------------------------------------
   Option Cards Grid
   -------------------------------------------------------------------------- */
.wizard-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.wizard-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6);
  background-color: var(--color-background);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.wizard-option:hover {
  border-color: var(--color-accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.wizard-option--selected,
.wizard-option:has(.wizard-option__input:checked) {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(196, 112, 60, 0.08), rgba(196, 112, 60, 0.02));
  box-shadow: 0 0 0 3px rgba(196, 112, 60, 0.15);
}

.wizard-option:has(.wizard-option__input:focus-visible) {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.wizard-option__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.wizard-option__icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
  color: var(--color-primary);
  transition: color var(--duration-normal) var(--ease-out);
}

.wizard-option--selected .wizard-option__icon,
.wizard-option:has(.wizard-option__input:checked) .wizard-option__icon {
  color: var(--color-accent);
}

.wizard-option__text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wizard-option__label {
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

.wizard-option__hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
}

/* Check mark for selected option */
.wizard-option__check {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 24px;
  height: 24px;
  background-color: var(--color-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: all var(--duration-fast) var(--ease-spring);
}

.wizard-option--selected .wizard-option__check,
.wizard-option:has(.wizard-option__input:checked) .wizard-option__check {
  opacity: 1;
  transform: scale(1);
}

.wizard-option__check svg {
  width: 14px;
  height: 14px;
  color: var(--color-surface);
}

/* --------------------------------------------------------------------------
   Slider Input
   -------------------------------------------------------------------------- */
.wizard-slider {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.wizard-slider__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-4);
}

.wizard-slider__label {
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.wizard-slider__value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
}

.wizard-slider__unit {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-left: var(--space-1);
}

.wizard-slider__track {
  position: relative;
  margin-bottom: var(--space-4);
}

.wizard-slider__input {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--color-accent) 0%, var(--color-accent) var(--slider-progress, 50%), var(--color-border) var(--slider-progress, 50%), var(--color-border) 100%);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.wizard-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  background: var(--color-surface);
  border: 3px solid var(--color-accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.wizard-slider__input::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.wizard-slider__input::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: var(--color-surface);
  border: 3px solid var(--color-accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.wizard-slider__labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Animated visual for slider */
.wizard-slider__visual {
  width: 100%;
  max-width: 300px;
  margin: var(--space-8) auto 0;
}

/* --------------------------------------------------------------------------
   Results Step
   -------------------------------------------------------------------------- */
.wizard-results {
  text-align: center;
}

.wizard-results__header {
  margin-bottom: var(--space-8);
}

.wizard-results__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.wizard-results__subtitle {
  color: var(--color-text-light);
}

.wizard-results__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.wizard-result-card {
  padding: var(--space-5);
  background-color: var(--color-background);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
}

.wizard-result-card__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.wizard-result-card__value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
}

.wizard-result-card__detail {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--space-1);
}

/* Spans the full row at every breakpoint (an inline span-2 created a phantom column on phones) */
.wizard-result-card--wide {
  grid-column: 1 / -1;
}

/* The hidden attribute loses to display:grid without this */
.wizard-result-card__value[hidden] {
  display: none;
}

/* Share/Copy results */
.wizard-results__actions {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

/* --------------------------------------------------------------------------
   Footer Navigation
   -------------------------------------------------------------------------- */
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-8);
  border-top: 1px solid var(--color-border-light);
  background-color: var(--color-background);
}

.wizard-footer__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.wizard-footer__btn--back {
  background: none;
  border: none;
  color: var(--color-text-muted);
}

.wizard-footer__btn--back:hover {
  color: var(--color-text);
}

.wizard-footer__btn--next {
  background-color: var(--color-accent-dark);
  border: none;
  color: var(--color-surface);
}

.wizard-footer__btn--next:hover {
  background-color: var(--color-accent-text);
  transform: translateX(2px);
}

.wizard-footer__btn--next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.wizard-footer__btn svg {
  width: 18px;
  height: 18px;
}

/* Keyboard shortcut hint */
.wizard-footer__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.wizard-footer__hint kbd {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background-color: var(--color-background-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* No keyboard shortcut to advertise on touch screens */
@media (hover: none) {
  .wizard-footer__hint {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .wizard-fab {
    bottom: var(--space-6);
    right: var(--space-6);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
  }

  .wizard-fab__text {
    display: none;
  }

  .wizard-modal__container {
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .wizard-header,
  .wizard-footer {
    padding: var(--space-4) var(--space-5);
    flex-shrink: 0;
  }

  .wizard-progress {
    padding: var(--space-4);
    flex-shrink: 0;
  }

  .wizard-content {
    flex: 1;
    min-height: 0;
    padding: var(--space-4) var(--space-5);
  }

  .wizard-step {
    padding: var(--space-4);
  }

  .wizard-options {
    grid-template-columns: 1fr;
  }

  .wizard-option {
    flex-direction: row;
    padding: var(--space-4);
    gap: var(--space-4);
  }

  .wizard-option__icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .wizard-option__text {
    align-items: flex-start;
    text-align: left;
  }

  .wizard-option__hint {
    text-align: left;
  }

  .wizard-progress__line {
    width: 20px;
  }

  .wizard-footer {
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  .wizard-footer__hint {
    order: 3;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .wizard-step__title {
    font-size: var(--text-xl);
  }

  .wizard-slider__value {
    font-size: var(--text-2xl);
  }
}

@media (max-width: 359px) {
  .wizard-results__grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Fit finder v2: fields, chips, live readout, results, print
   ========================================================================== */

/* Author display rules (grid, flex) would otherwise beat the hidden attribute */
.wizard-modal [hidden] {
  display: none !important;
}

@media (min-width: 769px) {
  .wizard-options--bows {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.wizard-option--disabled,
.wizard-option--disabled:hover {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  border-color: var(--color-border);
}

/* Slider value is an editable number box, so exact values can be typed */
.wizard-slider__readout {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-1);
}

.wizard-slider__number {
  width: 4.6ch;
  padding: 0;
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  text-align: right;
  background: transparent;
  border: 0;
  border-bottom: 2px dashed var(--color-border);
  border-radius: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

.wizard-slider__number::-webkit-outer-spin-button,
.wizard-slider__number::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.wizard-slider__number:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-bottom-color: transparent;
}

.wizard-slider__number[aria-invalid="true"],
.wizard-field__input[aria-invalid="true"] {
  color: #b3261e;
  border-color: #b3261e;
}

.wizard-slider__metric {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* in/cm and lb/kg pickers: as wide as their text, next to the number */
.wizard-field__select.wizard-unit {
  width: auto;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}

/* Plain fields */
.wizard-fields {
  display: grid;
  gap: var(--space-4);
  max-width: 400px;
  margin: var(--space-6) auto 0;
  text-align: left;
}

.wizard-fields--grid {
  max-width: none;
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
}

.wizard-field {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.wizard-field__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.wizard-field__control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.wizard-field__input,
.wizard-field__select {
  width: 100%;
  max-width: 10rem;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.wizard-field__input::placeholder {
  color: var(--color-text-muted);
}

.wizard-field__input:focus-visible,
.wizard-field__select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  border-color: var(--color-accent);
}

.wizard-field__unit {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.wizard-field__help {
  font-size: var(--text-xs);
  color: var(--color-text-light);
}

.wizard-checkline {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
}

.wizard-checkline__input {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  accent-color: var(--color-accent);
}

/* Live "what your bow really pulls" readout */
.wizard-readout {
  max-width: 400px;
  margin: var(--space-6) auto 0;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  text-align: left;
  color: var(--color-text);
  background-color: rgba(196, 112, 60, 0.08);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
}

.wizard-readout:empty {
  display: none;
}

.wizard-readout strong {
  color: var(--color-primary);
}

.wizard-readout__why {
  color: var(--color-text-light);
}

/* Arm-span helper */
.wizard-help {
  max-width: 400px;
  margin: var(--space-6) auto 0;
  font-size: var(--text-sm);
  text-align: left;
}

.wizard-help__summary {
  cursor: pointer;
  font-weight: var(--weight-medium);
  color: var(--color-accent-dark);
}

.wizard-help__body {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
  color: var(--color-text-light);
}

.wizard-help__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
}

.wizard-help__row .wizard-field__input {
  max-width: 7rem;
}

.wizard-help__row .wizard-field__select {
  width: auto;
}

.wizard-help__result {
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.wizard-help__result:empty {
  display: none;
}

/* Setup questions: compact cards in a radiogroup */
.wizard-question {
  max-width: 560px;
  min-width: 0;
  margin: 0 auto var(--space-6);
  padding: 0;
  border: 0;
}

.wizard-question__legend {
  margin-bottom: var(--space-3);
  padding: 0;
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
}

.wizard-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: var(--space-3);
}

.wizard-chip {
  position: relative;
  display: flex;
  padding: var(--space-4);
  text-align: left;
  background-color: var(--color-background);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}

.wizard-chip:hover {
  border-color: var(--color-accent-light);
}

.wizard-chip:has(.wizard-chip__input:checked) {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(196, 112, 60, 0.08), rgba(196, 112, 60, 0.02));
  box-shadow: 0 0 0 3px rgba(196, 112, 60, 0.15);
}

.wizard-chip:has(.wizard-chip__input:focus-visible) {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.wizard-chip__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.wizard-chip__text {
  display: grid;
  gap: var(--space-1);
}

.wizard-chip__label {
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
}

.wizard-chip__hint {
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

/* Results */
.wizard-results__body {
  text-align: left;
}

.wizard-results__error {
  padding: var(--space-5);
  text-align: left;
  color: #4a1410;
  background-color: #fdecea;
  border: 1px solid #f3b7b0;
  border-radius: var(--radius-lg);
}

.wizard-buy {
  margin-bottom: var(--space-6);
  padding: var(--space-6);
  color: var(--color-background);
  background-color: var(--color-primary);
  border-radius: var(--radius-xl);
}

.wizard-buy__title {
  margin-bottom: var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(245, 242, 235, 0.78);
}

.wizard-buy__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.wizard-buy__item {
  display: grid;
  align-content: start;
  gap: var(--space-1);
}

.wizard-buy__material {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent-light);
}

.wizard-buy__answer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
}

.wizard-buy__value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: 1.1;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.wizard-buy__unit {
  color: rgba(245, 242, 235, 0.78);
}

.wizard-buy__detail {
  font-size: var(--text-sm);
  color: rgba(245, 242, 235, 0.92);
}

.wizard-buy__source {
  font-size: var(--text-xs);
  color: rgba(245, 242, 235, 0.72);
}

.wizard-alerts {
  display: grid;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
}

.wizard-alert {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.5;
  border-left: 4px solid;
  border-radius: var(--radius-md);
}

.wizard-alert--danger {
  color: #4a1410;
  background-color: #fdecea;
  border-color: #b3261e;
}

.wizard-alert--caution {
  color: #43290a;
  background-color: #fff4e0;
  border-color: #b26a00;
}

.wizard-alert--info {
  color: var(--color-text);
  background-color: var(--color-background);
  border-color: var(--color-primary-light);
}

.wizard-alert__level {
  font-weight: var(--weight-semibold);
}

.wizard-results__grid {
  grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  margin-bottom: var(--space-6);
}

/* Disclosure panels */
.wizard-panel,
.more {
  margin-bottom: var(--space-3);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
}

.wizard-panel__summary,
.more__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
  list-style: none;
  cursor: pointer;
}

.wizard-panel__summary::-webkit-details-marker,
.more__summary::-webkit-details-marker {
  display: none;
}

.wizard-panel__summary::after,
.more__summary::after {
  content: '';
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: -0.25rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--duration-fast) var(--ease-out);
}

.wizard-panel[open] > .wizard-panel__summary::after,
.more[open] > .more__summary::after {
  margin-top: 0.25rem;
  transform: rotate(225deg);
}

.wizard-panel__summary:focus-visible,
.more__summary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  border-radius: var(--radius-lg);
}

.wizard-panel__body,
.more__body {
  display: grid;
  gap: var(--space-4);
  padding: 0 var(--space-5) var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* The chapters' "More detail" disclosures share the panel style above */
.more {
  margin-top: var(--space-6);
}

/* The grid gap spaces the paragraphs; .content-block__body p would add its own bottom margin */
.more__body p {
  margin-bottom: 0;
}

/* The translate guard wraps names, quantities and "spine" in spans, and a flex container would make
   each one a column. So the chapters' summaries lay out as text, with the chevron placed at the right. */
.more__summary {
  display: block;
  position: relative;
  padding-right: calc(var(--space-5) * 2 + 0.55rem);
}

.more__summary::after {
  position: absolute;
  top: 50%;
  right: var(--space-5);
  margin-top: -0.4rem;
}

.more[open] > .more__summary::after {
  margin-top: -0.15rem;
}

/* Chart comparison */
.wizard-compare__intro,
.wizard-compare__spread {
  color: var(--color-text-light);
}

.wizard-compare__material {
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-primary);
}

.wizard-compare__scroll {
  max-width: 100%;
  overflow-x: auto;
}

.wizard-compare__table {
  width: 100%;
  font-size: var(--text-sm);
  border-collapse: collapse;
}

.wizard-compare__table th,
.wizard-compare__table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border-light);
}

/* A light header: the site-wide thead is dark green, too heavy inside a white panel */
.wizard-compare__table thead {
  background: transparent;
  color: inherit;
}

.wizard-compare__table thead th {
  padding-top: 0;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-light);
  border-bottom: 2px solid var(--color-border);
}

.wizard-compare__table tbody th {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  white-space: normal; /* the site-wide th rule is nowrap; chart names must wrap on phones */
}

.wizard-compare__table a,
.wizard-sources a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.wizard-compare__adjustments {
  margin: var(--space-1) 0 0;
  padding: 0;
  font-size: var(--text-xs);
  color: var(--color-text-light);
  list-style: none;
}

.wizard-compare__note {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-light);
}

/* Phones: each chart becomes a labelled card (ARIA roles keep the table semantics) */
@media (max-width: 560px) {
  .wizard-compare__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .wizard-compare__table,
  .wizard-compare__table tbody,
  .wizard-compare__table tr,
  .wizard-compare__table th,
  .wizard-compare__table td {
    display: block;
    width: 100%;
  }

  .wizard-compare__table tr {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
  }

  .wizard-compare__table th,
  .wizard-compare__table td {
    padding: var(--space-1) 0;
    border: 0;
  }

  .wizard-compare__table td::before {
    content: attr(data-label);
    display: block;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-light);
  }
}

.wizard-fits {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.wizard-fits strong {
  color: var(--color-primary);
}

.wizard-sources {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding-left: var(--space-5);
}

/* Check arrows you already own */
.wizard-check-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.wizard-check-form .wizard-field {
  flex: 1 1 8rem;
}

/* Same height as the fields beside it */
.wizard-check-form .btn {
  min-height: 2.75rem;
}

.wizard-check-result {
  display: grid;
  gap: var(--space-2);
}

.wizard-verdict {
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-background);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-md);
}

.wizard-verdict[data-verdict="ok"] {
  background-color: #edf7ee;
  border-color: #2e7d32;
}

.wizard-verdict[data-verdict="weak"],
.wizard-verdict[data-verdict="stiff"] {
  background-color: #fff4e0;
  border-color: #b26a00;
}

.wizard-check-fixes {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding-left: var(--space-5);
}

.wizard-results__note {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

.wizard-results__actions {
  flex-wrap: wrap;
}

.wizard-share {
  display: grid;
  gap: var(--space-1);
  max-width: 520px;
  margin: var(--space-4) auto 0;
  text-align: left;
}

.wizard-share .wizard-field__input {
  max-width: none;
}

/* Print: only the spec, in paper-friendly colors */
@media print {
  body.wizard-is-open > *:not(.wizard-modal) {
    display: none !important;
  }

  body.wizard-is-open {
    overflow: visible !important;
    background: #ffffff;
  }

  .wizard-modal {
    position: static;
    display: block;
    opacity: 1;
    visibility: visible;
  }

  .wizard-modal__backdrop,
  .wizard-header__close,
  .wizard-progress,
  .wizard-footer,
  .wizard-results__actions,
  .wizard-share,
  .wizard-panel[data-tune],
  .wizard-panel[data-check],
  .wizard-panel__summary::after {
    display: none !important;
  }

  .wizard-modal__container {
    max-width: none;
    max-height: none;
    margin: 0;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .wizard-content {
    overflow: visible;
  }

  .wizard-step:not(.wizard-step--active) {
    display: none !important;
  }

  .wizard-step--active {
    padding: 0;
    animation: none;
  }

  .wizard-buy {
    color: #000000;
    background: none;
    border: 2px solid #000000;
  }

  .wizard-buy__title,
  .wizard-buy__material,
  .wizard-buy__value,
  .wizard-buy__unit,
  .wizard-buy__detail,
  .wizard-buy__source {
    color: #000000;
  }

  .wizard-buy__item,
  .wizard-result-card,
  .wizard-alert,
  .wizard-compare__block {
    break-inside: avoid;
  }
}
