/* Estilos para la Galería de Fotos en la vista final de la invitación */

.inv-dig-photo-gallery {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 columnas en escritorio */
    gap: 15px;
}

.gallery-item a {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.gallery-item a:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Asegura que la imagen cubra el espacio sin deformarse */
}

/* Adaptación para pantallas más pequeñas (móviles y tablets en vertical) */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columnas en móvil */
        gap: 10px;
    }
}

/* FIX: BLOQUEO ESTRICTO DEL CANVAS */
.canvas-container,
.canvas-container canvas,
#vista-final-container {
    pointer-events: none !important;
}

/* =========================================
   ESTILOS DE CONTENEDOR (Pantalla Completa)
   ========================================= */
.entry-content,
.post-content,
.inv-dig-card-section {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
}

/* =========================================
   SOBRE INTERACTIVO (Splash Screen Experience)
   ========================================= */

:root {
    --color-sobre-fallback: #c4a484;
    /* Color por defecto si no hay variable */
    --color-papel: #f4ecd8;
    --dorado: #d4ac0d;
    --transition-premium: 2s cubic-bezier(0.19, 1, 0.22, 1);
}

.inv-dig-envelope-splash {
    /* Lógica de colores Dinámicos heredados de --inv-main-color */
    --color-sobre-base: var(--inv-main-color, var(--color-sobre-fallback));
    --color-sobre: var(--color-sobre-base);
    --color-sobre-oscuro: color-mix(in srgb, var(--color-sobre-base), black 15%);
    --lacre: color-mix(in srgb, var(--color-sobre-base), black 30%);
}

/* Bloquear scroll mientras el sobre está activo */
body.inv-dig-locked {
    overflow: hidden !important;
}

.inv-dig-envelope-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.15);
    background-image: var(--inv-bg-url);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Crear un overlay para que el fondo no afecte la legibilidad del sobre */
    box-shadow: inset 0 0 0 1000px rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    /* Centrado absoluto */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1.5s var(--transition-premium);
}

/* Resplandor radial muy tenue teñido con el color principal */
.inv-dig-envelope-splash::before {
    content: "";
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle,
            color-mix(in srgb, var(--inv-main-color, white), white 60%) 0%,
            rgba(255, 255, 255, 0) 70%);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

/* =========================================
   ELEMENTOS FLOTANTES (TEMA Y ORNAMENTO)
   ========================================= */

/* Ornamentos Flotantes */
.inv-dig-floating-ornament {
    position: absolute;
    width: auto;
    max-width: 140px;
    max-height: 160px;
    height: auto;
    z-index: 110;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.1));
    animation: invDigFloat 5s ease-in-out infinite;
    pointer-events: none;
}

.ornament-top-left {
    top: -140px;
    /* Sobresale arriba, toca 20px (basado en max-height 160px) */
    left: -30px;
    animation-delay: -1s;
}

.ornament-bottom-right {
    bottom: -140px;
    /* Sobresale abajo, toca 20px */
    right: -30px;
    animation-delay: -2.5s;
    /* Animación desfasada para naturalidad */
}

@keyframes invDigFloat {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-15px) rotate(1deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

/* Ajustes Responsive para Elementos Flotantes */
@media (max-width: 380px) {
    .inv-dig-floating-ornament {
        width: 100px;
        bottom: -70px;
        right: 0;
    }
}

.contenedor-invitacion {
    position: relative;
    width: 380px;
    height: 250px;
    perspective: 1500px;
    cursor: pointer;
    z-index: 100;
    transition: transform var(--transition-premium);
}

/* Cuerpo del sobre */
.sobre-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 100;
    transition: opacity var(--transition-premium), transform var(--transition-premium);
}

.sobre {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-sobre) 0%, color-mix(in srgb, var(--color-sobre), black 5%) 100%);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    /* Sombra mucho más suave */
    z-index: 10;
}

/* Triángulo frontal */
.sobre::before {
    content: "";
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 190px solid transparent;
    border-right: 190px solid transparent;
    border-bottom: 140px solid var(--color-sobre-oscuro);
    z-index: 15;
    border-radius: 0 0 8px 8px;
}

@media (max-width: 380px) {
    .contenedor-invitacion {
        width: 90vw;
    }

    .sobre::before {
        border-left-width: 45vw;
        border-right-width: 45vw;
    }
}

/* SOLAPA SUPERIOR */
.solapa {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 190px solid transparent;
    border-right: 190px solid transparent;
    border-top: 140px solid var(--color-sobre);
    transform-origin: top;
    transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 20;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
    /* Sombra más ligera */
}

@media (max-width: 380px) {
    .solapa {
        border-left-width: 45vw;
        border-right-width: 45vw;
    }
}

/* Texto escrito sobre la solapa */
.texto-solapa {
    position: absolute;
    top: -110px;
    left: -140px;
    width: 280px;
    text-align: center;
    font-family: 'Dancing Script', cursive;
    font-size: 24px;
    color: color-mix(in srgb, var(--color-sobre-base), black 60%);
    /* Texto contrastado */
    transform: rotateX(180deg) rotateZ(1deg);
    /* Invertido porque la solapa se rota */
    pointer-events: none;
    white-space: nowrap;
}

/* Cuando la solapa está cerrada, el texto debe verse al derecho */
.contenedor-invitacion:not(.abriendo):not(.saliendo):not(.completado) .texto-solapa {
    transform: rotate(0deg);
    top: 30px;
    /* Ajustar posición cuando está cerrada */
}

.sello {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 65px;
    height: 65px;
    background: var(--lacre);
    border-radius: 50%;
    z-index: 25;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 0 15px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease, transform 0.6s ease, background-color 0.3s ease;
    color: var(--dorado);
    /* Color para el SVG interno */
}

.sello svg {
    width: 36px;
    height: 36px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

/* LA CARTA (Canvas) */
#vista-final-container {
    width: 100%;
    max-width: 380px;
    background: var(--color-papel);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    overflow: hidden;
    /* La transición de transform se activará en el JS para el asentamiento */
}

#vista-final-container.in-splash {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 220px;
    z-index: 5;
    transition: transform var(--transition-premium), height var(--transition-premium), opacity 1s ease;
    opacity: 0;
}

/* FASES DE ANIMACIÓN EN SPLASH */
.contenedor-invitacion.abriendo .solapa {
    transform: rotateX(170deg);
}

.contenedor-invitacion.abriendo .sello {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
}

.contenedor-invitacion.saliendo #vista-final-container.in-splash {
    opacity: 1;
    transform: translate(-50%, -280px);
    height: 640px;
    z-index: 110;
}

/* DESVANECE EL SPLASH (Más rápido para solapar) */
.inv-dig-envelope-splash.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease-in-out;
}

/* ANCLA Y POSICIÓN FINAL */
.inv-dig-canvas-anchor {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    min-height: 1px;
    position: relative;
    /* Asegurar que el ancla esté arriba si es posible */
}

/* Clase para el deslizamiento suave final (Más Premium) */
.settling {
    transition: transform 1.8s cubic-bezier(0.19, 1, 0.22, 1) !important;
}

#vista-final-canvas {
    max-width: 100%;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    /* Sombra elegante al settles */
}

/* Ajustes para el canvas */
#vista-final-canvas {
    max-width: 100%;
}



/* =========================================
   Estilos Unificados (Card Style)
   ========================================= */

.inv-dig-card-section {
    margin-top: 50px;
    padding: 30px 20px;
    background-color: #fff;
    /* Fondo limpio */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Sombra muy suave */
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    /* Heredar fuente del tema explícitamente */
    font-family: inherit;
}

/* --- Cabecera de Sección Común --- */
.inv-dig-section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    color: #333;
}

.inv-dig-section-icon {
    color: #d4af37;
    /* Dorado genérico */
    width: 32px;
    height: 32px;
}

.inv-dig-section-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: inherit;
    /* Heredar color del padre/tema si es necesario */
    font-family: inherit;
    /* CLAVE: Heredar fuente del tema */
}

/* --- Grid de Tiendas (Mesa de Regalos) --- */
.inv-dig-gift-stores h4,
.inv-dig-monetary-gift h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gift-stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
    justify-content: center;
}

.store-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    text-decoration: none;
    color: #444;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.store-card:hover {
    transform: translateY(-3px);
    background: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-color: #eee;
    color: #d4af37;
}

.store-icon {
    margin-bottom: 10px;
    color: #888;
    transition: color 0.3s ease;
}

.store-card:hover .store-icon {
    color: #d4af37;
}

.store-name {
    font-weight: 600;
    font-size: 0.95rem;
}

/* --- Regalo Monetario --- */
.inv-dig-monetary-gift {
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.monetary-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.inv-dig-icon-envelope {
    color: #888;
}

.monetary-desc {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Botón Toggle */
.inv-dig-toggle-details-btn {
    background-color: #f0f0f0;
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.1s;
    font-family: inherit;
}

.inv-dig-toggle-details-btn:hover {
    background-color: #e0e0e0;
}

.inv-dig-toggle-details-btn:active {
    transform: scale(0.98);
}

.chevron-icon {
    transition: transform 0.3s ease;
    width: 18px;
    height: 18px;
}

/* Detalles Bancarios */
.inv-dig-monetary-details {
    margin-top: 20px;
    animation: fadeIn 0.4s ease;
}

.details-card {
    background: #fafafa;
    border: 1px dashed #ccc;
    padding: 20px;
    border-radius: 8px;
    display: inline-block;
    min-width: 280px;
    text-align: left;
}

.method-name {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 8px;
}

.detail-line {
    margin: 4px 0;
    color: #555;
    font-family: monospace, sans-serif;
    font-size: 1rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Galería de Fotos --- */
.inv-dig-photo-gallery .gallery-grid {
    margin-top: 0;
    gap: 15px;
}

.inv-dig-photo-gallery .gallery-item a {
    box-shadow: none;
    border: 1px solid #eee;
}

.inv-dig-photo-gallery .gallery-item a:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #d4af37;
}

/* --- Confirmación de Asistencia (RSVP) --- */
.inv-dig-rsvp-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.rsvp-deadline {
    font-size: 1rem;
    color: #555;
    margin: 0;
}

.inv-dig-btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #25D366;
    /* WhatsApp Green */
    color: #fff !important;
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

.inv-dig-btn-whatsapp:hover {
    background-color: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.4);
}

.inv-dig-btn-whatsapp svg {
    fill: currentColor;
}

/* Responsive General */
@media (max-width: 600px) {
    .inv-dig-card-section {
        padding: 20px 15px;
        margin-top: 30px;
    }

    .gift-stores-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .store-card {
        padding: 15px 10px;
    }

    .inv-dig-section-title {
        font-size: 1.5rem;
    }
}