* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CONTENEDOR DE PARTICULAS (nieve) */
#tsparticles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

body {
    font-family: 'Georgia', serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* cursor: none; */
    background-image:  
        url('portada3.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Imagen de la varita mágica */
/* #magic-wand {
    position: fixed;
    width: 80px;
    height: 80px;
    background-image: url('vara.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 9999;
    animation: wandGlow 1s infinite alternate;
    filter: drop-shadow(0 0 8px #a259ff);
} */

/* Brillo animado */
@keyframes wandGlow {
    from {
        filter: drop-shadow(0 0 5px #a259ff);
    }
    to {
        filter: drop-shadow(0 0 15px #ffb3ff);
    }
}

/* Chispas */
.sparkle {
    position: fixed;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #fff, rgba(255, 0, 255, 0.5));
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: sparkleFade 0.8s linear forwards;
}

/* Animación de desaparición */
@keyframes sparkleFade {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(3);
    }
}

h1 {
    color: white;
    margin-bottom: 30px;
    text-align: center;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 3;
    position: relative;
}

.flipbook-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 800px;
    perspective: 2000px;
    z-index: 2;
}

.book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.page {
    position: absolute;
    width: 50%;
    height: 100%;
    background: #fffef7;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d;
    transform-origin: left center;
    transition: transform 0.8s ease-in-out;
    backface-visibility: hidden;
    padding: 40px;
    overflow: auto;
}

.page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(0, 0, 0, 0.05) 0%,
            transparent 5%);
    pointer-events: none;
}

.page-left {
    left: 0;
    border-right: 2px solid #ddd;
}

.page-right {
    right: 0;
    border-left: 2px solid #ddd;
}

.page.turned {
    transform: rotateY(-180deg);
    pointer-events: none;
}

.page.hidden {
    display: none;
}

.page-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.page-title {
    color: #228505;
    margin-bottom: 25px;
    border-bottom: 3px solid #228505;
    padding-bottom: 10px;
    text-align: center;
    font-size: 30px;
}

.page-number {
    position: absolute;
    bottom: 20px;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: #999;
    font-weight: bold;
}

.page-left .page-number {
    left: 25px;
}

.page-right .page-number {
    right: 25px;
}

.cover-page .page-content {
    background: linear-gradient(135deg, #ea9066 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    border-radius: 0;
}

.cover-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.cover-subtitle {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-style: italic;
}

/* Estilo para páginas completas con imagen de fondo */
.full-page-image .page-content {
    padding: 0 !important;
    border-radius: 0;
    overflow: hidden;
}

.full-page-image .page-number {
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
    color: #333;
}

.full-page-title {
    font-size: clamp(1.2rem, 3vw, 2rem) !important;
    font-weight: bold;
    color: #228505 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none !important;
    margin-bottom: 0 !important;
}

/* MODAL DE IMAGEN EXPANDIDA */
.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: auto;
    animation: fadeIn 0.3s ease-in-out;
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(102, 126, 234, 0.8);
    animation: zoomIn 0.3s ease-in-out;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10001;
}

.close-modal:hover {
    color: #667eea;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.controls {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 30px;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    background: white;
    color: #060607;
    border: 2px solid #667eea;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button:hover:not(:disabled) {
    background: #228505;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Grid por defecto: 2 columnas */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    justify-items: center;
    align-items: center;
    margin-top: 50px;
}

/* Estilo de las imágenes */
.image-grid img {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid #cc0d0d;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.image-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #25d366;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    transition: transform 0.2s ease;
}

.whatsapp-float img {
    width: 32px;
    height: 32px;
}

.whatsapp-float:hover {
    transform: scale(1.1);
}

/* Responsive: Convertir a vista vertical en móviles */
@media (max-width: 768px) {
    .flipbook-container {
        height: auto;
        perspective: none;
    }

    .book {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .page {
        position: relative !important;
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        min-height: 600px;
        margin-bottom: 20px;
        transform: none !important;
        border: none !important;
        border-radius: 15px;
    }

    /* Ajuste específico para páginas completas en móvil */
    .page .page-content[style*="background: url"],
    .full-page-image .page-content {
        background-size: cover !important;
        background-position: center !important;
        min-height: 500px !important;
        border-radius: 15px;
        padding: 0 !important;
    }

    .page.turned,
    .page.hidden {
        display: block !important;
        pointer-events: all !important;
    }

    .page-left,
    .page-right {
        border: none;
    }

    .image-grid {
        grid-template-columns: 1fr !important;
    }

    .controls {
        display: none;
    }

    .close-modal {
        font-size: 40px;
        top: 10px;
        right: 20px;
    }

    .whatsapp-float {
        width: 50px;
        height: 50px;
    }

    .whatsapp-float img {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 25px;
        min-height: 500px;
    }

    /* Ajuste específico para páginas completas en pantallas pequeñas */
    .page .page-content[style*="background: url"],
    .full-page-image .page-content {
        min-height: 400px !important;
        padding: 0 !important;
        border-radius: 12px;
    }

    .image-grid img {
        width: 180px;
        height: 180px;
    }
}