/* ============================================
   VARIABLES Y RESET - Colores de la imagen
   ============================================ */
:root {
    --color-fondo: #f5e6d3;
    --color-fondo-degradado-1: #f5e6d3;
    --color-fondo-degradado-2: #e8d5c4;
    
    --color-tarjeta: rgba(255, 255, 255, 0.95);
    --color-tarjeta-borde: rgba(201, 168, 76, 0.3);
    
    --color-texto-principal: #4a2c2a;
    --color-texto-destacado: #8b1a1a;
    --color-dorado: #c9a84c;
    --color-dorado-claro: #e8d5a3;
    
    --color-sombra: rgba(0, 0, 0, 0.15);
    --color-sombra-suave: rgba(0, 0, 0, 0.08);
    
    --radius-grande: 25px;
    --radius-medio: 15px;
    --radius-pequeno: 8px;
    
    --fuente-titulos: 'Quicksand', -apple-system, BlinkMacSystemFont, 
                       'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, 
                       Cantarell, 'Helvetica Neue', sans-serif;
    
    --fuente-mensaje: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
    
    --transicion-suave: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   BODY Y CONTENEDOR PRINCIPAL
   ============================================ */
body {
    font-family: var(--fuente-titulos);
    background: var(--color-fondo);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    /* CAMBIO: flex-start en lugar de center para pegar la tarjeta arriba en móvil */
    align-items: flex-start;
    padding: 40px 20px 20px; /* Reducido top: antes 20px */
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.contenedor {
    position: relative;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================
   FONDO DECORATIVO CON PATRÓN
   ============================================ */
.fondo-decorativo {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 0;
    background: 
        radial-gradient(circle at 15% 20%, rgba(139, 26, 26, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 80%, rgba(201, 168, 76, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(245, 230, 211, 0.3) 0%, transparent 70%),
        linear-gradient(135deg, var(--color-fondo-degradado-1) 0%, var(--color-fondo-degradado-2) 100%);
    pointer-events: none;
}

.fondo-decorativo::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(201, 168, 76, 0.15) 2px, transparent 2px),
        radial-gradient(circle at 80% 70%, rgba(139, 26, 26, 0.1) 3px, transparent 3px);
    background-size: 60px 60px, 80px 80px;
    pointer-events: none;
}

/* ============================================
   TARJETA PRINCIPAL
   ============================================ */
.tarjeta {
    position: relative;
    z-index: 1;
    background: var(--color-tarjeta);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-grande);
    padding: 20px 25px 20px;
    box-shadow: 
        0 15px 35px var(--color-sombra),
        0 5px 15px var(--color-sombra-suave);
    border: 1px solid var(--color-tarjeta-borde);
    transition: transform var(--transicion-suave), box-shadow var(--transicion-suave);
}

.tarjeta:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 20px 45px var(--color-sombra),
        0 5px 15px var(--color-sombra-suave);
}

/* ============================================
   HEADER - Ícono y título principal
   ============================================ */
.tarjeta__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tarjeta__icono-sorpresa {
    font-size: 2rem;
    display: inline-block;
    animation: latido 2s ease-in-out infinite;
    flex-shrink: 0;
}

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

.tarjeta__titulo-principal {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-texto-destacado);
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #8b1a1a 0%, #c9a84c 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

/* ============================================
   TÍTULO DE CUMPLEAÑOS
   ============================================ */
.tarjeta__titulo-cumpleanos {
    text-align: center;
    font-size: 1.2rem;
    color: var(--color-texto-principal);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px dashed var(--color-dorado);
    font-weight: 600;
    line-height: 1.3;
}

/* ============================================
   VIDEO - Contenedor adaptativo
   ============================================ */
.tarjeta__video-contenedor {
    margin: 0 0 18px 0;
    border-radius: var(--radius-medio);
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    position: relative;
    background: #0a0a0a;
}

/*
 * .tarjeta__video-marco
 * Por defecto: 16:9 (YouTube / Drive / horizontal)
 * JS añade la clase .tk-vertical cuando detecta video vertical,
 * y la clase .tk-proporcion-custom con una CSS var para proporciones raras.
 */
.tarjeta__video-marco {
    position: relative;
    width: 100%;
    /* Proporción 16:9 por defecto */
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

/* Video vertical detectado por JS */
.tarjeta__video-marco.tk-vertical {
    /* 9:16 = proporción estándar móvil */
    aspect-ratio: 9 / 16;
    /* En móvil ocupa ~78% del ancho de la tarjeta, centrado */
    width: 78%;
    margin: 0 auto;
}

/* Proporción personalizada (ej: 4:5, 3:4) inyectada por JS via CSS var */
.tarjeta__video-marco.tk-proporcion-custom {
    aspect-ratio: var(--tk-video-ratio);
    width: 78%;
    margin: 0 auto;
}

/* iframe ocupa todo el marco en cualquier proporción */
.tarjeta__video-marco iframe,
.tarjeta__video-marco .tk-video-wrap,
.tarjeta__video-marco video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.tarjeta__video-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f5f0eb;
    color: var(--color-texto-principal);
    font-size: 1rem;
    gap: 10px;
}

.tarjeta__video-error span {
    font-size: 3rem;
}

/* ============================================
   MENSAJE DE TEXTO
   ============================================ */
.tarjeta__mensaje-contenedor {
    background: linear-gradient(135deg, #fdf6f0 0%, #f8ede4 100%);
    border-radius: var(--radius-medio);
    padding: 22px 20px;
    border-left: 4px solid var(--color-dorado);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03);
    margin-bottom: 12px;
}

.tarjeta__mensaje {
    font-family: var(--fuente-mensaje);
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.8;
    color: var(--color-texto-principal);
    text-align: center;
}

.tarjeta__mensaje p {
    margin-bottom: 10px;
}

.tarjeta__mensaje p:last-child {
    margin-bottom: 0;
    text-align: right;
    font-weight: 600;
    color: var(--color-texto-destacado);
}

.tarjeta__mensaje p:has(❤️) {
    font-weight: 600;
    color: var(--color-texto-destacado);
}

/* ============================================
   FOOTER
   ============================================ */
.tarjeta__footer {
    text-align: center;
    font-size: 0.8rem;
    color: #999;
    padding-top: 10px;
    margin-top: 2px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.footer-logo {
    font-size: 0.9rem;
}

/* ============================================
   PÁGINA DE ERROR
   ============================================ */
.tarjeta--error {
    text-align: center;
    padding: 35px 25px;
}

.error-contenido {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.error-icono {
    font-size: 3.5rem;
}

.tarjeta--error h1 {
    font-size: 1.8rem;
    color: var(--color-texto-destacado);
    font-weight: 700;
}

.tarjeta--error p {
    color: var(--color-texto-principal);
    font-size: 1rem;
    line-height: 1.5;
}

/* ============================================
   RESPONSIVE - TABLETS Y MÓVILES
   ============================================ */
@media (max-width: 768px) {
    .contenedor {
        max-width: 100%;
    }

    .tarjeta {
        padding: 18px 20px 16px;
    }

    .tarjeta__titulo-principal {
        font-size: 1.1rem;
    }

    .tarjeta__icono-sorpresa {
        font-size: 1.7rem;
    }

    .tarjeta__titulo-cumpleanos {
        font-size: 1.1rem;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .tarjeta__mensaje {
        font-size: 1.15rem;
    }

    /* Video vertical en tablet: ancho algo mayor */
    .tarjeta__video-marco.tk-vertical,
    .tarjeta__video-marco.tk-proporcion-custom {
        width: 65%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 40px 12px 16px; /* Reducido top para acercar más la tarjeta */
    }

    .tarjeta {
        padding: 15px 15px 14px;
        border-radius: 20px;
    }

    .tarjeta__header {
        gap: 6px;
        margin-bottom: 6px;
    }

    .tarjeta__titulo-principal {
        font-size: 0.95rem;
    }

    .tarjeta__icono-sorpresa {
        font-size: 1.3rem;
    }

    .tarjeta__titulo-cumpleanos {
        font-size: 0.95rem;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .tarjeta__video-contenedor {
        margin: 0 0 14px 0;
        border-radius: 12px;
    }

    .tarjeta__mensaje-contenedor {
        padding: 16px 14px;
        margin-bottom: 10px;
    }

    .tarjeta__mensaje {
        font-size: 1.05rem;
        line-height: 1.6;
    }

    /* Video vertical en móvil: más ancho para aprovechar pantalla */
    .tarjeta__video-marco.tk-vertical,
    .tarjeta__video-marco.tk-proporcion-custom {
        width: 88%;
    }

    .tarjeta--error {
        padding: 25px 18px;
    }

    .tarjeta--error h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 360px) {
    body {
        padding: 6px 8px 12px;
    }

    .tarjeta {
        padding: 12px 12px 12px;
        border-radius: 16px;
    }

    .tarjeta__titulo-principal {
        font-size: 0.85rem;
    }

    .tarjeta__icono-sorpresa {
        font-size: 1.1rem;
    }

    .tarjeta__titulo-cumpleanos {
        font-size: 0.85rem;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .tarjeta__mensaje-contenedor {
        padding: 14px 12px;
    }

    .tarjeta__mensaje {
        font-size: 0.95rem;
    }

    /* Video vertical en móvil pequeño: casi full width */
    .tarjeta__video-marco.tk-vertical,
    .tarjeta__video-marco.tk-proporcion-custom {
        width: 94%;
    }
}

/* ============================================
   UTILIDADES Y ANIMACIONES EXTRA
   ============================================ */
.tarjeta__video-contenedor::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.05) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 2;
}

.tarjeta__video-contenedor:hover::after {
    opacity: 1;
}

.tarjeta__mensaje-contenedor p {
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}