/* --- ESTILOS GENERALES Y DE LA INVITACIÓN --- */
body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background: url('assets/fondo.jpg') center center fixed;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    /* Optimización para mejor renderizado de imágenes */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Mejoras para scroll suave y fondo estático */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- PANTALLA DE CARGA --- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.loading-content {
    text-align: center;
    color: #E0E0E0;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(135, 206, 235, 0.3);
    border-top: 4px solid #87CEEB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #87CEEB;
    font-weight: 600;
}

.loading-progress {
    width: 300px;
    height: 6px;
    background-color: rgba(135, 206, 235, 0.2);
    border-radius: 3px;
    margin: 0 auto 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #87CEEB, #4682B4);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease-out;
}

.loading-percentage {
    font-size: 0.9em;
    color: #B0B0B0;
    font-weight: 500;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

body.invitation-visible {
    overflow-y: auto;
}

#invitation-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 999;
    opacity: 0;
    transform: scale(0.1) translateY(50px);
    transition: opacity 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Optimización para scroll suave */
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.container {
    max-width: 900px;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #E0E0E0;
    opacity: 0; /* Inicia oculto */
    transform: translateY(20px); /* Inicia ligeramente abajo */
    transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Optimización para scroll suave y fondo estático */
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    width: 100%;
}

.logo {
    height: 100px;
    margin: 10px;
    /* Optimización para máxima calidad */
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
    will-change: transform;
}

.title-section { margin: 40px 0 0px 0; }
.invitation-text { font-size: 2em; font-weight: 700; color: #C0C0C0; margin-bottom: 10px; letter-spacing: 2px; text-transform: uppercase; }
.guest-name { 
    font-size: 2em; 
    font-weight: 700; /* Aumentado a 700 para mayor negrita */
    font-weight: bold; /* Fallback para navegadores antiguos */
    color: #87CEEB; 
    margin-top: 15px; 
    margin-bottom: 15px; 
    letter-spacing: 1px; 
    text-shadow: 0 0 10px rgba(135, 206, 235, 0.5);
    /* Asegurar que siempre se muestre en negrita */
    font-family: 'Montserrat', sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.gala-title-image { 
    max-width: 100%; 
    height: auto;
    width: 100%; 
    margin: 0 auto; 
    display: block;
    /* Optimización para máxima calidad */
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
    will-change: transform;
}
.info-text { font-size: 1.1em; line-height: 1.6; margin: 00px auto 30px auto; max-width: 700px; color: #B0B0B0; }
.highlight { color: #ADD8E6; font-weight: 700; }

#countdown { display: flex; justify-content: center; gap: 20px; margin: 40px 0; flex-wrap: wrap; }
.time-block { background-color: rgba(10, 28, 60, 0.5); padding: 15px 25px; border-radius: 10px; border: 1px solid #87CEEB; box-shadow: 0 0 10px rgba(135, 206, 235, 0.5); min-width: 90px; }
.time-block span { display: block; }
.time-block .number { font-size: 2.5em; font-weight: 700; color: #FFFFFF; }
.time-block .label { font-size: 0.9em; text-transform: uppercase; color: #87CEEB; margin-top: 5px; }
#countdown-message { font-size: 1.8em; font-weight: 700; color: #87CEEB; text-shadow: 0 0 10px rgba(135, 206, 235, 0.7); }

.date-location-section { background-color: rgba(0, 0, 0, 0.6); padding: 30px 20px; border-radius: 10px; margin-top: 40px; box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7); }
.date-location-section p { margin: 10px 0; font-size: 1.2em; font-weight: 700; color: #F0F8FF; }
.date-location-section span { font-weight: 400; color: #D3D3D3; display: block; font-size: 0.9em; }
.location-details { font-weight: 400; font-size: 1em; color: #D3D3D3; }
.map-icon { 
    text-decoration: none; 
    margin-left: 8px; 
    transition: transform 0.3s ease, filter 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #021D3A, #001027);
    border: 1px solid rgba(135, 206, 235, 0.25);
    box-shadow: 0 0 20px rgba(135, 206, 235, 0.25), inset 0 0 10px rgba(0, 0, 0, 0.4);
}
.map-icon:hover { 
    transform: translateY(-2px); 
    filter: none;
    box-shadow: 0 0 28px rgba(135, 206, 235, 0.45), inset 0 0 12px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #032A55, #00193A);
}

.map-icon .icon {
    width: 24px;
    height: 24px;
    vertical-align: -3px;
}

.calendar-button {
    background: linear-gradient(135deg, #003374, #01162E);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 60px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 51, 116, 0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.calendar-button .icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
}

.calendar-button:hover {
    background: linear-gradient(135deg, #01162E, #003374);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 51, 116, 0.5);
}

.calendar-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(135, 206, 235, 0.3);
}

footer { margin-top: 50px; font-size: 0.9em; color: #888; }

/* --- SECCIÓN RECLAMA TU PASE --- */
.claim-pass-section {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 30px 20px;
    border-radius: 12px;
    margin-top: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.claim-pass-section h2 {
    margin: 0 0 10px 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.8em;
    color: #E0F7FF;
    letter-spacing: 1px;
}

.claim-pass-section .claim-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    color: #B0C4DE;
    margin: 0 0 20px 0;
}

.ticket-wrapper {
    display: flex;
    justify-content: center;
}

.ticket-image {
    width: 100%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    animation: ticketEntrance 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
    position: relative;
    overflow: hidden;
    /* Optimización para máxima calidad */
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
    will-change: transform;
}

.ticket-image:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(135, 206, 235, 0.3);
    border-color: rgba(135, 206, 235, 0.4);
}

.ticket-image:active {
    transform: translateY(-4px) scale(1.01);
    transition: all 0.2s ease;
}

/* Animación de entrada del ticket */
@keyframes ticketEntrance {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Efecto de brillo sutil en hover */
.ticket-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ticket-image:hover::before {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* --- BOTÓN FLOTANTE DE INDICACIÓN DE DESLIZAR --- */
.scroll-indicator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(135, 206, 235, 0.15);
    border: 1px solid rgba(135, 206, 235, 0.3);
    border-radius: 50%;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 50px;
    height: 50px;
}

.scroll-indicator.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: gentleBlink 2s infinite;
}

.scroll-indicator:hover {
    transform: translateY(-3px) scale(1.1);
    background: rgba(135, 206, 235, 0.25);
    border-color: rgba(135, 206, 235, 0.5);
}

.scroll-arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: rgba(135, 206, 235, 0.9);
}

.scroll-arrows svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.scroll-arrows svg:first-child {
    animation: arrowMove1 1.5s infinite;
}

.scroll-arrows svg:last-child {
    animation: arrowMove2 1.5s infinite;
}

/* Animación de parpadeo suave */
@keyframes gentleBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Animación de las flechas */
@keyframes arrowMove1 {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(3px);
        opacity: 0.7;
    }
}

@keyframes arrowMove2 {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    50% {
        transform: translateY(3px);
        opacity: 1;
    }
}

/* --- ESTILOS DEL SOBRE CON IMÁGENES --- */
#envelope-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    cursor: pointer;
    transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.envelope-fullscreen {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Optimización para máxima calidad */
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Transición suave para el cambio de imágenes */
.image-transition {
    opacity: 0.85;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Efecto de parpadeo profesional para simular stop motion */
@keyframes stopMotionBlink {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    25% { 
        opacity: 0.6; 
        transform: scale(1.02);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(0.98);
    }
    75% { 
        opacity: 0.7; 
        transform: scale(1.01);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

.envelope-fullscreen.image-transition {
    animation: stopMotionBlink 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- ESTADOS DE LA ANIMACIÓN --- */
#envelope-overlay.opened {
    opacity: 0;
}

#invitation-wrapper.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

#invitation-wrapper.visible .container {
    opacity: 1;
    transform: translateY(0);
}

/* Animación de entrada suave para el ticket cuando es visible */
.ticket-image.visible {
    animation: ticketEntrance 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Efecto de pulso sutil en hover para móviles */
@media (max-width: 768px) {
    .ticket-image:hover {
        transform: translateY(-4px) scale(1.01);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(135, 206, 235, 0.2);
    }
    
    .ticket-image:active {
        transform: translateY(-2px) scale(1.005);
    }
}

/* Estilos adicionales para asegurar negrita en todos los navegadores */
.guest-name {
    /* Fallbacks adicionales para navegadores antiguos */
    font-weight: bold !important;
    font-style: normal;
    text-decoration: none;
    /* Asegurar que el texto sea legible incluso sin efectos */
    color: #87CEEB !important;
    background: transparent;
}

/* Optimización adicional para scroll suave y fondo estático */
* {
    /* Mejorar el rendimiento del scroll */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Optimización específica para elementos que se mueven durante el scroll */
.ticket-image,
.logo,
.gala-title-image {
    /* Forzar aceleración por hardware para mejor rendimiento */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

/* Mejora para dispositivos con poca memoria */
@media (max-width: 1024px) {
    body {
        /* Reducir la calidad del fondo en dispositivos con poca memoria */
        background-attachment: scroll;
    }
    
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: url('assets/fondo.jpg') center center;
        background-size: cover;
        background-repeat: no-repeat;
        z-index: -1;
        /* Optimización para dispositivos con poca memoria */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
        /* Reducir la calidad de la imagen para mejor rendimiento */
        image-rendering: auto;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Fallback para navegadores que no soporten font-weight numérico */
@supports not (font-weight: 700) {
    .guest-name {
        font-weight: bold;
    }
}

/* Optimización para dispositivos móviles - fondo estático alternativo */
@media (max-width: 768px) {
    body {
        /* En móviles, usar un fondo alternativo para mejor rendimiento */
        background-attachment: scroll;
        background-position: center top;
        background-size: cover;
        /* Crear un pseudo-elemento para el fondo fijo en móviles */
        position: relative;
    }
    
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: url('assets/fondo.jpg') center center;
        background-size: cover;
        background-repeat: no-repeat;
        z-index: -1;
        /* Optimización para móviles */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }
    
    .container { padding: 25px; }
    header { 
        flex-direction: row; 
        justify-content: space-around;
        flex-wrap: wrap;
    }
    .logo { 
        height: 50px; 
        margin: 5px; 
        flex: 0 0 auto;
    }
    .invitation-text { font-size: 1.5em; }
    .guest-name { 
        font-size: 1.2em; 
        font-weight: bold !important; /* Asegurar negrita en móviles */
    }
    .gala-title-image { 
        max-width: 100%; 
        width: 100%;
        height: auto;
    }
    .info-text { font-size: 1em; }
    .date-location-section p { font-size: 1.1em; }
    .time-block { padding: 10px; min-width: 70px; }
    .time-block .number { font-size: 2em; }
    .calendar-button { 
        padding: 10px 20px; 
        font-size: 0.9em; 
        margin-top: 15px; 
    }
}

@media (max-width: 480px) {
    .container { padding: 15px; }
    header { 
        flex-direction: row; 
        justify-content: space-around;
        flex-wrap: wrap;
    }
    .logo { 
        height: 40px; 
        margin: 3px;
        flex: 0 0 auto;
    }
    .invitation-text { font-size: 1.2em; }
    .guest-name { 
        font-size: 1em; 
        font-weight: bold !important; /* Asegurar negrita en móviles pequeños */
    }
    .gala-title-image { 
        max-width: 100%; 
        width: 100%;
        height: auto;
    }
    .info-text { font-size: 0.9em; }
    .date-location-section p { font-size: 1em; }
    #countdown { gap: 10px; }
    .time-block { min-width: 60px; }
    .time-block .number { font-size: 1.8em; }
    .time-block .label { font-size: 0.7em; }
    .calendar-button { 
        padding: 8px 16px; 
        font-size: 0.8em; 
        margin-top: 12px; 
    }
    
    /* Ajustes para el botón flotante en móviles */
    .scroll-indicator {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        padding: 10px;
    }
    
    .scroll-arrows svg {
        width: 18px;
        height: 18px;
    }
}
