:root {
  --bg: #FAFAF7; --surface: #FFFFFF; --surface-2: #F3F3EF; --text: #141414; --muted: #5E5E58; --line: #E3E2DC;
  --yellow: #FFCC00; --yellow-soft: #FFF3B0; --ink: #111111; --ok: #1F8A4C; --warn: #B7791F; --bad: #C0392B;
  --code-bg: #F6F6F2; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --radius: 14px; --max: 1180px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F0F0E; --surface: #181816; --surface-2: #20201D; --text: #F1F0EA; --muted: #A3A29A; --line: #2E2D29;
    --yellow-soft: #3A3311; --code-bg: #141412; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F0F0E; --surface: #181816; --surface-2: #20201D; --text: #F1F0EA; --muted: #A3A29A; --line: #2E2D29;
  --yellow-soft: #3A3311; --code-bg: #141412; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 Inter, system-ui, -apple-system, Segoe UI, sans-serif; overflow-x: hidden; }
a { color: inherit; text-decoration-color: var(--yellow); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code, pre { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); padding: .05em .35em; border-radius: 6px; overflow-wrap: anywhere; }
main { max-width: var(--max); margin: 0 auto; padding: 0 16px 64px; }
section { margin: 56px 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 800; margin: .2em 0 .35em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 750; margin: 0 0 .6em; }
h3 { font-size: 1.1rem; margin: 0 0 .3em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); } .small { font-size: .87rem; }

/* header */
header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand em { font-style: normal; font-weight: 500; color: var(--muted); }
.diamond { width: 22px; height: 22px; background: var(--yellow); border: 2px solid var(--ink); transform: rotate(45deg); border-radius: 3px; flex: none; }
header nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
header nav a { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 550; font-size: .95rem; }
header nav a:hover { background: var(--surface-2); }
header nav a[aria-current="page"] { background: var(--ink); color: #fff; }
:root[data-theme="dark"] header nav a[aria-current="page"] { background: var(--yellow); color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) header nav a[aria-current="page"] { background: var(--yellow); color: #111; } }
.theme, .menu { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; height: 34px; min-width: 34px; cursor: pointer; font: inherit; }
.menu { display: none; padding: 0 14px; margin-left: auto; }
@media (max-width: 860px) {
  .menu { display: block; }
  header.top { flex-wrap: wrap; }
  header nav { display: none; width: 100%; order: 3; flex-direction: column; margin: 0; }
  header nav.open { display: flex; }
}

/* hero */
.hero { margin-top: 48px; }
.hero.small { margin-top: 36px; margin-bottom: 24px; }
.hero.small h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--muted); margin: 0; }
.eyebrow a { text-decoration: none; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 62ch; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.btn { display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 650; cursor: pointer; font-size: .95rem; }
:root[data-theme="dark"] .btn { border-color: var(--line); }
.btn.primary { background: var(--yellow); color: #111; border-color: var(--ink); }
.btn:hover { transform: translateY(-1px); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 24px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stats b { display: block; font-size: 2rem; font-weight: 800; }
.stats b::after { content: ""; display: block; width: 28px; height: 4px; background: var(--yellow); margin: 4px 0 6px; border-radius: 2px; }
.stats span { color: var(--muted); font-size: .9rem; }

/* journey */
.journey { list-style: none; padding: 0; margin: 0; counter-reset: s; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 400px) { .journey { grid-template-columns: 1fr; } }
.journey li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px 62px; position: relative; box-shadow: var(--shadow); }
.journey li::before { content: counter(s); position: absolute; left: 16px; top: 18px; width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: #111; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--ink); }
.journey .who { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); }
.journey p { color: var(--muted); font-size: .95rem; margin: 0; }

figure { margin: 20px 0; }
figure img { max-width: 100%; display: block; border-radius: 10px; }
figure.wide img { border: 1px solid var(--line); }
figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; }
figure.diagram { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
figure.diagram img { margin: 0 auto; max-height: 1100px; width: auto; max-width: 100%; }
figure.diagram figcaption { color: #5E5E58; }
figure.diagram a { color: #141414; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--ink); }
.card p { color: var(--muted); font-size: .93rem; margin: 0 0 .6em; }
.card code { font-size: .78rem; }
.mark { display: inline-grid; place-items: center; min-width: 46px; height: 28px; padding: 0 8px; border-radius: 7px; background: var(--ink); color: var(--yellow); font-weight: 800; font-size: .8rem; letter-spacing: .06em; margin-bottom: 10px; }
:root[data-theme="dark"] .mark { background: var(--yellow); color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark { background: var(--yellow); color: #111; } }
.mark.big { font-size: 1rem; height: 38px; min-width: 62px; vertical-align: middle; margin: 0 6px 0 0; }

.callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.callouts div { border-left: 4px solid var(--yellow); background: var(--surface); padding: 14px 16px; border-radius: 0 10px 10px 0; }
.callouts h4 { margin: 0 0 6px; }
.callouts p { margin: 0; color: var(--muted); font-size: .95rem; }

.toc { display: flex; gap: 8px; flex-wrap: wrap; }
.toc a { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; text-decoration: none; font-size: .9rem; }

/* tables */
table { border-collapse: collapse; width: 100%; }
.table-wrap, .doc table, table.grid { display: block; overflow-x: auto; }
table.grid, .doc table { font-size: .92rem; }
table.grid th, table.grid td, .doc th, .doc td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.grid thead th, .doc thead th { background: var(--surface-2); font-weight: 650; }
table.kv th { text-align: left; width: 34%; padding: 8px 12px 8px 0; vertical-align: top; font-weight: 650; }
table.kv td { padding: 8px 0; vertical-align: top; overflow-wrap: anywhere; }
table.kv tr { border-bottom: 1px solid var(--line); }
@media (max-width: 600px) { table.kv th, table.kv td { display: block; width: 100%; padding: 4px 0; } table.kv tr { display: block; padding: 6px 0; } }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em; }
.tag.ok { background: #E3F5EA; color: #135C33; border-color: #BFE5CC; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.points { padding-left: 1.1em; } .points li { margin-bottom: .6em; }
.points li::marker { color: var(--yellow); content: "◆  "; font-size: .8em; }

/* docs */
.doc { max-width: 900px; }
article.doc { margin-top: 36px; }
.doc h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.doc h2 { margin-top: 1.6em; padding-top: .4em; border-top: 1px solid var(--line); }
.doc li { margin-bottom: .35em; }
pre.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; line-height: 1.5; }
pre.code code.hljs { background: transparent; padding: 0; }
.filecard { margin: 16px 0; }
.filecard-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .85rem; margin-bottom: 6px; }
.filecard pre { max-height: 520px; }

/* source browser */
.keyfiles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; font-size: .9rem; }
.keyfiles a { border: 1px solid var(--line); background: var(--surface); padding: 3px 10px; border-radius: 999px; text-decoration: none; font-family: "JetBrains Mono", monospace; font-size: .8rem; }
.browser { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-height: 520px; overflow: hidden; }
.browser .tree { border-right: 1px solid var(--line); overflow: auto; max-height: 76vh; padding: 8px 0; font-size: .86rem; }
.browser .tree input { width: calc(100% - 16px); margin: 0 8px 8px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.browser details > summary { cursor: pointer; padding: 2px 8px; list-style: none; white-space: nowrap; }
.browser details > summary::before { content: "▸ "; color: var(--muted); }
.browser details[open] > summary::before { content: "▾ "; }
.browser .node { padding-left: 14px; }
.browser .file { display: block; padding: 2px 8px 2px 20px; white-space: nowrap; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.browser .file:hover { background: var(--surface-2); }
.browser .file.active { background: var(--yellow-soft); font-weight: 650; }
.browser .file .r { color: var(--warn); font-size: .75em; margin-left: 4px; }
.browser .viewer { overflow: auto; max-height: 76vh; min-width: 0; }
.browser .viewer .vh { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 14px; font-size: .85rem; display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.browser .viewer pre { margin: 0; padding: 14px; font-size: .82rem; line-height: 1.5; }
.browser .viewer .empty { padding: 40px 20px; color: var(--muted); }
@media (max-width: 760px) { .browser { grid-template-columns: 1fr; } .browser .tree { max-height: 300px; border-right: 0; border-bottom: 1px solid var(--line); } }

/* status */
.status-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.status-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.status-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.status-card a { font-size: .85rem; overflow-wrap: anywhere; }
.status-card .health { font-size: .72rem; align-self: flex-start; }
.status-top { display: flex; align-items: center; gap: 8px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line); flex: none; }
.dot.up { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.down { background: var(--bad); }
.dot.pending { background: var(--warn); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .4 } to { opacity: 1 } }

/* videos */
.video { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.video video { width: 100%; max-height: 640px; border-radius: 10px; background: #000; }
.video .ph { aspect-ratio: 16/10; border-radius: 10px; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 12px, var(--bg) 12px, var(--bg) 24px); display: grid; place-items: center; color: var(--muted); font-weight: 700; border: 1px dashed var(--line); }
@media (max-width: 760px) { .video { grid-template-columns: 1fr; } }

.gitlog { list-style: none; padding: 0; margin: 0; font-size: .93rem; }
.gitlog li { display: grid; grid-template-columns: auto auto 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.gitlog time { color: var(--muted); white-space: nowrap; }
@media (max-width: 600px) { .gitlog li { grid-template-columns: auto 1fr; } .gitlog span { grid-column: 1 / -1; } }

footer { border-top: 1px solid var(--line); padding: 24px 16px 40px; color: var(--muted); font-size: .85rem; text-align: center; }
