@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Pinyon+Script&family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300&family=Great+Vibes&family=Allura&family=Tangerine:wght@400;700&display=swap');

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

:root {
    --bg-color: #dcd4cc;
    --border-layer: #b8aea4;
    --gold: #a8956c;
    --gold-light: #c9b899;
    --text-color: #8f7272;
    --dark-text: #5a4a4a;
}

body {
    font-family: 'Cinzel', serif;
    overflow: hidden;
    min-height: 100vh;
    background: linear-gradient(135deg, #dcd4cc 0%, #e8e0d8 50%, #dcd4cc 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

body.show-content {
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
}

/* ========== PARTÍCULAS DE FONDO ========== */
.particles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 2s ease;
}

body.show-content .particles-bg {
    opacity: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
    opacity: 0;
    animation: float 4s ease-in-out infinite;
    box-shadow: 0 0 4px rgba(168, 149, 108, 0.6);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ========== CONTENIDO PRINCIPAL ========== */
.web-content {
    text-align: center;
    color: var(--text-color);
    opacity: 0;
    transform: scale(0.8) translateY(50px);
    transition: all 2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    position: relative;
    padding: 100px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

body.show-content .web-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.web-content p:first-child {
    letter-spacing: 5px;
    font-size: 0.85rem;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 20px;
    animation: fadeInDown 1s ease 2.5s both;
}

.web-content h1 {
    font-family: 'Pinyon Script', cursive;
    font-size: clamp(3rem, 10vw, 6rem);
    color: var(--dark-text);
    margin: 30px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    animation: fadeInScale 1.2s ease 2.7s both;
}

.web-content p:last-child {
    font-size: 1.2rem;
    letter-spacing: 8px;
    color: var(--text-color);
    font-weight: 300;
    animation: fadeInUp 1s ease 2.9s both;
}

/* ========== SOBRE ANIMADO ========== */
.envelope-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    pointer-events: none;
    perspective: 2500px;
    animation: envelopeEntrance 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes envelopeEntrance {
    0% {
        transform: scale(0.3) translateY(-100vh) rotate(-10deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.05) translateY(0) rotate(2deg);
    }
    100% {
        transform: scale(1) translateY(0) rotate(0);
        opacity: 1;
    }
}

/* ========== CONTENEDOR DE SOLAPA ========== */
.flap-container {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    pointer-events: all;
    transform-style: preserve-3d;
    transition: transform 2.5s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 10px 40px rgba(0,0,0,0.25));
}

/* ========== CAPAS DEL SOBRE ========== */
.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

/* Capa del borde (más oscura) */
.layer.border {
    background: linear-gradient(135deg, var(--border-layer) 0%, #a89e94 100%);
    z-index: 1;
}

/* Capa del papel (color principal) con textura */
.layer.paper {
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255,255,255,0.03) 2px,
            rgba(255,255,255,0.03) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255,255,255,0.03) 2px,
            rgba(255,255,255,0.03) 4px
        ),
        linear-gradient(135deg, var(--bg-color) 0%, #e8e0d8 100%);
    z-index: 2;
}

/* ========== SOLAPA IZQUIERDA ========== */
.flap-container.left {
    left: 0;
    transform-origin: left center;
}

.flap-container.left .layer {
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.flap-container.left .layer.paper {
    transform: translateX(-2px);
}

/* ========== SOLAPA DERECHA ========== */
.flap-container.right {
    right: 0;
    transform-origin: right center;
}

.flap-container.right .layer {
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.flap-container.right .layer.paper {
    transform: translateX(2px);
}

/* ========== ANIMACIÓN DE APERTURA ========== */
.envelope-overlay.open .flap-container.left {
    transform: rotateY(-180deg);
}

.envelope-overlay.open .flap-container.right {
    transform: rotateY(180deg);
}

/* ========== SELLO DE CERA ========== */
.seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    z-index: 20;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    background: 
        radial-gradient(circle at 35% 35%, #c9b899 0%, #a8956c 30%, #8a7a6a 100%);
    border-radius: 50%;
    box-shadow: 
        0 8px 30px rgba(0,0,0,0.4),
        inset 0 -3px 10px rgba(0,0,0,0.3),
        inset 0 3px 10px rgba(255,255,255,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid rgba(168, 149, 108, 0.4);
    animation: sealPulse 3s ease-in-out infinite;
}

@keyframes sealPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 
            0 8px 30px rgba(0,0,0,0.4),
            0 0 0 0 rgba(168, 149, 108, 0.7),
            inset 0 -3px 10px rgba(0,0,0,0.3),
            inset 0 3px 10px rgba(255,255,255,0.3);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 
            0 8px 30px rgba(0,0,0,0.4),
            0 0 0 15px rgba(168, 149, 108, 0),
            inset 0 -3px 10px rgba(0,0,0,0.3),
            inset 0 3px 10px rgba(255,255,255,0.3);
    }
}

.seal:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 
        0 12px 40px rgba(0,0,0,0.5),
        0 0 30px rgba(168, 149, 108, 0.5),
        inset 0 -3px 10px rgba(0,0,0,0.3),
        inset 0 3px 10px rgba(255,255,255,0.3);
}

/* Borde interno decorativo */
.seal::after {
    content: '';
    position: absolute;
    width: 85%;
    height: 85%;
    border: 2px dashed rgba(255,255,255,0.4);
    border-radius: 50%;
}

/* Textura del sello */
.seal::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: 
        repeating-radial-gradient(
            circle at 50% 50%,
            transparent 0,
            transparent 3px,
            rgba(255,255,255,0.05) 3px,
            rgba(255,255,255,0.05) 6px
        );
    opacity: 0.5;
}

.seal span {
    font-family: 'Great Vibes', cursive;
    font-size: 3.2rem;
    color: #f5efe8;
    padding-top: 8px;
    z-index: 1;
    text-shadow: 
        2px 2px 4px rgba(0,0,0,0.3),
        0 0 10px rgba(255,255,255,0.3);
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
    letter-spacing: 2px;
}

/* Animación al abrir el sello */
.envelope-overlay.open .seal {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(2) rotate(180deg);
}

/* ========== INSTRUCCIÓN ========== */
.instruction {
    position: absolute;
    bottom: 15%;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: #6b5d52;
    z-index: 30;
    pointer-events: none;
    animation: instructionPulse 3s infinite;
    transition: opacity 0.6s;
    font-weight: 600;
    text-shadow: 
        1px 1px 3px rgba(255,255,255,0.8),
        0 0 10px rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.3);
    padding: 12px 24px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid rgba(168, 149, 108, 0.3);
}

.envelope-overlay.open .instruction {
    display: none;
    opacity: 0;
}

@keyframes instructionPulse {
    0%, 100% {
        opacity: 0.85;
        transform: translateX(-50%) translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-8px);
    }
}

/* ========== EXPLOSIÓN DE PARTÍCULAS ========== */
.particle-burst {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 1px;
    pointer-events: none;
    z-index: 150;
}

.burst-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 6px rgba(168, 149, 108, 0.5);
}

/* ========== ANIMACIONES DE TEXTO ========== */
@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .seal {
        width: 100px;
        height: 100px;
    }

    .seal span {
        font-size: 2.3rem;
    }

    .instruction {
        font-size: 0.6rem;
        letter-spacing: 3px;
        bottom: 20%;
    }

    .web-content h1 {
        font-size: 4rem;
    }
}

@media (max-width: 480px) {
    .seal {
        width: 80px;
        height: 80px;
    }

    .seal span {
        font-size: 1.8rem;
        padding-top: 5px;
    }

    .instruction {
        font-size: 0.55rem;
        letter-spacing: 2px;
    }

    .web-content p:first-child {
        font-size: 0.7rem;
        letter-spacing: 3px;
    }

    .web-content p:last-child {
        font-size: 1rem;
        letter-spacing: 5px;
    }
}
