/* mujun.wiki — Wiki Encyclopedia Layout */

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

:root {
    --white: #ffffff;
    --bg-light: #f5f5f5;
    --bg-infobox: #e8e8e8;
    --border: #d0d0d0;
    --border-light: #e0e0e0;
    --text-dark: #202020;
    --text-muted: #888888;
    --link-blue: #2266cc;
    --link-red: #cc2222;
    --link-visited: #6633aa;
    --search-highlight: #eef4ff;
    --infobox-row: #f8f8f8;
}

body {
    background: var(--white);
    color: var(--text-dark);
    font-family: 'Source Serif 4', serif;
    font-size: clamp(0.95rem, 1vw, 1.05rem);
    line-height: 1.7;
}

/* Wiki Header */
#wiki-header {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 16px;
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-logo {
    font-size: 1.2rem;
    color: var(--text-dark);
}

.header-title {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
}

.header-search {
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    background: var(--white);
    color: var(--text-dark);
    outline: none;
}

.search-input:focus {
    border-color: var(--link-blue);
}

.header-nav {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.nav-link {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.8rem;
    color: var(--link-blue);
    text-decoration: none;
}

.nav-link:hover {
    text-decoration: underline;
}

/* Wiki Layout */
#wiki-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
}

/* Sidebar */
#wiki-sidebar {
    position: sticky;
    top: 48px;
    height: calc(100vh - 48px);
    overflow-y: auto;
    border-right: 1px solid var(--border-light);
    background: var(--bg-light);
    padding: 16px 12px;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-heading {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-links {
    list-style: none;
}

.sidebar-links li {
    margin-bottom: 4px;
}

.sidebar-link {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.82rem;
    color: var(--link-blue);
    text-decoration: none;
}

.sidebar-link:hover {
    text-decoration: underline;
}

.stat-line {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Navigation Tree */
.nav-tree {
    margin-bottom: 6px;
}

.nav-tree summary {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    padding: 3px 0;
    list-style-type: none;
}

.nav-tree summary::before {
    content: '\25B6 ';
    font-size: 0.6rem;
    margin-right: 4px;
    display: inline-block;
    transition: transform 0.2s;
}

.nav-tree[open] summary::before {
    content: '\25BC ';
}

.tree-list {
    list-style: none;
    padding-left: 18px;
    margin-top: 2px;
}

.tree-list li {
    margin-bottom: 2px;
}

.tree-link {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.8rem;
    color: var(--link-blue);
    text-decoration: none;
}

.tree-link:hover {
    text-decoration: underline;
}

.tree-link.red-link,
.wiki-link.red-link {
    color: var(--link-red);
}

/* Article Content */
#wiki-content {
    padding: 20px 24px 60px;
    max-width: 900px;
}

.article-title {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(1.6rem, 2.5vw, 2rem);
    font-weight: 400;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.article-meta {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 20px;
}

/* Infobox */
.infobox {
    float: right;
    width: 260px;
    margin: 0 0 16px 20px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    font-size: 0.85rem;
}

.infobox-header {
    background: var(--bg-infobox);
    padding: 8px 12px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 700;
    text-align: center;
    font-size: 0.95rem;
}

.infobox-table {
    width: 100%;
    border-collapse: collapse;
}

.infobox-table tr {
    border-bottom: 1px solid var(--border-light);
}

.infobox-table tr:nth-child(even) {
    background: var(--white);
}

.infobox-table tr:nth-child(odd) {
    background: var(--bg-light);
}

.infobox-label {
    padding: 5px 10px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-dark);
    width: 90px;
    vertical-align: top;
}

.infobox-value {
    padding: 5px 10px;
    font-family: 'Source Serif 4', serif;
    font-size: 0.82rem;
}

/* Table of Contents */
.article-toc {
    background: var(--bg-light);
    border: 1px solid var(--border);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: inline-block;
    min-width: 220px;
}

.toc-title {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.toc-toggle {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--link-blue);
    cursor: pointer;
}

.toc-list {
    padding-left: 24px;
}

.toc-list li {
    margin-bottom: 3px;
}

.toc-link {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.82rem;
    color: var(--link-blue);
    text-decoration: none;
}

.toc-link:hover {
    text-decoration: underline;
}

/* Article Sections */
.article-section {
    margin-bottom: 24px;
}

.section-heading {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
    margin-bottom: 12px;
}

.wiki-link {
    color: var(--link-blue);
    text-decoration: none;
}

.wiki-link:hover {
    text-decoration: underline;
}

.ref-sup {
    font-size: 0.7em;
    vertical-align: super;
    color: var(--link-blue);
    cursor: pointer;
}

/* Blockquote */
.article-blockquote {
    margin: 16px 0 16px 24px;
    padding: 8px 16px;
    border-left: 3px solid var(--border);
    color: var(--text-dark);
}

.article-blockquote p {
    font-style: italic;
    margin-bottom: 4px;
}

.article-blockquote cite {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: normal;
}

/* Formula */
.formula-display {
    text-align: center;
    font-family: 'Source Code Pro', monospace;
    font-size: 1.05rem;
    padding: 12px;
    margin: 16px 0;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
}

/* See Also */
.see-also-list {
    padding-left: 24px;
}

.see-also-list li {
    margin-bottom: 4px;
}

/* References */
.references-list {
    padding-left: 24px;
    font-size: 0.85rem;
}

.references-list li {
    margin-bottom: 6px;
}

.ref-text {
    color: var(--text-muted);
}

.ref-text i {
    font-style: italic;
}

/* Article Footer */
.article-footer {
    margin-top: 40px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Scrollbar */
#wiki-sidebar::-webkit-scrollbar {
    width: 4px;
}

#wiki-sidebar::-webkit-scrollbar-track {
    background: var(--bg-light);
}

#wiki-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    #wiki-layout {
        grid-template-columns: 1fr;
    }

    #wiki-sidebar {
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }

    .infobox {
        float: none;
        width: 100%;
        margin: 0 0 16px 0;
    }

    .header-nav {
        display: none;
    }
}
