
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('fonts/inter-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url('fonts/inter-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url('fonts/inter-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url('fonts/inter-latin-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url('fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  --tx-1: #000000;
  --tx-2: #363636;
  --tx-3: #6b6b6b;
  --bg-1: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #84adff;
  --lk-1: #ff6030;
  --lk-2: #ff4f19;
  --ac-1: #79ffe1;
  --ac-tx: #0c4047;
  --border: #ebebeb;
  --code-bg: #111111;
  --code-tx: #eeeeee;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-title: var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --topbar-height: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tx-1: #ffffff;
    --tx-2: #eeeeee;
    --tx-3: #9b9b9b;
    --bg-1: #000000;
    --bg-2: #111111;
    --bg-3: #222222;
    --lk-1: #ff4f19;
    --lk-2: #ff6030;
    --ac-1: #7928ca;
    --ac-tx: #ffffff;
    --border: #222222;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::selection { background: var(--ac-1); color: var(--ac-tx); }

html { scroll-padding-top: calc(var(--topbar-height) + 1rem); }

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--tx-2);
  background: var(--bg-1);
}

/* Top bar */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-1) 85%, transparent);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.brand {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--lk-1);
  text-decoration: none;
}

.github {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--tx-2);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.github:hover { color: var(--lk-1); border-color: var(--lk-1); }

/* Layout */

.shell {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr) 14rem;
  gap: 2rem;
  max-width: 90rem;
  margin: 0 auto;
  padding: var(--topbar-height) 1.5rem 0;
}

/* Sidebar */

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 1.5rem 0.75rem 2rem 0;
  border-right: 1px solid var(--border);
}

.nav-group { margin-bottom: 1.5rem; }

.nav-title {
  display: block;
  font-family: var(--font-title);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tx-1);
  margin-bottom: 0.375rem;
  padding: 0 0.625rem;
}

.sidebar a {
  display: block;
  padding: 0.3125rem 0.625rem;
  font-size: 0.875rem;
  color: var(--tx-3);
  text-decoration: none;
  border-radius: 0.375rem;
}

.sidebar a:hover { color: var(--tx-1); background: var(--bg-2); }

.sidebar a.active {
  color: var(--lk-1);
  background: color-mix(in srgb, var(--lk-1) 8%, transparent);
  font-weight: 500;
}

/* Content */

.content { padding: 2.5rem 0 4rem; min-width: 0; }

article { max-width: 46rem; }

article > * + * { margin-top: 1.125rem; }

h1, h2, h3, h4 {
  font-family: var(--font-title);
  color: var(--tx-1);
  line-height: 1.3;
  position: relative;
}

h1 { font-size: 1.875rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 600; margin-top: 2.5rem; }
h3 { font-size: 1.125rem; font-weight: 600; margin-top: 2rem; }
h4 { font-size: 1rem; font-weight: 600; }

h2 { padding-top: 1rem; border-top: 1px solid var(--border); }

.anchor {
  position: absolute;
  margin-left: 0.375rem;
  color: var(--tx-3);
  text-decoration: none;
  opacity: 0;
}

h1:hover .anchor, h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--lk-1); }

a { color: var(--lk-1); text-decoration: none; }
a:hover { color: var(--lk-2); }

strong { color: var(--tx-1); }

ul, ol { padding-left: 1.5rem; }
li + li { margin-top: 0.25rem; }

blockquote {
  padding: 0.75rem 1.25rem;
  background: var(--bg-2);
  border-left: 3px solid var(--lk-1);
  border-radius: 0 0.5rem 0.5rem 0;
}

hr { border: 0; border-top: 1px solid var(--border); }

/* Inline code */

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.125rem 0.375rem;
}

/* Code blocks */

.codeblock { position: relative; }

.codeblock pre {
  background: var(--code-bg);
  color: var(--code-tx);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.6;
}

.codeblock code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.8125rem;
  color: inherit;
}

.codeblock .copy {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--code-tx);
  background: color-mix(in srgb, #ffffff 10%, transparent);
  border: 1px solid color-mix(in srgb, #ffffff 15%, transparent);
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.codeblock:hover .copy { opacity: 1; }
.codeblock .copy:hover { background: color-mix(in srgb, #ffffff 20%, transparent); }

.tok-kw { color: #ff6030; }
.tok-sql { color: #84adff; font-weight: 500; }
.tok-str { color: #79ffe1; }
.tok-num { color: #d6a8ff; }
.tok-cm { color: #888888; }

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  display: block;
  overflow-x: auto;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th { color: var(--tx-1); font-weight: 600; }

/* Table of contents */

.toc {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 2.5rem 0 2rem;
  font-size: 0.8125rem;
}

.toc-title {
  display: block;
  font-family: var(--font-title);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tx-1);
  margin-bottom: 0.5rem;
}

.toc a {
  display: block;
  color: var(--tx-3);
  padding: 0.1875rem 0;
}

.toc a:hover { color: var(--lk-1); }
.toc a.toc-3 { padding-left: 0.875rem; }

/* Pager */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 46rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  font-weight: 500;
  color: var(--tx-1);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  min-width: 10rem;
}

.pager a:hover { border-color: var(--lk-1); color: var(--lk-1); }

.pager a span {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--tx-3);
}

.pager-next { align-items: flex-end; text-align: right; margin-left: auto; }

/* Responsive */

@media (max-width: 75rem) {
  .shell { grid-template-columns: 17rem minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 50rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
}
