/* ==========================================
   layout.css - Layout & Grid Styles
   ========================================== */

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Header Layout */
.site-header {
    border-bottom: 8px double var(--border-dark);
    padding: var(--space-lg) 0 var(--space-md);
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
}

.header-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
    text-align: center;
}

/* Edition Info Bar - DATE ON RIGHT FIX */
.edition-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: calc(var(--text-xs) * 1.03); /* 3% larger */
    margin-bottom: var(--space-sm);
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-light);
    opacity: 1; /* Changed from 0.7 to allow full color control */
    position: relative;
}

/* Theme toggle on left */
.theme-toggle {
    flex: 0 0 auto;
    color: #2a2a2a !important; /* Darker in light mode */
    font-size: calc(var(--text-xs) * 1.03) !important; /* 3% larger */
}

/* Date on right */
.edition-date {
    flex: 0 0 auto;
    margin-left: auto;
    color: #2a2a2a !important; /* Darker in light mode */
    font-size: calc(var(--text-xs) * 1.03) !important; /* 3% larger */
    cursor: pointer !important;
    transition: color 0.3s ease !important;
}

.edition-date:hover {
    color: #00ff88 !important; /* Matrix green on hover */
}

body.dark-mode .theme-toggle {
    color: #d0d0d0 !important; /* Lighter in dark mode */
}

body.dark-mode .edition-date {
    color: #d0d0d0 !important; /* Lighter in dark mode */
}

body.dark-mode .edition-date:hover {
    color: #00ff88 !important;
}

/* Masthead */
.masthead {
    text-align: center;
    padding: var(--space-md) 0;
}

/* Navigation Layout */
.main-nav {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 2px solid var(--border-dark);
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

/* Filter Section Layout */
.filter-section {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-dark);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(10px);
}

.filter-controls {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
    margin-top: var(--space-sm);
}

/* Main Content Layout */
.main-content {
    padding: var(--space-xl) 0;
    min-height: 60vh;
}

/* Project Grid - Swiss Grid System */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--grid-gap);
    margin-top: var(--space-lg);
}

/* Single Column Layout for narrow screens */
@media (max-width: 640px) {
    .project-grid {
        grid-template-columns: 1fr;
    }
}

/* Two Column Layout for tablets */
@media (min-width: 641px) and (max-width: 1024px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Three Column Layout for desktop */
@media (min-width: 1025px) {
    .project-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Four Column Layout for wide screens */
@media (min-width: 1440px) {
    .project-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Footer Layout */
.site-footer {
    background: var(--ink-black);
    color: var(--paper-white);
    padding: var(--space-lg) 0;
    margin-top: var(--space-xl);
    border-top: 8px double var(--border-dark);
}

.footer-content {
    text-align: center;
}

.footer-divider {
    width: 60px;
    height: 2px;
    background: var(--paper-white);
    margin: var(--space-sm) auto;
    opacity: 0.5;
}

/* Responsive Layout Adjustments */
@media (max-width: 768px) {
    .nav-menu {
        gap: var(--space-sm);
    }
    
    .filter-controls {
        gap: var(--space-xs);
    }
    
    .edition-info {
        font-size: 0.65rem;
    }
    
    .container {
        padding: 0 var(--space-sm);
    }
}

/* Print Layout */
@media print {
    .filter-section,
    .theme-toggle,
    .lightbox {
        display: none !important;
    }
    
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .site-header {
        background: white;
        border-bottom: 2px solid black;
    }
    
    .site-footer {
        background: white;
        color: black;
        border-top: 2px solid black;
    }
}

/* Dark Mode Layout Adjustments */
body.dark-mode .site-header {
    background: linear-gradient(180deg, var(--ink-black) 0%, var(--newsprint-gray) 100%);
}

body.dark-mode .filter-section {
    background: var(--newsprint-gray);
}

body.dark-mode .site-footer {
    background: var(--paper-white);
    color: var(--ink-black);
}