:root {
    --bg-primary: #0d0f14;
    --bg-secondary: #151822;
    --bg-surface: #1c202c;
    --border-subtle: #2a2f3d;
    --text-title: #eef0f6;
    --text-body: #c3c8d6;
    --text-muted: #7d8399;
    --accent: #7c8cff;
    --accent-dim: #4b52a0;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* Landing page only, deliberately not swapped by the light-mode block below — a marketing
       page committing to one look is a normal choice, and it keeps the animated graph's node
       colors (tuned for a dark canvas) from ever landing on a light background. */
    --land-bg-0: #0a0c11;
    --land-bg-1: #12151d;
    --land-bg-2: #191d28;
    --land-border: #262b38;
    --land-text-hi: #f2f4f9;
    --land-text-mid: #b7bdcc;
    --land-text-lo: #767d90;
    --land-accent-soft: rgba(124,140,255,0.14);
    --font-display: 'Space Grotesk', var(--font-ui);
    --font-land-body: 'IBM Plex Sans', var(--font-ui);
    --font-land-mono: 'IBM Plex Mono', var(--font-mono);
}

* { box-sizing: border-box; }

/* html's own background is otherwise browser-default white — the .picker section's full-bleed
   trick (width:100vw via a negative margin) can round to a hair short of the real viewport
   width on some layouts, and without this that sliver shows html's white through, not body's. */
html { background: var(--bg-primary); }

body {
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-body);
    font-family: var(--font-ui);
    min-height: 100vh;
}

/* Fixed dark, like the landing page below it — it carries the same brand mark now, and a
   topbar that flips to white in light mode would sit as a bright seam directly above the
   hero's permanently-dark canvas. The workspace tabs/panes underneath keep following system
   theme as before; only this chrome strip is now part of the dark brand identity. */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.4rem;
    border-bottom: 1px solid var(--land-border);
    background: var(--land-bg-1);
    position: sticky;
    top: 0;
    z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.55rem; }
.brand-mark { flex-shrink: 0; }
.brand-name { font-family: var(--font-display); font-weight: 600; color: var(--land-text-hi); letter-spacing: -0.01em; font-size: 1.02rem; }
.brand-tag { font-family: var(--font-land-mono); font-size: 0.7rem; color: var(--land-text-lo); }
.nav-links { display: flex; align-items: center; gap: 1.6rem; font-size: 0.85rem; }
.nav-links a { color: var(--land-text-mid); text-decoration: none; }
.nav-links a:hover { color: var(--land-text-hi); }
.topbar-results { display: flex; align-items: center; gap: 0.6rem; }
.project-name { font-family: var(--font-land-mono); color: var(--land-text-lo); font-size: 0.85rem; margin-right: 0.4rem; }

.btn {
    background: var(--bg-surface);
    color: var(--text-title);
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: var(--font-ui);
}
.btn:hover { border-color: var(--accent-dim); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0d0f14; font-weight: 600; }
.btn-ghost { background: transparent; }
/* The topbar is fixed-dark now (see .topbar above) — its own buttons follow that, not the
   system theme, so "Export JSON" etc. never render as a light-mode button on a dark bar. */
.topbar .btn { background: var(--land-bg-2); color: var(--land-text-hi); border-color: var(--land-border); }
.topbar .btn:hover { border-color: var(--accent-dim); }
.topbar .btn-ghost { background: transparent; }

/* No bottom padding here on purpose: .picker is full-bleed and dark-committed (see below), and
   this padding would otherwise sit below it in main's own (theme-following) background — a
   light-mode visitor would see a light strip under an otherwise all-dark landing page. The
   landing's own footer carries its own bottom spacing; .workspace carries its own below. */
main { max-width: 1280px; margin: 0 auto; padding: 0 1.4rem; }

/* ===========================================================================
   Landing page. Full-bleed (escapes main's centered max-width for the mesh
   background and section dividers), dark-committed via the --land-* tokens
   above — a marketing page is allowed to commit to one look regardless of
   the visitor's system theme, the same way the animated graph's node colors
   are tuned for a dark canvas specifically. */
.picker {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    overflow: hidden;
    background: var(--land-bg-0);
    color: var(--land-text-mid);
    font-family: var(--font-land-body);
}
.bg-mesh {
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 900px 500px at 78% 8%, rgba(124,140,255,0.16), transparent 60%),
        radial-gradient(ellipse 700px 500px at 15% 60%, rgba(160,107,242,0.09), transparent 60%);
}
.bg-grid {
    position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35;
    background-image: linear-gradient(var(--land-border) 1px, transparent 1px), linear-gradient(90deg, var(--land-border) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 900px 600px at 70% 10%, black, transparent 70%);
}

.hero {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center;
    position: relative; z-index: 2; max-width: 1280px; margin: 0 auto;
    padding: 4rem 3.5rem 6rem; min-height: 34rem;
}
.hero-copy { max-width: 34rem; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-family: var(--font-land-mono); font-size: 0.75rem; color: var(--accent);
    background: var(--land-accent-soft); border: 1px solid rgba(124,140,255,0.28);
    padding: 0.4rem 0.75rem; border-radius: 100px; margin-bottom: 1.4rem;
    opacity: 0; animation: land-rise 0.7s 0.15s cubic-bezier(.16,1,.3,1) forwards;
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.hero h1 {
    font-family: var(--font-display); font-size: 3.1rem; line-height: 1.06; letter-spacing: -0.02em;
    color: var(--land-text-hi); margin: 0 0 1.4rem; font-weight: 600;
}
.hero h1 .reveal-line { display: block; overflow: hidden; }
.hero h1 b {
    display: inline-block; font-weight: 600; color: var(--land-text-hi);
    opacity: 0; transform: translateY(100%); animation: land-rise 0.75s cubic-bezier(.16,1,.3,1) forwards;
}
.hero h1 .reveal-line:nth-child(1) b { animation-delay: 0.28s; }
.hero h1 .reveal-line:nth-child(2) b { animation-delay: 0.4s; }
.hero h1 b.accent-word { color: var(--accent); }
.hero .lede {
    font-family: var(--font-land-body); font-size: 1.05rem; line-height: 1.6; color: var(--land-text-mid);
    margin: 0 0 1.9rem; max-width: 29rem;
    opacity: 0; animation: land-rise 0.7s 0.56s cubic-bezier(.16,1,.3,1) forwards;
}
.hero .lede strong { color: var(--land-text-hi); font-weight: 600; }
@keyframes land-rise { to { opacity: 1; transform: translateY(0); } }

.drop-zone {
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
    opacity: 0; animation: land-rise 0.7s 0.68s cubic-bezier(.16,1,.3,1) forwards;
    border-radius: 14px; transition: background 0.15s;
    padding: 0.5rem; margin: -0.5rem 0 0.4rem;
}
.drop-zone.drag-over { background: var(--land-bg-1); }
.cta-row { display: flex; align-items: center; gap: 1rem; }
.hero .btn-primary {
    background: var(--accent); color: #0a0c11; font-weight: 600; font-size: 0.92rem;
    font-family: var(--font-land-body); padding: 0.8rem 1.4rem; border-radius: 9px;
    display: inline-flex; align-items: center; gap: 0.55rem; border: none; cursor: pointer;
}
.hero .btn-secondary {
    background: transparent; color: var(--land-text-hi); font-size: 0.92rem; font-weight: 500;
    font-family: var(--font-land-body); border: 1px solid var(--land-border); padding: 0.8rem 1.3rem; border-radius: 9px;
    cursor: pointer;
}
.hero .btn-secondary:hover { border-color: var(--accent-dim); }
.drop-hint { color: var(--land-text-lo); font-size: 0.82rem; margin: 0.2rem 0 0; }
.hero .text-link {
    background: none; border: none; padding: 0; margin: 0;
    color: var(--land-text-hi); font: inherit; font-size: inherit;
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.hero .text-link:hover { color: var(--accent); }
.fallback-note { color: var(--land-text-lo); font-size: 0.78rem; max-width: 26rem; margin: 0.3rem 0 0; }
.hero .status { min-height: 1.4em; color: var(--accent); font-size: 0.85rem; margin: 0.6rem 0 0; }
.proof-line {
    display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; color: var(--land-text-lo);
    margin-top: 1.1rem;
    opacity: 0; animation: land-rise 0.7s 0.8s cubic-bezier(.16,1,.3,1) forwards;
}
.proof-line svg { flex-shrink: 0; }

.hero-visual { position: relative; height: 30rem; opacity: 0; animation: land-fadein 1s 0.3s ease forwards; }
@keyframes land-fadein { to { opacity: 1; } }
.hero-visual svg { width: 100%; height: 100%; overflow: visible; }
.g-edge {
    stroke-width: 1.4; fill: none; stroke-dasharray: 240; stroke-dashoffset: 240;
    animation: land-draw 1.1s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes land-draw { to { stroke-dashoffset: 0; } }
.g-node-wrap { animation: land-pop 0.55s cubic-bezier(.34,1.56,.64,1) backwards, land-drift 7s ease-in-out infinite; transform-origin: center; }
@keyframes land-pop { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
@keyframes land-drift { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.g-node-hub { animation: land-pop 0.5s cubic-bezier(.34,1.56,.64,1) backwards; }
.g-label { font-family: var(--font-land-mono); font-size: 10.5px; fill: var(--land-text-mid); }
.g-hub-label { font-family: var(--font-land-body); font-size: 11px; font-weight: 600; fill: #fff; }

.capabilities {
    position: relative; z-index: 2; max-width: 1280px; margin: 0 auto;
    padding: 4rem 3.5rem 5.5rem;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem;
    border-top: 1px solid var(--land-border);
}
.cap-card { background: var(--land-bg-1); border: 1px solid var(--land-border); border-radius: 14px; padding: 1.75rem 1.6rem; }
.cap-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 1.25rem; }
.cap-card h3 { font-family: var(--font-display); font-size: 1.12rem; color: var(--land-text-hi); margin: 0 0 0.6rem; font-weight: 600; }
.cap-card p { font-size: 0.9rem; line-height: 1.6; color: var(--land-text-mid); margin: 0 0 1rem; }
.cap-example {
    font-family: var(--font-land-mono); font-size: 0.75rem; color: var(--land-text-lo);
    background: var(--land-bg-2); border: 1px solid var(--land-border); border-radius: 7px; padding: 0.55rem 0.75rem;
}
.cap-example b { color: var(--land-text-mid); font-weight: 500; }

.landing-footer {
    position: relative; z-index: 2; border-top: 1px solid var(--land-border);
    max-width: 1280px; margin: 0 auto; padding: 1.9rem 3.5rem;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.8rem; color: var(--land-text-lo);
}
.footer-left { display: flex; align-items: center; gap: 0.6rem; }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding: 2.5rem 1.6rem 3rem; }
    .hero-visual { height: 20rem; order: -1; }
    .hero h1 { font-size: 2.2rem; }
    .capabilities { grid-template-columns: 1fr; padding: 2.5rem 1.6rem; }
    .landing-footer { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 1.5rem 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .picker * { animation: none !important; opacity: 1 !important; transform: none !important; }
}
@media (max-width: 640px) {
    /* The topbar's nav-links are scroll-to-section conveniences, not core function — on a
       narrow screen they crowd the brand mark into wrapping, which reads as broken chrome. */
    .nav-links { display: none !important; }
    .brand-tag { display: none; }
}

.workspace { padding-top: 1.4rem; padding-bottom: 3rem; }
.summary { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 1rem; }

.setup-banner {
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.85rem 1.05rem;
    margin-bottom: 1.1rem;
    font-size: 0.85rem;
}
.setup-banner .setup-title { color: var(--text-title); font-weight: 600; margin-bottom: 0.3rem; }
.setup-banner .setup-list { color: var(--text-muted); margin-bottom: 0.6rem; }
.setup-banner .setup-list code { font-family: var(--font-mono); font-size: 0.78rem; }
.setup-banner .setup-note { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.5rem; }

.tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--border-subtle); margin-bottom: 1.2rem; }
.tab-btn {
    background: none; border: none; color: var(--text-muted); font-family: var(--font-ui);
    font-size: 0.88rem; padding: 0.6rem 0.9rem; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text-title); border-bottom-color: var(--accent); }

.pane { display: none; }
.pane.active { display: block; }
.empty { color: var(--text-muted); font-style: italic; }

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    padding: 0.9rem 1.05rem;
    margin-bottom: 0.8rem;
}
.card-title { color: var(--text-title); font-weight: 600; margin-bottom: 0.15rem; }
.card-path { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.card-summary { margin: 0 0 0.5rem; font-size: 0.88rem; line-height: 1.5; }
.card-row { font-size: 0.8rem; margin-top: 0.25rem; color: var(--text-body); }
.card-row code { font-family: var(--font-mono); background: var(--bg-surface); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.76rem; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tbl th, .tbl td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border-subtle); }
.tbl th { color: var(--text-muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tbl code { font-family: var(--font-mono); font-size: 0.78rem; }

.docs-layout { display: flex; gap: 1rem; height: 560px; }
.docs-graph {
    flex: 2;
    min-width: 0;
    position: relative;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-primary);
    overflow: hidden;
    padding-top: 56px;
}
.docs-vis-canvas { width: 100%; height: 100%; }
.graph-toolbar {
    position: absolute; top: 8px; left: 12px; right: 12px; z-index: 10;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem;
    pointer-events: none;
}
.graph-toolbar > * { pointer-events: auto; }
.graph-search {
    display: flex; gap: 0.4rem;
    background: rgba(21, 24, 34, 0.82); backdrop-filter: blur(6px);
    padding: 6px; border-radius: 9px; border: 1px solid var(--border-subtle);
}
.graph-search input {
    background: transparent; border: none; color: var(--text-title);
    font-family: var(--font-ui); font-size: 0.82rem; width: 190px; outline: none; padding: 0.35rem 0.5rem;
}
.graph-layout-controls {
    display: flex; gap: 0.4rem;
    background: rgba(21, 24, 34, 0.82); backdrop-filter: blur(6px);
    padding: 6px; border-radius: 9px; border: 1px solid var(--border-subtle);
}
.graph-layout-controls .btn { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.graph-layout-controls .btn.is-on,
.graph-layout-controls .btn[aria-pressed="true"] {
    background: var(--accent); color: #0a0c11; border-color: var(--accent); font-weight: 600;
}
.docs-legend {
    position: absolute; bottom: 12px; left: 12px; z-index: 10;
    display: flex; gap: 0.7rem; flex-wrap: wrap; max-width: calc(100% - 24px);
    background: rgba(21, 24, 34, 0.82); backdrop-filter: blur(6px);
    padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-subtle);
}
.docs-legend .legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; color: var(--text-body); }
.docs-legend .legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.docs-details {
    flex: 1; min-width: 240px; max-width: 320px;
    border: 1px solid var(--border-subtle); border-radius: 10px;
    background: var(--bg-secondary); padding: 1rem 1.1rem; overflow-y: auto;
}
.docs-details .dd-title { color: var(--text-title); font-weight: 600; font-size: 1.02rem; margin-bottom: 0.2rem; word-break: break-word; }
.docs-details .dd-path { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-muted); margin-bottom: 0.7rem; word-break: break-all; }
.docs-details .dd-summary { font-size: 0.86rem; line-height: 1.5; margin-bottom: 0.7rem; }
.docs-details .dd-row { font-size: 0.8rem; margin-top: 0.4rem; }
.docs-details .dd-row code { font-family: var(--font-mono); background: var(--bg-surface); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.75rem; }
@media (max-width: 860px) {
    .docs-layout { flex-direction: column; height: auto; }
    .docs-graph { height: 420px; }
    .docs-details { max-width: none; }
    .graph-toolbar { flex-direction: column; }
    .graph-search input { width: 140px; }
}

.tree-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}
.tree-toolbar {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}
.tree-hint { color: var(--text-muted); font-size: 0.78rem; margin-right: auto; }
.tree-toolbar .btn { padding: 0.3rem 0.65rem; font-size: 0.75rem; }
.tree-root, .tree-root ul { list-style: none; margin: 0; padding-left: 1.15rem; }
.tree-root { padding: 0.55rem 0.85rem 0.9rem; font-family: var(--font-mono); font-size: 0.82rem; }
.tree-root ul {
    border-left: 1px solid var(--border-subtle);
    margin-left: 0.45rem;
    padding-left: 0.85rem;
}
.tree-root li { padding: 0.08rem 0; }
.tree-file {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.18rem 0.35rem; border-radius: 5px;
}
.tree-file:hover { background: var(--bg-surface); }
.tree-file .tree-name { color: var(--text-body); }
.tree-file.ext-md .tree-name { color: var(--text-title); }
.tree-file.ext-json .tree-name { color: #c9b36a; }
.tree-folder-btn {
    display: flex; align-items: center; gap: 0.45rem;
    width: 100%; text-align: left;
    background: none; border: none; color: var(--text-title);
    font-family: var(--font-mono); font-size: 0.82rem;
    padding: 0.22rem 0.35rem; border-radius: 5px; cursor: pointer;
}
.tree-folder-btn:hover { background: var(--bg-surface); }
.tree-chevron {
    width: 0.55rem; height: 0.55rem; flex-shrink: 0;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    transform: rotate(45deg); margin: 0 0.15rem 0.15rem 0;
    transition: transform 0.12s ease;
}
.tree-dir.collapsed > .tree-folder-btn .tree-chevron { transform: rotate(-45deg); margin-bottom: 0; }
.tree-dir.collapsed > ul { display: none; }
.tree-folder-label { font-weight: 600; }
.tree-count {
    margin-left: auto; color: var(--text-muted); font-size: 0.7rem;
    background: var(--bg-surface); border: 1px solid var(--border-subtle);
    border-radius: 999px; padding: 0.05rem 0.4rem;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f7f8fb; --bg-secondary: #ffffff; --bg-surface: #eef0f6;
        --border-subtle: #dde1ec; --text-title: #14161f; --text-body: #3a3f52; --text-muted: #767c94;
    }
    .btn-primary { color: #fff; }
}
