/* ════════════════════════════════════════════════════════════════
   Penworthy — product page (PDP) bundle
   Gallery, thumbnails, fullscreen lightbox, review star picker.
   Ported from design-reference/styles.css.
   ════════════════════════════════════════════════════════════════ */

/* ── Product gallery ── */
.pw-gallery-main {
  position: relative;
  width: 100%;
  border-radius: var(--pw-r);
  overflow: hidden;
  background: var(--pw-blue-tint);
}
.pw-gallery-main > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
  animation: pw-gallery-fade .35s ease;
}
.pw-gallery-main.is-clickable { cursor: zoom-in; }
.pw-gallery-main.is-clickable:hover > img { transform: scale(1.04); }
@keyframes pw-gallery-fade { from { opacity: 0; } to { opacity: 1; } }

.pw-gallery-zoom {
  position: absolute;
  left: 10px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: var(--pw-pill);
  background: rgba(20,28,38,.6);
  color: #fff; font-size: 12px; font-weight: 600;
  backdrop-filter: blur(4px);
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.pw-gallery-main.is-clickable:hover .pw-gallery-zoom { opacity: 1; transform: none; }

.pw-thumbs {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pw-thumb {
  width: 74px;
  flex: 0 0 auto;
  border-radius: var(--pw-r-sm);
  overflow: hidden;
  border: 1.5px solid var(--pw-line);
  background: var(--pw-blue-tint);
  cursor: pointer;
  padding: 0;
  transition: border-color .15s, transform .1s;
}
.pw-thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pw-thumb:hover { border-color: var(--pw-blue-tint-2); }
.pw-thumb.is-active { border-color: var(--pw-blue); box-shadow: 0 0 0 1px var(--pw-blue); }

/* ── Fullscreen image viewer ── */
.pw-lightbox {
  position: fixed; inset: 0;
  z-index: 4000;
  background: rgba(15,21,29,.9);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 76px 92px 128px;
  overflow: hidden;
  animation: pw-lb-in .2s ease;
}
@keyframes pw-lb-in { from { opacity: 0; } to { opacity: 1; } }

.pw-lb-stage { margin: 0; display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.pw-lb-img {
  max-width: min(1000px, 90vw);
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  cursor: zoom-in;
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
}
.pw-lb-img.is-zoom { transform: scale(2.3); cursor: zoom-out; transition: transform .2s ease; }

.pw-lb-close {
  position: absolute; top: 20px; right: 24px;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12); color: #fff;
  cursor: pointer; transition: background .15s;
}
.pw-lb-close:hover { background: rgba(255,255,255,.24); }

.pw-lb-count {
  position: absolute; top: 30px; left: 32px;
  color: rgba(255,255,255,.85); font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pw-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.1); color: #fff;
  cursor: pointer; transition: background .15s;
}
.pw-lb-nav:hover { background: rgba(255,255,255,.22); }
.pw-lb-prev { left: 20px; }
.pw-lb-next { right: 20px; }

.pw-lb-foot {
  position: absolute; bottom: 22px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 0 20px;
}
.pw-lb-cap { color: rgba(255,255,255,.92); font-size: 14px; font-weight: 600; text-align: center; }
.pw-lb-cap > span { display: block; color: rgba(255,255,255,.5); font-size: 12px; font-weight: 500; margin-top: 3px; }

.pw-lb-thumbs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; max-width: 90vw; }
.pw-lb-thumb {
  width: 58px; height: 44px; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; opacity: .5; cursor: pointer; padding: 0;
  transition: opacity .15s, border-color .15s;
}
.pw-lb-thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pw-lb-thumb:hover { opacity: 1; }
.pw-lb-thumb.is-active { opacity: 1; border-color: #fff; }

@media (max-width: 640px) {
  .pw-lightbox { padding: 64px 16px 120px; }
  .pw-lb-nav { width: 44px; height: 44px; }
  .pw-lb-prev { left: 8px; }
  .pw-lb-next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .pw-gallery-main > img, .pw-lb-img { transition: none; animation: none; }
}

/* ── Review star picker (inside the write-a-review modal) ── */
.pw-star-pick { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.pw-star-pick button { display: inline-flex; cursor: pointer; padding: 2px; }
.pw-star-pick > span { margin-left: 12px; font-size: 14px; color: var(--pw-ink-3); font-weight: 600; }

/* ── Product page: gallery is only sticky when it has its own column ── */
@media (max-width: 900px) {
  .pdp-gallery-col { position: static !important; }
}

/* — page-specific conversions appended below — */

/* ════════════════════════════════════════════════════════════════
   PDP conversions — inline JSX styles from pages/product.jsx ported
   to classes. Buy box, pills, tabs, quick facts, reviews, related
   strip, sticky mobile buy bar.
   ════════════════════════════════════════════════════════════════ */

/* ── Breadcrumb ── */
.pw-crumb { font-size: 14px; color: var(--pw-ink-3); margin-bottom: 24px; }
.pw-crumb a:hover { color: var(--pw-blue); }
.pw-crumb-sep { margin: 0 8px; }
.pw-crumb-here { color: var(--pw-blue); }

/* ── Two-column layout (gallery sticky left · details right) ── */
.pw-pdp-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: start; }
.pdp-gallery-col { position: sticky; top: 102px; }

/* Kits photograph landscape — JSX set the ratio inline */
.pw-gallery-main { aspect-ratio: 4 / 3; }
.pw-thumb { aspect-ratio: 4 / 3; }

/* No-photo fallback tile */
.pw-gallery-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 24px;
  color: var(--pw-blue); text-align: center;
}
.pw-gallery-empty-name { font-family: var(--pw-display); font-weight: 700; font-size: 20px; }

/* ── Trust chips under the gallery ── */
.pw-trust-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pw-trust-chip { padding: 12px 10px; background: var(--pw-bg-2); border-radius: var(--pw-r); text-align: center; }
.pw-trust-ic { color: var(--pw-blue); display: inline-flex; }
.pw-trust-t { font-size: 12px; font-weight: 700; color: var(--pw-ink); margin-top: 6px; }

/* ── Title · pills · rating ── */
.pw-pdp-title { font-size: clamp(28px, 4vw, 38px); color: var(--pw-ink); margin-top: 0; }
.pw-pdp-pills {
  font-size: 16px; margin-top: 8px; color: var(--pw-ink-2);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.pw-pdp-pills .pill-blue { font-weight: 600; }
.pw-pdp-rating { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.pw-pdp-rating-txt { font-size: 14px; color: var(--pw-ink-2); }
.pw-stars { display: inline-flex; color: var(--pw-tan); }
.pw-star { display: inline-flex; }
.pw-star.is-dim { opacity: .25; }

/* ── Price row + stock pill ── */
.pw-pdp-price-row { margin-top: 20px; display: flex; align-items: baseline; gap: 12px; }
.pw-pdp-price { font-size: 38px; font-weight: 700; color: var(--pw-ink); }
.pw-pdp-price-note { font-size: 14px; color: var(--pw-ink-3); }
.pw-stock-pill { margin-top: 10px; }
.pw-stock-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
/* Amber low-stock ink from the prototype (pill ink pattern, cf. base.css .pill-coral) */
.pw-stock-low { background: var(--pw-yellow-light); color: #9A6B12; font-weight: 700; }

.pw-pdp-intro { margin-top: 20px; line-height: 1.7; color: var(--pw-ink-2); }

/* ── Buy row: save · quantity · add to cart ── */
.pw-buy-row { margin-top: 26px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.pw-save-btn { padding: 14px 18px; }
.pw-save-btn .pw-save-heart { display: inline-flex; }
.pw-save-btn .pw-save-txt-on { display: none; }
.pw-save-btn.is-saved-btn .pw-save-txt-on { display: inline; }
.pw-save-btn.is-saved-btn .pw-save-txt-off { display: none; }
.pw-save-btn.is-saved-btn .pw-heart-glyph path { fill: currentColor; stroke-width: 0; }

.pw-qty {
  display: inline-flex; align-items: stretch;
  border: 1.5px solid var(--pw-line);
  border-radius: var(--pw-r);
  background: #fff;
}
.pw-qty-dec, .pw-qty-inc {
  padding: 10px 14px; color: var(--pw-blue);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.pw-qty-dec:hover, .pw-qty-inc:hover { background: var(--pw-blue-tint); }
.pw-qty-input {
  width: 50px; border: none;
  border-left: 1px solid var(--pw-line);
  border-right: 1px solid var(--pw-line);
  border-radius: 0;
  text-align: center; font-size: 18px; font-weight: 600;
  color: var(--pw-ink); outline: none; padding: 0;
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pw-qty-input::-webkit-outer-spin-button,
.pw-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pw-buy-btn { flex: 1; padding: 14px 24px; }
.pw-buy-row.is-busy .pw-buy-btn { opacity: .7; pointer-events: none; }
.pw-buy-lownote { margin-top: 8px; font-size: 13px; color: #9A6B12; font-weight: 600; }

/* ── Restock notify (out of stock swaps the buy row) ── */
.pw-notify { margin-top: 26px; }
.pw-notify-row { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.pw-notify-input { flex: 1; min-width: 200px; width: auto; }
.pw-notify-btn { padding: 14px 22px; }
.pw-notify-hint { margin-top: 10px; font-size: 13px; color: var(--pw-ink-3); }
.pw-notify-error { margin-top: 10px; font-size: 13.5px; font-weight: 600; color: #C4471F; }
.pw-notify-done {
  margin-top: 26px; padding: 16px;
  background: var(--pw-green-light);
  border-radius: var(--pw-r);
  display: flex; gap: 10px; align-items: center;
  font-size: 14.5px; color: #2C7A52; font-weight: 600;
}
.pw-notify-done .pw-i { flex: 0 0 auto; }

/* ── ClassWallet banner ── */
.pw-cw-banner {
  margin-top: 16px; padding: 12px 16px;
  background: var(--pw-yellow-light);
  border-radius: var(--pw-r);
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; color: var(--pw-ink-2);
}
.pw-cw-banner-ic { color: var(--pw-blue); display: inline-flex; flex: 0 0 auto; }

/* ── Quick facts + specs panel ── */
.pw-facts {
  margin-top: 16px; padding: 18px;
  border: 1px solid var(--pw-line);
  border-radius: var(--pw-r-md);
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px; font-size: 14px;
}
.pw-fact-k { color: var(--pw-ink-3); font-size: 12px; }
.pw-fact-v {
  overflow-wrap: anywhere; font-weight: 600; color: var(--pw-ink); }
.pw-specs {
  padding: 24px; background: var(--pw-bg-2);
  border-radius: var(--pw-r-md); align-self: start;
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 16px; font-size: 14px;
}
.pw-specs .pw-fact-v { word-break: break-word; }

/* ── Tabs ── */
.pw-pdp-tabs-sec { margin-top: 60px; }
.pw-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--pw-line); margin-bottom: 24px; overflow-x: auto; }
.pw-tab {
  padding: 14px 24px; font-size: 15px; font-weight: 500;
  color: var(--pw-ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
}
.pw-tab.is-active { font-weight: 700; color: var(--pw-blue); border-bottom-color: var(--pw-blue); }

/* ── Details tab ── */
.pw-details-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; }
.pw-pdp-body { line-height: 1.8; color: var(--pw-ink-2); }
.pw-pdp-body p { margin: 0; }
.pw-pdp-body p + p { margin-top: 14px; }
.pw-included-sec { margin-top: 28px; }
.pw-included-h { font-size: 20px; margin-bottom: 14px; }
.pw-included { display: flex; flex-direction: column; gap: 12px; }
.pw-included-item { display: flex; gap: 12px; align-items: flex-start; }
.pw-included-ic { color: var(--pw-green); margin-top: 3px; flex-shrink: 0; display: inline-flex; }
.pw-included-txt { color: var(--pw-ink-2); line-height: 1.55; }
.pw-keywords { margin-top: 28px; }
.pw-keywords-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Shipping tab ── */
.pw-ship-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pw-ship-card { padding: 20px; }
.pw-ship-ic { color: var(--pw-blue); display: inline-flex; }
.pw-ship-t { font-weight: 700; margin-top: 8px; }
.pw-ship-s { font-size: 13px; color: var(--pw-ink-3); margin-top: 4px; }
.pw-ship-p { margin-top: 8px; font-weight: 600; color: var(--pw-blue); }

/* ── Reviews tab (single-product-reviews.php) ── */
.pw-reviews-grid { display: grid; grid-template-columns: 320px 1fr; gap: 40px; }
.pw-rev-panel { padding: 24px; background: var(--pw-bg-2); border-radius: var(--pw-r-md); align-self: start; }
.pw-rev-avg { font-size: 60px; font-weight: 700; color: var(--pw-blue); line-height: 1; }
.pw-rev-stars-row { margin-top: 6px; }
.pw-rev-count { font-size: 14px; color: var(--pw-ink-3); margin-top: 4px; }
.pw-rev-bars { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.pw-rev-bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--pw-ink-2); }
.pw-rev-bar-star { width: 20px; flex: 0 0 auto; }
.pw-rev-bar-track { flex: 1; height: 6px; background: var(--pw-line); border-radius: 3px; overflow: hidden; }
.pw-rev-bar-fill { height: 100%; background: var(--pw-yellow); }
.pw-rev-bar-pct { width: 30px; text-align: right; flex: 0 0 auto; }
.pw-rev-write { width: 100%; margin-top: 18px; }

/* Write-a-review form (star picker + fields) */
.pw-rev-form-wrap { margin-top: 18px; }
.pw-rev-form-title { font-size: 20px; color: var(--pw-ink); margin: 0 0 4px; }
.pw-rev-field { margin: 14px 0 0; }
.pw-rev-textarea { min-height: 120px; resize: vertical; }
.pw-rev-pick { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
/* Radios are DOM-ordered 5→1 and row-reversed, so hover/:checked general
   siblings color every star to the visual left — no JS needed. */
.pw-star-pick-input {
  display: inline-flex; flex-direction: row-reverse; justify-content: flex-end;
  align-items: center; gap: 2px;
}
.pw-star-pick-input label { display: inline-flex; padding: 2px; cursor: pointer; color: var(--pw-line); transition: color .1s; }
.pw-star-pick-input label:hover,
.pw-star-pick-input label:hover ~ label,
.pw-star-pick-input input:checked ~ label { color: var(--pw-tan); }
.pw-star-pick-input input:focus-visible + label { outline: 2px solid var(--pw-blue); outline-offset: 2px; border-radius: 4px; }
.pw-star-pick-note { font-size: 14px; color: var(--pw-ink-3); font-weight: 600; }
.pw-rev-submit { margin-top: 16px; }
.pw-rev-form .comment-form-cookies-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--pw-ink-3); margin: 14px 0 0; }
.pw-rev-form .comment-form-cookies-consent input { margin-top: 3px; }
.pw-rev-login { font-size: 14px; color: var(--pw-ink-2); }
.pw-rev-login a { color: var(--pw-blue); font-weight: 700; }

/* Review list */
.pw-rev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.pw-rev-item { padding-bottom: 20px; border-bottom: 1px solid var(--pw-line); }
.pw-rev-head { display: flex; align-items: center; gap: 10px; }
.pw-rev-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--pw-blue-tint); color: var(--pw-blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex: 0 0 auto;
}
.pw-rev-name { font-weight: 700; }
.pw-rev-meta { font-size: 12px; color: var(--pw-ink-3); }
.pw-rev-verified { color: var(--pw-green); display: inline-flex; align-items: center; gap: 4px; }
.pw-rev-item .pw-stars { margin-top: 10px; }
.pw-rev-body { margin-top: 6px; color: var(--pw-ink-2); line-height: 1.6; }
.pw-rev-body p { margin: 0; }
.pw-rev-body p + p { margin-top: 8px; }
.pw-rev-pending { margin: 8px 0 0; font-size: 13px; color: #9A6B12; font-weight: 600; }
.pw-rev-none { color: var(--pw-ink-2); font-size: 15px; margin: 0; }
.pw-rev-pagenav { margin-top: 20px; font-size: 14px; }
.pw-rev-pagenav .page-numbers { display: inline-flex; padding: 6px 12px; border-radius: var(--pw-r); color: var(--pw-blue); }
.pw-rev-pagenav .page-numbers.current { background: var(--pw-blue-tint); font-weight: 700; }

/* ── Related strip — "More in this theme" ──
   The strip reuses the canonical shop card (template-parts/shop/card.php),
   so the old .pw-relcard* rules were dead code and have been removed. */
.pw-related { margin-top: 64px; }
.pw-related-title { font-size: 28px; margin-bottom: 20px; }
.pw-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }

/* ── Sticky mobile buy bar (flow gap #6) ── */
.pw-buybar { display: none; }
@media (max-width: 860px) {
  .pw-buybar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 96;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--pw-line);
    box-shadow: 0 -8px 24px rgba(4, 48, 76, .12);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .28s cubic-bezier(.32, .72, .24, 1), visibility 0s linear .28s;
  }
  .pw-buybar[hidden] { display: none; }
  .pw-buybar.is-in {
    transform: none;
    visibility: visible;
    transition: transform .28s cubic-bezier(.32, .72, .24, 1);
  }
  .pw-buybar-info { flex: 1; min-width: 0; }
  .pw-buybar-title {
    font-family: var(--pw-display); font-weight: 700; font-size: 13.5px;
    color: var(--pw-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .pw-buybar-price { font-size: 15px; font-weight: 700; color: var(--pw-ink); font-variant-numeric: tabular-nums; }
  .pw-buybar-btn { padding: 12px 18px; font-size: 15px; flex: 0 0 auto; }
  /* The floating cart pill yields to the bar */
  body.pw-buybar-open .pw-cart-fab { opacity: 0; pointer-events: none; transition: opacity .2s ease; }
}

/* ── Responsive tightening ── */
@media (max-width: 900px) {
  .pw-pdp-grid { gap: 28px; }
  .pw-details-grid, .pw-reviews-grid { gap: 28px; }
}
@media (max-width: 640px) {
  .pw-pdp-tabs-sec { margin-top: 44px; }
  .pw-related { margin-top: 48px; }
  .pw-tab { padding: 12px 16px; }
  .pw-buy-btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pw-buybar { transition: none; }
  .pw-star-pick-input label { transition: none; }
}

/* Mobile audit fixes: last content clears the pinned buy bar; 40px steppers. */
@media (max-width: 860px) {
  body.pw-buybar-open .app-main { padding-bottom: 156px; }
  .pw-qty-dec, .pw-qty-inc { min-height: 40px; min-width: 40px; }
}
.pw-facts > * { min-width: 0; }

/* ── Global product disclaimers (small print above the related strip) ── */
.pw-disclaimers {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px dashed var(--pw-line);
  max-width: 760px;
}
.pw-disclaimer { font-size: 12.5px; line-height: 1.6; color: var(--pw-ink-3); margin: 0 0 8px; }
.pw-disclaimer b { font-weight: 700; color: var(--pw-ink-2); }
