/* =========================================
   VARIABLES DE COLOR
========================================= */
:root {
    --text-brown: #7A5B4C;
    --text-light: #A88B7D; 
    --pink-accent: #E5B2B2;
    --pink-dark: #D49393;
    --gold: #CBA062;
    --green-whatsapp: #25D366;
    
    --font-cursive: 'Great Vibes', cursive;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Montserrat', sans-serif;

    --sky-band: 180px;
}

/* =========================================
   RESET Y ESTILOS BASE
========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { background-color: #332B27; font-family: var(--font-sans); color: var(--text-brown); display: flex; justify-content: center; align-items: center; min-height: 100vh; min-height: 100dvh; overflow: hidden; }

.app-container { background-color: #FFF; width: 100%; max-width: 414px; height: 100vh; height: 100dvh; max-height: 896px; position: relative; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.5); perspective: 1500px; }
@media (min-width: 415px) { .app-container { height: 90vh; border-radius: 35px; } }

/* =========================================
   PANTALLAS DINÁMICAS (FONDOS Y EFECTO LIBRO)
========================================= */
.screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; opacity: 0; pointer-events: none; z-index: 10; background-size: cover; background-position: center bottom; background-repeat: no-repeat; transform-origin: left center; transform: rotateY(0deg); transition: opacity 0.8s ease; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 16px 12px calc(22px + env(safe-area-inset-bottom, 0px)); }
.screen::-webkit-scrollbar { width: 0; display: none; }
.screen.active { opacity: 1; pointer-events: auto; z-index: 20; }
.screen.turned { transform: rotateY(-95deg); opacity: 0; z-index: 30; pointer-events: none; transition: transform 0.7s cubic-bezier(0.45, 0, 0.55, 1), opacity 0.55s ease 0.15s; }

#pantalla-1 { background-image: url('images/fondo_bosque_limpio.png'); }
#pantalla-saludo { background-image: url('images/fondo_arco_globos.png'); }
#pantalla-2 { background-image: url('images/fondo_casa.jpg'); }
#pantalla-3 { background-image: url('images/fondo_casa.jpg'); }
#pantalla-4 { background-image: url('images/fondo_casa.jpg'); }

/* Cada nombre de invitado en pantalla de saludo */
.nombre-invitado {
    display: block;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 3px rgba(255,255,255,0.9);
}

.content-wrapper { text-align: center; z-index: 20; width: 100%; margin: auto; flex-shrink: 0; }
.inner-frame { padding: 0.5rem 0.75rem; max-width: 330px; margin-left: auto; margin-right: auto; }

/* Ajuste específico para bajar el bloque de texto en la pantalla 1 y darle espacio al vuelo del pájaro */
#pantalla-1 { justify-content: flex-start; }
#pantalla-1 .content-wrapper { margin-top: var(--sky-band); margin-bottom: auto; }

/* =========================================
   CIELO ANIMADO (Proporcional y Nuevo Sol)
========================================= */
.cielo-animado {
    position: absolute;
    top: 0; left: 0; width: 100%;
    height: var(--sky-band);   /* franja propia: el cielo no invade el texto */
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

/* Pajarito volando (Pasa por debajo/lado de la nube) */
.anim-pajaro {
    position: absolute;
    top: 88px;
    left: 4%;
    width: 62px;
    animation: volarPajaro 12s linear infinite;
}

.anim-sol {
    position: absolute;
    top: 6px;
    right: 6%;
    width: 92px;
    animation: moverSol 15s ease-in-out infinite;
}

.anim-nube { position: absolute; }

/* Nube única arriba a la izquierda */
.nube-unica {
    top: 4px;
    left: 5%;
    width: 150px;
    animation: flotarNube 10s ease-in-out infinite;
}

/* El vuelo del pajarito en DIAGONAL suave, pasa cerca de la nube */
@keyframes volarPajaro {
    0% { transform: translateX(-20px) translateY(0px) scale(0.9); opacity: 0; }
    20% { opacity: 1; }
    50% { transform: translateX(80px) translateY(-10px) scale(0.95); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateX(180px) translateY(-20px) scale(1); opacity: 0; }
}

@keyframes moverSol {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    50% { transform: translateX(-15px) rotate(-8deg); } /* Movimiento corto para quedarse en su esquina */
}

@keyframes flotarNube {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-6px) translateX(8px); }
}

/* =========================================
   TIPOGRAFÍA E IMÁGENES GLOBALES
========================================= */
.pre-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 3px; margin-bottom: 0.8rem; font-weight: 600; color: var(--text-light); }
.main-title { font-family: var(--font-cursive); font-size: clamp(2.6rem, 13vw, 3.5rem); color: var(--pink-dark); line-height: 1.3; margin-bottom: 0.5rem; padding: 0 10px; text-shadow: 1px 1px 3px rgba(255,255,255,0.8); }
.subtitle { font-family: var(--font-serif); font-size: 1.2rem; font-style: italic; color: var(--text-brown); margin-bottom: 1.5rem; font-weight: 600;}

/* CONTENEDOR DEL VENADITO (Ahora es un ÓVALO) */
.image-container { 
    margin: 0.9rem auto; 
    position: relative; 
    border-radius: 50%; /* Al ser más ancho que alto, se hace óvalo */
    padding: 12px; 
    background: rgba(255, 255, 255, 0.95); 
    box-shadow: 0 10px 25px rgba(122, 91, 76, 0.15); 
    animation: float 6s ease-in-out infinite; 
    display: inline-block;
}
.image-container::before { 
    content: ''; 
    position: absolute; 
    top: -4px; right: -4px; bottom: -4px; left: -4px; 
    border: 1.5px dashed var(--pink-accent); 
    border-radius: 50%; 
    z-index: -1; 
}
.hero-image { 
    width: min(220px, 55vw); 
    height: auto; 
    aspect-ratio: 11 / 8; 
    object-fit: contain; /* Garantiza que no se corte nada de la imagen */
    border-radius: 50%; 
    mix-blend-mode: multiply; /* Magia: Hace transparente el fondo blanco del JPEG original */
}
/* Tamaño para la segunda pantalla */
.small-img .hero-image { 
    width: min(180px, 45vw); 
} 

/* =========================================
   BOTONES
========================================= */
.btn-primary, .btn-whatsapp { position: relative; z-index: 30; color: white; font-family: var(--font-sans); font-weight: 600; font-size: 1rem; padding: 0.95rem 1.5rem; min-height: 52px; border: none; border-radius: 50px; cursor: pointer; transition: all 0.3s ease; width: 100%; display: flex; justify-content: center; align-items: center; gap: 10px; }
.btn-primary { background: linear-gradient(135deg, var(--pink-accent), var(--pink-dark)); box-shadow: 0 5px 15px rgba(212, 147, 147, 0.5); animation: pulse 2s infinite; margin-top: 1rem; }
.btn-primary:active, .btn-whatsapp:active { transform: scale(0.95); }
.btn-primary i, .btn-whatsapp i, .btn-icon i { font-size: 1.1rem; }

/* =========================================
   INTERLUDIO DE TRANSICIÓN BLANCA (VERSO)
========================================= */
.transition-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #FAFAFA; /* Blanco crema muy suave */
    z-index: 150; /* Por encima de todo */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease-in-out; /* Fundido suave */
}
.transition-screen.show {
    opacity: 1;
    pointer-events: auto;
}
.transition-verse {
    font-family: var(--font-serif);
    font-size: 1.05rem; /* Letra más pequeña y delicada */
    color: var(--pink-dark);
    text-align: center; /* Perfectamente centrada */
    padding: 0 40px;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(20px); /* Ligero efecto de entrada hacia arriba */
    transition: all 1.2s ease-in-out;
    transition-delay: 0.5s; /* Aparece después de que la pantalla se ponga blanca */
}
.transition-screen.show .transition-verse {
    opacity: 1;
    transform: translateY(0);
}
.transition-verse strong {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--gold);
    letter-spacing: 2px;
}

/* Destellos pasteles flotantes en la pantalla blanca */
@keyframes floatSparkle {
    0%   { transform: translateY(0)   rotate(0deg)   scale(1);   opacity: 0; }
    15%  { opacity: 1; }
    80%  { opacity: 0.7; }
    100% { transform: translateY(-120px) rotate(360deg) scale(0.3); opacity: 0; }
}
@keyframes driftSparkle {
    0%   { transform: translate(0, 0)   rotate(0deg)   scale(1);   opacity: 0; }
    20%  { opacity: 0.9; }
    100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.2); opacity: 0; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.transition-sparkle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: driftSparkle linear forwards;
}

/* =========================================
   ESTILOS PANTALLA 3 (NUEVO LOOK)
========================================= */
.reveal-text { font-family: var(--font-serif); font-size: 1.25rem; margin-bottom: 0.5rem; font-weight: 600; }
.baby-name { position: relative; display: inline-block; font-family: var(--font-cursive); font-size: clamp(3.4rem, 17vw, 4.8rem); color: var(--gold); line-height: 1.2; margin: 0.5rem 0; padding: 0 10px; text-shadow: 1px 1px 3px rgba(255,255,255,0.9); }
.baby-surname { font-family: var(--font-sans); font-size: 1.15rem; color: var(--gold); letter-spacing: 2.5px; margin-bottom: 1.2rem; font-weight: 600; }

/* =========================================
   FASE 3: NUEVO DISEÑO (GLASSMORPHISM)
========================================= */
.info-screen { margin-top: auto; margin-bottom: auto; }
.title-info { font-family: var(--font-cursive); font-size: clamp(2.4rem, 12vw, 3.2rem); color: var(--pink-dark); margin-bottom: 1rem; line-height: 1.2; text-shadow: 1px 1px 2px #fff;}

.glass-card { 
    background: rgba(255, 255, 255, 0.95); 
    border: 1px solid rgba(255, 255, 255, 1); 
    padding: 1.2rem; 
    border-radius: 25px; 
    margin-bottom: 1rem; 
    box-shadow: 0 15px 35px rgba(122, 91, 76, 0.1); 
}
.text-gold { color: var(--gold); }
.info-row { display: flex; align-items: flex-start; margin-bottom: 0.8rem; text-align: left; }
.info-row:last-child { margin-bottom: 0; }
.info-row i { font-size: 1.3rem; margin-right: 0.8rem; margin-top: 0.2rem; width: 24px; text-align: center; }
.info-row h3 { font-family: var(--font-serif); font-size: 1rem; color: var(--gold); margin-bottom: 0.1rem; }
.info-row p { font-size: 0.82rem; color: var(--text-brown); line-height: 1.3; margin-bottom: 0.1rem; }
.zona-text { font-style: italic; opacity: 0.8; font-size: 0.75rem !important; }

.divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(212, 147, 147, 0.3), transparent); margin: 0.8rem 0; }

.map-buttons { display: flex; gap: 10px; margin-top: 0.5rem; }
.btn-icon { flex: 1; padding: 0.7rem 0.5rem; min-height: 44px; border-radius: 15px; border: 1px solid var(--gold); background: transparent; color: var(--text-brown); font-size: 0.8rem; font-weight: 600; font-family: var(--font-sans); cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; gap: 5px; }
.btn-icon:hover { background: var(--gold); color: white; }

.action-card { margin-top: 0.5rem; }
.rsvp-text { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.8rem; color: var(--text-brown); }
.rsvp-deadline { 
    font-size: 0.8rem; 
    color: var(--text-brown); 
    background-color: rgba(255, 255, 255, 0.95); 
    padding: 6px 16px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 1.2rem; 
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(122, 91, 76, 0.08);
}
.btn-whatsapp { background: linear-gradient(135deg, #25D366, #128C7E); box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3); }

/* =========================================
   ANIMACIONES GENERALES
========================================= */
.screen.active .fade-in-up { animation: fadeInUp 1s forwards ease-out; }
.screen.active .fade-in { animation: fadeIn 1.5s forwards ease-out; }
.screen.active .pop-in { animation: popIn 1s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.fade-in-up, .fade-in, .pop-in { opacity: 0; }
.fade-in-up { transform: translateY(20px); }
.pop-in { transform: scale(0.5); }

.name-reveal { opacity: 0; transform: scale(0.5); }
.screen.active .name-reveal { animation: popIn 1s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.4s, glowContour 1.5s ease-in-out 1.2s 1 forwards; }
@keyframes glowContour { 0% { text-shadow: 1px 1px 3px rgba(255,255,255,0.9); } 40% { text-shadow: 0 0 10px #FFF, 0 0 20px var(--gold), 0 0 40px var(--gold); color: #FFF; } 100% { text-shadow: 1px 1px 3px rgba(255,255,255,0.9); color: var(--gold); } }
.destello { position: absolute; top: -5px; right: -15px; font-size: 1.8rem; color: #FFF; opacity: 0; }
.screen.active .destello { animation: destelloAnim 1.5s forwards 1.3s; }
@keyframes destelloAnim { 0% { opacity: 0; transform: scale(0) rotate(0deg); } 30% { opacity: 1; transform: scale(1.3) rotate(45deg); filter: drop-shadow(0 0 10px var(--gold)); } 100% { opacity: 0; transform: scale(0) rotate(90deg); } }

.delay-1 { animation-delay: 0.2s; } .delay-2 { animation-delay: 0.4s; } .delay-3 { animation-delay: 0.6s; } .delay-4 { animation-delay: 0.9s; } .delay-5 { animation-delay: 1.2s; }

@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes popIn { to { opacity: 1; transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(212, 147, 147, 0.7); } 70% { box-shadow: 0 0 0 12px rgba(212, 147, 147, 0); } 100% { box-shadow: 0 0 0 0 rgba(212, 147, 147, 0); } }

.sparkles-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.sparkle { position: absolute; background-color: var(--gold); border-radius: 50%; opacity: 0; animation: twinkle linear forwards; }
@keyframes twinkle { 0% { opacity: 0; transform: translateY(0) scale(0.5); } 50% { opacity: 0.8; transform: translateY(-20px) scale(1.2); } 100% { opacity: 0; transform: translateY(-40px) scale(0.5); } }

/* Chispas cayendo de la lámpara */
.lamp-sparkle {
    animation-name: fallSparkle !important;
    animation-timing-function: ease-out !important;
    animation-fill-mode: forwards !important;
    background-color: #FFF !important; /* Luz más pura */
    box-shadow: 0 0 6px #FFF, 0 0 12px var(--gold) !important; /* Resplandor dorado alrededor */
}

@keyframes fallSparkle {
    0% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    20% { opacity: 0.9; transform: translate(calc(var(--spread-x) * 0.2), calc(var(--spread-y) * 0.2)) scale(1.4); }
    80% { opacity: 0.7; }
    100% { opacity: 0; transform: translate(var(--spread-x), var(--spread-y)) scale(0.5); }
}

/* =========================================
   NUEVO BOTÓN WHATSAPP Y MODALES
========================================= */
.btn-pulsing {
    background: linear-gradient(135deg, var(--pink-accent), var(--pink-dark)) !important;
    box-shadow: 0 5px 15px rgba(212, 147, 147, 0.5) !important;
    animation: pulse 2s infinite !important;
    font-size: 0.95rem !important; /* Letra un poco más pequeña para que quepa todo el texto */
    padding: 1rem 1rem !important;
}

.custom-modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(51, 43, 39, 0.7); z-index: 100; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.custom-modal.show { opacity: 1; pointer-events: auto; }
.modal-box { background: rgba(255, 255, 255, 0.95); padding: 1.6rem 1.25rem; border-radius: 20px; width: 88%; max-height: 88dvh; overflow-y: auto; text-align: center; box-shadow: 0 15px 40px rgba(0,0,0,0.4); transform: scale(0.8); transition: transform 0.3s ease; border: 2px solid var(--gold); }
.custom-modal.show .modal-box { transform: scale(1); }

.gold-icon { font-size: 2.5rem; color: var(--gold); margin-bottom: 1rem; }
.modal-box p { font-size: 0.95rem; color: var(--text-brown); margin-bottom: 1rem; line-height: 1.4; font-weight: 500;}
.modal-question { font-family: var(--font-serif); color: var(--pink-dark); margin-bottom: 1.5rem; font-size: 1.3rem; font-weight: bold;}
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-cancel { background: transparent; border: 1px solid var(--text-light); color: var(--text-light); padding: 12px; border-radius: 50px; font-weight: 600; font-family: var(--font-sans); font-size: 1rem; cursor: pointer;}
.modal-welcome { font-family: var(--font-cursive); font-size: 2.8rem; color: var(--gold); margin-bottom: 5px; }
.modal-quote { font-style: italic; color: var(--pink-dark); font-size: 0.85rem !important; border-top: 1px solid rgba(203,160,98,0.3); padding-top: 15px; }
.redirect-text { font-size: 0.75rem !important; color: #aaa !important; margin-top: 15px; animation: pulse 2s infinite;}


/* =========================================
   AJUSTES RESPONSIVE - PANTALLAS BAJAS / MOVILES PEQUENOS
   (mismo diseno, todo se compacta para que los botones queden visibles)
========================================= */
@media (max-height: 740px) {
    :root { --sky-band: 140px; }
    .anim-pajaro { top: 66px; width: 54px; }
    .anim-sol { width: 76px; }
    .nube-unica { width: 124px; }
    .pre-title { margin-bottom: 0.5rem; font-size: 0.78rem; letter-spacing: 2px; }
    .subtitle { margin-bottom: 0.9rem; font-size: 1.05rem; }
    .image-container { margin: 0.6rem auto; padding: 9px; }
    .hero-image { width: min(180px, 48vw); }
    .small-img .hero-image { width: min(150px, 40vw); }
    .baby-surname { margin-bottom: 0.7rem; font-size: 1rem; }
    .glass-card { padding: 1rem; border-radius: 20px; margin-bottom: 0.7rem; }
    .btn-primary, .btn-whatsapp { padding: 0.8rem 1.2rem; min-height: 48px; font-size: 0.95rem; }
    .btn-primary { margin-top: 0.7rem; }
    .rsvp-deadline { margin-bottom: 0.8rem; }
    .transition-verse { font-size: 0.95rem; padding: 0 24px; }
}

@media (max-height: 620px) {
    :root { --sky-band: 112px; }
    .anim-pajaro { top: 54px; width: 46px; }
    .anim-sol { width: 64px; }
    .nube-unica { width: 104px; }
    .image-container { margin: 0.45rem auto; padding: 7px; }
    .hero-image { width: min(150px, 42vw); }
    .small-img .hero-image { width: min(126px, 36vw); }
    .main-title { font-size: clamp(2.2rem, 11vw, 2.8rem); }
    .baby-name { font-size: clamp(2.8rem, 14vw, 3.6rem); }
}

/* Respeta a quien prefiere menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .anim-pajaro, .anim-sol, .anim-nube, .image-container, .btn-primary { animation: none !important; }
}
