/* ============================================================================
   DCC v2 — Wizard core styles (desktop-first, tokens-only)
   ----------------------------------------------------------------------------
   Imports root tokens + fonts (no duplication).
   Non-negotiable rules honoured:
     - Semantic HTML, flexbox only, no absolute positioning, no z-index stacking
       beyond the native <dialog> backdrop
     - WCAG AAA contrast (7:1) via tokens
     - 44px minimum touch targets (uses --tap-target-min from root tokens)
     - 16px minimum body text, 24px+ headings
     - No hover-only states (focus + click parity)
     - Self-hosted Merriweather + Source Sans 3 via css/fonts.css
     - No external CDNs, no Google Fonts
   ========================================================================== */

@import url('../../css/tokens.css');
@import url('../../css/fonts.css');

html.wizard {
  height: 100%;
}

body.wizard {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
}

/* --- Top bar (always visible) ---------------------------------------------- */

.wizard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  min-height: var(--nav-height);
  flex: 0 0 auto;
}

.wizard-topbar-left,
.wizard-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.wizard-progress {
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-wide);
}

.wizard-mapbtn,
.wizard-helpbtn,
.wizard-langbtn {
  min-width: var(--tap-target);
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wizard-helpbtn {
  width: var(--tap-target);
  height: var(--tap-target);
  padding: 0;
  border-radius: var(--radius-circle);
  font-size: 24px;
  font-weight: var(--font-weight-bold);
}

.wizard-mapbtn:hover,
.wizard-mapbtn:focus-visible,
.wizard-helpbtn:hover,
.wizard-helpbtn:focus-visible,
.wizard-langbtn:hover,
.wizard-langbtn:focus-visible {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.wizard-mapbtn:focus-visible,
.wizard-helpbtn:focus-visible,
.wizard-langbtn:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* --- Main stage + card ----------------------------------------------------- */

.wizard-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.wizard-card {
  width: 100%;
  max-width: 680px;
  min-height: min(560px, calc(100dvh - var(--nav-height) - 2 * var(--space-6)));
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  padding: var(--space-8);
  gap: var(--space-6);
}

/* --- Card body (step content) ---------------------------------------------- */

.wizard-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.wizard-body h1 {
  font-family: var(--font-heading);
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-primary);
  margin: 0;
}

.wizard-body p {
  margin: 0;
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
}

.wizard-body p strong {
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
}

/* Orientation-screen specific (screen 1) */
.wizard-body .wizard-reassurance {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}

.wizard-body .wizard-goal {
  font-style: italic;
  color: var(--color-text-light);
}

.wizard-body .wizard-time-estimate {
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  letter-spacing: var(--letter-spacing-wide);
}

/* Tell-me-more (details/summary) */
.wizard-body details {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.wizard-body details summary {
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  min-height: var(--tap-target-min);
  display: inline-flex;
  align-items: center;
  list-style: none;
  padding: var(--space-2) 0;
}

.wizard-body details summary::-webkit-details-marker {
  display: none;
}

.wizard-body details summary::before {
  content: '▸';
  display: inline-block;
  margin-right: var(--space-2);
  transition: transform var(--motion-duration-2) var(--motion-ease);
}

.wizard-body details[open] summary::before {
  transform: rotate(90deg);
}

.wizard-body details summary:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

.wizard-body details > *:not(summary) {
  margin-top: var(--space-3);
}

/* --- Summary-screen specific (last screen) --------------------------------- */

.wizard-summary-takeaways {
  margin: 0;
  padding-left: var(--space-5);
}

.wizard-summary-takeaways li {
  margin-bottom: var(--space-3);
  line-height: var(--line-height-body);
}

.wizard-summary-confidence {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  padding: var(--space-4);
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
}

.wizard-cert-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-weight: var(--font-weight-medium);
}

.wizard-cert-input {
  min-height: var(--tap-target);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}

.wizard-cert-input:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-color: var(--color-primary);
}

/* --- Footer buttons (Back / Continue) -------------------------------------- */

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex: 0 0 auto;
}

.wizard-footer[data-align='end'] {
  justify-content: flex-end;
}

.wizard-btn {
  min-height: var(--tap-target);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wizard-btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-border-strong);
}

.wizard-btn-ghost:hover,
.wizard-btn-ghost:focus-visible {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.wizard-btn-primary {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
}

.wizard-btn-primary:hover,
.wizard-btn-primary:focus-visible {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.wizard-btn:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

.wizard-btn:disabled,
.wizard-btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hidden step */
.wizard-step[hidden] {
  display: none;
}

/* --- Dialogs (map + help) -------------------------------------------------- */

.wizard-dialog {
  border: none;
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  max-width: min(560px, calc(100% - 2 * var(--space-4)));
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.wizard-dialog::backdrop {
  background: rgba(61, 50, 41, 0.5);
}

.wizard-dialog-inner {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  gap: var(--space-4);
  max-height: 80vh;
  overflow: auto;
}

.wizard-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.wizard-dialog-header h2 {
  font-family: var(--font-heading);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin: 0;
}

.wizard-dialog-close {
  min-width: var(--tap-target);
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
}

.wizard-dialog-close:hover,
.wizard-dialog-close:focus-visible {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.wizard-dialog-close:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* Module-map dialog step list */
.wizard-map-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wizard-map-item {
  display: block;
}

.wizard-map-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--tap-target);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  text-align: left;
  cursor: pointer;
}

.wizard-map-link[aria-current='step'] {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.wizard-map-link:hover,
.wizard-map-link:focus-visible {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.wizard-map-link:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

.wizard-map-number {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  min-width: 32px;
}
