/* =========================================================
   SANTA'S WISHLIST: page layer (started as a copy of the
   Matchmaker's; the two are kept separate on purpose)
   Structure only. Type, colour, cards, rows, pills, inputs,
   tags, the meter and the accordion all come from
   base-web-style.css. No tokens are redefined here.
   ========================================================= */

/* BASE CANDIDATE: base has no visually-hidden text. Used for
   the letter's status line and the full names of the ball
   card's buttons ("Traction Strength: High"). */
.mm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* `hidden` has to win over the display a class sets (.btn,
   .mm-fields and the rest): the browser's own [hidden] rule is
   weaker than any class, so without this the Share button and the
   gift-recipient field showed while hidden. */
#mm-app [hidden] {
  display: none !important;
}

/* ---------------------------------------------------------
   A step: one even column, straight on the page (no card
   frame on any step, B6). Each question is a group: its
   title, the line saying what's missing, then its options.
--------------------------------------------------------- */
.mm-step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.mm-step > * {
  margin: 0;
}

.mm-step > .mm-choices,
.mm-step > .mm-fields,
.mm-step > .mm-question,
.mm-step > .mm-hero,
.mm-step > .mm-actions,
.mm-step > .mm-results {
  align-self: stretch;
}

.mm-question {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mm-question > * {
  margin: 0;
}

/* the second question on the first step sits a little apart */
.mm-question + .mm-question {
  margin-top: 16px;
}

.mm-optional {
  font-weight: 400;
}

/* The gift's "Their name", right under the option that shows it */
.mm-recipient {
  margin-top: 4px;
}

/* Where they are: three dots, the current one long (B6) */
.mm-progress {
  display: flex;
  margin: 0;
}

.mm-dots {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mm-dot {
  width: 9px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
}

.mm-dot.is-done,
.mm-dot.is-current {
  background: currentColor;
}

.mm-dot.is-current {
  width: 26px;
}

/* ---------------------------------------------------------
   Step 1 opens on a peek at what they'll make (B1): a small
   tilted letter beside one line. Decorative; the skin
   colours it.
--------------------------------------------------------- */
.mm-hero {
  display: flex;
  align-items: center;
  gap: 24px;
}

.mm-hero-lead {
  margin: 0;
}

.mm-mini-letter {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 6px;
  width: 118px;
  padding: 18px 12px 14px;
  overflow: hidden;
  rotate: -5deg;
}

.mm-mini-letter > span {
  display: block;
}

.mm-mini-stamp {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 16px;
  height: 20px;
}

.mm-mini-greeting {
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}

.mm-mini-line {
  height: 4px;
  border-radius: 2px;
}

.mm-mini-line.is-short {
  width: 60%;
}

.mm-mini-ball {
  width: 28px;
  height: 28px;
  margin: 2px 0;
  border-radius: 50%;
}

.mm-mini-signoff {
  font-size: 13px;
  line-height: 1;
}

@media (max-width: 400px) {
  .mm-hero {
    gap: 16px;
  }

  /* "Dear Santa," starts under the stamp at this size */
  .mm-mini-letter {
    width: 96px;
    padding: 30px 10px 12px;
  }

  .mm-mini-greeting {
    font-size: 13px;
  }

  .mm-mini-stamp {
    top: 10px;
    right: 8px;
    width: 12px;
    height: 15px;
  }

  .mm-mini-signoff {
    font-size: 11px;
  }
}

/* Focus moves to each new step's heading so screen readers announce
   it. That's programmatic, not a control, so it doesn't need a ring. */
.mm-step [data-step-title]:focus {
  outline: none;
}

/* ---------------------------------------------------------
   Icons: the info mark and the arrow
--------------------------------------------------------- */
.mm-svg {
  display: block;
  flex-shrink: 0;
}

.spi-tag .mm-svg,
.mm-metric-value .mm-svg,
.mm-ball-link .mm-svg {
  display: inline-block;
}

/* The info mark rides on the value's last word, so a wrapped value
   doesn't leave it alone on a line of its own. */
.mm-metric-value .mm-svg,
.mm-ball-link .mm-svg {
  vertical-align: -2px;
}

/* ---------------------------------------------------------
   Single-choice rows. Base .layout-step draws the bordered
   row, the hover and the .active state; these add the radio.
--------------------------------------------------------- */
.mm-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.mm-option-label {
  font-weight: 600;
}

.mm-option input[type="radio"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--spi-accent);
  cursor: pointer;
}

/* The kind of bowler: the same option rows, two by two (his rule:
   a choice looks like every other choice, not a pill). */
/* Two by two while each tile has room for "Recreational" (160px);
   one column on the narrowest phones. Never more than two across:
   each column is at least half the row. */
.mm-choices.is-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(160px, calc(50% - 5px))), 1fr));
}

.mm-choices.is-tiles .mm-option {
  gap: 10px;
  padding: 14px;
}

/* The row carries the keyboard ring, the same 2px accent ring as
   base .layout-step:focus-visible. */
.mm-option:has(input:focus-visible) {
  outline: 2px solid var(--spi-accent);
  outline-offset: 2px;
}

@supports selector(:has(*)) {
  .mm-option input:focus-visible {
    outline: none;
  }
}

/* ---------------------------------------------------------
   Text fields (their name, who a gift is for) and the action row
--------------------------------------------------------- */
.mm-fields {
  display: grid;
  gap: 16px;
}

.mm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mm-field > * {
  margin: 0;
}

/* BASE CANDIDATE: base has no error state for .spi-input. Base
   text tokens only; the line says what's wrong in words. */
.mm-field-error {
  color: var(--spi-black);
  font-weight: 600;
}

.spi-input[aria-invalid="true"] {
  border-color: var(--spi-black);
}

.mm-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mm-chips .spi-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* No ball came back for the wish */
.mm-empty {
  margin: 0;
}

/* ---------------------------------------------------------
   Ball card, laid out from the Ball Reaction Cards design.
   The shell is base .spi-card-rec; colour is base tokens only.
--------------------------------------------------------- */
.mm-ball {
  position: relative;
  /* lets the card restack its own rows when it's narrow (see below) */
  container-type: inline-size;
}

.mm-ball .spi-card-rec-body > * {
  margin: 0;
}

.mm-ball-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 210px;
  background: var(--spi-white);
}

.mm-ball-photo img {
  width: 190px;
  height: 190px;
  object-fit: contain;
}

.mm-ball-photo.is-empty {
  background: var(--spi-gray-100);
}

.mm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

button.spi-tag {
  font-family: inherit;
  cursor: pointer;
}

.mm-define-toggle:focus-visible {
  outline: 2px solid var(--spi-accent);
  outline-offset: 2px;
}

.mm-define,
.mm-define p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--spi-text-muted);
}

.mm-define p + p {
  margin-top: 6px;
}

/* 15 lb core strip: RG / Diff / PSA */
.mm-spec-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 12px;
  border-radius: var(--spi-radius-sm);
  background: var(--spi-gray-100);
}

.mm-spec-label {
  max-width: 48px;
  line-height: 1.2;
}

.mm-spec-row {
  display: flex;
  gap: 18px;
  margin: 0;
}

.mm-spec-row > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mm-ball .mm-spec-row dt {
  margin: 0;
}

.mm-ball .mm-spec-row dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--spi-black);
  font-variant-numeric: tabular-nums;
}

.mm-metrics {
  margin: 0;
}

/* Reaction rows, as on the Ball Reaction Cards design: name on the
   left, meter + value on the right, always side by side (the design's
   raw-id line under each name is left out). The value column gets its
   full width first; when a card is narrow the name wraps instead, then
   the value. A definition opens underneath. */
/* The value column can shrink: on a narrow card the meter goes
   above the words and the words wrap, instead of running off the
   card (it clipped 45px at 320px before the audit). */
.mm-metric {
  display: grid;
  grid-template-columns: minmax(min-content, 1fr) minmax(0, auto);
  align-items: center;
  column-gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--spi-border);
}

.mm-ball .mm-metric dt {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.3;
  color: var(--spi-text-muted);
}

.mm-ball .mm-metric dd {
  min-width: 0;
  margin: 0;
  text-align: right;
}

.mm-ball .mm-metric dd.mm-define {
  grid-column: 1 / -1;
  margin-top: 6px;
  text-align: left;
}

.mm-metric-value {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 8px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--spi-black);
  text-align: right;
}

button.mm-metric-value {
  position: relative;
  cursor: pointer;
}

/* Bigger tap areas than the words show: the metric values and the
   category chip reach past their text, so a thumb doesn't have to
   land on 17px. Kept inside each row so neighbours don't overlap. */
button.mm-metric-value::after,
button.mm-cat-chip::after {
  content: "";
  position: absolute;
  inset: -10px -6px;
}

button.mm-cat-chip {
  position: relative;
}

/* 3-segment meter on traction and hook timing */
.mm-meter {
  display: inline-flex;
  flex-shrink: 0;
  gap: 3px;
}

.mm-meter > span {
  width: 14px;
  height: 6px;
  border-radius: 3px;
  background: var(--spi-gray-200);
}

.mm-meter > .is-on {
  background: var(--mm-cat, var(--spi-accent));
}

/* Category colours, from the Ball Reaction Cards design. Each card
   carries data-category; the chip takes the tint and the dark tone,
   the meters take the dark tone. Unclassified balls keep the accent.
   Page-scoped --mm-* properties: no base token is redefined. */
.mm-ball[data-category="aggressive_asym"] { --mm-cat: #9F1239; --mm-cat-tint: #FFE4E6; }
.mm-ball[data-category="controlled_asym"] { --mm-cat: #9A3412; --mm-cat-tint: #FFEDD5; }
.mm-ball[data-category="responsive_asym"] { --mm-cat: #6B21A8; --mm-cat-tint: #F3E8FF; }
.mm-ball[data-category="strong_sym"]      { --mm-cat: #1E3A8A; --mm-cat-tint: #DBEAFE; }
.mm-ball[data-category="balanced_sym"]    { --mm-cat: #115E59; --mm-cat-tint: #CCFBF1; }
.mm-ball[data-category="clean_sym"]       { --mm-cat: #3F3F46; --mm-cat-tint: #E4E4E7; }

.mm-ball[data-category] .mm-cat-chip {
  border-color: var(--mm-cat-tint);
  background: var(--mm-cat-tint);
  color: var(--mm-cat);
  font-weight: 600;
}

/* ---------------------------------------------------------
   The letter to Santa (letter.js): the words, the ball card
   inside them, the sign-off, then the actions. The step has no
   card frame (results.js): the letter is its surface and gets
   the whole column. The paper, stamp and type are the skin's.
--------------------------------------------------------- */
.mm-letter {
  display: flex;
  flex-direction: column;
  gap: 20px;
  container: letter-actions / inline-size;
}

.mm-letter-paper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 52px 36px 44px;
  overflow-wrap: break-word;
  container: letter / inline-size;
}

.mm-letter-paper > * {
  margin: 0;
}

.mm-letter-stamp {
  position: absolute;
  top: 30px;
  right: 30px;
  width: 64px;
  height: 78px;
}

/* clear of the stamp */
.mm-letter-greeting {
  padding-right: 84px;
}

.mm-letter-paper > .mm-ball {
  margin: 12px 0 8px;
}

.mm-letter-signoff {
  display: flex;
  flex-direction: column;
}

/* A long name breaks onto the next line rather than running off */
.mm-letter-signoff span,
.mm-letter-text strong {
  overflow-wrap: anywhere;
}

/* The ball card ends in a link to the ball's page */
.mm-ball-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  min-height: 44px;
  font-weight: 700;
}

/* The main actions in one row: Download your letter, Share (phones
   that can share a picture) and Find a Pro Shop. When the row is too
   narrow for all of them, they stack at full width, so nothing is
   left hanging on a line of its own. The widths are the letter's,
   not the screen's: 460px holds two buttons, 660px holds three. */
.mm-letter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

@container letter-actions (max-width: 460px) {
  .mm-letter-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@container letter-actions (max-width: 660px) {
  .mm-letter-actions.has-share {
    flex-direction: column;
    align-items: stretch;
  }
}

.mm-letter-note,
.mm-download-hint {
  margin: 0;
}

/* BASE CANDIDATE: base has no disabled state for .btn. Download and
   Share stay disabled until the letter is signed (name, birthday and
   email: flow.js); the line under them says so. */
.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Change my wish and Start over: quiet text buttons under the
   main actions, so starting over is never the obvious tap. One link
   per line, like the gift-idea links above them (his call, 2026-12-01). */
.mm-more-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.mm-text-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.mm-text-button:focus-visible {
  outline: 2px solid var(--spi-accent);
  outline-offset: 2px;
}

/* After the letter, the way back to shopping (audit F-29): its lead, then
   the two links in a plain vertical list, one under the other (his call,
   2026-11-30). Each link keeps its 44px tap height. */
.mm-shop-more {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-top: 8px;
}

.mm-shop-more > .spi-meta {
  margin: 0;
}

/* Where their name goes, until they sign: a line to write on.
   It fills in as they type (C2). */
.mm-letter-name.is-blank {
  display: inline-block;
  width: 6em;
  border-bottom: 2px solid currentColor;
}

.mm-letter-signoff .mm-letter-name.is-blank {
  width: min(240px, 80%);
  height: 1em;
}

/* The age question: a month and a year side by side. A fieldset,
   so its legend labels the pair; the browser's frame comes off. */
.mm-birthday {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mm-birthday legend {
  margin-bottom: 6px;
  padding: 0;
}

.mm-birthday-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 10px;
}

/* The unticked "news and offers" box, its words beside it, the
   whole row a 44px target */
.mm-consent {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mm-consent > * {
  margin: 0;
}

/* The agreement line, right above Download and Share */
.mm-agree {
  margin: 0;
}

.mm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding-top: 10px;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
}

.mm-check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
}

/* The trap only a bot fills in: off screen, out of the tab order,
   hidden from screen readers */
.mm-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Write your letter: their name, birthday and email (above the letter) */
.mm-sign {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mm-sign > * {
  margin: 0;
}

.mm-sign .mm-fields {
  max-width: 420px;
}

/* The specs behind base's accordion (A3): flush with the card,
   not centred at base's FAQ width */
.mm-specs.spi-accordion {
  max-width: none;
  margin: 0;
}

.mm-specs .spi-accordion-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* The copy of the letter that the download is painted from
   (letter.js): laid out off screen, then removed. */
.mm-letter-render {
  position: fixed;
  top: 0;
  left: -10000px;
  pointer-events: none;
}

/* A wide letter: the ball photo beside its facts */
@container letter (min-width: 540px) {
  .mm-letter .mm-ball {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .mm-letter .mm-ball-photo {
    height: auto;
  }
}

@media (max-width: 600px) {
  .mm-letter-paper {
    padding: 44px 20px 36px;
  }

  .mm-letter-stamp {
    top: 24px;
    right: 16px;
    width: 44px;
    height: 54px;
  }

  .mm-letter-greeting {
    padding-right: 50px;
  }
}

/* ---------------------------------------------------------
   Narrow ball cards (under 300px: 5, 4 or 3 across, and
   phones). The "15 lb core" label goes above RG / Diff /
   PSA, which don't fit beside it at 232px.
--------------------------------------------------------- */
@container (max-width: 299px) {
  .mm-spec-strip {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .mm-spec-label {
    flex-basis: 100%;
    max-width: none;
  }
}
