/*
 * shop.css — Shop / Recovery Stack collection page (PLAN Step 10). Consumes
 * tokens.css only; zero literals outside the sanctioned @media breakpoints (each
 * commented with its --bp-* token name). Enqueued only on the `shop` page slug
 * (see functions.php).
 *
 * The card idiom borrows the product page's cross-sell cards (.crosssell-* in
 * product.css) — surface panel, hairline edge, brand-edged featured card,
 * bottom-aligned price foot — re-expressed here as its own file (file-per-concern).
 * Reuses the shared components (.price, .media-placeholder, and, from sub-step 2,
 * .btn) from components.css.
 *
 * Sub-step 1: intro + the clean grid (media + live price). Sub-step 2: per-card
 * CTAs (ghost "View" → product pages; primary "Buy the stack" → Cart API).
 */

/* — Section rhythm — mirrors .home-section / .product-section cadence. — */
.shop-section {
  padding-block: var(--space-80);
}

/* Grid sits directly under the intro — pull its top padding so the two read as
   one collection block, not two stacked sections. */
.shop-grid-section {
  padding-block-start: 0;
}

/* ============================================================
 * Intro — eyebrow + title + lead (the sitewide section-head pattern).
 * ============================================================ */
.shop-intro {
  padding-block-end: var(--space-48);
}

.shop-intro__head {
  max-width: var(--container-narrow);
}

.shop-intro__eyebrow {
  display: inline-block;
  margin-block-end: var(--space-16);
  font-size: var(--type-caption);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.shop-intro__title {
  margin-block-end: var(--space-24);
  letter-spacing: var(--tracking-tight);
}

.shop-intro__lead {
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

/* ============================================================
 * Grid — gun · panel · bundle. 1-up → 2-up at --bp-md → 3-up at
 * --bp-lg. Cards reuse the cross-sell stack-card idiom.
 * ============================================================ */
.shop-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-24);
}

.shop-card {
  position: relative; /* anchors the .card-link stretched overlay (gun/panel) */
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
  padding: var(--space-24);
  background-color: var(--color-surface);
  border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-none);
  /* Tactile hover cue (Step 14) — flat/clinical: border + surface shift, no
     shadow, no lift. Scoped props (never `all`); reduced-motion drops it below. */
  transition: border-color var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-out);
}

/* Hover/focus-within: edge brightens + surface lifts one step (surface → nested
   surface-2). focus-within so keyboard users get the same cue via the card CTA. */
.shop-card:hover,
.shop-card:focus-within {
  border-color: var(--color-text-muted);
  background-color: var(--color-surface-2);
}

/* Featured (bundle): brand-red edge marks the one you buy — accent, no fill. */
.shop-card--featured {
  border-color: var(--color-brand);
}

/* Featured keeps its brand edge on hover (still lifts the surface). */
.shop-card--featured:hover,
.shop-card--featured:focus-within {
  border-color: var(--color-brand);
  background-color: var(--color-surface-2);
}

@media (prefers-reduced-motion: reduce) {
  .shop-card {
    transition: none;
  }
}

/* Bundle card: its title is the .card-link (→ /recovery-routine/), so the title
   inherits the heading colour and the Add CTA sits above the stretched overlay
   (.card-link::after, z-index 1). The gun/panel CTAs ARE their card links — they
   must stay unpositioned so their ::after stretches over the card. */
.shop-card__title .card-link,
.shop-card__title .card-link:hover {
  color: inherit;
}

.shop-card__cta:not(.card-link) {
  position: relative;
  z-index: 2;
}

.shop-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

/* Pill badge — sanctioned pill shape; brand fill marks the featured card. */
.shop-card__badge {
  align-self: flex-start;
  padding: var(--space-4) var(--space-12);
  font-size: var(--type-caption);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text);
  background-color: var(--color-brand);
  border-radius: var(--radius-pill);
}

.shop-card__title {
  font-family: var(--font-display);
  font-size: var(--type-subheading);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.shop-card__copy {
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

/* Foot bottom-aligns the price + CTA across cards of differing copy length. */
.shop-card__foot {
  margin-block-start: auto;
  padding-block-start: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
}

.shop-card__cta {
  align-self: flex-start;
}

/* Reveal stagger (Step 14) — the cards rise in sequence, not as a block. The
   generic [data-reveal] primitive lives in components.css; this adds only the
   per-card delay. Gated on motion-welcome to match the primitive. */
@media (prefers-reduced-motion: no-preference) {
  /* The card is both [data-reveal] and hover-interactive. The reveal primitive
     (.has-reveal [data-reveal]) sets `transition: opacity, transform` and outranks
     .shop-card, which would drop the hover easing. Restate the full list here
     (same specificity, later source → wins) so BOTH the reveal (opacity/transform)
     and the hover border/surface cue ease. Property order is fixed so the stagger
     delays below can target only the reveal properties. */
  .has-reveal .shop-card {
    transition: opacity var(--duration-slow) var(--ease-out),
                transform var(--duration-slow) var(--ease-out),
                border-color var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
  }

  /* Stagger the cards' reveal in sequence. The delay list maps 1:1 to the four
     transition properties above — applied to the reveal props (opacity/transform)
     only; the hover props stay at 0s so the hover cue is never delayed. */
  .has-reveal .shop-grid > [data-reveal]:nth-child(2) {
    transition-delay: var(--duration-fast), var(--duration-fast), 0s, 0s;
  }

  .has-reveal .shop-grid > [data-reveal]:nth-child(3) {
    transition-delay: calc(var(--duration-fast) * 2), calc(var(--duration-fast) * 2), 0s, 0s;
  }
}

@media (min-width: 768px) /* --bp-md */ {
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-32);
  }
}

@media (min-width: 1024px) /* --bp-lg */ {
  .shop-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
