/* ============================================================
   REPORT THEME — RI-ECOSYS Technical Reports
   Shared CSS for all TR-* reports
   ============================================================ */

/* ── Design Tokens ── */
:root {
    --bg-page: #faf9f7;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f3f1ec;
    --bg-code: #f3f4f6;
    --bg-badge: #f0fdf4;
    --accent: #0d7377;
    --accent-l: rgba(13, 115, 119, 0.08);
    --accent-dark: #084d3e;
    --learn: #2563eb;
    --learn-l: rgba(37, 99, 235, 0.08);
    --observe: #d97706;
    --observe-l: rgba(217, 119, 6, 0.08);
    --explore: #7c3aed;
    --explore-l: rgba(124, 58, 237, 0.08);
    --txt: #111827;
    --txt2: #4b5563;
    --txt3: #9ca3af;
    --border: #e5e7eb;
    --border2: #d1d5db;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --radius: 8px;
    --radius-lg: 12px;
    --f-brand: 'DM Serif Display', serif;
    --f-head: 'Figtree', sans-serif;
    --f-body: 'Crimson Pro', serif;
    --f-mono: 'JetBrains Mono', monospace;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark {
    --bg-page: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-alt: #2a2a27;
    --bg-code: #1e293b;
    --bg-badge: #064e3b;
    --accent: #14b8a6;
    --accent-l: rgba(20, 184, 166, 0.12);
    --accent-dark: #5eecd8;
    --txt: #e2e8f0;
    --txt2: #94a3b8;
    --txt3: #475569;
    --border: #334155;
    --border2: #475569;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--f-body);
    color: var(--txt);
    background: var(--bg-page);
    line-height: 1.7;
    font-size: 17px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Skip Link ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border-radius: 0 0 var(--radius) var(--radius);
    font-family: var(--f-head);
    font-size: 14px;
    z-index: 999;
}

.skip-link:focus {
    top: 0;
}

/* ── Container ── */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ── */
.site-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg-surface) 85%, transparent);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.site-header .logo {
    font-family: var(--f-brand);
    font-size: 20px;
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-header .logo span {
    color: var(--txt3);
    font-weight: 400;
    font-size: 14px;
}

.site-header .nav-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.site-header .nav-links a {
    font-family: var(--f-head);
    font-size: 13px;
    color: var(--txt2);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.site-header .nav-links a:hover,
.site-header .nav-links a.active {
    color: var(--accent);
    background: var(--accent-l);
}

.site-header .lang-switch {
    display: flex;
    gap: 4px;
}

.site-header .lang-switch a {
    font-family: var(--f-head);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius);
    color: var(--txt3);
    text-decoration: none;
    transition: all var(--transition);
}

.site-header .lang-switch a:hover {
    color: var(--txt2);
}

.site-header .lang-switch a.active {
    color: var(--accent);
    background: var(--accent-l);
}

@media (max-width: 700px) {
    .site-header .container {
        flex-direction: column;
        align-items: stretch;
    }

    .site-header .logo {
        justify-content: center;
    }

    .site-header .nav-links {
        justify-content: center;
    }

    .site-header .lang-switch {
        justify-content: center;
    }
}

/* ── Breadcrumb ── */
.breadcrumb {
    padding: 12px 0;
    font-family: var(--f-head);
    font-size: 13px;
    color: var(--txt3);
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.breadcrumb .container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--txt2);
}

/* ── Report Header ── */
.report-header {
    padding: 40px 0 24px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 32px;
}

.report-header h1 {
    font-family: var(--f-brand);
    font-size: clamp(28px, 4vw, 42px);
    color: var(--txt);
    line-height: 1.2;
    margin-bottom: 8px;
}

.report-header .subtitle {
    font-family: var(--f-head);
    font-size: 17px;
    color: var(--txt2);
    font-weight: 400;
    margin-bottom: 16px;
}

.report-header .metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    font-size: 14px;
    color: var(--txt2);
}

.report-header .metadata .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-header .metadata .meta-label {
    color: var(--txt3);
    font-weight: 500;
}

.report-header .metadata .meta-value {
    color: var(--txt);
}

.report-header .metadata .badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 10px;
    border-radius: 4px;
    background: var(--bg-badge);
    color: var(--success);
}

.report-header .metadata .badge.draft {
    background: var(--observe-l);
    color: var(--warning);
}

/* ── Executive Summary ── */
.executive-summary {
    background: var(--accent-l);
    border-left: 4px solid var(--accent);
    padding: 20px 24px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 24px 0 32px;
}

.executive-summary h2 {
    font-family: var(--f-head);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.executive-summary p {
    font-size: 16px;
    color: var(--txt2);
    line-height: 1.7;
}

/* ── Table of Contents ── */
.toc-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 24px 0 32px;
}

.toc-container h3 {
    font-family: var(--f-head);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--txt3);
    margin-bottom: 12px;
}

.toc-container ol {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: 32px;
}

.toc-container ol li {
    padding: 4px 0;
    break-inside: avoid;
    font-family: var(--f-head);
    font-size: 14px;
}

.toc-container ol li a {
    color: var(--txt2);
    text-decoration: none;
    transition: color var(--transition);
}

.toc-container ol li a:hover {
    color: var(--accent);
}

@media (max-width: 600px) {
    .toc-container ol {
        columns: 1;
    }
}

/* ── Content Sections ── */
.content-section {
    padding: 0 0 40px;
}

.content-section h2 {
    font-family: var(--f-head);
    font-size: 24px;
    font-weight: 700;
    color: var(--txt);
    margin: 40px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.content-section h3 {
    font-family: var(--f-head);
    font-size: 19px;
    font-weight: 600;
    color: var(--txt);
    margin: 28px 0 12px;
}

.content-section h4 {
    font-family: var(--f-head);
    font-size: 16px;
    font-weight: 600;
    color: var(--txt);
    margin: 20px 0 8px;
}

.content-section p {
    margin-bottom: 16px;
    color: var(--txt2);
    line-height: 1.8;
}

.content-section ul,
.content-section ol {
    margin: 0 0 20px 24px;
    color: var(--txt2);
}

.content-section li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.content-section li ul,
.content-section li ol {
    margin-bottom: 0;
    margin-top: 4px;
}

.content-section strong {
    color: var(--txt);
}

.content-section code {
    font-family: var(--f-mono);
    background: var(--bg-code);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent);
    border: 1px solid var(--border);
}

.content-section pre {
    background: var(--bg-code);
    padding: 16px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
    font-family: var(--f-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--txt2);
    border: 1px solid var(--border);
}

.content-section pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: 13px;
    color: var(--txt2);
}

.content-section blockquote {
    border-left: 4px solid var(--accent);
    padding: 12px 20px;
    margin: 20px 0;
    background: var(--accent-l);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--txt2);
}

.content-section blockquote strong {
    color: var(--accent);
    font-style: normal;
}

.content-section .quote {
    border-left: 4px solid var(--accent);
    padding: 12px 20px;
    margin: 20px 0;
    background: var(--accent-l);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--txt2);
    font-size: 16px;
}

.content-section .quote strong {
    color: var(--accent);
    font-style: normal;
}

/* ── Diagrams ── */
.content-section .diagram {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 32px;
    margin: 20px 0;
    font-family: var(--f-mono);
    font-size: 14px;
    line-height: 2;
    text-align: center;
    overflow-x: auto;
    color: var(--txt2);
}

.content-section .diagram .highlight {
    color: var(--accent);
    font-weight: 600;
}

/* ── Navigation Footer ── */
.nav-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0 16px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
    font-family: var(--f-head);
    font-size: 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.nav-footer a {
    color: var(--accent);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.nav-footer a:hover {
    background: var(--accent-l);
    text-decoration: none;
}

.nav-footer .disabled {
    color: var(--txt3);
    padding: 6px 12px;
}

/* ── Footer ── */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 24px 0;
    margin-top: 40px;
    text-align: center;
}

.site-footer p {
    font-size: 13px;
    color: var(--txt3);
    margin: 4px 0;
}

.site-footer a {
    color: var(--accent);
}

/* ── Report Cards (for index page) ── */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.report-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--txt);
    display: block;
    position: relative;
    overflow: hidden;
}

.report-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.report-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.report-card:hover::before {
    opacity: 1;
}

.report-card .report-id {
    font-family: var(--f-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.report-card .report-title {
    font-family: var(--f-head);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    color: var(--txt);
}

.report-card .report-desc {
    font-size: 14px;
    color: var(--txt2);
    line-height: 1.6;
    margin-bottom: 12px;
}

.report-card .report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--txt3);
}

.report-card .report-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-code);
    padding: 2px 10px;
    border-radius: 12px;
}

.report-card .report-meta .badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
}

.badge-published {
    background: var(--bg-badge);
    color: var(--success);
}

.badge-draft {
    background: var(--observe-l);
    color: var(--warning);
}

.report-card .lang-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--learn-l);
    color: var(--info);
}

/* ── Stack Diagram ── */
.stack-diagram {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin: 24px 0;
    text-align: center;
}

.stack-diagram .stack-label {
    font-family: var(--f-head);
    font-size: 11px;
    color: var(--txt3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.stack-diagram .stack-item {
    display: inline-block;
    padding: 10px 24px;
    margin: 4px;
    border-radius: var(--radius);
    font-family: var(--f-head);
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-code);
    border: 1px solid var(--border);
    color: var(--txt2);
}

.stack-diagram .stack-item.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-l);
}

.stack-diagram .stack-arrow {
    color: var(--txt3);
    font-size: 18px;
    margin: 0 4px;
    display: inline-block;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--txt3);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }

    .report-header h1 {
        font-size: 24px;
    }

    .report-header .metadata {
        flex-direction: column;
        gap: 8px;
    }

    .content-section h2 {
        font-size: 20px;
    }

    .content-section .diagram {
        padding: 16px;
        font-size: 12px;
        line-height: 1.8;
    }

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

    .nav-footer {
        flex-direction: column;
        text-align: center;
    }

    .stack-diagram .stack-item {
        display: block;
        margin: 6px auto;
        width: fit-content;
    }

    .stack-diagram .stack-arrow {
        display: block;
        transform: rotate(90deg);
        margin: 2px auto;
    }
}