@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-white: #f5f5f7;       
    --bg-soft: #ffffff;        
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --accent-blue: #000000;    /* Strict Black */
    --border-color: rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(245, 245, 247, 0.82);
    --code-bg: #e8e8ed;
}

[data-theme="dark"] {
    --bg-white: #000000;       /* Pure Black */
    --bg-soft: #0a0a0a;        /* Near Black */
    --text-primary: #ffffff;   /* Pure White */
    --text-secondary: #86868b;
    --accent-blue: #ffffff;    /* Strict White */
    --border-color: rgba(255, 255, 255, 0.12);
    --glass-bg: rgba(0, 0, 0, 0.85);
    --code-bg: #161617;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-white);
    color: var(--text-primary);
    font-family: "SF Pro Display", "SF Pro Icons", "Apple Inter", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
}

/* Vertical Sidebar Glassmorphism */
nav {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%) translateX(-100px);
    width: 64px;
    height: auto;
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    z-index: 9999;
    border: 1px solid var(--border-color);
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 0;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    opacity: 0;
}

nav.loaded {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
}

nav:hover {
    width: 180px;
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    opacity: 0.7;
    margin: 12px 0;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 22px; /* Stable icon position */
}

nav a svg {
    min-width: 20px; /* Force icon width to prevent shifting */
}

nav a span {
    margin-left: 15px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

nav:hover a span {
    opacity: 1;
    transform: translateX(0);
}

nav a:hover {
    opacity: 1;
    color: var(--accent-blue);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0 22px; /* Matching the sidebar icon alignment */
    margin-top: 15px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    opacity: 1;
    color: var(--accent-blue);
}

.theme-toggle svg {
    min-width: 20px;
    height: 20px;
    fill: currentColor;
}

.theme-toggle span {
    margin-left: 15px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

nav:hover .theme-toggle span {
    opacity: 1;
    transform: translateX(0);
}

/* Layout */
.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 22px;
}

header {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

header.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-white);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: var(--text-primary);
    opacity: 0;
    transform: scale(0.9);
    filter: blur(10px);
    animation: ghost-entrance 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes ghost-entrance {
    0% { opacity: 0; transform: scale(0.9); filter: blur(10px); }
    30% { opacity: 1; transform: scale(1); filter: blur(0px); }
    80% { opacity: 1; transform: scale(1); filter: blur(0px); }
    100% { opacity: 0; transform: scale(1.1); filter: blur(5px); }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-content h1 {
    font-size: 110px;
    font-weight: 600;
    letter-spacing: -0.05em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 60px;
    letter-spacing: 0.02em;
    opacity: 0.8;
}

.hero-tagline {
    font-size: 32px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 900px;
    margin: 0 auto 20px auto;
    line-height: 1.1;
}

.hero-features {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 80px;
    opacity: 0.7;
}

.hero-terminal {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

/* Sections */
section {
    padding: 120px 0;
}

.section-title {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 60px;
    text-align: center;
    letter-spacing: -0.003em;
}

/* Benchmarks Table */
.table-container {
    background: var(--bg-soft);
    border-radius: 30px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.benchmark-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 16px;
}

.benchmark-table th {
    background: var(--bg-white);
    padding: 24px 30px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.benchmark-table td {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
}

.benchmark-table tr:last-child td {
    border-bottom: none;
}

.benchmark-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dataset-name {
    font-weight: 600 !important;
    color: var(--text-primary);
}

[data-theme="dark"] .benchmark-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .table-container {
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.3);
}

.table-note {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 15px;
    opacity: 0.8;
    line-height: 1.6;
}

.table-note strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Architecture Grid (Cleanup - can keep or remove if unused) */

/* Sections */
section {
    padding: 120px 0;
}

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

@media (max-width: 768px) {
    .apps-grid {
        grid-template-columns: 1fr;
    }
}

.app-card {
    background: var(--bg-soft);
    border-radius: 30px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.app-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(255, 255, 255, 0.1);
}

.app-image {
    width: 100%;
    height: 300px;
    overflow: hidden;
    background: #000;
}

.app-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.app-card:hover .app-image img {
    transform: scale(1.05);
}

.app-info {
    padding: 40px;
}

.app-badge {
    display: inline-block;
    padding: 6px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
}

.app-card h3 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
    letter-spacing: -0.01em;
}

.app-card p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

[data-theme="dark"] .app-card {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* RSSP Detail */
.rssp-container {
    display: flex;
    align-items: center;
    gap: 80px;
    background: var(--bg-soft);
    padding: 80px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
}

/* Top Navigation Bar */
.top-bar {
    position: fixed;
    top: 30px;
    right: 40px;
    z-index: 10001; /* Above preloader and sidebar */
    display: flex;
    gap: 12px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.top-bar.loaded {
    opacity: 1;
    transform: translateY(0);
}

.top-btn {
    padding: 8px 18px;
    background: var(--text-primary);
    color: var(--bg-white);
    border: 1px solid var(--text-primary);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.top-btn:hover {
    background: transparent;
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Secondary Button Style */
.top-btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.top-btn-secondary:hover {
    background: var(--border-color);
}

@media (max-width: 768px) {
    .top-bar {
        top: 20px;
        right: 20px;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    .top-btn {
        padding: 6px 14px;
        font-size: 11px;
    }

    /* Index Scaling */
    .hero-content h1 {
        font-size: 60px;
    }

    .hero-tagline {
        font-size: 24px;
        padding: 0 10px;
    }

    .hero-subtitle {
        font-size: 16px;
        margin-bottom: 40px;
        padding: 0 15px;
    }

    .rssp-content h2 {
        font-size: 32px;
    }

    /* Section Spacing */
    section {
        padding: 60px 0;
    }

    /* App Card Scaling */
    .app-info {
        padding: 24px;
    }

    .app-card h3 {
        font-size: 24px;
    }

    .app-image {
        height: 200px;
    }

    /* Docs/API Scaling */
    .docs-header h1 {
        font-size: 36px;
    }

    .docs-main {
        padding-top: 100px;
    }

    .docs-card {
        padding: 24px;
    }

    .api-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 20px -24px;
        padding: 0 24px;
    }

    .api-table {
        min-width: 600px;
    }

    .author-separator {
        display: none;
    }

    .author-links {
        flex-direction: column;
        gap: 10px;
    }

    /* Sidebar to Bottom Bar */
    nav {
        left: 20px;
        right: 20px;
        bottom: 20px;
        top: auto;
        transform: translateY(100px);
        width: calc(100% - 40px);
        height: 60px;
        flex-direction: row;
        justify-content: center;
        padding: 0;
        border-radius: 20px;
    }

    nav.loaded {
        transform: translateY(0);
    }

    nav:hover {
        width: calc(100% - 40px);
    }

    nav a {
        width: auto;
        padding: 0 15px;
        margin: 0;
        justify-content: center;
    }

    nav a span, .theme-toggle span {
        display: none;
    }

    .theme-toggle {
        width: auto;
        padding: 0 15px;
        margin-top: 0;
    }
}

@media (max-width: 900px) {
    .rssp-container {
        flex-direction: column;
        padding: 40px;
    }
}

.rssp-content {
    flex: 1;
}

.rssp-content h2 {
    font-size: 42px;
    font-weight: 600;
    margin-bottom: 25px;
    letter-spacing: -0.02em;
}

.rssp-desc {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.rssp-features {
    display: grid;
    gap: 30px;
}

.rssp-feature h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rssp-feature h4::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-blue);
    border-radius: 50%;
}

.rssp-feature p {
    font-size: 14px;
    color: var(--text-secondary);
}

.rssp-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    perspective: 1000px;
    overflow: hidden;
}

.shapes-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 380px;
    transform-style: preserve-3d;
    margin: 0 auto;
}

.shape-node {
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--accent-blue);
    transform-style: preserve-3d;
    opacity: 0;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
    /* Explicitly centering each node at its 'left' position */
    transform-origin: center;
}

/* Cycle Loop: 6s Total */
.level-0 {
    width: 80px;
    height: 80px;
    top: 20px;
    left: 50%;
    margin-left: -40px; /* Perfect center */
    animation: root-cycle 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.level-1-left, .level-1-right {
    width: 50px;
    height: 50px;
    top: 160px;
    animation: branch-cycle-1 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.level-1-left { left: 25%; margin-left: -25px; }
.level-1-right { left: 75%; margin-left: -25px; }

.level-2-1, .level-2-2, .level-2-3, .level-2-4 {
    width: 30px;
    height: 30px;
    top: 280px;
    animation: branch-cycle-2 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.level-2-1 { left: 12.5%; margin-left: -15px; }
.level-2-2 { left: 37.5%; margin-left: -15px; }
.level-2-3 { left: 62.5%; margin-left: -15px; }
.level-2-4 { left: 87.5%; margin-left: -15px; }

@keyframes root-cycle {
    0%, 10% { opacity: 0; transform: rotateX(45deg) rotateZ(45deg) scale(0); }
    15%, 85% { opacity: 1; transform: rotateX(45deg) rotateZ(45deg) scale(1); }
    90%, 100% { opacity: 0; transform: rotateX(45deg) rotateZ(45deg) scale(0); }
}

@keyframes branch-cycle-1 {
    0%, 30% { opacity: 0; transform: rotateX(45deg) rotateZ(45deg) scale(0); }
    35%, 80% { opacity: 1; transform: rotateX(45deg) rotateZ(45deg) scale(1); }
    85%, 100% { opacity: 0; transform: rotateX(45deg) rotateZ(45deg) scale(0); }
}

@keyframes branch-cycle-2 {
    0%, 50% { opacity: 0; transform: rotateX(45deg) rotateZ(45deg) scale(0); }
    55%, 75% { opacity: 0.8; transform: rotateX(45deg) rotateZ(45deg) scale(1); }
    80%, 100% { opacity: 0; transform: rotateX(45deg) rotateZ(45deg) scale(0); }
}

/* Particles */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-blue);
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0.2;
}

.p1 { top: 20%; left: 30%; animation: particle-orbit 6s linear infinite; }
.p2 { top: 60%; left: 80%; animation: particle-orbit 8s linear infinite reverse; }
.p3 { top: 10%; left: 70%; animation: particle-orbit 5s linear infinite; }

@keyframes particle-orbit {
    0% { transform: rotate(0deg) translateX(120px) rotate(0deg); opacity: 0; }
    50% { opacity: 0.8; }
    100% { transform: rotate(360deg) translateX(120px) rotate(-360deg); opacity: 0; }
}

/* Help Grid */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.help-card {
    background: var(--bg-soft);
    padding: 60px 40px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.help-card h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
}

.code-stack {
    background: var(--code-bg);
    padding: 24px;
    border-radius: 12px;
    font-family: 'SF Mono', monospace;
    font-size: 14px;
}

.code-line {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.code-line:last-child {
    margin-bottom: 0;
}

.code-line span {
    color: var(--text-primary);
    font-weight: 600;
}

.support-links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.support-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}


.support-links a {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    width: fit-content;
    transition: opacity 0.2s ease;
}

.support-links a:hover {
    opacity: 0.7;
}

/* Tutorial Stepper - Vertical Timeline */
.tutorial-stepper {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    padding-left: 60px;
}

.step-card {
    position: relative;
    margin-bottom: 120px;
}

.step-card:not(:last-child)::after {
    content: '';
    position: absolute;
    left: -61px;
    top: 34px;
    width: 2px;
    height: calc(100% + 120px - 34px);
    background: var(--border-color);
}

.step-card:last-child {
    margin-bottom: 0;
}

.step-number-circle {
    position: absolute;
    left: -78px;
    top: 0;
    width: 34px;
    height: 34px;
    background: var(--bg-white);
    border: 2px solid var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-blue);
    z-index: 2;
    box-shadow: 0 0 0 8px var(--bg-white);
}

.step-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 15px;
}

.step-card h3 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
}

.step-card p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    max-width: 600px;
}

/* Terminal Window Styling */
.terminal-window {
    background: #1c1c1e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.terminal-header {
    background: #2c2c2e;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.terminal-prompt {
    color: #86868b;
    font-family: 'SF Mono', monospace;
    font-weight: 700;
}

.terminal-title {
    color: #a1a1a6;
    font-family: 'SF Pro Display', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.terminal-copy-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #a1a1a6;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.terminal-copy-btn:hover {
    color: #f5f5f7;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.terminal-copy-btn.success {
    background: #34c759;
    color: white;
    border-color: #34c759;
}

.terminal-window pre {
    margin: 0;
    background: transparent;
    padding: 24px;
}

.terminal-window code {
    color: #e5e5e5;
    font-size: 15px;
    line-height: 1.6;
}

[data-theme="dark"] .step-number-circle {
    background: var(--bg-white);
    box-shadow: 0 0 0 8px var(--bg-white);
}

[data-theme="dark"] .terminal-window {
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Logic for Reveal */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Footer */
footer {
    padding: 100px 0 60px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px;
    text-align: center;
}

.footer-authors {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.footer-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    opacity: 0.7;
}

.author-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.author-links a {
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.author-links a:hover {
    color: var(--accent-blue);
    transform: translateY(-2px);
}

.author-separator {
    color: var(--border-color);
    font-weight: 200;
    font-size: 24px;
}

/* Pending / empty table rows */
.pending-row td {
    color: var(--text-secondary);
    opacity: 0.4;
}

/* Inline code in paragraphs and notes */
p code, .table-note code, .step-card p code {
    background: var(--code-bg);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85em;
    font-style: normal;
}

/* Flag group sub-headings inside docs-card */
.flag-group-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin: 36px 0 14px;
}

/* Active top-bar button (current page) */
.top-btn-active {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.top-btn-active:hover {
    background: var(--border-color);
    transform: none;
}

/* Docs and API Page Layouts */
.docs-page, .api-page {
    background: var(--bg-white);
    color: var(--text-primary);
    line-height: 1.6;
}


.docs-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
}

.docs-header {
    margin-bottom: 80px;
    text-align: left;
}

.docs-header h1 {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
}

.docs-header .subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 400;
}

.docs-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.docs-card {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.docs-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
}

.docs-card h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.docs-card p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.7;
}

.docs-code-block {
    background: var(--code-bg);
    padding: 24px;
    border-radius: 16px;
    margin: 20px 0;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    overflow-x: auto;
}

.docs-code-block code {
    display: block;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.docs-math {
    background: rgba(0,0,0,0.03);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    font-style: italic;
    margin: 20px 0;
}

[data-theme="dark"] .docs-math {
    background: rgba(255,255,255,0.03);
}

/* API Specific */
.api-category {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin: 80px 0 30px;
    padding-left: 0;
    border: none;
}

.api-section h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
}

.api-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.api-table th {
    background: rgba(0,0,0,0.02);
    padding: 16px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .api-table th {
    background: rgba(255,255,255,0.02);
}

.api-table td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.api-table tr:last-child td {
    border-bottom: none;
}

.api-table td code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 13px;
}

/* Footer Re-style for docs */
.docs-page footer, .api-page footer {
    border-top: 1px solid var(--border-color);
    margin-top: 100px;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Docs / API pages — offset content from left sidebar */
.docs-main {
    padding-top: 120px;
    padding-bottom: 100px;
    padding-left: 90px;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .docs-main {
        padding-left: 0;
        padding-top: 80px;
    }
}

/* Beta badge */
.beta-badge {
    display: inline-block;
    padding: 5px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* Platform notice under hero terminal */
.platform-notice {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 18px;
    opacity: 0.65;
    letter-spacing: 0.01em;
}

.platform-notice a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* App card link button */
.app-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    padding: 10px 20px;
    background: var(--text-primary);
    color: var(--bg-white);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s ease;
    letter-spacing: 0.01em;
}

.app-link-btn:hover {
    opacity: 0.7;
}

/* Theme toggle icon button in top-bar */
.top-btn-icon {
    background: var(--text-primary);
    color: var(--bg-white);
    border: 1px solid var(--text-primary);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.top-btn-icon:hover {
    background: transparent;
    color: var(--text-primary);
    transform: translateY(-1px);
}

.top-btn-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

/* TOC active link highlight */
nav a.toc-active {
    opacity: 1;
    color: var(--accent-blue);
}

/* Upcoming feature list in docs */
.upcoming-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.upcoming-list li {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.upcoming-list li::before {
    content: '';
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    background: var(--border-color);
    border-radius: 50%;
    margin-top: 9px;
}

.upcoming-list li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Docs section anchors — offset for fixed header */
[data-section] {
    scroll-margin-top: 40px;
}

/* ─────────────────────────────────────────────
   Section subtitle
───────────────────────────────────────────── */
.section-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
    max-width: 700px;
    margin: -30px auto 60px;
    line-height: 1.65;
}

/* ─────────────────────────────────────────────
   Generalizability Box
───────────────────────────────────────────── */
#generalizability {
    padding: 60px 0 0;
}

.gen-box {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 56px 60px;
}

.gen-title {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
}

.gen-intro {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.gen-checklist {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 36px;
}

.gen-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 22px 28px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.gen-item:last-child {
    border-bottom: none;
}

.gen-icon {
    font-size: 18px;
    font-weight: 700;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}

.gen-checked .gen-icon {
    color: #30d158;
    background: rgba(48, 209, 88, 0.1);
}

.gen-warning .gen-icon {
    color: #ffd60a;
    background: rgba(255, 214, 10, 0.1);
}

.gen-item-text strong {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.gen-item-text p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.gen-wip-badge {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(255, 214, 10, 0.12);
    color: #b8860b;
    border: 1px solid rgba(255, 214, 10, 0.3);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

[data-theme="dark"] .gen-wip-badge {
    color: #ffd60a;
    background: rgba(255, 214, 10, 0.1);
}

.gen-footer-note {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 14px;
    padding: 24px 28px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.65;
}

[data-theme="dark"] .gen-footer-note {
    background: rgba(255, 255, 255, 0.04);
}

.gen-footer-note strong {
    color: var(--text-primary);
}

.gen-v2-link {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.gen-v2-link:hover {
    opacity: 0.7;
}

@media (max-width: 768px) {
    .gen-box {
        padding: 32px 24px;
    }
    .gen-title {
        font-size: 22px;
    }
    .gen-item {
        padding: 18px 20px;
    }
}

/* ─────────────────────────────────────────────
   Dataset Results Tabs
───────────────────────────────────────────── */
.dataset-tabs {
    margin-top: 20px;
}

.dataset-tab-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.ds-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
    letter-spacing: -0.01em;
}

.ds-tab-btn:hover {
    color: var(--text-primary);
}

.ds-tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
    font-weight: 600;
}

.dataset-tab-content {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
}

.ds-tab-panel {
    display: none;
    padding: 48px;
}

.ds-tab-panel.active {
    display: block;
}

.ds-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

@media (max-width: 900px) {
    .ds-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .ds-tab-panel {
        padding: 28px 20px;
    }
}

.ds-image-container {
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ds-info h3 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.ds-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    opacity: 0.8;
}

.ds-table-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    margin-top: 0;
}

.ds-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ds-table th {
    background: var(--bg-white);
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.ds-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
}

.ds-table tr:last-child td {
    border-bottom: none;
}

.ds-note {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.ds-note strong {
    color: var(--text-primary);
}

/* ─────────────────────────────────────────────
   Architecture Version Selector + Tabs
───────────────────────────────────────────── */
.arch-version-selector {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
}

.arch-version-btn {
    padding: 11px 28px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.arch-version-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.arch-version-btn.active {
    background: var(--text-primary);
    color: var(--bg-white);
    border-color: var(--text-primary);
}

.arch-tabs {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    overflow: hidden;
}

.arch-tab-buttons {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.arch-tab-buttons::-webkit-scrollbar {
    display: none;
}

.arch-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
    white-space: nowrap;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.arch-tab-btn:hover {
    color: var(--text-primary);
}

.arch-tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
    font-weight: 600;
}

.arch-tab-content {
    padding: 0;
}

.arch-panel {
    display: none;
    padding: 48px;
}

.arch-panel.active {
    display: block;
}

.arch-panel h3 {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 18px;
    letter-spacing: -0.02em;
}

.arch-panel p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 14px;
}

.arch-panel p:last-child {
    margin-bottom: 0;
}

.arch-badge {
    display: inline-block;
    padding: 4px 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.arch-badge-warn {
    color: #b8860b;
    border-color: rgba(255, 214, 10, 0.4);
    background: rgba(255, 214, 10, 0.06);
}

[data-theme="dark"] .arch-badge-warn {
    color: #ffd60a;
}

.arch-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.arch-list li {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.55;
    padding-left: 20px;
    position: relative;
}

.arch-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    background: var(--border-color);
    border-radius: 50%;
    flex-shrink: 0;
}

.arch-list li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.arch-goals-list li {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 20px;
}

.arch-goal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
    display: block;
}

.arch-goals-note {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-top: 24px !important;
    padding: 16px 20px;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
}

[data-theme="dark"] .arch-goals-note {
    background: rgba(255,255,255,0.04);
}

@media (max-width: 768px) {
    .arch-panel {
        padding: 28px 20px;
    }
    .arch-version-selector {
        flex-direction: column;
        align-items: stretch;
    }
    .arch-version-btn {
        text-align: center;
    }
}

/* ─────────────────────────────────────────────
   Why Spectral Section
───────────────────────────────────────────── */
.why-spectral-block {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.why-spectral-block p {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.75;
}

.why-spectral-block strong {
    color: var(--text-primary);
    font-weight: 600;
}

.why-spectral-block em {
    font-style: italic;
}

/* ─────────────────────────────────────────────
   Dataset image — clickable cursor + zoom hint
───────────────────────────────────────────── */
.ds-img-trigger {
    cursor: zoom-in;
    position: relative;
}

.ds-img-trigger::after {
    content: '⤢';
    position: absolute;
    bottom: 10px;
    right: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ds-img-trigger:hover::after {
    opacity: 1;
}

/* ─────────────────────────────────────────────
   Lightbox
───────────────────────────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    padding: 40px;
    cursor: zoom-out;
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    user-select: none;
    pointer-events: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 28px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s ease;
    z-index: 1;
}

.lightbox-close:hover {
    color: #fff;
}

/* ─────────────────────────────────────────────
   "See what GHOST looks like" button
───────────────────────────────────────────── */
.logs-peek-btn {
    display: inline-block;
    margin-top: 22px;
    padding: 9px 22px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.logs-peek-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* ─────────────────────────────────────────────
   Training log modal
───────────────────────────────────────────── */
.logs-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.logs-modal.open {
    display: flex;
}

.logs-modal-inner {
    width: 100%;
    max-width: 1300px;
    max-height: 92vh;
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
}

.logs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #161617;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.logs-modal-title {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.02em;
}

.logs-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.2s ease;
}

.logs-modal-close:hover {
    color: #fff;
}

.logs-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #000;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .logs-modal {
        padding: 16px;
    }
    .logs-modal-inner {
        max-height: 90vh;
    }
}
