/* =============================================================================
   Product V2 — Gallery layout
   Eloy & Becker child theme
   ============================================================================= */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */

.single-product .product-v2__wrapper {
    padding-top: 2rem;
    padding-bottom: 5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   Mobile:  single column — header → gallery → body (flex column, DOM order)
   Desktop: CSS Grid — gallery left (sticky, spans rows) | header + body right
   ═══════════════════════════════════════════════════════════════════════════ */

.product-v2__layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .product-v2__layout {
        display: grid;
        grid-template-columns: 41.6667% 58.3333%;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "gallery header"
            "gallery body";
        align-items: start;
        gap: 0;
    }

    .product-v2__gallery-col  { grid-area: gallery; }
    .product-v2__header-col   { grid-area: header; }
    .product-v2__body-col     { grid-area: body; }
}

/* ── Header column ────────────────────────────────────────────────────────── */

.product-v2__header-col {
    padding-top: 1.5rem;
}

@media (min-width: 992px) {
    .product-v2__header-col {
        padding-top: 2.5rem;
        padding-bottom: 1.5rem;
        padding-left: 3rem;
    }
}

/* ── Body column ──────────────────────────────────────────────────────────── */

.product-v2__body-col {
    padding-bottom: 2rem;
}

@media (min-width: 992px) {
    .product-v2__body-col {
        padding-left: 3rem;
        padding-bottom: 3rem;
        min-height: 30vh;
    }
}

.product-v2__share-row {
    margin-bottom: 1.5rem;
}

.product-v2__body {
    /* inherits parent styles */
}

/* ═══════════════════════════════════════════════════════════════════════════
   GALLERY COLUMN
   ═══════════════════════════════════════════════════════════════════════════ */

.product-v2__gallery {
    padding: 0;
}

@media (min-width: 992px) {
    .product-v2__gallery {
        position: sticky;
        top: calc(var(--admin-bar--height, 0px) + 5rem);
        padding: 2.5rem 2rem 2.5rem 0;
    }
}

/* ── Main image container ─────────────────────────────────────────────────── */

.product-v2__main-image {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    background-color: #f5f5f5;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Slightly less tall on mobile so it doesn't dominate the viewport */
@media (max-width: 991.98px) {
    .product-v2__main-image {
        aspect-ratio: 3 / 2;
        border-radius: 0.75rem;
    }
}

.product-v2__main-image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    overflow: hidden;
}

.product-v2__main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: opacity 0.2s ease, transform 0.35s ease;
    will-change: transform;
}

.product-v2__main-image-link:hover .product-v2__main-img {
    transform: scale(1.04);
}

/* Fade-out state triggered by JS during image swap */
.product-v2__main-img.is-swapping {
    opacity: 0;
    transform: scale(0.97);
}

/* ── Thumbnail strip ──────────────────────────────────────────────────────── */

.product-v2__thumbnails {
    display: flex;
    gap: 0.625rem;
    margin-top: 0.875rem;
    overflow-x: auto;
    padding-bottom: 0.375rem;
    scrollbar-width: thin;
    scrollbar-color: var(--bs-secondary, #888) transparent;
}

.product-v2__thumbnails::-webkit-scrollbar {
    height: 4px;
}
.product-v2__thumbnails::-webkit-scrollbar-thumb {
    background: var(--bs-secondary, #888);
    border-radius: 2px;
}

.product-v2__thumb {
    flex: 0 0 auto;
    width: 4.5rem;
    height: 4.5rem;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #efefef;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

@media (min-width: 992px) {
    .product-v2__thumb {
        width: 5rem;
        height: 5rem;
    }
}

.product-v2__thumb:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    border-color: var(--bs-secondary, #888);
}

.product-v2__thumb.is-active {
    border-color: var(--bs-primary, #333);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-v2__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TITLE & SUBTITLE
   ═══════════════════════════════════════════════════════════════════════════ */

.product-v2__title-group {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.product-v2__title {
    font-size: 2.25rem;
    line-height: 1.1;
    margin-bottom: 0.625rem;
}

@media (min-width: 768px) {
    .product-v2__title {
        font-size: 3rem;
    }
}

@media (min-width: 1200px) {
    .product-v2__title {
        font-size: 3.5rem;
    }
}

.product-v2__subtitle {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--bs-primary);
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .product-v2__subtitle {
        font-size: 1.375rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GALLERY BACKGROUND IMAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.product-v2__gallery.has-bg {
    background-image: var(--gallery-bg-url);
    background-size: cover;
    background-position: center;
    border-radius: 1.25rem;
    position: relative;
}

/* Subtle dark veil so product images always read clearly against any bg */
.product-v2__gallery.has-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.product-v2__gallery.has-bg > * {
    position: relative;
    z-index: 1;
}

/* Make the main image container transparent so the bg bleeds through */
.product-v2__gallery.has-bg .product-v2__main-image {
    background-color: transparent;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}

/* Slight drop shadow on the product image itself for separation */
.product-v2__gallery.has-bg .product-v2__main-img {
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.2));
}

/* Thumbnail strip gets a frosted backing */
.product-v2__gallery.has-bg .product-v2__thumbnails {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 0.625rem;
    padding: 0.375rem;
}

.product-v2__gallery.has-bg .product-v2__thumb {
    background: rgba(255, 255, 255, 0.85);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENTRANCE ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes productFadeUp {
    from {
        opacity: 0;
        transform: translateY(1.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-v2__header-col {
    animation: productFadeUp 0.5s ease both;
}

.product-v2__gallery-col {
    animation: productFadeUp 0.5s 0.1s ease both;
}

.product-v2__body-col {
    animation: productFadeUp 0.5s 0.2s ease both;
}
