/* =========================================================================
 * ap-product.css — the single-product (PDP) layer. P4.
 *
 * Ported verbatim from source-cdp/app.css lines 534-563 (the `.pdp*` and
 * `.coa-block` families) plus the `@media (max-width: 1000px)` collapse at
 * line 859. Loaded ONLY on is_product().
 *
 * ⛔ Deliberately NOT redefined here — ap-tokens.css already ships them and a
 * second copy is how two selectors drift apart:
 *     .crumbs · .lab-line / .pdp .lab-line · .sizes-tiles + every .size-*
 *     .qty · .callout · .stock · .tag · .price / .was · .eyebrow
 *     .btn / .btn-primary / .btn-ghost / .btn-sm · .link-u · .section · .wrap
 *     .pdp-price .per-vial
 * ap-pages.css ships .pdp-calc and the COA lightbox.
 *
 * ⚠️ Fonts: headings Georgia (--display), body self-hosted InterVariable.
 * Do NOT pin `opsz` or otherwise touch font metrics — our Inter renders ~7%
 * wider than the source's system fallback at 14px. Known, accepted, ratified;
 * changing it would shift every string site-wide.
 * ========================================================================= */

/* -------------------------------------------------------------------------
 * Layout
 * ---------------------------------------------------------------------- */
.pdp {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  padding: 22px 0 76px;
  align-items: start;
}

/* -------------------------------------------------------------------------
 * Gallery
 * ---------------------------------------------------------------------- */
.pdp-img {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 1 / 1;
  position: sticky;
  top: 96px;
  background:
    radial-gradient(70% 60% at 50% 26%, rgba(91, 143, 224, 0.16), transparent 72%),
    #060a14;
}
.pdp-img img { width: 100%; height: 100%; object-fit: cover; }
.pdp-img .art { display: block; width: 100%; height: 100%; padding: 28px 0 8px; }

/* The source's stage is a bare <div> with no rule of its own, so the image's
   height:100% resolves against an auto-height parent. We keep that exactly —
   adding a height here would change the crop on every photo. */

.pdp-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* ✅ THE ONE APPROVED DEVIATION FROM SOURCE ON THIS PAGE (user, 2026-11-17).
 *
 * `.pdp-img` above is `position: sticky; top: 96px`, exactly as the source has
 * it. A sticky element is offset VISUALLY without affecting its siblings'
 * layout, so the pinned 580px-square photo sits ON TOP of this thumbnail
 * strip as the strip scrolls underneath it — and `elementFromPoint` at a
 * thumb centre returns the pinned IMG, so the click never reaches the thumb.
 *
 * Measured by the overseer: at 1440×900 only 3 of 18 scroll positions with a
 * thumb visible were clickable; at 1280×643, 0 of 14 — every photo after the
 * first is permanently unreachable. The SOURCE returns hit=IMG identically at
 * all five viewports, so the defect is INHERITED, not ours.
 *
 * ⚠️ We normally keep an inherited source bug (see the trust copy, shipped
 * verbatim). The user's ruling here is the opposite and the distinction is the
 * point: design fidelity defers to the source, BROKEN INTERACTION does not.
 *
 * Chosen because it moves nothing — stacking order only, zero layout effect,
 * so the 34-selector × 3-viewport box diff against the source stays valid. */
.pdp-thumbs { position: relative; z-index: 1; }
.pdp-thumbs button {
  width: 66px;
  height: 66px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: #060a14;
}
.pdp-thumbs button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pdp-thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* -------------------------------------------------------------------------
 * Head + body
 * ---------------------------------------------------------------------- */
.pdp h1 {
  font-family: var(--display);
  font-size: clamp(30px, 3.9vw, 48px);
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 12px 0 8px;
  font-weight: 400;
}
.pdp .sub { color: var(--muted); font-size: 16px; margin: 0 0 18px; }
.pdp .price { font-size: 27px; }
.pdp-buy { display: flex; gap: 12px; margin: 24px 0; flex-wrap: wrap; }

.pdp-desc {
  color: var(--body);
  white-space: pre-line;
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 22px;
}
/* The template prints the description as a RAW TEXT NODE, exactly like the
   source — `white-space: pre-line` above is what turns the stored "\n\n" into
   the paragraph break, and running it through wpautop as well produced a
   doubled gap (131.83px vs the source's 95.54px for identical text).
   All 25 descriptions are plain text today; these two rules are only a safety
   net for a client who later pastes markup into the editor. */
.pdp-desc > p { margin: 0 0 12px; }
.pdp-desc > p:last-child { margin-bottom: 0; }

/* -------------------------------------------------------------------------
 * Spec tiles
 * ---------------------------------------------------------------------- */
.pdp-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  overflow: hidden;
  margin: 22px 0 0;
}
.pdp-specs div { background: rgba(8, 11, 20, 0.9); padding: 14px 16px; }
.pdp-specs b { display: block; font-size: 15px; color: var(--text); font-family: var(--mono); font-weight: 700; }
.pdp-specs span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

/* -------------------------------------------------------------------------
 * COA block — the PDP's own component.
 * NOTE this is NOT `.coa-links > .coa-chip` (the lab-tests page's shape,
 * styled in ap-pages.css). app.css styles both; the source PDP uses these.
 * ---------------------------------------------------------------------- */
.coa-block {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 16px 18px;
  background: var(--panel);
}
.coa-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--text); }
.coa-head svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.coa-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}
.coa-row:hover { color: var(--accent-2); }
.coa-row small {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* -------------------------------------------------------------------------
 * `.hero-actions` is a source primitive (app.css:221) that currently lives
 * only in ap-home.css, which is enqueued on the front page alone. The PDP's
 * "Calculate a dose ↓" / "All lab tests" row needs it, so it is repeated here
 * byte-identically. If a later pass promotes it into ap-tokens.css, delete
 * this block — do not let the two values diverge.
 * ---------------------------------------------------------------------- */
.hero-actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

/* ⛔ Nothing else. Two invented rules lived here and were measured out:
   `.pdp .hero-actions { margin-top: 24px }` (the source has 0, and it was the
   WHOLE of the residual +24.67px the PDP column carried over the source at
   all three widths) and a 17px `.btn svg` override of ap-tokens' 16px, which
   is the source's own value. With both gone every child of the PDP column
   matches the source to 0.00px. */

/* Busy state while the add-to-cart request is in flight. */
.pdp-buy .btn.is-busy { opacity: 0.6; pointer-events: none; }

/* -------------------------------------------------------------------------
 * Responsive. The source has NO 820px breakpoint — tablet falls in the 900
 * band — and collapses the PDP at 1000 (app.css:859-860).
 * ---------------------------------------------------------------------- */
@media (max-width: 1000px) {
  .pdp { grid-template-columns: 1fr; gap: 26px; }
  .pdp-img { position: static; }
}
