/* Design System & Custom Properties */
:root {
    --bg-color: #030101;
    --text-primary: #f2ebd9; /* Cloud white/cream */
    --text-light: #ffffff;
    --accent-red: #e62222; /* Demoniac Gothic red */
    --accent-gold: hsla(43, 74%, 49%, 0.9);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Custom Background Image Container */
.background-image-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('Static/Foto/lucifer_rooftop.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    /* Guy and foreground remain perfectly visible during dark phases */
    filter: brightness(0.55) contrast(1.05) saturate(0.95); 
    transition: filter 0.4s cubic-bezier(0.15, 0.85, 0.35, 1);
}

/* Soft Sheet Lightning Illumination States (reduced contrast/brightness jump) */
body.lightning-flash-1 .background-image-container {
    filter: brightness(0.68) contrast(1.1) saturate(1.05);
    transition: none;
}

body.lightning-flash-2 .background-image-container {
    filter: brightness(0.85) contrast(1.15) saturate(1.15);
    transition: none;
}

/* Permanent Illumination End State */
body.lightning-lit .background-image-container {
    filter: brightness(0.9) contrast(1.1) saturate(1.1);
    transition: filter 4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Majestic 4-second fade into permanent light */
}

/* Soft Lightning Overlay for blending */
.lightning-flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #ffffff;
    opacity: 0;
    mix-blend-mode: overlay;
    z-index: 99;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.15, 0.85, 0.35, 1);
}

body.lightning-flash-1 .lightning-flash-overlay {
    opacity: 0.08; /* Very subtle flash */
    transition: none;
}

body.lightning-flash-2 .lightning-flash-overlay {
    opacity: 0.22; /* Soft peak glare */
    transition: none;
}

/* Ambient glow and texture overlays */
.radial-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 25% 30%, transparent 20%, rgba(3, 1, 1, 0.4) 80%);
    z-index: 0;
    pointer-events: none;
}

.stars-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px);
    background-size: 550px 550px, 350px 350px;
    background-position: 0 0, 40px 60px;
    opacity: 0.02;
    z-index: 0;
    pointer-events: none;
}

/* Container */
.container {
    width: 100%;
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

/* Horizontal Quote Sky Container */
.sky-text-container {
    position: fixed;
    top: 8%; /* Shifted higher up */
    left: 6%; /* Shifted all the way to the left */
    width: 50%; /* Constrains text width to prevent overlapping the guy on the right */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    z-index: 20;
    pointer-events: none;
}

/* Active Italian Sentence: Imprinted in the clouds */
.sentence-display {
    font-family: 'Pirata One', serif;
    font-size: clamp(1.15rem, 2.0vw, 1.7rem); /* Compact and highly readable */
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    opacity: 0;
    filter: blur(5px);
    line-height: 1.4;
    text-align: left;
    /* Soft cloud-like mist shadow to highlight against the sky */
    text-shadow: 
        0 0 12px rgba(255, 255, 255, 0.4),
        0 0 25px rgba(255, 255, 255, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.85);
    transition: opacity 1.8s cubic-bezier(0.25, 0.8, 0.25, 1), filter 1.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Fast reveal animation state */
.sentence-display.active {
    opacity: 1;
    filter: blur(0);
    transition: opacity 0.15s ease-out, filter 0.15s ease-out; /* Fast peak flash appearance */
}

/* Slow dissolve "energy fade-out" state (doubled to 3.6s) */
.sentence-display.fade-out {
    opacity: 0;
    filter: blur(8px);
    transition: opacity 3.6s cubic-bezier(0.25, 0.8, 0.25, 1), filter 3.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Fast fade-out state used specifically for transition swap */
.sentence-display.fade-out-fast {
    opacity: 0;
    filter: blur(4px);
    transition: opacity 0.6s ease-out, filter 0.6s ease-out;
}

/* Transition to red & large on the last sentence with heavy gothic font */
.sentence-display.final-transform {
    font-family: 'UnifrakturMaguntia', serif; /* Switch to heavy, highly distinct gothic font */
    color: var(--accent-red) !important;
    font-size: clamp(1.6rem, 3.2vw, 2.8rem) !important;
    /* Red demonic glow shadow */
    text-shadow: 
        0 0 15px rgba(230, 34, 34, 0.6),
        0 0 30px rgba(230, 34, 34, 0.3),
        0 3px 6px rgba(0, 0, 0, 0.95) !important;
    transition: 
        color 2.5s cubic-bezier(0.25, 0.8, 0.25, 1), 
        font-size 2.5s cubic-bezier(0.25, 0.8, 0.25, 1), 
        text-shadow 2.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Author signature styling (revealed under the final quote) */
.author-display {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
    font-family: 'UnifrakturMaguntia', serif;
    font-size: clamp(0.85rem, 1.5vw, 1.2rem);
    color: var(--text-light);
    letter-spacing: 0.05em;
    margin-top: 0.8rem;
    text-align: left;
    /* Soft white ambient shadow */
    text-shadow: 
        0 0 8px rgba(255, 255, 255, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.95);
    transition: opacity 3s cubic-bezier(0.25, 0.8, 0.25, 1), transform 3s cubic-bezier(0.25, 0.8, 0.25, 1), filter 3s ease;
}

.author-display.revealed {
    opacity: 0.85;
    transform: translateY(0);
    filter: blur(0);
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 1024px) {
    .background-image-container {
        background-position: 55% center; /* Slightly shifted rightwards as requested */
    }
    
    .sky-text-container {
        top: auto;
        bottom: 8%; /* Placed at the bottom on mobile to avoid covering the face */
        left: 5%;
        right: 5%;
        width: 90%;
        align-items: center;
        text-align: center;
    }
    
    .sentence-display {
        text-align: center;
    }
    
    .author-display {
        text-align: center;
    }
}

@media (max-width: 600px) {
    .sky-text-container {
        top: auto;
        bottom: 8%;
    }
    
    .sentence-display {
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.95);
    }
}

/* Accessibility: respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .background-image-container {
        filter: brightness(0.6) contrast(1.05) saturate(0.95) !important;
    }
    .sentence-display {
        display: none !important;
    }
    .author-display {
        opacity: 0.85 !important;
        transform: none !important;
        filter: none !important;
    }
}
