/* =========================================================
   pd_videogallery – frontend styles
   ========================================================= */

.pdvg-gallery-item {
    cursor: pointer;
}

.pdvg-thumb-inner {
    position: relative;
    display: inline-block;
    line-height: 0;
    vertical-align: top;
    width: 100%;
}

img.pdvg-yt-thumb {
    display: block;
    width: 100%;
    /* YouTube thumbnails are 4:3 (480x360), not square - force the same 1:1 box as
       the theme's own 160x160 thumbnails and crop the image to fit it. */
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
    object-position: center;
    cursor: pointer;
    background: #000;
}

/* ---- Local video placeholder thumbnail ---- */
span.pdvg-local-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #1a1a2e;
    cursor: pointer;
    position: relative;
}

span.pdvg-local-thumb::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, .6);
    font-size: 22px;
    line-height: 1;
}

.pdvg-gallery-item.pdvg-thumb-active img.pdvg-yt-thumb,
.pdvg-gallery-item.pdvg-thumb-active span.pdvg-local-thumb {
    outline: 2px solid #c00;
    outline-offset: -2px;
}

.pdvg-gallery-item:hover img.pdvg-yt-thumb,
.pdvg-gallery-item:hover span.pdvg-local-thumb {
    opacity: .85;
}

/* ---- Red play circle (centered over thumbnail) ---- */
.pdvg-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - .3125rem));
    width: 20px;
    height: 20px;
    background: rgba(200, 0, 0, .85);
    border-radius: 50%;
    pointer-events: none;
    transition: background .15s ease, transform .15s ease;
}

.pdvg-gallery-item:hover .pdvg-play-overlay {
    background: #c00;
    transform: translate(-50%, calc(-50% - .3125rem)) scale(1.15);
}

.pdvg-play-overlay::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 7px;
    border-color: transparent transparent transparent #fff;
}

/* ---- For local thumbs the play overlay centres without margin offset ---- */
span.pdvg-local-thumb ~ .pdvg-play-overlay {
    transform: translate(-50%, -50%);
}

.pdvg-gallery-item:hover span.pdvg-local-thumb ~ .pdvg-play-overlay {
    transform: translate(-50%, -50%) scale(1.15);
}

/* ---- Full-cover video overlay ---- */
#pdvg-video-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: #000;
}

#pdvg-video-overlay.pdvg-visible {
    display: block;
}

#pdvg-video-overlay iframe,
#pdvg-video-overlay video {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---- Close button ---- */
.pdvg-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 101;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    transition: background .15s ease;
}

.pdvg-close-btn:hover {
    background: rgba(0, 0, 0, .9);
}
