:root {
  --bg:        #f7f6f3;
  --panel:     #ffffff;
  --ink:       #111111;
  --ink-2:     #404040;
  --ink-3:     #707070;
  --line:      rgba(0,0,0,0.10);
  --line-2:    rgba(0,0,0,0.06);
  --hover:     rgba(0,0,0,0.04);
  --accent:    #111111;
  --accent-ink:#ffffff;
  --font-sans: "Geist", "Helvetica Neue", Helvetica, ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  --bg:        #0e0e0f;
  --panel:     #161618;
  --ink:       #f3f3f1;
  --ink-2:     #c8c7c2;
  --ink-3:     #8a8a86;
  --line:      rgba(255,255,255,0.10);
  --line-2:    rgba(255,255,255,0.06);
  --hover:     rgba(255,255,255,0.05);
  --accent:    #f3f3f1;
  --accent-ink:#0e0e0f;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: -0.005em;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
@media (max-width: 720px) { .topbar { padding: 0 20px; } }
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.brand-dot { color: var(--ink-3); }
.brand-tld { color: var(--ink-3); font-weight: 400; }
.brand-tag {
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: -0.005em;
}
@media (max-width: 720px) { .brand-tag { display: none; } }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.lang-wrap { position: relative; display: inline-flex; align-items: center; }
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 18px 6px 8px;
  cursor: pointer;
}
.lang-select:hover { background: var(--hover); color: var(--ink); }
.lang-wrap::after {
  content: "";
  position: absolute;
  right: 7px; top: 50%;
  width: 6px; height: 6px;
  border-right: 1px solid var(--ink-3);
  border-bottom: 1px solid var(--ink-3);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 30px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink-2);
  font-size: 12.5px;
}
.back-link:hover { background: var(--hover); color: var(--ink); }

/* Page layout */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 80px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 80px 32px 96px;
}
@media (max-width: 880px) {
  main {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 48px 20px 64px;
  }
}

aside.toc {
  position: sticky;
  top: 88px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}
@media (max-width: 880px) {
  aside.toc { position: static; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
}
.toc-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.toc-link {
  color: var(--ink-2);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.toc-link:hover { color: var(--ink); }

.doc { display: flex; flex-direction: column; gap: 64px; max-width: 720px; }

.doc-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.doc-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.doc-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.025em;
  font-weight: 500;
  line-height: 1.1;
  text-wrap: balance;
}
.doc-updated {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.summary {
  margin: 0;
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--ink-2);
  text-wrap: pretty;
  line-height: 1.6;
}
.summary-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

article + article { margin-top: 32px; }
section.section {
  padding: 24px 0;
  border-bottom: 1px solid var(--line-2);
}
section.section:last-child { border-bottom: 0; }
.section-h {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.section-p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* Footer */
footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.footer-row {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
@media (max-width: 720px) { .footer-row { padding: 24px 20px; } }
.footer-brand {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
}
.footer-year {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
