/* ============================= */
/* HISTOIRES — BASE UNIQUE */
/* Complément de style.css */
/* ============================= */

.page-histoire {
    --ratio-diapo: 1920 / 1240;

    --kb-scale: 1.035;
    --kb-x: 0%;
    --kb-y: -0.8%;
    --kb-duration: 14s;
    --kb-curve: ease-in-out;
}

/* ============================= */
/* DIAPORAMA */
/* ============================= */

.page-histoire .diapo {
    position: absolute;
    z-index: 20;

    overflow: hidden;
    aspect-ratio: var(--ratio-diapo);

    pointer-events: auto;
}

.page-histoire .diapo-img {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;
    object-position: center center;

    opacity: 0;

    transform: scale(1) translate(0, 0);
    transform-origin: center center;

    transition: opacity 1.8s ease-in-out;

    will-change: opacity, transform;
    pointer-events: none;
}

.page-histoire .diapo-img.active {
    opacity: 1;
    animation: histoire-kenburns var(--kb-duration) var(--kb-curve) both;
}

@keyframes histoire-kenburns {
    0% {
        transform: scale(1) translate(0, 0);
    }

    50% {
        transform:
            scale(var(--kb-scale))
            translate(var(--kb-x), var(--kb-y));
    }

    100% {
        transform: scale(1) translate(0, 0);
    }
}

/* ============================= */
/* AUDIO */
/* ============================= */

.page-histoire .audio {
    position: absolute;
    z-index: 30;

    display: flex;
    justify-content: center;
    align-items: center;
}

.page-histoire .audio audio {
    width: 100%;
    max-width: 520px;

    opacity: 0.9;
    border-radius: 999px;

    filter:
        drop-shadow(0 0 10px rgba(255, 230, 160, 0.35))
        drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

/* ============================= */
/* MENU HISTOIRES */
/* ============================= */

.page-histoire .histoires-menu {
    position: absolute;
    z-index: 25;

    overflow: hidden;
}

.page-histoire .histoires-menu-scroll {
    width: 100%;
    height: 100%;

    display: flex;

    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.page-histoire .histoire-menu-item {
    display: block;

    flex: 0 0 auto;

    border-radius: 0.45rem;
    overflow: hidden;

    text-decoration: none;

    box-shadow:
        0 0 8px rgba(255, 220, 120, 0.45),
        0 0 16px rgba(120, 70, 255, 0.35);

    transition:
        transform 0.18s ease,
        filter 0.18s ease,
        box-shadow 0.18s ease;
}

.page-histoire .histoire-menu-item img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    pointer-events: none;
    user-select: none;
}

.page-histoire .histoire-menu-item:hover {
    transform: scale(1.03);

    filter: brightness(1.08);

    box-shadow:
        0 0 10px rgba(255, 240, 170, 0.7),
        0 0 22px rgba(150, 90, 255, 0.55);
}

.page-histoire .histoire-menu-item.inactive {
    opacity: 0.82;
    cursor: default;
}

/* ============================= */
/* HISTOIRE ACTIVE */
/* ============================= */

.page-histoire .histoire-menu-item.active {

    transform: scale(1.04);

    box-shadow:
        0 0 10px rgba(255, 255, 255, 0.9),
        0 0 18px rgba(255, 220, 120, 0.95),
        0 0 32px rgba(120, 180, 255, 0.75);

    filter:
        brightness(1.08)
        saturate(1.08);

    animation: histoire-active-pulse 2.8s ease-in-out infinite;
}

@keyframes histoire-active-pulse {

    0% {
        transform: scale(1.04);
    }

    50% {
        transform: scale(1.07);
    }

    100% {
        transform: scale(1.04);
    }
}

/* ============================= */
/* BOUTON PLEIN ÉCRAN */
/* ============================= */

.page-histoire .fullscreen-button {
    position: absolute;
    z-index: 80;

    display: none;
    justify-content: center;
    align-items: center;

    width: 52px;
    height: 52px;

    border: 2px solid rgba(255, 230, 160, 0.75);
    border-radius: 50%;

    background:
        radial-gradient(
            circle at 35% 30%,
            rgba(255, 245, 190, 0.35),
            rgba(80, 45, 15, 0.95) 70%
        );

    color: #fff6c8;
    font-size: 1.7rem;
    line-height: 1;

    cursor: pointer;

    box-shadow:
        0 0 12px rgba(255, 210, 90, 0.45),
        0 4px 14px rgba(0, 0, 0, 0.45);

    -webkit-tap-highlight-color: transparent;
}

.page-histoire .fullscreen-button:active {
    transform: scale(0.94);
}

.page-histoire.fullscreen .fullscreen-button {
    display: flex;
}

/* ============================= */
/* LANDSCAPE — 16:9 */
/* ============================= */

@media (orientation: landscape) {

    .page-histoire .diapo {
        width: 57%;
        left: 29.18%;
        top: 18.7%;

        border-radius: 1.2vw;
    }

    .page-histoire .audio {
        width: 54%;
        left: 30%;
        top: 89%;
    }

    .page-histoire .histoires-menu {
        left: 4.5%;
        top: 26%;
        width: 15.7%;
        height: 64%;
    }

    .page-histoire .histoires-menu-scroll {
        flex-direction: column;

        gap: 4%;

        overflow-y: auto;
        overflow-x: hidden;

        padding: 3% 4%;
    }

    .page-histoire .histoire-menu-item {
        width: 100%;
        aspect-ratio: 4 / 3;
    }

    .page-histoire .fullscreen-button {
        display: flex;
        right: 2.2%;
        bottom: 3%;
    }
}

/* ============================= */
/* PORTRAIT — 9:16 */
/* ============================= */

@media (orientation: portrait) {

    .page-histoire .diapo {
        width: 96%;
        left: 2%;
        top: 31%;

        border-radius: 1.2vw;
    }

    .page-histoire .audio {
        width: 74%;
        left: 13%;
        top: 76%;
    }

    .page-histoire .audio audio {
        max-width: 100%;
    }

    .page-histoire .histoires-menu {
        left: 7%;
        top: 83%;
        width: 86%;
        height: 13%;
    }

    .page-histoire .histoires-menu-scroll {
        flex-direction: row;

        gap: 3%;

        overflow-x: auto;
        overflow-y: hidden;

        padding: 2% 2%;
    }

    .page-histoire .histoire-menu-item {
        height: 100%;
        aspect-ratio: 4 / 3;
    }
}

/* ============================= */
/* DEBUG — VISUALISATION DIAPO */
/* ============================= */

/*
.page-histoire .diapo {
    background: rgba(255, 0, 0, 0.35) !important;
    outline: 4px solid red !important;
    box-shadow: 0 0 0 6px rgba(255, 255, 0, 0.6) !important;
}

.page-histoire .diapo-img {
    opacity: 0.55 !important;
}
*/