/* Wikipedia-style CSS */

:root {
    --wiki-bg: #ffffff;
    --wiki-border: #a2a9b1;
    --wiki-gray-bg: #f8f9fa;
    --wiki-link: #0645ad;
    --wiki-link-visited: #0b0080;
    --wiki-link-hover: #0b0080;
    --wiki-heading: #000000;
    --wiki-text: #202122;
}

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

body {
    font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--wiki-text);
    background: var(--wiki-bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.wiki-header {
    background: var(--wiki-gray-bg);
    border-bottom: 1px solid var(--wiki-border);
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.wiki-site-title {
    font-family: 'Linux Libertine', serif;
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    color: var(--wiki-text);
}

.wiki-logo-img {
    max-width: 250px;
    height: auto;
    margin-bottom: 0.25rem;
}

.wiki-tagline {
    font-family: 'Linux Libertine', serif;
    font-size: 0.85rem;
    color: #54595d;
    font-style: italic;
}

/* Main Content Layout */
.wiki-content {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: flex-start;
}

/* Article */
.article {
    flex: 1;
    min-width: 0;
}

/* Infobox */
.infobox {
    flex-shrink: 0;
    width: 300px;
    background: var(--wiki-gray-bg);
    border: 1px solid var(--wiki-border);
    font-size: 0.875rem;
    position: sticky;
    top: 10px;
    align-self: start;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

.article-title {
    font-family: 'Linux Libertine', serif;
    font-size: 2rem;
    font-weight: normal;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--wiki-border);
    padding-bottom: 0.5rem;
}

.article-intro {
    margin-bottom: 1.5rem;
}

.article-intro p:first-child::first-line {
    font-weight: 600;
}

/* Links */
a {
    color: var(--wiki-link);
    text-decoration: none;
}

a:visited {
    color: var(--wiki-link-visited);
}

a:hover {
    text-decoration: underline;
}

/* Infobox */
.infobox {
    flex-shrink: 0;
    width: 300px;
    background: var(--wiki-gray-bg);
    border: 1px solid var(--wiki-border);
    font-size: 0.875rem;
    position: sticky;
    top: 10px;
    align-self: start;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

.infobox-title {
    background: #d3d3d3;
    padding: 0.5rem;
    font-weight: bold;
    text-align: center;
    font-size: 1rem;
}

.infobox-image {
    padding: 1rem;
    text-align: center;
    background: white;
}

.infobox-image img {
    max-width: 100%;
    height: auto;
}

.infobox-caption {
    font-size: 0.8rem;
    color: #54595d;
    margin-top: 0.5rem;
}

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

.infobox-table th {
    background: #eaecf0;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    vertical-align: top;
    width: 40%;
}

.infobox-table td {
    padding: 0.5rem;
    border-top: 1px solid var(--wiki-border);
}

.infobox-links {
    padding: 0.75rem;
    border-top: 1px solid var(--wiki-border);
}

.infobox-link-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.infobox-links a {
    display: block;
    margin: 0.25rem 0;
}

/* CA Box in Infobox */
.ca-box-wiki-top {
    padding: 1rem;
    background: #fffbea;
    border: 2px solid #fc3;
    border-left: 5px solid #fc3;
}

.ca-label-wiki {
    font-size: 0.75rem;
    font-weight: 800;
    color: #c93;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    display: block;
    text-transform: uppercase;
}

.ca-box-wiki-top code {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    background: white;
    padding: 0.75rem;
    border: 1px solid #fc3;
    border-radius: 3px;
    word-break: break-all;
    margin-bottom: 0.75rem;
    color: #000;
    font-weight: 600;
}

.copy-btn-wiki {
    width: 100%;
    padding: 0.75rem;
    background: #0645ad;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: background 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.copy-btn-wiki:hover {
    background: #0b0080;
}

.ca-box-wiki {
    padding: 0.75rem;
    border-top: 2px solid var(--wiki-border);
    background: white;
}

.ca-box-wiki code {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    background: #f8f9fa;
    padding: 0.5rem;
    border: 1px solid var(--wiki-border);
    border-radius: 3px;
    word-break: break-all;
    margin-bottom: 0.5rem;
}

/* Table of Contents */
.toc {
    background: var(--wiki-gray-bg);
    border: 1px solid var(--wiki-border);
    padding: 1rem;
    margin: 1.5rem 0;
    display: inline-block;
    min-width: 300px;
}

.toc-title {
    font-weight: bold;
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.toc-list {
    list-style: none;
    counter-reset: section;
}

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

.toc-list > li::before {
    content: counter(section) " ";
    font-weight: bold;
}

.toc-list ol {
    list-style: none;
    counter-reset: subsection;
    margin-left: 1.5rem;
}

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

.toc-list ol li::before {
    content: counter(section) "." counter(subsection) " ";
}

.toc a {
    color: var(--wiki-link);
}

/* Headings */
h2 {
    font-family: 'Linux Libertine', serif;
    font-size: 1.6rem;
    font-weight: normal;
    margin: 1.5rem 0 0.75rem 0;
    border-bottom: 1px solid var(--wiki-border);
    padding-bottom: 0.3rem;
}

h3 {
    font-family: 'Linux Libertine', serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem 0;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section p {
    margin-bottom: 0.75rem;
}

/* Hatnote */
.hatnote {
    background: var(--wiki-gray-bg);
    border-left: 3px solid #a2a9b1;
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    font-style: italic;
}

/* Figure */
.figure-right {
    float: right;
    margin: 0 0 1rem 1rem;
    max-width: 300px;
}

.figure-box {
    background: var(--wiki-gray-bg);
    border: 1px solid var(--wiki-border);
    padding: 0.5rem;
}

.figure-caption {
    font-size: 0.85rem;
    color: #54595d;
    margin-top: 0.5rem;
    text-align: center;
}

/* Blockquote */
.wiki-quote {
    background: var(--wiki-gray-bg);
    border-left: 4px solid #0645ad;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
}

.wiki-quote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-style: normal;
    color: #54595d;
}

/* Lists */
.wiki-list {
    margin: 1rem 0 1rem 2rem;
}

.wiki-list li {
    margin: 0.5rem 0;
}

/* Tables */
.comparison-table-section {
    margin: 1.5rem 0;
}

.wiki-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--wiki-border);
    margin: 1rem 0;
    background: var(--wiki-bg);
}

.wiki-table thead {
    background: var(--wiki-gray-bg);
}

.wiki-table th,
.wiki-table td {
    border: 1px solid var(--wiki-border);
    padding: 0.5rem;
    text-align: left;
}

.wiki-table th {
    font-weight: 600;
}

/* Note Box */
.note-box {
    background: #fef6e7;
    border: 1px solid #fc3;
    border-left: 5px solid #fc3;
    padding: 1rem;
    margin: 1.5rem 0;
}

.note-box strong {
    color: #c93;
}

/* References */
.references {
    font-size: 0.85rem;
    list-style-position: inside;
}

.references li {
    margin: 0.5rem 0;
}

/* Superscript references */
sup {
    font-size: 0.75em;
}

sup a {
    color: var(--wiki-link);
}

/* Categories */
.categories {
    margin-top: 3rem;
    padding: 1rem;
    background: var(--wiki-gray-bg);
    border-top: 1px solid var(--wiki-border);
    font-size: 0.9rem;
}

.categories a {
    margin: 0 0.5rem;
}

/* Footer */
.wiki-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    background: var(--wiki-gray-bg);
    border-top: 1px solid var(--wiki-border);
    text-align: center;
    font-size: 0.85rem;
    color: #54595d;
}

.wiki-footer p {
    margin: 0.5rem 0;
}

.wiki-footer .disclaimer {
    font-style: italic;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--wiki-border);
}

/* Responsive */
@media (max-width: 1024px) {
    .wiki-content {
        flex-direction: column;
    }
    
    .infobox {
        position: static;
        width: 100%;
        max-width: 400px;
        margin: 0 auto 2rem;
        order: -1;
    }
    
    .article {
        max-width: 100%;
    }
    
    .figure-right {
        float: none;
        margin: 1rem auto;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .article-title {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .wiki-logo-img {
        max-width: 200px;
    }
    
    .toc {
        width: 100%;
    }
    
    .wiki-table {
        font-size: 0.85rem;
    }
}
