/* ========================================
   MEJORAS UX/UI - Invitación
   Mejoras específicas para optimizar la experiencia
   ======================================== */

/* ========================================
   1. MEJORAS DE ACCESIBILIDAD
   ======================================== */

/* Focus states mejorados para navegación por teclado */
*:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
.carousel-btn:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 4px;
}

/* Mejorar contraste de texto sobre video */
.hero-pretitle,
.hero-verse,
.hero-date {
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6),
                 0 4px 24px rgba(0, 0, 0, 0.4);
}

.hero-name {
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.7),
                 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ========================================
   2. MICRO-INTERACCIONES MEJORADAS
   ======================================== */

/* Botón primario con efecto shimmer */
.btn-primary {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
}

/* Efecto de elevación en hover para botones */
.btn-primary,
.location-btn,
.carousel-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover,
.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(58, 69, 52, 0.3),
                0 6px 12px -4px rgba(58, 69, 52, 0.2);
}

.btn-primary:active,
.location-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px -2px rgba(58, 69, 52, 0.2);
}

/* Carrusel: mejoras en botones */
.carousel-btn {
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-btn:hover {
    background: rgba(58, 69, 52, 0.95);
    transform: scale(1.1);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.3);
}

.carousel-btn:active {
    transform: scale(0.95);
}

/* Scroll indicator con animación pulsante mejorada */
.scroll-indicator {
    animation: bounceGentle 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.scroll-indicator:hover {
    transform: translateY(-4px);
    animation-play-state: paused;
}

@keyframes bounceGentle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-12px);
    }
}

/* ========================================
   3. MEJORAS DE RESPONSIVIDAD MOBILE
   ======================================== */

/* Asegurar que los textos sean legibles en móviles */
@media (max-width: 640px) {
    /* Hero section */
    .hero-name {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-ampersand {
        font-size: 1.75rem;
    }
    
    .hero-verse p {
        font-size: 0.95rem;
        line-height: 1.6;
        padding: 0 1rem;
    }
    
    /* Countdown */
    .countdown-circle-num {
        font-size: 1.75rem;
    }
    
    .countdown-circle-lab {
        font-size: 0.7rem;
    }
    
    /* Section titles */
    .section-title {
        font-size: 2.25rem;
    }
    
    /* Cards */
    .card-elegant {
        padding: 1.75rem 1.25rem;
    }
    
    /* Music toggle button - ajustar para no obstruir contenido */
    .music-toggle {
        width: 52px;
        height: 52px;
        bottom: 1.5rem;
        right: 1.5rem;
    }
    
    .music-icon {
        width: 24px;
        height: 24px;
    }
}

/* Mejoras para pantallas muy pequeñas */
@media (max-width: 360px) {
    .hero-name {
        font-size: 2.25rem;
    }
    
    .countdown-circle-num {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

/* Dots del carrusel - ajuste para móviles */
@media (max-width: 768px) {
    .carousel-nav {
        gap: 0.35rem;
        margin-top: 0.75rem;
    }
    
    .carousel-dot {
        width: 5px;
        height: 5px;
    }
    
    .carousel-dot.active {
        width: 5px;
        height: 5px;
        transform: scale(1.3);
    }
}

/* Dots aún más pequeños para móviles muy pequeños */
@media (max-width: 480px) {
    .carousel-nav {
        gap: 0.3rem;
    }
    
    .carousel-dot {
        width: 4px;
        height: 4px;
    }
    
    .carousel-dot.active {
        width: 4px;
        height: 4px;
        transform: scale(1.4);
    }
}

/* ========================================
   4. FORMULARIO RSVP - MEJORAS
   ======================================== */

/* Input states mejorados */
.form-input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.form-input:hover {
    border-color: var(--sage-light);
    box-shadow: 0 2px 8px -2px rgba(122, 130, 112, 0.15);
}

.form-input:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -3px rgba(122, 130, 112, 0.25),
                0 0 0 3px rgba(122, 130, 112, 0.1);
}

/* Label con animación cuando el input está enfocado */
.form-group {
    position: relative;
}

.form-label {
    transition: color 0.3s ease;
}

.form-input:focus ~ .form-label,
.form-group:focus-within .form-label {
    color: var(--sage-dark);
}

/* Checkbox/Radio mejorados */
input[type="checkbox"],
input[type="radio"] {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
    transform: scale(1.1);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    animation: checkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkPop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Select mejorado */
select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%237a8270' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* ========================================
   5. ANIMACIONES OPTIMIZADAS
   ======================================== */

/* Preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroll-indicator {
        animation: none;
    }
}

/* Reveal animations más suaves */
.reveal-item {
    animation-duration: 0.8s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger con delays más naturales */
.reveal-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.reveal-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.reveal-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.reveal-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.reveal-stagger > *:nth-child(5) { animation-delay: 0.5s; }

/* ========================================
   6. ESTADOS DE CARGA MEJORADOS
   ======================================== */

/* Loading skeleton para cards */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--card) 0%,
        var(--cream) 50%,
        var(--card) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Spinner mejorado */
.spinner-ring {
    animation: spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

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

/* ========================================
   7. MEJORAS VISUALES GENERALES
   ======================================== */

/* Suavizar imágenes durante la carga */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Dividers con efecto sutil */
.section-divider {
    position: relative;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

.section-divider:hover {
    opacity: 1;
}

/* Cards con hover effect sutil */
.card-elegant {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-elegant:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -8px rgba(58, 69, 52, 0.15),
                0 8px 16px -4px rgba(58, 69, 52, 0.1);
}

/* Location buttons con mejor feedback */
.location-btn svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.location-btn:hover svg {
    transform: scale(1.1);
}

/* ========================================
   8. MEJORAS DE PERFORMANCE
   ======================================== */

/* Will-change para elementos animados */
.carousel-btn,
.btn-primary,
.music-toggle,
.scroll-indicator {
    will-change: transform;
}

/* Optimizar rendering de video */
video {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* ========================================
   9. MEJORAS PARA TÁCTILES
   ======================================== */

/* Aumentar área táctil en móvil */
@media (max-width: 768px) and (hover: none) {
    button,
    a.btn-primary,
    .carousel-btn,
    .location-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Eliminar hover effects en dispositivos táctiles */
    .btn-primary:hover,
    .location-btn:hover,
    .carousel-btn:hover {
        transform: none;
    }
    
    /* Mejorar feedback táctil */
    .btn-primary:active,
    .location-btn:active,
    .carousel-btn:active {
        opacity: 0.8;
        transform: scale(0.97);
    }
}

/* ========================================
   10. MEJORAS PARA VIDEO DEL HERO
   ======================================== */

/* Asegurar que el poster del hero video se muestre correctamente */
.hero-video {
    background-color: var(--ivory);
    object-fit: cover;
}

/* Mientras el video carga, mostrar el poster */
.hero-video:not([src]) {
    background-image: url('https://res.cloudinary.com/cinsuasty/image/upload/v1768763584/inframe_rqaw2g.png');
    background-size: cover;
    background-position: center;
}

/* Estado de carga del hero video */
.hero-video-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--ivory);
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-video-container.loading::before {
    opacity: 1;
}

/* ========================================
   11. MEJORAS PARA MODO OSCURO (FUTURO)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* El diseño actual es claro, pero preparamos para futuro */
    .hero-overlay {
        background: rgba(0, 0, 0, 0.65);
    }
}

/* ========================================
   11. PRINT STYLES (OPCIONAL)
   ======================================== */

@media print {
    .music-toggle,
    .carousel-btn,
    .scroll-indicator,
    video {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        page-break-after: always;
    }
    
    body {
        background: white;
    }
}

/* ========================================
   12. MEJORAS ESPECÍFICAS DE COMPONENTES
   ======================================== */

/* Countdown: mejorar legibilidad de números */
.countdown-circle-num {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Deadline badge con mejor contraste */
.deadline-badge {
    background: rgba(230, 166, 35, 0.15);
    border: 1.5px solid rgba(230, 166, 35, 0.3);
    padding: 0.625rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sage-dark);
    display: inline-block;
    transition: all 0.3s ease;
}

.deadline-badge:hover {
    background: rgba(230, 166, 35, 0.25);
    border-color: rgba(230, 166, 35, 0.5);
    transform: scale(1.02);
}

/* Success message con animación de confeti virtual */
.success-icon {
    animation: successPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successPop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Edit mode banner mejorado */
.edit-mode-banner {
    background: linear-gradient(135deg, rgba(122, 130, 112, 0.08) 0%, rgba(168, 176, 157, 0.12) 100%);
    border-left: 4px solid var(--sage);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    animation: slideInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Guest cards mejorados en RSVP */
.guest-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid transparent;
}

.guest-card:hover {
    border-color: var(--sage-light);
    box-shadow: 0 4px 12px -3px rgba(122, 130, 112, 0.2);
    transform: translateY(-2px);
}

/* ========================================
   13. MEJORAS DE TIPOGRAFÍA
   ======================================== */

/* Mejorar kerning y legibilidad */
.hero-name,
.section-title {
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

/* Mejor espaciado en párrafos */
.hero-verse p,
.section-subtitle,
p.font-body {
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   FIN DE MEJORAS
   ======================================== */
