/* ==========================================================================
   CINEMATIC SCROLL ANIMATIONS & TRANSITIONS
   ========================================================================== */

/* ── INTERSECTION OBSERVER BASE CLASSES ── */

.gs-reveal, .cinematic-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.cinematic-reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children reveals */
.stagger-group .gs-reveal:nth-child(1) { transition-delay: 0.1s; }
.stagger-group .gs-reveal:nth-child(2) { transition-delay: 0.2s; }
.stagger-group .gs-reveal:nth-child(3) { transition-delay: 0.3s; }
.stagger-group .gs-reveal:nth-child(4) { transition-delay: 0.4s; }
.stagger-group .gs-reveal:nth-child(5) { transition-delay: 0.5s; }

/* ── PARALLAX STARS & HEARTS ── */
.parallax-layer {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ── TIMELINE ANIMATIONS (Our Story) ── */
.timeline-card {
    opacity: 0;
    transition: all 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity, box-shadow;
}
.timeline-card.left-side {
    transform: translateX(-60px) scale(0.95);
}
.timeline-card.right-side {
    transform: translateX(60px) scale(0.95);
}
.timeline-card.in-view {
    opacity: 1;
    transform: translateX(0) scale(1);
    box-shadow: 0 10px 40px rgba(255, 94, 142, 0.15);
}
.timeline-card:hover {
    transform: scale(1.03) translateY(-5px);
    box-shadow: 0 20px 50px rgba(255, 94, 142, 0.3);
}

.timeline-line-glow {
    height: 0;
    transition: height 1.5s ease-out;
    background: linear-gradient(180deg, transparent, var(--accent-primary), transparent);
    box-shadow: 0 0 15px var(--accent-primary);
}
.timeline-line-glow.in-view {
    height: 100%;
}

/* ── POLAROID GALLERY SCATTER ── */
.polaroid-scatter {
    opacity: 0;
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.polaroid-scatter:nth-child(odd).in-view {
    opacity: 1;
    transform: rotate(-6deg) translateY(0);
}
.polaroid-scatter:nth-child(even).in-view {
    opacity: 1;
    transform: rotate(8deg) translateY(0);
}
.polaroid-scatter:hover {
    transform: rotate(0) scale(1.1) !important;
    z-index: 10;
}

/* ── SECRET GARDEN BLOOM ── */
.garden-bloom {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    filter: blur(10px);
    transition: all 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.garden-bloom.in-view {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
}
.firefly {
    position: absolute;
    width: 4px; height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px 3px #ffff80;
    opacity: 0;
    pointer-events: none;
    animation: firefly-flight 8s ease-in-out infinite alternate;
}
@keyframes firefly-flight {
    0%   { opacity: 0; transform: translate(0, 0); }
    20%  { opacity: 1; }
    80%  { opacity: 0.8; }
    100% { opacity: 0; transform: translate(100px, -150px); }
}

/* ── FLOATING LETTERS ── */
.envelope-fly-in {
    opacity: 0;
    transform: translateY(80px) rotate(-10deg);
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.envelope-fly-in.in-view {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

/* ── TREASURE HUNT GLOW ── */
.treasure-glow {
    opacity: 0;
    filter: brightness(0.5);
    transition: all 1.5s ease;
}
.treasure-glow.in-view {
    opacity: 1;
    filter: brightness(1.2);
    animation: pulse-glow 3s infinite alternate;
}
@keyframes pulse-glow {
    from { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
    to   { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8); }
}

/* ── PAGE TRANSITION OVERLAY ── */
#cinematic-transition-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 6, 20, 0.98);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
}
#cinematic-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.transition-particles {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.transition-icon {
    font-size: 4rem;
    animation: heartbeat 1.2s infinite, float-up 2s ease-out forwards;
    filter: drop-shadow(0 0 20px var(--accent-primary));
}

/* ── MOOD CROSSFADE ENGINE ── */
body, .page-container, #background-container {
    transition: background 1.5s ease, background-color 1.5s ease, color 1.5s ease !important;
}

/* ── ROMANTIC TIC-TAC-TOE ── */
.tictactoe-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 250px;
    margin: 0 auto;
}
.ttt-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.ttt-cell:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}
.ttt-cell.pop-in {
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ── LOVE FORTUNE COOKIE ── */
.fortune-cookie-btn {
    font-size: 5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}
.fortune-cookie-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
}
.fortune-cookie-btn.cracked {
    animation: crack-shake 0.5s ease;
    pointer-events: none;
}
.fortune-paper {
    margin-top: 15px;
    background: #fff8e7;
    color: #333;
    padding: 15px 25px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 1px solid #d4c098;
    max-width: 80%;
    text-align: center;
    transform-origin: top center;
}
.fortune-paper.slide-down {
    animation: fortune-unroll 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes crack-shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg) scale(1.1); }
    50% { transform: rotate(10deg) scale(1.1); }
    75% { transform: rotate(-10deg) scale(1.1); }
    100% { transform: rotate(0deg) scale(1); }
}
@keyframes fortune-unroll {
    0% { opacity: 0; transform: scaleY(0) translateY(-20px); }
    100% { opacity: 1; transform: scaleY(1) translateY(0); }
}
