/* ==========================================================================
   diaporama.css — Bouton « Diaporama » de la galerie et lecture plein écran
   ========================================================================== */

/* ---------- Bouton et menu de lancement ---------- */
.dia-launch {
    position: relative;
}

.dia-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 25px;
    border: 1px solid rgba(243, 156, 18, .6);
    background: rgba(243, 156, 18, .15);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.dia-btn:hover,
.dia-btn[aria-expanded="true"] {
    background: #f39c12;
    border-color: #f39c12;
}

.dia-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 8px);
    left: 0;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 14px;
    border-radius: 14px;
    background: #2a2a2a;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
    color: #eee;
    text-align: left;
}

.dia-menu[hidden] {
    display: none;
}

.dia-menu-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dia-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .05);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.dia-start svg {
    color: #f39c12;
}

.dia-start:hover,
.dia-start:focus-visible {
    background: rgba(243, 156, 18, .18);
    border-color: #f39c12;
}

.dia-opt {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    font-size: .85rem;
    color: #ddd;
    cursor: pointer;
}

.dia-opt span {
    color: #999;
    font-size: .78rem;
}

.dia-opt input {
    accent-color: #f39c12;
}

.dia-speed {
    cursor: default;
}

.dia-speed > span {
    width: 100%;
    color: #aaa;
}

.dia-speed label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .12);
    cursor: pointer;
}

.dia-speed label:has(input:checked) {
    border-color: #f39c12;
    background: rgba(243, 156, 18, .15);
    color: #fff;
}

.dia-speed input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* ---------- Lecture plein écran ---------- */
.dia {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: none;
    background: #000;
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
}

.dia.open {
    display: block;
}

.dia-stage {
    position: absolute;
    inset: 0;
    touch-action: none;
}

.dia-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .9s ease;
    pointer-events: none;
}

.dia-img.on {
    opacity: 1;
}

/* Photo pas encore arrivée */
.dia-wait {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: #f39c12;
    animation: diaSpin 1s linear infinite;
}

.dia-wait[hidden] {
    display: none;
}

@keyframes diaSpin {
    to { transform: rotate(360deg); }
}

.dia-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, .08);
}

.dia-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: #f39c12;
}

.dia-top,
.dia-bar {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}

.dia.show-ui .dia-top,
.dia.show-ui .dia-bar,
.dia.paused .dia-top,
.dia.paused .dia-bar {
    opacity: 1;
    pointer-events: auto;
}

.dia-top {
    top: 0;
    gap: 16px;
    justify-content: space-between;
    padding: calc(16px + env(safe-area-inset-top)) 20px 40px;
    background: linear-gradient(rgba(0, 0, 0, .65), transparent);
}

.dia-caption {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dia-folder {
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dia-name {
    font-size: .8rem;
    color: rgba(255, 255, 255, .65);
}

.dia-count {
    flex: none;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .45);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.dia-bar {
    bottom: 0;
    justify-content: center;
    gap: 6px;
    padding: 40px 16px calc(18px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0, 0, 0, .7));
}

.dia-ctl {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.dia-ctl:hover {
    background: rgba(255, 255, 255, .22);
}

.dia-ctl:active {
    transform: scale(.94);
}

.dia-main {
    width: 58px;
    height: 58px;
    background: #f39c12;
}

.dia-main:hover {
    background: #e67e22;
}

.dia-toggle.is-on {
    color: #f39c12;
    background: rgba(243, 156, 18, .2);
}

.dia-speed-btn {
    width: auto;
    min-width: 46px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: .85rem;
}

.dia-sep {
    width: 1px;
    height: 26px;
    margin: 0 6px;
    background: rgba(255, 255, 255, .2);
}

@media (max-width: 600px) {
    .dia-bar {
        gap: 4px;
    }

    .dia-ctl {
        width: 42px;
        height: 42px;
    }

    .dia-main {
        width: 52px;
        height: 52px;
    }

    .dia-sep {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dia-img {
        transition-duration: .01ms;
    }
}
