/**
 * Astral Gallery 2.0
 * Stable single-image stage; intentionally independent of FlexSlider.
 */
.acp-gallery2,
.acp-gallery2 * { box-sizing: border-box; }

.acp-gallery2 {
  --acp-gallery-gap: 14px;
  width: 100%;
  min-width: 0;
}

.acp-gallery2__stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(360px, 52vh, 610px);
  max-height: calc(100vh - 225px);
  overflow: hidden;
  border: 1px solid var(--acp-color-border, #dfe4df);
  border-radius: var(--acp-radius-lg, 20px);
  background: var(--acp-color-soft, #f7f8f5);
  isolation: isolate;
}

.acp-gallery2__image-button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: clamp(16px, 2.4vw, 32px);
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.acp-gallery2__main-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(560px, calc(100vh - 275px));
  object-fit: contain;
  object-position: center;
  transition: opacity 160ms ease, transform 160ms ease;
  content-visibility: visible !important;
}

.acp-gallery2__stage[data-mode="portrait"] .acp-gallery2__main-image {
  max-width: min(82%, 520px);
  max-height: min(590px, calc(100vh - 250px));
}

.acp-gallery2__stage[data-mode="landscape"] .acp-gallery2__main-image {
  max-width: 96%;
  max-height: min(500px, calc(100vh - 300px));
}

.acp-gallery2.is-changing .acp-gallery2__main-image { opacity: .18; transform: scale(.992); }

.acp-gallery2__zoom,
.acp-gallery2__stage-arrow,
.acp-gallery2__rail-arrow,
.acp-gallery2__lightbox button {
  display: grid;
  place-items: center;
  border: 1px solid rgba(30, 50, 36, .16);
  background: rgba(255,255,255,.94);
  color: #173c2b;
  box-shadow: 0 8px 24px rgba(20,45,28,.12);
  cursor: pointer;
}

.acp-gallery2__zoom {
  position: absolute;
  z-index: 4;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.acp-gallery2__stage-arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 42px;
  height: 56px;
  border-radius: 999px;
  font-size: 32px;
  line-height: 1;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}
.acp-gallery2__stage-arrow--prev { left: 14px; }
.acp-gallery2__stage-arrow--next { right: 14px; }
.acp-gallery2__stage:hover .acp-gallery2__stage-arrow,
.acp-gallery2__stage:focus-within .acp-gallery2__stage-arrow { opacity: 1; }
.acp-gallery2__stage-arrow:hover { transform: translateY(-50%) scale(1.04); }

.acp-gallery2__counter {
  position: absolute;
  z-index: 3;
  right: 16px;
  bottom: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20,34,25,.76);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.acp-gallery2__rail-wrap {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 42px;
  align-items: center;
  gap: 10px;
  margin-top: var(--acp-gallery-gap);
}

.acp-gallery2__rail {
  display: flex;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 2px 9px;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(31,94,57,.35) transparent;
  overscroll-behavior-inline: contain;
}
.acp-gallery2__rail::-webkit-scrollbar { height: 7px; }
.acp-gallery2__rail::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(31,94,57,.35); }

.acp-gallery2__rail-arrow {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 28px;
}

.acp-gallery2__thumb {
  position: relative;
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  padding: 5px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  scroll-snap-align: center;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.acp-gallery2__thumb:hover { transform: translateY(-1px); border-color: rgba(31,94,57,.38); }
.acp-gallery2__thumb.is-active { border-color: var(--acp-color-primary, #1f5e39); box-shadow: 0 0 0 2px rgba(31,94,57,.13); }
.acp-gallery2__thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.acp-gallery2__thumb span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(21,38,27,.78);
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.acp-gallery2 button:focus-visible { outline: 3px solid rgba(31,94,57,.36); outline-offset: 3px; }

.acp-gallery2__lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10,14,11,.96);
  color: #fff;
}
.acp-gallery2__lightbox::backdrop { background: rgba(10,14,11,.82); }
.acp-gallery2__lightbox[open] { display: grid; grid-template-columns: 68px minmax(0,1fr) 68px; grid-template-rows: 64px minmax(0,1fr); }
.acp-gallery2__lightbox-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 10px 18px;
}
.acp-gallery2__lightbox-toolbar button { width: 44px; height: 44px; border-radius: 50%; }
.acp-gallery2__lightbox-canvas { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 12px; overflow: auto; }
.acp-gallery2__lightbox-canvas img { display: block; max-width: 100%; max-height: calc(100dvh - 88px); width: auto; height: auto; object-fit: contain; }
.acp-gallery2__lightbox-arrow { align-self: center; width: 48px; height: 64px; margin: 0 auto; border-radius: 999px; font-size: 34px; }

@media (min-width: 980px) {
  .acp-product-detail-page .acp-product-hero {
    grid-template-columns: minmax(0, .86fr) minmax(390px, 1.14fr);
    align-items: start;
    gap: clamp(32px, 4vw, 62px);
  }
  .acp-product-detail-page .acp-product-hero__gallery { min-width: 0; }
}

@media (max-height: 780px) and (min-width: 980px) {
  .acp-gallery2__stage { min-height: 330px; max-height: calc(100vh - 190px); }
  .acp-gallery2__main-image { max-height: calc(100vh - 245px); }
  .acp-gallery2__stage[data-mode="portrait"] .acp-gallery2__main-image { max-height: calc(100vh - 220px); }
  .acp-gallery2__thumb { flex-basis: 68px; width: 68px; height: 68px; }
}

@media (max-width: 979px) {
  .acp-gallery2__stage { min-height: clamp(330px, 68vw, 570px); max-height: none; }
  .acp-gallery2__image-button { min-height: inherit; }
  .acp-gallery2__main-image,
  .acp-gallery2__stage[data-mode="portrait"] .acp-gallery2__main-image,
  .acp-gallery2__stage[data-mode="landscape"] .acp-gallery2__main-image { max-width: 94%; max-height: min(68vh, 650px); }
  .acp-gallery2__stage-arrow { opacity: .88; }
}

@media (max-width: 640px) {
  .acp-gallery2__stage { min-height: 330px; border-radius: 14px; }
  .acp-gallery2__image-button { padding: 12px; }
  .acp-gallery2__main-image,
  .acp-gallery2__stage[data-mode="portrait"] .acp-gallery2__main-image,
  .acp-gallery2__stage[data-mode="landscape"] .acp-gallery2__main-image { max-width: 100%; max-height: 62vh; }
  .acp-gallery2__rail-wrap { grid-template-columns: 36px minmax(0,1fr) 36px; gap: 6px; }
  .acp-gallery2__rail-arrow { width: 36px; height: 36px; }
  .acp-gallery2__thumb { flex-basis: 66px; width: 66px; height: 66px; }
  .acp-gallery2__stage-arrow { width: 36px; height: 48px; font-size: 28px; }
  .acp-gallery2__stage-arrow--prev { left: 8px; }
  .acp-gallery2__stage-arrow--next { right: 8px; }
  .acp-gallery2__lightbox[open] { grid-template-columns: 46px minmax(0,1fr) 46px; }
  .acp-gallery2__lightbox-arrow { width: 40px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .acp-gallery2__main-image,
  .acp-gallery2__thumb,
  .acp-gallery2__rail { transition: none; scroll-behavior: auto; }
}
