/* Scale Command site: the Test your shop questionnaire.
 * Owns .quiz* only (js/quiz.js puts .quiz on #quiz and .quiz-results on #quiz-results).
 * Every color and font is a :root token from /style.css; the fallbacks are the brief's values.
 * Gold sits on the picked answer's border, the Next button and Book a call, nowhere else.
 * The only motion is a 200ms fade when a question or the result comes in; none under reduced motion.
 */

:root {
  --quiz-fade: 200ms;
  --quiz-max: 760px;
  --quiz-track: 6px;
}

.quiz,
.quiz-results {
  max-width: var(--quiz-max);
  min-width: 0;
}

/* ----- the fade ----- */

.quiz-stage,
.quiz-results {
  opacity: 1;
  transition: opacity var(--quiz-fade) ease;
}

.quiz-stage.is-fading,
.quiz-results.is-fading {
  opacity: 0;
}

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

.quiz-card {
  display: block;
}

.quiz-progress {
  margin: 0;
  font-family: var(--font-mono, 'Manrope', system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted, #8A8A93);
}

.quiz-bar {
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--hair, rgba(200, 168, 78, 0.15));
  overflow: hidden;
}

.quiz-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--text-2, #A7A5A0);
  transition: width var(--quiz-fade) ease;
}

/* ----- the question ----- */

.quiz-fieldset {
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.quiz-legend {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.quiz-pillar {
  display: block;
}

.quiz-question {
  display: block;
  margin: 10px 0 0;
  max-width: 26ch;
  scroll-margin-top: calc(var(--header-h, 64px) + 16px);
  font-family: var(--font-display, 'Manrope', system-ui, sans-serif);
  font-weight: 800;
  font-size: clamp(1.35rem, 2vw + 0.7rem, 2rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text, #EDEBE3);
}

.quiz-question:focus {
  outline: none;
}

.quiz-question:focus-visible {
  outline: 2px solid var(--gold-light, #DFC06A);
  outline-offset: 4px;
}

/* ----- the four answers: one column, the whole label is the target ----- */

.quiz-answers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.quiz-answer {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--edge, rgba(237, 235, 227, 0.38));
  border-radius: var(--radius-card, 10px);
  background: var(--card, #141418);
  color: var(--text, #EDEBE3);
  font-size: 1rem;
  line-height: 1.4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.quiz-answer::before {
  content: '';
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--edge-on, rgba(237, 235, 227, 0.55));
  transition: border-color 160ms ease, background-color 160ms ease;
}

@media (hover: hover) {
  .quiz-answer:hover {
    border-color: var(--edge-hover, rgba(237, 235, 227, 0.5));
    background: var(--raised, #1B1B21);
  }
}

.quiz-answer.is-picked {
  border-color: var(--gold, #C8A84E);
  background: var(--raised, #1B1B21);
}

.quiz-answer.is-picked::before {
  border-color: var(--text, #EDEBE3);
  background: radial-gradient(circle, var(--text, #EDEBE3) 0 4px, transparent 5px);
}

.quiz-answer-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The radio stays in the tab order but out of sight; the label shows its state. */
.quiz-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  pointer-events: none;
}

.quiz-answer:focus-within {
  outline: 2px solid var(--gold-light, #DFC06A);
  outline-offset: 2px;
}

@supports selector(:has(a)) {
  .quiz-answer:focus-within {
    outline: none;
  }

  .quiz-answer:has(.quiz-radio:focus-visible) {
    outline: 2px solid var(--gold-light, #DFC06A);
    outline-offset: 2px;
  }
}

/* ----- Back and Next ----- */

.quiz-nav {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.quiz-nav .btn {
  flex: 1 1 0;
}

.quiz-nav .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quiz-nav .btn-gold:disabled:hover {
  background: var(--gold, #C8A84E);
  border-color: var(--gold, #C8A84E);
}

.quiz-nav .btn-ghost:disabled:hover {
  border-color: var(--edge, rgba(237, 235, 227, 0.38));
  background: transparent;
}

@media (min-width: 620px) {
  .quiz-nav {
    justify-content: space-between;
  }

  .quiz-nav .btn {
    flex: 0 0 auto;
    min-width: 150px;
  }
}

/* ----- the result ----- */

.quiz-results-title {
  scroll-margin-top: calc(var(--header-h, 64px) + 16px);
  font-family: var(--font-display, 'Manrope', system-ui, sans-serif);
  font-weight: 800;
  font-size: clamp(1.2rem, 1.2vw + 0.8rem, 1.55rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.quiz-results-title:focus {
  outline: none;
}

.quiz-results-title:focus-visible {
  outline: 2px solid var(--gold-light, #DFC06A);
  outline-offset: 4px;
}

.quiz-summary {
  display: grid;
  gap: 4px;
  margin-top: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hair, rgba(200, 168, 78, 0.15));
  --quiz-tone: var(--text, #EDEBE3);
}

.quiz-summary.is-green,
.quiz-pillar-row.is-green,
.quiz-row.is-green { --quiz-tone: var(--green, #3FBF7F); }

.quiz-summary.is-amber,
.quiz-pillar-row.is-amber,
.quiz-row.is-amber { --quiz-tone: var(--amber, #E0A63A); }

.quiz-summary.is-red,
.quiz-pillar-row.is-red,
.quiz-row.is-red { --quiz-tone: var(--red, #E05A4F); }

.quiz-grade {
  margin: 0;
  font-family: var(--font-display, 'Manrope', system-ui, sans-serif);
  font-weight: 800;
  font-size: clamp(4.5rem, 12vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--text, #EDEBE3);
}

.quiz-band {
  margin: 0;
  font-family: var(--font-display, 'Manrope', system-ui, sans-serif);
  font-weight: 700;
  font-size: clamp(1.4rem, 2vw + 0.8rem, 2.1rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--quiz-tone);
}

.quiz-score {
  margin: 0;
  font-family: var(--font-mono, 'Manrope', system-ui, sans-serif);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2, #A7A5A0);
}

/* the four pillar bars */

.quiz-pillars {
  display: grid;
}

.quiz-pillar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair, rgba(200, 168, 78, 0.15));
  --quiz-tone: var(--text, #EDEBE3);
}

.quiz-pillar-name {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text, #EDEBE3);
}

.quiz-pillar-pct {
  min-width: 4ch;
  font-family: var(--font-mono, 'Manrope', system-ui, sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
  color: var(--quiz-tone);
}

.quiz-pillar-bar {
  grid-column: 1 / -1;
  height: var(--quiz-track);
  border-radius: 999px;
  background: var(--hair, rgba(200, 168, 78, 0.15));
  overflow: hidden;
}

.quiz-pillar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--quiz-tone);
}

/* left on the table */

.quiz-leak {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.quiz-leak-line {
  margin: 0;
  font-family: var(--font-mono, 'Manrope', system-ui, sans-serif);
  font-weight: 700;
  font-size: clamp(1.2rem, 1.2vw + 0.85rem, 1.6rem);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  color: var(--text, #EDEBE3);
  overflow-wrap: anywhere;
}

.quiz-leak-note {
  margin: 0;
}

/* the answer rows */

.quiz-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 28px;
}

.quiz-row {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  background: var(--card, #141418);
  border: 1px solid var(--hair, rgba(200, 168, 78, 0.15));
  border-radius: var(--radius-card, 10px);
  --quiz-tone: var(--text, #EDEBE3);
}

.quiz-row.is-weakest {
  background: var(--raised, #1B1B21);
}

.quiz-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.quiz-row-title {
  margin: 0;
  font-family: var(--font-body, 'Manrope', system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text, #EDEBE3);
}

.quiz-row-pct {
  flex: 0 0 auto;
  font-family: var(--font-mono, 'Manrope', system-ui, sans-serif);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--quiz-tone);
}

.quiz-row-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-2, #A7A5A0);
}

.quiz-row-link {
  justify-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  border: 1px solid var(--edge, rgba(237, 235, 227, 0.38));
  border-radius: var(--radius-chip, 6px);
  background: transparent;
  color: var(--text, #EDEBE3);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.quiz-row-link:hover {
  border-color: var(--edge-hover, rgba(237, 235, 227, 0.5));
  background: rgba(237, 235, 227, 0.04);
}

@media (min-width: 620px) {
  .quiz-row-link {
    justify-self: start;
  }
}

@media (min-width: 768px) {
  .quiz-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quiz-row:only-child {
    grid-column: 1 / -1;
  }
}

/* Book a call and Start over */

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

@media (max-width: 619.98px) {
  .quiz-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .quiz-actions .btn {
    width: 100%;
  }
}

/* ----- reduced motion: no fade, no transitions ----- */

@media (prefers-reduced-motion: reduce) {
  .quiz-stage,
  .quiz-results,
  .quiz-bar-fill,
  .quiz-answer,
  .quiz-answer::before,
  .quiz-row-link {
    transition: none;
  }

  .quiz-stage.is-fading,
  .quiz-results.is-fading {
    opacity: 1;
  }
}
