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

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.7;
    background: #f5f7fa;
    color: #1f2937;
}

/* Navigation */

nav {
    background: #111827;
    color: white;
}

.nav-container {
    max-width: 1100px;
    margin: auto;
    padding: 18px 20px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: white;
    text-decoration: none;
    font-size: 22px;
    font-weight: bold;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 25px;
}

.nav-links a:hover {
    color: #60a5fa;
}

/* Main */

main {
    min-height: 70vh;
}

/* Article */

.post {
    max-width: 900px;
    margin: 50px auto;
    padding: 45px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.post h1 {
    color: #1e3a8a;
    font-size: 40px;
    line-height: 1.3;
    margin-bottom: 15px;
}

.post h2 {
    color: #1e3a8a;
    margin-top: 35px;
    margin-bottom: 10px;
}

.post h3 {
    margin-top: 25px;
}

.post p {
    margin-bottom: 18px;
}

.post ul,
.post ol {
    margin: 15px 0 20px 25px;
}

/* ========================================
   Code Blocks
   ======================================== */

    .post code {
        font-family: Consolas, "Courier New", monospace;
        background: #f3f4f6;
        padding: 3px 6px;
        border-radius: 4px;
        font-size: 0.95em;
    }
    
    /* Wrapper around code block */
    
    .code-wrapper {
        position: relative;
        margin: 25px 0;
    }
    
    /* Main code block */
    
    .post .code-wrapper pre {
        background: #111827;
        color: #f9fafb;
        padding: 50px 22px 22px 22px;
        margin: 0;
        overflow-x: auto;
        border-radius: 8px;
        line-height: 1.6;
        border: 1px solid #374151;
    }
    
    /* Remove inline-code styling inside code blocks */
    
    .post .code-wrapper pre code {
        background: transparent;
        color: inherit;
        padding: 0;
        border-radius: 0;
        font-family: Consolas, "Courier New", monospace;
        font-size: 14px;
    }
    
    /* Copy button */
    
    .copy-code-button {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 2;
    
        background: #1f2937;
        color: #e5e7eb;
    
        border: 1px solid #4b5563;
        border-radius: 5px;
    
        padding: 5px 11px;
    
        font-size: 12px;
        font-weight: 600;
    
        cursor: pointer;
    }
    
    .copy-code-button:hover {
        background: #374151;
        color: white;
    }
    
    /* Dark mode */
    
    body.dark-mode .post code {
        background: #1f2937;
        color: #e5e7eb;
    }
    
    body.dark-mode .post .code-wrapper pre {
        background: #020617;
        border-color: #334155;
    }
    
    body.dark-mode .copy-code-button {
        background: #1e293b;
        border-color: #475569;
        color: #f8fafc;
    }
    
    body.dark-mode .copy-code-button:hover {
        background: #334155;
    }

.post pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
}

.post-meta {
    color: #6b7280;
    margin-bottom: 30px;
}

/* Blog page */

.blog-container {
    max-width: 1100px;
    margin: 50px auto;
    padding: 0 20px;
}

.blog-container h1 {
    text-align: center;
    color: #1e3a8a;
    margin-bottom: 10px;
}

.blog-intro {
    text-align: center;
    color: #6b7280;
    margin-bottom: 40px;
}

.post-card {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}

.post-card h2 {
    margin-bottom: 8px;
}

.post-card h2 a {
    color: #1e3a8a;
    text-decoration: none;
}

.post-card h2 a:hover {
    color: #2563eb;
}

.read-more {
    color: #2563eb;
    font-weight: bold;
    text-decoration: none;
}

/* Footer */

footer {
    background: #111827;
    color: #d1d5db;
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
}

/* Dark mode */

body.dark-mode {
    background: #0f172a;
    color: #e5e7eb;
}

body.dark-mode nav,
body.dark-mode footer {
    background: #020617;
}

body.dark-mode .post,
body.dark-mode .post-card,
body.dark-mode .about,
body.dark-mode .category {
    background: #111827;
    color: #e5e7eb;
}

body.dark-mode .post h1,
body.dark-mode .post h2,
body.dark-mode .post-card h2 a,
body.dark-mode .blog-container h1 {
    color: #93c5fd;
}

body.dark-mode .post-meta,
body.dark-mode .blog-intro,
body.dark-mode .section-title p,
body.dark-mode .card p {
    color: #cbd5e1;
}

body.dark-mode .category {
    color: #e5e7eb;
}

body.dark-mode .post code {
    background: #1f2937;
}

body.dark-mode .post pre {
    background: #020617;
}

.theme-toggle {
    background: transparent;
    border: 1px solid #64748b;
    color: white;
    padding: 7px 11px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 18px;
}

.theme-toggle:hover {
    background: #1e293b;
}

.related-intro {
    margin-bottom: 15px;
    color: #6b7280;
}

body.dark-mode .related-intro {
    color: #cbd5e1;
}

/* Mobile */

@media (max-width: 700px) {

    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links a {
        margin: 0 8px;
    }

    .post {
        margin: 20px;
        padding: 25px;
    }

    .post h1 {
        font-size: 30px;
    }

}

/* Mobile navigation button */

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid #64748b;
    color: white;
    font-size: 22px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
}

/* ========================================
   Table of Contents
   ======================================== */

.table-of-contents {
    background: #ffffff;
    border: 1px solid #dbe3ec;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 22px 26px;
    margin: 30px 0 40px 0;
    color: #1f2937;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 19px;
    color: #111827;
    margin-bottom: 15px;
}

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

.table-of-contents li {
    margin: 9px 0;
    padding-left: 0;
    color: #4b5563;
}

.table-of-contents a {
    color: #1d4ed8;
    text-decoration: none;
    line-height: 1.5;
}

.table-of-contents a:hover {
    color: #1e40af;
    text-decoration: underline;
}

.toc-toggle {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
}

.toc-toggle:hover {
    background: #e5e7eb;
}

/* Heading jump position */

.post h2 {
    scroll-margin-top: 90px;
}


/* ========================================
   Table of Contents - Dark Mode
   ======================================== */

body.dark-mode .table-of-contents {
    background: #1e293b;
    border-color: #334155;
    border-left-color: #60a5fa;
    color: #e5e7eb;
}

body.dark-mode .toc-header {
    color: #f8fafc;
}

body.dark-mode .table-of-contents li {
    color: #cbd5e1;
}

body.dark-mode .table-of-contents a {
    color: #93c5fd;
}

body.dark-mode .table-of-contents a:hover {
    color: #bfdbfe;
}

body.dark-mode .toc-toggle {
    background: #334155;
    color: #f8fafc;
    border-color: #475569;
}

body.dark-mode .toc-toggle:hover {
    background: #475569;
}
/* related posts */
.related-posts {
    margin-top: 45px;
    padding-top: 25px;
    border-top: 1px solid #e5e7eb;
}

.related-posts h2 {
    margin-bottom: 15px;
}

.related-posts ul {
    margin-left: 20px;
}

.related-posts li {
    margin-bottom: 10px;
}

.related-posts a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.related-posts a:hover {
    text-decoration: underline;
}

body.dark-mode .related-posts {
    border-top-color: #374151;
}

/* Mobile navigation */

@media (max-width: 700px) {

    .nav-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: 15px;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        margin: 0;
        padding: 10px 0;
        width: 100%;
    }

    .theme-toggle {
        margin: 10px 0 0 0;
        align-self: flex-start;
    }

}
