@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

body {
    background-image: url("../Image/herbe.webp");
    background-size: cover; 
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Patrick Hand', cursive;
    overflow: hidden;
}

.album-book {
    width: 900px;
    height: 700px;
    background-color: #fcfcfc;
    border-radius: 5px;
    display: flex;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.spine {
    position: absolute;
    left: 50%; top: 0; bottom: 0;
    width: 2px;
    background: rgba(0,0,0,0.1);
    transform: translateX(-50%);
    z-index: 1;
}

.page {
    flex: 1;
    position: relative;
    padding: 20px;
}

/* --- LE POLAROID --- */
.polaroid-wrapper {
    width: 180px;
    height: 220px;
    position: absolute;
    cursor: pointer;
    perspective: 1000px;
    z-index: 10;
    transition: transform 0.3s, top 0.3s, left 0.3s;
}

/* Positions "bazar" sur la page (Style Basil) */
.left-page .p1 { top: 30px; left: 40px; transform: rotate(-5deg); }
.left-page .p2 { top: 250px; right: 20px; transform: rotate(3deg); }
.left-page .p3 { bottom: 30px; left: 40px; transform: rotate(-2deg); }

.right-page .p1 { top: 30px; left: 40px; transform: rotate(-5deg); }
.right-page .p2 { top: 250px; right: 20px; transform: rotate(3deg); }
.right-page .p3 { top: 400px; left: 0px; transform: rotate(-2deg); }

/* Effet Hover dans l'album */
.polaroid-wrapper:not(.zoomed):hover {
    z-index: 20;
    transform: scale(1.1) rotate(0deg) !important;
}

.polaroid-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.polaroid-wrapper.flipped .polaroid-inner {
    transform: rotateY(180deg);
}

.face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: #fff;
    padding: 10px 10px 30px 10px;
    box-sizing: border-box;
    box-shadow: 2px 4px 8px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.face.back {
    transform: rotateY(180deg);
    background: #fff repeating-linear-gradient(transparent, transparent 19px, #e0e0e0 20px);
    justify-content: center;
    padding: 20px;
    color: #333;
}

.face img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #000;
    border: 1px solid #eee;
}

.handwriting {
    margin-top: 10px;
    font-size: 1.2rem;
    color: #222;
}

/* --- BOUTON FLIP --- */
.flip-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.flip-btn:hover {
    opacity: 1;
    transform: rotate(45deg);
}

/* --- LE SCOTCH --- */
.tape {
    position: absolute;
    top: -10px;
    left: 50%;
    width: 60px;
    height: 20px;
    background: rgba(255,255,255,0.5);
    transform: translateX(-50%) rotate(-2deg);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* --- ZOOM STATE --- */
.polaroid-wrapper.zoomed {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(1.8) !important;
    z-index: 1000;
    cursor: default;
}

.polaroid-wrapper.zoomed .tape {
    display: none; /* On cache le scotch quand c'est zoomé */
}

#overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 900;
}

#overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* --- GESTION DES FEUILLES --- */
.sheet {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    opacity: 0;
    pointer-events: none; /* Empêche de cliquer sur les pages invisibles */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease;
    transform: rotateY(-5deg); /* Petit effet 3D au changement */
    z-index: 1;
}

/* La feuille active est visible */
.sheet.active {
    opacity: 1;
    pointer-events: all;
    transform: rotateY(0deg);
    z-index: 5;
}

/* --- BOUTONS DE NAVIGATION --- */
.nav-btn {
    position: absolute;
    bottom: 20px;
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    z-index: 50;
    transition: transform 0.2s;
}

.nav-btn:hover {
    transform: scale(1.2);
    color: #000;
}

#prevBtn { left: 20px; }
#nextBtn { right: 20px; }

/* Une classe pour faire passer la page active DEVANT l'overlay noir */
.sheet.super-z-index {
    z-index: 2000 !important; /* Plus grand que l'overlay (900) */
    transform: none !important; /* Annule la rotation pour que le fixed fonctionne */
}

/* La page active passe devant l'overlay */
.sheet.super-z-index {
    z-index: 2000 !important;
    transform: none !important;
}

/* Les polaroids NON zoomés deviennent semi-transparents */
.sheet.super-z-index .polaroid-wrapper:not(.zoomed) {
    opacity: 0.15; /* On voit le fond noir à travers (donne l'effet sombre) */
    filter: grayscale(100%); /* Optionnel : les rend gris pour accentuer le focus */
    pointer-events: none;
    transition: opacity 0.3s, filter 0.3s;
}

/* Le polaroid zoomé reste totalement visible */
.sheet.super-z-index .polaroid-wrapper.zoomed {
    opacity: 1;
    filter: none;
}

.Navtop-Menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 3000;
}

.pixelart-to-css-cactus {
    position: fixed;
    bottom: 250px;
    left: 20px;
    width: 160px;
    height: 160px;
}

.pixelart-to-css-rose {
    position: fixed;
    bottom: 500px;
    left: 140px;
    width: 160px;
    height: 160px;
}

.pixelart-to-css-glaieul {
    position: fixed;
    bottom: 800px;
    left: 100px;
    width: 160px;
    height: 160px;
}

.pixelart-to-css-sunflower {
    position: fixed;
    bottom: 500px;
    right: 300px;
    width: 160px;
    height: 160px;
}

.pixelart-to-css-tulipe {
    position: fixed;
    bottom: 300px;
    right: 380px;
    width: 160px;
    height: 160px;
}

.pixelart-to-css-muguet {
    position: fixed;
    bottom: 650px;
    right: 380px;
    width: 160px;
    height: 160px;
}