/* HTML 'hidden' attribute should always hide; Paul's .btn / .builder-nav set
 * display:inline-flex / flex which would otherwise override it. */
[hidden] { display: none !important; }

/* PaulTheDesigner Suit Configurator Wizard — additive styles.
 *
 * Inherits Paul's site palette (--ink, --bg, --muted, --border, --accent),
 * typography, .btn, .field, .measurements-grid, .preview-card, .summary-card,
 * and .builder-* layout from styles.css. This file ONLY adds wizard-specific
 * pieces: canvas preview wrap, fabric grid, skip/error banners, thanks screen.
 */

/* --- Live preview canvas inside the .preview-card --- */
.wizard-canvas-wrap {
  position: relative;
  background: #ffffff;       /* matches the in-canvas white background that compositor paints over the photo's black */
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* While assets are loading, hide the canvas and show a centered spinner.
 * Pseudo-element spinner — no animation libraries. Monochrome to match Paul's
 * site aesthetic. Wizard.js toggles the .is-loading class around any async
 * pose/fabric fetch in render(). */
.wizard-canvas-wrap #stage { transition: opacity .18s ease; }
.wizard-canvas-wrap.is-loading #stage { opacity: 0; }
.wizard-canvas-wrap.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid #e2e2e2;
  border-top-color: #111;
  border-radius: 50%;
  animation: wizard-spin 0.8s linear infinite;
  pointer-events: none;
}
@keyframes wizard-spin {
  to { transform: rotate(360deg); }
}
#stage {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.wizard-canvas-status {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.72);
  color: #fff;
  padding: .35rem .85rem;
  border-radius: 999px;
  font-size: .8rem;
  pointer-events: none;
  transition: opacity 150ms;
}

/* --- Step body container --- */
.wizard-step-body { min-height: 360px; }
.wizard-step-body h2 { font-size: 1.5rem; margin: 0 0 .5rem; }
.wizard-step-body h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* --- Per-slot section (e.g. "Jacket fabric", "Lining") --- */
.wizard-slot { margin-bottom: 1.75rem; }
.wizard-slot:last-child { margin-bottom: 0; }

/* --- Fabric grid (3 columns of clean swatches) --- */
.wizard-fabric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
}
.wizard-fabric-tile {
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .12s, transform .05s, box-shadow .12s;
  font: inherit;
  color: inherit;
  text-align: left;
}
.wizard-fabric-tile:hover {
  border-color: #777;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.wizard-fabric-tile.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink) inset, 0 6px 18px rgba(0,0,0,0.08);
}
.wizard-fabric-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  background-color: #ececec;
}
.wizard-fabric-label {
  padding: .55rem .7rem;
  font-size: .85rem;
  text-align: center;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

/* --- Skipped state banner --- */
.wizard-skipped-banner {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: .9rem;
}
.wizard-skipped-banner strong { color: var(--ink); display: block; margin-bottom: .35rem; }

/* --- Radio row inside the contact form --- */
.wizard-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .9rem;
  margin-top: .25rem;
}
.wizard-radio-row label { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }

/* --- Submit error --- */
.wizard-error {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: #fff5f5;
  border: 1px solid #f0c0c0;
  border-radius: 8px;
  color: #8a2222;
  font-size: .9rem;
}

/* --- Thank-you screen --- */
.wizard-thanks {
  background: var(--bg-alt);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  text-align: center;
}
.wizard-thanks h2 { margin: 0 0 .5rem; font-size: 1.75rem; }
.wizard-thanks .builder-small { color: var(--muted); }

/* --- Builder controls pane (right column) --- */
.builder-controls-pane { display: flex; flex-direction: column; }

/* Step tracker on the wizard renders inside builder-hero, slightly tighter */
#wizard-step-tracker { margin-top: 1rem; }
#wizard-step-tracker li { font-size: .8rem; padding: .35rem .8rem; }

/* Clickable step tracker — visited steps act as buttons; future steps are dimmed */
.step-tracker li.is-completed {
  cursor: pointer;
  user-select: none;
  transition: background .12s, transform .05s;
}
.step-tracker li.is-completed:hover {
  background: #2a2a2a;
  transform: translateY(-1px);
}
.step-tracker li.is-completed:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.step-tracker li.is-future {
  color: #b0b0b0;
  background: transparent;
  cursor: not-allowed;
  opacity: .55;
}

/* Subtle "Start over" link below the step tracker */
.wizard-reset-line {
  margin: .5rem 0 0;
  text-align: right;
}
.wizard-reset-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: .8rem;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  letter-spacing: .02em;
}
.wizard-reset-link:hover { color: var(--ink); }

/* Thank-you action row — primary "build another" + secondary "back home" side by side */
.wizard-thanks-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

/* --- Top navigation row (mirrors the bottom nav, sits above the fabric grid) --- */
.wizard-nav-top {
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* --- Mobile (≤900px): collapse grid AND reorder so fabrics + nav land above the preview --- */
@media (max-width: 900px) {
  .builder-grid {
    display: flex !important;
    flex-direction: column;
    gap: 1.25rem;
  }
  /* controls (top-nav, fabric grids, bottom-nav, thanks) come first */
  .builder-controls-pane { order: 1; }
  /* preview + summary follow */
  .builder-preview       { order: 2; }

  .wizard-canvas-wrap { aspect-ratio: 3 / 4; max-height: 520px; }
  .wizard-fabric-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}
@media (max-width: 720px) {
  .wizard-step-body h2 { font-size: 1.25rem; }
  .wizard-fabric-grid { grid-template-columns: repeat(2, 1fr); }
}
