* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', serif;
    background-image: url('images/fondo.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Fallback for browsers that don't support WebP */
body.no-webp {
    background-image: url('images/fondo.jpg');
}

/* Overlay opcional para mejorar legibilidad */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 0;
}

/* Botón de música */
.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #FFD700;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.music-toggle.playing {
    background: rgba(255, 215, 0, 0.9);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 4px 25px rgba(255, 215, 0, 0.8);
    }
}

/* Efecto de nieve */
.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.snowflake {
    position: absolute;
    top: -10%;
    color: white;
    font-size: 1.5em;
    opacity: 0.8;
    animation: fall linear infinite;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.snowflake:nth-child(1) { left: 10%; animation-duration: 8s; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 20%; animation-duration: 10s; animation-delay: 1s; }
.snowflake:nth-child(3) { left: 30%; animation-duration: 12s; animation-delay: 2s; }
.snowflake:nth-child(4) { left: 40%; animation-duration: 9s; animation-delay: 0.5s; }
.snowflake:nth-child(5) { left: 50%; animation-duration: 11s; animation-delay: 1.5s; }
.snowflake:nth-child(6) { left: 60%; animation-duration: 10s; animation-delay: 0.8s; }
.snowflake:nth-child(7) { left: 70%; animation-duration: 13s; animation-delay: 2.5s; }
.snowflake:nth-child(8) { left: 80%; animation-duration: 9s; animation-delay: 1.2s; }
.snowflake:nth-child(9) { left: 90%; animation-duration: 11s; animation-delay: 0.3s; }
.snowflake:nth-child(10) { left: 15%; animation-duration: 10s; animation-delay: 3s; }

@keyframes fall {
    0% {
        top: -10%;
        opacity: 0.8;
    }
    100% {
        top: 110%;
        opacity: 0.3;
    }
}

.container {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
}

.main-title {
    text-align: center;
    font-size: 5rem;
    color: #fff;
    margin-bottom: 60px;
    text-shadow:
        4px 4px 0px #c41e3a,
        6px 6px 0px #165b33,
        3px 3px 20px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(255, 215, 0, 0.6);
    animation: glow 2s ease-in-out infinite alternate;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.3;
    font-family: 'Mountains of Christmas', cursive, serif;
}

.subtitle-familia {
    font-size: 2.8rem;
    display: block;
    margin-top: 15px;
    font-style: normal;
    letter-spacing: 0.03em;
    font-family: 'Courgette', cursive, serif;
    text-shadow:
        3px 3px 0px #c41e3a,
        5px 5px 0px #165b33,
        2px 2px 15px rgba(0, 0, 0, 0.8);
}

@keyframes glow {
    from {
        text-shadow:
            4px 4px 0px #c41e3a,
            6px 6px 0px #165b33,
            3px 3px 20px rgba(0, 0, 0, 0.8),
            0 0 30px rgba(255, 215, 0, 0.6);
    }
    to {
        text-shadow:
            4px 4px 0px #c41e3a,
            6px 6px 0px #165b33,
            3px 3px 20px rgba(0, 0, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.9),
            0 0 50px rgba(255, 215, 0, 0.5);
    }
}

.gallery {
    position: relative;
    width: 100%;
    min-height: 1500px;
    padding: 40px 0;
}

/* Estilo de postal navideña */
.photo-card {
    position: absolute;
    background: #fff;
    border: 15px solid #fff;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.4s ease;
    width: 320px;
}

/* Postal principal - centrada y más grande */
.photo-card.main-card {
    width: 420px;
    top: 480px;
    left: 50%;
    margin-left: -210px;
    transform: rotate(0deg);
    z-index: 100;
    border: 18px solid #fff;
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.5),
        0 0 0 2px rgba(255, 215, 0, 0.5),
        inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.photo-card.main-card .photo-wrapper {
    height: 360px;
}

/* Fila superior - efecto esfera (Gerard más arriba en el centro) */
.photo-card:nth-child(2) {
    top: 120px;
    left: 3%;
    transform: rotate(-5deg);
    z-index: 10;
}

.photo-card:nth-child(3) {
    top: 0px;
    left: 50%;
    margin-left: -160px;
    transform: rotate(3deg);
    z-index: 20;
}

.photo-card:nth-child(4) {
    top: 120px;
    right: 3%;
    transform: rotate(-4deg);
    z-index: 30;
}

/* Fila inferior - efecto esfera (Mare más abajo en el centro) */
.photo-card:nth-child(5) {
    top: 900px;
    left: 3%;
    transform: rotate(4deg);
    z-index: 40;
}

.photo-card:nth-child(6) {
    top: 1020px;
    left: 50%;
    margin-left: -160px;
    transform: rotate(-3deg);
    z-index: 50;
}

.photo-card:nth-child(7) {
    top: 900px;
    right: 3%;
    transform: rotate(5deg);
    z-index: 60;
}

.photo-card:hover {
    transform: rotate(0deg) scale(1.05) translateY(-10px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.photo-wrapper {
    width: 100%;
    height: 300px;
    overflow: hidden;
    position: relative;
    background: #f5f5f5;
}

.photo-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(139, 69, 19, 0.1);
    pointer-events: none;
    z-index: 1;
}

.photo-wrapper img,
.photo-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.photo-wrapper .static-image {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.photo-wrapper .preview-video {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.photo-wrapper .static-image.hidden {
    opacity: 0;
}

.photo-wrapper .preview-video.visible {
    opacity: 1;
}

.photo-card:hover .photo-wrapper img,
.photo-card:hover .photo-wrapper video {
    transform: scale(1.1);
}

.subtitle {
    text-align: center;
    font-size: 1.4rem;
    color: #8B4513;
    font-weight: bold;
    margin-top: 15px;
    padding: 10px;
    font-family: 'Brush Script MT', cursive, 'Georgia', serif;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

/* Decoración navideña en las postales */
.photo-card::after {
    content: '❄️';
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    pointer-events: none;
}

.photo-card:nth-child(1)::after {
    top: 10px;
    right: 10px;
}

.photo-card:nth-child(2)::after {
    top: 10px;
    left: 10px;
    content: '🎄';
}

.photo-card:nth-child(3)::after {
    top: 10px;
    right: 10px;
    content: '⭐';
}

/* Overlay para modal */
.overlay {
    display: none;
    position: fixed;
    z-index: 9998;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    backdrop-filter: none;
    pointer-events: auto;
}

.overlay.active {
    display: block;
}

/* Postal en modo fullscreen */
.photo-card.fullscreen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) rotate(0deg) !important;
    width: 90vw !important;
    max-width: 900px !important;
    z-index: 9999 !important;
    margin: 0 !important;
}

.photo-card.fullscreen .photo-wrapper {
    height: 70vh;
    max-height: 600px;
}

.photo-card.fullscreen .subtitle {
    font-size: 1.8rem;
}

.photo-card.fullscreen .fullscreen-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Botón de cerrar */
.close-button {
    position: fixed;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    transition: color 0.3s ease, transform 0.3s ease;
    display: none;
}

.close-button.active {
    display: block;
}

.close-button:hover {
    color: #ff6b6b;
    transform: scale(1.2);
}

/* Responsive */
@media (max-width: 1200px) {
    .photo-card {
        width: 280px;
    }

    .photo-card.main-card {
        width: 380px;
        margin-left: -190px;
    }

    .photo-card.main-card .photo-wrapper {
        height: 320px;
    }

    .photo-wrapper {
        height: 260px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
        margin-bottom: 40px;
    }

    .subtitle-familia {
        font-size: 1.8rem;
    }

    .gallery {
        min-height: 2800px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
    }

    .photo-card {
        position: relative !important;
        width: 85%;
        max-width: 380px;
        margin: 0 auto 30px auto !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        margin-left: auto !important;
    }

    /* En móvil, la postal principal se ve igual que las demás */
    .photo-card.main-card {
        width: 85% !important;
        max-width: 380px !important;
        border: 15px solid #fff !important;
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.4),
            0 0 0 1px rgba(0, 0, 0, 0.1),
            inset 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    }

    .photo-card.main-card .photo-wrapper {
        height: 320px !important;
    }

    .photo-card.main-card .subtitle {
        font-size: 1.3rem !important;
        color: inherit !important;
    }

    .photo-card:nth-child(1) {
        transform: rotate(-4deg);
        margin-top: 20px !important;
    }

    .photo-card:nth-child(2) {
        transform: rotate(3deg);
        margin-top: -30px !important;
    }

    .photo-card:nth-child(3) {
        transform: rotate(-3deg);
        margin-top: -30px !important;
    }

    .photo-card:nth-child(4) {
        transform: rotate(4deg);
        margin-top: -30px !important;
    }

    .photo-card:nth-child(5) {
        transform: rotate(-5deg);
        margin-top: -30px !important;
    }

    .photo-card:nth-child(6) {
        transform: rotate(3deg);
        margin-top: -30px !important;
    }

    .photo-card:nth-child(7) {
        transform: rotate(-4deg);
        margin-top: -30px !important;
        margin-bottom: 40px !important;
    }

    .photo-wrapper {
        height: 320px;
    }

    .subtitle {
        font-size: 1.3rem;
    }

    .photo-card.fullscreen {
        width: 98vw !important;
        border: 8px solid #fff !important;
    }

    .photo-card.fullscreen .photo-wrapper {
        height: 60vh;
    }

    .photo-card.fullscreen .fullscreen-video {
        object-fit: contain;
    }

    .photo-card.fullscreen .subtitle {
        font-size: 1.5rem;
    }

    .close-button {
        font-size: 40px;
        top: 10px;
        right: 10px;
    }

    .music-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 2rem;
    }

    .subtitle-familia {
        font-size: 1.4rem;
    }

    .photo-card {
        width: 90%;
        max-width: 340px;
    }

    .photo-wrapper {
        height: 280px;
    }

    .subtitle {
        font-size: 1.1rem;
    }
}
