/**
 * Amazon-style PDP gallery: vertical thumbs, main stage, lightbox zoom.
 * Used on product show + product landing. Scope: .pg-amazon
 */
.pg-amazon {
  --pg-accent: #e77600;
  --pg-border: #d5d9d9;
  --pg-bg: #fff;
  width: 100%;
  max-width: 550px;
}

.pg-amazon__inner {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

/* Thumbnails (left column, desktop) */
.pg-amazon__thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 72px;
  flex-shrink: 0;
  max-height: min(420px, 55vh);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px;
  scrollbar-width: thin;
}

.pg-amazon--single .pg-amazon__thumbs {
  display: none;
}

.pg-amazon__thumb {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid var(--pg-border);
  border-radius: 8px;
  background: var(--pg-bg);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pg-amazon__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Video thumb (last slot, Amazon-style) */
.pg-amazon__thumb--video {
  position: relative;
}

.pg-amazon__thumb--video .pg-amazon__thumb-video-bg {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
}

.pg-amazon__thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pg-amazon__thumb-play svg {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.pg-amazon__thumb:hover,
.pg-amazon__thumb:focus-visible {
  border-color: #a2a2a2;
  outline: none;
}

.pg-amazon__thumb.is-active {
  border-color: var(--pg-accent);
  box-shadow: 0 0 0 1px var(--pg-accent);
}

/* Main stage */
.pg-amazon__stage-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.pg-amazon__stage {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  margin: 0;
  border: 1px solid var(--pg-border);
  border-radius: 10px;
  background: var(--pg-bg);
  cursor: zoom-in;
  overflow: hidden;
}

.pg-amazon__stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.pg-amazon__stage--video {
  cursor: default;
}

.pg-amazon__stage-video {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.pg-amazon__iframe-video,
.pg-amazon__native-video {
  width: 100%;
  max-height: min(96vw, 550px);
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
}

.pg-amazon__native-video {
  object-fit: contain;
  background: #000;
}

.pg-amazon__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--pg-border);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #333;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pg-amazon__nav:hover {
  background: #f0f2f2;
}

.pg-amazon__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.pg-amazon__nav--prev {
  left: 8px;
}

.pg-amazon__nav--next {
  right: 8px;
}

.pg-amazon--single .pg-amazon__nav {
  display: none;
}

.pg-amazon__hint {
  font-size: 0.75rem;
  color: #565959;
  margin-top: 6px;
  text-align: center;
}

/* Mobile: thumbs below */
@media (max-width: 767px) {
  .pg-amazon__inner {
    flex-direction: column-reverse;
  }

  .pg-amazon__thumbs {
    flex-direction: row;
    width: 100%;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .pg-amazon__thumb {
    width: 56px;
    height: 56px;
  }
}

/* —— Fullscreen lightbox —— */
.pg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  padding: 16px;
  box-sizing: border-box;
}

.pg-lightbox.is-open {
  display: flex;
}

.pg-lightbox__panel {
  position: relative;
  width: 100%;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pg-lightbox__zoom-wrap {
  position: relative;
  width: 100%;
  max-height: calc(92vh - 80px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  cursor: zoom-out;
  border-radius: 4px;
  text-align: center;
}

.pg-lightbox__zoom-wrap[data-zoom='1'] {
  cursor: zoom-in;
}

.pg-lightbox__zoom-wrap[data-zoom='1'] .pg-lightbox__img {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.pg-lightbox__zoom-wrap[data-zoom='2'] {
  cursor: grab;
}

.pg-lightbox__zoom-wrap[data-zoom='2']:active {
  cursor: grabbing;
}

.pg-lightbox__zoom-wrap[data-zoom='2'] .pg-lightbox__img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  transform: scale(1.75);
  transform-origin: center center;
}

.pg-lightbox__img {
  vertical-align: middle;
  user-select: none;
}

.pg-lightbox__video-host {
  width: 100%;
  max-height: calc(92vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 4px;
}

.pg-lightbox__video-host .pg-lightbox__iframe-video,
.pg-lightbox__video-host .pg-lightbox__native-video {
  width: 100%;
  max-width: min(96vw, 1100px);
  aspect-ratio: 16 / 9;
  border: 0;
}

.pg-lightbox__zoom-wrap.pg-lightbox__zoom--video {
  overflow: visible;
  cursor: default;
}

.pg-lightbox__zoom-wrap.pg-lightbox__zoom--video[data-zoom='1'] {
  cursor: default;
}

.pg-lightbox__close {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.pg-lightbox__toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.pg-lightbox__btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.pg-lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pg-lightbox__counter {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
}

.pg-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-lightbox__nav:hover {
  background: rgba(0, 0, 0, 0.65);
}

.pg-lightbox__nav--prev {
  left: 8px;
}

.pg-lightbox__nav--next {
  right: 8px;
}

body.pg-lightbox-open {
  overflow: hidden;
}

/* Landing page variant spacing */
.product-landing-page .pg-amazon {
  max-width: 100%;
}
