@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,200..900;1,200..900&family=Poppins:wght@200;300;400&display=swap');

:root {
    --bg-color: #0d0d0d;
    --text-color: #f5f5f7;
    --accent-color: #d4af37;
    --secondary-text: rgba(245, 245, 247, 0.7);
    --transition-speed: 2s;
    --stay-duration: 3s;
    --font-main: 'Crimson Pro', serif;
    --font-accent: 'Poppins', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-accent);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Cinematic Depth Gradient */
    background: linear-gradient(135deg, #05010a 0%, #140a25 50%, #05010a 100%);
    transition: opacity 3s ease, background 5s ease;
}

body.final-reveal #bg-canvas {
    background: linear-gradient(135deg, #1a0a0a 0%, #3d1414 50%, #1a0a0a 100%);
    opacity: 0.4 !important;
}

body.final-reveal .haze-layer {
    background: radial-gradient(circle at 50% 50%, rgba(230, 57, 70, 0.08) 0%, transparent 70%);
}

.haze-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, rgba(157, 78, 221, 0.04) 0%, transparent 70%);
    animation: hazeMovement 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hazeMovement {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(-5%, 5%) scale(1.1);
        opacity: 0.5;
    }
}

/* Memory Image Layers */
.memory-image-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.memory-image {
    position: absolute;
    max-width: 45%;
    max-height: 70%;
    opacity: 0;
    /* Cinematic Memory Treatment */
    filter: grayscale(100%) brightness(0.7) blur(1.5px) contrast(1.1);
    box-shadow: 0 0 60px rgba(157, 78, 221, 0.15);
    transition: opacity 1.5s ease-in-out, transform 6s ease-in-out, filter 1.5s ease-in-out;
    mask-image: radial-gradient(circle, black 40%, transparent 90%);
    -webkit-mask-image: radial-gradient(circle, black 40%, transparent 90%);
    will-change: transform, opacity;
}

.memory-image.active {
    opacity: 0.1;
    /* Perfectly balanced faintness (8-12% range) */
    filter: grayscale(20%) brightness(0.6) blur(0.5px) contrast(1.05);
}

.memory-image.left {
    left: 8%;
    /* Vertical randomness handled via JS */
}

.memory-image.right {
    right: 8%;
    /* Vertical randomness handled via JS */
}

.memory-image.center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
    max-width: 30%;
}

/* Base Styles Update */
.experience-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Cinematic Text Styles */
.story-text {
    font-family: var(--font-main);
    font-size: clamp(1.4rem, 4.5vw, 2.6rem);
    line-height: 1.6;
    font-weight: 200;
    letter-spacing: 0.05em;
    opacity: 0;
    transform: translateY(0);
    /* Stay at center */
    transition: opacity 1s ease-in-out;
    text-shadow:
        0 0 20px rgba(255, 255, 255, 0.1),
        0 0 40px rgba(157, 78, 221, 0.1);
    /* Soft Orchid Glow */
    position: relative;
    /* Changed from absolute for better control */
    width: 80%;
    max-width: 800px;
    padding: 0 40px;
    pointer-events: none;
    text-align: center;
}

.story-text.active {
    opacity: 1;
    transform: translateY(0);
}

.story-text.exit {
    opacity: 0;
    transform: translateY(0);
    /* Fades out in place */
}

/* Audio Control */
.audio-control {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--secondary-text);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.audio-control:hover {
    color: var(--accent-color);
}

/* Start Overlay */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 2s ease;
}

#start-btn {
    background: none;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 15px 40px;
    font-family: var(--font-accent);
    font-size: 0.8rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

#start-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.4);
    letter-spacing: 7px;
}

.overlay-title {
    font-family: var(--font-main);
    font-size: 1.4rem;
    font-weight: 200;
    color: var(--secondary-text);
    margin-bottom: 20px;
    letter-spacing: 3px;
    font-style: italic;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* Choice Interaction Styles */
.choice-container {
    display: none;
    gap: 40px;
    margin-top: 50px;
    opacity: 0;
    transition: opacity 1.5s ease;
    z-index: 20;
}

.choice-container.visible {
    display: flex;
    opacity: 1;
}

.choice-btn {
    padding: 12px 45px;
    font-family: var(--font-accent);
    font-size: 0.9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.choice-btn:hover {
    border-color: rgba(157, 78, 221, 0.5);
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.2);
    transform: translateY(-2px);
}

.choice-btn.yes:hover {
    background: rgba(157, 78, 221, 0.1);
}

.excuse-text {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-main);
    font-style: italic;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    opacity: 0;
    transition: opacity 1.5s ease;
    text-align: center;
    width: 80%;
    max-width: 600px;
}

.excuse-text.visible {
    opacity: 1;
}

.final-letter {
    font-family: var(--font-main);
    font-size: clamp(1.2rem, 3.5vw, 2rem);
    line-height: 1.8;
    font-weight: 300;
    color: var(--text-color);
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
    white-space: pre-wrap;
    opacity: 0;
    transition: opacity 2s ease;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.final-letter.visible {
    opacity: 1;
}

.mail-btn {
    display: none;
    margin-top: 40px;
    padding: 15px 40px;
    font-family: var(--font-accent);
    font-size: 0.9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: rgba(157, 78, 221, 0.1);
    border: 1px solid rgba(157, 78, 221, 0.3);
    color: var(--text-color);
    cursor: pointer;
    border-radius: 40px;
    transition: all 0.5s ease;
    opacity: 0;
    z-index: 30;
}

.mail-btn.visible {
    display: block;
    opacity: 1;
    animation: breathingGlow 3s infinite;
}

@keyframes breathingGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(157, 78, 221, 0.1);
    }

    50% {
        box-shadow: 0 0 40px rgba(157, 78, 221, 0.3);
    }
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--text-color);
    margin-left: 5px;
    vertical-align: middle;
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    .story-text {
        font-size: 1.6rem;
        padding: 0 20px;
    }

    .audio-control {
        bottom: 20px;
        right: 20px;
    }
}