:root {
    --primary-black: #0a0a0a;
    --secondary-black: #1a1a1a;
    --accent-grey: #4a4a4a;
    --text-color: #e0e0e0;
    --flicker-color: rgba(255, 200, 100, 0.4);
    --font-heading: 'Creepster', cursive;
    --font-body: 'Playfair Display', serif;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    /* overflow: hidden;  <-- Changed to allow scrolling */
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--primary-black);
    color: var(--text-color);
    font-family: var(--font-body);
    scroll-behavior: smooth;
}

.scene {
    position: relative;
    width: 100vw;
    height: 100vh;
    /* Takes up full viewport initially */
    min-height: 100vh;
    perspective: 1000px;
    background: radial-gradient(circle at center, transparent 30%, black 90%);
    /* Vignette base */
    z-index: 1;
    /* Ensure scene is above fixed bg */
}

/* Content Section below the fold */
.content-section {
    position: relative;
    z-index: 2;
    background: rgba(10, 10, 10, 0.95);
    /* Dark, slightly transparent background */
    min-height: 100vh;
    padding: 100px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 -50px 100px rgba(0, 0, 0, 1);
    /* Blend with scene above */
    margin-top: -5px;
    /* prevent gap */
}

.content-container {
    max-width: 800px;
    width: 100%;
    border: 1px solid #333;
    padding: 40px;
    background: rgba(0, 0, 0, 0.8);
    position: relative;
}

.content-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 1px solid #444;
    z-index: -1;
    opacity: 0.5;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: #e0e0e0;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.note-text {
    font-family: var(--font-body);
    font-size: 1.2rem;
    line-height: 1.8;
    color: #cccccc;
    margin-bottom: 20px;
    text-align: justify;
}

/* Main Scene Wrapper */
.scene-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* or flex-end to anchor bottom */
    /* background-color: #000; Removed to show graveyard-bg */
    overflow: hidden;
    z-index: 1;
}

/* Interactive Area: The container that holds the image and overlays */
.interactive-area {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    /* This ensures the div shrinks to fit the image inside it */
    display: flex;
    justify-content: center;
}

/* The scaled image */
.main-image {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Overlay adjustments for the new relative container */
.inscription-overlay {
    position: absolute;
    /* Coordinates are now relative to the IMAGE itself */
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    /* Percentage of image width */
    min-width: 200px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5vw;
    /* Responsive gap */
    z-index: 6;
}

.name {
    font-family: var(--font-heading);
    font-size: 3.5vw;
    /* Responsive font size based on viewport width (approximate, relative to container would be query container but vw is okay if image fills width) */
    /* Better: Use container query units if supported, or just %/vw assuming image is large */
    /* Let's try clamping or % of parent width if possible, but standard CSS often needs text scaling adjustments. 
       Using 'container-type' or just standard media queries is robust. 
       For simplicity, let's use a combination of REM and fluid units or just adjust based on assumption image takes up most of screen.
    */
    font-size: min(5vh, 5vw);
    /* Scale with viewport */
    line-height: 1.1;
    letter-spacing: 0.2em;
    color: #ffffff;
    /* Increased brightness from #d0d0d0 */
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.9),
        /* Glow */
        0 0 20px rgba(255, 255, 255, 0.7),
        /* Outer Glow */
        0 0 30px rgba(255, 255, 255, 0.5),
        /* Extra Outer Glow */
        0px 1px 1px rgba(255, 255, 255, 0.1),
        0px -1px 1px rgba(0, 0, 0, 0.8);
    opacity: 1;
    /* Increased opacity */
    mix-blend-mode: normal;
    /* Removed overlay to make it pop more */
    animation: name-glow-pulse 3s infinite alternate;
}

@keyframes name-glow-pulse {
    from {
        text-shadow:
            0 0 10px rgba(255, 255, 255, 0.8),
            0 0 20px rgba(255, 255, 255, 0.6),
            0 0 30px rgba(255, 255, 255, 0.4);
    }

    to {
        text-shadow:
            0 0 15px rgba(255, 255, 255, 1),
            0 0 25px rgba(255, 255, 255, 0.8),
            0 0 40px rgba(255, 255, 255, 0.6);
    }
}

.dob {
    font-size: min(2vh, 2vw);
    font-style: italic;
    color: #d0d0d0;
    /* Increased brightness */
    text-shadow:
        0 0 5px rgba(255, 255, 255, 0.5),
        /* Subtle glow */
        1px 1px 2px black;
    letter-spacing: 0.1em;
    opacity: 0.9;
}

/* Background Image */
.graveyard-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/background.png');
    /* User requested path */
    background-size: cover;
    background-position: center;
    z-index: 0;
    opacity: 0.4;
}

/* Hide unused classes */
.graves-container,
.grave,
.tombstone-wrapper,
.tombstone-img,
.crow-perched {
    display: none;
}

@keyframes crow-idle {

    0%,
    100% {
        transform: translateX(-50%) rotate(0deg);
    }

    50% {
        transform: translateX(-50%) rotate(2deg);
    }
}

.lamp-post {
    position: absolute;
    z-index: 4;
    width: 60px;
    /* Adjust based on asset */
}

.lamp-img {
    width: 100%;
    height: auto;
}

.lamp-light {
    position: absolute;
    top: 15%;
    /* Adjust to match lamp bulb position */
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--flicker-color) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.6;
    mix-blend-mode: screen;
}

.flickering {
    animation: flicker 3s infinite steps(10);
}

.delay-1 {
    animation-delay: 1.2s;
}

@keyframes flicker {

    0%,
    100% {
        opacity: 0.6;
        transform: translateX(-50%) scale(1);
    }

    5% {
        opacity: 0.2;
    }

    10% {
        opacity: 0.6;
    }

    15% {
        opacity: 0.1;
    }

    20% {
        opacity: 0.6;
    }

    25% {
        opacity: 0.7;
        transform: translateX(-50%) scale(1.1);
    }

    30% {
        opacity: 0.2;
    }

    35% {
        opacity: 0.6;
    }

    60% {
        opacity: 0.5;
    }

    70% {
        opacity: 0.1;
    }

    72% {
        opacity: 0.6;
    }

    80% {
        opacity: 0.5;
    }

    90% {
        opacity: 0.1;
    }
}

/* Menu Styles */
.menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to scene if needed */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.menu-item {
    pointer-events: auto;
    position: absolute;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-color);
}

.menu-item:hover {
    transform: scale(1.15) translateY(-10px);
    z-index: 11;
}

.coffin-icon {
    width: 60px;
    /* Adjust size */
    height: auto;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
    transition: filter 0.3s;
}

.menu-item:hover .coffin-icon {
    filter: drop-shadow(0 0 10px rgba(100, 100, 255, 0.3));
}

.menu-text {
    margin-top: 5px;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 5px;
    border-radius: 3px;
    pointer-events: none;
}

/* Positioning Menu Items around the screen */
.menu-pos-0 {
    top: 10%;
    left: 10%;
}

.menu-pos-1 {
    top: 10%;
    right: 10%;
}

.menu-pos-2 {
    bottom: 10%;
    left: 10%;
}

.menu-pos-3 {
    bottom: 10%;
    right: 10%;
}

.menu-pos-4 {
    top: 50%;
    left: 5%;
    transform: translateY(-50%);
}

.menu-pos-5 {
    top: 50%;
    right: 5%;
    transform: translateY(-50%);
}

/* Sound Toggle */
.sound-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #4a4a4a;
    color: #e0e0e0;
    font-size: 1.5rem;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
}

.sound-toggle:hover {
    background: rgba(50, 50, 50, 0.8);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}