/* ═══════════════════════════════════════════════════════════════════════
   STUDYRIA — PDF PDP V3 GALLERY CSS
   V3.2 — 2026-08-02
   Key: NO overflow on page containers, NO cover-card hiding (causes blank)
   ═══════════════════════════════════════════════════════════════════════ */

/* Page must scroll freely — no touch-action restriction on the page itself */
/* Only the gallery stage has touch-action:pan-y to allow vertical scroll past it */

/* ═══ GALLERY WRAPPER ═══ */
.pdp-v3-gallery {
  position: relative;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04);
  transform: none !important;
  will-change: auto !important;
}

/* ═══ MAIN STAGE — fixed aspect ratio, no zoom ever ═══ */
.pdp-v3-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  /* Allow vertical scroll to pass through, only capture horizontal for swipe */
  touch-action: pan-y;
}
@media (min-width: 768px) { .pdp-v3-stage { max-height: 520px; } }

/* Cover image — ZERO transform, opacity-only transitions */
.pdp-v3-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: opacity 0.22s ease;
  will-change: opacity;
  transform: none !important;
  backface-visibility: hidden;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

.pdp-v3-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: rgba(255,255,255,0.3);
}

/* Preview image — fades in over dimmed cover */
.pdp-v3-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
  will-change: opacity;
  transform: none !important;
  backface-visibility: hidden;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}
.pdp-v3-preview-img.pdp-v3-visible { opacity: 1; }

/* Watermark overlay */
.pdp-v3-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 4;
}
.pdp-v3-watermark.pdp-v3-visible { opacity: 1; }
.pdp-v3-wm-text {
  font-size: clamp(9px, 2.2vw, 12px);
  font-weight: 800;
  color: rgba(255,255,255,0.16);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.6;
  transform: rotate(-25deg);
  pointer-events: none;
  user-select: none;
  white-space: pre-line;
}

/* Loading spinner */
.pdp-v3-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0,0,0,0.5);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.pdp-v3-loading.active { opacity: 1; pointer-events: auto; }
.pdp-v3-spinner {
  width: 30px; height: 30px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent, #930205);
  border-radius: 50%;
  animation: v3spin 0.72s linear infinite;
}
@keyframes v3spin { to { transform: rotate(360deg); } }

/* Corner badges */
.pdp-v3-tag {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  padding: 4px 10px; border-radius: 20px;
  font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  backdrop-filter: blur(8px); pointer-events: none;
}
.pdp-v3-discount-badge {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg,#ff4d6d,#f97316);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 900; color: #fff;
  box-shadow: 0 4px 16px rgba(255,77,109,0.5);
  pointer-events: none;
}

/* Nav arrows */
.pdp-v3-arrow {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 8;
  transition: background 0.18s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  backdrop-filter: blur(6px);
}
.pdp-v3-arrow:hover { background: rgba(147,2,5,0.75); }
.pdp-v3-arrow-prev { left: 10px; }
.pdp-v3-arrow-next { right: 10px; }
.pdp-v3-arrow:disabled { opacity: 0.22; cursor: default; pointer-events: none; }

/* Page indicator */
.pdp-v3-indicator {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 20px;
  background: rgba(0,0,0,0.55);
  font-size: 0.68rem; font-weight: 700; color: rgba(255,255,255,0.85);
  z-index: 8; pointer-events: none; backdrop-filter: blur(4px);
}

/* Fullscreen button */
.pdp-v3-fs-btn {
  position: absolute; bottom: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 8; transition: background 0.18s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; backdrop-filter: blur(6px);
}
.pdp-v3-fs-btn:hover { background: rgba(147,2,5,0.65); }

/* ═══ THUMBNAIL STRIP ═══ */
.pdp-v3-thumb-strip {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--glass);
  border-top: 1px solid var(--glass-border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border, rgba(255,255,255,0.1)) transparent;
  scroll-behavior: smooth;
}
.pdp-v3-thumb-strip::-webkit-scrollbar { height: 3px; }
.pdp-v3-thumb-strip::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 2px; }

.pdp-v3-thumb {
  flex-shrink: 0;
  width: 64px; height: 84px;
  border-radius: 10px;
  border: 2.5px solid var(--glass-border, rgba(255,255,255,0.1));
  overflow: hidden;
  cursor: pointer;
  background: var(--bg3);
  position: relative;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 0;
}
.pdp-v3-thumb:hover { transform: scale(1.05); }
.pdp-v3-thumb.active {
  border-color: var(--accent, #930205);
  box-shadow: 0 0 0 1px var(--accent, #930205), 0 4px 14px rgba(147,2,5,0.3);
}
.pdp-v3-thumb img {
  width: 100%; height: calc(100% - 18px);
  object-fit: cover; display: block;
  pointer-events: none; -webkit-user-drag: none; user-select: none;
}
.pdp-v3-thumb-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: var(--text2);
  text-align: center; padding: 4px;
}
.pdp-v3-thumb-lbl {
  position: absolute; bottom: 0; left: 0; right: 0;
  font-size: 0.55rem; font-weight: 700;
  color: rgba(255,255,255,0.9); background: rgba(0,0,0,0.6);
  text-align: center; padding: 2px 2px 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .pdp-v3-thumb { width: 52px; height: 70px; }
  .pdp-v3-thumb img { height: calc(100% - 16px); }
}

/* ═══ ACTION ROW ═══ */
.pdp-v3-action-row {
  display: flex;
  border-top: 1px solid var(--glass-border);
}
.pdp-v3-action-btn {
  flex: 1; padding: 11px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 0.65rem; font-weight: 600; color: var(--text2);
  cursor: pointer; border: none; background: none;
  font-family: var(--font-body, sans-serif); transition: background 0.2s;
  border-right: 1px solid var(--glass-border);
  -webkit-tap-highlight-color: transparent;
}
.pdp-v3-action-btn:last-child { border-right: none; }
.pdp-v3-action-btn:hover { background: rgba(147,2,5,0.08); }

/* ═══ FULLSCREEN OVERLAY ═══ */
.pdp-v3-fs-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,0.97);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.pdp-v3-fs-overlay.open { opacity: 1; pointer-events: auto; }
.pdp-v3-fs-close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.2rem; z-index: 2;
  transition: background 0.18s; -webkit-tap-highlight-color: transparent;
}
.pdp-v3-fs-close:hover { background: rgba(255,255,255,0.22); }
.pdp-v3-fs-wrap {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none; position: relative;
}
.pdp-v3-fs-img {
  max-width: 95vw; max-height: 90vh;
  object-fit: contain; display: block;
  transform-origin: center; will-change: transform;
  -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.pdp-v3-fs-wm {
  position: absolute; pointer-events: none;
  font-size: 13px; font-weight: 800;
  color: rgba(255,255,255,0.13); text-transform: uppercase;
  letter-spacing: 0.08em; transform: rotate(-25deg);
  white-space: nowrap; user-select: none;
}
.pdp-v3-fs-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.4rem; z-index: 5;
  transition: background 0.18s; -webkit-tap-highlight-color: transparent;
}
.pdp-v3-fs-nav:hover { background: rgba(147,2,5,0.6); }
.pdp-v3-fs-prev { left: 12px; }
.pdp-v3-fs-next { right: 12px; }
.pdp-v3-fs-ind {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 0.75rem; color: rgba(255,255,255,0.7); font-weight: 600;
  background: rgba(0,0,0,0.5); padding: 4px 14px; border-radius: 20px;
  pointer-events: none;
}

/* ═══ HIDE OLD V2 PREVIEW TRACK (scroll-driven, no longer used) ═══ */
.pdp-preview-track,
#pdpPreviewTrack,
#pdpThumbStrip,
.pdp-thumb-strip { display: none !important; }

/* ═══ NO transform on images ever ═══ */
.pdp-v3-stage,
.pdp-v3-cover-img,
.pdp-v3-preview-img {
  -webkit-transform: none !important;
  transform: none !important;
}

/* NOTE: Do NOT hide .pdp-cover-card in CSS — the JS replaces it via
   DOM swap. Hiding it in CSS would cause a blank page if JS fails
   or runs late. The cover-card is only in DOM briefly during render
   and is immediately replaced by the V3 gallery. */


/* ═══════════════════════════════════════════════════════════════════════
   V3.3 — PERMANENT ZOOM FIX
   Root cause: V2 pdpInitPreview created a position:sticky preview element
   that stayed fixed during scroll, creating a "zoom" perception.
   Fix: Removed pdpInitPreview call from V2 _pdpRenderShell (line 474)
   and removed preview-track HTML from V2 template.
   CSS below ensures no V2 preview element can ever render.
   ═══════════════════════════════════════════════════════════════════════ */

/* Permanently neutralize ALL V2 preview elements */
.pdp-preview-track,
#pdpPreviewTrack,
.pdp-preview-sticky,
#pdpPreviewSticky,
.pdp-preview-stage,
#pdpPreviewStage,
.pdp-preview-img,
#pdpPreviewImg,
#pdpThumbStrip,
.pdp-thumb-strip {
  display: none !important;
  position: static !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  transform: none !important;
  will-change: auto !important;
  contain: none !important;
}

/* Ensure NO sticky positioning on any PDP element except buy-card */
.pdp-preview-sticky {
  position: static !important;
  top: auto !important;
}

/* Cover image — absolute zero transform/scale, guaranteed */
.pdp-cover-wrap,
.pdp-cover-img,
.pdp-cover-card {
  transform: none !important;
  scale: 1 !important;
  zoom: 1 !important;
  transition: none !important;
  will-change: auto !important;
  contain: layout paint !important;
}

/* V3 gallery stage — no transform ever */
.pdp-v3-stage,
.pdp-v3-cover-img,
.pdp-v3-preview-img,
.pdp-v3-gallery {
  transform: none !important;
  scale: 1 !important;
  zoom: 1 !important;
  will-change: auto !important;
}

/* Only the fullscreen overlay image may have transform */
.pdp-v3-fs-img {
  will-change: transform;
}

/* Prevent any iOS Safari zoom behavior on PDP */
#page-detail {
  touch-action: pan-y !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

/* Sticky buy card is fine — it doesn't zoom, it just sticks */
.pdp-buy-card { position: sticky; top: 88px; }
.pdp-sticky-bar { position: fixed; bottom: 0; }
