/* Blog-specific styles that extend the main design */

/* CSS Variables for Theme - matching main site */
:root {
    --bg-color: #fff;
    --text-color: #333;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    --card-bg: #fff;
    --border-color: #e5e7eb;
    --section-bg: #f9fafb;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --nav-bg-scrolled: rgba(255, 255, 255, 0.98);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.2);
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-color: #10b981;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-light: #cbd5e1;
    --text-lighter: #94a3b8;
    --card-bg: #1e293b;
    --border-color: #334155;
    --section-bg: #1e293b;
    --nav-bg: rgba(15, 23, 42, 0.95);
    --nav-bg-scrolled: rgba(15, 23, 42, 0.98);
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.6);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation - same as main site */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: var(--nav-bg-scrolled);
    box-shadow: 0 2px 20px var(--shadow-medium);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-light);
    transition: color 0.3s ease;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--primary-color);
}

.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
    margin-left: 1rem;
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    margin-bottom: 2rem;
}

.back-button:hover {
    color: var(--primary-color);
}

/* Blog Container */
.blog-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 120px 2rem 4rem;
}

/* Blog Header */
.blog-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.blog-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.blog-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.blog-date,
.blog-reading-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-tags {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.blog-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Blog Content */
.blog-content {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow-light);
    border: 1px solid var(--border-color);
    margin-bottom: 3rem;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4 {
    color: var(--text-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.blog-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.blog-content h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.blog-content h3 {
    font-size: 1.3rem;
}

.blog-content p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
}

/* Ensure list text size matches paragraph text */
.blog-content ul,
.blog-content ol {
    margin: 0 0 1.5rem 1.25rem;
}

.blog-content li {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    margin: 0.25rem 0;
}

.blog-content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.blog-content a:hover {
    border-bottom-color: var(--primary-color);
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.blog-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--section-bg);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-light);
}

.blog-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

.blog-content code {
    background: var(--section-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.blog-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Math equations */
.blog-content .math {
    text-align: center;
    margin: 2rem 0;
    font-size: 1.1rem;
}

/* Table of Contents */
.table-of-contents {
    background: var(--section-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
}

.table-of-contents h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.table-of-contents ul {
    list-style: none;
    padding-left: 0;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
}

.table-of-contents a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.table-of-contents a:hover {
    color: var(--primary-color);
}

/* Navigation between posts */
.blog-navigation {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.nav-post {
    flex: 1;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-post:hover {
    box-shadow: 0 8px 25px var(--shadow-medium);
    transform: translateY(-2px);
}

.nav-post-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.nav-post-title {
    color: var(--text-color);
    font-weight: 600;
}

/* Footer */
.blog-footer {
    text-align: center;
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
    color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .blog-container {
        padding: 100px 1rem 2rem;
    }
    
    .blog-title {
        font-size: 2rem;
    }
    
    .blog-content {
        padding: 2rem 1.5rem;
    }
    
    .blog-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .blog-navigation {
        flex-direction: column;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Collapsible TOC button */
.collapsible {
    width: 100%;
    text-align: left;
    background: var(--section-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    margin-bottom: 0.5rem;
}

.collapsible:hover,
.collapsible.active {
    background: var(--card-bg);
    border-color: var(--primary-color);
}

/* Collapsible content wrapper */
.content {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

/* Numbered TOC list */
ol.toc-list {
    list-style: none;
    counter-reset: section;
    padding-left: 0;
}

ol.toc-list > li {
    counter-increment: section;
    margin: 0.25rem 0;
}

ol.toc-list > li::before {
    content: counter(section) ". ";
    color: var(--text-light);
}

ol.toc-list > li > ol {
    list-style: none;
    counter-reset: subsection;
    padding-left: 1rem;
    margin-top: 0.25rem;
}

ol.toc-list > li > ol > li {
    counter-increment: subsection;
    margin: 0.125rem 0;
}

ol.toc-list > li > ol > li::before {
    content: counter(section) "." counter(subsection) " ";
    color: var(--text-lighter);
}

/* Utility colors used in blog text */
.blue { color: var(--primary-color); }
.red { color: #ef4444; }

/* TOC link appearance (non-collapsible variant container .toc-section) */
.toc-section a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.toc-section a:hover {
    color: var(--primary-color);
    text-decoration: none;
}
