/* ==========================================================================
   WV PDP Hero — shared base + info column
   --------------------------------------------------------------------------
   Outer section + grid + the right-column info stack (title, rating,
   blurb, contains, accordion, purchase options, ATC). Loaded on every
   PDP regardless of template — both parts/pdp-hero-first5.php and
   parts/pdp-hero-generic.php paint their gallery into the left grid
   cell, and call parts/pdp-hero-info.php for the right cell.

   Class names stay on the legacy .wv-pdp-generic__* namespace pending
   a site-wide BEM rename pass.
   ========================================================================== */

/* PDP dispatcher wrapper — the outer `<div class="wv-pdp">` emitted by
   parts/pdp-{first5,generic,bundle}.php. `overflow-x: clip` contains
   the full-bleed breakout sections (.wv-buy-bar, .wv-buzzword-bar,
   .wv-feat-spot, etc. all use width: 100vw + margin-left: -50vw) so
   they don't overshoot the viewport and trigger horizontal scroll.

   `clip` (not `hidden`) is intentional: clip prevents the overshoot
   without creating a new containing block, which preserves the sticky
   buy bar's position: fixed behavior. `overflow: hidden` would break
   sticky/fixed children. Added 2026-06-05 after F5 PDP horizontal
   overflow surfaced. */
.wv-pdp {
  overflow-x: clip;
}

.wv-pdp-generic {
  max-width: var(--wv-container-max);
  margin: 0 auto;
  padding: 40px var(--wv-page-gutter);
  /* z-index: 1 + opaque page-cream bg cover any tail of MDN's upward
     image bleed that escapes Comp Table's absorbing padding (2026-06-02).
     Otherwise the bleed paints over the hero's transparent areas. */
  position: relative;
  z-index: 1;
  background: var(--wv-color-background);
}

.wv-pdp-generic__grid {
  display: grid;
  grid-template-columns: 6fr 4fr;
  gap: var(--wv-grid-gap);
}

/* ── Info column ──────────────────────────────────────────────────── */

.wv-pdp-generic__info {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wv-pdp-generic__title {
  margin: 0;
}

.wv-pdp-generic__rating-row {
  display: flex;
  align-items: center;
  gap: 12px;
  /* Reduce title → rating gap from parent 24px to effective 14px */
  margin-top: -10px;
}

.wv-pdp-generic__stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.wv-pdp-generic__star {
  width: 16px;
  height: 16px;
  display: block;
}

.wv-pdp-generic__review-count {
  color: var(--wv-color-olive-dark);
  text-transform: uppercase;
}

.wv-pdp-generic__description {
  /* Pull description closer to rating row — effective gap 14px from
     parent 24px, matching the title → rating rhythm. */
  margin-top: -10px;
}

.wv-pdp-generic__description p {
  margin: 0 0 12px;
}

.wv-pdp-generic__description p:last-child {
  margin-bottom: 0;
}

.wv-pdp-generic__contains {
  margin: 0;
}

/* ── Accordion ────────────────────────────────────────────────────── */

.wv-pdp-generic__accordion {
  display: flex;
  flex-direction: column;
}

.wv-pdp-generic__accordion-row {
  border-top: 1px solid var(--wv-color-border);
}

.wv-pdp-generic__accordion-row:last-child {
  border-bottom: 1px solid var(--wv-color-border);
}

.wv-pdp-generic__accordion-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 0;
  background: none;
  border: 0;
  color: var(--wv-color-text-primary);
  cursor: pointer;
  text-align: left;
}

.wv-pdp-generic__accordion-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  object-fit: contain;
}

.wv-pdp-generic__accordion-toggle[aria-expanded="true"] .wv-pdp-generic__accordion-icon {
  /* Designer call 2026-06-01: swap to icon-green-minus PNG on expand
     instead of rotating the plus. CSS `content: url(...)` replaces the
     img's rendered source without touching the src attribute. */
  content: url('../images/icons/icon-green-minus.png');
}

.wv-pdp-generic__accordion-body {
  padding: 0 0 16px;
  color: var(--wv-color-text-secondary);
}

.wv-pdp-generic__accordion-body p {
  margin: 0 0 12px;
}

.wv-pdp-generic__accordion-body p:last-child {
  margin-bottom: 0;
}

/* ── Purchase option cards ────────────────────────────────────────── */

.wv-pdp-generic__purchase-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wv-pdp-generic__purchase-option {
  position: relative;
  display: block;
  border: 1px solid var(--wv-color-border);
  border-radius: var(--wv-radius-sm);
  padding: 14px 20px;
  cursor: pointer;
  transition: border-color 180ms ease;
}

/* Selected state — 1.5px var(--wv-color-text-primary) per design +
   white background to pop the selected card against the page bg.
   Using :has() so the state is purely CSS-driven. */
.wv-pdp-generic__purchase-option:has(.wv-pdp-generic__radio:checked) {
  border: 1.5px solid var(--wv-color-text-primary);
  background: var(--wv-color-card-bg);
}

.wv-pdp-generic__purchase-option-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wv-pdp-generic__radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wv-pdp-generic__radio-visual {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--wv-color-text-primary);
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.wv-pdp-generic__radio:checked ~ .wv-pdp-generic__purchase-option-header .wv-pdp-generic__radio-visual::after,
.wv-pdp-generic__purchase-option:has(.wv-pdp-generic__radio:checked) .wv-pdp-generic__radio-visual::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wv-color-text-primary);
}

.wv-pdp-generic__sub-label-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.wv-pdp-generic__purchase-label {
  flex: 1;
}

/* Inside sub-label-group the label should NOT expand — we want the pill
   sitting right next to "Subscribe & Save" text, not pushed to the end. */
.wv-pdp-generic__sub-label-group .wv-pdp-generic__purchase-label {
  flex: none;
}

.wv-pdp-generic__save-pill {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: var(--wv-radius-pill);
  background: var(--wv-color-accent);
  color: var(--wv-color-text-inverse);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Price pattern — mirrors .wv-card__price design spec.
   No matching typography class exists for 20px/700 or 14px/300, so these
   are declared locally per CLAUDE.md "no class matches — apply closest +
   flag" (nothing is close enough here to be useful). */
.wv-pdp-generic__price {
  font-family: var(--wv-font-primary);
  font-size: 20px;
  font-weight: 700;
  color: var(--wv-color-text-primary);
  white-space: nowrap;
}

/* Sale price coral — explicitly authorized by user 2026-06-04 for the
   PDP price sale context. The token --wv-color-quiz is named for its
   one canonical home (quiz UI), so using it here is intentionally
   loose semantics — user signed off on the "goofiness." Do not
   replicate the pattern elsewhere; route any other non-quiz coral
   needs through a separate approval. */
.wv-pdp-generic__price--sale {
  color: var(--wv-color-quiz);
}

.wv-pdp-generic__price-strike {
  font-family: var(--wv-font-primary);
  font-size: 14px;
  font-weight: 300;
  color: var(--wv-color-surface-2);
  text-decoration: line-through;
  margin-right: 6px;
}

.wv-pdp-generic__delivery-helper {
  margin: 12px 0 0;
  color: var(--wv-color-text-secondary);
}

.wv-pdp-generic__benefits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.wv-pdp-generic__benefit-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wv-pdp-generic__benefit-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  object-fit: contain;
}

.wv-pdp-generic__benefit-label {
  text-transform: uppercase;
  color: var(--wv-color-text-primary);
}

/* ── Add to Cart row ──────────────────────────────────────────────── */

.wv-pdp-generic__atc-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.wv-pdp-generic__atc-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  background: var(--wv-color-accent);
  color: var(--wv-color-text-inverse);
  border: 0;
  border-radius: var(--wv-radius-lg);
  text-transform: uppercase;
  cursor: pointer;
  transition: background 180ms ease;
  white-space: nowrap;
}

.wv-pdp-generic__atc-btn:hover:not(:disabled) {
  background: var(--wv-color-atc-hover);
}

.wv-pdp-generic__atc-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Mobile-first: stacked columns; restored to 6fr 4fr grid at tablet+ */

.wv-pdp-generic {
  padding: 24px var(--wv-page-gutter);
}

.wv-pdp-generic__grid {
  grid-template-columns: 1fr;
  gap: 32px;
}

/* Mobile: pull ATC up between variant row and purchase options so the
   Buy CTA sits in the visible viewport without scrolling. .wv-pdp-generic__info
   is display: flex / column, so `order` reorders the visual sequence
   without touching DOM order. Note: screen readers follow DOM order
   (variant → purchase → atc) regardless. Restored to natural order
   at tablet+ where the desktop layout has room for the ATC at the bottom. */
.wv-pdp-generic__atc-row { order: 1; }
.wv-pdp-generic__purchase-options { order: 2; }

/* Generic PDP mobile only: descriptions are long on generic products,
   so pull variant + ATC up between rating and description (instead of
   the F5/Bundle position above purchase options). Buy controls stay
   above the fold even on long-copy SKUs. Scoped to .wv-pdp--generic
   so F5 + Bundle keep the all-PDP reorder above. */
.wv-pdp--generic .wv-pdp-generic__variant-row     { order: 1; }
.wv-pdp--generic .wv-pdp-generic__atc-row         { order: 2; }
.wv-pdp--generic .wv-pdp-generic__description     { order: 3; }
.wv-pdp--generic .wv-pdp-generic__contains        { order: 4; }
.wv-pdp--generic .wv-pdp-generic__accordion       { order: 5; }
.wv-pdp--generic .wv-pdp-generic__purchase-options { order: 6; }

/* S&S strikeout price hidden at mobile — the "Save 10%" pill and the
   strike text overlap inside the narrower mobile card. Sale price
   reads on its own; tablet+ restores the strikeout so the saving is
   re-emphasized at the desktop width. User direction 2026-06-05. */
.wv-pdp-generic__price-strike {
  display: none;
}

@media (min-width: 768px) {
  .wv-pdp-generic {
    padding: 40px var(--wv-page-gutter);
  }

  .wv-pdp-generic__grid {
    grid-template-columns: 6fr 4fr;
    gap: var(--wv-grid-gap);
  }

  .wv-pdp-generic__atc-row { order: 0; }
  .wv-pdp-generic__purchase-options { order: 0; }

  /* Generic-specific reorder restored to natural DOM at tablet+ */
  .wv-pdp--generic .wv-pdp-generic__variant-row,
  .wv-pdp--generic .wv-pdp-generic__atc-row,
  .wv-pdp--generic .wv-pdp-generic__description,
  .wv-pdp--generic .wv-pdp-generic__contains,
  .wv-pdp--generic .wv-pdp-generic__accordion,
  .wv-pdp--generic .wv-pdp-generic__purchase-options { order: 0; }

  /* S&S strikeout restored at tablet+ — card is wide enough for the
     strike + Save 10% pill to sit cleanly side-by-side. */
  .wv-pdp-generic__price-strike {
    display: inline;
  }
}

/* ── Variant row ───────────────────────────────────────────────────
   Two-column wrapper: variation selector (variable products) on the
   left, BIS panel (OUT OF STOCK + H6 + signup form) on the right.
   align-items: flex-start so OUT OF STOCK lines up at the top with the
   SIZE caption. For simple OOS products only the BIS panel renders;
   data-variant="none" on the row centers it.                          */

.wv-pdp-generic__variant-row {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

.wv-pdp-generic__variant-row[data-variant="none"] {
  justify-content: center;
  text-align: center;
}

/* OUT OF STOCK label — bespoke styling: no global typography class
   covers mono / 20px / Demi weight in warning color. Flagged per
   Rule 3 of CLAUDE.md (closest is .wv-label-small at 12px). */
.wv-pdp-generic__oos-label {
  font-family: var(--wv-font-mono);
  font-weight: 500;
  font-size: 20px;
  line-height: 1;
  color: var(--wv-color-warning);
  text-transform: uppercase;
  letter-spacing: -0.03em;
}

/* ── Variation selector ────────────────────────────────────────────
   Variable products only — pill button + dropdown listbox.
   Visual language adapted from the product card's
   .wv-card__count-pill--variable but scaled for the PDP context.
   Wired by WVPdpVariations in wv-pdp-hero-info.js. */

.wv-pdp-generic__variant-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.wv-pdp-generic__variant-label {
  text-transform: uppercase;
  color: var(--wv-color-text-secondary);
}

.wv-pdp-generic__variant-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  align-self: flex-start;
  min-width: 140px;
  height: 44px;
  padding: 0 16px;
  background: var(--wv-color-card-bg);
  border: 1.5px solid var(--wv-color-text-primary);
  border-radius: var(--wv-radius-sm);
  color: var(--wv-color-text-primary);
  cursor: pointer;
  font-family: var(--wv-font-primary);
  font-size: 15px;
  font-weight: 600;
  transition: border-color var(--wv-transition-fast);
}
.wv-pdp-generic__variant-pill:hover {
  border-color: var(--wv-color-accent);
}
.wv-pdp-generic__variant-pill[aria-expanded="true"] {
  border-color: var(--wv-color-accent);
}
.wv-pdp-generic__variant-pill-chevron {
  flex-shrink: 0;
  transition: transform var(--wv-transition-fast);
}
.wv-pdp-generic__variant-pill[aria-expanded="true"] .wv-pdp-generic__variant-pill-chevron {
  transform: rotate(180deg);
}

.wv-pdp-generic__variant-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--wv-color-card-bg);
  border: 1px solid var(--wv-color-border);
  border-radius: var(--wv-radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.wv-pdp-generic__variant-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--wv-radius-sm);
  cursor: pointer;
  transition: background var(--wv-transition-fast);
}
.wv-pdp-generic__variant-option:hover {
  background: var(--wv-color-surface);
}
.wv-pdp-generic__variant-option--active {
  background: var(--wv-color-surface);
}

.wv-pdp-generic__variant-option-label {
  flex: 1;
  font-family: var(--wv-font-primary);
  font-weight: 600;
  font-size: 15px;
  color: var(--wv-color-text-primary);
}
.wv-pdp-generic__variant-option-price {
  font-family: var(--wv-font-primary);
  font-weight: 400;
  font-size: 14px;
  color: var(--wv-color-text-secondary);
  white-space: nowrap;
}
.wv-pdp-generic__variant-option-oos {
  text-transform: uppercase;
  color: var(--wv-color-surface-2);
}

.wv-pdp-generic__variant-option--oos {
  cursor: not-allowed;
  opacity: 0.55;
}
.wv-pdp-generic__variant-option--oos:hover {
  background: transparent;
}
.wv-pdp-generic__variant-option--oos .wv-pdp-generic__variant-option-price {
  text-decoration: line-through;
}

/* ── Back-in-Stock panel ───────────────────────────────────────────
   Right column of the variant row. Vertical stack: OUT OF STOCK label
   + H6 prompt + plugin signup form. For variable products, one form
   per OOS variation is rendered inside, gated by data-wv-pdp-bis-variation;
   JS shows the active one. Hidden by default when the page loads with
   the in-stock default variation; JS unhides on OOS pick.            */
.wv-pdp-generic__bis-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 240px;
  max-width: 360px;
}
/* `display: flex` overrides the browser's default `[hidden]{display:none}`,
   so we have to explicitly restore it for the attribute toggle to work. */
.wv-pdp-generic__bis-panel[hidden] {
  display: none;
}

.wv-pdp-generic__variant-row[data-variant="none"] .wv-pdp-generic__bis-panel {
  align-items: center;
}

/* H6 prompt sits between OOS label and the plugin form. */
.wv-pdp-generic__bis-prompt {
  margin: 0;
}
.wv-pdp-generic__bis-disclaimer {
  margin: 0;
  color: var(--wv-color-text-secondary);
}

/* Hide the plugin's own form title — our H6 prompt replaces it. */
.wv-pdp-generic__bis-panel .wc_bis_form_title {
  display: none;
}

/* Notify-me button — shape mirrored from .wv-first5__btn-primary
   (44px tall, 28px horizontal pad, uppercase) but olive-accent fill
   to differentiate from the dark ATC. Scoped to the BIS panel. */
.wv-pdp-generic__bis-panel .wc_bis_send_form {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 28px;
  background: var(--wv-color-accent);
  color: var(--wv-color-text-inverse);
  font-family: var(--wv-font-primary);
  font-weight: 400;
  font-size: 15.6px;
  line-height: 19.8px;
  letter-spacing: -0.47px;
  text-transform: uppercase;
  border: 0;
  border-radius: var(--wv-radius-sm);
  cursor: pointer;
  transition: background var(--wv-transition-base);
}
.wv-pdp-generic__bis-panel .wc_bis_send_form:hover {
  background: var(--wv-color-olive-dark);
}

/* Email input (logged-out customers only) — match site form style.
   16px font-size on mobile prevents iOS auto-zoom on focus. */
.wv-pdp-generic__bis-panel #wc_bis_email {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--wv-color-card-bg);
  border: 1.5px solid var(--wv-color-text-primary);
  border-radius: var(--wv-radius-sm);
  color: var(--wv-color-text-primary);
  font-family: var(--wv-font-primary);
  font-size: 16px;
  line-height: 1.5;
}
.wv-pdp-generic__bis-panel #wc_bis_email:focus {
  outline: none;
  border-color: var(--wv-color-accent);
}
