
/* ═══════════════════════════════════════════════════════════════════
   FILE: themes/YOUR_THEME/assets/css/product-gallery.css
   OR paste inside your theme's main CSS file.
   ═══════════════════════════════════════════════════════════════════

   HOW TO INCLUDE: In product.tpl, inside {block name='head' append}:
   <link rel="stylesheet" href="{$urls.theme_assets}css/product-gallery.css">
   ═══════════════════════════════════════════════════════════════════ */

/* ── Product page outer layout ─────────────────────────── */
.ps-product-layout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 992px) {
  .ps-product-layout {
    flex-direction: row;
    gap: 3rem;
    padding: 0 1.5rem;
  }
}

/* ── Gallery column (left) ──────────────────────────────── */
.ps-gallery-column {
  width: 100%;
}

@media (min-width: 992px) {
  .ps-gallery-column {
    width: 55%;
    flex-shrink: 0;
  }
}

@media (min-width: 1280px) {
  .ps-gallery-column {
    width: 58%;
  }
}

/* ── Info column (right, sticky) ────────────────────────── */
.ps-info-column {
  width: 100%;
  padding-top: 1.5rem;
}

@media (min-width: 992px) {
  .ps-info-column {
    width: 45%;
    padding-top: 0;
  }
}

@media (min-width: 1280px) {
  .ps-info-column {
    width: 42%;
  }
}

.ps-info-sticky {
  position: static;
}

@media (min-width: 992px) {
  .ps-info-sticky {
    position: sticky;
    top: 80px; /* adjust to your header height */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    /* hide scrollbar visually but keep scrollable */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .ps-info-sticky::-webkit-scrollbar {
    display: none;
  }
}

/* ── Gallery grid ───────────────────────────────────────── */
.ps-product-gallery {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr; /* single column by default */
}

/* JS adds .ps-two-col when gallery taller than info panel */
@media (min-width: 992px) {
  .ps-product-gallery.ps-two-col {
    grid-template-columns: 1fr 1fr;
  }

  /* First image always full width in 2-col mode */
  .ps-product-gallery.ps-two-col .ps-gallery-item:first-child {
    grid-column: 1 / -1;
  }
}

/* ── Gallery items ──────────────────────────────────────── */
.ps-gallery-item {
  overflow: hidden;
  background: #f5f5f5;
  line-height: 0; /* remove gap below img */
}

.ps-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.ps-gallery-item:hover .ps-gallery-img {
  transform: scale(1.02);
}

/* ── Hide old thumbnail/cover wrappers if still in DOM ─── */
.js-gallery-layout ~ .images-container,
.js-gallery-layout ~ #thumbnails {
  display: none !important;
}

/* ── Mobile stacking ────────────────────────────────────── */
@media (max-width: 991px) {
  .ps-product-gallery.ps-two-col {
    grid-template-columns: 1fr; /* always 1 col on mobile */
  }
  .ps-product-gallery.ps-two-col .ps-gallery-item:first-child {
    grid-column: 1;
  }
}
