/* Magazine / Minimal Modernist Theme (Clean Grid) */

/* Self-Hosted Fonts */
@font-face {
    font-family: 'Bodoni Moda';
    src: url('fonts/BodoniModa-VariableFont_opsz,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Work Sans';
    src: url('fonts/WorkSans-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* Themable Variables */
:root {
    --bg-color: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    --text-color: #000000;
    --text-on-bar: #000000;
    
    --link-color: #000000;
    --link-hover: #444444;
    
    --font-headline: 'Work Sans', sans-serif;
    --font-body: 'Bodoni Moda', serif;
    
    --border-color: #000000;
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --sidebar-bg: #000000;
        --text-color: #FFFFFF;
        --text-on-bar: #FFFFFF;
        --link-color: #FFFFFF;
        --link-hover: #CCCCCC;
        --border-color: #FFFFFF;
    }
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
}

/* Sidebar */
.info-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 450px;
    height: 100vh;
    padding: 60px 40px; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 100;
    background-color: var(--sidebar-bg);
    color: var(--text-on-bar);
    overflow-y: auto;
}

/* Master Container: CSS Grid Mosaic */
.magazine-container {
    margin-left: 450px;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0; /* Full Bleed */
    box-sizing: border-box;
    
    /* THE GRID */
    display: grid;
    /* 4 rows, each 25% height */
    grid-template-rows: repeat(4, 25vh); 
    /* Columns populate automatically */
    grid-auto-flow: column dense; 
    /* Fine-grained columns: 5vh unit */
    grid-auto-columns: 5vh; 
    
    background-color: var(--bg-color);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
}

/* Row Spans */
.span-row-1 { grid-row: span 1; }
.span-row-2 { grid-row: span 2; }
.span-row-3 { grid-row: span 3; }
.span-row-4 { grid-row: span 4; }

/* Column Spans (1-30) */
.span-col-1 { grid-column: span 1; }
.span-col-2 { grid-column: span 2; }
.span-col-3 { grid-column: span 3; }
.span-col-4 { grid-column: span 4; }
.span-col-5 { grid-column: span 5; }
.span-col-6 { grid-column: span 6; }
.span-col-7 { grid-column: span 7; }
.span-col-8 { grid-column: span 8; }
.span-col-9 { grid-column: span 9; }
.span-col-10 { grid-column: span 10; }
.span-col-11 { grid-column: span 11; }
.span-col-12 { grid-column: span 12; }
.span-col-13 { grid-column: span 13; }
.span-col-14 { grid-column: span 14; }
.span-col-15 { grid-column: span 15; }
.span-col-16 { grid-column: span 16; }
.span-col-17 { grid-column: span 17; }
.span-col-18 { grid-column: span 18; }
.span-col-19 { grid-column: span 19; }
.span-col-20 { grid-column: span 20; }
.span-col-21 { grid-column: span 21; }
.span-col-22 { grid-column: span 22; }
.span-col-23 { grid-column: span 23; }
.span-col-24 { grid-column: span 24; }
.span-col-25 { grid-column: span 25; }
.span-col-26 { grid-column: span 26; }
.span-col-27 { grid-column: span 27; }
.span-col-28 { grid-column: span 28; }
.span-col-29 { grid-column: span 29; }
.span-col-30 { grid-column: span 30; }

/* Filler Items */
.mag-item.is-filler {
    background-color: var(--bg-color);
    pointer-events: none;
    /* Keep borders to maintain grid structure */
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* Items in the grid */
.mag-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background-color: transparent;
    padding: 0;
    
    /* Borders for grid lines */
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}

.mag-item img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.mag-item:hover img {
    transform: scale(0.96);
}

/* Lead Image Pop-out */
.mag-item.is-lead {
    margin-right: -30px; 
    margin-bottom: -30px; 
    z-index: 10; 
    border: none; 
    overflow: visible !important; 
}

.mag-item.is-lead img {
    border: 10px solid var(--bg-color); 
    box-shadow: 10px 10px 30px rgba(0,0,0,0.2);
}

/* Typography */
.title-card h1 {
    font-family: var(--font-headline);
    font-weight: 900; 
    font-size: 3em; 
    line-height: 0.95;
    margin: 0 0 30px 0;
    text-transform: uppercase;
    color: var(--text-on-bar);
    letter-spacing: -1px;
    display: block;
    max-width: min-content;
    word-wrap: break-word;
}

.title-card p.subtitle { display: none; }

.social-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.social-links a {
    font-family: var(--font-body);
    font-weight: 400; 
    font-size: 1.1em;
    text-transform: lowercase;
    text-decoration: none;
    color: var(--link-color);
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
}

.social-links a:hover { opacity: 0.5; text-decoration: underline; }

.scroll-hint {
    margin-top: 60px;
    font-family: var(--font-headline);
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    opacity: 0.4;
}

/* Lightbox */
#lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    justify-content: center;
    align-items: center;
}

#lightbox-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

#lightbox-img-pane {
    flex: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 60px;
    position: relative;
}

#lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#lightbox-text-pane {
    width: 0;
    overflow: hidden;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.4s ease;
}

#lightbox-container.has-post #lightbox-text-pane {
    flex: 1;
    width: 450px;
    padding: 80px 60px;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
}

.close-btn {
    position: absolute;
    top: 40px;
    right: 40px;
    font-family: var(--font-headline);
    font-weight: 900;
    font-size: 1.5em;
    color: var(--text-color);
    cursor: pointer;
    z-index: 1050;
    background: transparent;
    border: none;
    text-transform: uppercase;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 3em;
    cursor: pointer;
    z-index: 1060;
    padding: 20px;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    user-select: none;
}

.nav-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.nav-btn.prev { left: 20px; }
.nav-btn.next { right: 20px; }

#lightbox-post {
    font-family: var(--font-body);
    font-size: 1.4em;
    line-height: 1.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    html,
    body {
        overflow-y: auto !important;
        height: auto !important;
        overflow-x: hidden;
    }

    .info-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 40px 30px;
        margin-bottom: 0;
        justify-content: flex-start;
    }
    
    .title-card h1 {
        font-size: 2.5em; 
        margin-bottom: 20px;
        max-width: none; 
    }
    
    .magazine-container {
        margin-left: 0;
        height: auto !important;
        display: block;
        overflow-x: hidden;
        overflow-y: visible !important;
        padding: 10px 5px; 
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    /* Reset Grid for Mobile */
    .mag-item {
        width: 50%; 
        height: auto;
        float: left;
        margin: 0;
        padding: 5px;
        border: none;
        
        grid-column: auto !important;
        grid-row: auto !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
        z-index: 1 !important;
    }
    
    .mag-item img {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        box-shadow: none !important;
        border: none;
    }

    #lightbox-container { flex-direction: column; overflow-y: auto; }
    #lightbox-img-pane { flex: none; height: 50vh; padding: 20px; }
    #lightbox-container.has-post #lightbox-text-pane {
        flex: none; width: 100%; padding: 40px 20px 100px 20px;
        border-left: none; border-top: 1px solid var(--border-color);
    }
    
    .close-btn { top: 20px; right: 20px; font-size: 1.2em; }
    .nav-btn { display: none; }
}