
:root{
  /* ---------- DARK (brand default) ---------- */
  --bg:#0a1a30; --bg-deep:#081626;
  --surface-glass:rgba(22,54,95,.38); --surface-raised:#122842;
  --line:rgba(255,255,255,.08); --line-hover:rgba(30,155,215,.45);
  --text:#eaf2fb; --text-2:#9fb6d4; --text-mut:#6f86a8;
  --cta:#1e9bd7; --link:#7cc6ee;
  --purple:#8a6cc4;
  --grid:rgba(255,255,255,.025);
  --auroraA:rgba(30,155,215,.22); --auroraB:rgba(110,78,158,.20);
  --logo-chip:rgba(255,255,255,.92);
  --nav-bg:rgba(10,26,48,.72);
  --grad-brand:linear-gradient(100deg,#1e9bd7 0%,#1668b0 45%,#6e4e9e 100%);
  color-scheme:dark;
}
:root[data-theme="light"]{
  --bg:#f6f8fc; --bg-deep:#0a1a30;
  --surface-glass:rgba(255,255,255,.96); --surface-raised:#eef3f9;
  --line:#dbe3ef; --line-hover:#1668b0;
  --text:#0c2142; --text-2:#34495f; --text-mut:#5d7390;
  --cta:#1668b0; --link:#1668b0;
  --purple:#4b2e83;
  --grid:rgba(15,39,71,.05);
  --auroraA:rgba(22,104,176,.14); --auroraB:rgba(110,78,158,.11);
  --logo-chip:transparent;
  --nav-bg:rgba(246,248,252,.86);
  color-scheme:light;
}

*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  font-family:"Open Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  background:var(--bg); color:var(--text);
  line-height:1.6; -webkit-font-smoothing:antialiased;
}
@media (prefers-reduced-motion:reduce){ html{scroll-behavior:auto} *{transition:none!important;animation:none!important} }

.bgfx{position:fixed;inset:0;z-index:-1;pointer-events:none;overflow:hidden;background:var(--bg)}
.bgfx::before,.bgfx::after{content:"";position:absolute;width:70vw;height:70vw;border-radius:50%;filter:blur(20px)}
.bgfx::before{top:-20vw;left:-14vw;background:radial-gradient(circle at center,var(--auroraA),transparent 60%)}
.bgfx::after{bottom:-24vw;right:-16vw;background:radial-gradient(circle at center,var(--auroraB),transparent 60%)}
.bgfx .grid{position:absolute;inset:0;
  background-image:linear-gradient(var(--grid) 1px,transparent 1px),linear-gradient(90deg,var(--grid) 1px,transparent 1px);
  background-size:48px 48px;mask-image:radial-gradient(circle at 50% 20%,#000 30%,transparent 80%)}

a{color:var(--link)}
:focus-visible{outline:2px solid var(--cta);outline-offset:2px;border-radius:6px}
.rail{width:100%;max-width:820px;margin:0 auto;padding:0 24px}
svg.i{width:1em;height:1em;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;vertical-align:-0.14em}

/* ---------- Nav ---------- */
.nav{position:sticky;top:0;z-index:100;height:64px;display:flex;align-items:center;
  background:var(--nav-bg);border-bottom:1px solid var(--line)}
@supports (backdrop-filter:blur(1px)){.nav{backdrop-filter:blur(16px) saturate(140%)}}
.nav .rail{display:flex;align-items:center;gap:14px;height:100%;max-width:960px}
.brand{display:flex;align-items:center;gap:10px;margin-right:auto;color:var(--text)}
.brand .chip{background:var(--logo-chip);border-radius:9px;padding:4px 7px;display:flex;align-items:center}
:root[data-theme="light"] .brand .chip{padding:0}
.brand img{height:26px;width:auto;display:block}
.brand .sep{width:1px;height:20px;background:var(--line)}
.brand .doctitle{font-weight:700;font-size:.92rem;letter-spacing:-.01em}
.backlink{color:var(--text-2);font-weight:600;font-size:.88rem;display:inline-flex;align-items:center;gap:6px;padding:8px 10px;border-radius:8px}
.backlink:hover{color:var(--text);background:var(--surface-raised)}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;border:1px solid var(--line);background:transparent;color:var(--text);cursor:pointer}
.theme-toggle:hover{border-color:var(--line-hover);background:var(--surface-raised)}
.theme-toggle svg{width:18px;height:18px}
.theme-toggle .moon{display:none}
:root[data-theme="light"] .theme-toggle .sun{display:none}
:root[data-theme="light"] .theme-toggle .moon{display:block}

/* ---------- Intro ---------- */
.intro{padding:clamp(2.5rem,6vh,4rem) 0 2.2rem}
.eyebrow{font-family:ui-monospace,"Cascadia Code","Segoe UI Mono",Consolas,monospace;font-size:.78rem;text-transform:uppercase;letter-spacing:.16em;color:var(--cta);font-weight:700;display:inline-flex;align-items:center;gap:8px}
.eyebrow::before{content:"/";opacity:.7}
.intro h1{font-size:clamp(2rem,4.4vw,2.9rem);font-weight:800;letter-spacing:-.03em;line-height:1.08;margin:14px 0 12px;text-wrap:balance}
.grad-text{background:var(--grad-brand);-webkit-background-clip:text;background-clip:text;color:transparent}
.intro .lead{font-size:1.05rem;color:var(--text-2);max-width:60ch;line-height:1.6}
.meta{display:flex;flex-wrap:wrap;gap:10px;margin-top:22px}
.meta-chip{display:flex;align-items:center;gap:9px;padding:9px 14px;border:1px solid var(--line);border-radius:999px;background:var(--surface-glass);font-family:ui-monospace,"Cascadia Code","Segoe UI Mono",Consolas,monospace;font-size:.8rem;color:var(--text-mut)}
.meta-chip b{color:var(--text);font-weight:600;font-family:"Open Sans",sans-serif}

/* ---------- Doc grid ---------- */
.layout{display:grid;grid-template-columns:200px minmax(0,1fr);gap:44px;padding:8px 0 64px;align-items:start}
.toc{position:sticky;top:88px;display:flex;flex-direction:column;gap:1px}
.toc-label{font-family:ui-monospace,"Cascadia Code","Segoe UI Mono",Consolas,monospace;font-size:.68rem;letter-spacing:.1em;text-transform:uppercase;color:var(--text-mut);margin:0 0 10px 10px}
.toc a{color:var(--text-2);text-decoration:none;font-size:.85rem;padding:7px 10px;border-radius:8px;border-left:2px solid transparent;display:flex;gap:9px}
.toc a .n{font-family:ui-monospace,"Cascadia Code","Segoe UI Mono",Consolas,monospace;color:var(--text-mut);font-size:.76rem}
.toc a:hover{background:var(--surface-raised);color:var(--text)}
.toc a.active{color:var(--text);border-left-color:var(--cta);background:var(--surface-raised);font-weight:600}
.toc a.active .n{color:var(--cta)}

.stack{display:flex;flex-direction:column;gap:14px;max-width:640px}
.card{background:var(--surface-glass);border:1px solid var(--line);border-top:2px solid rgba(30,155,215,.28);border-radius:16px;padding:22px 24px;scroll-margin-top:88px}
@supports (backdrop-filter:blur(1px)){:root:not([data-theme="light"]) .card{backdrop-filter:blur(16px) saturate(140%)}}
.card-head{display:flex;align-items:center;gap:12px;margin-bottom:10px}
.card-ico{width:34px;height:34px;flex:0 0 auto;border-radius:10px;background:var(--surface-raised);border:1px solid var(--line);display:flex;align-items:center;justify-content:center;color:var(--cta)}
.card-ico svg{width:17px;height:17px}
.card h2{font-size:1.05rem;font-weight:700;letter-spacing:-.01em;color:var(--text)}
.card .num{font-family:ui-monospace,"Cascadia Code","Segoe UI Mono",Consolas,monospace;font-weight:500;font-size:.72rem;color:var(--text-mut);margin-right:8px}
.card p{color:var(--text-2);font-size:.95rem;max-width:62ch;margin:0 0 8px}
.card p:last-child{margin-bottom:0}

.contact-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.contact-pill{display:inline-flex;align-items:center;gap:8px;padding:8px 13px;border-radius:10px;background:var(--surface-raised);border:1px solid var(--line);color:var(--text);font-family:ui-monospace,"Cascadia Code","Segoe UI Mono",Consolas,monospace;font-size:.84rem;font-weight:500;text-decoration:none}
.contact-pill svg{width:14px;height:14px;color:var(--cta)}
.contact-pill:hover{border-color:var(--line-hover)}

/* ---------- Footer ---------- */
.footer{background:var(--bg-deep);color:#cdddef;margin-top:8px;padding:28px 0}
.footer .rail{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;max-width:960px}
.footer .fmono{font-family:ui-monospace,"Cascadia Code","Segoe UI Mono",Consolas,monospace;font-size:.76rem;color:#88a2c4;letter-spacing:.04em}
.footer a{color:#cdddef;font-weight:600;font-size:.86rem}
.footer a:hover{color:#fff}

@media (max-width:760px){
  .layout{grid-template-columns:1fr;gap:0;padding-top:0}
  .toc{position:static;flex-direction:row;overflow-x:auto;gap:4px;padding-bottom:14px;margin-bottom:18px;border-bottom:1px solid var(--line)}
  .toc-label{display:none}
  .toc a{white-space:nowrap;border-left:none;border-bottom:2px solid transparent;border-radius:0}
  .toc a.active{border-left-color:transparent;border-bottom-color:var(--cta);background:transparent}
  .brand .doctitle{display:none}
}
