@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Outfit:wght@500;600;700&family=Source+Sans+3:ital,wght@0,400;0,600;0,700;1,400&display=swap");

:root {
  --bg: #070b14;
  --bg-elev: #0e1524;
  --bg-soft: #141c2e;
  --border: #243049;
  --text: #eef3fb;
  --muted: #93a0b5;
  --link: #7dd3fc;
  --accent: #2ee6c5;
  --accent-2: #38bdf8;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --chip: #12353c;
  --sidebar: 268px;
  --radius: 14px;
  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --display: "Outfit", "Source Sans 3", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --content: 48rem;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 520px at 85% -10%, rgba(46, 230, 197, 0.12), transparent 55%),
    radial-gradient(900px 480px at -10% 20%, rgba(56, 189, 248, 0.1), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #042027;
  padding: 0.5rem 1rem;
  z-index: 50;
  font-weight: 700;
}
.skip:focus { left: 0.75rem; top: 0.75rem; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.96), rgba(7, 11, 20, 0.96));
  border-right: 1px solid var(--border);
  padding: 1.35rem 0.95rem 2rem;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.15rem 0.35rem 1.05rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  color: inherit;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.mark {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.65rem;
  display: grid;
  place-items: center;
  background:
    linear-gradient(160deg, #2ee6c5 0%, #38bdf8 55%, #6366f1 120%);
  color: #06201c;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.92rem;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(46, 230, 197, 0.25), 0 8px 24px rgba(56, 189, 248, 0.2);
}
.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}
.brand span { display: block; color: var(--muted); font-size: 0.75rem; }

.search {
  width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.58rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}
.search::placeholder { color: #6b7a90; }

.nav-group {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7b8aa3;
  margin: 0.95rem 0.4rem 0.35rem;
  font-weight: 700;
  font-family: var(--display);
}
.nav a {
  display: block;
  padding: 0.42rem 0.6rem;
  border-radius: 9px;
  color: #d5deea;
  font-size: 0.92rem;
}
.nav a:hover { background: var(--bg-soft); text-decoration: none; color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, rgba(46, 230, 197, 0.16), rgba(56, 189, 248, 0.08));
  color: var(--accent);
  font-weight: 650;
  box-shadow: inset 2px 0 0 var(--accent);
}

.menu-btn {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 40;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font: inherit;
}

main {
  padding: 2.2rem 2.4rem 4.5rem;
  max-width: calc(var(--content) + 18rem);
}
main.has-toc {
  display: grid;
  grid-template-columns: minmax(0, var(--content)) 13.5rem;
  gap: 2.2rem;
  align-items: start;
}
.doc-body { min-width: 0; }

.toc {
  position: sticky;
  top: 1.4rem;
  font-size: 0.82rem;
  padding-top: 0.2rem;
}
.toc p {
  margin: 0 0 0.55rem;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7b8aa3;
  font-weight: 700;
}
.toc a {
  display: block;
  color: var(--muted);
  padding: 0.22rem 0 0.22rem 0.7rem;
  border-left: 1px solid var(--border);
}
.toc a:hover, .toc a.active { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }

.kicker {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.75rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--accent);
  border: 1px solid rgba(46, 230, 197, 0.28);
  font-family: var(--display);
}
.chip.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.35); background: #1f1708; }
.chip.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); background: #082014; }

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.03em; }
h1 { font-size: clamp(1.8rem, 2.4vw, 2.35rem); line-height: 1.15; margin: 0 0 0.8rem; }
h2 { font-size: 1.28rem; margin: 2.35rem 0 0.75rem; scroll-margin-top: 1.2rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
h2 .anchor, h3 .anchor {
  color: #5b6b82;
  font-weight: 500;
  text-decoration: none;
  margin-left: 0.4rem;
  font-size: 0.85em;
}
h2:hover .anchor, h3:hover .anchor { color: var(--accent); }
p { color: #c9d4e4; }
.lead { font-size: 1.12rem; color: var(--muted); margin-top: 0; max-width: 42rem; }

.callout {
  border: 1px solid var(--border);
  background: rgba(20, 28, 46, 0.7);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  margin: 1.1rem 0;
  box-shadow: var(--shadow);
}
.callout.warn { border-color: rgba(251, 191, 36, 0.35); background: rgba(31, 23, 8, 0.75); }
.callout.bad { border-color: rgba(251, 113, 133, 0.35); background: rgba(36, 12, 18, 0.7); }
.callout.ok { border-color: rgba(52, 211, 153, 0.3); background: rgba(8, 32, 20, 0.65); }
.callout strong { display: block; margin-bottom: 0.25rem; color: var(--text); font-family: var(--display); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
  margin: 1.3rem 0;
}
.hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  display: block;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18, 26, 43, 0.9), rgba(11, 17, 30, 0.9));
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.card:hover { border-color: rgba(46, 230, 197, 0.45); text-decoration: none; transform: translateY(-2px); }
.card h3 { margin: 0 0 0.4rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.card .method {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.steps {
  list-style: none;
  margin: 1rem 0 1.4rem;
  padding: 0;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 3.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(14, 21, 36, 0.65);
  margin: 0 0 0.65rem;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 0.85rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  color: #06201c;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.82rem;
}

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 1.1rem 0 1.4rem;
}
.flow-step {
  border: 1px solid var(--border);
  background: rgba(14, 21, 36, 0.8);
  border-radius: 12px;
  padding: 0.85rem 0.8rem;
  min-height: 6.4rem;
}
.flow-step span {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.flow-step strong { display: block; font-family: var(--display); font-size: 0.92rem; }
.flow-step p { margin: 0.3rem 0 0; font-size: 0.82rem; color: var(--muted); }

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 1rem 0 1.4rem;
}
.compare article {
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
}
.compare .do { background: rgba(8, 32, 20, 0.55); border-color: rgba(52, 211, 153, 0.28); }
.compare .dont { background: rgba(36, 12, 18, 0.45); border-color: rgba(251, 113, 133, 0.28); }
.compare h3 { margin: 0 0 0.45rem; font-size: 0.95rem; }
.compare ul { margin: 0; padding-left: 1.1rem; color: #c9d4e4; font-size: 0.92rem; }

.term {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  margin: 0.9rem 0 1.3rem;
  background: #05080f;
  box-shadow: var(--shadow);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  background: #10182a;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--display);
}
.term-bar i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #334155;
  display: inline-block;
}
.term-bar i:nth-child(1) { background: #fb7185; }
.term-bar i:nth-child(2) { background: #fbbf24; }
.term-bar i:nth-child(3) { background: #34d399; }
.term pre {
  border: 0;
  border-radius: 0;
  margin: 0;
  background: transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.62rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
th {
  color: #8b9bb3;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--display);
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.85rem 0 1.3rem;
  background: rgba(14, 21, 36, 0.55);
}

.code-block { position: relative; margin: 0.85rem 0 1.3rem; }
pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: #05080f;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: #d7e3f4;
}
.copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid var(--border);
  background: #121a2b;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.22rem 0.5rem;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}
.copy:hover { color: var(--text); }
.term .code-block { margin: 0; }
.term .copy { top: 0.45rem; }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(20, 28, 46, 0.9);
  padding: 0.08rem 0.34rem;
  border-radius: 5px;
  border: 1px solid rgba(36, 48, 73, 0.8);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.pager a {
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  min-width: 42%;
  background: rgba(14, 21, 36, 0.55);
}
.pager a:hover { text-decoration: none; border-color: rgba(46, 230, 197, 0.4); color: var(--text); }
.pager strong { display: block; color: var(--text); font-family: var(--display); }

footer.page-foot {
  margin-top: 2.4rem;
  color: #6e7d94;
  font-size: 0.82rem;
}

.search-hits {
  display: none;
  margin: 0 0 0.8rem;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.search-hits.open { display: block; }
.search-hits a { display: block; padding: 0.4rem 0.55rem; color: var(--text); }
.search-hits a:hover { background: var(--bg-soft); text-decoration: none; }

@media (max-width: 1180px) {
  .toc { display: none; }
  main.has-toc { display: block; max-width: calc(var(--content) + 4.4rem); }
}
@media (max-width: 920px) {
  .layout { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    z-index: 30;
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  main, main.has-toc { padding: 4.4rem 1.1rem 3rem; max-width: none; }
  .flow, .compare, .hero-grid { grid-template-columns: 1fr; }
  .pager a { min-width: 0; }
}
