/**
 * WC Gallery Fix v1.0.2 — gallery CSS
 *
 * Styles our self-contained gallery markup. Uses high-specificity selectors
 * scoped to .wcgf-gallery so they only affect our component, never anything else.
 */

/* ==============================================================
   Parent layout — make sure the product page is two columns.
   We still need this because the theme controls the .product container.
   ============================================================== */
body.single-product div.product {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 3rem !important;
    align-items: flex-start !important;
    max-width: 1280px !important;
    margin: 2rem auto !important;
    padding: 0 1.5rem !important;
    width: 100% !important;
}

body.single-product div.product > .wcgf-gallery {
    flex: 1 1 480px;
    min-width: 0;
    max-width: 600px;
}

body.single-product div.product > .summary,
body.single-product div.product > .summary.entry-summary {
    flex: 1 1 380px !important;
    min-width: 0 !important;
    max-width: 600px !important;
    padding: 0.5rem 0 !important;
    float: none !important;
    width: auto !important;
}

body.single-product div.product > .woocommerce-tabs,
body.single-product div.product > .related,
body.single-product div.product > .upsells {
    flex: 1 0 100%;
    width: 100%;
}

@media (max-width: 880px) {
    body.single-product div.product > .wcgf-gallery,
    body.single-product div.product > .summary {
        flex: 1 0 100% !important;
        max-width: 100% !important;
    }
}

/* ==============================================================
   The gallery container
   ============================================================== */
.wcgf-gallery {
    position: relative;
    display: block;
    font-family: inherit;
}

/* ==============================================================
   Main viewer
   ============================================================== */
.wcgf-gallery__main {
    position: relative;
    background: #fafafa;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    margin: 0 0 0.75rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* All slides absolute-positioned, only the active one visible */
.wcgf-gallery__slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcgf-gallery__slide.wcgf-is-active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.wcgf-gallery__slide > a,
.wcgf-gallery__zoom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
    text-decoration: none;
    padding: 1rem;
    box-sizing: border-box;
}

.wcgf-gallery__slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* ==============================================================
   Nav arrows
   ============================================================== */
.wcgf-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1a;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
    padding: 0;
    line-height: 0;
}

.wcgf-gallery__main:hover .wcgf-gallery__nav {
    opacity: 1;
}

.wcgf-gallery__nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.06);
}

.wcgf-gallery__nav--prev { left: 0.75rem; }
.wcgf-gallery__nav--next { right: 0.75rem; }

.wcgf-gallery__nav svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Always visible on touch devices */
@media (hover: none) {
    .wcgf-gallery__nav {
        opacity: 0.85;
    }
}

/* ==============================================================
   Zoom trigger badge (top-right)
   ============================================================== */
.wcgf-gallery__trigger {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 6;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    transition: transform 0.18s ease;
}

.wcgf-gallery__main:hover .wcgf-gallery__trigger {
    transform: scale(1.06);
}

.wcgf-gallery__trigger svg {
    width: 16px;
    height: 16px;
}

/* ==============================================================
   Thumbnails
   ============================================================== */
.wcgf-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(var(--wcgf-cols, 4), minmax(0, 1fr));
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wcgf-gallery__thumb {
    list-style: none;
    margin: 0;
    padding: 0;
    width: auto;
    float: none;
}

.wcgf-gallery__thumb button {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 2px solid transparent;
    background: #fafafa;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.18s ease, opacity 0.18s ease;
    opacity: 0.6;
}

.wcgf-gallery__thumb button:hover {
    opacity: 0.9;
}

.wcgf-gallery__thumb.wcgf-is-active button {
    opacity: 1;
    border-color: rgba(0, 0, 0, 0.5);
}

.wcgf-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}

/* ==============================================================
   Hide the loose anchor tags the theme emits BEFORE our gallery
   (the legacy 3-stacked-links output from Kids Gift Shop)
   ============================================================== */
body.single-product div.product > a[href*="/wp-content/uploads/"] {
    display: none !important;
}

/* GLightbox z-index above everything */
.glightbox-clean .gslide-description {
    background: rgba(0, 0, 0, 0.6) !important;
}
.glightbox-container {
    z-index: 999999 !important;
}
