/* --- FOND MAGIQUE DORÉ --- */
body {
    margin: 0;
   background: radial-gradient(circle at center,
        #fff7dd 0%,
        #f4e0ab 40%,
        #e3c577 70%,
        #c19a55 100%
    ) !important;
    background-attachment: fixed;
    overflow: hidden;
    font-family: 'Cinzel Decorative', serif;
}

/* --- PARTICULES MAGIQUES --- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: url("../images/fond.png");
    background-repeat: repeat;
    opacity: 0.35;
    animation: drift 14s infinite linear;
}

@keyframes drift {
    from { transform: translate(0, 0); }
    to   { transform: translate(-120px, -80px); }
}

/* HALO MAGIQUE */
#book {
    position: relative;
    z-index: 10;
}

#book::before {
    content: "";
    position: absolute;
    inset: -25px;
    border-radius: 25px;
    background: radial-gradient(circle,
        rgba(255, 220, 140, 0.6),
        rgba(255, 180, 80, 0.3),
        transparent
    );
    filter: blur(35px);
    animation: haloPulse 4s ease-in-out infinite;
    z-index: -1;
}

@keyframes haloPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

/* --- CADRE DU LIVRE --- */
/* === CADRE DU LIVRE + FOND OR === */
#book {
    width: 90vw;
    height: 85vh;
    padding: 12px;
    box-sizing: border-box;

    /* Couleur + image en même temps */
    background:
        rgba(255, 248, 225, 0.35),
        url("../images/gold.png");
    background-size: cover;
    background-blend-mode: overlay; /* Donne un effet or magique */

    border: 4px solid rgba(255, 215, 160, 0.9);
    border-radius: 18px;

    box-shadow:
        0 0 35px rgba(255, 200, 120, 0.9),
        inset 0 0 12px rgba(255, 240, 200, 0.45);
}

/* --- AMBIANCE PAGE --- */
.page img {
    filter: brightness(1.1) saturate(1.05);
    border-radius: 6px;
    box-shadow: 
        0 0 20px rgba(160, 120, 60, 0.65),
        inset 0 0 10px rgba(255, 240, 200, 0.5);
}

/* === BOUTONS MAGIQUES RESPONSIVE === */
.btn-magic {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;

    width: 45px;
    height: 45px;

    background: rgba(255, 240, 200, 0.55);
    border: 2px solid rgba(170, 130, 70, 0.9);
    border-radius: 50%;
    backdrop-filter: blur(4px);

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

    font-size: 22px;
    font-family: "Cinzel Decorative";
    color: #6d4a1b;
    cursor: pointer;
    transition: 0.25s ease;

    box-shadow: 
        0 0 10px rgba(255, 220, 150, 0.8),
        inset 0 0 10px rgba(255, 250, 230, 0.4);
}

/* Position desktop */
#prevBtn { left: 20px; }
#nextBtn { right: 20px; }
#homeBtn { top: 20px; left: 50%; transform: translateX(-50%); }

/* Hover desktop */
.btn-magic:hover {
    transform: scale(1.15);
}

/* === VERSION MOBILE : PAS DE BOUTONS PRÉC/ SUIV. === */
/* On laisse le SWIPE naturel, rien sur le texte */
@media (max-width: 900px) {

    #prevBtn,
    #nextBtn {
        display: none !important;
    }

    /* Bouton HOME : petit, discret, jamais sur le texte */
    #homeBtn {
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 32px;
        height: 32px;
        font-size: 16px;
        border-width: 1px;
        opacity: 0.85;
    }

    #homeBtn:hover {
        transform: translateX(-50%) scale(1.15);
    }
}
/* === BARRE MAGIQUE === */
#magicNav {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    
    display: flex;
    gap: 15px;

    padding: 8px 18px;
    border-radius: 30px;

    background: rgba(255, 245, 210, 0.45);
    backdrop-filter: blur(6px);

    border: 2px solid rgba(180, 140, 60, 0.7);
    box-shadow:
        0 0 18px rgba(255, 220, 150, 0.8),
        inset 0 0 10px rgba(255, 255, 230, 0.4);
}

.nav-item {
    padding: 6px 12px;
    border-radius: 16px;
    font-family: "Cinzel Decorative";
    font-size: 18px;
    color: #6d4a1b;
    cursor: pointer;
    transition: 0.2s;
}

.nav-item:hover {
    background: rgba(255, 240, 200, 0.6);
    box-shadow: 0 0 10px rgba(255, 230, 160, 0.8);
}
/* === INTRO MAGIQUE === */
#intro {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 99999999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: introFadeOut 2.5s ease forwards;
    animation-delay: 2s;
}

.intro-title {
    font-family: "Cinzel Decorative";
    font-size: 42px;
    color: #ffebc8;
    text-shadow:
        0 0 12px gold,
        0 0 20px #ffcf66,
        0 0 30px #ffcc55;
    opacity: 0;
    animation: introTitle 2s ease forwards;
}

@keyframes introTitle {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes introFadeOut {
    to { opacity: 0; visibility: hidden; }
}

/* --- PARTICULES MAGIQUES AU-DESSUS DU LIVRE --- */
#magicParticles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    inset: 0;
    overflow: hidden;
    z-index: 5;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #ffe9b3, #ffcc66);
    border-radius: 50%;
    opacity: 0.7;
    animation: floatUp 6s linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-150px) scale(0.7);
        opacity: 0;
    }
}

/* Glow sur la page */
.page-glow {
    animation: pageGlow 0.6s ease-out;
}

@keyframes pageGlow {
    0% { box-shadow: 0 0 0px rgba(255, 220, 150, 0); }
    50% { box-shadow: 0 0 40px rgba(255, 220, 150, 1); }
    100% { box-shadow: 0 0 0px rgba(255, 220, 150, 0); }
}

/* --- INTRO HARRY POTTER --- */
#hpIntro {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999999;
    animation: introFadeOut 3s ease forwards;
    animation-delay: 3.2s;
}

.hpTitle {
    font-family: "Cinzel Decorative";
    font-size: 48px;
    color: #ffebc8;
    opacity: 0;
    text-shadow:
        0 0 20px gold,
        0 0 35px #ffdd77,
        0 0 60px #ffcc55;
    animation: hpTitlePop 2.5s ease forwards;
}

@keyframes hpTitlePop {
    0% { opacity: 0; transform: scale(0.7); }
    60% { opacity: 1; transform: scale(1.05); }
    100% { transform: scale(1); }
}

.hpLight {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffdf99, transparent 70%);
    filter: blur(30px);
    opacity: 0;
    animation: hpLightAnim 2s ease-out forwards;
}

@keyframes hpLightAnim {
    0% { opacity: 0; transform: scale(0.3);}
    100% { opacity: 1; transform: scale(1.3);}
}

@keyframes introFadeOut {
    to { opacity: 0; visibility: hidden; }
}


/* MENU DES PAGES */
.page-menu {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    max-width: 500px;

    background: rgba(255, 245, 210, 0.85);
    backdrop-filter: blur(6px);
    border: 2px solid rgba(180, 140, 60, 0.7);
    border-radius: 18px;
    padding: 20px;

    box-shadow:
        0 0 18px rgba(255, 220, 150, 0.8),
        inset 0 0 10px rgba(255, 255, 230, 0.4);

    z-index: 99999999;
    display: none;
    animation: fadeMenu 0.3s ease-out;
}

.page-menu-title {
    font-family: "Cinzel Decorative";
    font-size: 20px;
    text-align: center;
    margin-bottom: 12px;
    color: #6d4a1b;
}

#pageList {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.page-btn {
    padding: 8px 14px;
    background: rgba(255, 240, 200, 0.85);
    border: 1px solid rgba(170, 130, 70, 0.9);
    border-radius: 12px;
    font-size: 16px;
    font-family: "Cinzel Decorative";
    cursor: pointer;
    transition: 0.2s;
}

.page-btn:hover {
    background: rgba(255, 230, 160, 0.85);
    box-shadow: 0 0 10px rgba(255, 220, 150, 1);
}

/* animation */
@keyframes fadeMenu {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* === MOBILE : LE LIVRE DOIT PRENDRE TOUT L'ÉCRAN === */
@media (max-width: 900px) {
    #book {
        width: 100vw !important;
        height: 100vh !important;
        padding: 0 !important;
        margin: 0 !important;
        border-width: 2px !important;
        border-radius: 10px !important;
    }

    /* Halo plus petit pour pas déborder */
    #book::before {
        inset: -10px !important;
        filter: blur(20px) !important;
    }
}

@media (max-width: 900px) {
    #book {
        width: 100vw !important;
        height: 100vh !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .page {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    .page img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important; /* PAS de déformation */
    }
}
@media screen and (orientation: landscape) and (max-width: 900px) {
    #magicNav {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        height: 0 !important;
    }

    body {
        overflow: hidden !important;
    }

    #book {
        width: 100vw !important;
        height: 100vh !important;
    }
}

#musicBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    background: rgba(255, 240, 200, 0.55);
    border: 2px solid rgba(170, 130, 70, 0.9);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 26px;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 0 12px rgba(255,220,150,0.7);
    transition: 0.25s ease;
}

#musicBtn.active {
    background: rgba(255, 220, 140, 0.7);
    box-shadow: 0 0 25px gold;
}