/* ==========================================================================
   WattSwap — product pages (partials/pdp.html). Builds on css/ws-premium.css.
   ========================================================================== */

.pdp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hero ---------- */
.pdp-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: calc(var(--nav-h) + 28px) 0 clamp(56px, 7vw, 104px);
  background: var(--bg);
}
.pdp-hero > .wp-wrap { position: relative; z-index: 2; }
.pdp-aurora { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.pdp-aurora .wp-fx.is-live { opacity: 0.38; }
.pdp-aurora::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(70% 60% at 30% 45%, rgba(1, 3, 8, 0) 0%, rgba(1, 3, 8, 0.55) 100%),
    linear-gradient(to bottom, rgba(1, 3, 8, 0) 70%, var(--bg) 100%);
}

.pdp-crumb { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--t3); margin-bottom: clamp(12px, 2vw, 28px); }
.pdp-crumb a { color: var(--t2); transition: color 0.2s; }
.pdp-crumb a:hover { color: var(--t1); }
.pdp-crumb [aria-current] { color: var(--t1); }

.pdp-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 88px); align-items: center; }

.pdp-media { min-width: 0; }
.pdp-stage {
  width: 100%;
  aspect-ratio: 16 / 10;
  transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.7s var(--ease);
  will-change: transform;
}
.pdp-stage.is-tilting { transition: transform 0.12s linear; }
.pdp-stage img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.32s var(--ease); }
.pdp-stage.is-swap img { opacity: 0; }

.pdp-thumbs { position: relative; z-index: 2; display: flex; gap: 12px; justify-content: center; margin-top: 22px; }
.pdp-thumb {
  width: 92px; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2);
  opacity: 0.6; transition: opacity 0.25s, border-color 0.25s, transform 0.4s var(--ease), box-shadow 0.25s;
}
.pdp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-thumb:hover { opacity: 0.95; transform: translateY(-2px); }
.pdp-thumb[aria-pressed='true'] { opacity: 1; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.25); }
.pdp-thumb:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* Buy panel */
.pdp-buy { max-width: 540px; min-width: 0; }
.pdp-title { margin: 6px 0 14px; font-size: clamp(42px, 5.4vw, 72px); line-height: 1; letter-spacing: -0.045em; font-weight: 650; text-wrap: balance; }
.pdp-headline { margin: 0 0 14px; color: var(--t1); font-size: clamp(17px, 1.5vw, 20px); line-height: 1.4; letter-spacing: -0.01em; text-wrap: pretty; }
.pdp-specline { margin: 0; color: var(--t3); font-size: 13px; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; text-transform: uppercase; }

.pdp-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; margin: 30px 0 8px; }
.pdp-sale { font-size: clamp(44px, 4.6vw, 60px); font-weight: 650; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.pdp-mrp { font-size: 20px; color: var(--t3); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.pdp-disc { padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--mint); background: rgba(0, 245, 160, 0.1); border: 1px solid rgba(0, 245, 160, 0.28); }
.pdp-mrp:empty, .pdp-disc:empty { display: none; }
.pdp-sale:empty::before { content: '—'; color: var(--t3); }
.pdp-stage img { transform: scale(1.14); }

.pdp-tax { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; font-size: 14px; color: var(--t3); }
.pdp-tax span + span::before { content: '·'; margin-right: 10px; color: var(--t3); }
.pdp-tax span:empty { display: none; }
.pdp-tax span:empty + span::before { content: '·'; }

.pdp-note {
  display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; padding: 12px 14px;
  border-radius: 14px; font-size: 14px; line-height: 1.5; color: var(--t1);
  background: rgba(251, 191, 36, 0.07); border: 1px solid rgba(251, 191, 36, 0.28);
}
.pdp-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--warn); }

.pdp-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.pdp-cta [data-ws-stock-live] { flex: 1 0 100%; order: -1; margin: 0 0 2px !important; font-size: 13px !important; }
.pdp-cta .btn-blue { min-width: 200px; flex: 1 1 200px; }

.pdp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pdp-chips .wp-chip svg { width: 15px; height: 15px; flex: none; color: var(--cyan); }

/* ---------- Sticky sub-nav ---------- */
.pdp-sub {
  position: sticky; top: var(--nav-h); z-index: 60;
  background: rgba(1, 3, 8, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-block: 1px solid var(--line);
}
.pdp-sub-in { display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); height: 52px; }
.pdp-sub-name { font-weight: 650; letter-spacing: -0.02em; white-space: nowrap; }
.pdp-sub-links { display: flex; gap: clamp(14px, 2.4vw, 32px); margin-inline: auto; overflow-x: auto; scrollbar-width: none; }
.pdp-sub-links::-webkit-scrollbar { display: none; }
.pdp-sub-links a { position: relative; padding: 6px 0; font-size: 14px; color: var(--t2); white-space: nowrap; transition: color 0.2s; }
.pdp-sub-links a:hover { color: var(--t1); }
.pdp-sub-links a.is-active { color: var(--t1); }
.pdp-sub-links a.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--iri); }
.pdp-sub .btn-sm { flex: none; }

/* ---------- Story ---------- */
.pdp-story { padding-block: clamp(96px, 14vw, 200px); }
.pdp-story .display { max-width: 14ch; margin-inline: auto; }
.pdp-story .lede { max-width: 52ch; }

/* ---------- Anatomy ---------- */
.pdp-explode { width: min(1280px, 100%); margin: clamp(8px, 2vw, 24px) auto 0; aspect-ratio: 16 / 9; will-change: transform; }
.pdp-explode img { width: 100%; height: 100%; object-fit: contain; }
.pdp-anat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 48px); margin-top: clamp(24px, 4vw, 56px); }
.pdp-anat { border-top: 1px solid var(--line-2); padding-top: 22px; }
.pdp-anat .n { display: inline-block; margin-bottom: 14px; font-size: 13px; font-weight: 650; color: var(--cyan); font-variant-numeric: tabular-nums; }
.pdp-anat .n::before { content: '0'; }
.pdp-anat h3 { margin-bottom: 10px; }
.pdp-anat p { margin: 0; color: var(--t2); font-size: 16px; max-width: 34ch; }

/* ---------- Diagram figures (ai.socket) ---------- */
.pdp-figs .wp-wrap { display: block; }
.pdp-fig-head { max-width: 760px; margin: 0 0 clamp(20px, 3vw, 36px); }
.pdp-fig-head:not(:first-child) { margin-top: clamp(64px, 9vw, 120px); }
.pdp-fig { margin: 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); box-shadow: var(--shadow-card); }
.pdp-fig iframe { display: block; width: 100%; height: 720px; border: 0; background: transparent; }

/* ---------- Intelligence ---------- */
.pdp-diagram { width: min(1180px, 100%); margin: 0 auto clamp(24px, 4vw, 48px); aspect-ratio: 16 / 9; }
.pdp-diagram img { width: 100%; height: 100%; object-fit: contain; }
.pdp-feat-wrap { padding-inline: 0; }
.pdp-feat-wrap .wp-card .h3 { margin-bottom: 10px; font-size: 22px; }
.pdp-feat-wrap .wp-card .body-copy { font-size: 16px; }

/* ---------- Specs ---------- */
.pdp-specs-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.pdp-specs .lede { margin-top: 20px; }
.pdp-specs .wp-spec { border-top: 1px solid var(--line); }
.pdp-specs .wp-spec th { padding: 18px 24px 18px 0; border-bottom: 1px solid var(--line); text-align: left; }
.pdp-specs .wp-spec td { font-weight: 550; font-variant-numeric: tabular-nums; }

/* ---------- Compare ---------- */
.pdp-cmp thead th a { color: inherit; transition: color 0.2s; }
.pdp-cmp thead th a:hover { color: var(--cyan); }
.pdp-cmp tbody td { color: var(--t2); }
.pdp-cmp tbody th { position: sticky; left: 0; z-index: 1; background: var(--bg); }
.pdp-cmp thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg); }
.pdp-cmp[data-cur='1'] :is(thead th, tbody td):nth-child(2),
.pdp-cmp[data-cur='2'] :is(thead th, tbody td):nth-child(3),
.pdp-cmp[data-cur='3'] :is(thead th, tbody td):nth-child(4),
.pdp-cmp[data-cur='4'] :is(thead th, tbody td):nth-child(5) { background: rgba(0, 102, 255, 0.1); color: var(--t1); }
.pdp-cmp[data-cur='1'] thead th:nth-child(2),
.pdp-cmp[data-cur='2'] thead th:nth-child(3),
.pdp-cmp[data-cur='3'] thead th:nth-child(4),
.pdp-cmp[data-cur='4'] thead th:nth-child(5) { box-shadow: inset 0 2px 0 var(--blue); }

/* ---------- Economics ---------- */
.pdp-econ-wrap { padding-bottom: clamp(24px, 4vw, 56px); }
.pdp-econ {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(20px, 4vw, 64px);
  padding: clamp(28px, 4vw, 56px); background: var(--iri-soft); border-color: var(--line-2);
}
.pdp-econ-n { font-size: clamp(48px, 7vw, 96px); font-weight: 700; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.pdp-econ-n small { display: block; margin-top: 8px; font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--t2); }

/* ---------- FAQ ---------- */
.pdp-faq { max-width: 860px; }

/* ---------- Related ---------- */
.pdp-rel { display: flex; flex-direction: column; gap: 6px; padding: 0 0 22px; overflow: hidden; }
.pdp-rel-img { display: block; aspect-ratio: 16 / 9; margin-bottom: 14px; }
.pdp-rel-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.pdp-rel:hover .pdp-rel-img img { transform: scale(1.04); }
.pdp-rel b { padding-inline: 24px; font-size: 20px; letter-spacing: -0.02em; }
.pdp-rel > span:last-child { padding-inline: 24px; color: var(--t2); font-size: 15px; }

/* ---------- Final CTA ---------- */
.pdp-final { overflow: hidden; text-align: center; }
.pdp-final::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(55% 60% at 50% 100%, rgba(0, 102, 255, 0.28), transparent 70%);
}
.pdp-final .wp-wrap { position: relative; }
.pdp-final-row { justify-content: center; margin-top: 12px; }
.pdp-final-row [data-ws-stock-live] { flex: 1 0 100%; order: -1; text-align: center; margin: 0 0 6px !important; }

/* ---------- Sticky buy bar ---------- */
.wp-buybar {
  position: fixed; inset: auto 0 0 0; z-index: 90;
  padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  background: rgba(1, 3, 8, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line-2);
  transform: translateY(110%); transition: transform 0.5s var(--ease);
}
.wp-buybar.show { transform: none; }
.wp-buybar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: var(--wrap); margin-inline: auto; }
.wp-buybar-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.wp-buybar-info b { font-size: 15px; letter-spacing: -0.01em; }
.wp-buybar-info span { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--t1); }
.wp-buybar-info small { color: var(--t3); font-size: 12px; }
.wp-buybar [data-ws-stock-live] { display: none; }
.wp-buybar .btn { flex: none; }
@media (min-width: 961px) {
  .wp-buybar { display: none; }  /* desktop uses the sticky sub-nav's Buy button */
}
body.has-buybar .wp-footer { padding-bottom: 96px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .pdp-grid { grid-template-columns: 1fr; gap: 28px; }
  .pdp-buy { max-width: none; }
  .pdp-stage { aspect-ratio: 4 / 3; }
  .pdp-specs-grid { grid-template-columns: 1fr; }
  .pdp-anat-grid { grid-template-columns: 1fr; }
  .pdp-econ { grid-template-columns: 1fr; text-align: left; }
  .pdp-sub-name { display: none; }
  .pdp-sub-links { margin-inline: 0; flex: 1; }
  .pdp-explode, .pdp-diagram { aspect-ratio: 4 / 3; }
}
@media (max-width: 560px) {
  .pdp-cta .btn { flex: 1 1 100%; }
  .pdp-thumb { width: 76px; }
  .pdp-sub .btn-sm { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .pdp-stage { transform: none !important; }
}
