:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #0f0f0f;
  --panel-2: #141414;
  --text: #ebebeb;
  --muted: #8a8a8a;
  --faint: #555;
  --line: #202020;
  --line-strong: #303030;
  --accent: #f5f0e8;
  --accent-soft: rgba(245, 240, 232, 0.08);
  --code: #f5f0e8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Outfit, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.58;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(10, 10, 10, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-brand span {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 18px;
}

.topbar-actions a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.topbar-actions a:hover {
  color: var(--text);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  padding-top: 64px;
}

.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 28px 20px;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 800;
  letter-spacing: -0.08em;
  padding-right: 2px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 13px;
}

.search-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.search-wrap span {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #090909;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--accent);
}

.search-results {
  margin: -6px 0 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0b0b;
}

.search-results a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.search-results a:hover {
  background: var(--accent-soft);
}

.nav-link {
  display: none;
}

.nav-section {
  margin: 18px 0 26px;
}

.nav-section h2 {
  margin: 0 0 8px;
  color: var(--faint);
  font-family: Outfit, sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topic {
  border-radius: 10px;
  margin: 4px 0;
}

.topic summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 12px;
  color: var(--muted);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
}

.topic summary::-webkit-details-marker {
  display: none;
}

.topic summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--faint);
  font-size: 12px;
}

.topic[open] summary::before {
  content: "–";
}

.topic summary:hover,
.topic.active summary {
  background: var(--accent-soft);
  color: var(--text);
}

.subnav {
  display: grid;
  gap: 2px;
  padding: 4px 0 8px 38px;
}

.subnav-link {
  display: block;
  padding: 6px 10px;
  color: var(--faint);
  text-decoration: none;
  border-left: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.subnav-link:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

.content {
  width: min(1040px, calc(100vw - 370px));
  padding: 64px 54px 110px;
}

.hero {
  position: relative;
  padding: 42px 0 34px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.hero::before {
  content: "";
  position: absolute;
  right: -120px;
  top: -80px;
  width: 420px;
  height: 260px;
  background: radial-gradient(ellipse, rgba(245, 240, 232, 0.08), transparent 68%);
  pointer-events: none;
}

h1 {
  font-family: Syne, Outfit, sans-serif;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.95;
  margin: 0 0 18px;
  letter-spacing: -0.04em;
}

h2 {
  margin-top: 40px;
  font-family: Syne, Outfit, sans-serif;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

h2, h3 {
  scroll-margin-top: 90px;
}

.heading-anchor {
  color: var(--faint);
  text-decoration: none;
  opacity: 0;
  margin-left: 10px;
  font-family: Outfit, sans-serif;
  font-size: 0.65em;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}

h3 {
  margin-top: 28px;
  font-size: 20px;
}

p, li {
  font-size: 16px;
  color: #d6d6d6;
}

a {
  color: var(--accent);
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #181818;
  color: var(--code);
  font-size: 0.92em;
}

pre {
  overflow: auto;
  padding: 16px;
  background: #050505;
  color: #f8f5ee;
  border-radius: 8px;
  border: 1px solid var(--line);
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  background: var(--panel);
}

th, td {
  padding: 12px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-2);
}

.page-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.page-card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
}

.page-card:hover {
  border-color: var(--accent);
}

.page-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.category-block {
  margin-top: 34px;
}

.category-block h3 {
  color: var(--accent);
  font-size: 18px;
  margin: 0 0 12px;
}

@media (max-width: 860px) {
  .topbar {
    position: static;
  }
  .shell {
    display: block;
    padding-top: 0;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .content {
    width: 100%;
    padding: 34px 20px 72px;
  }
  .topbar-actions {
    display: none;
  }
}
