/**
 * Guide quiz (sections/guide-quiz.liquid).
 *
 * Answers are links, not buttons, because the page has to work without
 * JavaScript - so they are styled to read as controls here rather than
 * inheriting link styling. See the section comment for why.
 */
/* Questions sit in a reading measure; the results grid beneath them takes
   the full page width, because eight product cards at 860px are postage
   stamps and the grid is the point of the page. */
.guide-quiz {
  display: block;
}

.guide-quiz__intro,
.guide-quiz__questions {
  max-width: 860px;
  margin-inline: auto;
}

.guide-quiz__intro {
  margin-bottom: var(--space-7);
  text-align: center;
}

.guide-quiz__heading {
  margin: 0 0 var(--space-3);
}

.guide-quiz__blurb {
  margin: 0;
  color: var(--color-muted);
}

.guide-quiz__blurb > p {
  margin: 0;
}

.guide-quiz__questions {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

/* A fieldset so the question and its answers are one group to a screen
   reader. Its default border and padding are removed rather than styled -
   the rule below the legend does the separating. */
.guide-quiz__question {
  margin: 0;
  padding: 0;
  border: 0;
}

.guide-quiz__legend {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-line);
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 500;
}

/* The step number is decoration, not content - it repeats what the order
   already says - so it is small and quiet rather than a numbered badge
   competing with the question. */
.guide-quiz__step {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background-color: color-mix(in srgb, var(--color-brand) 12%, transparent);
  color: var(--color-brand);
  font-size: 13px;
  font-weight: 600;
}

.guide-quiz__answers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.guide-quiz__answer {
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background-color: var(--color-bg);
  color: var(--color-ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.guide-quiz__answer:hover {
  border-color: var(--color-ink);
}

.guide-quiz__answer:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.guide-quiz__answer.is-chosen {
  border-color: var(--color-ink);
  background-color: var(--color-ink);
  color: var(--color-bg);
}

/* The typed budget sits under the price chips as a quiet alternative: a
   label, a currency mark, a short number field. It is hidden without
   script because a number field cannot be a link. */
html:not(.js) .guide-quiz__budget {
  display: none;
}

.guide-quiz__budget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-4);
}

.guide-quiz__budget-label {
  color: var(--color-muted);
}

.guide-quiz__budget-field {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background-color: var(--color-bg);
}

.guide-quiz__budget-field:focus-within {
  border-color: var(--color-ink);
}

.guide-quiz__budget-currency {
  padding-left: var(--space-4);
  color: var(--color-muted);
  font-size: 14px;
}

.guide-quiz__budget-input {
  width: 9ch;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-2);
  border: 0;
  background: none;
  color: var(--color-ink);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.guide-quiz__budget-input:focus {
  outline: none;
}

.guide-quiz__budget-input::-webkit-outer-spin-button,
.guide-quiz__budget-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.guide-quiz__budget-input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

@media screen and (prefers-reduced-motion: no-preference) {
  .guide-quiz__answer {
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }
}

.guide-quiz__result {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-line);
}

.guide-quiz__result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
}

/* The count is the quiz's answer, so it carries the heading face. It has a
   reserved height so the line does not appear from nothing on the first
   answer and shove the grid down. */
.guide-quiz__count {
  margin: 0;
  min-height: 1.3em;
  font-variant-numeric: tabular-nums;
}

.guide-quiz__grid {
  min-height: 0;
}

.guide-quiz__grid:empty {
  display: none;
}

/* The same shape as the collection page's grid, redeclared here so the
   guide does not pull in the whole collection stylesheet for one rule. */
.guide-results__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

@media screen and (min-width: 990px) {
  .guide-results__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-5);
  }
}

.guide-quiz__grid[aria-busy='true'] {
  opacity: 0.5;
}

@media screen and (prefers-reduced-motion: no-preference) {
  .guide-quiz__grid {
    transition: opacity 0.15s ease;
  }
}

.guide-quiz__none {
  margin: 0;
  color: var(--color-muted);
}

.guide-quiz__none[hidden] {
  display: none;
}

.guide-quiz__actions {
  display: flex;
  justify-content: center;
}

/* Dimmed, not removed. The button is present from the start so answering a
   question does not shift the page under the pointer; its href still points
   at the unfiltered collection, so even in this state it goes somewhere
   real rather than nowhere. */
.guide-quiz__cta.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.guide-quiz__reset {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.guide-quiz__reset:hover {
  color: var(--color-ink);
}

.guide-quiz__reset[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Second pass: questions as cards, answers with the site's hover fill  */
/* ------------------------------------------------------------------ */
.guide-quiz__question {
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-m);
  background-color: color-mix(in srgb, var(--color-ink) 2%, var(--color-bg));
}

.guide-quiz__legend {
  float: left;
  flex-wrap: wrap;
  padding-bottom: 0;
  border-bottom: 0;
}

.guide-quiz__legend + * {
  clear: both;
}

.guide-quiz__legend-text {
  flex: 1 1 auto;
}

.guide-quiz__hint {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background-color: color-mix(in srgb, var(--color-brand) 12%, transparent);
  color: var(--color-brand);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
}

.guide-quiz__step {
  width: 30px;
  height: 30px;
  background-color: var(--color-brand);
  color: #fff;
}

/* Answers: the pill button, with motion.js's cursor-origin fill (the
   four-point contract in assets/motion.js) and a tick that pops in when
   chosen. The label is its own span so it sits above the fill. */
.guide-quiz__answer {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: 44px;
  --gq-fill: var(--color-ink);
}

.guide-quiz__answer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-color: var(--gq-fill);
  clip-path: circle(0% at var(--fill-x, 50%) var(--fill-y, 50%));
  pointer-events: none;
}

html.has-cursor-fill .guide-quiz__answer.is-hover-fill::before {
  clip-path: circle(150% at var(--fill-x, 50%) var(--fill-y, 50%));
}

html.has-cursor-fill .guide-quiz__answer:hover {
  color: var(--color-bg);
}

/* A chosen answer is already solid ink; the fill would be black on black. */
.guide-quiz__answer.is-chosen {
  --gq-fill: transparent;
  gap: var(--space-2);
}

.guide-quiz__tick {
  display: inline-grid;
  place-items: center;
  width: 0;
  height: 18px;
  overflow: hidden;
  border-radius: 50%;
  background-color: var(--color-brand);
  color: #fff;
  opacity: 0;
  scale: 0.4;
}

.guide-quiz__answer.is-chosen .guide-quiz__tick {
  width: 18px;
  opacity: 1;
  scale: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .guide-quiz__answer::before {
    transition: clip-path var(--btn-fill-out) var(--btn-fill-out-ease);
  }

  html.has-cursor-fill .guide-quiz__answer.is-hover-fill::before {
    transition: clip-path var(--btn-fill-in) var(--btn-fill-in-ease);
  }

  .guide-quiz__answer {
    transition: color var(--btn-fill-out) var(--btn-fill-out-ease),
      background-color 0.25s ease, border-color 0.25s ease, gap 0.25s ease;
  }

  .guide-quiz__answer:hover {
    transition-duration: var(--btn-fill-in), 0.25s, 0.25s, 0.25s;
  }

  .guide-quiz__tick {
    transition: width 0.25s ease, opacity 0.2s ease, scale 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .guide-quiz__answer:active {
    scale: 0.97;
  }
}

@media screen and (max-width: 749px) {
  .guide-quiz__question {
    padding: var(--space-4);
  }

  .guide-quiz__answers {
    gap: var(--space-2);
  }
}
