:root {
  --paper: #faf9f6;
  --surface: #fffefb;
  --soft: #eeeee5;
  --ink: #292b24;
  --muted: #74766d;
  --line: #e7e6df;
  --coral: #ed714c;
  --code-bg: #292b24;
  --code-ink: #f2f0e9;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  z-index: 10;
}
.skip:focus { left: 12px; top: 12px; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  font-size: 19px;
}
.brand:hover { text-decoration: none; }
.brand img { border-radius: 50%; }
.brand-suffix {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}

.header-nav { display: flex; gap: 22px; }
.header-nav a { color: var(--muted); font-size: 15px; }
.header-nav a:hover { color: var(--ink); text-decoration: none; }

.layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding-top: 36px;
  padding-bottom: 72px;
}

.sidebar { position: sticky; top: 86px; }

.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.nav-button { display: none; }

.nav-overview,
.nav-section ul a {
  display: block;
  padding: 5px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
}
.nav-overview:hover,
.nav-section ul a:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.nav-overview[aria-current='page'],
.nav-section ul a[aria-current='page'] {
  background: var(--soft);
  color: var(--ink);
  font-weight: 500;
}
.nav-overview { font-weight: 500; margin-bottom: 14px; }

.nav-section { margin-bottom: 22px; }
.nav-section h2 {
  margin: 0 0 6px;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-section ul { list-style: none; margin: 0; padding: 0; }

.content { min-width: 0; }

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
}

.doc-head h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 4.5vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  font-size: 18px;
  color: var(--muted);
  max-width: 64ch;
}

.toc {
  margin: 28px 0 8px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.toc-title {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc ol { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 32px; }
.toc li { margin: 3px 0; break-inside: avoid; }
.toc a { color: var(--ink); font-size: 15px; }
.toc-h3 { padding-left: 16px; }
.toc-h3 a { color: var(--muted); }

.doc-body { margin-top: 28px; max-width: 76ch; }
.doc-body > :first-child { margin-top: 0; }

.doc-body h2 {
  margin: 44px 0 14px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.doc-body h3 { margin: 32px 0 10px; font-size: 19px; }
.doc-body h4 { margin: 24px 0 8px; font-size: 16px; }
.doc-body p { margin: 0 0 16px; }
.doc-body ul, .doc-body ol { margin: 0 0 16px; padding-left: 24px; }
.doc-body li { margin: 5px 0; }

.doc-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--soft);
  border-radius: 5px;
  padding: 2px 6px;
}
.doc-body pre {
  margin: 0 0 20px;
  padding: 18px 20px;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 12px;
  overflow-x: auto;
  line-height: 1.55;
}
.doc-body pre code {
  background: none;
  padding: 0;
  font-size: 13.5px;
  color: inherit;
}

.doc-body table {
  width: 100%;
  margin: 0 0 20px;
  border-collapse: collapse;
  font-size: 14.5px;
  display: block;
  overflow-x: auto;
}
.doc-body th, .doc-body td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.doc-body th { background: var(--surface); font-weight: 600; white-space: nowrap; }

.doc-body blockquote {
  margin: 0 0 20px;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--coral);
  color: var(--muted);
}

.doc-body hr { border: none; border-top: 1px solid var(--line); margin: 36px 0; }
.doc-body img { max-width: 100%; height: auto; }

.doc-source {
  margin-top: 44px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.home { max-width: 880px; }
.home-hero { margin-bottom: 44px; }
.home-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.home-note { margin-top: 18px; color: var(--muted); }

.home-section { margin-bottom: 40px; }
.home-section h2 {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  display: block;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
}
.card:hover { border-color: var(--coral); text-decoration: none; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; font-size: 14.5px; color: var(--muted); }

.button {
  display: inline-block;
  padding: 10px 18px;
  background: var(--coral);
  color: #fff;
  border-radius: 999px;
  font-weight: 500;
}
.button:hover { background: #d95f3c; text-decoration: none; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 14px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
}
.footer-inner p { margin: 0; font-weight: 500; color: var(--ink); }
.footer-inner nav { display: flex; gap: 18px; }
.footer-inner small { margin-left: auto; }

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
  .sidebar { position: static; }

  .nav-button {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .nav-toggle:checked ~ .nav-button { border-color: var(--coral); color: var(--coral); }
  .nav-toggle:not(:checked) ~ .nav-body { display: none; }
  .nav-body { margin-top: 16px; padding: 16px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  .toc ol { columns: 1; }
  .footer-inner small { margin-left: 0; }
}

.cookie-preferences { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.cookie-preferences:hover { color: var(--coral); }
.cookie-consent { position: fixed; right: 24px; bottom: 24px; z-index: 1000; width: min(380px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-family: var(--sans); box-shadow: 0 20px 50px #38362a29; }
.cookie-consent h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.cookie-consent p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.cookie-consent a { color: #b84f31; text-decoration: underline; text-underline-offset: 2px; }
.cookie-consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.cookie-consent-actions button { min-height: 42px; padding: 0 14px; border: 1px solid #dcded6; border-radius: 7px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.cookie-consent-actions button:hover { border-color: var(--coral); }
.cookie-consent-actions .cookie-consent-accept { border-color: var(--coral); background: var(--coral); color: #fff; }
.cookie-consent-actions .cookie-consent-accept:hover { background: #d9603c; }
.cookie-consent button:focus-visible, .cookie-consent a:focus-visible { outline: 3px solid #a74429; outline-offset: 3px; }
@media (max-width: 600px) { .cookie-consent { right: 16px; bottom: 16px; } }
