/* The strategy quiz, /quiz/ (templates/quiz.mjs, assets/js/quiz.js): a head on the stars like the terms' pages, then one
   column of 760 px at most with the form on a panel of the second space tone and, under it, the result on the same
   panel. Cream for everything that is chosen or next; gold only on "See <Name>", which leads to a strategy's buy box,
   as Subscribe does everywhere. Without JavaScript every question shows, one under the other, and the six cards under
   them; with it (html.quiz-js before the first paint, html.quiz-ready once quiz.js runs) one question at a time and
   then the result. The question and the result slide in only while the motion setting is on. */

.quiz-page [hidden] {
  display: none !important;
}

.quiz-column {
  max-width: 760px;
  margin: 0 auto;
}

.quiz-head {
  padding: calc(var(--header-h) + clamp(28px, 6vw, 72px)) 0 clamp(28px, 4vw, 44px);
  /* The photo's stars screened onto the blue, fading out downwards (as .terms-head, strategy.css). */
  background:
    linear-gradient(180deg, rgb(var(--space-rgb) / 0.5), var(--space)),
    url("../planets/starfield.webp") center / 1400px auto repeat,
    var(--space);
  background-blend-mode: normal, screen;
}

.quiz-head .eyebrow {
  margin-bottom: 0.9rem;
}

.quiz-head h1 {
  margin: 0 0 0.4em;
  font-size: clamp(1.68rem, 1.15rem + 2.4vw, 2.94rem);
}

.quiz-lead {
  max-width: 56ch;
  margin: 0;
  color: var(--on-dark-muted);
  font-size: 1.0625rem;
}

.quiz-body {
  padding: 0 0 clamp(64px, 9vw, 112px);
}

/* The panel the form and the result stand on. */
.quiz,
.quiz-result {
  min-width: 0;
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--space-2);
  scroll-margin-top: 16px;
}

.quiz + .quiz-result {
  margin-top: clamp(32px, 5vw, 48px);
}

html.quiz-ready .quiz + .quiz-result {
  margin-top: 0;
}

/* The progress bar (with JavaScript): how far through the questions, in cream. */
.quiz-bar {
  height: 3px;
  margin: 0 0 clamp(20px, 3vw, 28px);
  border-radius: 999px;
  background: rgb(var(--on-dark-rgb) / 0.14);
  overflow: hidden;
}

.quiz-bar__fill {
  display: block;
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: rgb(var(--on-dark-rgb) / 0.85);
}

html[data-motion="on"] .quiz-bar__fill {
  transition: width 0.3s ease;
}

/* A question: its count, its title, a line of help, then the answers. */
.quiz-q {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz-q + .quiz-q {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line-dark);
}

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

/* The question takes the focus when it comes (quiz.js), only so that a screen reader reads it: no ring on a heading. */
.quiz-q__legend:focus,
.quiz-result__title:focus {
  outline: none;
}

.quiz-q__count {
  display: block;
  margin-bottom: 10px;
  color: var(--on-dark-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.quiz-q__title {
  display: block;
  color: var(--on-dark);
  font-family: var(--font-display);
  font-size: clamp(1.155rem, 1rem + 0.8vw, 1.575rem);
  line-height: 1.3;
  text-wrap: balance;
}

.quiz-q__help {
  margin: 10px 0 0;
  color: var(--on-dark-muted);
  font-size: 0.9375rem;
}

.quiz-answers {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

/* An answer: the whole box is its label, the round mark its radio. Chosen: a cream edge and a faint cream wash. */
.quiz-answer {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 56px;
  padding: 15px 16px;
  border: 1px solid rgb(var(--on-dark-rgb) / 0.2);
  border-radius: var(--radius-sm);
  background: rgb(var(--space-rgb) / 0.6);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.quiz-answer:hover {
  border-color: rgb(var(--on-dark-rgb) / 0.5);
}

.quiz-answer:has(:checked) {
  border-color: rgb(var(--on-dark-rgb) / 0.85);
  background: rgb(var(--on-dark-rgb) / 0.07);
}

.quiz-answer__input {
  display: grid;
  flex: none;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  border: 1.5px solid rgb(var(--on-dark-rgb) / 0.7);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.quiz-answer__input::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--on-dark);
  transform: scale(0);
}

.quiz-answer__input:checked {
  border-color: var(--on-dark);
}

.quiz-answer__input:checked::before {
  transform: scale(1);
}

.quiz-answer__input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.quiz-answer:has(:focus-visible) {
  border-color: var(--on-dark);
}

.quiz-answer__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.quiz-answer__label {
  color: var(--on-dark);
  font-weight: 500;
  line-height: 1.4;
}

.quiz-answer__note {
  color: var(--on-dark-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

/* Forced colours draw the system's own radio. */
@media (forced-colors: active) {
  .quiz-answer__input {
    -webkit-appearance: auto;
    appearance: auto;
  }

  .quiz-answer__input::before {
    display: none;
  }
}

/* With JavaScript: one question at a time. Until quiz.js runs, only the first one and no result (no flash of the whole
   form); once it runs, the current one. */
html.quiz-js:not(.quiz-ready) .quiz-q:not(:first-of-type),
html.quiz-js:not(.quiz-ready) .quiz-result {
  display: none;
}

html.quiz-ready .quiz--js .quiz-q:not(.is-current) {
  display: none;
}

html.quiz-ready .quiz--js .quiz-q {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

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

.quiz-nav .btn {
  min-height: 48px;
}

/* Next: the step forward in cream (gold stays for the way to a buy box). */
.quiz-nav__next {
  margin-left: auto;
  background: var(--on-dark);
  color: var(--space);
}

.quiz-nav__next:hover {
  background: var(--light);
}

.quiz-nav__next:disabled:hover {
  background: var(--on-dark);
}

/* On phones both stay on the left: the Support button stands fixed at the bottom right (base.css) and would cover a
   Next on the right whenever the question ends near the bottom of the screen. */
@media (max-width: 599.98px) {
  .quiz-nav__next {
    margin-left: 0;
  }
}

/* The result. Its cards: the planet and the name, the line on how it runs, "See <Name>". The match alone is one card,
   bigger, with the tagline and what you get; the shortlist, the "any" result and the page without JavaScript show
   them two a row from 600 px. */
.quiz-result__title {
  margin: 0 0 0.3em;
  font-size: clamp(1.26rem, 1.05rem + 1vw, 1.89rem);
}

.quiz-result__lead {
  margin: 0 0 24px;
  color: var(--on-dark-muted);
}

.quiz-cards {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.quiz-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 18px 20px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgb(var(--space-rgb) / 0.6);
}

.quiz-card__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0 0 12px;
  font-size: 1.26rem;
}

/* The sphere photo in its own tone (--planet-filter for its look, base.css; --planet-tone, appearance.mjs). Its disc is
   0.6 of the photo (Saturn's 0.42, scaled up by --k so its disc is as big): the margins pull the empty edge in and give
   Saturn's rings their room, as on the lobby's cards. */
.quiz-card__planet {
  --size: 64px;
  flex: none;
  width: var(--size);
  height: var(--size);
  margin:
    calc(var(--size) * -0.18)
    calc(var(--size) * (var(--k, 1) - 1) / 2 - var(--size) * 0.09)
    calc(var(--size) * -0.18)
    calc(var(--size) * (var(--k, 1) - 1) / 2 - var(--size) * 0.19);
  filter: brightness(0.95) var(--planet-filter) var(--planet-tone,);
  transform: scale(var(--k, 1));
}

.quiz-card__tagline,
.quiz-card__get {
  display: none;
}

.quiz-card__line {
  margin: 0 0 18px;
  color: rgb(var(--on-dark-rgb) / 0.88);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.quiz-card__cta {
  margin: auto 0 0;
}

.quiz-card__see {
  min-height: 44px;
  padding: 0 1.4em;
  font-size: 1rem;
}

/* The match: one card, its planet bigger and its light in the corner. */
.quiz-card--match {
  padding: clamp(20px, 4vw, 30px);
  border-color: rgb(var(--tint-hi, var(--on-dark-rgb)) / 0.45);
  background:
    radial-gradient(110% 80% at 0% 0%, rgb(var(--tint, 255 255 255) / 0.12), transparent 62%),
    rgb(var(--space-rgb) / 0.6);
}

.quiz-card--match .quiz-card__name {
  gap: 6px 18px;
  margin-bottom: 16px;
  font-size: clamp(1.35rem, 1.05rem + 1.6vw, 2.31rem);
}

.quiz-card--match .quiz-card__planet {
  --size: 80px;
}

@media (min-width: 600px) {
  .quiz-card--match .quiz-card__planet {
    --size: 120px;
  }
}

.quiz-card--match .quiz-card__tagline {
  display: block;
  margin: 0 0 12px;
  color: var(--on-dark-muted);
  font-size: 0.9375rem;
}

.quiz-card--match .quiz-card__line {
  margin-bottom: 20px;
  color: var(--on-dark);
  font-size: 1.0625rem;
}

.quiz-card--match .quiz-card__get {
  display: block;
  margin: 0 0 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line-dark);
}

.quiz-card__get-title {
  margin: 0 0 8px;
  color: var(--on-dark-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.quiz-card__get ul {
  margin: 0;
  padding-left: 1.2em;
}

.quiz-card__get li {
  margin-bottom: 4px;
  color: rgb(var(--on-dark-rgb) / 0.88);
  font-size: 0.9375rem;
}

.quiz-card--match .quiz-card__see {
  min-height: 52px;
  padding: 0 1.6em;
  font-size: 1.0625rem;
}

.quiz-result__also {
  margin: 18px 0 0;
  color: var(--on-dark-muted);
}

.quiz-result__also a,
.quiz-result__step a,
.quiz-result__restart a {
  color: var(--on-dark);
  text-underline-offset: 3px;
}

.quiz-result__also a {
  font-weight: 600;
}

.quiz-result__lobby {
  margin: 22px 0 0;
}

/* The first step: a quiet note with a cream edge. */
.quiz-result__step {
  margin: 22px 0 0;
  padding: 14px 16px;
  border-left: 2px solid rgb(var(--on-dark-rgb) / 0.5);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgb(var(--on-dark-rgb) / 0.04);
  color: rgb(var(--on-dark-rgb) / 0.9);
}

.quiz-result__restart {
  margin: 22px 0 0;
  font-weight: 500;
}

.quiz-caution {
  margin: 28px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-dark);
  color: var(--on-dark-muted);
  font-size: 0.875rem;
}

/* Motion on: a new question and the result come in from a little lower (never on the first paint: quiz.js marks the
   form once the visitor has moved on). Calm and off: they are simply there. */
@keyframes quiz-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

html[data-motion="on"].quiz-ready .quiz--moved .quiz-q.is-current,
html[data-motion="on"] .quiz-result.is-shown {
  animation: quiz-in 0.28s ease-out both;
}

@media print {
  .quiz-nav,
  .quiz-bar {
    display: none !important;
  }
}
