body.single-product {
  --chai25-gallery-bg: #fff8ea;
  --chai25-gallery-card: #fffaf1;
  --chai25-gallery-border: #ead8bd;
  --chai25-gallery-text: #2b1b10;
  --chai25-gallery-muted: #7c6b5b;
  --chai25-gallery-brown: #7a4f2b;
  --chai25-gallery-brown-dark: #5b3519;
  --chai25-gallery-shadow: 0 16px 38px rgba(84, 49, 21, .12);
}

/* Основная галерея */
body.single-product .woocommerce-product-gallery.chai25-gallery-ready {
  position: relative !important;
}

body.single-product .woocommerce-product-gallery.chai25-gallery-ready .woocommerce-product-gallery__wrapper {
  position: relative !important;
}

/* Стрелки основной галереи */
body.single-product .chai25-gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 12;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(234, 216, 189, .95);
  border-radius: 999px;
  background: rgba(255, 250, 241, .92);
  color: var(--chai25-gallery-text);
  box-shadow: 0 10px 24px rgba(84, 49, 21, .13);
  cursor: pointer;
  transform: translateY(-50%);
  transform-origin: center;
  transition:
    background .18s ease,
    color .18s ease,
    transform .18s cubic-bezier(.2, .8, .2, 1),
    box-shadow .18s ease,
    border-color .18s ease;
  -webkit-tap-highlight-color: transparent;
}

body.single-product .chai25-gallery-arrow:hover,
body.single-product .chai25-gallery-arrow:focus-visible {
  background: var(--chai25-gallery-brown);
  color: #fffaf0;
  border-color: var(--chai25-gallery-brown);
  transform: translateY(-50%) scale(1.02);
  box-shadow: 0 14px 30px rgba(84, 49, 21, .18);
}

body.single-product .chai25-gallery-arrow:active {
  background: var(--chai25-gallery-brown-dark);
  color: #fffaf0;
  border-color: var(--chai25-gallery-brown-dark);
  transform: translateY(-50%) scale(.985) !important;
  box-shadow: 0 7px 16px rgba(84, 49, 21, .14);
  transition-duration: .08s;
}

body.single-product .chai25-gallery-arrow--prev {
  left: 14px;
}

body.single-product .chai25-gallery-arrow--next {
  right: 14px;
}

body.single-product .chai25-gallery-arrow svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}

/* Миниатюры */
body.single-product .chai25-thumbs-shell {
  position: relative;
  width: 100%;
  margin-top: 12px;
  padding: 0 34px;
  box-sizing: border-box;
}

body.single-product .chai25-thumbs-shell .flex-control-thumbs {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  list-style: none !important;
  -webkit-overflow-scrolling: touch;
}

body.single-product .chai25-thumbs-shell .flex-control-thumbs::-webkit-scrollbar {
  height: 0;
}

body.single-product .chai25-thumbs-shell .flex-control-thumbs li {
  flex: 0 0 74px !important;
  width: 74px !important;
  min-width: 74px !important;
  max-width: 74px !important;
  height: 74px !important;
  margin: 0 !important;
  padding: 0 !important;
  scroll-snap-align: start;
}

body.single-product .chai25-thumbs-shell .flex-control-thumbs img {
  width: 74px !important;
  height: 74px !important;
  display: block !important;
  object-fit: cover !important;
  border: 2px solid transparent !important;
  border-radius: 12px !important;
  background: #f3e5cf;
  opacity: .58 !important;
  cursor: pointer;
  transition:
    opacity .16s ease,
    border-color .16s ease,
    transform .16s ease,
    box-shadow .16s ease;
}

body.single-product .chai25-thumbs-shell .flex-control-thumbs img.flex-active,
body.single-product .chai25-thumbs-shell .flex-control-thumbs img:hover {
  opacity: 1 !important;
  border-color: var(--chai25-gallery-brown) !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(84, 49, 21, .10);
}

/* Стрелки миниатюр */
body.single-product .chai25-thumbs-btn {
  position: absolute;
  top: 50%;
  z-index: 10;
  width: 28px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(234, 216, 189, .95);
  border-radius: 999px;
  background: rgba(255, 250, 241, .95);
  color: var(--chai25-gallery-text);
  box-shadow: 0 8px 18px rgba(84, 49, 21, .10);
  cursor: pointer;
  transform: translateY(-50%);
  transform-origin: center;
  transition:
    background .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    transform .18s cubic-bezier(.2, .8, .2, 1);
}

body.single-product .chai25-thumbs-btn:hover,
body.single-product .chai25-thumbs-btn:focus-visible {
  background: var(--chai25-gallery-brown);
  color: #fffaf0;
  border-color: var(--chai25-gallery-brown);
}

body.single-product .chai25-thumbs-btn:hover,
body.single-product .chai25-thumbs-btn:focus-visible {
  transform: translateY(-50%) scale(1.015);
}

body.single-product .chai25-thumbs-btn:active {
  background: var(--chai25-gallery-brown-dark);
  color: #fffaf0;
  border-color: var(--chai25-gallery-brown-dark);
  transform: translateY(-50%) scale(.985) !important;
  box-shadow: 0 5px 12px rgba(84, 49, 21, .12);
  transition-duration: .08s;
}

body.single-product .chai25-thumbs-btn--prev {
  left: 0;
}

body.single-product .chai25-thumbs-btn--next {
  right: 0;
}

body.single-product .chai25-thumbs-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Если WooCommerce PhotoSwipe всё-таки открывается — возвращаем стрелки */
body.single-product .pswp__button--arrow--left,
body.single-product .pswp__button--arrow--right {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Наш лёгкий лайтбокс */
body.chai25-lightbox-open {
  overflow: hidden !important;
}

.chai25-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(21, 13, 7, .78);
  backdrop-filter: blur(7px);
  box-sizing: border-box;
}

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

.chai25-lightbox__panel {
  position: relative;
  width: min(1120px, 100%);
  height: min(86vh, 820px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(234, 216, 189, .55);
  border-radius: 24px;
  background: rgba(255, 248, 234, .95);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .30);
  box-sizing: border-box;
}

.chai25-lightbox__stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 18px;
  background: #fffaf1;
}

.chai25-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 14px;
  user-select: none;
}

.chai25-lightbox__counter {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  min-width: 48px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(43, 27, 16, .78);
  color: #fffaf0;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.chai25-lightbox__close,
.chai25-lightbox__arrow {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(234, 216, 189, .75);
  border-radius: 999px;
  background: rgba(255, 250, 241, .96);
  color: var(--chai25-gallery-text);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
  cursor: pointer;
  transform-origin: center;
  transition:
    background .18s ease,
    color .18s ease,
    transform .18s cubic-bezier(.2, .8, .2, 1),
    border-color .18s ease,
    box-shadow .18s ease;
}

.chai25-lightbox__close:hover,
.chai25-lightbox__arrow:hover {
  background: var(--chai25-gallery-brown);
  color: #fffaf0;
  border-color: var(--chai25-gallery-brown);
}

.chai25-lightbox__close {
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
}

.chai25-lightbox__arrow {
  top: 50%;
  width: 50px;
  height: 50px;
  transform: translateY(-50%);
}

.chai25-lightbox__arrow:hover {
  transform: translateY(-50%) scale(1.02);
}

.chai25-lightbox__arrow:active {
  transform: translateY(-50%) scale(.985) !important;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .16);
  transition-duration: .08s;
}

.chai25-lightbox__close:active {
  transform: scale(.985) !important;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .16);
  transition-duration: .08s;
}

.chai25-lightbox__arrow--prev {
  left: 14px;
}

.chai25-lightbox__arrow--next {
  right: 14px;
}

.chai25-lightbox__arrow svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.chai25-lightbox__thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chai25-lightbox__thumbs::-webkit-scrollbar {
  height: 0;
}

.chai25-lightbox__thumb {
  flex: 0 0 62px;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f3e5cf;
  overflow: hidden;
  cursor: pointer;
  opacity: .58;
  transition: opacity .16s ease, border-color .16s ease, transform .16s ease;
}

.chai25-lightbox__thumb.is-active,
.chai25-lightbox__thumb:hover {
  opacity: 1;
  border-color: var(--chai25-gallery-brown);
  transform: translateY(-1px);
}

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

/* Мобильная версия */
@media (max-width: 760px) {
  body.single-product .chai25-gallery-arrow {
    width: 38px;
    height: 38px;
  }

  body.single-product .chai25-gallery-arrow--prev {
    left: 10px;
  }

  body.single-product .chai25-gallery-arrow--next {
    right: 10px;
  }

  body.single-product .chai25-thumbs-shell {
    padding: 0 30px;
  }

  body.single-product .chai25-thumbs-shell .flex-control-thumbs li,
  body.single-product .chai25-thumbs-shell .flex-control-thumbs img {
    width: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
    height: 62px !important;
  }

  body.single-product .chai25-thumbs-btn {
    width: 26px;
    height: 38px;
  }

  .chai25-lightbox {
    padding: 10px;
  }

  .chai25-lightbox__panel {
    height: 88vh;
    padding: 10px;
    border-radius: 18px;
  }

  .chai25-lightbox__close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .chai25-lightbox__arrow {
    width: 42px;
    height: 42px;
  }

  .chai25-lightbox__arrow--prev {
    left: 10px;
  }

  .chai25-lightbox__arrow--next {
    right: 10px;
  }

  .chai25-lightbox__thumb {
    flex-basis: 54px;
    width: 54px;
    height: 54px;
  }
}


@media (prefers-reduced-motion: reduce) {
  body.single-product .chai25-gallery-arrow,
  body.single-product .chai25-thumbs-btn,
  .chai25-lightbox__close,
  .chai25-lightbox__arrow {
    transition-duration: .01ms !important;
  }
}
