.site-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: transparent;
    position: relative;
    z-index: 10;
}

.site-header {
    background-color: var(--color-surface);
    border-bottom: var(--border-standard);
    padding: var(--spacing-sm) 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-secondary);
    font-weight: 700; /* Merriweather bold */
    font-size: 1.5rem;
    color: var(--color-primary);
    text-decoration: none;
}
.logo:hover,
.logo:focus {
    color: var(--color-secondary);
    text-decoration: none;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--spacing-lg);
}

.main-nav a {
    text-decoration: none;
    color: var(--color-text-secondary);
    padding: var(--spacing-sm) 0;
    position: relative;
}

.main-nav a:hover,
.main-nav a:focus,
.main-nav a.active { /* Add class for active page */
    color: var(--color-primary);
    font-weight: 700;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

.main-nav a:hover::after,
.main-nav a:focus::after,
.main-nav a.active::after {
    width: 100%;
}

/* Login/Logout links specific styling if needed */
#login-link,
#logout-link {
    cursor: pointer;
}

.site-content {
    flex-grow: 1;
    max-width: 1200px;
    width: 100%;
    margin: var(--spacing-xl) auto;
    padding: 0 var(--spacing-md);
}

.site-footer {
    background-color: var(--color-background-secondary);
    padding: 1.5rem var(--container-padding); /* Increased padding */
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-top: auto; 
    border-top: 1px solid var(--color-border-subtle); /* Added top border */
}

.site-footer .footer-content {
    max-width: var(--container-max-width, 1200px); /* Constrain content width */
    margin: 0 auto;
    /* Use Flexbox for layout */
    display: flex;
    justify-content: space-between; /* Space items out */
    align-items: center; /* Vertically align items */
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 1rem; /* Add gap between items when wrapped */
}

.site-footer p {
    margin: 0; /* Remove default margin for flex control */
    text-align: left; /* Align text left within flex items */
}

/* Ensure donate link is aligned right potentially on wrap */
.site-footer p.donate-link {
    text-align: right;
}

/* Center items when they wrap on small screens */
@media (max-width: 600px) {
    .site-footer .footer-content {
        justify-content: center; /* Center items when stacked */
    }
    .site-footer p,
    .site-footer p.donate-link {
        text-align: center; /* Center text when stacked */
        width: 100%; /* Take full width when stacked */
    }
}

.donate-link a {
    color: var(--color-link); /* Use theme link color */
    text-decoration: none;
}

.donate-link a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/* Ensure link is visible on dark background */
body.is-night .donate-link a {
    color: var(--color-link-on-dark, #aaa);
}
body.is-night .donate-link a:hover {
    color: var(--color-link-hover-on-dark, #fff);
}

/* Keep Footer Nav styles if needed elsewhere */
.footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: var(--spacing-lg);
}

.footer-nav a {
    color: var(--color-text-subtle);
}
.footer-nav a:hover,
.footer-nav a:focus {
    color: var(--color-secondary);
}

/* Responsive Layout */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    .main-nav ul {
        gap: var(--spacing-md);
        flex-wrap: wrap;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

.page-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: var(--border-standard);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Wrap on small screens */
    gap: var(--spacing-md);
}

.page-header h1 {
    margin-bottom: 0; /* Remove default margin */
}

/* Dynamic Backgrounds */
body {
    /* Default/Fallback background */
    background-color: #000;
    transition: background 0.5s ease-in-out; /* Smooth transition */
    position: relative; /* Needed for pseudo-elements */
    overflow-x: hidden; /* Prevent horizontal scroll from pseudo-elements */
}

/* Day Time Styles */
body.is-day {
    background: linear-gradient(to bottom, #87CEEB 0%, #f0f8ff 70%, #d0e0f0 100%); /* Sky Blue Gradient */
    color: var(--color-text-default, #333); /* Ensure default text is readable */
}

/* Simple Sun using ::before */
body.is-day::before {
    content: "";
    position: absolute;
    top: 10%;
    right: 15%;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #fff700 0%, #ffcc00 100%);
    border-radius: 50%;
    /* box-shadow: 0 0 30px 5px rgba(255, 255, 0, 0.5); */ /* Temporarily removed for CLS testing */
    z-index: -1; /* Ensure it's behind main content */
    transform: translateZ(0); /* Hint for hardware acceleration */
}

/* Night Time Styles */
body.is-night {
    background: linear-gradient(to bottom, #0d1a2f 0%, #2c3e50 50%, #1a2531 100%); /* Dark Blue/Gray Night Sky */
    color: var(--color-text-on-dark, #eee); /* Ensure default text is readable */
}

/* Simple Moon using ::before */
body.is-night::before {
    content: "";
    position: absolute;
    top: 15%;
    left: 20%;
    width: 60px;
    height: 60px;
    background-color: #f0f0d0; /* Pale yellow moon */
    border-radius: 50%;
    box-shadow: 0 0 20px 3px rgba(240, 240, 220, 0.3),
                /* Inner shadow for crescent effect */
                inset -15px 5px 0 0px rgba(0,0,0,0.1); 
    z-index: -1; /* Ensure it's behind main content */
    transform: translateZ(0); /* Hint for hardware acceleration */
}

/* Simple Clouds using ::after (works for both day/night) */
body::after {
    content: "";
    position: absolute;
    top: 20%;
    left: -50px; /* Start off screen */
    width: 200px;
    height: 60px;
    background: radial-gradient(circle, white 30%, transparent 70%);
    border-radius: 50%;
    opacity: 0.3;
    box-shadow: 
        /* Multiple blurred circles to form cloud shape */
        50px 0 0 0 white, 
        90px 10px 0 -10px white, 
        140px -5px 0 5px white, 
        180px 5px 0 0 white;
    filter: blur(5px);
    animation: driftClouds 60s linear infinite; /* Slow drift */
    z-index: -1; /* Ensure it's behind main content */
    transform: translateZ(0); /* Hint for hardware acceleration */
}

@keyframes driftClouds {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(100vw + 300px)); /* Drift across and off screen */
    }
}

/* Star Layer */
.star-layer {
    position: fixed; /* Fixed position to cover viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Make it non-interactive */
    z-index: 1;
    /* Restore default opacity */
    opacity: 0; 
    transition: opacity 1s ease-in-out; /* Restore transition */
    /* Remove box-shadow from main rule */
    /* box-shadow: ... stars ...; */
}

/* RESTORE this rule */
body.is-night .star-layer {
    opacity: 1; 
    /* Add box-shadow back here */
    box-shadow: 
        /* Tiny stars */
        5vw 10vh 0 0px rgba(255, 255, 255, 0.7),
        25vw 30vh 0 0px rgba(255, 255, 255, 0.6),
        80vw 50vh 0 0px rgba(255, 255, 255, 0.7),
        40vw 75vh 0 0px rgba(255, 255, 255, 0.5),
        90vw 20vh 0 0px rgba(255, 255, 255, 0.6),
        15vw 85vh 0 0px rgba(255, 255, 255, 0.7),
        /* Slightly larger/brighter stars */
        50vw 60vh 0 1px rgba(255, 255, 255, 0.9),
        70vw 15vh 0 1px rgba(255, 255, 255, 0.8),
        30vw 55vh 0 1px rgba(255, 255, 255, 0.9),
        10vw 40vh 0 1px rgba(255, 255, 255, 0.8),
        /* Simple Big Dipper Example */
        60vw 20vh 0 1px rgba(255, 255, 255, 0.9),
        63vw 23vh 0 1px rgba(255, 255, 255, 0.9),
        67vw 25vh 0 1px rgba(255, 255, 255, 0.9),
        70vw 24vh 0 1px rgba(255, 255, 255, 0.9),
        75vw 28vh 0 1px rgba(255, 255, 255, 0.9),
        78vw 33vh 0 1px rgba(255, 255, 255, 0.9),
        82vw 35vh 0 1px rgba(255, 255, 255, 0.9);
}

/* REMOVE test rule */
/* body.is-night .star-layer { ... } */

/* Remove or comment out this rule as z-index is now set directly */
/* Ensure clouds and moon/sun are above stars */
/* body::before, */ /* Sun/Moon */
/* body::after { */ /* Clouds */
/*    z-index: 2; */ /* Changed from -1 */
/* } */ 