@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    /* GitHub Dark Colors */
    --bg-color: #0d1117;
    --surface: #161b22;
    --surface-hover: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    
    /* Primary Accent - GitHub Blue */
    --accent-primary: #58a6ff;
    /* Secondary Accent - GitHub Green */
    --accent-secondary: #3fb950;
    
    /* Legacy support */
    --accent-green: #3fb950;
    --accent-cyan: #58a6ff;
    --accent-red: #f85149;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-primary);
    opacity: 0.8;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 1rem;
    word-break: break-word;
    overflow-wrap: break-word;
    color: var(--text-primary);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Navbar */
nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0;
}

.logo::before {
    content: 'MH';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    color: var(--bg-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0;
    position: relative;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-search-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.navbar-search-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.navbar-search-btn kbd {
    background: var(--surface);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s;
}

/* Header/Hero */
.hero {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 0;
    position: relative;
}

.hero-content {
    max-width: 700px;
    position: relative;
    z-index: 10;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.hero .highlight {
    color: var(--accent-primary);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: var(--bg-color);
    border: 1px solid var(--accent-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn:hover {
    background: transparent;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn::before {
    display: none;
}

/* Typing Effect */
.typing-container {
    display: none;
}

/* Sections */
section {
    padding: 5rem 0;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.section-head h2 {
    font-size: 1.8rem;
    position: relative;
    display: inline-block;
    font-weight: 700;
}

.section-head h2::after {
    display: none;
}

/* Grid Layouts */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 2rem;
}

/* Cards (Projects & Articles) */
.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: none;
}

.card:hover {
    transform: none;
    border-color: var(--accent-primary);
    box-shadow: 0 8px 24px rgba(88, 166, 255, 0.1);
}

.card::before {
    display: none;
}

.card-category {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--accent-secondary);
    margin-bottom: 0.8rem;
    display: inline-block;
    background: rgba(63, 185, 80, 0.1);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: capitalize;
}

.card h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

.read-more {
    color: var(--accent-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95rem;
}

.read-more::after {
    content: '→';
    transition: transform 0.2s ease;
}

.card:hover .read-more::after {
    transform: translateX(4px);
}

/* Article Feed / List specific */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: var(--bg-color);
}

.search-box {
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--accent-primary);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Article Reader View */
.article-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 4rem 0 2rem;
    border-bottom: 1px solid var(--border-color);
}

.article-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--font-mono);
    color: var(--accent-green);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.article-content {
    max-width: 100%;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.8;
    word-wrap: break-word;
    /* Prevent long strings causing overflow */
    overflow-wrap: break-word;
    word-break: break-word;
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    align-items: start;
}

.article-body {
    max-width: 800px;
    width: 100%;
}

.article-toc-rail {
    position: fixed;
    top: 50%;
    right: 0;
    width: 280px;
    transform: translate(250px, -50%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1200;
    display: flex;
    align-items: center;
}

.article-toc-rail:hover,
.article-toc-rail:focus-within {
    transform: translate(0, -50%);
}

.article-toc-handle {
    width: 30px;
    min-height: 88px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: rgba(12, 16, 24, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    cursor: default;
}

.article-toc-handle span {
    width: 14px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent-primary);
}

.article-toc {
    width: 250px;
    max-height: min(72vh, 640px);
    overflow-y: auto;
    padding: 0.9rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 0 0 8px;
    border-left: none;
    background: rgba(22, 27, 34, 0.82);
    opacity: 0.78;
    transition: opacity 0.25s ease;
}

.article-toc-rail:hover .article-toc,
.article-toc-rail:focus-within .article-toc {
    opacity: 0.9;
}

.article-toc-title {
    margin: 0 0 0.65rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.article-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.article-toc-list li {
    margin: 0;
}

.article-toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    display: inline-block;
    font-size: 0.9rem;
    transition: color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.78;
}

.article-toc-list a:hover {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    text-shadow: none;
    opacity: 1;
}

.article-toc-list a.active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    opacity: 1;
}

.article-toc-list .toc-level-3 a {
    padding-left: 1.1rem;
    font-size: 0.84rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
}

.article-content table {
    display: block;
    overflow-x: auto;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.article-content table thead {
    background: var(--surface);
}

.article-content table th,
.article-content table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.article-content table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface);
}

/* Markdown specific styling */
.article-content h2 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.article-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.article-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content code {
    background: var(--surface);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    color: var(--accent-secondary);
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.article-content pre {
    background: #0f111a;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    /* Allow horizontal scroll within pre, but never overflow the page */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.article-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.article-content blockquote {
    border-left: 3px solid var(--accent-primary);
    background: var(--surface);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    font-style: italic;
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    margin-top: 5rem;
    text-align: center;
    font-family: var(--font-body);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.5rem;
}

.social-links a:hover {
    color: var(--accent-primary);
}

/* Project List View */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-item {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-item::before {
    content: '>';
    font-family: var(--font-mono);
    color: var(--accent-red);
    font-weight: bold;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.project-item:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.05);
    transform: translateX(10px);
}

.project-item:hover::before {
    opacity: 1;
}

.project-info {
    flex-grow: 1;
}

.project-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.project-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.project-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    min-width: 150px;
}

.project-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-green);
    background: rgba(0, 255, 65, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
}

.project-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    font-weight: bold;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    .project-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .project-meta {
        align-items: flex-start;
        min-width: auto;
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 1rem;
    }
}

/* Timeline Layout */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 1px;
    background-color: var(--border-color);
    top: 0;
    bottom: 0;
    left: 20px;
    margin-left: -0.5px;
}

.timeline-item {
    padding: 1rem 0 2rem 50px;
    position: relative;
    width: 100%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--accent-primary);
    border: 2px solid var(--bg-color);
    top: 1.5rem;
    left: 14px;
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 0 3px var(--surface);
}

.timeline-content {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    position: relative;
    box-shadow: none;
    transition: all 0.2s ease;
}

.timeline-content:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 8px 24px rgba(88, 166, 255, 0.1);
    transform: translateY(-2px);
}

.timeline-date {
    font-family: var(--font-body);
    color: var(--accent-primary);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.timeline-role {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.timeline-company {
    color: var(--accent-primary);
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
}

.timeline-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.timeline-tech {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

.timeline-tech span {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-body);
    border: 1px solid rgba(88, 166, 255, 0.2);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .navbar-search-btn kbd {
        display: none;
    }

    .search-text-nav {
        display: none;
    }

    .navbar-search-btn {
        padding: 0.4rem 0.6rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .section-head h2 {
        font-size: 1.8rem;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100dvh;
        width: min(80vw, 300px);
        max-width: 300px;
        background: rgba(5, 5, 16, 0.95);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.3s ease;
        z-index: 1000;
        backdrop-filter: blur(10px);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    }

    .nav-links.active {
        right: 0;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .card {
        padding: 1.5rem;
    }

    .typing-container {
        font-size: 1rem;
    }

    .article-header {
        padding: 2rem 0 1rem;
        margin-bottom: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

/* Docs Layout */
.docs-container {
    display: flex;
    gap: 3rem;
    padding-top: 2rem;
    align-items: flex-start;
}

.docs-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    padding-right: 1.5rem;
}

/* Custom scrollbar for sidebar */
.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.docs-main {
    flex-grow: 1;
    min-width: 0;
    width: 100%;
    padding-bottom: 4rem;
}

.docs-nav {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.docs-category {
    font-family: var(--font-body);
    color: var(--accent-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.docs-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.docs-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: block;
    padding: 0.4rem 0.8rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
}

.docs-links a:hover,
.docs-links a.active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.05);
    text-shadow: none;
}

.docs-mobile-header {
    display: none;
    width: 100%;
    margin-bottom: 2rem;
}

.docs-index-heading {
    text-align: left;
    margin-bottom: 3rem;
}

.docs-index-heading h1 {
    font-size: clamp(1.8rem, 8vw, 3rem);
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.docs-index-heading p {
    color: var(--text-secondary);
    max-width: 600px;
}

.docs-section-title {
    font-size: clamp(1.2rem, 5vw, 1.5rem);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-primary);
    font-weight: 700;
}

.docs-recent-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.docs-mobile-btn {
    background: var(--surface);
    color: var(--accent-cyan);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    font-family: var(--font-heading);
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.docs-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
}

.docs-sidebar-backdrop.active {
    display: block;
}

@media (max-width: 900px) {
    .docs-container {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }

    .docs-mobile-header {
        display: flex;
        gap: 10px;
    }

    .docs-mobile-btn {
        flex: 1;
        font-size: 0.9rem;
        width: auto;
    }

    .docs-mobile-all-articles-btn {
        flex: 1;
        text-align: center;
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    .docs-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: min(85vw, 300px);
        height: 100dvh;
        background: var(--bg-color);
        z-index: 1002;
        transition: left 0.3s ease;
        padding: 2rem;
        border-right: 1px solid var(--border-color);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    }

    .docs-sidebar.active {
        left: 0;
    }

    .docs-main {
        padding: 0 0.75rem;
    }

    .article-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .article-body {
        max-width: 100%;
    }

    .article-content {
        font-size: 1rem;
        line-height: 1.7;
        max-width: 100%;
    }

    .article-content pre {
        padding: 0.75rem;
        font-size: 0.7rem;
        margin-bottom: 1.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .article-content pre code {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .article-content code {
        word-break: break-word;
    }

    .article-content table {
        font-size: 0.85rem;
    }

    .article-content table th,
    .article-content table td {
        padding: 0.5rem 0.75rem;
    }

    .article-toc-rail {
        display: none;
    }

    .article-toc-handle {
        display: none;
    }
}

/* Global Search Overlay */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 16, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.search-overlay.active {
    display: flex;
}

.search-modal {
    width: 100%;
    max-width: 600px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    margin: 0 1rem;
}

.search-modal input {
    width: 100%;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-family: var(--font-body);
    outline: none;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.search-results a {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.search-results a:hover,
.search-results a.active {
    background: rgba(0, 229, 255, 0.1);
    color: var(--text-primary);
    text-shadow: none;
}

.search-result-title {
    color: var(--accent-cyan);
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.search-result-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.search-footer {
    padding: 0.8rem 1.5rem;
    background: var(--surface-hover);
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
/* =============================================
   Article Quiz Section
   ============================================= */

.article-quiz {
    margin-top: 3rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: rgba(0, 229, 255, 0.03);
    position: relative;
}

.article-quiz::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-cyan), var(--accent-green));
    border-radius: 4px 0 0 4px;
}

.quiz-title {
    font-family: var(--font-heading);
    color: var(--accent-cyan);
    font-size: 1.1rem;
    margin-bottom: 1.75rem;
    letter-spacing: 1px;
}

.quiz-questions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-item {
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.quiz-item.correct {
    border-color: rgba(0, 255, 65, 0.4);
    background: rgba(0, 255, 65, 0.04);
}

.quiz-item.incorrect {
    border-color: rgba(255, 0, 85, 0.3);
}

.quiz-num {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    margin-right: 0.4rem;
}

.quiz-question {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.9rem;
    line-height: 1.5;
}

.quiz-input-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.quiz-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 0.6rem 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
    min-width: 0;
}

.quiz-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
}

.quiz-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.quiz-check-btn {
    white-space: nowrap;
    padding: 0.55rem 1.2rem;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.quiz-feedback {
    margin-top: 0.75rem;
    font-size: 0.88rem;
    font-family: var(--font-mono);
    min-height: 1.2em;
    line-height: 1.4;
}

.quiz-feedback.correct {
    color: var(--accent-green);
}

.quiz-feedback.incorrect {
    color: var(--accent-red);
}

.quiz-reset-btn {
    margin-top: 1.5rem;
    background: transparent;
    border: 1px solid rgba(0, 229, 255, 0.25);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.45rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-reset-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

@media (max-width: 600px) {
    .article-quiz {
        padding: 1.25rem;
    }

    .quiz-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-check-btn {
        width: 100%;
    }
}
