@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Montserrat:wght@300;400;600&family=Dancing+Script:wght@700&display=swap');

/* ==========================================================================
   RESET & THEME BASE (Noir Sepia Journal Aesthetic)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #12100e; /* Deep Nocturnal Slate-Sepia background */
    color: #e6dfd5; /* Warm cream/parchment text */
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.7;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    letter-spacing: 1px;
    color: #fff;
}

/* NAVIGATION BAR */
.nav-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1.5rem 5%; 
    background: rgba(18, 16, 14, 0.95); 
    position: sticky; 
    top: 0; 
    width: 100%; 
    z-index: 100; 
    border-bottom: 1px solid #1f1a17;
}
.nav-bar ul { display: flex; list-style: none; gap: 2rem; }
.nav-bar a { 
    color: #df8040; /* Warm Copper accent for navigation */
    text-decoration: none; 
    font-size: 0.9rem; 
    font-weight: 600; 
    letter-spacing: 1px; 
    transition: 0.3s; 
}
.nav-bar a:hover, .nav-bar a.active { 
    color: #fff; 
    text-shadow: 0 0 10px #df8040; 
}

.logo { display: flex; align-items: center; gap: 15px; color: #df8040; }
.logo span { font-family: 'Dancing Script', cursive; font-size: 2.2rem; }
.avatar { width: 50px; height: 50px; border-radius: 50%; border: 2px solid #df8040; object-fit: cover; }

/* GLOW LINKS */
.glow-link { transition: all 0.3s ease; cursor: pointer; }
.glow-link:hover { color: #fff !important; text-shadow: 0 0 10px #df8040, 0 0 20px #df8040; }

/* HEADER */
.blog-header {
    text-align: center;
    padding: 6rem 5% 3rem 5%;
    background: linear-gradient(180deg, #1f1a17 0%, #12100e 100%);
    border-bottom: 1px dashed #2d2520;
}
.blog-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #fff;
    text-shadow: 0 0 15px rgba(223, 128, 64, 0.3);
    margin-bottom: 0.8rem;
    letter-spacing: 3px;
}
.blog-header .tagline {
    font-size: 1.1rem;
    color: #df8040;
    font-style: italic;
    font-weight: 300;
}

/* MAIN CONTAINER */
.blog-container {
    max-width: 1000px;
    width: 90%;
    margin: 4rem auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
}

/* CONTROLS BAR (Search & Filters) */
.controls-bar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border-bottom: 1px solid #1f1a17;
    padding-bottom: 2.5rem;
}

.search-box {
    width: 100%;
}
.search-box input {
    width: 100%;
    background: #1c1815;
    border: 1px solid #2d2520;
    color: #e6dfd5;
    padding: 1.2rem 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    border-radius: 4px;
    outline: none;
    transition: 0.3s;
}
.search-box input:focus {
    border-color: #df8040;
    box-shadow: 0 0 10px rgba(223, 128, 64, 0.15);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.filter-btn {
    background: none;
    border: 1px solid #2d2520;
    color: #a0958a;
    padding: 0.8rem 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 2px;
    transition: 0.3s;
}
.filter-btn:hover {
    color: #fff;
    border-color: #df8040;
}
.filter-btn.active {
    background: #df8040;
    color: #12100e;
    border-color: #df8040;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(223, 128, 64, 0.25);
}

/* ==========================================================================
   POSTS GRID & CARD LAYOUTS (Desktop)
   ========================================================================== */
.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.post-card {
    background: #1c1815;
    border: 1px solid #2d2520;
    padding: 0 !important; /* Force padding 0 to let the image sit edge-to-edge */
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: row; /* Horizontal layout on desktop */
    overflow: hidden; /* Clamp image to borders */
    transition: 0.3s ease;
    min-height: 240px;
}
.post-card:hover {
    border-color: #df8040;
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(223, 128, 64, 0.08);
}

.post-thumb-wrap {
    width: 240px; /* Highly compact thumbnail width - makes pictures significantly smaller */
    min-width: 240px;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-right: 1px solid #2d2520;
}

.post-thumb-wrap img, .post-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.post-card:hover .post-thumb-wrap img {
    transform: scale(1.05);
}

.post-card-content {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    flex: 1;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}
.category-badge {
    padding: 4px 10px;
    border-radius: 2px;
    font-weight: bold;
    letter-spacing: 1px;
}
.category-badge.rewired {
    background: rgba(223, 128, 64, 0.1);
    color: #df8040;
    border: 1px solid rgba(223, 128, 64, 0.3);
}
.category-badge.curtain {
    background: rgba(229, 169, 59, 0.1);
    color: #e5a93b;
    border: 1px solid rgba(229, 169, 59, 0.3);
}
.category-badge.internal {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.post-date {
    color: #80756b;
}

.post-card h2 {
    font-size: clamp(1.4rem, 3.5vw, 2.2rem);
    line-height: 1.3;
    color: #fff;
    transition: 0.2s;
}
.post-card:hover h2 {
    color: #df8040;
}

.post-excerpt {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #ccc;
}

.read-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: #df8040;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    border-bottom: 2px solid #df8040;
    padding-bottom: 4px;
    transition: 0.3s;
    margin-top: 1rem;
}
.read-btn:hover {
    color: #fff;
    border-bottom-color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   READING OVERLAY MODAL (Elegantly opens full posts like a physical journal)
   ========================================================================== */
.overlay {
    display: none; /* Controlled by JavaScript */
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 8, 7, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeInOverlay 0.4s ease;
}
@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.overlay-card {
    width: 90%;
    max-width: 800px;
    height: 85vh;
    background: #faf6f0; /* Crisp physical paper texture background */
    border-radius: 4px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid #dcd1c4;
    animation: slideUpCard 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
@keyframes slideUpCard {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-btn {
    align-self: flex-end;
    background: #1c1815;
    border: none;
    color: #df8040;
    padding: 0.8rem 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.3s;
    border-bottom-left-radius: 4px;
}
.close-btn:hover {
    background: #df8040;
    color: #1c1815;
}

.journal-paper {
    flex: 1;
    overflow-y: auto;
    padding: 4rem 5%;
    color: #2b2b2b; /* Deep graphite print for vintage reading look */
    font-family: 'Playfair Display', serif; /* Classic, bookish typography */
}

.journal-banner-wrap {
    width: 100%;
    overflow: hidden;
    border-radius: 2px;
    margin-bottom: 2rem;
}
.journal-banner-img, .journal-banner {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: cover;
    display: block;
    border: 1px solid #e9dfd3;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.journal-header {
    text-align: center;
    border-bottom: 2px solid #e9dfd3;
    padding-bottom: 2.5rem;
    margin-bottom: 3rem;
}
.journal-badge {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: #df8040;
    display: inline-block;
    margin-bottom: 1rem;
    border: 1px solid #df8040;
    padding: 4px 12px;
}
.journal-title {
    font-size: clamp(1.8rem, 4.5vw, 3rem);
    line-height: 1.2;
    color: #111;
    margin-bottom: 1rem;
}
.journal-date {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #706255;
    letter-spacing: 1px;
}

.journal-body {
    font-size: 1.15rem;
    line-height: 1.9;
    text-align: justify;
}
.journal-body p {
    margin-bottom: 2rem;
}

/* Elegant drop cap for first paragraph */
.drop-cap::first-letter {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    font-weight: bold;
    float: left;
    line-height: 0.8;
    margin-right: 12px;
    color: #df8040;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.05);
}

/* FOOTER */
.blog-footer-nav {
    border-top: 1px solid #1f1a17;
    padding: 2.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #60554c;
    background: #0d0c0b;
}

/* ==========================================================================
   UNIFIED FLUID TYPOGRAPHY SYSTEM (Release v42)
   ========================================================================== */
html {
    font-size: 16px; /* Desktop browser baseline */
}

:root {
    --h1-size: clamp(1.8rem, 4.5vw, 2.8rem);
    --h2-size: clamp(1.3rem, 3.5vw, 2.0rem);
    --h3-size: clamp(1.1rem, 2.5vw, 1.4rem);
}

/* ==========================================================================
   GLOBAL MOBILE RESPONSIVE OVERHAUL (Release v42)
   ========================================================================== */

/* Standard Responsive Text Scaling & Formatting */
@media (max-width: 850px) {
    html {
        font-size: 14px !important; /* Globally down-scales all REM dimensions by 12.5% */
    }
    body {
        line-height: 1.6 !important;
    }
    
    /* Global Navigation Bar Overhaul (Centered 4x2 Console Grid) */
    .nav-bar {
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1.2rem 4% !important;
        text-align: center !important;
        position: relative !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: rgba(18, 16, 14, 0.98) !important;
        border-bottom: 1px solid #1f1a17 !important;
    }
    
    .nav-bar ul {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.4rem !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }
    
    .nav-bar li {
        width: 100% !important;
        margin: 0 !important;
    }
    
    .nav-bar a {
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        padding: 0.65rem 0.2rem !important;
        text-align: center !important;
        border: 1px solid rgba(212, 175, 55, 0.15) !important;
        border-radius: 4px !important;
        background: rgba(255, 255, 255, 0.02) !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        letter-spacing: 0.5px !important;
        transition: 0.2s ease !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        overflow: hidden !important;
        color: #df8040 !important; /* Warm Copper accent */
    }
    
    .nav-bar a.active {
        color: #fff !important;
        border-color: #df8040 !important;
        background: rgba(223, 128, 64, 0.1) !important;
        text-shadow: 0 0 5px rgba(223, 128, 64, 0.5) !important;
    }
    
    .nav-bar a:hover {
        color: #fff !important;
        text-shadow: 0 0 10px #df8040 !important;
    }

    /* Blog Header mobile adjustments */
    .blog-header {
        padding: 4rem 5% 2rem 5% !important;
    }
    .blog-header h1 {
        font-size: var(--h1-size) !important;
    }
    .blog-header .tagline {
        font-size: 0.95rem !important;
    }

    /* Layout Margins & Containers */
    .blog-container {
        width: 92% !important;
        margin: 2rem auto !important;
        gap: 2.5rem !important;
    }

    /* Search & Filter bar optimizations */
    .controls-bar {
        gap: 1.2rem !important;
        padding-bottom: 1.5rem !important;
    }
    .search-box input {
        padding: 0.9rem 1.2rem !important;
        font-size: 0.9rem !important;
    }
    .filter-group {
        justify-content: center !important;
        gap: 0.6rem !important;
    }
    .filter-btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.75rem !important;
        letter-spacing: 0.5px !important;
    }

    /* Stacked Post Cards Overhaul */
    .posts-grid {
        gap: 2rem !important;
    }
    .post-card {
        flex-direction: column !important; /* Stacks vertically */
        min-height: auto !important;
    }
    .post-thumb-wrap {
        width: 100% !important;
        min-width: 100% !important;
        height: 220px !important;
        min-height: 220px !important;
        border-right: none !important;
        border-bottom: 1px solid #2d2520 !important;
    }
    .post-card-content {
        padding: 1.8rem 1.5rem !important;
        gap: 0.8rem !important;
    }
    .post-card h2 {
        font-size: var(--h2-size) !important;
    }
    .post-excerpt {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    /* Touch-optimized button */
    .read-btn {
        align-self: stretch !important; /* Stretch to fill mobile width */
        text-align: center !important;
        padding: 0.9rem !important;
        background: rgba(223, 128, 64, 0.05) !important;
        border: 1.5px solid #df8040 !important;
        border-radius: 4px !important;
        margin-top: 0.8rem !important;
        display: block !important;
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        letter-spacing: 1px !important;
        transition: 0.2s ease !important;
    }
    .read-btn:hover {
        background: #df8040 !important;
        color: #12100e !important;
        text-shadow: none !important;
    }

    /* Journal Reading Overlay Modal on Mobile */
    .overlay-card {
        width: 95% !important;
        height: 90vh !important;
        margin-top: 5vh !important;
    }
    .close-btn {
        padding: 0.6rem 1.2rem !important;
        font-size: 0.75rem !important;
    }
    .journal-paper {
        padding: 2.5rem 5% !important;
    }
    .journal-banner-wrap {
        margin-bottom: 1.5rem !important;
    }
    .journal-banner-img, .journal-banner {
        max-height: 200px !important;
    }
    .journal-header {
        padding-bottom: 1.5rem !important;
        margin-bottom: 2rem !important;
    }
    .journal-badge {
        font-size: 0.7rem !important;
        padding: 3px 10px !important;
        margin-bottom: 0.8rem !important;
    }
    .journal-title {
        font-size: var(--h1-size) !important;
    }
    .journal-body {
        font-size: 1.05rem !important;
        line-height: 1.7 !important;
        text-align: left !important; /* Normal left-align on small screens */
    }
    .drop-cap::first-letter {
        font-size: 3.2rem !important;
        margin-right: 8px !important;
    }
}

/* Extra Compact Devices (iPhone SE / small screens) */
@media (max-width: 412px) {
    html {
        font-size: 13.2px !important;
    }
    .nav-bar a {
        font-size: 0.65rem !important;
    }
    .nav-bar ul {
        gap: 0.3rem !important;
    }
    .journal-paper {
        padding: 2rem 4% !important;
    }
}