/* ============================================================
   DataSynth Documentation — Design System
   Aesthetic: Swiss Precision × Financial Authority
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --- Design Tokens --- */
:root {
    /* Brand */
    --ds-yellow: #FFE600;
    --ds-yellow-muted: #FFE60026;
    --ds-yellow-glow: #FFE60018;
    --ds-dark: #2E2E38;
    --ds-gray: #747480;
    --ds-light-gray: #F6F6FA;
    --ds-white: #FFFFFF;

    /* Typography */
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --font-size-base: 1rem;
    --line-height-body: 1.72;
    --line-height-heading: 1.2;
    --letter-spacing-tight: -0.02em;
    --letter-spacing-wide: 0.04em;

    /* Spacing rhythm (8px base) */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;

    /* Geometry */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Motion */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
}

/* --- Light Theme --- */
.light {
    --bg: #FAFAFA;
    --fg: #1C1C22;
    --fg-muted: #5A5A68;
    --fg-subtle: #9090A0;
    --sidebar-bg: #F0F0F5;
    --sidebar-fg: var(--ds-dark);
    --sidebar-active: var(--ds-dark);
    --sidebar-active-bg: var(--ds-yellow);
    --links: #1A4FD6;
    --links-hover: #0D38A8;
    --inline-code-color: #C7254E;
    --inline-code-bg: #F3F0F8;
    --theme-popup-bg: var(--ds-white);
    --theme-popup-border: #E0E0E8;
    --theme-hover: #EEEEF4;
    --quote-bg: #F4F4FA;
    --quote-border: var(--ds-yellow);
    --table-header-bg: #F0F0F5;
    --table-alternate-bg: #F8F8FC;
    --table-border: #E4E4EC;
    --code-bg: #1B1B2F;
    --code-fg: #E0DEF4;
    --card-bg: var(--ds-white);
    --card-border: #E4E4EC;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --divider: #E4E4EC;
    --accent-gradient: linear-gradient(135deg, #FFE600 0%, #FFD000 100%);
    --page-shadow: 0 0 40px rgba(0, 0, 0, 0.03);
}

/* --- Navy (Dark) Theme --- */
.navy {
    --bg: #0C0C14;
    --fg: #E2E0F0;
    --fg-muted: #9896A8;
    --fg-subtle: #6C6A7E;
    --sidebar-bg: #12121C;
    --sidebar-fg: #C8C6D8;
    --sidebar-active: #0C0C14;
    --sidebar-active-bg: var(--ds-yellow);
    --links: #6EA8FF;
    --links-hover: #9DC4FF;
    --inline-code-color: #F0A0C0;
    --inline-code-bg: #1E1E30;
    --theme-popup-bg: #16162A;
    --theme-popup-border: #2A2A44;
    --theme-hover: #1A1A2E;
    --quote-bg: #14142A;
    --quote-border: var(--ds-yellow);
    --table-header-bg: #16162A;
    --table-alternate-bg: #10101E;
    --table-border: #2A2A44;
    --code-bg: #0A0A18;
    --code-fg: #E0DEF4;
    --card-bg: #14142A;
    --card-border: #2A2A44;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --divider: #2A2A44;
    --accent-gradient: linear-gradient(135deg, #FFE600 0%, #FFD000 100%);
    --page-shadow: none;
}

/* ============================================================
   Base Typography
   ============================================================ */

.content {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: var(--line-height-body);
    color: var(--fg);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 52rem;
}

.content p {
    margin-bottom: var(--space-md);
    color: var(--fg);
}

/* ============================================================
   Headings — Tight, geometric, with accent markers
   ============================================================ */

.content h1 {
    font-family: var(--font-body);
    font-size: 2.15rem;
    font-weight: 700;
    letter-spacing: var(--letter-spacing-tight);
    line-height: var(--line-height-heading);
    color: var(--fg);
    border-bottom: none;
    padding-bottom: var(--space-sm);
    margin-top: 0;
    margin-bottom: var(--space-lg);
    position: relative;
}

.content h1::after {
    content: '';
    display: block;
    width: 3.5rem;
    height: 3px;
    background: var(--accent-gradient);
    margin-top: var(--space-sm);
    border-radius: 2px;
}

.content h2 {
    font-family: var(--font-body);
    font-size: 1.55rem;
    font-weight: 600;
    letter-spacing: var(--letter-spacing-tight);
    line-height: var(--line-height-heading);
    color: var(--fg);
    border-bottom: 1px solid var(--divider);
    padding-bottom: var(--space-sm);
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-lg);
}

.content h3 {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: var(--letter-spacing-tight);
    line-height: var(--line-height-heading);
    color: var(--fg);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
}

.content h4 {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    color: var(--fg-muted);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
}

/* ============================================================
   Links
   ============================================================ */

.content a {
    color: var(--links);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color var(--duration-fast) var(--ease-in-out),
                border-color var(--duration-fast) var(--ease-in-out);
}

.content a:hover {
    color: var(--links-hover);
    border-bottom-color: var(--links-hover);
    text-decoration: none;
}

/* ============================================================
   Hero Section — Commanding, architectural
   ============================================================ */

.hero-section {
    background: linear-gradient(160deg, #1C1C28 0%, #14142A 40%, #0C0C18 100%);
    color: var(--ds-white);
    padding: var(--space-2xl) var(--space-xl);
    margin: -20px -15px var(--space-xl) -15px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0;
}

/* Geometric accent line */
.hero-section::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

/* Subtle grid pattern overlay */
.hero-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 230, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 230, 0, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

.hero-section h1 {
    color: var(--ds-white);
    font-family: var(--font-body);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-xs);
    position: relative;
    z-index: 1;
    border-bottom: none;
    padding-bottom: 0;
}

.hero-section h1::after {
    display: none;
}

.hero-section .subtitle {
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 400;
    color: #B0B0C0;
    letter-spacing: 0.01em;
    margin-bottom: var(--space-md);
    position: relative;
    z-index: 1;
}

.hero-section .attribution {
    font-size: 0.85rem;
    font-weight: 400;
    color: #7A7A8E;
    margin-top: var(--space-lg);
    position: relative;
    z-index: 1;
    letter-spacing: 0.02em;
}

.hero-section .attribution a {
    color: var(--ds-yellow);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 230, 0, 0.3);
    transition: border-color var(--duration-fast) var(--ease-in-out);
}

.hero-section .attribution a:hover {
    border-bottom-color: var(--ds-yellow);
    text-decoration: none;
}

/* Badge row */
.badges {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
    position: relative;
    z-index: 1;
}

.badges img {
    height: 22px;
    border-radius: 3px;
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.badges img:hover {
    transform: translateY(-1px);
}

/* ============================================================
   Sidebar — Clean hierarchy with yellow accent
   ============================================================ */

.sidebar {
    font-family: var(--font-body);
    font-size: 0.9rem;
    border-right: 1px solid var(--divider);
}

.sidebar .sidebar-scrollbox {
    padding: var(--space-lg) var(--space-sm) var(--space-lg) 0;
}

.sidebar ol.chapter {
    padding-left: var(--space-md);
}

.sidebar ol.chapter li.chapter-item {
    margin: 1px 0;
    line-height: 1.5;
}

.sidebar ol.chapter li.chapter-item a {
    display: block;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-fg);
    font-weight: 400;
    transition: background-color var(--duration-fast) var(--ease-in-out),
                color var(--duration-fast) var(--ease-in-out);
    text-decoration: none;
    border-bottom: none;
}

.sidebar ol.chapter li.chapter-item a:hover {
    background-color: var(--theme-hover);
    color: var(--fg);
    text-decoration: none;
    border-bottom: none;
}

.sidebar ol.chapter li.chapter-item.expanded > a,
.sidebar ol.chapter li.chapter-item a.active {
    font-weight: 600;
    color: var(--sidebar-active);
    background-color: var(--sidebar-active-bg);
    border-radius: var(--radius-sm);
}

/* Section dividers in sidebar */
.sidebar .chapter li.affix {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-xs);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    color: var(--fg-subtle);
    padding-left: 0.75rem;
}

/* ============================================================
   Tables — Financial-grade precision
   ============================================================ */

.content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: var(--space-lg) 0;
    font-size: 0.92rem;
    border: 1px solid var(--table-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.content table thead {
    background-color: var(--table-header-bg);
}

.content table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    color: var(--fg-muted);
    border-bottom: 2px solid var(--ds-yellow);
}

.content table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--table-border);
    color: var(--fg);
    vertical-align: top;
}

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

.content table tbody tr:nth-child(even) {
    background-color: var(--table-alternate-bg);
}

.content table tbody tr {
    transition: background-color var(--duration-fast) var(--ease-in-out);
}

.content table tbody tr:hover {
    background-color: var(--ds-yellow-glow);
}

/* Bold first column — label styling */
.content table td:first-child strong {
    color: var(--fg);
    font-weight: 600;
}

/* ============================================================
   Code Blocks — Dark, precise, with yellow accent
   ============================================================ */

.content pre {
    background-color: var(--code-bg) !important;
    color: var(--code-fg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid var(--ds-yellow);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.65;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.content pre code {
    font-family: var(--font-mono);
    font-size: inherit;
    color: inherit;
    background: none;
    padding: 0;
    border-radius: 0;
}

.content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    font-variant-ligatures: none;
}

/* Inline code */
.content :not(pre) > code {
    background-color: var(--inline-code-bg);
    color: var(--inline-code-color);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.86em;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.navy .content :not(pre) > code {
    border-color: rgba(255, 255, 255, 0.06);
}

/* ============================================================
   Blockquotes — Accent border with subtle background
   ============================================================ */

.content blockquote {
    border-left: 3px solid var(--ds-yellow);
    background-color: var(--quote-bg);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--fg-muted);
    font-style: italic;
}

.content blockquote p {
    margin: 0;
    color: inherit;
}

/* ============================================================
   Lists — Better rhythm and indentation
   ============================================================ */

.content ul,
.content ol {
    padding-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

.content li {
    margin-bottom: 0.35rem;
    line-height: var(--line-height-body);
}

.content li strong {
    color: var(--fg);
}

/* ============================================================
   Horizontal Rules
   ============================================================ */

.content hr {
    border: none;
    height: 1px;
    background: var(--divider);
    margin: var(--space-2xl) 0;
}

/* ============================================================
   Warning / Info Admonitions
   ============================================================ */

.warning {
    background-color: #FFFDF0;
    border: 1px solid #F0E0A0;
    border-left: 3px solid var(--ds-yellow);
    padding: var(--space-md) var(--space-lg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: var(--space-lg) 0;
    font-size: 0.95rem;
}

.navy .warning {
    background-color: #1E1E10;
    border-color: #3A3A20;
    border-left-color: var(--ds-yellow);
}

.info {
    background-color: #F0F5FF;
    border: 1px solid #C0D4F0;
    border-left: 3px solid var(--links);
    padding: var(--space-md) var(--space-lg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: var(--space-lg) 0;
    font-size: 0.95rem;
}

.navy .info {
    background-color: #0E1420;
    border-color: #1E2E48;
    border-left-color: #6EA8FF;
}

/* ============================================================
   Feature Grid — Cards with hover lift
   ============================================================ */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin: var(--space-xl) 0;
}

.feature-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--card-shadow);
    transition: transform var(--duration-normal) var(--ease-out-expo),
                box-shadow var(--duration-normal) var(--ease-out-expo);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.navy .feature-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.feature-card h3 {
    margin-top: 0;
    font-size: 1.05rem;
    color: var(--fg);
    padding-left: 0.85rem;
    border-left: 3px solid var(--ds-yellow);
}

/* ============================================================
   Quick Links Grid
   ============================================================ */

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.quick-link {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--fg);
    transition: all var(--duration-normal) var(--ease-out-expo);
    border-bottom: none;
}

.quick-link:hover {
    background-color: var(--theme-hover);
    text-decoration: none;
    border-bottom: none;
    transform: translateY(-1px);
    box-shadow: var(--card-shadow);
}

.quick-link-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* ============================================================
   API Link Button
   ============================================================ */

.api-link {
    display: inline-block;
    background: var(--accent-gradient);
    color: var(--ds-dark) !important;
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none !important;
    border-bottom: none !important;
    letter-spacing: 0.01em;
    transition: transform var(--duration-fast) var(--ease-out-expo),
                box-shadow var(--duration-fast) var(--ease-out-expo);
}

.api-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 230, 0, 0.25);
    border-bottom: none !important;
}

/* ============================================================
   Version Badge
   ============================================================ */

.version-badge {
    display: inline-block;
    background: var(--accent-gradient);
    color: var(--ds-dark);
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
}

/* ============================================================
   Architecture Diagram Container
   ============================================================ */

.architecture-diagram {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    overflow-x: auto;
    box-shadow: var(--card-shadow);
}

.architecture-diagram pre {
    margin: 0;
    border: none;
    background: transparent !important;
    box-shadow: none;
    border-left: none;
    padding: var(--space-sm);
}

/* ============================================================
   Performance Metrics Table
   ============================================================ */

.metrics-table {
    margin: var(--space-lg) 0;
}

.metrics-table td:first-child {
    font-weight: 600;
    color: var(--fg);
}

.metrics-table td:last-child {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--links);
}

/* ============================================================
   Scrollbar Styling
   ============================================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--fg-subtle);
    border-radius: 3px;
}

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

/* ============================================================
   Menu Bar (top) — Cleaner separation
   ============================================================ */

.menu-bar {
    border-bottom: 1px solid var(--divider);
}

.menu-bar i {
    transition: color var(--duration-fast) var(--ease-in-out);
}

.menu-bar i:hover {
    color: var(--ds-yellow);
}

/* ============================================================
   Search Results
   ============================================================ */

.searchresults a {
    border-bottom: none;
}

.searchresults a:hover {
    border-bottom: none;
}

mark {
    background-color: var(--ds-yellow-muted);
    color: inherit;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

/* ============================================================
   Page Navigation (prev/next)
   ============================================================ */

.nav-chapters {
    transition: color var(--duration-fast) var(--ease-in-out);
    opacity: 0.5;
}

.nav-chapters:hover {
    color: var(--ds-yellow);
    opacity: 1;
}

/* ============================================================
   Print Styles
   ============================================================ */

@media print {
    .hero-section {
        background: var(--ds-light-gray);
        color: var(--ds-dark);
    }

    .hero-section h1 {
        color: var(--ds-dark);
    }

    .hero-section::before,
    .hero-section::after {
        display: none;
    }

    .content pre {
        border-left-color: var(--ds-dark);
        box-shadow: none;
    }

    .content table {
        box-shadow: none;
    }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .hero-section {
        padding: var(--space-xl) var(--space-md);
        margin: -10px -10px var(--space-lg) -10px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section .subtitle {
        font-size: 1rem;
    }

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

    .content table {
        font-size: 0.85rem;
    }

    .content table th,
    .content table td {
        padding: 0.5rem 0.65rem;
    }

    .content h1 {
        font-size: 1.65rem;
    }

    .content h2 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .badges {
        gap: 0.3rem;
    }

    .badges img {
        height: 18px;
    }

    .hero-section h1 {
        font-size: 1.65rem;
    }

    .content pre {
        font-size: 0.82rem;
        padding: var(--space-md);
    }
}
