/* =========================================================
   WooCommerce Video Gallery — wvg-gallery.css
   ========================================================= */

/* ── Variables ──────────────────────────────────────────── */
:root {
    --wvg-accent:       #1a1a1a;
    --wvg-bg:           #f7f7f7;
    --wvg-thumb-size:   80px;
    --wvg-thumb-gap:    8px;
    --wvg-radius:       6px;
    --wvg-transition:   0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --wvg-overlay:      rgba(0, 0, 0, 0.56);
    --wvg-play-size:    72px;
}

/* ── Wrapper ─────────────────────────────────────────────── */
.wvg-gallery-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    /* ensure it sits where WooCommerce gallery normally lives */
    position: relative;
}

/* ── Stage (main viewport) ───────────────────────────────── */
.wvg-stage {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--wvg-radius);
    background: var(--wvg-bg);
    /* maintain aspect ratio: default 1:1 but overridable */
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

/* ── Slides ──────────────────────────────────────────────── */
.wvg-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--wvg-transition);
    background: #000;
}

.wvg-slide--active {
    opacity: 1;
    pointer-events: auto;
    position: relative;  /* take space in flow */
}

/* ── Gallery image ───────────────────────────────────────── */
.wvg-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
    cursor: zoom-in;
}

.wvg-image:hover {
    transform: scale(1.02);
}

/* ── Video wrapper ───────────────────────────────────────── */
.wvg-video-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.wvg-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    outline: none;
}


/* ── Play button overlay ─────────────────────────────────── */
.wvg-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: var(--wvg-play-size);
    height: var(--wvg-play-size);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform var(--wvg-transition), opacity var(--wvg-transition);
    z-index: 10;
    pointer-events: auto;
}

.wvg-play-btn svg {
    width: 100%;
    height: 100%;
    drop-shadow: 0 2px 12px rgba(0,0,0,0.5);
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.6));
}

.wvg-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* hide play button when video is playing */
.wvg-video-wrap.is-playing .wvg-play-btn {
    opacity: 0;
    pointer-events: none;
}

/* show on hover even while playing */
.wvg-video-wrap.is-playing:hover .wvg-play-btn {
    opacity: 1;
    pointer-events: auto;
}

/* ── Fullscreen button ───────────────────────────────────── */
.wvg-fullscreen-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--wvg-transition), transform var(--wvg-transition);
    z-index: 11;
}

.wvg-fullscreen-btn svg {
    width: 100%;
    height: 100%;
}

.wvg-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.08);
}

/* ── Prev / Next navigation ──────────────────────────────── */
.wvg-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.88);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background var(--wvg-transition), transform var(--wvg-transition), opacity var(--wvg-transition);
    color: var(--wvg-accent);
    opacity: 0;  /* hide until hover */
}

.wvg-nav svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.wvg-stage:hover .wvg-nav {
    opacity: 1;
}

.wvg-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
}

.wvg-nav--prev { left: 10px; }
.wvg-nav--next { right: 10px; }

/* ── Thumbnail strip ─────────────────────────────────────── */
.wvg-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wvg-thumb-gap);
    list-style: none;
    margin: 0;
    padding: 0;
}

.wvg-thumb {
    position: relative;
    width: var(--wvg-thumb-size);
    height: var(--wvg-thumb-size);
    border: 2px solid transparent;
    border-radius: var(--wvg-radius);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: var(--wvg-bg);
    transition: border-color var(--wvg-transition), transform var(--wvg-transition);
    flex-shrink: 0;
}

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

.wvg-thumb:hover {
    border-color: #999;
    transform: scale(1.04);
}

.wvg-thumb--active {
    border-color: var(--wvg-accent) !important;
}

/* Video icon when no poster */
.wvg-thumb-video-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #222;
    color: #fff;
}

.wvg-thumb-video-icon svg {
    width: 32px;
    height: 32px;
}

/* Video play badge on thumbnail */
.wvg-thumb-play-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    color: #fff;
}

.wvg-thumb-play-badge svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* ── Lightbox ────────────────────────────────────────────── */
.wvg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wvgFadeIn 0.25s ease forwards;
}

.wvg-lightbox[hidden] {
    display: none;
}

.wvg-lightbox-img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 4px;
    animation: wvgScaleIn 0.3s ease forwards;
}

.wvg-lightbox-close {
    position: fixed;
    top: 18px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--wvg-transition), transform var(--wvg-transition);
    z-index: 10;
}

.wvg-lightbox-close:hover {
    background: rgba(255,255,255,0.22);
    transform: scale(1.1) rotate(90deg);
}

.wvg-lightbox-close svg {
    width: 20px;
    height: 20px;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes wvgFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes wvgScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --wvg-thumb-size: 60px;
        --wvg-play-size:  56px;
    }

    .wvg-nav {
        opacity: 1;   /* always visible on touch */
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    :root {
        --wvg-thumb-size: 52px;
    }
}
