/* Zettuce site stylesheet. Inspired by IntelliStream TSDB's dark-indigo telemetry aesthetic:
 * deep indigo ground, cyan/violet/magenta/amber/mint telemetry highlights, system fonts,
 * zero external dependencies. Licensed under Apache-2.0. */

:root {
    color-scheme: dark;
    --bg: #070a17;
    --bg-2: #0b1022;
    --bg-prose: #0b0d16;
    --surface: #10162e;
    --surface-2: #161e3d;
    --surface-3: #1d2750;
    --line: rgba(150, 165, 255, 0.16);
    --line-2: rgba(150, 165, 255, 0.54);
    --text: #e9ecff;
    --muted: #c5cbe8;
    --faint: #a3abd0;
    --cyan: #36e2ff;
    --violet: #8f80ff;
    --magenta: #ff5ad9;
    --amber: #ffb547;
    --mint: #6ff2b0;
    --red: #ff6b81;
    --link: #7fdcff;
    --on-accent: #050816;
    --code-bg: #0a0f24;
    --code-text: #dfe5ff;
    --hl-com: #9aa6d6;
    --hl-kw: #d2a8ff;
    --hl-type: #7fe6ff;
    --hl-fn: #ffc45e;
    --hl-str: #a9f0b6;
    --hl-num: #ffb685;
    --hl-meta: #ff9be3;
    --hl-var: #a9c4ff;
    --bar-other: #5b8f6b;
    --bar-tcp: #8f80ff;
    --fail-bg: rgba(255, 107, 129, 0.14);
    --fail-text: #ffb3be;
    --glow: 0 0 24px rgba(54, 226, 255, 0.35);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    --topbar-bg: rgba(7, 10, 23, 0.72);
    --grid-line: rgba(120, 140, 255, 0.09);
    --hero-a: rgba(143, 128, 255, 0.35);
    --hero-b: rgba(54, 226, 255, 0.22);
    --hero-c: rgba(255, 90, 217, 0.18);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Cascadia Code", "Roboto Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
    --bar-h: 64px;
    --side-w: 272px;
    --ease: cubic-bezier(0.2, 0, 0, 1);
    --grad: linear-gradient(100deg, var(--cyan), var(--violet) 55%, var(--magenta));
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--bar-h) + 24px);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 1rem/1.65 var(--font);
    text-rendering: optimizeLegibility;
}

img,
svg {
    max-width: 100%;
}

a {
    color: var(--link);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

a:hover {
    text-decoration-thickness: 2px;
}

:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
    border-radius: 6px;
}

[hidden] {
    display: none !important;
}

.skip {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 100;
    padding: 8px 16px;
    background: var(--cyan);
    color: #04121a;
    border-radius: 8px;
    font-weight: 600;
}

.skip:focus {
    top: 8px;
}

h1,
h2,
h3,
h4 {
    line-height: 1.18;
    margin: 1.8em 0 0.55em;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

h1 {
    font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 0.3em;
}

h2 {
    font-size: 1.65rem;
    font-weight: 750;
}

h3 {
    font-size: 1.2rem;
    font-weight: 650;
}

p,
ul,
ol,
table,
pre,
figure,
dl {
    margin: 0 0 1em;
}

li + li {
    margin-top: 0.35em;
}

strong {
    font-weight: 650;
}

code,
kbd {
    font-family: var(--mono);
    font-size: 0.88em;
}

:not(pre) > code {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--code-text);
    padding: 0.08em 0.38em;
    border-radius: 6px;
    overflow-wrap: anywhere;
}

pre {
    font-size: 0.86rem;
    line-height: 1.6;
    background: var(--code-bg);
    color: var(--code-text);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 20px;
    overflow-x: auto;
    tab-size: 4;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

pre code {
    font-size: inherit;
}

.tok-com { color: var(--hl-com); font-style: italic; }
.tok-kw { color: var(--hl-kw); }
.tok-type { color: var(--hl-type); }
.tok-fn { color: var(--hl-fn); }
.tok-str { color: var(--hl-str); }
.tok-num { color: var(--hl-num); }
.tok-meta { color: var(--hl-meta); }
.tok-var { color: var(--hl-var); }

.code-wrap {
    position: relative;
}

.copy {
    position: absolute;
    top: 10px;
    right: 10px;
    font: 600 0.75rem/1 var(--font);
    padding: 7px 11px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
}

.copy:hover {
    color: var(--text);
    border-color: var(--cyan);
}

.code-source {
    margin: -0.55em 0 1.3em;
    font-size: 0.82rem;
    color: var(--faint);
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.93rem;
}

th,
td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

thead th {
    font-weight: 650;
    color: var(--muted);
    border-bottom-color: var(--line-2);
}

td.num,
th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table-wrap {
    overflow-x: auto;
    margin: 0 0 1.3em;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.table-wrap table {
    margin: 0;
}

.table-wrap tr:last-child > * {
    border-bottom: 0;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid color-mix(in srgb, var(--cyan) 40%, var(--line));
    background: color-mix(in srgb, var(--cyan) 12%, var(--surface));
    color: var(--cyan);
    margin-bottom: 14px;
}

/* ---------- top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--topbar-bg);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--line);
}

.topbar-in {
    max-width: 1280px;
    height: var(--bar-h);
    margin: 0 auto;
    padding: 0 max(16px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
    margin-right: auto;
    padding: 6px 4px;
}

.brand img {
    filter: drop-shadow(0 0 8px rgba(54, 226, 255, 0.45));
}

.topnav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 6px;
}

.topnav a,
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 15px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font: 650 0.9rem var(--font);
    border: 1px solid var(--line-2);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.12s, filter 0.2s;
}

.topnav a:hover,
.icon-btn:hover {
    border-color: color-mix(in srgb, var(--text) 30%, transparent);
    box-shadow: 0 0 18px color-mix(in srgb, var(--cyan) 22%, transparent);
}

.topnav a:active,
.icon-btn:active {
    transform: translateY(1px);
}

.topnav a[aria-current="page"] {
    border-color: var(--cyan);
    background-origin: border-box;
    color: var(--on-accent);
    background: var(--grad);
    box-shadow: 0 4px 20px rgba(143, 128, 255, 0.45);
}

.topnav a[aria-current="page"]:hover {
    filter: brightness(1.08);
}

.topnav svg,
.icon-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-btn {
    width: 36px;
    padding: 0;
    margin-left: 2px;
}

.menu-btn {
    display: none;
}

@media (max-width: 760px) {
    .menu-btn {
        display: inline-flex;
    }

    .topnav {
        position: absolute;
        top: var(--bar-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-right: 0;
        padding: 12px 16px 18px;
        background: var(--bg-2);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
        display: none;
    }

    .topnav a {
        height: 46px;
        font-size: 1rem;
        border-radius: 12px;
    }

    body.nav-open .topnav {
        display: flex;
    }
}

.scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(3, 5, 14, 0.55);
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 26px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--line-2);
    background: var(--surface);
    transition: border-color 0.2s, filter 0.2s;
}

.btn:hover {
    border-color: var(--cyan);
    text-decoration: none;
}

.btn.filled {
    border: 0;
    color: var(--on-accent);
    background: var(--grad);
    box-shadow: 0 6px 28px rgba(143, 128, 255, 0.45);
}

.btn.filled:hover {
    filter: brightness(1.08);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 28px 0 0;
}

/* ---------- landing: hero ---------- */

.home main {
    overflow: hidden;
}

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

.hero {
    position: relative;
    isolation: isolate;
    padding: clamp(36px, 5vw, 72px) 20px clamp(48px, 6vw, 84px);
    overflow: hidden;
}

.hero-glow {
    pointer-events: none;
    position: absolute;
    inset: -20% -10% 0;
    z-index: -2;
    background: radial-gradient(40% 45% at 22% 30%, var(--hero-a), transparent 70%),
        radial-gradient(38% 40% at 80% 35%, var(--hero-b), transparent 70%),
        radial-gradient(30% 35% at 55% 75%, var(--hero-c), transparent 70%);
}

.hero-track {
    pointer-events: none;
    position: absolute;
    left: -20%;
    right: -20%;
    top: 38%;
    height: 70%;
    z-index: -1;
    background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 56px 56px;
    transform: perspective(520px) rotateX(62deg);
    transform-origin: 50% 0;
    -webkit-mask-image: linear-gradient(to bottom, #000 10%, transparent 85%);
    mask-image: linear-gradient(to bottom, #000 10%, transparent 85%);
}

.hero-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: center;
    gap: clamp(28px, 4vw, 56px);
}

.hero-text {
    text-align: left;
}

.hero h1 {
    font-size: clamp(2.4rem, 1.5rem + 3.2vw, 4.1rem);
    line-height: 1.04;
    letter-spacing: -0.04em;
    font-weight: 850;
    margin: 0 0 18px;
    background: linear-gradient(180deg, var(--text) 32%, color-mix(in srgb, var(--text) 62%, var(--violet)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero .lead {
    font-size: clamp(1.05rem, 1rem + 0.3vw, 1.22rem);
    line-height: 1.58;
    color: var(--muted);
    max-width: 42rem;
    margin: 0;
}

.hero-visual {
    position: relative;
}

.fabric-svg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.55));
}

.fabric-svg .pulse-fast {
    stroke-dasharray: 28 240;
    stroke-dashoffset: 0;
}

.fabric-svg .pulse-med {
    stroke-dasharray: 22 260;
    stroke-dashoffset: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .hero-track {
        animation: track 0.9s linear infinite;
    }

    .fabric-svg .pulse-fast {
        animation: packet-flow 1.05s linear infinite;
    }

    .fabric-svg .pulse-med {
        animation: packet-flow 2.4s linear infinite;
    }
}

@keyframes track {
    from { background-position: 0 0; }
    to { background-position: 0 56px; }
}

@keyframes packet-flow {
    from { stroke-dashoffset: 268; }
    to { stroke-dashoffset: 0; }
}

@media (max-width: 960px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text {
        text-align: center;
    }

    .hero .lead {
        margin: 0 auto;
    }

    .hero .actions {
        justify-content: center;
    }
}

/* ---------- landing: numbers ---------- */

.stats {
    border-block: 1px solid var(--line);
    background: linear-gradient(180deg, var(--bg-2), var(--bg));
    padding: 40px 0 26px;
}

.stats-in {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
}

.stat p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.stat .big {
    font-size: clamp(2.2rem, 1.5rem + 2.2vw, 3.2rem);
    font-weight: 850;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    color: var(--c);
    text-shadow: 0 0 30px color-mix(in srgb, var(--c) 45%, transparent);
}

.stat.c1 { --c: var(--cyan); }
.stat.c2 { --c: var(--violet); }
.stat.c3 { --c: var(--magenta); }
.stat.c4 { --c: var(--mint); }

.stats-src {
    margin-top: 26px;
    font-size: 0.85rem;
    color: var(--faint);
}

@media (max-width: 900px) {
    .stats-in { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 460px) {
    .stats-in { grid-template-columns: 1fr; gap: 22px; }
}

/* ---------- landing: sections ---------- */

.section {
    padding: clamp(56px, 7vw, 96px) 0 0;
}

.section h2 {
    font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.75rem);
    letter-spacing: -0.035em;
    font-weight: 800;
    margin: 0 0 12px;
}

.section .intro {
    max-width: 66ch;
    color: var(--muted);
    font-size: 1.08rem;
    margin-bottom: 32px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 18px;
}

.features.pairs {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
}

.feature {
    --c: var(--cyan);
    position: relative;
    display: block;
    padding: 24px 24px 22px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--text);
    background: linear-gradient(160deg, color-mix(in srgb, var(--c) 16%, var(--surface)), var(--surface) 60%);
    border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
    overflow: hidden;
    transition: border-color 0.2s, transform 0.15s;
}

.feature::before {
    content: "";
    position: absolute;
    left: 24px;
    top: 0;
    width: 44px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--c);
    box-shadow: 0 0 16px var(--c);
}

.feature h3 {
    margin: 4px 0 8px;
    font-size: 1.15rem;
    color: var(--text);
}

.feature p {
    margin: 0;
    color: var(--muted);
}

a.feature:hover {
    border-color: var(--c);
    transform: translateY(-2px);
}

.feature.f2 { --c: var(--violet); }
.feature.f3 { --c: var(--magenta); }
.feature.f4 { --c: var(--amber); }
.feature.f5 { --c: var(--mint); }
.feature.f6 { --c: #5aa2ff; }

.charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr));
    gap: 20px;
}

.more {
    margin-top: 12px;
}

.steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 14px;
    margin-top: 28px;
}

.steps li {
    counter-increment: step;
    position: relative;
    margin: 0;
    padding: 54px 20px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--muted);
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 20px;
    top: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--grad);
    color: var(--on-accent);
    font-weight: 800;
    font-size: 0.9rem;
}

.highlight-callout {
    max-width: 68ch;
    margin: 26px 0 22px;
    color: var(--muted);
    font-size: 1.05rem;
}

.highlight-callout strong {
    color: var(--text);
}

/* ---------- footer ---------- */

footer.site {
    margin-top: 96px;
    border-top: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--muted);
    font-size: 0.92rem;
}

.footer-in {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 44px;
}

footer.site p {
    margin: 0 0 0.5em;
    max-width: 78ch;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: var(--text);
    font-size: 1.05rem;
}

/* ---------- docs ---------- */

.docbar {
    display: none;
}

.doc-shell {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    gap: 48px;
    padding: 0 20px;
}

.sidebar {
    position: sticky;
    top: var(--bar-h);
    align-self: start;
    max-height: calc(100vh - var(--bar-h));
    overflow-y: auto;
    padding: 28px 8px 40px 0;
    scrollbar-width: thin;
}

.sidebar h2 {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--cyan);
    margin: 26px 7px 8px;
    border: 0;
    padding: 0;
}

.sidebar h2:first-child {
    margin-top: 0;
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar li + li {
    margin-top: 0;
}

.sidebar a {
    display: block;
    padding: 3px 8px;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.94rem;
    font-weight: 550;
    line-height: 1.38;
}

.sidebar a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.sidebar a[aria-current="page"] {
    color: var(--text);
    background: linear-gradient(90deg, color-mix(in srgb, var(--cyan) 18%, transparent), transparent);
}

.sidebar .toc {
    margin: 4px 0 6px 7px;
    padding-left: 8px;
    border-left: 1px solid var(--line-2);
}

.sidebar .toc a {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 2px 6px;
    color: var(--faint);
}

.sidebar .toc a.active {
    color: var(--cyan);
    background: none;
}

body.docs {
    background: var(--bg-prose);
}

.doc {
    min-width: 0;
    max-width: 52rem;
    padding: 20px 0 32px;
    font-size: 1.04rem;
    line-height: 1.72;
}

.doc pre,
.doc table {
    line-height: 1.6;
}

.doc > p,
.doc > ul,
.doc > ol,
.doc > dl {
    max-width: 72ch;
}

.doc h2 {
    border-top: 1px solid var(--line);
    padding-top: 28px;
}

.doc h1 + .lead + h2,
.doc .lead + p + h2 {
    border-top: 0;
}

.lead {
    font-size: 1.16rem;
    line-height: 1.6;
    color: var(--muted);
    max-width: 64ch;
}

.note {
    background: color-mix(in srgb, var(--violet) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--violet) 35%, var(--line));
    border-radius: 14px;
    padding: 14px 18px;
    margin: 0 0 1.3em;
}

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

dl.terms dt {
    font-weight: 650;
    margin-top: 1em;
}

dl.terms dd {
    margin: 0.2em 0 0;
    color: var(--muted);
}

.pager {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 56px;
}

.pager a {
    display: block;
    padding: 14px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    font-weight: 650;
    min-width: 13rem;
}

.pager a:hover {
    border-color: var(--cyan);
}

.pager a span {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--faint);
}

.pager .next {
    margin-left: auto;
    text-align: right;
}

.docs footer.site {
    margin-top: 40px;
}

@media (max-width: 960px) {
    .docbar {
        display: block;
        position: sticky;
        top: var(--bar-h);
        z-index: 30;
        background: var(--topbar-bg);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--line);
        padding: 8px 16px;
    }

    .side-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        height: 40px;
        padding: 0 14px;
        border-radius: 10px;
        border: 1px solid var(--line-2);
        background: var(--surface);
        color: var(--text);
        font: 600 0.92rem var(--font);
        cursor: pointer;
    }

    .side-btn svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
    }

    .doc-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        width: min(300px, 86vw);
        max-height: none;
        padding: 24px 16px 40px;
        background: var(--bg-2);
        border-right: 1px solid var(--line);
        box-shadow: var(--shadow);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform 0.28s var(--ease), visibility 0s 0.28s;
    }

    body.side-open .sidebar {
        transform: none;
        visibility: visible;
        transition: transform 0.28s var(--ease);
    }

    .doc {
        padding-top: 8px;
    }
}

/* ---------- language tabs ---------- */

.tabs {
    margin: 0 0 1.5em;
}

.tablist {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.tablist button {
    flex: 0 0 auto;
    min-width: 76px;
    height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--muted);
    font: 650 0.92rem var(--font);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.tablist button:hover {
    color: var(--text);
    background: var(--surface-2);
}

.tablist button[aria-selected="true"] {
    color: var(--on-accent);
    background: var(--grad);
    box-shadow: 0 2px 14px rgba(143, 128, 255, 0.35);
}

.tabpanel {
    padding-top: 14px;
}

.tabpanel pre {
    max-height: 38rem;
}

/* ---------- charts ---------- */

.chart {
    background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 70%, var(--bg)));
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px 22px 16px;
    margin: 0 0 20px;
    min-width: 0;
    box-shadow: var(--shadow);
}

.chart figcaption h3 {
    margin: 0 0 4px;
    font-size: 1.08rem;
}

.chart figcaption p {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: var(--muted);
}

.chart-svg svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-svg text {
    font-family: var(--font);
    font-size: 13px;
    fill: var(--text);
}

.chart-svg .lab {
    fill: var(--muted);
}

.chart-svg .us .lab,
.chart-svg .us .val {
    fill: var(--text);
    font-weight: 800;
}

.chart-svg .tcp .lab,
.chart-svg .tcp .val {
    fill: var(--text);
    font-weight: 700;
}

.chart-svg .val {
    fill: var(--muted);
    font-size: 12.5px;
}

.chart-svg .bar {
    fill: var(--bar-other);
}

.chart-svg .us .bar {
    filter: drop-shadow(0 0 6px rgba(54, 226, 255, 0.55));
}

.chart-svg .tcp .bar {
    filter: drop-shadow(0 0 5px rgba(143, 128, 255, 0.45));
}

.chart-notes {
    margin: 4px 0 0;
    font-size: 0.86rem;
    color: var(--faint);
    max-width: 90ch;
}

.doc .charts {
    grid-template-columns: 1fr;
}

@media (prefers-reduced-motion: no-preference) {
    .chart-svg .bar {
        transform: scaleX(0);
        transform-box: fill-box;
        transform-origin: 0 50%;
        transition: transform 0.9s var(--ease);
        transition-delay: var(--d, 0s);
    }

    .chart-svg .val {
        opacity: 0;
        transition: opacity 0.35s ease;
        transition-delay: calc(var(--d, 0s) + 0.5s);
    }

    .chart.in .chart-svg .bar {
        transform: none;
    }

    .chart.in .chart-svg .val {
        opacity: 1;
    }
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.fig {
    max-width: 44rem;
    margin: 0 0 1.4em;
    padding: 16px 18px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.fig svg {
    display: block;
    width: 100%;
    height: auto;
}

.fig figcaption {
    margin-top: 8px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--muted);
}

@media (max-width: 480px) {
    .chart {
        padding: 16px 14px 12px;
    }
}

@media print {
    .topbar,
    .sidebar,
    .docbar,
    .copy {
        display: none;
    }
}
