/**
 * Build-your-agent wizard. Structure and behaviour only.
 *
 * Every colour here comes from a custom property the host site defines, so the
 * two debt sites can look nothing like each other while sharing the mechanism.
 * Nothing in this file hardcodes a hue.
 */

/* The hidden attribute has to beat any display rule the host site puts on a
   button. Without this the wizard's Back button shows on step one, because
   .btn { display: inline-block } outranks the browser default for [hidden]. */
[hidden] { display: none !important; }

.wz {
  display: grid;
  gap: clamp(24px, 4vw, 56px);
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 940px) {
  .wz { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ progress */

.wz-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 22px;
  list-style: none;
}

.wz-dot {
  appearance: none;
  border: 1px solid var(--wz-rule);
  background: transparent;
  color: var(--wz-ink-soft);
  font: inherit;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}

.wz-dot[data-state="now"] {
  background: var(--wz-accent);
  border-color: var(--wz-accent);
  color: var(--wz-on-accent);
}

.wz-dot[data-state="done"] {
  border-color: var(--wz-accent);
  color: var(--wz-accent);
}

.wz-dot:hover { border-color: var(--wz-accent); }
.wz-dot:focus-visible { outline: 2px solid var(--wz-accent); outline-offset: 3px; }

/* --------------------------------------------------------------------- panel */

.wz-panel { animation: wz-in .42s cubic-bezier(.2, .7, .3, 1) both; }
.wz-panel[hidden] { display: none; }

@keyframes wz-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.wz-panel h3 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.15;
}

.wz-panel h3:focus-visible { outline: 2px solid var(--wz-accent); outline-offset: 6px; }

.wz-help {
  margin: 0 0 22px;
  color: var(--wz-ink-soft);
  max-width: 54ch;
}

.wz-field { display: grid; gap: 7px; margin-bottom: 18px; }

.wz-field > span {
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--wz-ink-soft);
}

.wz-field input[type="text"],
.wz-field input[type="email"],
.wz-field input[type="tel"] {
  font: inherit;
  color: var(--wz-ink);
  background: var(--wz-input);
  border: 1px solid var(--wz-rule);
  padding: 13px 15px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .2s ease, background .2s ease;
}

.wz-field input:focus {
  outline: none;
  border-color: var(--wz-accent);
  background: var(--wz-input-focus, var(--wz-input));
}

/* ------------------------------------------------------------ choice buttons */

.wz-choice { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

.wz-choice button {
  appearance: none;
  font: inherit;
  cursor: pointer;
  background: var(--wz-input);
  color: var(--wz-ink);
  border: 1px solid var(--wz-rule);
  padding: 12px 20px;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.wz-choice button:hover { border-color: var(--wz-accent); transform: translateY(-1px); }
.wz-choice button:focus-visible { outline: 2px solid var(--wz-accent); outline-offset: 3px; }

.wz-choice button[aria-pressed="true"] {
  background: var(--wz-accent);
  border-color: var(--wz-accent);
  color: var(--wz-on-accent);
}

/* -------------------------------------------------------------------- voices */

.wz-voices { display: grid; gap: 10px; margin-bottom: 20px; }

@media (min-width: 560px) {
  .wz-voices { grid-template-columns: 1fr 1fr; }
}

.wz-voice {
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 3px;
  background: var(--wz-input);
  color: var(--wz-ink);
  border: 1px solid var(--wz-rule);
  padding: 14px 16px;
  transition: border-color .2s ease, transform .2s ease;
}

.wz-voice:hover { border-color: var(--wz-accent); transform: translateY(-1px); }
.wz-voice:focus-visible { outline: 2px solid var(--wz-accent); outline-offset: 3px; }

.wz-voice[aria-pressed="true"] {
  border-color: var(--wz-accent);
  box-shadow: inset 3px 0 0 var(--wz-accent);
}

.wz-voice-name { font-size: 1.1rem; font-weight: 600; }

.wz-voice-gender {
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--wz-ink-soft);
}

.wz-voice-note { font-size: .9rem; color: var(--wz-ink-soft); }

/* ---------------------------------------------------------------- days input */

.wz-days { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.wz-days input[type="range"] { flex: 1 1 200px; accent-color: var(--wz-accent); }

.wz-days-readout {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-variant-numeric: tabular-nums;
  color: var(--wz-accent);
  min-width: 5ch;
}

.wz-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

.wz-presets button {
  appearance: none;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  background: transparent;
  color: var(--wz-ink-soft);
  border: 1px solid var(--wz-rule);
  padding: 7px 13px;
}

.wz-presets button:hover { border-color: var(--wz-accent); color: var(--wz-ink); }
.wz-presets button:focus-visible { outline: 2px solid var(--wz-accent); outline-offset: 3px; }

/* ------------------------------------------------------------------ controls */

.wz-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.wz-count { font-size: .82rem; color: var(--wz-ink-soft); margin-left: auto; }

/* ------------------------------------------------------------------- preview */

.wz-preview {
  position: sticky;
  top: 24px;
  border: 1px solid var(--wz-rule);
  background: var(--wz-preview-bg);
  padding: clamp(18px, 3vw, 30px);
}

@media (max-width: 939px) {
  .wz-preview { position: static; }
}

.wz-preview-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--wz-rule);
}

.wz-preview-head strong { font-size: 1.15rem; }

.wz-live {
  margin-left: auto;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--wz-accent);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.wz-live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wz-accent);
  animation: wz-pulse 1.8s ease-in-out infinite;
}

@keyframes wz-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.7); }
}

.wz-spec { display: grid; gap: 0; margin: 0 0 20px; }

.wz-spec div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--wz-rule);
  font-size: .93rem;
}

.wz-spec dt { color: var(--wz-ink-soft); margin: 0; }
.wz-spec dd { margin: 0; text-align: right; }

.wz-transcript { display: grid; gap: 12px; min-height: 260px; }

.wz-line {
  margin: 0;
  display: grid;
  gap: 3px;
  animation: wz-said .34s ease both;
}

@keyframes wz-said {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

.wz-who {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--wz-ink-soft);
}

.wz-said { font-size: .97rem; line-height: 1.55; }
.wz-line[data-who="agent"] .wz-said { color: var(--wz-ink); border-left: 2px solid var(--wz-accent); padding-left: 12px; }
.wz-line[data-who="them"] .wz-said { color: var(--wz-ink-soft); padding-left: 12px; }

.wz-note { font-size: .82rem; color: var(--wz-ink-soft); margin: 16px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .wz-panel,
  .wz-line { animation: none; }
  .wz-live::before { animation: none; }
  .wz-choice button:hover,
  .wz-voice:hover { transform: none; }
}
