/**
 * Galerie multimédia événement — style Amazon
 * Fichier : assets/event-media-gallery.css
 *
 * Desktop  : zone principale + colonne de miniatures verticale
 * Mobile   : zone principale + miniatures horizontales scrollables (swipe)
 * A11y     : focus-visible, aria-live, reduced-motion
 * Contenu  : object-fit contain (pas de crop sur affiches)
 */

/* ── Container ──────────────────────────────────────────────────────── */

.alo-gallery {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    position: relative;
}

/* ── Zone principale ────────────────────────────────────────────────── */

.alo-gallery__main {
    flex: 1;
    min-width: 0;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--alo-page-bg-strong, #ece2d2);
}

.alo-gallery__slide {
    display: none;
    position: relative;
    width: 100%;
    line-height: 0;
}

.alo-gallery__slide--active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image : contain, jamais crop */
.alo-gallery__slide img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(45, 37, 28, 0.035), 0 14px 34px rgba(45, 37, 28, 0.08);
}

/* Vidéo HTML5 */
.alo-gallery__slide video {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    background: #000;
}

/* Iframe YouTube / Vimeo */
.alo-gallery__slide iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 70vh;
    border: 0;
    border-radius: 8px;
    display: block;
}

/* ── Flèches navigation ─────────────────────────────────────────────── */

.alo-gallery__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #276749;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: background 0.18s ease, transform 0.18s ease;
    padding: 0;
}

.alo-gallery__arrow:hover,
.alo-gallery__arrow:focus-visible {
    background: #276749;
    color: #fff;
    transform: translateY(-50%) scale(1.08);
}

.alo-gallery__arrow:focus-visible {
    outline: 3px solid #276749;
    outline-offset: 2px;
}

.alo-gallery__arrow--prev {
    left: 12px;
}

.alo-gallery__arrow--next {
    right: 12px;
}

/* Masquer les flèches si 1 seul média */
.alo-gallery--single .alo-gallery__arrow {
    display: none;
}

/* ── Compteur ───────────────────────────────────────────────────────── */

.alo-gallery__counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    pointer-events: none;
    user-select: none;
    letter-spacing: 0.02em;
}

/* ── Colonne miniatures ─────────────────────────────────────────────── */

.alo-gallery__thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 80px;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(39, 103, 73, 0.2) transparent;
    padding: 2px 0;
}

.alo-gallery__thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--alo-page-bg-strong, #ece2d2);
    padding: 0;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.7;
}

.alo-gallery__thumb:hover {
    opacity: 1;
}

.alo-gallery__thumb--active {
    border-color: #276749;
    opacity: 1;
}

.alo-gallery__thumb:focus-visible {
    outline: 3px solid #276749;
    outline-offset: 2px;
    opacity: 1;
}

.alo-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 5px;
}

/* Badge vidéo sur miniature */
.alo-gallery__thumb-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.alo-gallery__thumb-badge svg {
    width: 12px;
    height: 12px;
    fill: #fff;
}

.alo-gallery__thumb-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ── Placeholder chargement vidéo ───────────────────────────────────── */

.alo-gallery__video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 70vh;
    background: #1a1a1a;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
}

.alo-gallery__video-placeholder::after {
    content: '▶';
    font-size: 48px;
    color: rgba(255, 255, 255, 0.85);
    transition: transform 0.2s ease;
}

.alo-gallery__video-placeholder:hover::after {
    transform: scale(1.15);
}

/* ── Mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    .alo-gallery {
        flex-direction: column;
        gap: 0;
    }

    .alo-gallery__main {
        border-radius: 0;
    }

    .alo-gallery__slide img {
        max-height: 50vh;
        border-radius: 0;
        box-shadow: none;
    }

    .alo-gallery__slide video {
        max-height: 50vh;
        border-radius: 0;
    }

    .alo-gallery__slide iframe {
        max-height: 50vh;
        border-radius: 0;
    }

    .alo-gallery__arrow {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .alo-gallery__arrow--prev {
        left: 8px;
    }

    .alo-gallery__arrow--next {
        right: 8px;
    }

    .alo-gallery__counter {
        bottom: 8px;
        font-size: 12px;
        padding: 3px 10px;
    }

    /* Miniatures horizontales scrollables */
    .alo-gallery__thumbs {
        flex-direction: row;
        width: 100%;
        height: auto;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding: 10px 16px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .alo-gallery__thumbs::-webkit-scrollbar {
        display: none;
    }

    .alo-gallery__thumb {
        width: 64px;
        height: 64px;
        flex-shrink: 0;
    }
}

/* ── Tablette (768-1024px) ──────────────────────────────────────────── */

@media (min-width: 768px) and (max-width: 1024px) {
    .alo-gallery__thumbs {
        width: 68px;
    }

    .alo-gallery__thumb {
        width: 68px;
        height: 68px;
    }
}

/* ── Reduced motion ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .alo-gallery__arrow,
    .alo-gallery__thumb,
    .alo-gallery__slide img,
    .alo-gallery__slide video,
    .alo-gallery__slide iframe {
        transition: none !important;
        animation: none !important;
    }
}

/* ── Print ──────────────────────────────────────────────────────────── */

@media print {
    .alo-gallery__arrow,
    .alo-gallery__counter,
    .alo-gallery__thumbs {
        display: none !important;
    }

    .alo-gallery__slide {
        display: block !important;
    }

    .alo-gallery__slide:not(.alo-gallery__slide--active) {
        display: none !important;
    }
}
