/* =============================================================
   Palmer Product Gallery — v4.1
   ============================================================= */

:root {
  --pg-teal:    #5ab5aa;
  --pg-ink:     #1c1c1c;
  --pg-mid:     #6b6b6b;
  --pg-rule:    #e2e2e2;
  --pg-bg:      #ffffff;
  --pg-bg-soft: #f8f7f5;
  --pg-fast:    180ms cubic-bezier(.4,0,.2,1);
}

/* ── Shell ── */
.product-gallery {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--pg-bg);
  user-select: none;
}

/* ── Main image stage ── */
.product-gallery-main-image {
  position: relative;
  width: 100%;
  height: 560px;
  background: var(--pg-bg-soft);
  overflow: hidden;
  cursor: zoom-in;
  border-bottom: 1px solid var(--pg-rule);
}

.product-gallery-main-image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  transition: transform 650ms cubic-bezier(.25, 0, 0, 1);
  will-change: transform;
  transform-origin: center center;
}

.product-gallery-main-image.pg-swapping img {
  transition: none;
  transform: scale(1) !important;
}

.product-gallery-main-image img.pg-zoomed {
  transform: scale(1.04);
}

/* Crossfade */
.product-gallery-main-image img.pg-fade-out {
  opacity: 0;
  transform: scale(1.008);
  transition: opacity 110ms ease, transform 110ms ease;
}

.product-gallery-main-image img.pg-fade-in {
  animation: pgXfade 270ms cubic-bezier(.22,1,.36,1) forwards;
  pointer-events: none;
}

@keyframes pgXfade {
  from { opacity: 0; transform: scale(1.008); }
  to   { opacity: 1; transform: scale(1); }
}

/* Expand icon — bottom right, no box */
.product-gallery-main-image::after {
  content: '';
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--pg-fast);
  z-index: 2;
  background-color: var(--pg-mid);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M9 21H3v-6'/%3E%3Cpath d='M21 3l-7 7'/%3E%3Cpath d='M3 21l7-7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M9 21H3v-6'/%3E%3Cpath d='M21 3l-7 7'/%3E%3Cpath d='M3 21l7-7'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.product-gallery-main-image:hover::after {
  opacity: 0.45;
}

/* ── Thumbnail strip ── */
.pg-thumb-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 0 0;
  width: 100%;
  box-sizing: border-box;
}

.pg-arrow {
  all: unset;
  box-sizing: border-box;
  width: 32px;
  height: 44px;
  flex: 0 0 32px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: var(--pg-ink);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--pg-fast), color var(--pg-fast);
}

.pg-arrow:hover {
  color: var(--pg-teal);
  opacity: 1;
}

.pg-arrow.is-disabled {
  opacity: 0.22;
  pointer-events: none;
}

/* Counter sits BELOW the thumbnail row */
.pg-thumb-count {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding-left: 32px;
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--pg-mid);
  text-align: left;
}

.pg-thumb-wrapper.pg-no-scroll .pg-arrow {
  display: none !important;
}

/* Hide counter when there's nothing to scroll */
.pg-thumb-wrapper.pg-no-scroll ~ .pg-thumb-count {
  display: none !important;
}

.pg-arrow:hover  { color: var(--pg-mid); }
.pg-arrow:focus,
.pg-arrow:active { background: none !important; border: none !important; box-shadow: none !important; }

.pg-arrow svg {
  display: block;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.product-gallery-thumbnails {
  flex: 1;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  padding-right: 1px;
  box-sizing: border-box;
}

.product-gallery-thumbnails .slick-list { overflow: visible; }
.product-gallery-thumbnails .slick-track { display: flex; }

/* Kill any slick-injected arrow styles completely */
.product-gallery-thumbnails .slick-prev,
.product-gallery-thumbnails .slick-next,
.product-gallery-thumbnails .slick-prev::before,
.product-gallery-thumbnails .slick-next::before {
  display: none !important;
  content: none !important;
}

.product-thumbnail {
  padding: 0 4px;
  outline: none;
  box-sizing: border-box;
}

.product-thumbnail:first-child { padding-left: 0; }
.product-thumbnail:last-child  { padding-right: 4px; }

.product-thumbnail img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
  background: var(--pg-bg-soft);
  border: 1px solid transparent;
  cursor: pointer;
  opacity: 0.42;
  transition: opacity var(--pg-fast), border-color var(--pg-fast), transform var(--pg-fast);
  box-sizing: border-box;
}

.product-thumbnail img:hover  { opacity: 0.7; }
.product-thumbnail img.active-thumbnail {
  opacity: 1;
  border-color: var(--pg-teal);
  outline: 1px solid var(--pg-teal);
  outline-offset: -1px;
  animation: none;
}

/* Staggered entrance */
.product-thumbnail:nth-child(1) { animation: pgThumbIn 320ms 0ms   both; }
.product-thumbnail:nth-child(2) { animation: pgThumbIn 320ms 55ms  both; }
.product-thumbnail:nth-child(3) { animation: pgThumbIn 320ms 110ms both; }
.product-thumbnail:nth-child(4) { animation: pgThumbIn 320ms 165ms both; }
.product-thumbnail:nth-child(5) { animation: pgThumbIn 320ms 220ms both; }
.product-thumbnail:nth-child(n+6) { animation: pgThumbIn 320ms 260ms both; }

@keyframes pgThumbIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Elementor editor safety ── */
.elementor-editor-active .product-gallery-main-image {
  height: auto !important;
  min-height: 200px;
  overflow: visible;
}

.elementor-editor-active .product-gallery-main-image img {
  height: 100% !important;
  max-height: 400px;
  object-fit: cover !important;
  object-position: center !important;
  transform: none !important;
  transition: none !important;
}

.elementor-editor-active .product-gallery-main-image::after {
  display: none !important;
}

.elementor-editor-active .pg-thumb-wrapper {
  flex-wrap: wrap;
}

.elementor-editor-active .product-thumbnail img {
  opacity: 1 !important;
  animation: none !important;
}

/* ── Lightbox ── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(20,20,20,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms ease;
  cursor: zoom-out;
}

.lightbox-overlay.is-open { opacity: 1; }

.lightbox-overlay::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--pg-teal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 380ms cubic-bezier(.22,1,.36,1) 80ms;
  z-index: 1;
}

.lightbox-overlay.is-open::before { transform: scaleX(1); }

.lightbox-counter {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.45);
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease 280ms;
  z-index: 10060;
}

.lightbox-overlay.is-open .lightbox-counter { opacity: 1; }

.lightbox-close-btn {
  all: unset;
  box-sizing: border-box;
  position: fixed;
  top: 22px;
  right: 26px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  z-index: 10060;
  pointer-events: auto;
  transition: color var(--pg-fast);
}

.lightbox-close-btn:hover { color: #fff; }

.lightbox-close-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.lightbox-content {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lightbox-slider { width: 100%; height: 100%; visibility: hidden; }
.lightbox-slider.is-ready { visibility: visible; }
.lightbox-slider .slick-list,
.lightbox-slider .slick-track { height: 100%; overflow: visible !important; }

.lightbox-slide {
  height: 100vh;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.img-close-ctn {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(88vw, 1100px);
  max-height: 82vh;
  position: relative;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 260ms cubic-bezier(.22,1,.36,1), transform 340ms cubic-bezier(.22,1,.36,1);
}

.lightbox-overlay.is-open .img-close-ctn { opacity: 1; transform: translateY(0); }

.lightbox-slide img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  pointer-events: auto;
  cursor: default;
}

.lightbox-prev,
.lightbox-next,
.lightbox-close,
.lightbox-close-desktop {
  all: unset;
  box-sizing: border-box;
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-close,
.lightbox-close-desktop { display: none !important; }

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
  z-index: 10050;
  font-size: 16px;
  transition: background var(--pg-fast), border-color var(--pg-fast), color var(--pg-fast);
}

.lightbox-prev { left: 22px; }
.lightbox-next { right: 22px; }

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
  transform: translateY(-50%);
}

.lightbox-prev.slick-disabled,
.lightbox-next.slick-disabled { opacity: 0.2; pointer-events: none; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .product-gallery-main-image { height: 400px; }

  .pg-arrow {
    display: inline-flex !important;
    width: 28px;
    flex-basis: 28px;
  }

  .pg-thumb-count {
    font-size: 10px;
  }

  .product-gallery-thumbnails {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .product-gallery-thumbnails::-webkit-scrollbar { display: none; }

  .product-gallery-thumbnails .slick-list { overflow: visible; }
  .product-gallery-thumbnails .slick-track { width: max-content !important; }

  .product-thumbnail { width: 80px; flex-shrink: 0; }

  .lightbox-prev { left: 8px; width: 40px; height: 40px; font-size: 14px; }
  .lightbox-next { right: 8px; width: 40px; height: 40px; font-size: 14px; }
  .lightbox-close-btn { top: 12px; right: 12px; }
  .lightbox-counter { bottom: 20px; }
}

@media (max-width: 480px) {
  .product-gallery-main-image { height: 300px; }
  .lightbox-slide img { max-height: 75vh; }
}

.emoji { display: none !important; }