/* Modern multi-image product gallery. Loaded after legacy and premium PDP layers. */

@keyframes pdp-gallery-reveal {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: none; }
}

@keyframes pdp-gallery-lightbox-in {
  from { opacity: 0; transform: translateY(14px) scale(.975); }
  to { opacity: 1; transform: none; }
}

@keyframes pdp-gallery-swipe-next {
  from { opacity: .35; transform: translateX(24%) scale(.985); filter: saturate(.92) blur(1px); }
  to { opacity: 1; transform: translateX(0) scale(1); filter: saturate(1.01) blur(0); }
}

@keyframes pdp-gallery-swipe-previous {
  from { opacity: .35; transform: translateX(-24%) scale(.985); filter: saturate(.92) blur(1px); }
  to { opacity: 1; transform: translateX(0) scale(1); filter: saturate(1.01) blur(0); }
}

@keyframes pdp-gallery-swipe-out-left {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(-28%) scale(.975); }
}

@keyframes pdp-gallery-swipe-out-right {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(28%) scale(.975); }
}

@keyframes pdp-gallery-swipe-cancel {
  from { transform: translate3d(var(--pdp-swipe-offset, 0), 0, 0) scale(.985); }
  to { transform: translate3d(0, 0, 0) scale(1); }
}

.product-gallery.pdp-gallery-modern {
  --pdp-gallery-accent: #f57224;
  --pdp-gallery-ink: #151515;
  --pdp-gallery-line: rgba(15, 23, 42, .09);
  --pdp-gallery-glass: rgba(255, 255, 255, .88);
  position: relative;
  min-width: 0;
}

body.product-details-page .product-gallery,
body.product-details-page .product-gallery.pdp-gallery-modern .main-image-wrapper {
  animation: none;
}

.product-gallery.pdp-gallery-modern .main-image-wrapper {
  position: relative;
  top: auto;
  isolation: isolate;
  aspect-ratio: 1 / 1;
  margin: 0;
  border: 1px solid var(--pdp-gallery-line);
  border-radius: 30px;
  overflow: hidden;
  cursor: zoom-in;
  background:
    radial-gradient(circle at 18% 16%, rgba(245, 114, 36, .105), transparent 35%),
    radial-gradient(circle at 86% 88%, rgba(126, 87, 194, .09), transparent 38%),
    linear-gradient(145deg, #ffffff 0%, #fffaf6 52%, #f8fafc 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 22px 60px rgba(15, 23, 42, .09),
    0 6px 18px rgba(245, 114, 36, .07);
  animation: pdp-gallery-reveal .55s cubic-bezier(.16, 1, .3, 1) both;
}

.product-gallery.pdp-gallery-modern .main-image-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom right, rgba(0,0,0,.75), transparent 68%);
  -webkit-mask-image: linear-gradient(to bottom right, rgba(0,0,0,.75), transparent 68%);
}

.product-gallery.pdp-gallery-modern .main-image-wrapper::after {
  content: '';
  position: absolute;
  inset: 1px;
  z-index: 3;
  pointer-events: none;
  border-radius: 29px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.product-gallery.pdp-gallery-modern .main-image-wrapper #product-image {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: clamp(8px, 1vw, 14px);
  object-fit: contain;
  opacity: 1;
  visibility: visible;
  filter: saturate(1.01) contrast(1.01);
  transform: translateZ(0) scale(1);
  transition:
    opacity .22s ease,
    transform .55s cubic-bezier(.16, 1, .3, 1),
    filter .3s ease;
  will-change: transform, opacity;
  user-select: none;
  -webkit-user-drag: none;
}

.product-gallery.pdp-gallery-modern .main-image-wrapper:hover #product-image {
  transform: translateZ(0) scale(1.022);
}

.product-gallery.pdp-gallery-modern.is-switching .main-image-wrapper #product-image,
.product-gallery.pdp-gallery-modern.is-switching .main-image-wrapper:hover #product-image {
  opacity: .42 !important;
  visibility: visible !important;
  filter: blur(2px) saturate(.9);
  transform: translateZ(0) scale(.975);
}

.pdp-gallery-toolbar {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pdp-gallery-counter,
.pdp-gallery-zoom,
.pdp-gallery-nav {
  border: 1px solid rgba(255, 255, 255, .82);
  background: var(--pdp-gallery-glass);
  color: var(--pdp-gallery-ink);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .1);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.pdp-gallery-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .05em;
}

.pdp-gallery-zoom,
.pdp-gallery-nav {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.pdp-gallery-zoom:hover,
.pdp-gallery-nav:hover,
.pdp-gallery-zoom:focus-visible,
.pdp-gallery-nav:focus-visible {
  color: #fff;
  background: linear-gradient(135deg, #ff8a00, var(--pdp-gallery-accent));
  border-color: rgba(245, 114, 36, .45);
  box-shadow: 0 12px 28px rgba(245, 114, 36, .3);
  transform: translateY(-2px);
  outline: none;
}

.pdp-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 30;
  opacity: 0;
  transform: translateY(-50%) scale(.9);
}

.pdp-gallery-prev { left: 18px; }
.pdp-gallery-next { right: 18px; }

.main-image-wrapper:hover .pdp-gallery-nav,
.pdp-gallery-nav:focus-visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.pdp-gallery-nav:hover,
.pdp-gallery-nav:focus-visible {
  transform: translateY(calc(-50% - 2px)) scale(1);
}

.pdp-gallery-nav[hidden] { display: none; }

.product-gallery.pdp-gallery-modern .thumbnail-strip {
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 114, 36, .32) transparent;
}

.product-gallery.pdp-gallery-modern .thumbnail-strip img {
  box-sizing: border-box;
  object-fit: contain;
  padding: 7px;
  opacity: .66;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 5px 14px rgba(15, 23, 42, .055);
  cursor: pointer;
  transition: opacity .2s ease, border-color .2s ease, transform .22s cubic-bezier(.16, 1, .3, 1), box-shadow .22s ease, background .2s ease;
}

.product-gallery.pdp-gallery-modern .thumbnail-strip img:hover,
.product-gallery.pdp-gallery-modern .thumbnail-strip img:focus-visible {
  opacity: 1;
  transform: translateY(-2px);
  border-color: rgba(245, 114, 36, .45);
  box-shadow: 0 10px 22px rgba(245, 114, 36, .14);
  outline: none;
}

.product-gallery.pdp-gallery-modern .thumbnail-strip img.active,
.product-gallery.pdp-gallery-modern .thumbnail-strip img[aria-current="true"] {
  opacity: 1;
  border-color: var(--pdp-gallery-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(245, 114, 36, .16), 0 12px 24px rgba(245, 114, 36, .12);
}

.product-gallery.pdp-gallery-modern[data-gallery-count="1"] .thumbnail-strip {
  display: none;
}

body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern {
  --pdp-gallery-ink: #f8fafc;
  --pdp-gallery-line: rgba(255, 255, 255, .1);
  --pdp-gallery-glass: rgba(17, 24, 39, .82);
}

body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern .main-image-wrapper {
  border-color: rgba(255, 255, 255, .09);
  background:
    radial-gradient(circle at 18% 16%, rgba(245, 114, 36, .16), transparent 36%),
    radial-gradient(circle at 86% 88%, rgba(126, 87, 194, .14), transparent 40%),
    linear-gradient(145deg, #151821 0%, #0d1119 58%, #12101a 100%);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .055);
}

body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern .main-image-wrapper::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
}

body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern .main-image-wrapper::after {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .035);
}

/* Convert white product-art canvases into a true dark presentation while
   keeping brand hues familiar. This is intentionally dark-mode-only. */
body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern .main-image-wrapper #product-image,
body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern .pdp-gallery-swipe-ghost,
body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern .thumbnail-strip img,
body.dark-mode.product-details-page .pdp-gallery-lightbox-image {
  filter: invert(.94) hue-rotate(180deg) saturate(1.08) brightness(.94) contrast(1.08);
}

body.dark-mode.product-details-page .product-gallery.pdp-gallery-modern .thumbnail-strip img {
  border-color: rgba(255, 255, 255, .09);
  background: rgba(20, 24, 34, .8);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .26);
}

body.dark-mode .product-gallery.pdp-gallery-modern .thumbnail-strip img.active,
body.dark-mode .product-gallery.pdp-gallery-modern .thumbnail-strip img[aria-current="true"] {
  border-color: rgba(251, 146, 60, .9);
  background: rgba(28, 31, 42, .96);
  box-shadow: 0 0 0 3px rgba(245, 114, 36, .2), 0 14px 28px rgba(0, 0, 0, .35);
}

body.pdp-gallery-modal-open {
  overflow: hidden;
}

.pdp-gallery-lightbox[hidden] {
  display: none !important;
}

.pdp-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483200;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 38px);
  opacity: 0;
  background: rgba(5, 8, 14, .82);
  backdrop-filter: blur(22px) saturate(.9);
  -webkit-backdrop-filter: blur(22px) saturate(.9);
  transition: opacity .18s ease;
}

.pdp-gallery-lightbox.is-open {
  opacity: 1;
}

.pdp-gallery-lightbox-panel {
  position: relative;
  width: min(94vw, 1080px);
  height: min(90vh, 900px);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(245, 114, 36, .13), transparent 34%),
    linear-gradient(145deg, rgba(25, 29, 39, .98), rgba(8, 11, 17, .98));
  box-shadow: 0 36px 100px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.pdp-gallery-lightbox.is-open .pdp-gallery-lightbox-panel {
  animation: pdp-gallery-lightbox-in .28s cubic-bezier(.16, 1, .3, 1) both;
}

.pdp-gallery-lightbox-topbar {
  position: absolute;
  top: 18px;
  left: 20px;
  right: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pdp-gallery-lightbox-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(8, 12, 20, .7);
  color: rgba(255, 255, 255, .88);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .06em;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pdp-gallery-lightbox-close,
.pdp-gallery-lightbox-nav {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(8, 12, 20, .7);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}

.pdp-gallery-lightbox-close:hover,
.pdp-gallery-lightbox-close:focus-visible,
.pdp-gallery-lightbox-nav:hover,
.pdp-gallery-lightbox-nav:focus-visible {
  background: var(--primary-color, #f57224);
  border-color: rgba(255, 255, 255, .2);
  transform: scale(1.06);
  outline: none;
}

.pdp-gallery-lightbox-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: clamp(54px, 7vw, 90px);
}

.pdp-gallery-lightbox-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .28));
}

.pdp-gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  transform: translateY(-50%);
}

.pdp-gallery-lightbox-nav:hover,
.pdp-gallery-lightbox-nav:focus-visible {
  transform: translateY(-50%) scale(1.06);
}

.pdp-gallery-lightbox-prev { left: 20px; }
.pdp-gallery-lightbox-next { right: 20px; }
.pdp-gallery-lightbox-nav[hidden] { display: none; }

@media (min-width: 1024px) {
  .product-gallery.pdp-gallery-modern:not([data-gallery-count="1"]) {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .product-gallery.pdp-gallery-modern:not([data-gallery-count="1"]) .main-image-wrapper {
    grid-column: 2;
    grid-row: 1;
  }

  .product-gallery.pdp-gallery-modern:not([data-gallery-count="1"]) .thumbnail-strip {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 11px;
    max-height: min(72vh, 620px);
    padding: 4px 6px 12px 4px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .product-gallery.pdp-gallery-modern:not([data-gallery-count="1"]) .thumbnail-strip img {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
  }
}

@media (max-width: 1023px) {
  .product-gallery.pdp-gallery-modern {
    display: flex;
    flex-direction: column;
    gap: 13px;
  }

  .product-gallery.pdp-gallery-modern .main-image-wrapper {
    width: 100%;
    border-radius: 24px;
  }

  .product-gallery.pdp-gallery-modern .main-image-wrapper::after {
    border-radius: 23px;
  }

  .product-gallery.pdp-gallery-modern .thumbnail-strip {
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 4px 3px 9px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .product-gallery.pdp-gallery-modern .thumbnail-strip img {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    border-radius: 14px;
    scroll-snap-align: start;
  }

  .pdp-gallery-nav {
    width: 40px;
    height: 40px;
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }

  .pdp-gallery-prev { left: 12px; }
  .pdp-gallery-next { right: 12px; }
  .pdp-gallery-toolbar { top: 13px; right: 13px; }
  .pdp-gallery-counter { height: 36px; min-width: 52px; }
  .pdp-gallery-zoom { width: 40px; height: 40px; }
}

@media (max-width: 600px) {
  .product-gallery.pdp-gallery-modern {
    width: 100vw;
    margin-inline: calc(50% - 50vw);
    gap: 8px;
  }

  .product-gallery.pdp-gallery-modern .main-image-wrapper {
    width: 100%;
    /* Preserve the full square gallery grid so square product artwork fills
       the available width instead of being letterboxed inside a short card. */
    aspect-ratio: 1 / 1;
    max-height: none;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: 0 14px 38px rgba(15, 23, 42, .085), 0 4px 14px rgba(245, 114, 36, .055);
    touch-action: pan-y pinch-zoom;
    overscroll-behavior-x: contain;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .product-gallery.pdp-gallery-modern .main-image-wrapper::after {
    border-radius: 0;
  }

  .product-gallery.pdp-gallery-modern .main-image-wrapper #product-image {
    padding: 7px;
    object-fit: contain;
  }

  .product-gallery.pdp-gallery-modern .thumbnail-strip {
    justify-content: safe center;
    gap: 7px;
    padding: 4px 13px 7px;
  }

  .product-gallery.pdp-gallery-modern .thumbnail-strip img {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    padding: 4px;
    border-radius: 11px;
  }

  .pdp-gallery-toolbar { top: auto; right: auto; bottom: 12px; left: 13px; gap: 6px; }
  .pdp-gallery-counter { min-width: 46px; height: 32px; padding: 0 9px; font-size: .68rem; }
  .pdp-gallery-zoom,
  .pdp-gallery-nav { display: none; }

  .product-gallery.pdp-gallery-modern.is-swipe-next .main-image-wrapper #product-image {
    z-index: 1;
    animation: pdp-gallery-swipe-next .52s cubic-bezier(.22, 1, .36, 1) both;
  }
  .product-gallery.pdp-gallery-modern.is-swipe-previous .main-image-wrapper #product-image {
    z-index: 1;
    animation: pdp-gallery-swipe-previous .52s cubic-bezier(.22, 1, .36, 1) both;
  }
  .product-gallery.pdp-gallery-modern .pdp-gallery-swipe-ghost {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    padding: 7px;
    object-fit: contain;
    pointer-events: none;
    will-change: transform, opacity;
  }
  .product-gallery.pdp-gallery-modern .pdp-gallery-drag-preview {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
    width: 100%;
    height: 100%;
    padding: 7px;
    object-fit: contain;
    pointer-events: none;
    transform: translate3d(calc(var(--pdp-preview-origin, 100%) + var(--pdp-swipe-offset, 0px)), 0, 0);
    will-change: transform;
  }
  .product-gallery.pdp-gallery-modern .pdp-gallery-swipe-ghost.is-leaving-left {
    animation: pdp-gallery-swipe-out-left .52s cubic-bezier(.22, 1, .36, 1) both;
  }
  .product-gallery.pdp-gallery-modern .pdp-gallery-swipe-ghost.is-leaving-right {
    animation: pdp-gallery-swipe-out-right .52s cubic-bezier(.22, 1, .36, 1) both;
  }
  .product-gallery.pdp-gallery-modern.is-dragging .main-image-wrapper #product-image {
    transform: translate3d(var(--pdp-swipe-offset, 0), 0, 0);
    transition: none !important;
    will-change: transform;
  }
  .product-gallery.pdp-gallery-modern.is-swipe-settling .main-image-wrapper #product-image,
  .product-gallery.pdp-gallery-modern.is-swipe-settling .pdp-gallery-drag-preview {
    transition: transform .22s cubic-bezier(.22, 1, .36, 1) !important;
  }
  .product-gallery.pdp-gallery-modern.is-swipe-swap .main-image-wrapper #product-image {
    transition: none !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
  }
  .product-gallery.pdp-gallery-modern.is-dragging .main-image-wrapper {
    box-shadow: 0 18px 44px rgba(15, 23, 42, .13), 0 0 0 1px rgba(245, 114, 36, .08);
  }
  .product-gallery.pdp-gallery-modern.is-swipe-cancel .main-image-wrapper #product-image {
    animation: pdp-gallery-swipe-cancel .24s cubic-bezier(.22, 1, .36, 1) both;
  }

  body.dark-mode .product-gallery.pdp-gallery-modern .main-image-wrapper {
    box-shadow: 0 18px 44px rgba(0, 0, 0, .34);
  }

  body.dark-mode .product-gallery.pdp-gallery-modern.is-dragging .main-image-wrapper #product-image {
    filter: invert(.94) hue-rotate(180deg) saturate(1.08) brightness(.94) contrast(1.08);
  }

  body.dark-mode .product-gallery.pdp-gallery-modern .pdp-gallery-drag-preview {
    filter: invert(.94) hue-rotate(180deg) saturate(1.08) brightness(.94) contrast(1.08);
  }

  .pdp-gallery-lightbox {
    padding: 0;
  }

  .pdp-gallery-lightbox-panel {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .pdp-gallery-lightbox-stage {
    padding: 66px 20px 44px;
  }

  .pdp-gallery-lightbox-prev { left: 10px; }
  .pdp-gallery-lightbox-next { right: 10px; }
}

html[data-dw-performance-tier="lite"] .pdp-gallery-counter,
html[data-dw-performance-tier="lite"] .pdp-gallery-zoom,
html[data-dw-performance-tier="lite"] .pdp-gallery-nav,
html[data-dw-performance-tier="lite"] .pdp-gallery-lightbox,
html[data-dw-performance-tier="lite"] .pdp-gallery-lightbox-counter,
html[data-dw-performance-tier="lite"] .pdp-gallery-lightbox-close,
html[data-dw-performance-tier="lite"] .pdp-gallery-lightbox-nav {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .product-gallery.pdp-gallery-modern .main-image-wrapper,
  .product-gallery.pdp-gallery-modern .main-image-wrapper #product-image,
  .product-gallery.pdp-gallery-modern .thumbnail-strip img,
  .pdp-gallery-zoom,
  .pdp-gallery-nav,
  .pdp-gallery-lightbox,
  .pdp-gallery-lightbox-panel,
  .pdp-gallery-lightbox-close,
  .pdp-gallery-lightbox-nav {
    animation: none !important;
    transition: none !important;
  }
}
