/* ==========================================================================
   Product page (product-detail.html, js/product-detail.js).
   Desktop: a short dark band behind the breadcrumb; the gallery and the
   details on the left, a sticky buy card on the right, both overlapping the
   band. Phone: back link, swipeable photos, then the buy card, so the price
   and Buy now are on the first screen; a buy bar takes over once the buy
   buttons scroll away.
   ========================================================================== */
.pdp { padding-bottom: 72px; }

/* ---------- Band ---------- */
.pdp-band { padding: 18px 0 112px; }
.pdp-band .breadcrumb { margin: 0; }
.pdp-band .breadcrumb [aria-current] { color: var(--on-dark); }
.pdp-back {
  display: none; align-items: center; gap: 4px; min-height: 40px; margin-left: -8px; padding: 0 8px;
  border-radius: var(--r-sm); font: 600 var(--text-sm)/1.2 var(--font-body); color: var(--on-dark-2);
}
.pdp-back svg { width: 18px; height: 18px; flex: none; }
.pdp-back:hover { color: #fff; }
.pdp-body { position: relative; z-index: 3; margin-top: -88px; }

/* ---------- Layout ---------- */
.pdp-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-areas: "media buy" "details buy";
  grid-template-rows: auto 1fr;
  gap: 28px 40px;
  align-items: start;
}
.pdp-top.is-bare { grid-template-areas: "details buy"; grid-template-rows: auto; }
@media (min-width: 1280px) { .pdp-top { grid-template-columns: minmax(0, 1fr) 420px; gap: 28px 48px; } }
.pdp-media { grid-area: media; min-width: 0; }
.pdp-buy { grid-area: buy; position: sticky; top: calc(var(--header-h) + 20px); min-width: 0; }
.pdp-details { grid-area: details; min-width: 0; }

/* ---------- Gallery ---------- */
.gal { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
.gal.is-single { grid-template-columns: minmax(0, 1fr); }
.gal-thumbs { display: grid; align-content: start; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gal-thumb {
  display: block; width: 72px; height: 72px; padding: 3px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 5px; }
.gal-thumb:hover { border-color: var(--text-3); }
.gal-thumb[aria-current="true"] { border-color: var(--ink-900); box-shadow: inset 0 0 0 1px var(--ink-900); }
.gal-stage { position: relative; min-width: 0; }
.gal-track {
  display: flex; overflow: hidden; margin: 0; padding: 0; list-style: none;
  height: clamp(420px, calc(100vh - var(--header-h) - 150px), 620px);
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-sm);
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.gal-track::-webkit-scrollbar { display: none; }
.gal-slide { position: relative; flex: 0 0 100%; min-width: 0; scroll-snap-align: start; }
.gal-open {
  position: relative; display: block; width: 100%; height: 100%; padding: 0; overflow: hidden;
  border: 0; border-radius: inherit;
  background:
    radial-gradient(circle at 50% 40%, #fff 0 35%, rgba(255, 255, 255, 0) 75%),
    repeating-linear-gradient(135deg, #f4f6f8 0 10px, #f0f2f5 10px 20px);
  cursor: zoom-in;
}
.gal-open img { position: absolute; inset: 20px; width: calc(100% - 40px); height: calc(100% - 40px); object-fit: contain; }
.gal-open:focus-visible { outline: var(--focus-outline); outline-offset: -4px; }
/* Tall screenshots (parameter trees) at their own width, top first, with a fade. */
.gal-slide.is-tall .gal-open img {
  inset: 20px auto auto 50%; width: min(calc(100% - 40px), var(--nat-w, 100%)); height: auto; max-height: none;
  transform: translateX(-50%); object-fit: initial; box-shadow: 0 1px 0 var(--line), 0 8px 24px -16px rgba(11, 14, 19, 0.35);
}
.gal-slide.is-tall .gal-open::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.92) 70%, #fff);
  pointer-events: none;
}
.gal-zoom {
  position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: var(--r-full); background: rgba(255, 255, 255, 0.94); color: var(--text); box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.gal-zoom svg { width: 18px; height: 18px; }
.gal-nav {
  position: absolute; top: 50%; display: grid; place-items: center; width: 44px; height: 44px; margin-top: -22px;
  border: 1px solid var(--line); border-radius: var(--r-full); background: rgba(255, 255, 255, 0.96); color: var(--text);
  box-shadow: var(--shadow-sm); cursor: pointer; opacity: 0; transition: opacity var(--dur) var(--ease-out);
}
.gal-nav svg { width: 20px; height: 20px; }
.gal-nav.is-prev { left: 12px; }
.gal-nav.is-next { right: 12px; }
.gal-stage:hover .gal-nav, .gal-nav:focus-visible { opacity: 1; }
.gal-nav[disabled] { opacity: 0 !important; pointer-events: none; }
.gal-count {
  position: absolute; left: 12px; bottom: 12px; padding: 4px 9px; border-radius: var(--r-full);
  background: rgba(11, 14, 19, 0.8); color: #fff; font: 600 12px/1.2 var(--font-body); font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ---------- Buy card ---------- */
.buy {
  display: grid; gap: 18px; padding: 24px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg);
}
.buy-head { display: grid; gap: 10px; }
.buy-eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 24px; }
.buy-brand {
  display: inline-flex; align-items: center; gap: 8px; min-height: 24px; border-radius: var(--r-xs);
  font: 600 var(--text-xs)/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2);
}
.buy-brand img { flex: none; }
.buy-brand:hover { color: var(--text); }
.buy-title { font-size: clamp(1.75rem, 1.4rem + 1vw, 2.125rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; overflow-wrap: anywhere; }
.buy-facts { display: flex; flex-wrap: wrap; margin: 2px 0 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.buy-facts > div { flex: 1 1 auto; min-width: 0; padding: 9px 12px; }
.buy-facts > div + div { border-left: 1px solid var(--line); }
.buy-facts dt { font: 600 10.5px/1.2 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.buy-facts dd { margin: 3px 0 0; font: 600 var(--text-sm)/1.25 var(--font-body); color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.copy-ref {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content; min-height: 28px; margin: 0 0 0 -6px; padding: 0 6px;
  border: 0; border-radius: var(--r-xs); background: none; color: var(--text-3); cursor: pointer;
  font: 500 12.5px/1 var(--font-mono);
}
.copy-ref svg { width: 14px; height: 14px; flex: none; }
.copy-ref:hover { color: var(--text); background: var(--surface-2); }
.copy-ref-label { font: 600 11px/1 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; }

.buy-price-row { display: grid; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.buy-price { font: 800 2.5rem/1 var(--font-display); font-stretch: 105%; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.buy-price small { margin-left: 6px; font: 600 var(--text-sm)/1 var(--font-body); letter-spacing: 0; color: var(--text-3); }
.buy-charge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 22px; font-size: var(--text-sm); color: var(--text-2); }
.buy-charge strong { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.buy-charge .skeleton { display: inline-block; width: 96px; height: 14px; vertical-align: middle; }
.card-marks { display: inline-flex; gap: 4px; }
.card-marks svg { width: 32px; height: 21px; border-radius: 3px; box-shadow: 0 0 0 1px var(--line); }

.buy-receive { display: grid; gap: 10px; }
.buy-label { font: 600 var(--text-xs)/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  font: 600 13px/1.2 var(--font-body); color: var(--text);
}
.file-chip svg { width: 16px; height: 16px; flex: none; color: var(--brand-600); }
.buy-delivery { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: var(--text-sm); color: var(--text-2); }
.buy-delivery svg { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--text-3); }

.buy-actions { display: grid; gap: 10px; }
.buy-actions .btn-buy { min-height: 56px; font-size: 1.0625rem; }
.buy-actions .btn { width: 100%; }
.btn.is-added { --btn-bg: var(--success-bg); --btn-border: #b9e8cb; --btn-fg: var(--success); --btn-bg-hover: #dcf5e6; }
.buy-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: -6px; }
.buy-link {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 6px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-2); cursor: pointer; font: 600 var(--text-sm)/1 var(--font-body); text-decoration: none;
}
.buy-link svg { width: 17px; height: 17px; flex: none; }
.buy-link .is-wa { color: #128c4a; }
.buy-link:hover { color: var(--text); background: var(--surface-2); }
.buy-trust { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--line); list-style: none; }
.buy-trust li { display: flex; align-items: center; gap: 8px; font: 500 13px/1.3 var(--font-body); color: var(--text-2); }
.buy-trust svg { flex: none; width: 17px; height: 17px; color: var(--success); }

/* ---------- Details ---------- */
.details { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.dsec { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 24px; padding: 24px 28px; }
.dsec + .dsec { border-top: 1px solid var(--line); }
.dsec-title { font-size: var(--text-md); letter-spacing: -0.015em; padding-top: 2px; }
.dsec-body { min-width: 0; color: var(--text-2); overflow-wrap: anywhere; }
.dsec-body p { white-space: pre-line; }
.dsec-body p + p { margin-top: 10px; }
.checks { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: 10px; align-items: flex-start; color: var(--text); }
.checks svg { flex: none; width: 20px; height: 20px; margin-top: 2px; padding: 3px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600); }
.specs { display: grid; margin: 0; }
.specs > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: center; min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.specs > div:first-child { padding-top: 0; }
.specs > div:last-child { border-bottom: 0; padding-bottom: 0; }
.specs dt { font-size: var(--text-sm); color: var(--text-3); }
.specs dd { margin: 0; font-weight: 500; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.specs dd .pcard-types { margin: 0; }
.specs-brand { display: inline-flex; align-items: center; gap: 8px; }
.specs .copy-ref { margin: 0 0 0 -6px; color: var(--text); font-size: 13px; }

/* Phone accordion */
.dsec.dsec-acc { display: block; padding: 0; }
.dsec-acc > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 16px;
  cursor: pointer; list-style: none; border-radius: var(--r-lg);
}
.dsec-acc > summary::-webkit-details-marker { display: none; }
.dsec-acc > summary:focus-visible { outline: var(--focus-outline); outline-offset: -3px; }
.dsec-acc > summary .dsec-title { padding: 0; font-size: var(--text-base); }
.dsec-acc > summary svg { width: 20px; height: 20px; flex: none; color: var(--text-3); transition: transform var(--dur) var(--ease-out); }
.dsec-acc[open] > summary svg { transform: rotate(180deg); }
.dsec-acc > .dsec-body { padding: 0 16px 20px; }

/* ---------- Related ---------- */
.related { padding-top: 56px; }
.related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.related-title { font-size: var(--text-xl); letter-spacing: -0.02em; }

/* ---------- Phone buy bar ---------- */
.buybar {
  position: fixed; z-index: var(--z-sticky); left: 0; right: 0; bottom: 0;
  display: none; align-items: center; gap: 10px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: var(--surface);
  box-shadow: 0 -8px 24px -12px rgba(11, 14, 19, 0.25);
  transform: translateY(110%); transition: transform var(--dur-slow) var(--ease-out);
}
.buybar.is-shown { transform: none; }
.buybar-info { display: grid; flex: 1; min-width: 0; gap: 3px; }
.buybar-title { font: 600 13px/1.2 var(--font-body); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buybar-price { display: flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; }
.buybar-price strong { font: 800 1.25rem/1 var(--font-display); font-stretch: 105%; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.buybar-price span { overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.buybar .btn { min-height: 48px; flex: none; }
.buybar .btn-icon { width: 48px; }
.buybar .btn-primary { padding: 0 20px; }

/* ---------- Lightbox ---------- */
.lb { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #06080b; color: #fff; overscroll-behavior: contain; }
.lb::backdrop { background: #06080b; }
.lb-inner { position: relative; display: grid; place-items: center; width: 100%; height: 100%; padding: 64px 76px; touch-action: pan-y pinch-zoom; }
.lb-img { max-width: 100%; max-height: calc(100vh - 128px); max-height: calc(100dvh - 128px); width: auto; height: auto; border-radius: 4px; background: #fff; user-select: none; -webkit-user-drag: none; }
.lb-btn { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, 0.16); }
.lb-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 14px; top: 50%; margin-top: -24px; }
.lb-next { right: 14px; top: 50%; margin-top: -24px; }
.lb-count { position: absolute; top: 26px; left: 20px; font: 600 var(--text-sm)/1 var(--font-body); color: var(--on-dark-2); font-variant-numeric: tabular-nums; }

/* ---------- Loading and missing ---------- */
.pdp-skel .skeleton { display: block; }
.pdp-missing { max-width: 440px; margin: 0 auto; padding: 48px 24px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }

/* ---------- Tablet ---------- */
@media (max-width: 1099px) {
  .pdp-top { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px 24px; }
  .dsec { grid-template-columns: 1fr; padding: 22px 24px; }
  .gal { grid-template-columns: minmax(0, 1fr); }
  .gal-thumbs { display: flex; flex-wrap: wrap; order: 2; }
  .gal-thumb { width: 64px; height: 64px; }
  .specs > div { grid-template-columns: 120px minmax(0, 1fr); }
}

/* ---------- Phone ---------- */
@media (max-width: 859px) {
  .pdp { padding-bottom: 48px; }
  .pdp-band { padding: 6px 0; }
  .pdp-band .breadcrumb { display: none; }
  .pdp-back { display: inline-flex; }
  .pdp-body { margin-top: 0; }
  .pdp-top, .pdp-top.is-bare { grid-template-columns: minmax(0, 1fr); grid-template-areas: "media" "buy" "details"; grid-template-rows: auto; gap: 16px; }
  .pdp-top.is-bare { grid-template-areas: "buy" "details"; padding-top: 16px; }
  .pdp-buy { position: static; }
  .gal-thumbs { display: none; }
  /* The desktop frame at phone size: the photo stays whole inside it instead
     of being cropped and bled to the edges of the screen. */
  .gal-track {
    overflow-x: auto; height: auto; aspect-ratio: 4 / 3;
    border-radius: var(--r-md);
    overscroll-behavior-x: contain;
  }
  .gal-open { cursor: pointer; }
  .gal-open img { inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }
  .gal-slide.is-tall .gal-open img { inset: 12px auto auto 50%; width: min(calc(100% - 24px), var(--nat-w, 100%)); }
  .gal-slide.is-tall .gal-open::after { height: 72px; }
  .gal-nav { display: none; }
  .gal-zoom { right: 10px; bottom: 10px; width: 36px; height: 36px; }
  .gal-count { left: 10px; bottom: 10px; }

  .buy { gap: 14px; padding: 18px 16px; box-shadow: var(--shadow-sm); }
  .buy-price-row { padding-top: 14px; }
  .buy-price { font-size: 2.125rem; }
  .buy-actions { grid-template-columns: 1fr; gap: 8px; }
  /* Price, then Buy now: what the file includes follows the buttons. */
  .buy-actions { order: 1; }
  .buy-more { order: 2; }
  .buy-receive { order: 3; padding-top: 14px; border-top: 1px solid var(--line); }
  .buy-trust { order: 4; }
  .buy-trust { gap: 8px 18px; padding-top: 14px; }
  .buybar { display: flex; }
  /* The card has its own WhatsApp link: the floating button waits until the buy buttons leave the screen. */
  body.pdp-actions-seen .wa-fab { opacity: 0; transform: translateY(24px) scale(0.9); pointer-events: none; }
  .details { border-radius: var(--r-lg); }
  .dsec-acc + .dsec-acc { border-top: 1px solid var(--line); }
  .specs > div { grid-template-columns: 104px minmax(0, 1fr); gap: 12px; }
  .lb-inner { padding: 60px 12px 88px; }
  .lb-img { max-height: calc(100vh - 148px); max-height: calc(100dvh - 148px); }
  .lb-prev, .lb-next { top: auto; bottom: 20px; margin-top: 0; }
  .lb-prev { left: calc(50% - 60px); }
  .lb-next { right: calc(50% - 60px); }
  .related { padding-top: 40px; }
  .related-title { font-size: var(--text-lg); }
  .related .pgrid {
    display: flex; gap: 12px; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 12px;
    scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); scrollbar-width: none;
  }
  .related .pgrid::-webkit-scrollbar { display: none; }
  .related .pcard { flex: 0 0 min(72%, 260px); scroll-snap-align: start; }
}

/* The listing the server writes into the page for crawlers. A visitor sees
   it for the moment it takes the script to fetch the data and draw the full
   page over it. */
.pdp-static { padding: 32px 0 48px; max-width: 760px; }
.pdp-static h1 { margin: 0 0 12px; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.15; }
.pdp-static p { margin: 0 0 10px; line-height: 1.6; }
