/* DTLR shoe giveaway — mobile-first, self-hosted brand assets (see BRANDING.md).
   Palette: ink #1a1a1a, accent #e92e45, light ground #f2f2f2, muted #737373.
   Accent red is used for text only at display sizes (>= 18px bold); buttons are
   red bg + white text; small text stays ink/muted for contrast.

   Motion: vanilla CSS keyframes/transitions only. EVERY animation is disabled
   by the prefers-reduced-motion block at the end of this file; JS-timed
   sequences check the same media query. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/bebas-neue-latin.woff2') format('woff2');
}

:root {
  --red: #e92e45;
  --red-tint: #fdeaee;
  --ink: #1a1a1a;
  --ground: #f2f2f2;
  --panel: #ffffff;
  --line: #d9d9d9;
  --muted: #737373;
  --good: #1e7a45;   /* semantic in-stock green — distinct from the brand red accent */
  --warn: #b45309;   /* semantic almost-gone amber — genuine scarcity, never a count */
  --bad: #b3261e;    /* semantic sold-out red — darker than the CTA red #e92e45 */
  --font-body: Inter, -apple-system, sans-serif;
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }

/* The wizard drives visibility with the hidden attribute; it must always win,
   even over classes that set an explicit display (e.g. .check-wrap's flex). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  font-size: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

/* Header / footer */
.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 4px solid var(--red);
  background: #000;
}
.brand-logo {
  display: block;
  width: 150px;
  height: auto;
}
.brand-sub {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
}
/* Brand footer — black like the header, restrained; links warm on hover.
   Outbound hrefs only: nothing here fetches, the icons are inline SVGs. */
.site-footer {
  margin-top: 36px;
  padding: 36px 20px 44px;
  background: #000;
  border-top: 4px solid var(--red);
  text-align: center;
  color: #8a8a8a;
  font-size: 0.85rem;
}
.footer-logo {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 14px;
}
.footer-initiative { margin: 0 0 14px; color: #b3b3b3; }
.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 700;
}
.footer-links a {
  color: #d9d9d9;
  text-decoration: none;
  padding: 8px 2px; /* >=44px touch target with the line box */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 140ms ease;
}
.footer-links a:hover, .footer-links a:focus-visible { color: #fff; text-decoration: underline; }
.footer-dot { color: #5c5c5c; }
.footer-social {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 0 0 14px;
  padding: 0;
}
.footer-social a {
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: #8a8a8a;
  border-radius: 50%;
  transition: color 140ms ease;
}
.footer-social a:hover, .footer-social a:focus-visible { color: #fff; }
.footer-social svg { width: 20px; height: 20px; fill: currentColor; }
.footer-copyright { margin: 0; color: #737373; }
.site-footer :focus-visible { outline-color: #fff; }

/* Layout */
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px;
}

.step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-top: 12px;
}

/* Animated step transition — re-triggered by JS on every step change. */
.step-in { animation: step-in 340ms cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes step-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 8vw, 2.9rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 0.85;
  margin: 0.35em 0;
}
h2:focus { outline: none; }
h3 {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 1.6em 0 0.5em;
}

.progress {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Brand-red progress bar that fills across the steps */
.progressbar { margin: 6px 0 0; }
.progressbar-track {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progressbar-fill {
  height: 100%;
  width: 0%;
  background: var(--red);
  border-radius: 999px;
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Alerts */
.alert {
  background: var(--red-tint);
  border: 2px solid var(--red);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
  font-weight: 600;
  color: var(--ink);
  animation: step-in 260ms ease both;
}

/* Skeleton loaders (event payload) */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e7e7e7;
  border-radius: 8px;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-title { height: 44px; width: 62%; margin: 10px 0 22px; }
.skeleton-line { height: 15px; margin: 12px 0; }
.skeleton-line.short { width: 55%; }
.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 22px 0;
}
.skeleton-card { height: 150px; border-radius: 10px; }
.skeleton-btn { height: 56px; margin-top: 24px; }

/* Forms */
label {
  display: block;
  margin: 20px 0 6px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
input, select {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
}
input::placeholder { color: var(--muted); }

/* Registrant fields — single column on phones, composed grid on wider screens */
.field-row { display: grid; gap: 0 16px; }
/* Keep paired inputs baseline-aligned even when one label wraps to two lines:
   each field is a column with the input pinned to the bottom. */
.field-row .field { display: flex; flex-direction: column; }
.field-row .field input { margin-top: auto; }

.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 20px;
  padding: 14px;
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-secondary {
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--ink);
  margin-top: 12px;
}

/* Button loading state — inline spinner set by JS (setBusy) */
.btn.btn-loading::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  vertical-align: -4px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.btn-secondary.btn-loading::before {
  border-color: rgba(26, 26, 26, 0.25);
  border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

:focus-visible, input:focus-visible, .btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
input:focus-visible { border-color: var(--red); outline-offset: 0; }

/* Event facts */
.event-facts { margin: 20px 0; padding: 0; }
.event-facts div {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.event-facts dt {
  flex: 0 0 96px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 3px;
}
.event-facts dd { margin: 0; font-weight: 600; }

/* Event picker cards (2+ open events) */
.event-cards { display: grid; gap: 12px; margin-top: 16px; grid-auto-rows: 1fr; }
.event-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}
.event-card:hover, .event-card:focus-visible { border-color: var(--red); transform: translateY(-1px); }
.event-card .city {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 0.85;
  text-transform: uppercase;
}
.event-card .date {
  display: block;
  margin-top: 8px;
  font-weight: 700;
}
.event-card .loc {
  display: block;
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Step-1 availability — style-card grid (replaces the old department pills).
   Equal-track grid + shared min-height: a card's size NEVER derives from its
   content length. Cards settle in with a subtle stagger (per-card --i from JS).
   Availability stays binary: struck tokens and a whole-card sold-out state,
   never a count.
   --------------------------------------------------------------------------- */
.style-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* mobile 2-up; 3-up from 768px */
  grid-auto-rows: 1fr;
  gap: 10px;
  margin: 12px 0;
}
.style-card {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  animation: card-in 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.style-card-media {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ground);
}
.style-card-media .style-photo { border-radius: 0; }
/* Size-token strip on a translucent scrim overlaying the photo's bottom edge.
   In normal flow with a negative top margin: the first row sits over the
   image; long size runs wrap to further rows that extend gracefully below it
   (the scrim grows downward inside the media box). */
.size-strip {
  list-style: none;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -32px 0 0;
  padding: 5px 6px;
  background: rgba(26, 26, 26, 0.72);
}
.size-token {
  padding: 1px 7px;
  border-radius: 6px;
  background: #eaf6ee;
  color: #14532d;
  border: 1px solid var(--good);
  box-shadow: inset 3px 0 0 var(--good);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.6;
}
/* Almost-gone token: amber — genuine low stock, still selectable */
.size-token.low {
  background: #fdf1e3;
  color: #7c3d0c;
  border: 1px solid var(--warn);
  box-shadow: inset 3px 0 0 var(--warn);
}
/* Sold-out token: red-tinted + strikethrough — color AND shape, never color-only */
.size-token.out {
  background: rgba(120, 30, 30, 0.35);
  border: 1px solid rgba(255, 120, 120, 0.55);
  box-shadow: inset 3px 0 0 var(--bad);
  color: rgba(255, 200, 200, 0.85);
  font-weight: 600;
  text-decoration: line-through;
}

/* Availability legend under the section heading */
.avail-legend {
  display: flex;
  gap: 18px;
  margin: 4px 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.avail-legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}
.avail-legend .legend-in::before { background: var(--good); }
.avail-legend .legend-low::before { background: var(--warn); }
.avail-legend .legend-out::before { background: var(--bad); }
.style-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 8px 4px 2px;
  margin-top: auto;
}
.dept-badge {
  background: var(--ink);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.style-card-name { font-weight: 800; font-size: 0.95rem; line-height: 1.25; }
/* Whole-card sold-out treatment (every size out) */
.style-card-flag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  background: var(--ink);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.style-card.sold-out { border-color: var(--line); background: var(--ground); }
.style-card.sold-out .style-photo { filter: grayscale(1); opacity: 0.55; }
.style-card.sold-out .dept-badge { background: var(--muted); }
.style-card.sold-out .style-card-name { color: var(--muted); }

/* Quiet "← Back" text control at the top of each step card */
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -6px 0 -8px;
  padding: 8px 10px 8px 0;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 140ms ease;
}
.back-link:hover, .back-link:focus-visible { color: var(--ink); }

/* Inline field errors (step 3 inline validation) */
.field-error {
  margin: 6px 0 0;
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 600;
}
/* Informational NON-blocking note in the error slot (e.g. geocoder outage:
   "We couldn't verify that ZIP right now — you can continue."). Amber, not
   red — the field is fine to submit and is never marked invalid. */
.field-error.is-note {
  color: var(--warn);
  font-weight: 500;
}
input[aria-invalid="true"] { border-color: var(--red); }

/* "Get directions" link following the event address */
.directions-link {
  display: inline-block;
  margin-top: 2px;
  color: var(--red);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Lazy keyless Google map embed (event details only) */
.map-wrap { margin: 16px 0 20px; }
.map-embed {
  display: block;
  width: 100%;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ground);
}

.rules {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--red);
  background: var(--ground);
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  color: #333;
}
.rules:empty { display: none; }
.rules :first-child { margin-top: 0; }
.rules :last-child { margin-bottom: 0; }

/* OTP — 6 individual digit boxes */
.otp-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 10px;
  max-width: 380px;
}
/* Narrow phones: tighten the gap so each digit box keeps a >=44px touch target. */
@media (max-width: 400px) {
  .otp-boxes { gap: 5px; grid-template-columns: repeat(6, minmax(44px, 1fr)); max-width: none; }
}
.otp-digit {
  min-height: 58px;
  padding: 0;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  caret-color: var(--red);
  transition: border-color 120ms ease, transform 120ms ease;
}
.otp-digit.filled { border-color: var(--ink); }
.otp-digit:focus-visible { border-color: var(--red); transform: translateY(-1px); }

/* Animated success check (OTP verify + location verified) */
.check-wrap { display: flex; justify-content: center; margin: 18px 0 4px; }
.check-svg { width: 68px; height: 68px; }
.check-circle {
  fill: none;
  stroke: var(--red);
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: draw-stroke 500ms ease-out forwards;
}
.check-mark {
  fill: none;
  stroke: var(--red);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: draw-stroke 320ms 380ms ease-out forwards;
}
@keyframes draw-stroke { to { stroke-dashoffset: 0; } }

/* Location check — radar/pulse while geolocation resolves */
.radar {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 28px auto 12px;
}
.radar-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--red);
  border-radius: 50%;
  opacity: 0;
  animation: radar-pulse 2.4s ease-out infinite;
}
.radar-ring.r2 { animation-delay: 0.8s; }
.radar-ring.r3 { animation-delay: 1.6s; }
.radar-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 7px var(--red-tint);
}
@keyframes radar-pulse {
  0%   { transform: scale(0.12); opacity: 0.9; }
  100% { transform: scale(1); opacity: 0; }
}
.loc-status {
  text-align: center;
  font-weight: 700;
  margin: 10px 0 4px;
}
.loc-guidance {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 6px auto 0;
  max-width: 40ch;
}

/* ZIP fallback on the location step (denied / timeout / unsupported states) */
.loc-zip-fallback {
  max-width: 340px;
  margin: 22px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.loc-zip-lead {
  margin: 0 0 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

/* Securing theater — staged sequence bound to the real request lifecycle */
.secure-stages { list-style: none; margin: 24px 0 8px; padding: 0; }
.secure-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  opacity: 0.45;
  transition: opacity 260ms ease, color 260ms ease;
}
.secure-stage:last-child { border-bottom: 0; }
.secure-stage.active, .secure-stage.done { opacity: 1; color: var(--ink); }
.stage-icon {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-radius: 50%;
}
.secure-stage.active .stage-icon {
  border-color: var(--red);
  border-top-color: transparent;
  animation: spin 800ms linear infinite;
}
.secure-stage.done .stage-icon {
  border-color: var(--red);
  background: var(--red);
  animation: none;
}
.secure-stage.done .stage-icon::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* Recipient cards (one per reserved pair) */
.recipient-card {
  margin-top: 24px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 10px;
}
.recipient-card legend {
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  padding: 0 6px;
}
/* Direct child only — must NOT reach the <label> choice cards nested in the
   radiogroups (that reintroduces the uneven-card bug). */
.recipient-card > label:first-of-type { margin-top: 4px; }

fieldset { border: 0; margin: 0; padding: 0; }
fieldset.recipient-card { border: 2px solid var(--line); padding: 16px; }

/* Radio choice cards (departments, styles, slots).
   LAYOUT DISCIPLINE: every card group is an equal-track grid with
   grid-auto-rows: 1fr — a card's size NEVER derives from its label length. */
.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  grid-auto-rows: 1fr;
}
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0; /* choice cards are <label>s — the generic label margin must NOT
                apply, or cards size unevenly (the "Men's card bigger" bug) */
  min-height: 52px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.choice input[type="radio"] {
  width: 22px; height: 22px;
  min-height: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--red);
}
.choice:has(input:checked) { border-color: var(--red); background: var(--red-tint); }
.choice.disabled { opacity: 0.5; cursor: not-allowed; }
.choice .meta { margin-left: auto; font-size: 0.8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.choice .meta.full { color: var(--ink); font-weight: 800; }
.choice .meta.low { color: var(--warn); font-weight: 800; }  /* "Filling fast" urgency */

/* Step 3 — department + style cards on equal 2-up tracks. Same visual system
   as the size cards: hidden radio, centered column, checked = red border+tint. */
.dept-list, .style-list {
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.dept-list .choice, .style-list .choice {
  position: relative;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 3px;
  min-height: 72px;
  padding: 12px 8px;
  font-size: 0.95rem;
  font-weight: 800;
}
.dept-list .choice input[type="radio"], .style-list .choice input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}
.dept-list .choice:has(input:focus-visible), .style-list .choice:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.dept-list .choice .meta, .style-list .choice .meta {
  margin-left: 0;
  font-size: 0.7rem;
}

/* Shoe photo — FIXED aspect box so equal-track card grids never go ragged;
   object-fit: contain on a light ground. .no-photo is the graceful fallback
   (null imageUrl, or a load error caught by JS): a neutral shoe silhouette. */
.style-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--ground);
  border-radius: 8px;
  overflow: hidden;
}
.style-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.style-photo.no-photo {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cpath d='M6 28 C7 21 12 19 17 16 C21 13.6 24 10 27 11.5 C29 12.5 30 15 34 17 C42 21 52 22 57 25 C60 26.8 60 29 60 30 L60 31 L6 31 Z' fill='%23c9c9c9'/%3E%3Crect x='5' y='32' width='56' height='4' rx='2' fill='%23c9c9c9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 44% auto;
}

/* Style cards get a little more room for the photo */
.style-list .choice { padding: 10px 10px 12px; }
.style-list .choice .style-photo { margin-bottom: 3px; }

/* Resolved-style preview above the size grid — the shoe being size-picked */
.style-preview { margin: 18px 0 4px; }
.style-preview .style-photo { max-width: 260px; margin: 0 auto; }
.preview-caption {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.95rem;
}
.preview-caption .preview-style-num {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Size cards — equal-track grid; each card reserves a style_sizes row */
.size-hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; }
.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  grid-auto-rows: 1fr;
  gap: 8px;
  margin-top: 8px;
}
.size-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin: 0; /* also a <label> — see .choice */
  min-height: 60px;
  padding: 8px 4px;
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.size-choice input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}
.size-choice { border-left: 5px solid var(--good); }  /* in-stock: green edge */
.size-choice.low { border-left: 5px solid var(--warn); }  /* almost gone: amber edge */
.size-choice .size-low {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warn);
}
.size-choice:has(input:checked) { border-color: var(--red); border-left-color: var(--red); background: var(--red-tint); }
.size-choice:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
/* Sold-out sizes: red edge + dimmed + disabled — color AND state, no count text ever */
.size-choice.disabled { opacity: 0.5; cursor: not-allowed; border-left: 5px solid var(--bad); }
.size-choice.disabled .size-num { text-decoration: line-through; }
.size-choice .size-num { font-size: 1.05rem; font-weight: 800; line-height: 1.15; }

.remove-recipient {
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
  padding: 10px 0;
  min-height: 44px;
}

/* Confirmation + existing reservation */
.code-caption {
  margin: 24px 0 6px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-align: center;
}
.family-code {
  margin: 0 0 20px;
  padding: 0.3em 0.2em 0.18em;
  border: 4px solid var(--red);
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 17vw, 5.2rem);
  line-height: 0.85;
  letter-spacing: 0.04em;
  text-align: center;
  overflow-wrap: anywhere;
  perspective: 500px;
}
/* Family-code reveal: characters flip/settle in (per-char --i from JS) */
.family-code .code-char {
  display: inline-block;
  animation: char-flip 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes char-flip {
  from { opacity: 0; transform: rotateX(-88deg) translateY(0.1em); }
  to   { opacity: 1; transform: none; }
}
.qr-wrap { margin: 0 0 20px; text-align: center; }
.qr-wrap:has(img[hidden]) { margin: 0; }
.qr-img {
  width: 232px;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: #fff;
}
/* QR fades in after the code settles (delay set inline by JS) */
.qr-img.qr-reveal { animation: fade-in 640ms ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.bring-list { padding-left: 20px; }
.bring-list li { margin: 6px 0; }
.fine-print { color: var(--muted); font-size: 0.85rem; }

.turnstile-slot { margin-top: 16px; }
.turnstile-slot:empty { margin: 0; }

/* Sizes-are-final notice (size picker + confirmation) */
.sizes-note {
  margin: 20px 0 0;
  padding: 10px 14px;
  background: var(--red-tint);
  border-left: 4px solid var(--red);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  font-weight: 600;
}

/* FAQ (admin-entered, rendered at the bottom of the page) */
.faq-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 0; padding-bottom: 0; }
.faq-q { margin: 0 0 4px; }
.faq-a { margin: 0; color: #333; font-size: 0.95rem; }
.faq-contact { margin: 16px 0 0; font-weight: 600; }
.faq-contact a { color: var(--red); }

/* ---------------------------------------------------------------------------
   Responsive composition. QA gate: every step reviewed at 375 / 768 / 1280.
   --------------------------------------------------------------------------- */
@media (min-width: 640px) {
  .wrap { padding: 32px 20px; }
  .step { padding: 28px; }
  .dept-list, .style-list { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row .field-wide { grid-column: 1 / -1; }
  .slot-list { grid-template-columns: repeat(2, 1fr); }
  .event-cards { grid-template-columns: repeat(2, 1fr); }
  .style-cards, .skeleton-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .wrap { max-width: 880px; }
  h2 { font-size: 3.2rem; }
  /* Recipient cards side-by-side on desktop */
  #recipients {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: stretch;
    margin-top: 24px;
  }
  #recipients .recipient-card { margin-top: 0; }
  .dept-list, .style-list { grid-template-columns: repeat(3, 1fr); }
  .size-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

/* ---------------------------------------------------------------------------
   Reduced motion: every keyframe/transition collapses to an instant state.
   JS-timed sequences check the same media query (see app.js reducedMotion()).
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
