@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500&family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --surface: rgba(255,255,255,.92);
  --surface-solid: #ffffff;
  --text: #0d0d0d;
  --text-2: #3f4650;
  --muted: #69717c;
  --border: rgba(13,13,13,.09);
  --border-strong: rgba(13,13,13,.15);
  --accent: #18c98b;
  --accent-deep: #087b55;
  --accent-soft: #d9f9ec;
  --blue: #2f6fd0;
  --blue-soft: #eaf2ff;
  --amber: #a56605;
  --amber-soft: #fff4d7;
  --red: #b53d3d;
  --red-soft: #fff0f0;
  --shadow: 0 2px 12px rgba(13,13,13,.045);
  --code-bg: #111418;
  --code-text: #e9f3ee;
  --header-h: 66px;
  --max: 1180px;
  --reading: 790px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e0f;
  --bg-soft: #111416;
  --surface: rgba(12,14,15,.9);
  --surface-solid: #121516;
  --text: #edf2ef;
  --text-2: #c6ceca;
  --muted: #949e99;
  --border: rgba(255,255,255,.10);
  --border-strong: rgba(255,255,255,.17);
  --accent: #22dfa0;
  --accent-deep: #63e5b6;
  --accent-soft: #133c2f;
  --blue: #8ab6ff;
  --blue-soft: #14243b;
  --amber: #f2c264;
  --amber-soft: #3b2b11;
  --red: #ff9696;
  --red-soft: #3a1b1b;
  --shadow: 0 2px 18px rgba(0,0,0,.25);
  --code-bg: #050708;
  --code-text: #e9f3ee;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 18px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:hover { color: var(--accent-deep); }
button, input { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }

.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px;
}
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  border-bottom: 1px solid var(--border); background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.nav-wrap { max-width: var(--max); height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 700; letter-spacing: -.35px; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--text); color: var(--bg); font: 600 13px/1 'Geist Mono', monospace; }
.brand small { display: block; color: var(--muted); font: 500 10px/1.2 'Geist Mono', monospace; letter-spacing: .7px; text-transform: uppercase; }
.main-nav { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.main-nav a { color: var(--text-2); text-decoration: none; padding: 8px 10px; border-radius: 9px; font-size: 14px; font-weight: 500; }
.main-nav a:hover, .main-nav a.active { background: var(--bg-soft); color: var(--text); }
.main-nav a.active { box-shadow: inset 0 0 0 1px var(--border); }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-solid); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--border-strong); }
.menu-btn { display: none; }

.hero {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 16% 10%, rgba(24,226,153,.20), transparent 31%),
    radial-gradient(circle at 82% 20%, rgba(70,140,255,.10), transparent 24%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}
.hero-inner { max-width: var(--max); margin: 0 auto; padding: 88px 24px 76px; }
.hero.compact .hero-inner { padding-top: 62px; padding-bottom: 54px; }
.eyebrow, .label { font: 500 12px/1.5 'Geist Mono', monospace; text-transform: uppercase; letter-spacing: .75px; color: var(--accent-deep); }
.hero h1 { max-width: 880px; margin: 13px 0 18px; font-size: clamp(40px, 6vw, 68px); line-height: 1.08; letter-spacing: -2.4px; font-weight: 650; }
.hero.compact h1 { font-size: clamp(36px, 5vw, 54px); }
.hero p { max-width: 760px; margin: 0; color: var(--text-2); font-size: clamp(17px, 2vw, 20px); line-height: 1.7; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 19px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; font-size: 14px; font-weight: 600; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.secondary { background: var(--surface-solid); }
.btn:hover { opacity: .88; color: inherit; }

.page-shell { max-width: var(--max); margin: 0 auto; padding: 52px 24px 88px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 50px; }
.page-shell.no-toc { display: block; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; padding-right: 12px; }
.toc-title { margin-bottom: 10px; color: var(--muted); font: 500 11px/1.5 'Geist Mono', monospace; text-transform: uppercase; letter-spacing: .7px; }
.toc a { display: block; padding: 6px 9px; border-left: 1px solid var(--border); color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.45; }
.toc a:hover { color: var(--text); border-left-color: var(--accent); }
.content { min-width: 0; max-width: var(--reading); }
.content.wide { max-width: none; }
.content > :first-child { margin-top: 0; }

section { margin: 0 0 58px; }
h1, h2, h3, h4 { line-height: 1.28; letter-spacing: -.02em; }
h2 { margin: 0 0 18px; font-size: 30px; letter-spacing: -.8px; }
h3 { margin: 30px 0 12px; font-size: 21px; }
h4 { margin: 24px 0 8px; font-size: 16px; }
p { margin: 0 0 16px; color: var(--text-2); }
.lede { font-size: 18px; color: var(--text-2); }
ul, ol { color: var(--text-2); padding-left: 22px; }
li { margin: 7px 0; }
strong { color: var(--text); }
hr { border: 0; border-top: 1px solid var(--border); margin: 48px 0; }

.grid { display: grid; gap: 15px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card { position: relative; border: 1px solid var(--border); border-radius: 17px; padding: 23px; background: var(--surface-solid); box-shadow: var(--shadow); }
.card:hover { border-color: var(--border-strong); }
.card h3 { margin-top: 0; font-size: 19px; }
.card p:last-child { margin-bottom: 0; }
.card-link { text-decoration: none; }
.card-link::after { content: '→'; position: absolute; right: 20px; top: 20px; color: var(--muted); }
.metric { font-size: 28px; font-weight: 650; letter-spacing: -1px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font: 500 12px/1.4 'Geist Mono', monospace; background: var(--accent-soft); color: var(--accent-deep); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.risk { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border); }

.callout { margin: 20px 0; padding: 17px 19px; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 13px; background: var(--bg-soft); }
.callout p:last-child { margin-bottom: 0; }
.callout.warn { border-left-color: var(--amber); background: var(--amber-soft); }
.callout.danger { border-left-color: var(--red); background: var(--red-soft); }
.callout.info { border-left-color: var(--blue); background: var(--blue-soft); }
.callout-title { margin-bottom: 5px; color: var(--text); font-weight: 650; }

.table-wrap { overflow-x: auto; margin: 18px 0 26px; border: 1px solid var(--border); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 650px; background: var(--surface-solid); }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: 14px; }
th { background: var(--bg-soft); color: var(--text); font-weight: 600; }
td { color: var(--text-2); }
tr:last-child td { border-bottom: 0; }

code { padding: 2px 6px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); font: 500 13px/1.5 'Geist Mono', monospace; overflow-wrap: anywhere; }
.code-block { position: relative; min-width: 0; max-width: 100%; margin: 16px 0 24px; }
pre { margin: 0; padding: 20px; overflow-x: auto; border-radius: 14px; background: var(--code-bg); color: var(--code-text); border: 1px solid rgba(255,255,255,.09); font: 400 13px/1.7 'Geist Mono', monospace; }
pre code { padding: 0; border: 0; background: transparent; color: inherit; overflow-wrap: normal; }
.copy-btn { position: absolute; right: 9px; top: 9px; padding: 5px 9px; border-radius: 8px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: #d9e2dd; cursor: pointer; font-size: 11px; }

.steps { counter-reset: step; display: grid; gap: 12px; margin: 20px 0; }
.step { position: relative; min-width: 0; max-width: 100%; padding: 20px 20px 20px 62px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-solid); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 19px; top: 19px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 999px; background: var(--text); color: var(--bg); font: 600 12px/1 'Geist Mono', monospace; }
.step h3, .step h4 { margin: 0 0 5px; }
.step p:last-child { margin-bottom: 0; }

.arch { display: flex; align-items: stretch; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.arch-node { flex: 1 1 140px; min-width: 130px; display: grid; place-items: center; min-height: 76px; padding: 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-solid); text-align: center; font-size: 13px; font-weight: 600; }
.arch-arrow { display: grid; place-items: center; color: var(--muted); }

.checklist { list-style: none; padding: 0; }
.checklist li { position: relative; padding-left: 29px; }
.checklist li::before { content: '✓'; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 700; }

.source-ref { font: 500 11px/1 'Geist Mono', monospace; vertical-align: super; text-decoration: none; color: var(--blue); }
.source-list { list-style: none; padding: 0; counter-reset: sources; }
.source-list li { counter-increment: sources; position: relative; padding: 14px 14px 14px 48px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.source-list li::before { content: '[' counter(sources) ']'; position: absolute; left: 8px; top: 16px; color: var(--muted); font: 500 12px/1.5 'Geist Mono', monospace; }
.source-list a { font-weight: 600; }
.source-type { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

.updated { display: inline-flex; align-items: center; gap: 7px; margin-top: 22px; color: var(--muted); font: 500 12px/1.5 'Geist Mono', monospace; }
.updated::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 30px 24px; display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 13px; }
.footer-inner a { color: var(--text-2); }

@media (max-width: 980px) {
  .page-shell { grid-template-columns: 180px minmax(0,1fr); gap: 30px; }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .main-nav a { padding-inline: 7px; font-size: 13px; }
}

@media (max-width: 760px) {
  :root { --header-h: 60px; }
  .nav-wrap { padding: 0 16px; gap: 9px; }
  .brand span:last-child { display: none; }
  .main-nav { display: none; position: absolute; left: 12px; right: 12px; top: calc(var(--header-h) - 2px); padding: 9px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-solid); box-shadow: 0 18px 50px rgba(0,0,0,.14); }
  .main-nav.open { display: grid; }
  .main-nav a { padding: 11px 12px; }
  .menu-btn { display: grid; margin-left: auto; }
  .hero-inner { padding: 60px 18px 52px; }
  .hero.compact .hero-inner { padding-top: 44px; padding-bottom: 42px; }
  .hero h1 { letter-spacing: -1.4px; }
  .page-shell { display: block; padding: 40px 18px 64px; }
  .toc { position: static; max-height: none; margin-bottom: 38px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--bg-soft); }
  .toc a { display: inline-block; border: 0; padding: 5px 8px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .arch { display: grid; grid-template-columns: 1fr; }
  .arch-arrow { transform: rotate(90deg); min-height: 20px; }
  h2 { font-size: 26px; }
  .footer-inner { display: block; }
  .footer-inner div + div { margin-top: 8px; }
}

@media print {
  .site-header, .toc, .hero-actions, .copy-btn, .site-footer { display: none !important; }
  .hero, .page-shell { border: 0; }
  .hero-inner, .page-shell { padding: 24px 0; }
  .page-shell { display: block; }
  .content { max-width: none; }
  .card, .step, .callout { break-inside: avoid; }
}
