/* --- Global & Body Styling --- */
/* Added a fallback background-color and line-height for readability */
body {
    font-family: 'Merriweather', serif;
    text-align: center;
    background-color: #013220;
    /* Fallback for your image */
    background-image: url('/static/background.png');
    background-size: cover;
    background-attachment: fixed;
    /* Keeps background still on scroll */
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    color: #f8f8f2;
    line-height: 1.6;
    /* Improved readability */
}

h1 {
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 3.5rem;
    font-family: 'Great Vibes', cursive;
    z-index: 1;
    position: relative;

    /* --- Old School Fairy Light Effect (Default "On" state) --- */
    /* This is the stable "on" color and glow */
    color: #f0e68c;
    /* Warm, slightly desaturated yellow */
    text-shadow:
        0 0 3px #fdfd96,
        /* Inner soft yellow glow */
        0 0 7px #ffd700,
        /* Main gold glow */
        0 0 12px #cc9900;
    /* Deeper, warmer gold glow */

    /* Runs fade-in, then starts the 5-second flicker-burst cycle */
    animation:
        fadeInGlow 1s ease-in-out forwards,
        flickerBurst 2s infinite linear 1s;
    /* UPDATED: 5s cycle, 'linear' for crisp keyframes */
}

/* --- Grid for the calendar --- */
/* Added perspective for a 3D hover effect on the doors */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 25px;
    /* Increased gap */
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    z-index: 1;
    /* Set base z-index */
    position: relative;
    perspective: 1000px;
    /* This enables the 3D door tilt */
}

/* --- Styling each door (Using Image) --- */
/* This is the new, merged section */
.door {
    /* --- NEW: Force square shape --- */
    aspect-ratio: 1 / 1;

    /* Use the image as the background */
    background-image: url('/static/closed_door.png');
    background-size: cover;
    /* Ensures the image fills the div */
    background-position: center;

    color: #ffd700;
    font-size: 3rem;
    font-family: 'Great Vibes', cursive;
    text-shadow: 0 0 5px #ffffff;

    /* --- NEW: Use Flexbox to center the number --- */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Removed padding and line-height */

    /* border-radius: 12px; */
    /* Should match the image's corners */
    cursor: pointer;
    text-align: center;

    /* A simple shadow behind the door image */
    box-shadow: 0px 0px 10px rgb(255, 255, 255);

    /* Updated transition to include filter */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, filter 0.3s ease;

    /* Removed the CSS border; image provides it */

    z-index: 1;
    position: relative;
}

.door:hover {
    /* The background image stays the same */
    /* 3D tilt effect! */
    transform: scale(1.05);

    /* A more pronounced shadow to show the "lift" */
    box-shadow: 10px 15px 25px rgba(0, 0, 0, 0.6);

    /* Makes the image slightly brighter on hover */
    filter: brightness(1.1);
}


.modal {
    display: none;
    position: fixed;
    z-index: 10;
    /* Placed above all other content */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    /* Slightly darker backdrop */
    /* Add a subtle fade-in for the modal backdrop */
    animation: fadeInModal 0.5s ease;
}

.modal-content {
    /* Replaced flat color with a radial gradient */
    background: radial-gradient(circle, #025a38, #013220);
    color: #ffd700;

    /* --- MODIFIED TO FILL SCREEN --- */
    margin: 2.5vh auto;
    /* Small 2.5% viewport-height margin top/bottom */
    padding: 20px;
    /* Reduced padding */
    width: 95vw;
    /* 95% of viewport width */
    height: 95vh;
    /* 95% of viewport height */
    max-width: none;
    /* REMOVED 600px cap */
    box-sizing: border-box;
    /* Makes padding part of the 95% size */

    /* --- NEW FLEXBOX PROPERTIES --- */
    /* This will let the iframe grow */
    display: flex;
    flex-direction: column;
    /* --- END MODIFICATION --- */

    border: 5px solid #d4af37;
    text-align: center;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
    z-index: 11;
    position: relative;
    animation: zoomIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#pdf-viewer {
    width: 100%;
    flex-grow: 1;
    border: none;
    border-radius: 5px;
    margin-top: 15px;
}

.close {
    color: #ffd700;
    float: right;
    font-size: 32px;
    /* Larger */
    font-weight: bold;
    line-height: 1;
    transition: color 0.3s ease, transform 0.3s ease;
    /* Added transform */
}

.close:hover,
.close:focus {
    color: #f8f8f2;
    /* Brighter hover */
    transform: scale(1.1);
    /* Slight zoom on hover */
    cursor: pointer;
}

#image {
    max-width: 100%;
    height: auto;
    /* Ensure aspect ratio is maintained */
    border-radius: 10px;
    border: 5px solid #ffd700;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 15px;
    /* Added for spacing */
}

#text {
    margin-top: 15px;
    font-size: 1.2rem;
    color: #f8f8f2;
    /* Switched to off-white for easier reading */
    font-family: 'Merriweather', serif;
    line-height: 1.7;

    /* More line spacing */
}

/* --- Snowflake Animation --- */
/* Added z-index and varied sizes/speeds/opacities for realism */
@keyframes snow {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.snowflake {
    position: fixed;
    top: -10px;
    font-size: 1.5rem;
    color: white;
    animation: snow 10s linear infinite;
    pointer-events: none;
    opacity: 0.8;
    z-index: 2;
    /* Above base content, below modal */
}

/* Added many variations for a more natural snow storm */
.snowflake:nth-child(3n) {
    animation-duration: 15s;
    animation-delay: -3s;
    font-size: 1.2rem;
    opacity: 0.6;
}

.snowflake:nth-child(3n + 1) {
    animation-duration: 10s;
    animation-delay: -7s;
    font-size: 1rem;
    opacity: 0.7;
}

.snowflake:nth-child(5n) {
    animation-duration: 18s;
    animation-delay: -10s;
    font-size: 2rem;
    opacity: 0.9;
}

.snowflake:nth-child(7n) {
    animation-duration: 12s;
    animation-delay: -5s;
    font-size: 1.7rem;
    opacity: 0.8;
}


/* --- Snow Pile (at bottom) --- */
/* Set z-index to 0 to be behind everything */
/* Added a white glow to look more like a snow drift */
.snow {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background-color: white;
    z-index: 0;
    /* Behind all content */
    transition: height 0.1s linear;
    /* Added a "glow" to the snow pile */
    box-shadow: 0 -10px 20px 5px rgba(255, 255, 255, 0.4);
}

@keyframes fadeInGlow {
    from {
        opacity: 0;
        /* Start with no glow */
        text-shadow:
            0 0 0px rgba(255, 255, 255, 0),
            0 0 0px rgba(255, 215, 0, 0),
            0 0 0px rgba(204, 153, 0, 0);
        color: rgba(240, 230, 140, 0);
        /* Fade in the color as well */
    }

    to {
        opacity: 1;
        /* End at the full old-school fairy light glow */
        text-shadow:
            0 0 3px #fdfd96,
            0 0 7px #ffd700,
            0 0 12px #cc9900;
        color: #f0e68c;
    }
}


/* --- NEW Flicker Burst Animation --- */
/* This is stable for 4.5s, then flickers fast for 0.5s */
@keyframes flickerBurst {

    /* Stable "On" state for 90% of the time (4.5s) */
    0%,
    90% {
        color: #f0e68c;
        text-shadow:
            0 0 3px #fdfd96,
            0 0 7px #ffd700,
            0 0 12px #cc9900;
    }

    /* --- Fast flicker burst in the last 0.5s --- */
    92%,
    96% {
        /* "Dim" flicker state */
        color: #e0d080;
        text-shadow:
            0 0 2px #fdfd96,
            0 0 5px #ffd700,
            0 0 9px #cc9900;
    }

    94%,
    98%,
    100% {
        /* "Bright" flicker state (back to normal) */
        color: #f0e68c;
        text-shadow:
            0 0 3px #fdfd96,
            0 0 7px #ffd700,
            0 0 12px #cc9900;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}