/*
 * Showcase layer. Loaded after assets/style.css and any page <style>, so it
 * refines every page without touching their markup.
 *
 * Rules it follows (Emil Kowalski's skills + Apple's motion/materials notes):
 *  - Animate only transform and opacity; name the properties, never "all".
 *  - ease-out for enter/exit, UI motion under 300ms, exits faster than enters.
 *  - Press feedback on pointer-down (scale 0.97), hover only where hover exists.
 *  - Reduced motion = fewer, gentler animations (opacity stays, movement goes).
 *  - Mobile-native: tap highlight off, 16px inputs, safe areas, dvh, no sticky hover.
 *  - Break-UI: nothing may overflow at 320px or 200% zoom; long words wrap.
 */

:root {
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --bg: #0a0a0b;
    --surface: #101012;
    --border: #1c1c20;
    --line: #26262b;
    --text: #ececee;
    --text-dim: #8a8a92;
    --accent: #8b9cf7;
    --radius: 6px;
    --gutter: max(24px, env(safe-area-inset-left));
}

/* ── Base: mobile-native defaults ─────────────────────────────── */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    scroll-padding-top: 72px;
}
body {
    -webkit-font-smoothing: antialiased;
    font-optical-sizing: auto;
    line-height: 1.55;
    background: var(--bg);
    overflow-wrap: break-word;
    padding-bottom: env(safe-area-inset-bottom);
}
a, button, summary, label { touch-action: manipulation; }
input, select, textarea { font-size: max(16px, 1em); }
img { max-width: 100%; height: auto; }
.container { padding-left: max(32px, env(safe-area-inset-left)); padding-right: max(32px, env(safe-area-inset-right)); min-width: 0; }
@media (max-width: 768px) { .container { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* Display type: tracking tightens as size grows, leading shrinks */
h1 {
    font-size: clamp(2.25rem, 6.2vw, 4.25rem);
    letter-spacing: -0.035em;
    line-height: 1.04;
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    color: #fff;
    text-wrap: balance;
}
.section-title, .section-head h2, .cta h2 { letter-spacing: -0.03em; line-height: 1.1; text-wrap: balance; }
.hero p, .section-head p { text-wrap: pretty; }
.doc h1, main h1 { -webkit-text-fill-color: currentColor; color: #fff; }

/* ── Header: translucent material, sticky ─────────────────────── */
.vibe-ribbon + .container {
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(10, 10, 11, 0.72);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
    max-width: none;
}
.vibe-ribbon + .container > nav { max-width: 1136px; margin: 0 auto; }
nav { border-bottom: 0; padding: 14px 0; gap: 20px; min-width: 0; }
.logo { white-space: nowrap; font-size: 16px; letter-spacing: -0.01em; }
.logo-icon { background: none; border: 1px solid #3a3a42; border-radius: var(--radius); width: 26px; height: 26px; font-size: 13px; color: var(--text-dim); }
.nav-links { gap: 22px; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 4px 2px; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { white-space: nowrap; transition: color 160ms ease; }
.nav-dl { background: var(--text); color: #0a0a0b !important; border-radius: var(--radius); }
@media (max-width: 560px) {
    .logo { font-size: 15px; }
    .nav-links { gap: 16px; }
    .nav-links a { font-size: 13px; }
}
@media (hover: none), (pointer: coarse) { .nav-links a:hover { color: var(--text-dim); } }

/* ── Hero: no glow, no gradient fill ──────────────────────────── */
.hero { padding: clamp(56px, 10vw, 112px) 0 clamp(48px, 7vw, 80px); }
.hero::before { display: none; }
.badge { background: none; border: 1px solid var(--line); color: var(--text-dim); border-radius: 100px; }
.badge .dot { animation: none; }
.hero p { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); line-height: 1.5; }

/* ── Surfaces: flat, small radius, no shadows ─────────────────── */
.feature-card, .info-block, .product-card, .gallery-item, .app-preview, .callout, main pre {
    border-radius: var(--radius);
    box-shadow: none;
}
.app-preview { box-shadow: none !important; }
.feature-card, .product-card, .rune-tile, .btn-primary, .btn-secondary, .brand-pill {
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.feature-card .icon, .product-card .icon-lg, .rune-glyph { display: none; }
.concept-note { border-radius: var(--radius); background: transparent; border: 1px solid #3a3320; }
.concept-note strong { color: #d9a441; }
.hero-icon { filter: none; border-radius: 22%; }
.pill { border-radius: 3px; background: rgba(139, 156, 247, 0.1); }
code { border-radius: 3px; }
.feature-grid, .gallery-grid, .info-grid, .product-grid { min-width: 0; }
.feature-grid > *, .gallery-grid > *, .info-grid > *, .product-grid > * { min-width: 0; }
table { max-width: 100%; }
pre { max-width: 100%; overflow-x: auto; }

/* Buttons: solid light primary, press on pointer-down */
.btn-primary { background: var(--text); color: #0a0a0b; border-radius: var(--radius); }
.btn-primary.disabled { background: #1d1d21; color: #66666d; }
.btn-secondary { border-color: var(--line); border-radius: var(--radius); }
.btn-primary:active, .btn-secondary:active, .nav-dl:active, .showcase-tab:active, .showcase-nav:active { transform: scale(0.97); }

/* Hover only where a pointer can hover. Outside this block nothing sticks. */
.feature-card:hover, .product-card:hover { transform: none; border-color: var(--border); }
.btn-primary:hover { background: var(--text); transform: none; }
.btn-primary.disabled:hover { background: #1d1d21; }
.btn-secondary:hover { border-color: var(--line); color: var(--text-dim); }
.rune-tile:hover { border-color: #2c2c33; background: transparent; }
.brand-pill:hover { border-color: var(--border); color: var(--text-dim); }
@media (hover: hover) and (pointer: fine) {
    .feature-card:hover, .product-card:hover { border-color: #34343a; }
    .btn-primary:hover { background: #fff; }
    .btn-secondary:hover { border-color: #55555d; color: var(--text); }
    .rune-tile:hover { border-color: var(--accent); background: var(--surface); }
    .brand-pill:hover { border-color: #34343a; color: var(--text); }
}

/* ── Footer ───────────────────────────────────────────────────── */
footer { color: #55555c; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
footer a { color: var(--text-dim); }

/* ── Vibe ribbon stays, but keeps clear of the home indicator ─── */
.vibe-ribbon { bottom: env(safe-area-inset-bottom); left: env(safe-area-inset-left); }

/* ── Scroll reveal: opacity + 8px translate, 30–80ms stagger ──── */
.js .reveal { opacity: 0; transform: translateY(8px); }
.js .reveal.in {
    opacity: 1;
    transform: none;
    transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
    transition-delay: calc(var(--i, 0) * 50ms);
}

/* ── Homepage: concept index ──────────────────────────────────── */
.concepts { padding: 8px 0 24px; }
.group-label { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); padding: 40px 0 12px; border-bottom: 1px solid var(--line); }
.concept-list { list-style: none; }
.concept {
    display: grid;
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto;
    gap: 8px 40px;
    align-items: start;
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
}
.concept h3 { font-size: 1.375rem; letter-spacing: -0.02em; line-height: 1.2; }
.concept h3 a { text-decoration: none; }
.concept .tag { display: block; font-size: 12px; color: var(--text-dim); letter-spacing: 0.02em; margin-top: 6px; }
.concept .tag.soon { color: #d9a441; }
.concept p { color: var(--text-dim); font-size: 15px; line-height: 1.55; max-width: 62ch; text-wrap: pretty; }
.concept .go { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.concept .go a { font-size: 14px; padding: 8px 16px; border-radius: var(--radius); text-decoration: none; border: 1px solid var(--line); color: var(--text-dim); transition: border-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); white-space: nowrap; }
.concept .go a:first-child { background: var(--text); color: #0a0a0b; border-color: var(--text); }
.concept .go a.disabled { background: transparent; color: #66666d; border-color: var(--border); pointer-events: none; }
.concept .go a:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
    .concept .go a:hover { border-color: #55555d; color: var(--text); }
    .concept .go a:first-child:hover { background: #fff; border-color: #fff; color: #0a0a0b; }
}
@media (max-width: 860px) {
    .concept { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 24px 0; }
    .concept .go { justify-content: flex-start; margin-top: 6px; }
}

.runes-section { border-top: 1px solid var(--line); }
.rune-grid { gap: 0; border-top: 1px solid var(--border); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.rune-tile { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 24px 0; margin-right: 32px; }
.rune-tile:hover { background: transparent; }
@media (hover: hover) and (pointer: fine) { .rune-tile:hover { background: transparent; } .rune-tile:hover h3 { color: var(--accent); } }
.rune-tile h3 { transition: color 160ms ease; }
.section-head { text-align: left; margin-left: 0; max-width: 62ch; }
.hero .container.hero-left { text-align: left; }

/* ── Showcase carousel ────────────────────────────────────────── */
.showcase { padding: 0 0 72px; }
.showcase-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.showcase-tabs::-webkit-scrollbar { display: none; }
.showcase-tab { flex: 0 0 auto; background: transparent; border: 1px solid var(--border); color: var(--text-dim); padding: 7px 14px; border-radius: 100px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out); }
.showcase-tab[aria-selected="true"] { background: var(--text); border-color: var(--text); color: #0a0a0b; }
@media (hover: hover) and (pointer: fine) { .showcase-tab:not([aria-selected="true"]):hover { border-color: #3a3a42; color: var(--text); } }
.showcase-frame { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.showcase-stage { position: relative; aspect-ratio: 16 / 9; background: #0c0c0e; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; overflow: hidden; }
.showcase-stage.dragging { cursor: grabbing; }
.showcase-slide {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px;
    opacity: 0; visibility: hidden; transform: translate3d(6%, 0, 0);
    /* exit: quick and out of the way */
    transition: opacity 160ms ease-out, transform 160ms ease-out, visibility 0s linear 160ms, filter 160ms ease-out;
    filter: blur(2px);
}
.showcase-slide.before { transform: translate3d(-6%, 0, 0); }
.showcase-slide.is-active {
    opacity: 1; visibility: visible; transform: none; filter: none;
    /* enter: slightly longer, ease-out */
    transition: opacity 280ms var(--ease-out), transform 280ms var(--ease-out), filter 280ms var(--ease-out), visibility 0s;
}
.showcase-stage.dragging .showcase-slide { transition: none; }
.showcase-stage.instant .showcase-slide, .showcase-stage.instant .showcase-slide.is-active { transition: none; }
.showcase-slide img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); pointer-events: none; -webkit-user-drag: none; }
.showcase-caption { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 24px; border-top: 1px solid var(--border); }
.showcase-caption h3 { font-size: 17px; letter-spacing: -0.015em; margin-bottom: 2px; }
.showcase-caption p { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.showcase-caption .btn-small { flex: 0 0 auto; }
.showcase-nav { position: absolute; top: 50%; margin-top: -22px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #33333a; background: rgba(10, 10, 11, 0.72); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; z-index: 2; transition: border-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.showcase-nav.prev { left: 16px; }
.showcase-nav.next { right: 16px; }
@media (hover: hover) and (pointer: fine) { .showcase-nav:hover { border-color: var(--accent); color: var(--accent); } }
.showcase-progress { height: 2px; background: var(--border); }
.showcase-progress span { display: block; height: 100%; width: 100%; background: var(--text); transform: scaleX(0); transform-origin: 0 50%; }
.showcase-progress.running span { animation: showcase-fill var(--showcase-ms, 6000ms) linear forwards; }
@keyframes showcase-fill { to { transform: scaleX(1); } }
.showcase-count { text-align: right; font-size: 12px; color: var(--text-dim); margin-top: 12px; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }

/* Overview slides: flat boxes, thin lines */
.showcase-slide.is-diagram { padding: 0; align-items: stretch; }
.sc-flow, .sc-facts { width: 100%; padding: 36px 80px; display: flex; flex-direction: column; justify-content: center; }
.sc-kicker { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 20px; }
.sc-row { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; }
.sc-facts .sc-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sc-box { position: relative; border: 1px solid var(--line); border-radius: 3px; padding: 22px 22px 24px; background: #0f0f11; }
.sc-flow .sc-box:not(:last-child)::after { content: ''; position: absolute; top: 50%; left: 100%; width: 48px; height: 1px; background: #4a4a52; }
.sc-flow .sc-box:not(:last-child)::before { content: ''; position: absolute; top: calc(50% - 4px); left: calc(100% + 40px); width: 8px; height: 8px; border-top: 1px solid #4a4a52; border-right: 1px solid #4a4a52; transform: rotate(45deg); }
.sc-num { display: block; font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); margin-bottom: 12px; }
.sc-box h4 { font-size: 1.25rem; letter-spacing: -0.02em; margin-bottom: 12px; }
.sc-box ul { list-style: none; }
.sc-box li { font-size: 14px; line-height: 1.5; color: var(--text-dim); padding-left: 14px; position: relative; margin-bottom: 8px; }
.sc-box li::before { content: ''; position: absolute; left: 0; top: 0.7em; width: 6px; height: 1px; background: #666; }
.sc-box p { font-size: 15px; line-height: 1.55; color: var(--text-dim); }

@media (max-width: 768px) {
    .showcase-stage { aspect-ratio: auto; height: 600px; }
    .showcase-slide { padding: 12px; }
    .showcase-slide:not(.is-diagram) { padding-top: 56px; }
    .showcase-nav { width: 34px; height: 34px; top: 10px; margin-top: 0; }
    .showcase-nav.prev { left: auto; right: 50px; }
    .showcase-nav.next { right: 10px; }
    .showcase-caption { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px 20px; }
    .sc-flow, .sc-facts { padding: 22px 20px; }
    .sc-kicker { margin-bottom: 14px; }
    .sc-row, .sc-facts .sc-row { grid-template-columns: minmax(0, 1fr); gap: 30px; }
    .sc-facts .sc-row { gap: 12px; }
    .sc-box { padding: 14px 16px 16px; }
    .sc-box h4 { font-size: 1.0625rem; margin-bottom: 8px; }
    .sc-box li, .sc-box p { font-size: 13px; margin-bottom: 4px; }
    .sc-flow .sc-box:not(:last-child)::after { top: 100%; left: 50%; width: 1px; height: 30px; }
    .sc-flow .sc-box:not(:last-child)::before { top: calc(100% + 22px); left: calc(50% - 4px); transform: rotate(135deg); }
}

/* ── Accessibility preferences ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    /* gentler, not none: keep opacity, drop the movement */
    .js .reveal { transform: none; }
    .js .reveal.in { transition: opacity 200ms ease; transition-delay: 0ms; }
    .showcase-slide, .showcase-slide.before { transform: none; filter: none; transition: opacity 200ms ease, visibility 0s linear 200ms; }
    .showcase-slide.is-active { transition: opacity 200ms ease, visibility 0s; }
    .showcase-progress.running span { animation: none; }
    .btn-primary:active, .btn-secondary:active, .nav-dl:active, .showcase-tab:active, .showcase-nav:active, .concept .go a:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
    .vibe-ribbon + .container { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .showcase-nav { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
    :root { --text-dim: #b4b4bc; --border: #3a3a42; --line: #4a4a52; }
    .vibe-ribbon + .container { background: var(--bg); box-shadow: 0 1px 0 #4a4a52; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .vibe-ribbon + .container { background: var(--bg); }
}

/* Left-aligned hero (homepage) */
.hero-left p { margin-left: 0; margin-right: 0; max-width: 62ch; }
.hero-left .concept-note { margin: 0 0 8px; max-width: 62ch; }
.hero-left h1 { max-width: 14ch; }
@media (max-width: 560px) { .hero-left h1 { max-width: none; } }

/* Docs layout: grid children must be allowed to shrink (long code, wide tables) */
.layout > *, main { min-width: 0; }
p code, li code, h2 code, h3 code, dd code, .callout code { overflow-wrap: anywhere; }
td, th { overflow-wrap: break-word; }
table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ══ App pages: left-aligned hero, ruled feature list ═══════════ */
.hero .container { text-align: left; }
.hero .badge { margin-bottom: 28px; }
.hero p { margin-left: 0; margin-right: 0; max-width: 62ch; }
.hero .concept-note { margin: 0 0 32px; max-width: 62ch; }
.hero .actions { justify-content: flex-start; }
.app-preview { margin-left: 0; margin-right: 0; max-width: none; margin-top: 48px; }
.hero-icon { margin-left: 0; margin-right: 0; margin-top: 40px; }
.section-label, .section-title { text-align: left; }
.section-label { letter-spacing: 0.14em; }
.section-title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 40px; max-width: 22ch; }
.features { padding: clamp(56px, 8vw, 96px) 0; }
.feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; border-top: 1px solid var(--border); }
.feature-card { background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 26px 0 28px; }
.feature-card:hover { border-color: var(--border); }
.feature-card h3 { font-size: 1.0625rem; letter-spacing: -0.01em; margin-bottom: 8px; }
.feature-card p { font-size: 15px; line-height: 1.6; max-width: 56ch; }
@media (hover: hover) and (pointer: fine) { .feature-card:hover { border-color: var(--border); } }
@media (max-width: 768px) { .feature-grid { grid-template-columns: minmax(0, 1fr); } }
.gallery { padding: clamp(56px, 8vw, 96px) 0; }
.gallery-item { border-radius: 4px; }
.gallery-item .caption { font-size: 13px; }
.docs-section { text-align: left !important; }
.cta { text-align: left; padding: clamp(64px, 9vw, 112px) 0; }
.cta h2 { font-size: clamp(1.875rem, 4.5vw, 3rem); max-width: 18ch; }
.cta p { max-width: 56ch; }
.cta .actions { justify-content: flex-start; }
.info-block { background: none; }
.info-block h3 { color: var(--text); }

/* ══ Docs (and Runes pages): measure, anchors, code, tables, callouts ══ */
[id] { scroll-margin-top: 84px; }
main p, main > ul, main > ol { max-width: 72ch; }
main > p, main > ul, main > ol, main li { text-wrap: pretty; }
main h2 { letter-spacing: -0.025em; line-height: 1.2; text-wrap: balance; }
main h2 .anchor, main h3 .anchor { margin-left: 0.45em; color: var(--text-dim); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity 160ms ease; }
main h2 .anchor:focus-visible, main h3 .anchor:focus-visible { opacity: 1; }
@media (hover: hover) and (pointer: fine) { main h2:hover .anchor, main h3:hover .anchor { opacity: 1; } main h2 .anchor:hover { text-decoration: none; color: var(--accent); } }

.callout { background: #0f0f11; border: 1px solid var(--line); border-radius: 3px; padding: 18px 20px; }
.callout strong { color: var(--text); }
.callout.warn { background: #0f0f11; border-color: #4a3d1c; }
.callout.warn strong { color: #d9a441; }
.config-block, .doc-shot { border-radius: 4px; background: #0f0f11; }
.doc-shot .caption { font-size: 13px; }

.code { position: relative; margin: 16px 0 24px; }
.code pre, main .code pre { margin: 0; }
main pre { background: #0c0c0e; border-radius: 4px; padding: 18px 20px; -webkit-overflow-scrolling: touch; }
main pre code { font-size: 12.5px; line-height: 1.6; }
.copy { position: absolute; top: 8px; right: 8px; font: 600 12px/1 inherit; font-family: inherit; background: #17171a; border: 1px solid var(--line); color: var(--text-dim); border-radius: 4px; padding: 7px 10px; cursor: pointer; opacity: 0; transition: opacity 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.code:focus-within .copy, .copy:focus-visible { opacity: 1; }
.copy.done { color: var(--text); opacity: 1; }
.copy:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .code:hover .copy { opacity: 1; } .copy:hover { color: var(--text); } }
@media (hover: none), (pointer: coarse) { .copy { opacity: 1; } }

table { margin: 16px 0 24px; }
th { color: var(--text-dim); font-weight: 600; letter-spacing: 0.08em; border-bottom-color: var(--line); white-space: nowrap; }
td { border-bottom-color: var(--border); vertical-align: top; }
td:first-child { color: var(--text); }
td code, th code { white-space: nowrap; overflow-wrap: normal; }

.sidebar {
    max-height: calc(100dvh - 104px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    padding: 14px 8px 24px 0;
    margin-top: -14px;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar h3 { color: var(--text-dim); letter-spacing: 0.14em; opacity: 0.7; }
.sidebar a { padding: 6px 0; transition: color 160ms ease; }
.sidebar a.active { color: #fff; }
@media (hover: none), (pointer: coarse) { .sidebar a:hover { color: var(--text-dim); } .sidebar a.active:hover { color: #fff; } }

/* Mobile: the hidden sidebar becomes a native jump menu */
.jump { display: none; }
@media (max-width: 768px) {
    .jump { display: block; margin: 0 0 28px; }
    .jump span { display: block; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
    .jump select { width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: var(--text); background: #0f0f11; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
}
