:root {
    --bg: #0b1020;
    --panel: #0f1530;
    --text: #e6eefc;
    --muted: #a2b3d9;
    --brand: #7c4dff;
    --brand2: #00e5ff;
    --border: #1b2540;
    --accent: #101a36;
    --ok: #30e0a1;
    --warn: #ffd166;
}

:root.light {
    --bg: #f7f8ff;
    --panel: #ffffff;
    --text: #0f1530;
    --muted: #56627a;
    --brand: #5b2cff;
    --brand2: #0081a7;
    --border: #e6e9f5;
    --accent: #eef2ff;
    --ok: #198754;
    --warn: #a66e00;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
}

a {
    color: #9cc7ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header / Nav */

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 21, 48, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.header .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand img {
    width: 28px;
    height: 28px;
}

.brand strong {
    font-weight: 700;
}

.nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.nav a {
    margin: 0 6px;
    color: var(--muted);
    font-size: 14px;
}

.nav a:hover {
    color: var(--text);
}

.btn {
    display: inline-block;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--accent);
    color: var(--text);
    font-size: 14px;
}

.btn.primary {
    border: none;
    background: linear-gradient(90deg, var(--brand), var(--brand2));
    color: #ffffff;
}

.btn.ghost {
    background: transparent;
}

/* Hero */

.hero {
    position: relative;
    overflow: hidden;
    padding: 72px 0 40px;
    border-bottom: 1px solid var(--border);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(1000px 500px at 10% -10%, rgba(124, 77, 255, 0.25), transparent 60%),
        radial-gradient(1000px 500px at 90% 10%, rgba(0, 229, 255, 0.18), transparent 60%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
}

.hero-title {
    font-size: 42px;
    line-height: 1.08;
    margin: 0 0 10px;
}

.hero-subtitle {
    max-width: 780px;
    color: var(--muted);
}

.hero-ctas {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Metric badges */

.badges {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 22px 0;
}

.badge {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
}

.badge-title {
    font-size: 12px;
    color: var(--muted);
}

.badge-value {
    font-size: 22px;
}

/* Sections */

.section {
    padding: 48px 0;
    border-bottom: 1px solid var(--border);
}

.section:last-of-type {
    border-bottom: none;
}

.section h2 {
    margin: 0 0 16px;
    font-size: 24px;
}

.section p.lead {
    margin-top: 0;
    color: var(--muted);
    max-width: 720px;
}

/* Cards + Grids */

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.card h3 {
    margin-top: 6px;
}

.card small {
    color: var(--muted);
    font-size: 12px;
}

.grid2 {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 18px;
}

/* Misc bits */

.logo-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
    opacity: 0.9;
    font-size: 14px;
}

.kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    background: var(--accent);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 12px;
}

pre,
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

pre {
    background: #0b1128;
    color: #e6eefc;
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: 12px;
    overflow: auto;
    font-size: 13px;
}

:root.light pre {
    background: #f5f7ff;
    color: #0b1320;
}

/* Footer */

.footer {
    padding: 32px 0;
    color: var(--muted);
    font-size: 14px;
}

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

.footer a:hover {
    color: var(--text);
}

/* DOCS-SPECIFIC helpers (used on documentation.html) */

main.docs {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.docs-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 32px;
}

.docs-title h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.2;
}

.docs-meta {
    font-size: 14px;
    color: var(--muted);
}

.toc {
    min-width: 220px;
    max-width: 260px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 12px 14px;
    font-size: 14px;
    position: sticky;
    top: 80px;
}

.toc h3 {
    margin: 0 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin: 4px 0;
}

.toc a {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}

.toc a.active {
    color: var(--text);
    font-weight: 600;
}

.docs-section {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 28px;
}

.docs-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.docs-section h2 {
    margin-top: 0;
    margin-bottom: 8px;
    border-bottom: none;
    font-size: 24px;
}

.docs-section .subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 12px;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--accent);
    color: var(--muted);
    margin-right: 6px;
    margin-bottom: 4px;
}

.badge-pill.ok {
    border-color: var(--ok);
    color: var(--ok);
}

.badge-pill.warn {
    border-color: var(--warn);
    color: var(--warn);
}

.architecture-tabs {
    margin-top: 10px;
}

.tab-bar {
    display: inline-flex;
    gap: 4px;
    border-radius: 999px;
    padding: 2px;
    background: var(--accent);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.tab-btn {
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
}

.tab-panel {
    display: none;
}

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

.callout {
    border-left: 4px solid var(--brand);
    background: rgba(124, 77, 255, 0.08);
    padding: 10px 12px;
    border-radius: 10px;
    margin: 10px 0 14px;
    font-size: 14px;
}

.callout.warning {
    border-left-color: var(--warn);
}

.grid-two {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
}

.table-like {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 14px;
}

.table-like th,
.table-like td {
    border: 1px solid var(--border);
    padding: 6px 8px;
}

.table-like th {
    background: var(--panel);
    text-align: left;
}

details {
    margin: 8px 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 8px 10px;
}

details summary {
    cursor: pointer;
    font-weight: 500;
}

details[open] {
    background: var(--accent);
}

/* Back-to-top button (docs) */

#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
}

#backToTop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive */

@media (max-width: 980px) {
    .hero-title {
        font-size: 32px;
    }

    .badges {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .grid2,
    .grid-two {
        grid-template-columns: 1fr;
    }

    .docs-header {
        flex-direction: column;
    }

    .toc {
        position: static;
        width: 100%;
    }
}