/* blog_src_pelican/theme/static/css/blog.css */

/* === 1. COPIED FROM YOUR index.html === */
:root {
    --header-offset: 3.5rem;
    --base-font-size: 16px;
    --bg-main: #121212;
    --bg-content: #1E1E1E;
    --bg-input: #2A2A2A;
    --text-primary: #F5F5F5;
    --text-secondary: #A0A0A0;
    --border-subtle: #333333;
    --border-interactive: #555555;
    --button-bg: #333333;
    --button-text: #F5F5F5;
    --button-hover-bg: #444444;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-xxl: 3rem;
    --space-section-margin: 4rem;
}

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

html {
    font-size: var(--base-font-size);
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.7;
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header (EXACTLY from index.html) */
header#page-header {
    background-color: var(--bg-content);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* This targets the <a> link wrapping the logo */
header#page-header > a:first-child {
    display: block;
    line-height: 0; /* Collapses extra space around the image */
}

header img#header-logo {
    max-width: 130px;
    height: auto;
    margin-right: var(--space-lg);
    /* Added for consistency */
    vertical-align: middle; 
}

/* === NAVIGATION STYLES (NOW MATCH index.html) === */
nav ul {
    list-style: none;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
}

nav ul li {
    margin: var(--space-xs) var(--space-md);
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    padding: var(--space-sm) 0;
    position: relative;
    transition: color 0.2s ease;
    letter-spacing: 0.5px;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -var(--space-xs);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-primary);
    transition: width 0.3s ease;
}

nav a:hover,
nav a.active {
    color: var(--text-primary);
}

nav a:hover::after,
nav a.active::after {
    width: 100%;
}

/* --- NEW: Mobile Navigation Toggle Button (from index.html) --- */
#mobile-nav-toggle {
    display: none; /* Hidden by default */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    z-index: 1011; /* Above nav overlay */
    position: relative; 
}

#mobile-nav-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

/* Active (X) state for hamburger */
#mobile-nav-toggle.is-active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
#mobile-nav-toggle.is-active .bar:nth-child(2) {
    opacity: 0;
}
#mobile-nav-toggle.is-active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}
/* --- END NEW --- */


/* Footer (EXACTLY from index.html) */
footer {
    background-color: var(--bg-content);
    color: var(--text-secondary);
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    font-size: 0.9em;
    margin-top: auto; /* Pushes footer to bottom */
    border-top: 1px solid var(--border-subtle);
}

footer p {
    margin-bottom: var(--space-sm);
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-secondary);
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

footer a:hover {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}


/* === 2. NEW BLOG-SPECIFIC STYLES === */
/* (These use the variables from above) */

main.blog-content {
    flex-grow: 1;
    max-width: 55rem; /* Matches your #about section */
    margin: var(--space-xl) auto;
    padding: var(--space-xl);
    width: 90%;
}

/* Blog Post List (index.html) */
.post-list {
    list-style: none;
}

.post-list-item {
    background-color: var(--bg-content);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-subtle);
    border-radius: 0.375rem; /* 6px, matches your form inputs */
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.post-list-item:hover {
    box-shadow: 0 0 0 3px rgba(245, 245, 245, 0.15); /* Matches form focus */
}

.post-list-item a {
    display: block;
    padding: var(--space-lg) var(--space-xl);
    text-decoration: none;
    overflow-wrap: break-word;
}

.post-list-item h2 {
    color: var(--text-primary);
    font-size: 1.5em; /* A bit smaller than section h2 */
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.post-list-item .post-meta {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.post-list-item .post-summary {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Single Blog Post (article.html) */
.blog-article {
    background-color: var(--bg-content);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem; /* 8px */
    padding: var(--space-xxl);
    overflow-wrap: break-word;
}

.blog-article header h1 {
    font-size: 2.5em; /* Matches your section h2 */
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.blog-article .post-meta {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--space-lg);
}

.blog-article .article-body {
    color: var(--text-secondary);
    font-size: 1.1em; /* Matches your #about p */
    font-weight: 400;
}

.blog-article .article-body h2 {
    font-size: 2em; /* Matches your section h2 mobile */
    font-weight: 800;
    color: var(--text-primary);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--space-sm);
}

.blog-article .article-body h3 {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
}

.blog-article .article-body p {
    margin-bottom: var(--space-md);
}

.blog-article .article-body a {
    color: var(--text-primary); /* Brighter link for content */
    text-decoration: underline;
}

.blog-article .article-body code {
    background: var(--bg-input);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--text-primary);
}

.blog-article .article-body pre {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    padding: var(--space-md);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9em;
}

.blog-article .article-body pre code {
    padding: 0;
    background: none;
}

/* --- FIX 3: Add media query for mobile padding --- */
@media (max-width: 600px) {
    main.blog-content {
        width: 95%; /* Use more of the screen */
        padding: var(--space-md); /* Reduce main padding (was 2rem) */
    }

    .post-list-item a {
        /* Reduce padding inside list items */
        padding: var(--space-lg); /* 1.5rem (was 1.5rem / 2rem) */
    }

    .blog-article {
        /* Reduce padding inside articles */
        padding: var(--space-lg); /* 1.5rem (was 3rem) */
    }
}

/* --- FIX 4: Make tables scrollable --- */

.blog-article .article-body table {
    display: block;
    max-width: 100%;
    overflow-x: auto; /* Adds a horizontal scrollbar to the table */
    margin-bottom: var(--space-md);
    border-collapse: collapse;
}

.blog-article .article-body th,
.blog-article .article-body td {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.blog-article .article-body th {
    background-color: var(--bg-input); /* Style header to match theme */
    color: var(--text-primary);
    font-weight: 700;
}

.blog-article .article-body ul,
.blog-article .article-body ol {
    /* Re-adds the default indentation (padding) */
    padding-left: var(--space-xl); 
    
    /* Adds space after the entire list, just like a paragraph */
    margin-bottom: var(--space-md);
}

.blog-article .article-body li {
    /* Adds a little space between list items */
    margin-bottom: var(--space-sm);
}

.blog-article .article-body ul {
    /* Ensures bullet points are visible */
    list-style-type: disc;
}

.blog-article .article-body ol {
    /* Ensures numbers are visible */
    list-style-type: decimal;
}

/* === 3. MOBILE MENU STYLES (FROM index.html) === */

/* Screen-reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Breakpoint and styles copied from index.html */
@media (max-width: 768px) {
    header#page-header {
        /* Copied from index.html media query */
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-sm);
    }

    header img#header-logo {
        /* Copied from index.html media query */
        margin-right: 0;
        margin-bottom: 0;
    }

    /* --- NEW: Show hamburger, hide desktop nav --- */
    #mobile-nav-toggle {
        display: block;
    }

    #main-nav {
        /* Full-screen overlay */
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: var(--bg-content);
        z-index: 1010; /* Below toggle, above content */
        display: flex;
        align-items: center;
        justify-content: center;
        
        /* Hide by default */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px); /* Effect */
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    }

    #main-nav.is-active {
        /* Show when active */
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* --- MODIFIED: Style nav items for overlay --- */
    nav ul {
        justify-content: center;
        flex-direction: column; /* Stack links vertically */
        align-items: center;
        flex-wrap: nowrap;
    }

    nav ul li {
        margin: var(--space-md) 0; /* Adjust spacing for vertical menu */
    }

    nav a {
        font-size: 1.5em; /* Make links bigger */
        padding: var(--space-sm) var(--space-md);
    }
}

/* Smaller mobile screen adjustments */
@media (max-width: 480px) {
    header img#header-logo {
        max-width: 110px;
    }

    nav ul li {
        margin: var(--space-md) 0;
    }
}