:root {
    --bg: #05060f;
    --bg-elev: rgba(16, 19, 38, 0.66);
    --bg-card: rgba(14, 17, 34, 0.78);
    --bg-input: rgba(4, 5, 14, 0.7);
    --line: rgba(170, 182, 230, 0.14);
    --line-strong: rgba(170, 182, 230, 0.28);
    --text: #eef1ff;
    --muted: #9aa3c7;
    --dim: #687096;
    --accent: #8fe3ff;
    --violet: #b48cff;
    --ok: #4be37a;
    --err: #ff6b88;
    --warn: #ffd23f;
    --spectrum: linear-gradient(90deg, #ff4d6d, #ff8a3d, #ffd23f, #4be37a, #2fd4ff, #4f7dff, #a35bff);
    --radius: 1rem;
    --header: 4.5rem;
    --font: "Public Sans", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header) + 1rem);
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
}

body {
    overflow-x: hidden;
}

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

a:hover {
    color: #fff;
}

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

[hidden] {
    display: none !important;
}

h1 code,
h2 code,
h3 code {
    padding: 0 !important;
    background: none !important;
    color: inherit !important;
    font-size: 0.9em;
}

:not(pre) > code {
    padding: 0.05em 0.35em;
    border-radius: 0.35em;
    background: rgba(170, 182, 230, 0.1);
    color: #dfe5ff;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 80;
    padding: 0.5rem 0.8rem;
    background: #fff;
    color: var(--bg);
    border-radius: 0.4rem;
}

.skip-link:focus {
    top: 1rem;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.page-bg {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(900px 520px at 8% -12%, rgba(163, 91, 255, 0.16), transparent 60%),
        radial-gradient(760px 460px at 96% 6%, rgba(47, 212, 255, 0.12), transparent 55%),
        radial-gradient(800px 420px at 50% 118%, rgba(255, 77, 109, 0.07), transparent 60%),
        var(--bg);
}

.page-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(170, 182, 230, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(170, 182, 230, 0.045) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at 50% 0%, black 15%, transparent 70%);
}

.shell {
    width: min(1160px, calc(100% - 2rem));
    margin-inline: auto;
}

/* The playground breaks out wider: the SQL must fit without scrolling. */
.shell-wide {
    width: min(1600px, calc(100% - 2rem));
}

/* ---------------------------------------------------------------- header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header);
    border-bottom: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.site-header.is-scrolled {
    background: rgba(5, 6, 15, 0.8);
    border-bottom-color: var(--line);
    backdrop-filter: blur(16px);
}

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header);
    gap: 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
}

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

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.brand-mark {
    width: 40px;
    height: 31px;
    overflow: visible;
    filter: drop-shadow(0 0 10px rgba(143, 227, 255, 0.25));
}

.brand-name {
    font-weight: 800;
    letter-spacing: -0.035em;
    font-size: 1.12rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav a {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
}

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

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 16px;
    height: 1.5px;
    margin: 5px auto;
    background: var(--text);
}

/* ---------------------------------------------------------------- hero */

.hero {
    padding: 4rem 0 4.5rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 2.5rem;
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1.1rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 26px;
    height: 3px;
    border-radius: 99px;
    background: var(--spectrum);
}

h1,
h2,
h3 {
    letter-spacing: -0.04em;
    line-height: 1.06;
    font-weight: 800;
    margin: 0 0 1rem;
}

h1 {
    font-size: clamp(2.6rem, 5.6vw, 4.6rem);
}

.spectrum-text {
    background: linear-gradient(90deg, #ff6b88 0%, #ffb04a 22%, #ffe06a 40%, #6cf0a0 58%, #5ad8ff 76%, #b48cff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lede {
    max-width: 38rem;
    color: var(--muted);
    font-size: 1.1rem;
    margin: 0 0 2rem;
}

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

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2.4rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.8rem;
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

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

.btn:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}

.btn-primary {
    background: #fff;
    color: var(--bg);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 8px 30px rgba(143, 227, 255, 0.18);
}

.btn-primary:hover {
    background: #e9f8ff;
    color: var(--bg);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--line-strong);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: rgba(143, 227, 255, 0.5);
    color: #fff;
}

.btn-sm {
    min-height: 2.1rem;
    padding: 0.3rem 0.9rem;
    font-size: 0.84rem;
}

.btn kbd {
    padding: 0.05rem 0.35rem;
    border-radius: 0.3rem;
    background: rgba(5, 6, 15, 0.1);
    font-size: 0.72rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
}

.stat {
    padding-left: 0.8rem;
    border-left: 1px solid var(--line-strong);
}

.stat dt {
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.stat dd {
    margin: 0.15rem 0 0;
    color: var(--dim);
    font-size: 0.8rem;
    line-height: 1.4;
}

.hero-visual {
    position: relative;
    min-width: 0;
}

.hero-prism {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    margin-bottom: 0.5rem;
}

.hp-photon {
    animation: photon 3.2s linear infinite;
}

.hp-spectrum {
    animation: shimmer 6s ease-in-out infinite;
}

.hp-bloom {
    animation: bloom 6s ease-in-out infinite;
}

@keyframes photon {
    from { stroke-dashoffset: 100; }
    to { stroke-dashoffset: 0; }
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.86; }
}

@keyframes bloom {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 0.7; }
}

/* ---------------------------------------------------------------- ticker */

.progress-ticker {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 30rem;
    margin: 0 auto;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-elev);
    backdrop-filter: blur(10px);
}

.ticker-orb {
    position: relative;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
}

.ticker-bullet {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: #fff;
    box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.7), 0 0 18px 6px rgba(143, 227, 255, 0.25);
}

.ticker-spinner {
    position: absolute;
    inset: 1px;
    border: 1.5px solid transparent;
    border-top-color: #fff;
    border-right-color: rgba(255, 255, 255, 0.35);
    border-radius: 99px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.progress-ticker.is-fetching .ticker-spinner {
    opacity: 1;
    animation: ticker-spin 0.7s linear infinite;
}

.progress-ticker.is-fetching .ticker-bullet {
    opacity: 0.55;
}

.ticker-viewport {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 1.35rem;
    overflow: hidden;
}

.ticker-line {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    margin: 0;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.ticker-line.is-in {
    transform: translateY(0);
    opacity: 1;
}

.ticker-line.is-out {
    transform: translateY(-120%);
    opacity: 0;
}

.ticker-status {
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 500;
    white-space: nowrap;
}

.ticker-commit {
    gap: 0.7rem;
}

.ticker-sha {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: 0.8rem;
}

.ticker-sha:not([href]) {
    color: var(--dim);
    pointer-events: none;
}

.ticker-title {
    min-width: 0;
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes ticker-spin {
    to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------- sections */

.section {
    padding: 4.5rem 0;
}

.section-head {
    max-width: 44rem;
    margin-bottom: 2.2rem;
}

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

h2 {
    font-size: clamp(1.9rem, 3.2vw, 2.7rem);
}

.kicker {
    display: inline-block;
    margin: 0 0 0.6rem;
    color: var(--violet);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.card,
.eco-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem 1.25rem 1.35rem;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: var(--spectrum);
    opacity: 0.55;
}

.card h3,
.eco-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.card p:last-child,
.eco-card p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
}

/* ---------------------------------------------------------------- compatibility */

.proof {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.proof-item {
    padding: 1.3rem 1.25rem;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--line);
}

.proof-item b {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 2rem;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.proof-item span {
    color: var(--muted);
    font-size: 0.92rem;
}

.features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.features li {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-elev);
    color: #d5dbf7;
    font-family: var(--mono);
    font-size: 0.78rem;
}

.features li.ext {
    border-color: rgba(180, 140, 255, 0.45);
    color: var(--violet);
}

.note {
    color: var(--dim);
    font-size: 0.88rem;
    margin: 0;
}

/* ---------------------------------------------------------------- playground */

.console {
    background: var(--bg-card);
    border: 1px solid var(--line-strong);
    border-radius: 1.2rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.console-top {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    color: var(--dim);
    font-family: var(--mono);
    font-size: 0.78rem;
}

.console-file {
    margin-left: 0.4rem;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 99px;
}

.dot-r { background: #ff4d6d; }
.dot-y { background: #ffd23f; }
.dot-g { background: #4be37a; }

.play-pill {
    margin-left: auto;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--dim);
    font-size: 0.72rem;
    white-space: nowrap;
}

.play-pill.ok { color: var(--ok); border-color: rgba(75, 227, 122, 0.4); }
.play-pill.err { color: var(--err); border-color: rgba(255, 107, 136, 0.45); }
.play-pill.busy { color: var(--warn); border-color: rgba(255, 210, 63, 0.4); }

.console-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
}

.toolbar-gap {
    flex: 1;
}

.play-label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 0.76rem;
}

.play-label select {
    max-width: 100%;
    min-height: 2.1rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.6rem;
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.86rem;
}

.console-body {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    grid-template-rows: auto auto;
}

.schema {
    grid-row: 1 / span 2;
    padding: 0.8rem 0.75rem;
    border-right: 1px solid var(--line);
    background: rgba(4, 5, 14, 0.35);
    min-width: 0;
}

.schema-title {
    margin: 0 0 0.5rem;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.schema-list {
    position: sticky;
    top: calc(var(--header) + 0.5rem);
    display: grid;
    gap: 0.15rem;
    max-height: calc(100vh - var(--header) - 4rem);
    overflow: auto;
}

.schema-empty {
    margin: 0;
    color: var(--dim);
    font-size: 0.8rem;
}

.schema-item {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    width: 100%;
    padding: 0.28rem 0.4rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: #d5dbf7;
    font-family: var(--mono);
    font-size: 0.78rem;
    text-align: left;
    cursor: pointer;
}

.schema-item:hover {
    background: rgba(143, 227, 255, 0.08);
    color: #fff;
}

.schema-item i {
    flex: 0 0 auto;
    width: 1.1rem;
    color: var(--dim);
    font-style: normal;
    font-size: 0.66rem;
    text-transform: uppercase;
}

.schema-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-wrap {
    display: flex;
    min-width: 0;
    border-bottom: 1px solid var(--line);
}

#sql-input {
    flex: 1;
    width: 100%;
    min-height: 14rem;
    margin: 0;
    padding: 1rem 1.2rem;
    border: 0;
    resize: none;
    background: var(--bg-input);
    color: #e4e9ff;
    font-family: var(--mono);
    font-size: 0.86rem;
    line-height: 1.65;
    tab-size: 2;
    /* playground.js sizes the height to the text; a line longer than the
       editor wraps instead of scrolling sideways. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: hidden;
}

#sql-input:focus {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(143, 227, 255, 0.35);
}

.results {
    min-width: 0;
    max-height: 40rem;
    padding: 0.75rem;
    overflow: auto;
    display: grid;
    align-content: start;
    gap: 0.6rem;
}

.results-empty {
    margin: 0.4rem 0.2rem;
    color: var(--dim);
    font-size: 0.86rem;
}

.res {
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: rgba(4, 5, 14, 0.45);
    overflow: hidden;
}

.res-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.75rem;
}

.res-sql {
    flex: 1;
    min-width: 0;
    color: #c7cff2;
    font-family: var(--mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.res-meta {
    flex: 0 0 auto;
    color: var(--dim);
    font-family: var(--mono);
}

.res-body {
    padding: 0.5rem 0.7rem;
    font-size: 0.84rem;
}

.res-done {
    color: var(--ok);
}

.res-err {
    border-color: rgba(255, 107, 136, 0.4);
}

.res-err .res-body {
    color: var(--err);
    font-family: var(--mono);
    font-size: 0.82rem;
}

.res-compact .res-head {
    border-bottom: 0;
}

.res-compact .res-meta.res-done {
    color: var(--ok);
}

.grid-wrap {
    max-height: 18rem;
    overflow: auto;
}

.grid {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: 0.78rem;
    white-space: nowrap;
}

.grid th,
.grid td {
    padding: 0.35rem 0.7rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.grid th.num {
    text-align: right;
}

.grid th {
    position: sticky;
    top: 0;
    background: #0c0f20;
    color: var(--muted);
    font-weight: 500;
}

.grid td.num {
    text-align: right;
    color: #ffe6a8;
}

.grid td.null {
    color: var(--dim);
    font-style: italic;
}

.grid td.blob {
    color: var(--violet);
}

.grid tr:hover td {
    background: rgba(143, 227, 255, 0.04);
}

.res-more {
    padding: 0.4rem 0.7rem;
    color: var(--dim);
    font-size: 0.76rem;
}

.console-hint {
    margin: 0;
    padding: 0.7rem 1rem 0.9rem;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 0.8rem;
}

/* ---------------------------------------------------------------- ecosystem */

.eco {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.eco-card h3 code {
    font-size: 0.92em;
}

.eco-ide {
    background:
        linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
        linear-gradient(135deg, rgba(255, 77, 109, 0.35), rgba(47, 212, 255, 0.3), rgba(163, 91, 255, 0.45)) border-box;
    border: 1px solid transparent;
}

/* ---------------------------------------------------------------- downloads */

.dl-group {
    margin: 2rem 0 0.8rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
}

.dl-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    padding: 1.15rem 1.15rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.dl-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem 0.6rem;
}

.dl-top h4 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.dl-platform {
    flex: 0 0 auto;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.7rem;
    white-space: nowrap;
}

.dl-what {
    flex: 1;
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.dl-file {
    margin: 0;
    color: var(--dim);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.dl-hash summary {
    color: var(--dim);
    font-size: 0.78rem;
    cursor: pointer;
}

.dl-hash code {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.dl-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

.dl-actions [aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
}

#download .note {
    margin-top: 1.6rem;
}

/* ---------------------------------------------------------------- documentation */

.docs-hero {
    padding: 3.5rem 0 1rem;
}

.docs-title {
    font-size: clamp(2.2rem, 4.5vw, 3.6rem);
}

.docs-layout {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
    padding-bottom: 5rem;
}

.docs-aside {
    position: sticky;
    top: calc(var(--header) + 1rem);
    max-height: calc(100vh - var(--header) - 2rem);
    overflow: auto;
    padding-right: 0.5rem;
}

.docs-nav ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs-nav > ol > li {
    margin-bottom: 0.45rem;
}

.docs-nav a {
    display: block;
    padding: 0.18rem 0.6rem;
    border-left: 2px solid transparent;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

.docs-nav > ol > li > a {
    color: var(--text);
    font-weight: 600;
}

.docs-nav ol ol a {
    padding-left: 1.2rem;
    font-size: 0.82rem;
}

.docs-nav a:hover {
    color: #fff;
}

.docs-nav a.is-current {
    border-left-color: var(--accent);
    color: #fff;
}

.doc {
    min-width: 0;
    max-width: 52rem;
    color: #d9def5;
    font-size: 1rem;
    line-height: 1.7;
}

.doc-chapter {
    padding-bottom: 2.5rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--line);
}

.doc h1 {
    max-width: none;
    margin: 0 0 1rem;
    font-size: 2rem;
    scroll-margin-top: calc(var(--header) + 1rem);
}

.doc h2 {
    margin: 2.2rem 0 0.8rem;
    font-size: 1.35rem;
    scroll-margin-top: calc(var(--header) + 1rem);
}

.doc h3 {
    margin: 1.6rem 0 0.6rem;
    font-size: 1.1rem;
}

.doc p,
.doc ul,
.doc ol {
    margin: 0 0 1rem;
}

.doc ul,
.doc ol {
    padding-left: 1.4rem;
}

.doc li {
    margin-bottom: 0.4rem;
}

.doc li > p {
    margin-bottom: 0.5rem;
}

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

.doc a {
    text-decoration: underline;
    text-decoration-color: rgba(143, 227, 255, 0.35);
    text-underline-offset: 2px;
}

.doc pre {
    position: relative;
    margin: 0 0 1.2rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: #070914;
    color: #e4e9ff;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.6;
    overflow-x: auto;
}

.doc pre code {
    padding: 0;
    background: none;
    font-size: inherit;
}

.copy-btn {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.4rem;
    background: rgba(5, 6, 15, 0.85);
    color: var(--muted);
    font-family: var(--font);
    font-size: 0.72rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.doc pre:hover .copy-btn,
.copy-btn:focus-visible {
    opacity: 1;
}

.doc-table {
    margin: 0 0 1.2rem;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
}

.doc table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.doc th,
.doc td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.doc th {
    background: rgba(170, 182, 230, 0.06);
    color: var(--text);
    font-weight: 600;
}

.doc tr:last-child td {
    border-bottom: 0;
}

.doc .admonition {
    margin: 0 0 1.2rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid rgba(143, 227, 255, 0.3);
    border-left: 3px solid var(--accent);
    border-radius: 0.6rem;
    background: rgba(143, 227, 255, 0.05);
}

.doc .admonition.warning {
    border-color: rgba(255, 210, 63, 0.35);
    border-left-color: var(--warn);
    background: rgba(255, 210, 63, 0.05);
}

.doc .admonition-title {
    margin: 0 0 0.35rem;
    color: var(--text);
    font-weight: 700;
}

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

/* ---------------------------------------------------------------- architecture */

.crate-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.crate {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: var(--bg-elev);
}

.crate > code {
    padding: 0;
    background: none;
    color: var(--accent);
    font-size: 0.82rem;
}

.crate span {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------- changelog */

.banner {
    margin: 0 0 1.2rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(255, 210, 63, 0.28);
    background: rgba(255, 210, 63, 0.08);
    color: #ffe8a0;
    border-radius: 0.8rem;
    font-size: 0.9rem;
}

.commits {
    display: grid;
    gap: 0.6rem;
}

.commit {
    display: grid;
    grid-template-columns: 6.2rem 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 1.05rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--bg-card);
}

.commit a {
    font-family: var(--mono);
    font-size: 0.85rem;
}

.commit strong {
    display: block;
    font-weight: 600;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.commit .meta {
    color: var(--dim);
    font-size: 0.82rem;
}

.commit time {
    color: var(--dim);
    font-size: 0.8rem;
    white-space: nowrap;
}

.empty {
    color: var(--muted);
}

.more-commits {
    margin-top: 0.6rem;
}

.more-commits > summary {
    width: fit-content;
    margin: 0.4rem 0 0.8rem;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.92rem;
}

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

.site-footer {
    border-top: 1px solid var(--line);
    padding: 2.4rem 0 3rem;
    color: var(--muted);
}

.footer-inner {
    display: grid;
    gap: 0.7rem;
}

.footer-inner p {
    margin: 0;
}

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

.fineprint {
    color: var(--dim);
    font-size: 0.82rem;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
    .nav {
        gap: 1rem;
    }

    .nav a {
        font-size: 0.86rem;
    }

    .console-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .schema {
        grid-row: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .schema-list {
        position: static;
        max-height: none;
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .schema-item {
        width: auto;
        border: 1px solid var(--line);
        border-radius: 999px;
        padding: 0.2rem 0.6rem;
    }
}

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

    .docs-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

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

    .docs-aside {
        position: static;
        max-height: none;
        padding: 0.8rem;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--bg-card);
    }

    .docs-nav ol ol {
        display: none;
    }

    .hero-visual {
        max-width: 620px;
        margin-inline: auto;
        width: 100%;
    }

    .grid-3,
    .eco,
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 720px) {
    .nav-toggle {
        display: inline-block;
    }

    .nav {
        display: none;
        position: absolute;
        top: var(--header);
        left: -1rem;
        right: -1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 0.4rem 1rem 1rem;
        background: rgba(5, 6, 15, 0.97);
        border-bottom: 1px solid var(--line);
    }

    .nav.is-open {
        display: flex;
    }

    .nav a {
        width: 100%;
        padding: 0.75rem 0;
    }

    .hero,
    .section {
        padding: 3rem 0;
    }

    .grid-3,
    .eco,
    .dl-grid,
    .crate-list,
    .commit,
    .crate,
    .console-body {
        grid-template-columns: 1fr;
    }

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

    #sql-input {
        font-size: 0.8rem;
        padding: 0.9rem;
    }

    .toolbar-gap {
        display: none;
    }

    .play-label {
        width: 100%;
    }

    .play-label select {
        flex: 1;
        min-width: 0;
    }

    .commit time {
        justify-self: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hp-photon,
    .hp-spectrum,
    .hp-bloom,
    .ticker-spinner {
        animation: none !important;
    }

    .hp-photon {
        display: none;
    }

    .btn,
    .ticker-line {
        transition: none;
    }
}
