/* --- Color Palette --- */
:root {
    /* Richer Blue Palette (Preserved) */
    --color-black: #0a0a0a;             /* Deepest Black for background */
    --color-dark-gray: #1e1e1e;         /* Dark Gray for containers */
    --color-darker-blue: #0f1624;       /* Darker Blue for footer */
    --color-dark-blue: #141c2c;         /* Dark Navy Blue for accents/footer */
    --color-text-light: #f0f0f0;        /* Near White for main text */
    --color-accent: #3a7bd5;            /* BRIGHTER, RICHER Blue for links/highlights */
    --color-text-header: #5f86b7;       /* Subtler Blue for header text/glow - MATCHES NEW ACCENT */
    --color-accent-dark: #1e5799;       /* Darker accent for hover/buttons - DARKER BLUE */
}

/* Basic Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    color: var(--color-text-light); 
    background-color: var(--color-black); 
    overflow-x: hidden; 
}

/* Reusable container for layout centering */
.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
    overflow: hidden;
}

/* --- Navigation Bar Styling (Main & Overlay) --- */
#navbar,
.overlay-navbar {
    background-color: var(--color-dark-gray); 
    padding: 20px 0; 
    width: 100%;
    z-index: 10; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); 
}

/* Main Navbar is positioned absolutely */
#navbar {
    position: absolute;
    top: 0;
}

/* Overlay Navbar is positioned absolutely within the overlay */
.overlay-navbar {
    position: sticky; 
    top: 0;
    z-index: 99; 
}

#navbar .container,
.overlay-navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#navbar .logo,
.overlay-navbar .logo {
    font-size: 1.8em; 
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--color-text-light); 
}

#navbar ul,
.overlay-navbar ul {
    list-style: none;
    display: flex;
}

#navbar ul li,
.overlay-navbar ul li {
    margin-left: 30px; 
}

#navbar ul li a,
.overlay-navbar ul li a {
    color: var(--color-text-light);
    text-decoration: none;
    font-weight: 400;
    padding: 5px 0;
    opacity: 0.8;
    transition: all 0.3s;
}

#navbar ul li a:hover,
#navbar ul li a.active,
.overlay-navbar ul li a:hover,
.overlay-navbar ul li a.active {
    opacity: 1;
    color: var(--color-accent); 
    border-bottom: 2px solid var(--color-accent);
}


/* --- Main Landing Section (Header) --- */
.main-header {
    background: linear-gradient(145deg, var(--color-black) 0%, var(--color-dark-gray) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center; 
    justify-content: center; 
    text-align: center;
    
    /* CRITICAL FIX 1: Ensure margin is absolutely zero to prevent pull-up */
    margin-bottom: 0 !important; 
    
    /* CRITICAL FIX 2: Increased padding to create a large gap before next element */
    padding-bottom: 150px; 
    
    /* NEW: Add padding to accommodate fixed navbar on top */
    padding-top: 80px; 
}

.header-content {
    background: var(--color-dark-blue);
    padding: 40px 60px;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6); 
    max-width: 800px;
    border: 1px solid var(--color-dark-gray); 
}

.header-content h1 {
    font-size: 4.5em; 
    font-weight: 900; 
    margin-bottom: 0.1em;
    letter-spacing: -2px;
    text-transform: uppercase;
    
    color: var(--color-text-header); 
    text-shadow: 0 0 5px rgba(95, 134, 183, 0.5); 
}

.header-content p {
    font-size: 1.3em;
    font-weight: 300; 
    opacity: 0.9;
    padding-top: 15px;
    border-top: 1px solid var(--color-dark-gray); 
    margin-top: 20px;
}

/* --- Added style for the section FOLLOWING the header (e.g., Projects) --- */
/* This is a safeguard to ensure a clear space above the content */
.project-section, 
main {
    padding-top: 50px;
}


/* --- Links Overlay Styling (no change) --- */
.overlay {
    display: none; 
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, var(--color-black) 0%, var(--color-dark-gray) 100%);
    z-index: 100; 
    
    display: flex;
    flex-direction: column;
    justify-content: flex-start; 
    overflow-y: auto; 
}

.overlay-content {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    padding: 100px 20px; 
    text-align: center;
}

.overlay-content h2 {
    font-size: 4em;
    font-weight: 300;
    margin-bottom: 30px;
}

/* --- Styling for the Discord Button on the Links Page (no change) --- */
.btn-discord {
    display: inline-block;
    background-color: var(--color-accent-dark); 
    color: var(--color-text-light); 
    padding: 15px 30px;
    margin: 20px 0;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 5px 15px rgba(30, 87, 153, 0.5); 
}

.btn-discord:hover {
    background-color: var(--color-accent); 
    transform: translateY(-2px);
}

/* --- Footer Styling (Main & Overlay - minor change to undefined color) --- */
#footer,
.overlay-footer {
    background-color: var(--color-darker-blue);
    color: var(--color-text-light);
    padding: 30px 0;
    border-top: 2px solid var(--color-dark-gray);
    font-size: 0.9em;
    width: 100%; 
    flex-shrink: 0; 
}

#footer .container,
.overlay-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
}

.copyright {
    opacity: 0.6;
    margin: 10px 0;
}

.footer-nav a {
    color: var(--color-accent); 
    text-decoration: none;
    margin-left: 25px;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-nav a.active {
    color: var(--color-text-light);
}

.footer-nav a:hover {
    opacity: 1;
    text-decoration: underline;
    /* Corrected undefined color variable */
    color: var(--color-text-light); 
}

/* --- Media Queries (Responsiveness) --- */
@media (max-width: 768px) {
    /* Navbar adjustments for better mobile stacking */
    #navbar .container,
    .overlay-navbar .container {
        flex-direction: column;
        text-align: center;
    }
    #navbar ul,
    .overlay-navbar ul {
        margin-top: 15px;
    }
    #navbar ul li,
    .overlay-navbar ul li {
        margin: 0 15px;
    }

    /* CRITICAL FIXES FOR HEADER SCALING (Guaranteed Separation) */
    .main-header {
        /* Allow height to be determined by content, not fixed viewport height */
        min-height: auto; 
        
        /* Set a generous padding for breathing room around the header content */
        padding-top: 100px; 
        
        /* Increased mobile padding for guaranteed separation */
        padding-bottom: 100px; 
        
        /* Force margin to zero */
        margin-bottom: 0 !important; 
        
        /* Align content back to center for visual balance */
        align-items: center;
    }

    .header-content {
        /* Scale down the container on mobile */
        padding: 25px 30px; 
        width: 95%; 
        /* Ensure content is positioned relative to the top of the header */
        margin-top: 0; 
    }

    .header-content h1 {
        font-size: 2.8em; 
        letter-spacing: 0;
    }
    .header-content p {
        font-size: 1.1em; 
    }
    
    /* Footer and Overlay adjustments (kept) */
    #footer .container,
    .overlay-footer .container {
        flex-direction: column;
        text-align: center;
    }
    .footer-nav {
        margin-top: 15px;
    }
    .footer-nav a {
        display: block;
        margin: 5px 0;
    }
    .overlay-content {
        padding-top: 150px; 
    }
}
