/* ============================================================
   Divi Video Dynamic Object — styles frontend
   ============================================================ */

/* Wrapper principal */
.dvdo-video-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
}

/* --- Ratios d'aspect --- */
.dvdo-ratio-16-9  { aspect-ratio: 16 / 9; }
.dvdo-ratio-4-3   { aspect-ratio: 4 / 3; }
.dvdo-ratio-1-1   { aspect-ratio: 1 / 1; }
.dvdo-ratio-9-16  { aspect-ratio: 9 / 16; }
.dvdo-ratio-none  { aspect-ratio: auto; }

/* Fallback pour les navigateurs sans support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .dvdo-ratio-16-9::before { content: ""; display: block; padding-top: 56.25%; }
    .dvdo-ratio-4-3::before  { content: ""; display: block; padding-top: 75%; }
    .dvdo-ratio-1-1::before  { content: ""; display: block; padding-top: 100%; }
    .dvdo-ratio-9-16::before { content: ""; display: block; padding-top: 177.78%; }
    .dvdo-ratio-16-9 > *,
    .dvdo-ratio-4-3  > *,
    .dvdo-ratio-1-1  > *,
    .dvdo-ratio-9-16 > * {
        position: absolute;
        inset: 0;
    }
}

/* --- Vidéo HTML5 --- */
.dvdo-video-html5 {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* --- Iframe (YouTube / Vimeo) --- */
.dvdo-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Fallback image --- */
.dvdo-fallback img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Lightbox trigger --- */
.dvdo-lightbox-trigger {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    display: block;
}

.dvdo-lightbox-trigger .dvdo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dvdo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.dvdo-lightbox-trigger:hover .dvdo-overlay,
.dvdo-lightbox-trigger:focus .dvdo-overlay {
    background: rgba(0, 0, 0, 0.5) !important;
}

/* Icône play SVG */
.dvdo-play-icon {
    width: 64px;
    height: 64px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
}

.dvdo-lightbox-trigger:hover .dvdo-play-icon,
.dvdo-lightbox-trigger:focus .dvdo-play-icon {
    transform: scale(1.12);
    opacity: 0.95;
}

/* Accessibilité : focus visible */
.dvdo-lightbox-trigger:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

/* --- Modale lightbox --- */
.dvdo-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: dvdo-fade-in 0.2s ease;
}

@keyframes dvdo-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.dvdo-modal-inner {
    position: relative;
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,.7);
    animation: dvdo-slide-up 0.25s ease;
}

@keyframes dvdo-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.dvdo-modal-inner iframe,
.dvdo-modal-inner video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.dvdo-modal-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.dvdo-modal-close:hover { opacity: 1; }

/* --- Responsive --- */
@media (max-width: 767px) {
    .dvdo-play-icon {
        width: 48px;
        height: 48px;
    }
    .dvdo-modal-inner {
        aspect-ratio: auto;
        height: 56vw;
    }
}

/* ============================================================
   GALERIE VIDÉOS PODS — dvdo_video_gallery
   ============================================================ */

.dvdo-gallery { box-sizing: border-box; }

/* --- GRILLE --- */
.dvdo-grid {
    display: grid;
    gap: 16px;
}
.dvdo-cols-1 { grid-template-columns: 1fr; }
.dvdo-cols-2 { grid-template-columns: repeat(2, 1fr); }
.dvdo-cols-3 { grid-template-columns: repeat(3, 1fr); }
.dvdo-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .dvdo-cols-3,
    .dvdo-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .dvdo-cols-2,
    .dvdo-cols-3,
    .dvdo-cols-4 { grid-template-columns: 1fr; }
}

/* --- RATIOS --- */
.dvdo-ratio-16-9 { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; }
.dvdo-ratio-4-3  { position: relative; padding-bottom: 75%;    height: 0; overflow: hidden; }
.dvdo-ratio-1-1  { position: relative; padding-bottom: 100%;   height: 0; overflow: hidden; }

.dvdo-ratio-16-9 .dvdo-thumb,
.dvdo-ratio-4-3  .dvdo-thumb,
.dvdo-ratio-1-1  .dvdo-thumb,
.dvdo-ratio-16-9 .dvdo-iframe,
.dvdo-ratio-4-3  .dvdo-iframe,
.dvdo-ratio-1-1  .dvdo-iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    border: 0;
}

/* --- OVERLAY & PLAY --- */
.dvdo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}
.dvdo-grid-item:hover .dvdo-overlay,
.dvdo-slide:hover .dvdo-overlay,
.dvdo-hero:hover .dvdo-overlay,
.dvdo-thumb-item:hover .dvdo-overlay { opacity: 1; }

.dvdo-lightbox-trigger { cursor: pointer; }

.dvdo-play-icon { flex-shrink: 0; }

/* --- LÉGENDE --- */
.dvdo-legende {
    margin: 6px 0 12px;
    font-size: 0.9em;
    color: #555;
    text-align: center;
}
.dvdo-legende-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    margin: 0;
    padding: 6px 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.85em;
    text-align: left;
}

/* --- LISTE --- */
.dvdo-list .dvdo-list-item { margin-bottom: 24px; }

/* --- SLIDER --- */
.dvdo-slider { position: relative; overflow: hidden; }
.dvdo-slider-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    scrollbar-width: none;
}
.dvdo-slider-track::-webkit-scrollbar { display: none; }
.dvdo-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}
.dvdo-slider-prev,
.dvdo-slider-next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    font-size: 2rem;
    width: 40px; height: 60px;
    cursor: pointer;
    z-index: 10;
    border-radius: 3px;
}
.dvdo-slider-prev { left: 0; }
.dvdo-slider-next { right: 0; }

/* --- MINIATURE PRINCIPALE + LISTE --- */
.dvdo-hero { cursor: pointer; margin-bottom: 12px; }
.dvdo-thumb-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.dvdo-thumb-item {
    flex: 1 1 calc(33% - 10px);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}
.dvdo-thumb-item img { width: 100%; display: block; border-radius: 4px; }
.dvdo-thumb-item .dvdo-legende {
    font-size: 0.8em;
    margin: 4px 0 0;
    text-align: left;
}

/* --- LIGHTBOX --- */
.dvdo-lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.dvdo-lightbox-modal[style*="display:none"],
.dvdo-lightbox-modal[style*="display: none"] { display: none !important; }

.dvdo-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}
.dvdo-lightbox-content {
    position: relative;
    width: 90vw;
    max-width: 960px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    z-index: 1;
}
.dvdo-lightbox-content iframe {
    width: 100%; height: 100%;
    border: 0;
}
.dvdo-lightbox-close {
    position: absolute;
    top: -36px; right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
}
