/**
 * FIVES PDP — Myntra-style layout (plain CSS, no Vite required)
 * LEFT: image grid scrolls with page
 * RIGHT: sticky product details (NOT the image)
 */
.pdp-shell {
  padding-top: 1rem;
  padding-bottom: 1.5rem;
}

.pdp-layout {
  display: block;
  width: 100%;
}

.pdp-gallery {
  position: static !important; /* never sticky — was causing overlay bug */
  width: 100%;
}

/* —— Mobile —— */
.pdp-gallery-desktop { display: none; }
.pdp-gallery-mobile { display: block; }

.pdp-hero {
  position: relative;
  margin: 0 auto;
  max-width: 420px;
  aspect-ratio: 3 / 4;
  max-height: min(58vh, 480px);
  overflow: hidden;
  background: #f5f5f6;
  border: 0;
  padding: 0;
  display: block;
  width: 100%;
  cursor: zoom-in;
}
.pdp-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.pdp-zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #282c3f;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(20, 20, 30, 0.12);
  pointer-events: none;
}
.pdp-zoom-hint svg { width: 16px; height: 16px; }

.pdp-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.pdp-dots button {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(40, 44, 63, 0.25);
  border: 0;
  padding: 0;
}
.pdp-dots button.is-on {
  width: 18px;
  background: #282c3f;
}

.pdp-thumbs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  max-width: 420px;
  margin: 10px auto 0;
}
.pdp-thumbs button {
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid transparent;
  background: #f5f5f6;
  padding: 0;
}
.pdp-thumbs button.is-on { border-color: #9e1b4a; }
.pdp-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.pdp-buy {
  padding-top: 1.25rem;
  position: static;
}

/* —— Desktop / laptop: true 2-column Myntra layout —— */
@media (min-width: 1024px) {
  .pdp-shell {
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
  }

  .pdp-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr) !important;
    column-gap: 2.5rem;
    align-items: start;
  }

  .pdp-gallery-mobile { display: none !important; }

  .pdp-gallery-desktop {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .pdp-shot {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #f5f5f6;
    border: 0;
    padding: 0;
    cursor: zoom-in;
    position: relative;
  }
  .pdp-shot::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 70%, rgba(20, 16, 24, 0.08));
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
  }
  .pdp-shot:hover::after { opacity: 1; }
  .pdp-shot:hover img {
    transform: scale(1.03);
  }
  .pdp-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: transform 0.45s ease;
  }

  /* Hide Blade fallbacks after Alpine mounts (class toggled in JS); until then they show all photos */
  .alpine-ready .pdp-shot-fallback {
    display: none !important;
  }

  .alpine-ready .pdp-gallery-ssr {
    display: none !important;
  }

  /* Details stick while images scroll — Myntra behavior */
  .pdp-buy {
    position: sticky !important;
    top: 88px;
    align-self: start;
    padding-top: 0;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
  }
}

@media (min-width: 1280px) {
  .pdp-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(380px, 0.75fr) !important;
    column-gap: 3rem;
  }
}

/* —— Lightbox / zoom viewer —— */
body.pdp-lb-open { overflow: hidden; }

.pdp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pdp-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 16, 0.92);
  backdrop-filter: blur(6px);
}
.pdp-lightbox-chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.pdp-lightbox-close {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pdp-lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.pdp-lightbox-close svg { width: 18px; height: 18px; }
.pdp-lightbox-count {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pdp-lightbox-hint {
  display: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
@media (min-width: 768px) {
  .pdp-lightbox-hint { display: block; }
}

.pdp-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pdp-lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.pdp-lightbox-nav svg { width: 20px; height: 20px; }
.pdp-lightbox-prev { left: 10px; }
.pdp-lightbox-next { right: 10px; }

.pdp-lightbox-stage {
  position: relative;
  z-index: 2;
  width: min(92vw, 720px);
  height: min(78vh, 920px);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
}
.pdp-lightbox-stage.is-zoomed { cursor: grab; }
.pdp-lightbox-stage.is-zoomed.is-dragging { cursor: grabbing; }
.pdp-lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center top;
  transform-origin: center center;
  transition: transform 0.18s ease-out;
  pointer-events: none;
  will-change: transform;
}
.pdp-lightbox-stage.is-dragging img {
  transition: none;
}

.pdp-lightbox-thumbs {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: min(92vw, 560px);
  overflow-x: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}
.pdp-lightbox-thumbs button {
  flex: 0 0 auto;
  width: 48px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #1a1a1f;
  cursor: pointer;
  opacity: 0.7;
}
.pdp-lightbox-thumbs button.is-on {
  border-color: #fff;
  opacity: 1;
}
.pdp-lightbox-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
