/* =========================================================================
   DOCUMENTATION SECTION - Modern Native Styles
   ========================================================================= */

/* --- Per-file token block: light defaults --- */
:root {
  --doc-bg: #ffffff;
  --doc-surface: #fafafa;
  --doc-text-primary: #1a1a1a;
  --doc-text-secondary: #333;
  --doc-text-muted: #666;
  --doc-text-dim: #999;
  --doc-border: #e0e0e0;
  --doc-border-subtle: #d0d0d0;
  --doc-heading: #1a1a1a;
  --doc-link: #2175d9;
  --doc-link-hover: #1648b5;
  --doc-code-bg: #f5f5f5;
  --doc-code-text: #333;
}

/* --- Dark-mode token overrides --- */
[data-theme="dark"] {
  --doc-bg: #0f172a;
  --doc-surface: #1e293b;
  --doc-text-primary: #f1f5f9;
  --doc-text-secondary: #cbd5e1;
  --doc-text-muted: #94a3b8;
  --doc-text-dim: #64748b;
  --doc-border: #334155;
  --doc-border-subtle: rgba(255,255,255,0.1);
  --doc-heading: #f1f5f9;
  --doc-link: #60a5fa;
  --doc-link-hover: #93c5fd;
  --doc-code-bg: #1e293b;
  --doc-code-text: #e2e8f0;
}

/* ============================================================
   Dark-mode contrast lift for accent-colored headings
   The literals #0A2E5C (dark navy) read as near-invisible on dark
   backgrounds. In dark mode, lift to a light brand-blue family.
   Pastel callout boxes (with their own light backgrounds) keep
   their dark accent text — those are legible on pastel bg in
   both themes and stay semantic per FR-010.
   ============================================================ */
[data-theme="dark"] .doc-section h2,
[data-theme="dark"] .feature-card h4,
[data-theme="dark"] .breakdown-col h4,
[data-theme="dark"] .algorithm-card h4,
[data-theme="dark"] .transparency-card h4 {
    color: #93c5fd;
}

/* Main Wrapper */
.doc-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--doc-surface);
}

/* Sticky Header */
.doc-sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--doc-bg);
    border-bottom: 1px solid var(--doc-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.doc-header-content {
    padding: 1.25rem 3rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--doc-bg);
    border: 1.5px solid var(--doc-border-subtle);
    border-radius: 6px;
    color: var(--doc-text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-text:hover {
    border-color: #2196F3;
    color: #2196F3;
    background: var(--doc-surface);
}

.doc-main-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--doc-text-secondary);
}

/* Table of Contents Navigation */
.doc-toc-nav {
    display: flex;
    gap: 0;
    padding: 0 3rem;
    background: var(--doc-surface);
    border-top: 1px solid var(--doc-border);
    overflow-x: auto;
}

.toc-link {
    padding: 1rem 1.5rem;
    color: var(--doc-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.toc-link:hover {
    color: #2196F3;
    background: rgba(33, 150, 243, 0.05);
}

.toc-link.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
}

/* Scrollable Content */
.doc-content-scroll {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.doc-article {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem;
}

/* Hero Section */
.doc-hero {
    padding: 3rem 0 4rem;
    border-bottom: 2px solid var(--doc-border);
    margin-bottom: 4rem;
}

.doc-hero h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--doc-text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.2;
    letter-spacing: -1px;
}

.doc-lead {
    font-size: 1.25rem;
    color: var(--doc-text-secondary);
    line-height: 1.6;
    margin: 0 0 2rem 0;
}

.doc-meta {
    display: flex;
    gap: 1rem;
    color: var(--doc-text-dim);
    font-size: 0.95rem;
}

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

.doc-section h2 {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0A2E5C;
    margin: 0 0 1.5rem 0;
    scroll-margin-top: 100px;
}

.doc-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--doc-text-secondary);
    margin: 3rem 0 1rem 0;
}

.doc-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--doc-text-secondary);
    margin: 1.5rem 0 1rem 0;
}

.doc-section p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--doc-text-secondary);
    margin-bottom: 1.5rem;
}

.doc-intro {
    font-size: 1.15rem;
    color: var(--doc-text-secondary);
    line-height: 1.8;
    margin-bottom: 2.5rem;
}

.doc-list {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.doc-list li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    color: var(--doc-text-secondary);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2.5rem 0;
}

.feature-card {
    background: var(--doc-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--doc-border);
    transition: all 0.2s;
}

.feature-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #2196F3;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h4 {
    margin: 0 0 1rem 0;
    font-size: 1.15rem;
    color: #0A2E5C;
}

.feature-card p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--doc-text-muted);
}

/* Mapping Cards */
.mapping-grid {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

.mapping-card {
    background: var(--doc-surface);
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid #2196F3;
}

.mapping-label {
    font-weight: 600;
    color: var(--doc-text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mapping-example {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.variant {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--doc-bg);
    border: 1px solid var(--doc-border-subtle);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--doc-text-muted);
}

.arrow {
    font-size: 1.25rem;
    color: #2196F3;
    font-weight: bold;
}

.canonical {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #2196F3;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Callouts */
.info-callout,
.success-callout {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.info-callout {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.success-callout {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.callout-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.callout-content {
    flex: 1;
    line-height: 1.6;
}

.callout-content strong {
    color: var(--doc-text-primary);
    font-weight: 600;
}

/* Mode Cards */
.mode-card {
    background: var(--doc-bg);
    border: 1px solid var(--doc-border);
    border-radius: 8px;
    padding: 2.5rem;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--doc-border);
}

.mode-header h3 {
    margin: 0;
    font-size: 1.75rem;
}

.mode-badge {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-badge.eu {
    background: #EDE9FE;
    color: #6B21A8;
}

.mode-badge.be {
    background: #FEF3C7;
    color: #92400E;
}

.mode-badge.direct {
    background: #D1FAE5;
    color: #065F46;
}

.mode-card > p {
    margin-bottom: 2rem;
}

/* Scoring Breakdown */
.scoring-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.breakdown-col h4 {
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    color: #0A2E5C;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weight-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.weight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--doc-surface);
    border-radius: 6px;
}

.weight-badge {
    background: #2196F3;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

.bonus-badge {
    background: #4caf50;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Algorithm Grid */
.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.algorithm-card {
    background: var(--doc-surface);
    padding: 2rem;
    border-radius: 8px;
    border-top: 4px solid #2196F3;
}

.algorithm-card h4 {
    margin: 0 0 1rem 0;
    color: #0A2E5C;
}

.algorithm-card p {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.formula {
    background: var(--doc-bg);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--doc-border);
}

.formula code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #d32f2f;
}

/* Transparency Grid */
.transparency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.transparency-card {
    background: var(--doc-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--doc-border);
}

.transparency-card h4 {
    margin: 0 0 0.75rem 0;
    color: #0A2E5C;
    font-size: 1rem;
}

.transparency-card p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Tab Content Height Fix */
#documentation.tab-content {
    height: calc(100vh - 120px);
    overflow: hidden;
}

/* Responsive */
@media (max-width: 1024px) {
    .doc-article {
        padding: 2rem;
    }

    .doc-header-content {
        padding: 1rem 2rem;
    }

    .doc-toc-nav {
        padding: 0 2rem;
    }

    .doc-hero h1 {
        font-size: 2.25rem;
    }

    .doc-section h2 {
        font-size: 1.75rem;
    }
}

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

    .doc-header-content {
        padding: 1rem 1.5rem;
    }

    .doc-toc-nav {
        padding: 0 1.5rem;
    }

    .feature-grid,
    .algorithm-grid {
        grid-template-columns: 1fr;
    }

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

    .mode-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
