/*
Theme Name: Sidebar Posts Theme
Description: A native-app style theme with HTMX pane swapping and manual load more pagination.
Author: You
Version: 13.0
*/

:root {
    --bg-color: #0A1720;
    --text-color: #ffffff;
    --accent-red: #FF3333; 
    --accent-teal: rgba(17, 94, 89, 0.75); 
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Links & Typography */
a { color: var(--accent-red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { color: var(--text-color); font-weight: bold; text-transform: capitalize; }

/* Standard Containers */
.container-narrow { max-width: 800px; margin: 0 auto; padding: 10px 20px 40px; }
.container-wide { width: 100%; padding: 40px; box-sizing: border-box; max-width: 1400px; margin: 0 auto; }
.centered-title { text-align: center; margin-top: 0; margin-bottom: 20px; }
.centered-title::after { content: ""; display: block; width: 60px; height: 4px; background-color: var(--accent-red); margin: 15px auto 0; }

/* SEO Homepage Header */
.home-seo-header { text-align: center; padding: 40px 20px; background: #0f2231; border-radius: 8px; margin-bottom: 30px; }
.home-seo-header h1 { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 0; font-size: 2rem; }
.home-seo-header .inline-icon { max-height: 40px; width: auto; border-radius: 4px; }
.home-seo-header p { margin: 0; font-size: 1.1rem; color: #a0aec0; }

/* Base Post Cards (Homepage & General) */
.card-item { background: #0f2231; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.card-item img { 
    width: 100%; 
    height: auto; 
    aspect-ratio: 4/3; 
    object-fit: cover; 
    display: block; 
    transform: scale(1.05); 
    transition: transform 0.3s ease;
}
.card-item:hover img { transform: scale(1.1); }
.card-content { padding: 15px; }
.card-content h2 { margin: 0; font-size: 1.1rem; }
.card-content h2 a { color: var(--text-color); }

/* Homepage Grid Layout */
.main-grid { display: grid; gap: 20px; grid-template-columns: repeat(2, 1fr); margin-bottom: 40px;}
@media (min-width: 1024px) { .main-grid { grid-template-columns: repeat(3, 1fr); } }

/* Traditional WP Pagination for Homepage */
.pagination-container { text-align: center; margin-bottom: 40px; }
.pagination-container .nav-links { display: flex; justify-content: center; gap: 10px; }
.pagination-container a, .pagination-container span { padding: 10px 15px; background: #0f2231; border-radius: 4px; color: var(--text-color); text-decoration: none; font-weight: bold; }
.pagination-container .current { background: var(--accent-red); }

/* Sidebar Load More Button */
.load-more-container { text-align: center; margin-top: 20px; grid-column: 1 / -1; }
.load-more-btn {
    background: #0f2231;
    color: var(--text-color);
    border: 1px solid #1a364d;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}
.load-more-btn:hover { background: var(--accent-red); border-color: var(--accent-red); }

/* ==================================== */
/* Sidebar Header & Menu Elements       */
/* ==================================== */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-color);
    border-bottom: 1px solid #1a364d;
    flex-shrink: 0; 
    z-index: 10;
}
.site-branding { display: flex; align-items: center; gap: 12px; }
.site-branding img, .site-icon { max-height: 32px; width: auto; border-radius: 4px; }
.site-title { margin: 0; font-size: 1.2rem; }
.site-title a { color: var(--text-color); text-decoration: none; }

.menu-toggle { background: transparent; border: none; cursor: pointer; padding: 5px; }
.hamburger { display: block; width: 22px; height: 2px; background-color: var(--text-color); position: relative; }
.hamburger::before, .hamburger::after { content: ''; position: absolute; left: 0; width: 100%; height: 2px; background-color: var(--text-color); }
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

.main-navigation { 
    display: none; 
    background: #0d1e2b; 
    padding: 15px 20px; 
    border-bottom: 1px solid #1a364d; 
    flex-shrink: 0; 
    z-index: 9;
}
.main-navigation.is-open { display: block; }
.main-navigation ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.main-navigation a { color: var(--text-color); font-weight: bold; text-decoration: none; }
.main-navigation a:hover { color: var(--accent-red); }

/* ==================================== */
/* Unified Footer Escape Hatch          */
/* ==================================== */
.site-footer {
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid #1a364d;
    margin-top: 20px;
}
.footer-home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.5rem; 
    font-weight: bold;
    color: var(--text-color);
    text-decoration: none;
}
.footer-home-link img { height: 35px; width: auto; border-radius: 4px; }
.footer-home-link:hover { color: var(--accent-red); text-decoration: none; }

/* ==================================== */
/* Desktop: Dual-Pane SPA Architecture */
/* ==================================== */
@media (min-width: 1024px) {
    body.single { overflow: hidden; height: 100vh; }
    
    .split-layout { display: flex; align-items: flex-start; height: 100vh; max-width: 1800px; margin: 0 auto; }
    
    /* Accounts for the desktop WordPress Admin Bar */
    body.admin-bar .split-layout { height: calc(100vh - 32px); }
    
    .sidebar-slide-toggle { display: none; }
    
    .left-sidebar {
        display: flex;
        flex-direction: column;
        width: 400px;
        flex-shrink: 0;
        height: 100%; 
        border-right: 1px solid #1a364d;
        box-sizing: border-box;
        position: relative;
    }
    
    .sidebar-scroll-area { flex-grow: 1; overflow-y: auto; padding: 20px; box-sizing: border-box; }
    
    /* Purely visual Pinterest-style grid for Sidebar */
    .sidebar-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .sidebar-card { border-radius: 8px; background: transparent; }
    .sidebar-card a { display: block; overflow: hidden; border-radius: 8px; }
    .sidebar-card img { aspect-ratio: 1/1; } /* Bold, perfectly square images */

    .right-content { flex-grow: 1; height: 100%; overflow-y: auto; padding: 0; box-sizing: border-box; }
    #post-content-area { min-height: 100%; display: flex; flex-direction: column; justify-content: space-between; }

    .sidebar-scroll-area::-webkit-scrollbar, .right-content::-webkit-scrollbar { width: 8px; }
    .sidebar-scroll-area::-webkit-scrollbar-track, .right-content::-webkit-scrollbar-track { background: var(--bg-color); }
    .sidebar-scroll-area::-webkit-scrollbar-thumb, .right-content::-webkit-scrollbar-thumb { background: #1a364d; border-radius: 4px; }
}

/* ==================================== */
/* Mobile Adjustments & Slide-Out       */
/* ==================================== */
@media (max-width: 1023px) {
    
    .container-wide { padding: 15px; }
    .container-narrow { padding: 10px 15px 30px; }
    .home-seo-header { padding: 25px 15px; margin-bottom: 20px; }
    .main-grid { gap: 15px; }
    .card-content { padding: 12px; }
    
    .split-layout { display: block; }
    .right-content { width: 100%; }
    
    .left-sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: -280px; 
        width: 280px; 
        height: 100vh;
        background: var(--bg-color);
        z-index: 9999;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid #1a364d;
        box-shadow: 10px 0 15px rgba(0,0,0,0.5);
    }
    
    .left-sidebar.is-open { transform: translateX(280px); }
    
    .sidebar-scroll-area { flex-grow: 1; overflow-y: auto; padding: 15px; box-sizing: border-box; }
    
    /* Purely visual Pinterest-style grid for Sidebar (Mobile) */
    .sidebar-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .sidebar-card { border-radius: 8px; background: transparent; }
    .sidebar-card a { display: block; overflow: hidden; border-radius: 8px; }
    .sidebar-card img { aspect-ratio: 1/1; } /* Bold, perfectly square images */
    
    /* Vertically Centered Glass Chevron Button */
    .sidebar-slide-toggle {
        display: flex;
        position: absolute;
        right: -40px; 
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 60px; 
        background: rgba(10, 23, 32, 0.65); 
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(255,255,255,0.08);
        border-left: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border-radius: 0 8px 8px 0;
        box-shadow: 4px 0 10px rgba(0,0,0,0.25);
        z-index: 10000;
        padding-right: 5px; 
    }
    
    /* CSS Chevron Graphic */
    .chevron {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-right: 2px solid #ffffff;
        border-bottom: 2px solid #ffffff;
        transform: rotate(-45deg); 
        transition: transform 0.3s ease;
    }
    
    /* Rotates the chevron left when drawer is open */
    .left-sidebar.is-open .chevron { transform: rotate(135deg); }
}