/* EEG Article Styles - Scoped to .eeg-article */

/* Remove container constraints for full-width background */
.content-container.container:has(.eeg-article) {
    padding: 0;
    max-width: none;
}

/* Article container with dark theme */
.eeg-article {
    --eeg-color-bg: #0f1419;
    --eeg-color-surface: #1a1f26;
    --eeg-color-surface-alt: #242a33;
    --eeg-color-border: #2f3640;
    --eeg-color-text: #e6edf3;
    --eeg-color-text-muted: #8b949e;
    --eeg-color-accent: #58a6ff;
    --eeg-color-accent-secondary: #7ee787;
    --eeg-color-warning: #f0883e;
    --eeg-color-code-bg: #161b22;
    --eeg-max-width: 820px;

    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 19px;
    line-height: 1.7;
    color: var(--eeg-color-text);
    padding: 60px 20px 100px;
    max-width: var(--eeg-max-width);
    margin: 0 auto;
    position: relative;
}

/* Full-width background using pseudo-element */
.eeg-article::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    background: var(--eeg-color-bg);
    z-index: -1;
}

/* Header (article header, not site header) */
.eeg-article > header {
    margin-bottom: 50px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--eeg-color-border);
}

.eeg-article h1 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--eeg-color-text) 0%, var(--eeg-color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.eeg-article .subtitle {
    font-size: 1.25rem;
    color: var(--eeg-color-text-muted);
    font-style: italic;
}

.eeg-article .meta {
    margin-top: 20px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.9rem;
    color: var(--eeg-color-text-muted);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.eeg-article .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Headings */
.eeg-article h2 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    margin: 50px 0 20px;
    color: var(--eeg-color-accent);
    position: relative;
    padding-left: 18px;
}

.eeg-article h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    background: var(--eeg-color-accent);
    border-radius: 2px;
}

.eeg-article h3 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 35px 0 15px;
    color: var(--eeg-color-text);
}

/* Text elements */
.eeg-article p {
    margin-bottom: 18px;
}

.eeg-article a {
    color: var(--eeg-color-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.eeg-article a:hover {
    border-bottom-color: var(--eeg-color-accent);
}

/* Code */
.eeg-article code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: var(--eeg-color-code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--eeg-color-accent-secondary);
}

.eeg-article pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    background: var(--eeg-color-code-bg);
    padding: 20px 24px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid var(--eeg-color-border);
    line-height: 1.5;
}

.eeg-article pre code {
    background: none;
    padding: 0;
    color: var(--eeg-color-text);
    font-family: 'JetBrains Mono', monospace;
}

/* Override highlight.js theme to match article */
.eeg-article pre code.hljs {
    background: transparent;
    padding: 0;
}

/* Highlight box */
.eeg-article .highlight {
    background: linear-gradient(135deg, var(--eeg-color-surface) 0%, var(--eeg-color-surface-alt) 100%);
    padding: 24px 28px;
    border-radius: 12px;
    margin: 30px 0;
    border-left: 4px solid var(--eeg-color-accent);
}

.eeg-article .highlight p:last-child {
    margin-bottom: 0;
}

/* Repository callout */
.eeg-article .repo-callout {
    background: linear-gradient(135deg, rgba(126, 231, 135, 0.1) 0%, rgba(88, 166, 255, 0.1) 100%);
    border: 1px solid var(--eeg-color-accent-secondary);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 30px;
    text-align: center;
}

.eeg-article .repo-callout p {
    margin: 0;
    font-size: 1.05rem;
}

.eeg-article .repo-callout a {
    color: var(--eeg-color-accent-secondary);
    font-weight: 600;
}

/* Lists */
.eeg-article ul,
.eeg-article ol {
    margin: 18px 0;
    padding-left: 28px;
}

.eeg-article li {
    margin-bottom: 10px;
}

/* Tables */
.eeg-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.95rem;
}

.eeg-article th,
.eeg-article td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--eeg-color-border);
}

.eeg-article th {
    background: var(--eeg-color-surface);
    font-weight: 600;
    color: var(--eeg-color-accent);
}

.eeg-article tr:hover {
    background: var(--eeg-color-surface);
}

/* Compact tables for label mappings */
.eeg-article table.table-compact {
    font-size: 0.8rem;
}

.eeg-article table.table-compact th,
.eeg-article table.table-compact td {
    padding: 6px 10px;
}

.eeg-article table.table-compact td:first-child {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--eeg-color-text-muted);
}

.eeg-article table.table-compact td:nth-child(2) {
    font-family: 'JetBrains Mono', monospace;
    color: var(--eeg-color-accent-secondary);
}

/* Pipeline diagram */
.eeg-article .pipeline-diagram {
    background: var(--eeg-color-surface);
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
}

.eeg-article .pipeline-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.eeg-article .pipeline-step {
    background: var(--eeg-color-surface-alt);
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid var(--eeg-color-border);
    white-space: nowrap;
}

.eeg-article .pipeline-arrow {
    color: var(--eeg-color-accent);
    font-weight: bold;
}

.eeg-article .section-number {
    font-size: 0.8em;
    color: var(--eeg-color-text-muted);
    margin-right: 8px;
}

/* Figures */
.eeg-article figure {
    margin: 30px 0;
    text-align: center;
}

.eeg-article figure img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--eeg-color-border);
    background: var(--eeg-color-surface);
}

.eeg-article .eeg-montage-image {
    background: white;
}

.eeg-article figcaption {
    font-size: 0.9rem;
    color: var(--eeg-color-text-muted);
    margin-top: 12px;
    font-style: italic;
}

/* Note box */
.eeg-article .note {
    background: rgba(240, 136, 62, 0.1);
    border-left: 4px solid var(--eeg-color-warning);
    padding: 16px 20px;
    margin: 24px 0;
    border-radius: 0 8px 8px 0;
}

.eeg-article .note strong {
    color: var(--eeg-color-warning);
}

/* Results box */
.eeg-article .results-box {
    background: var(--eeg-color-surface);
    padding: 24px;
    border-radius: 12px;
    margin: 24px 0;
}

.eeg-article .results-box h4 {
    font-family: 'Source Sans 3', sans-serif;
    color: var(--eeg-color-accent-secondary);
    margin-bottom: 12px;
}

/* Table of contents */
.eeg-article .toc {
    background: var(--eeg-color-surface);
    padding: 24px 28px;
    border-radius: 12px;
    margin: 30px 0;
}

.eeg-article .toc h3 {
    margin-top: 0;
    color: var(--eeg-color-accent);
}

.eeg-article .toc ol {
    margin: 0;
    padding-left: 20px;
}

.eeg-article .toc li {
    margin-bottom: 6px;
}

/* Article footer (not site footer) */
.eeg-article > footer {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--eeg-color-border);
    color: var(--eeg-color-text-muted);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.9rem;
    background: transparent;
}

/* Dataset summary table with percentage bars */
.eeg-article table.dataset-summary {
    margin-top: 16px;
}

.eeg-article table.dataset-summary td:first-child {
    width: 70px;
}

.eeg-article table.dataset-summary td:nth-child(2) {
    color: var(--eeg-color-text-muted);
    font-size: 0.85rem;
}

.eeg-article table.dataset-summary td:nth-child(3) {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    width: 80px;
}

.eeg-article table.dataset-summary td:nth-child(4) {
    width: 140px;
}

.eeg-article table.dataset-summary .bar {
    display: inline-block;
    position: relative;
    width: 100%;
    background: var(--eeg-color-surface-alt);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--eeg-color-text);
    overflow: hidden;
}

.eeg-article table.dataset-summary .bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--pct);
    background: linear-gradient(90deg, var(--eeg-color-accent) 0%, var(--eeg-color-accent-secondary) 100%);
    opacity: 0.3;
    border-radius: 4px;
}

.eeg-article table.dataset-summary tfoot td {
    border-top: 2px solid var(--eeg-color-border);
    font-weight: 600;
}

.eeg-article table.dataset-summary tfoot td:nth-child(2) {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
}

/* Metrics grid for side-by-side charts */
.eeg-article .metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 30px 0 20px;
}

.eeg-article .metrics-grid figure {
    margin: 0;
}

.eeg-article .metrics-grid img {
    width: 100%;
    height: auto;
}

.eeg-article .metrics-grid figcaption {
    font-size: 0.85rem;
    margin-top: 10px;
}

.eeg-article .training-note {
    text-align: center;
    color: var(--eeg-color-text-muted);
    font-size: 0.95rem;
    margin-top: 10px;
}

/* Metrics explanation diagram */
.eeg-article figure.metrics-explanation {
    margin: 30px 0;
}

.eeg-article figure.metrics-explanation svg {
    border-radius: 8px;
    border: 1px solid var(--eeg-color-border);
}

/* Metrics table */
.eeg-article table.metrics-table {
    margin: 24px 0;
}

.eeg-article table.metrics-table td:first-child {
    white-space: nowrap;
}

.eeg-article table.metrics-table td:last-child {
    color: var(--eeg-color-text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    .eeg-article {
        font-size: 17px;
        padding: 40px 15px 60px;
    }

    .eeg-article h1 {
        font-size: 2rem;
    }

    .eeg-article h2 {
        font-size: 1.5rem;
    }

    .eeg-article .pipeline-flow {
        flex-direction: column;
    }

    .eeg-article .pipeline-arrow {
        transform: rotate(90deg);
    }

    .eeg-article .metrics-grid {
        grid-template-columns: 1fr;
    }
}
