:root {
    --primary-color: #ff6f61; /* Rojo Coral */
    --secondary-color: #ff9800; /* Naranja Brillante */
    --accent-color: #e91e63; /* Rosa Fuerte */
    --text-dark: #333;
    --text-light: #555;
    --bg-light: #fefefe;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --timeline-line-color: #ffd700; /* Dorado para la línea de tiempo */
    --timeline-dot-color: #ff6347; /* Rojo tomatera para los puntos */
}

body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    flex-direction: column; /* Asegura que el content-wrapper se expanda correctamente en columna */
    justify-content: center; /* Centra verticalmente el contenido principal */
    align-items: center; /* Centra horizontalmente el contenido principal */
    min-height: 100vh; /* Ocupa al menos toda la altura de la ventana */
    background: linear-gradient(135deg, #f7f3f0, #e0e0e0); /* Degradado suave */
    overflow-x: hidden; /* Evita desplazamiento horizontal */
    position: relative;
    color: var(--text-dark);
}

/* Animación de fondo (Confeti y Estrellas) */
.background-animation {
    position: fixed; /* Cubre siempre la ventana */
    top: 0;
    left: 0;
    width: 100%; /* Asegura que cubra todo el ancho */
    height: 100%; /* Asegura que cubra toda la altura */
    overflow: hidden;
    z-index: -1;
}

.confetti, .star {
    position: absolute;
    opacity: 0;
    animation: fallAndFade linear infinite;
}

.confetti {
    width: 10px;
    height: 10px;
    background-color: var(--color);
    border-radius: 50%;
}

.star {
    width: 15px;
    height: 15px;
    background-color: gold;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 67% 57%, 78% 91%, 50% 70%, 22% 91%, 33% 57%, 2% 35%, 39% 35%);
    animation: twinkle 2s infinite alternate; /* Animación de parpadeo */
}

@keyframes fallAndFade {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.8); }
}

/* Sección de Video Emotivo Inicial */
#emotionalVideoSection {
    position: fixed; /* Asegura que cubra toda la ventana */
    top: 0;
    left: 0;
    width: 100vw; /* Usa el ancho del viewport */
    height: 100vh; /* Usa la altura del viewport */
    background-color: rgba(0, 0, 0, 0.9); /* Fondo semi-transparente oscuro */
    display: flex;
    flex-direction: column; /* Apila el video y los botones verticalmente */
    justify-content: center;
    align-items: center;
    z-index: 200; /* Asegura que esté por encima de todo */
    padding: 20px; /* Pequeño padding alrededor del contenido del popup */
    box-sizing: border-box; /* Asegura que el padding se incluya en width/height */
}

#emotionalVideo {
    max-width: 100%; /* Ajusta el ancho máximo al contenedor */
    max-height: 75vh; /* Limita la altura para dejar espacio a los botones y evitar desborde vertical */
    width: auto; /* Permite que el video se adapte manteniendo su proporción */
    height: auto; /* Permite que el video se adapte manteniendo su proporción */
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    object-fit: contain; /* Asegura que el video se ajuste dentro de su caja sin cortarse */
}

.video-overlay {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap; /* Permite que los botones salten de línea si no hay espacio */
    justify-content: center;
    gap: 20px; /* Espacio entre los botones */
}

.video-button {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 30px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    flex-shrink: 0; /* Evita que los botones se encojan */
    min-width: 120px; /* Ancho mínimo para los botones */
    text-align: center;
}

.video-button:hover {
    background-color: var(--accent-color);
    transform: translateY(-3px);
}

/* Contenedor principal del contenido */
.content-wrapper {
    display: none; /* Oculto por defecto, se mostrará con JS */
    opacity: 0;
    animation: fadeInContent 1s forwards;
    width: 100%; /* Asegura que ocupe todo el ancho disponible */
    display: flex; /* Para centrar el container */
    justify-content: center;
    align-items: flex-start; /* Alinea arriba para que el scroll funcione */
    padding: 20px 0; /* Padding vertical para evitar que el contenido toque los bordes */
    min-height: 100vh; /* Asegura que ocupe al menos toda la altura de la ventana */
    box-sizing: border-box; /* Asegura que el padding no añada ancho/alto extra */
    flex-grow: 1; /* ¡Este es el ajuste clave para que ocupe el espacio y se centre! */
}

@keyframes fadeInContent {
    to { opacity: 1; }
}

.container {
    background-color: var(--bg-light);
    /* Padding responsivo: más en pantallas grandes, menos en pequeñas */
    padding: 50px 40px; /* Valor por defecto para pantallas grandes */
    border-radius: 20px;
    box-shadow: 0 15px 30px var(--shadow-medium);
    text-align: center;
    max-width: 950px; /* Ancho máximo para que no se estire demasiado en pantallas muy grandes */
    width: 95%; /* Ocupa el 95% del ancho disponible */
    transform: scale(0.9); /* Animación inicial */
    animation: fadeInScaleUp 1.2s ease-out forwards;
    position: relative;
    z-index: 1;
    border: 2px solid var(--primary-color);
    box-sizing: border-box; /* Crucial para que el padding no desborde el 95% de width */
    margin-top: 20px; /* Añade un margen superior si el centrado vertical es muy pegado al borde */
    margin-bottom: 20px; /* Añade un margen inferior */
}

@keyframes fadeInScaleUp {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Títulos y mensajes */
.main-title {
    font-family: 'Lobster', cursive;
    font-size: 4.5em;
    color: var(--accent-color);
    margin-bottom: 20px;
    text-shadow: 2px 2px 5px var(--shadow-light);
    animation: bounceIn 1.5s ease-out;
}

.highlight-name {
    color: var(--secondary-color); /* Color especial para el nombre */
    display: inline-block;
    animation: popAndRotate 2s ease-in-out infinite alternate;
}

@keyframes bounceIn {
    0% { transform: scale(0.1); opacity: 0; }
    60% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes popAndRotate {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.message {
    font-size: 1.4em;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 30px;
    font-style: italic;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Secciones generales */
section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px dashed #ccc;
    opacity: 0; /* Para animación de scroll */
    transform: translateY(30px); /* Para animación de scroll */
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

section h2 {
    font-family: 'Dancing Script', cursive;
    font-size: 3em;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-shadow: 1px 1px 3px var(--shadow-light);
}

/* Galería de Fotos General */
.photo-gallery {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
    justify-content: center;
}

.children-photos {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.family-moments {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.gallery-item {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 8px 16px var(--shadow-light);
    transition: transform 0.4s ease-in-out, box-shadow 0.4s ease-in-out;
    cursor: pointer;
    border: 3px solid transparent; /* Borde para el hover */
    object-fit: cover; /* Para asegurar que las imágenes llenen el espacio */
}

.gallery-item.portrait {
    height: 260px; /* Altura fija para fotos verticales */
}

.gallery-item.landscape {
    height: 200px; /* Altura fija para fotos horizontales */
}

.gallery-item:hover {
    transform: scale(1.08) rotate(3deg);
    box-shadow: 0 12px 24px var(--shadow-medium);
    border-color: var(--secondary-color); /* Resalta en hover */
}

/* Sección de Hijos */
.children-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    justify-content: center;
}

.child-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 16px var(--shadow-light);
    text-align: center;
    transition: transform 0.3s ease-out;
}

.child-card:hover {
    transform: translateY(-10px);
}

.child-card .child-photo {
    width: 180px;
    height: 240px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.child-message-text {
    font-size: 1.1em;
    color: var(--text-dark);
    margin-bottom: 15px;
    min-height: 50px; /* Altura mínima para mensajes */
}

.child-audio {
    width: 100%;
    max-width: 200px; /* Ajusta el ancho del reproductor de audio */
    margin: 0 auto;
}

/* Línea de Tiempo de Recuerdos */
#timelineSection {
    padding: 60px 20px;
}

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding-top: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px; /* Línea más gruesa */
    background-color: var(--timeline-line-color);
    transform: translateX(-50%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); /* Brillo dorado */
}

.timeline-item {
    margin-bottom: 60px;
    position: relative;
    opacity: 0; /* Inicialmente oculto */
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.timeline-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--timeline-dot-color);
    border: 4px solid #fff;
    border-radius: 50%;
    z-index: 1;
    top: 15px; /* Ajusta la posición del círculo */
    transform: translateX(-50%);
    box-shadow: 0 0 10px var(--shadow-medium);
}

.timeline-item.left::after {
    left: 50%;
}

.timeline-item.right::after {
    left: 50%;
}

.timeline-content {
    padding: 25px;
    background-color: var(--bg-light);
    border-radius: 15px;
    box-shadow: 0 10px 20px var(--shadow-light);
    position: relative;
    width: 45%;
}

.timeline-item.left .timeline-content {
    float: left;
    text-align: right;
    transform: translateX(-10%); /* Desplaza a la izquierda */
}

.timeline-item.right .timeline-content {
    float: right;
    text-align: left;
    transform: translateX(10%); /* Desplaza a la derecha */
}

/* Flechas de conexión */
.timeline-item.left .timeline-content::after {
    content: '';
    position: absolute;
    top: 25px;
    right: -10px; /* Ajuste para que apunte a la línea */
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 10px solid var(--bg-light);
}

.timeline-item.right .timeline-content::after {
    content: '';
    position: absolute;
    top: 25px;
    left: -10px; /* Ajuste para que apunte a la línea */
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid var(--bg-light);
}

.timeline-content h3 {
    font-family: 'Montserrat', sans-serif;
    color: var(--secondary-color);
    font-size: 1.8em;
    margin-bottom: 10px;
}

.timeline-content img {
    max-width: 100%;
    height: 150px; /* Altura fija para las imágenes de la línea de tiempo */
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 2px solid var(--timeline-dot-color);
}

.timeline-content p {
    font-size: 1.1em;
    color: var(--text-light);
}

/* Limpiar floats para que los ítems se coloquen correctamente */
.timeline::after {
    content: '';
    display: block;
    clear: both;
}


/* Botón de sorpresa (Mejorado) */
button#surpriseButton {
    background: linear-gradient(145deg, var(--primary-color) 0%, var(--accent-color) 100%); /* Gradiente de color */
    color: white;
    padding: 20px 40px; /* Un poco más grande */
    border: none;
    border-radius: 50px;
    font-size: 1.4em; /* Fuente un poco más grande */
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 1px; /* Más espaciado entre letras */
    text-transform: uppercase; /* Texto en mayúsculas */
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3); /* Sombra más pronunciada */
    transition: all 0.3s ease-in-out; /* Transiciones suaves para todas las propiedades */
    position: relative;
    overflow: hidden; /* Para efectos internos como el brillo */
    z-index: 2; /* Para que esté por encima de algunos elementos si es necesario */
    margin-top: 60px; /* Un poco más de margen superior */
}

button#surpriseButton:hover {
    background: linear-gradient(145deg, var(--accent-color) 0%, var(--primary-color) 100%); /* Invierte el gradiente al pasar el mouse */
    transform: translateY(-7px) scale(1.02); /* Se eleva y crece un poco más */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4); /* Sombra aún más grande */
}

button#surpriseButton:active {
    transform: translateY(-2px) scale(0.98); /* Se "hunde" al hacer clic */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Animación de pulso para el botón (ya existía, pero la mantendremos) */
button#surpriseButton.surprise-active {
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3); }
    100% { transform: scale(1.03); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4); }
}

/* Efecto de "brillo" al pasar el mouse (opcional, para un toque extra) */
button#surpriseButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3); /* Brillo blanco */
    transform: skewX(-30deg); /* Inclina el brillo */
    transition: all 0.7s ease;
}

button#surpriseButton:hover::before {
    left: 100%; /* Mueve el brillo de izquierda a derecha */
}


/* Estilos del Modal (pop-up) */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed; /* Permanece en su lugar */
    z-index: 100; /* Alto z-index para que esté encima de todo */
    left: 0;
    top: 0;
    width: 100%; /* Ancho completo */
    height: 100%; /* Altura completa */
    overflow: auto; /* Habilita scroll si es necesario */
    background-color: rgba(0, 0, 0, 0.7); /* Fondo semi-transparente más oscuro */
    backdrop-filter: blur(8px); /* Efecto de desenfoque más fuerte */
    justify-content: center;
    align-items: center;
    animation: fadeInModal 0.3s forwards;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-light);
    margin: auto;
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 20px 40px var(--shadow-medium);
    position: relative;
    max-width: 600px;
    text-align: center;
    transform: translateY(-50px);
    animation: slideInModal 0.5s ease-out forwards;
    border: 3px solid var(--accent-color);
}

@keyframes slideInModal {
    from { transform: translateY(-100px) scale(0.8); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 36px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 25px;
    cursor: pointer;
    transition: color 0.3s;
}

.close-button:hover,
.close-button:focus {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-title {
    font-family: 'Dancing Script', cursive;
    font-size: 3.5em;
    color: var(--secondary-color);
    margin-bottom: 25px;
    text-shadow: 1px 1px 3px var(--shadow-light);
}

/* Efecto de escritura en el mensaje especial */
.surprise-message-text {
    font-size: 1.6em;
    color: var(--text-dark);
    line-height: 1.7;
    margin-bottom: 30px;
    white-space: pre-wrap; /* Mantiene saltos de línea y espacios del JS */
    font-style: normal;
    text-shadow: 0.5px 0.5px 1px var(--shadow-light);
    overflow: hidden; /* Oculta el texto que no se ha "escrito" aún */
    border-right: .15em solid orange; /* Cursor de máquina de escribir */
    white-space: nowrap; /* Impide que el texto se ajuste al ancho */
    margin: 0 auto; /* Centra el texto */
    letter-spacing: .05em; /* Espaciado entre letras */
    animation: typing 3s steps(40, end), blink-caret .75s step-end infinite;
}

/* Animación de escritura */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

/* Animación del cursor */
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: orange; }
}

/* Reiniciar animación de escritura cuando el modal se abre */
.modal.is-active .surprise-message-text {
    animation: none; /* Desactiva la animación por defecto */
}


/* Responsividad */
@media (max-width: 900px) {
    .main-title {
        font-size: 3.8em;
    }
    .message {
        font-size: 1.3em;
    }
    section h2 {
        font-size: 2.8em;
    }
    .photo-gallery.children-photos,
    .photo-gallery.family-moments {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    /* Línea de tiempo responsiva */
    .timeline::before {
        left: 20px; /* Mueve la línea a la izquierda */
    }
    .timeline-item {
        margin-left: 20px; /* Espacio para la línea */
    }
    .timeline-item::after {
        left: 20px;
        transform: translateX(-50%);
    }
    .timeline-content {
        width: calc(100% - 60px); /* Ajusta el ancho */
        float: none;
        text-align: left !important;
        margin-left: 60px; /* Deja espacio para la línea y el punto */
        transform: translateX(0); /* Desactiva la traslación */
    }
    .timeline-item.left .timeline-content::after {
        border-left: none;
        border-right: 10px solid var(--bg-light); /* Flecha a la derecha */
        left: 50px; /* Posición de la flecha */
    }
    .timeline-item.right .timeline-content::after {
        left: 50px;
    }
}

@media (max-width: 600px) {
    .main-title {
        font-size: 3em;
    }
    .message {
        font-size: 1.1em;
    }
    section h2 {
        font-size: 2.2em;
    }
    .container {
        padding: 30px 20px; /* Reduce aún más el padding en pantallas pequeñas */
        width: 98%; /* Permite que ocupe un poco más de espacio en pantallas muy pequeñas */
        margin: 10px auto; /* Añade un pequeño margen vertical y centra */
    }

    /* Ajuste para el video inicial en pantallas pequeñas */
    #emotionalVideo {
        width: 95vw; /* Ocupa casi todo el ancho del viewport */
        height: auto; /* Mantiene la proporción */
        max-height: 80vh; /* Limita la altura para que no se salga de la pantalla */
    }

    .video-overlay {
        flex-direction: column; /* Botones de video uno debajo del otro */
        gap: 10px;
    }

    .video-button {
        width: 100%; /* Ocupa todo el ancho disponible en la columna */
        max-width: 200px; /* Pero con un límite de ancho para no ser demasiado grande */
        margin: 0 auto; /* Centrar el botón */
    }
    
    .photo-gallery.children-photos,
    .photo-gallery.family-moments {
        grid-template-columns: 1fr; /* Una columna en móviles */
    }
    .gallery-item.portrait, .gallery-item.landscape {
        height: auto;
        max-height: 250px;
    }
    .child-card .child-photo {
        width: 150px;
        height: 200px;
    }
    button#surpriseButton { /* Responsividad específica para el botón */
        padding: 15px 30px;
        font-size: 1.2em;
        margin-top: 40px;
        width: calc(100% - 40px); /* Ajusta el ancho para móviles */
        max-width: 300px; /* Máximo para que no sea demasiado ancho */
    }
    .modal-content {
        padding: 25px;
        margin: 15px;
    }
    .modal-title {
        font-size: 2.5em;
    }
    .surprise-message-text {
        font-size: 1.3em;
        white-space: normal; /* Permite el ajuste del texto en líneas */
        width: auto; /* Ancho automático para el efecto de escritura */
        animation: typing-mobile 3s steps(40, end), blink-caret .75s step-end infinite;
    }
    /* Nueva animación de escritura para móviles que permite salto de línea */
    @keyframes typing-mobile {
        from { width: 0 }
        to { width: 100% }
    }
}

@media (max-width: 400px) {
    .main-title {
        font-size: 2.5em;
    }
    section h2 {
        font-size: 1.8em;
    }
    .surprise-message-text {
        font-size: 1.1em;
    }
    .timeline-content {
        margin-left: 40px;
    }
    .timeline::before, .timeline-item::after {
        left: 10px;
    }
    button#surpriseButton { /* Responsividad específica para el botón */
        padding: 12px 25px;
        font-size: 1.1em;
    }
}

#seccion-video-principal{
    padding:20px;
    text-align:center;
}
.contenedor-video{
    width:100%;
    max-width:800px;
    margin:0 auto;
    position:relative;
    padding-bottom:56.25%;
    overflow:hidden;
}

.contenedor-video video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.contenedor-video button#botonReproducir {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
z-index: 10; /* Asegura que el botón esté por encima del video */
}
/* Estilos adicionales opcionales */
#seccion-video-principal h2 {
margin-bottom: 15px;
}
#seccion-video-principal p {
margin-top: 10px;
font-size: 0.9em;
color:#777;
}
