/* --- docs/blog.css --- */

/* 1. VARIABLES & RESET (Synced with Main Site) */
:root {
    /* BRAND COLORS */
    --brand-delft: #3b3674;
    --brand-purple: #6B4E9A;
    --brand-lilac: #A68BC7;
    --brand-sienna: #D9774F;
    --brand-amber: #F4A261;

    /* THEME DEFAULTS */
    --bg-deep: #fdfcff;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(59, 54, 116, 0.08);
    
    --text-white: #3b3674; /* Re-mapped to Delft Blue */
    --text-muted: #6B4E9A; /* Re-mapped to Royal Purple */
    
    --gradient-main: linear-gradient(135deg, var(--brand-purple), var(--brand-sienna));
    --card-shadow: 0 10px 30px rgba(59, 54, 116, 0.08);
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    overflow-x: hidden;
    width: 100%;
    position: relative; /* ADD THIS */
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-deep);
    color: var(--text-white);
    line-height: 1.6;
    background-image: radial-gradient(circle at 15% 50%, rgba(107, 78, 154, 0.03), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(217, 119, 79, 0.03), transparent 25%);
    background-attachment: fixed;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw; /* ADD THIS */
    position: relative;
    margin: 0;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

.container {
    max-width: 1280px;
    margin: 0 auto; 
    padding: 0 24px;
    width: 100%; /* ADD THIS */
}

/* 2. UTILITIES */
.text-gradient {
    background: linear-gradient(90deg, var(--brand-amber), var(--brand-sienna), var(--brand-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% auto;
    animation: textShine 5s linear infinite;
}
@keyframes textShine { to { background-position: -200% center; } }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 24px;
    background: var(--brand-delft);
    color: #ffffff;
    font-weight: 700; border-radius: 100px;
    transition: all 0.3s var(--ease-spring);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(107, 78, 154, 0.2); }

/* 3. HEADER (Synced styling) */
header {
    position: sticky; top: 20px; z-index: 1000;
    margin-bottom: 40px;
    width: 100%; /* ADD THIS */
}

.nav-box {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    padding: 12px 24px;
    border-radius: 100px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--card-shadow);
    width: 90%; max-width: 1280px; margin: 0 auto;
}

.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--text-white); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

/* Language Select */
.lang-wrap { position: relative; }
.lang-select {
    background: rgba(59, 54, 116, 0.05);
    color: var(--brand-delft);
    border: 1px solid rgba(59, 54, 116, 0.15);
    border-radius: 8px; padding: 8px 30px 8px 12px;
    font-weight: 600; cursor: pointer; appearance: none;
    transition: 0.3s;
}
.lang-wrap::after {
    content: '▼'; font-size: 0.7em; color: var(--brand-delft);
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    pointer-events: none;
}

/* FIX: DEFAULT STATE (DESKTOP) - HIDE MOBILE ELEMENTS */
.mobile-menu-toggle { display: none; }
.mobile-nav-overlay { display: none; }

/* 4. BLOG INDEX LAYOUT */
.blog-header { padding: 100px 0 60px; text-align: center; }
.blog-header h1 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 20px; font-weight: 800; }
.blog-header p { font-size: 1.2rem; color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.grid-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    padding-bottom: 100px;
}

.post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 32px;
    transition: 0.4s var(--ease-spring);
    display: flex; flex-direction: column;
    height: 100%;
    position: relative; overflow: hidden;
}
.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(59, 54, 116, 0.12);
    border-color: rgba(107, 78, 154, 0.3);
}

.post-date { font-size: 0.8rem; font-weight: 700; color: var(--brand-sienna); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; display: block; }
.post-card h2 { font-size: 1.6rem; margin-bottom: 12px; line-height: 1.3; }
.post-card h2 a { color: var(--text-white); }
.post-card p { color: var(--text-muted); font-size: 1rem; margin-bottom: 24px; flex-grow: 1; }
.read-more {
    color: var(--brand-purple); font-weight: 700; display: inline-flex; align-items: center; gap: 6px;
}
.read-more:hover { gap: 10px; color: var(--brand-sienna); }

/* 5. SINGLE POST LAYOUT */
.single-post { padding-top: 60px; padding-bottom: 100px; }

.post-header {
    text-align: center; margin-bottom: 60px;
    padding-bottom: 40px; border-bottom: 1px solid var(--border-glass);
}
.post-meta {
    display: inline-block; padding: 6px 14px;
    background: rgba(59, 54, 116, 0.05); border-radius: 20px;
    font-size: 0.9rem; font-weight: 600; color: var(--brand-delft);
    margin-bottom: 24px;
}
.post-header h1 { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.1; margin-bottom: 20px; }

.markdown-content { font-size: 1.15rem; color: var(--text-muted); line-height: 1.8; }
.markdown-content p { margin-bottom: 24px; }

.markdown-content a {
    color: var(--brand-sienna);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid rgba(217, 119, 79, 0.2);
    transition: 0.3s;
}
.markdown-content a:hover {
    background: rgba(217, 119, 79, 0.1);
    border-bottom-color: var(--brand-sienna);
}

.markdown-content h2 {
    font-size: 2rem; color: var(--text-white); margin: 60px 0 24px; letter-spacing: -0.5px;
}
.markdown-content h3 { font-size: 1.5rem; color: var(--text-white); margin: 40px 0 20px; }
.markdown-content ul, .markdown-content ol { margin-bottom: 30px; padding-left: 20px; }
.markdown-content li { margin-bottom: 10px; padding-left: 10px; }
.markdown-content li::marker { color: var(--brand-purple); font-weight: bold; }

.markdown-content blockquote {
    border-left: 4px solid var(--brand-purple);
    background: linear-gradient(to right, rgba(107, 78, 154, 0.05), transparent);
    padding: 24px 32px;
    margin: 40px 0;
    border-radius: 0 16px 16px 0;
    font-style: italic; color: var(--brand-delft); font-size: 1.25rem;
}

.post-footer { margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--border-glass); text-align: center; }
.back-link {
    display: inline-flex; padding: 12px 30px;
    border: 1px solid var(--border-glass); border-radius: 100px;
    font-weight: 600; color: var(--text-muted); transition: 0.3s;
}
.back-link:hover { background: var(--bg-surface); border-color: var(--brand-delft); color: var(--brand-delft); transform: translateY(-2px); box-shadow: var(--card-shadow); }

footer {
    text-align: center; padding: 60px 0; border-top: 1px solid var(--border-glass); color: var(--text-muted);
    font-size: 0.9rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .blog-header h1 { font-size: 2.5rem; }
    .nav-box { padding: 10px 16px; width: 95%; margin: 0 auto; }
    .post-header h1 { font-size: 2rem; }
    
    /* MOBILE NAV VISIBILITY */
    .nav-actions { display: none; } /* Hide Desktop Buttons */
    .mobile-menu-toggle { display: flex; } /* Show Hamburger */
    .mobile-nav-overlay { display: flex; } /* Allow overlay to exist (it's hidden by right: -100%) */

    .mobile-menu-toggle { 
        display: flex; flex-direction: column; gap: 6px; cursor: pointer; padding: 8px; z-index: 1001; background: none; border: none; 
    }
    .mobile-menu-toggle span { width: 25px; height: 2px; background: var(--brand-delft); transition: 0.3s; border-radius: 2px; }
    .mobile-menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translateY(10px); }
    .mobile-menu-toggle.active span:nth-child(2) { opacity: 0; }
    .mobile-menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translateY(-10px); }

    /* Slide-out Logic */
    .mobile-nav-overlay {
        position: fixed; 
        top: 0; 
        right: -100%; 
        height: 100vh; 
        width: 100vw; /* CHANGED from 100% to 100vw */
        max-width: 100vw; /* ADD THIS - prevents overflow */
        background: var(--bg-surface); 
        z-index: 1000;
        
        /* ALIGNMENT UPDATES: */
        display: flex; 
        flex-direction: column; 
        justify-content: flex-start; 
        padding-top: 140px;          
        align-items: center; 
        gap: 25px;

        /* SCROLL BUG FIX: */
        visibility: hidden; 
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.4s;
        overflow-x: hidden; /* ADD THIS - prevents internal horizontal scroll */
    }

    /* Keep the .active rule right below it */
    .mobile-nav-overlay.active { 
        right: 0; 
        visibility: visible;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    }
    
    .mobile-nav-overlay .btn-primary { width: 80%; max-width: 400px; text-align: center; } /* ADD max-width */
    .mobile-nav-overlay .lang-wrap { width: 80%; max-width: 400px; } /* ADD max-width */
    .mobile-nav-overlay .lang-select { width: 100%; text-align: center; }
    
    /* ADD THIS - Prevent grid from causing overflow */
    .grid-wrapper {
        grid-template-columns: 1fr;
        width: 100%;
    }
}
