/**
 * Size guide (sections/product-size-guide.liquid).
 *
 * The visitor sets their hand measurement and the size whose range covers it
 * is marked. Everything here has to work with the control absent, because the
 * control is hidden until `html.js` - the cards are the content, the slider
 * only points at one of them.
 */
.section-size-guide {
  margin-top: var(--space-9);
}

.size-guide__heading {
  margin: 0 0 var(--space-5);
  color: var(--color-muted);
}

/* ------------------------------------------------------------------ */
/* The control                                                         */
/* ------------------------------------------------------------------ */
.size-guide__control {
  max-width: 460px;
  margin: 0 auto var(--space-7);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-m);
  text-align: center;
}

.size-guide__control[hidden] {
  display: none;
}

.size-guide__control-label {
  display: block;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.size-guide__readout {
  display: block;
  margin-block: var(--space-2) var(--space-4);
  font-family: var(--font-heading);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  /* The number changes as the slider moves, so its digits must not reflow the
     line while it does. */
  font-variant-numeric: tabular-nums;
}

.size-guide__unit {
  margin-left: 4px;
  color: var(--color-muted);
  font-size: 18px;
  font-weight: 500;
}

/* A styled range input rather than a custom widget: it is already keyboard
   operable, already announced correctly, and already understands drag on
   touch. None of that is worth rebuilding for a nicer thumb. */
.size-guide__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background-color: var(--color-line);
  cursor: pointer;
}

.size-guide__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-bg);
  border-radius: 50%;
  background-color: var(--color-brand);
  box-shadow: 0 1px 4px rgb(0 0 0 / 25%);
  cursor: grab;
}

.size-guide__slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-bg);
  border-radius: 50%;
  background-color: var(--color-brand);
  box-shadow: 0 1px 4px rgb(0 0 0 / 25%);
  cursor: grab;
}

.size-guide__slider:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 4px;
}

/* ------------------------------------------------------------------ */
/* The cards                                                           */
/* ------------------------------------------------------------------ */
.size-guide__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.size-guide__card {
  position: relative;
  padding: var(--space-6) var(--space-5) var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-m);
  background-color: var(--color-bg);
}

@media screen and (prefers-reduced-motion: no-preference) {
  .size-guide__card {
    transition: border-color 240ms ease, transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
  }
}

/* The matched card is stated with the border and a lift, NOT with a colour
   wash - the cards carry a lot of small text and a tinted ground under it
   costs more contrast than the emphasis is worth. */
.size-guide__card.is-match {
  border-color: var(--color-ink);
  transform: translateY(-4px);
}

.size-guide__badge {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% -50%;
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  background-color: var(--color-ink);
  color: var(--color-bg);
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.size-guide__badge[hidden] {
  display: none;
}

.size-guide__name {
  margin: 0 0 var(--space-4);
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

.size-guide__field {
  padding-block: var(--space-3);
  border-top: 1px solid var(--color-line);
}

.size-guide__label {
  margin-bottom: 2px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.size-guide__value {
  margin: 0;
  color: var(--color-ink);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.size-guide__grips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.size-guide__grip {
  padding: 2px var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
}

/* Not small print hidden at the bottom of a page. The hand ranges are the one
   thing here no manufacturer publishes, so the sentence saying they are
   guidance sits directly under the cards it qualifies. */
.size-guide__note {
  max-width: 62ch;
  margin: var(--space-5) auto 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
