/* ============================================
   VARIÁVEIS
   ============================================ */
:root {
    --bg-dark: #07030a;
    --bg-lavender: #ece1f5;
    --bg-gradient: linear-gradient(135deg, #e3cff2 0%, #f7effa 50%, #d8bbed 100%);
    --primary-color: #b38cd6;
    --primary-dark: #8c60ba;
    --text-dark: #312145;
    --accent-glow: rgba(179, 140, 214, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.35);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body { overflow: hidden; height: 100%; width: 100%; }

body {
    font-family: 'Quicksand', sans-serif;
    background: var(--bg-lavender);
    color: var(--text-dark);
    line-height: 1.6;
    transition: background 4s ease;
    -webkit-font-smoothing: antialiased;
}

body.theme-light { background: var(--bg-gradient); }

/* ============================================
   CANVAS & OVERLAY
   ============================================ */
#magic-canvas {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    z-index: 1; pointer-events: none;
}

#dark-overlay {
    position: fixed; inset: 0;
    background: radial-gradient(circle at center, #1a0f2e, var(--bg-dark));
    z-index: 5; transition: opacity 3.5s ease; pointer-events: none;
}
#dark-overlay.fade-out { opacity: 0; }

/* ============================================
   TELAS FULLSCREEN
   ============================================ */
.fullscreen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 10; padding: 20px;
    text-align: center; opacity: 1;
    transition: opacity 1.8s ease, filter 1.8s ease;
}
.fullscreen.hidden-screen { opacity: 0; pointer-events: none; filter: blur(12px); z-index: 8; }
.fullscreen.active { opacity: 1; pointer-events: auto; filter: blur(0); z-index: 10; }

/* ============================================
   TIPOGRAFIA BASE
   ============================================ */
.typewriter-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 5.5vw, 3.5rem);
    font-weight: 400; letter-spacing: 1px;
    line-height: 1.3; margin-bottom: 15px; min-height: 1.3em;
}

.breath-indicator {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem; letter-spacing: 3px;
    color: rgba(255,255,255,0.6);
    margin-top: 40px; cursor: pointer;
    animation: breath 3.5s infinite ease-in-out;
}
@keyframes breath {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; text-shadow: 0 0 12px rgba(255,255,255,0.4); }
}

.hint-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem; letter-spacing: 3px;
    text-transform: uppercase; color: #a291b5;
    margin-top: 35px; animation: fadeIn 2s 2.5s both;
}

/* ============================================
   ENVELOPE
   ============================================ */
.envelope-wrapper {
    position: relative; width: min(340px, 85vw); height: min(220px, 55vw);
    cursor: pointer; transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.envelope-wrapper:hover { transform: scale(1.05) translateY(-5px); }
.envelope-glow {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 150%; height: 170%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 65%);
    opacity: 0.35; z-index: 0; pointer-events: none;
    animation: pulseGlow 4s infinite alternate;
}
@keyframes pulseGlow {
    from { transform: translate(-50%, -50%) scale(0.92); opacity: 0.25; }
    to   { transform: translate(-50%, -50%) scale(1.08); opacity: 0.65; }
}
.envelope {
    position: relative; width: 100%; height: 100%;
    background-color: var(--primary-dark); border-radius: 8px;
    box-shadow: 0 30px 60px -15px rgba(49, 33, 69, 0.5); z-index: 2;
}
.flap, .pocket { position: absolute; width: 0; height: 0; }
.flap {
    border-top: min(120px, 30vw) solid #cfb8eb;
    border-left: min(170px, 42.5vw) solid transparent;
    border-right: min(170px, 42.5vw) solid transparent;
    border-bottom: min(100px, 25vw) solid transparent;
    top: 0; left: 0; z-index: 4; transform-origin: top;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.6s;
    filter: drop-shadow(0 6px 6px rgba(0,0,0,0.12));
}
.pocket {
    border-bottom: min(120px, 30vw) solid var(--primary-color);
    border-left: min(170px, 42.5vw) solid #b38bd6;
    border-right: min(170px, 42.5vw) solid #b38bd6;
    border-top: min(100px, 25vw) solid transparent;
    border-radius: 0 0 8px 8px; bottom: 0; left: 0; z-index: 3;
}
.letter {
    position: absolute; background: #fffcfd;
    width: calc(100% - 40px); height: calc(100% - 30px);
    top: 15px; left: 20px; border-radius: 4px; z-index: 2;
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.7s;
    padding: 20px; display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.letter p {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic; font-size: clamp(1.2rem, 4vw, 1.8rem);
    line-height: 1.4; color: var(--primary-dark);
}
.envelope-wrapper.open .flap { transform: rotateX(180deg); z-index: 1; }
.envelope-wrapper.open .letter {
    transform: translateY(-130px) scale(1.05); z-index: 5;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* ============================================
   TELA 2: FOTOS LATERAIS E CONTEÚDO CENTRAL
   ============================================ */
#screen-2 {
    flex-direction: row;
    justify-content: center; align-items: center;
    gap: 25px; overflow: hidden; padding: 30px;
}

.side-photos {
    flex: 0 0 180px;
    display: flex; flex-direction: column;
    gap: 12px; align-items: center;
    height: 90vh; justify-content: center; overflow: hidden;
}

.floating-photo {
    background: rgba(255,255,255,0.8); backdrop-filter: blur(8px);
    padding: 5px; padding-bottom: 18px; border-radius: 3px;
    box-shadow: 0 8px 25px rgba(49,33,69,0.12);
    border: 1px solid rgba(255,255,255,0.5);
    transition: transform 0.5s ease, box-shadow 0.5s ease, opacity 1.5s ease;
    opacity: 0; width: 130px;
}
.floating-photo.visible { opacity: 1; }
.floating-photo img {
    width: 100%; display: block; border-radius: 2px;
    aspect-ratio: 4 / 3; object-fit: cover;
}
.floating-photo:hover {
    transform: scale(1.1) rotate(0deg) !important;
    box-shadow: 0 20px 40px rgba(49,33,69,0.25); z-index: 20;
}
/* Rotações estilo polaroid */
.fp-1 { transform: rotate(-4deg); }
.fp-2 { transform: rotate(3deg); }
.fp-3 { transform: rotate(-2deg); }
.fp-4 { transform: rotate(4deg); }
.fp-5 { transform: rotate(3deg); }
.fp-6 { transform: rotate(-3deg); }
.fp-7 { transform: rotate(2deg); }
.fp-8 { transform: rotate(-4deg); }
.fp-9 { transform: rotate(1deg); }

/* ============================================
   ÁREA CENTRAL DE TEXTO (PROGRESSIVO)
   ============================================ */
.center-content {
    flex: 0 1 500px;
    max-width: 500px;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 10px 20px;
}

#text-wrapper {
    width: 100%;
}

.msg {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    line-height: 1.55; 
    margin-bottom: 16px;
    color: var(--text-dark);
}
.msg:last-of-type { margin-bottom: 0; }

.highlight-q {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.4rem, 3.5vw, 1.7rem);
    font-style: italic; color: var(--primary-dark);
    line-height: 1.4;
    margin-top: 15px;
}

/* CARACTERES INDIVIDUAIS (Efeito Máquina de Escrever) */
.char {
    opacity: 0;
    transition: opacity 0.6s ease;
}
.char.visible {
    opacity: 1;
}

/* ============================================
   BOTÕES
   ============================================ */
.answer-buttons {
    display: flex; justify-content: center;
    gap: 20px; flex-wrap: wrap; margin-top: 30px;
    opacity: 0; transition: opacity 1.5s ease;
}
.answer-buttons.visible {
    opacity: 1;
}

.btn-primary {
    background: var(--glass-bg); backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border); color: var(--text-dark);
    padding: 15px 45px; font-family: 'Montserrat', sans-serif;
    font-size: 1rem; font-weight: 300; letter-spacing: 2px;
    border-radius: 40px; cursor: pointer;
    box-shadow: 0 10px 35px rgba(49,33,69,0.12); outline: none;
    transition: all 0.5s ease;
}
.btn-primary:hover {
    background: rgba(255,255,255,0.55); transform: translateY(-4px);
    box-shadow: 0 18px 45px rgba(49,33,69,0.22);
}
.btn-secondary {
    background: transparent; border: 1px solid rgba(49,33,69,0.18);
    color: #7a6790; padding: 15px 45px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem; font-weight: 300; letter-spacing: 2px;
    border-radius: 40px; cursor: pointer; outline: none;
    transition: opacity 0.5s ease, filter 0.5s ease, transform 0.5s ease;
}

/* ============================================
   TELA FINAL
   ============================================ */
.final-scene { position: relative; text-align: center; z-index: 2; }
.heart-svg-container { margin-bottom: 25px; animation: heartPulse 1.8s ease-in-out infinite; }
.heart-svg { width: 90px; height: 83px; filter: drop-shadow(0 0 25px rgba(179,140,214,0.6)); }
@keyframes heartPulse {
    0%   { transform: scale(1); }
    15%  { transform: scale(1.2); }
    30%  { transform: scale(1); }
    45%  { transform: scale(1.15); }
    60%  { transform: scale(1); }
    100% { transform: scale(1); }
}
.glow-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    text-shadow: 0 0 50px var(--accent-glow), 0 0 100px rgba(179,140,214,0.3);
}
.final-line {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    font-weight: 300; letter-spacing: 2px;
    margin-bottom: 8px; opacity: 0;
}
.fl-1 { animation: fadeIn 2.5s 2s both; }
.fl-2 { animation: fadeIn 2.5s 4s both; }
.fl-3 { animation: fadeIn 2.5s 6s both; }

.memory-slideshow { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.slide-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0;
    filter: blur(30px) brightness(1.1);
    transition: opacity 3s ease; transform: scale(1.1);
}
.slide-img.active-slide { opacity: 0.2; }

@keyframes fadeIn { to { opacity: 1; } }

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 900px) {
    #screen-2 { flex-direction: column; gap: 10px; padding: 15px; }
    .side-photos {
        flex: none; flex-direction: row; flex-wrap: wrap;
        justify-content: center; gap: 8px; height: auto; padding: 5px 0;
    }
    .left-photos { order: 1; }
    .center-content { order: 2; flex: none; }
    .right-photos { order: 3; }
    .floating-photo { width: 55px; padding: 3px; padding-bottom: 12px; }
    .answer-buttons { flex-direction: column; align-items: center; gap: 12px; }
    .btn-primary, .btn-secondary { width: 85%; padding: 14px 20px; }
}
