html { scroll-behavior: smooth; scroll-padding-top: 70px; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }

.sidebar {
  position: sticky;
  top: 54px;
  align-self: start;
  max-height: calc(100vh - 54px);
  overflow-y: auto;
  padding: 24px 12px 40px 20px;
}
.sidebar p { margin: 18px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.sidebar p:first-child { margin-top: 0; }
.sidebar a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--text-2); font-size: 14px; }
.sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.current { background: var(--surface-2); color: var(--text); font-weight: 600; }

main { min-width: 0; padding: 32px 28px 100px; }
main > section { max-width: 780px; margin-bottom: 56px; }
main h1 { font-size: 36px; letter-spacing: -0.02em; margin-bottom: 12px; }
main h2 { font-size: 24px; letter-spacing: -0.01em; margin-bottom: 14px; padding-top: 4px; }
main h3 { font-size: 17px; margin-bottom: 6px; }
main h4 { margin: 20px 0 8px; font-size: 12.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
main p, main ul { margin: 0 0 14px; }
main li { margin-bottom: 6px; }
.lead { font-size: 18px; color: var(--text-2); }

:not(pre) > code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); overflow-wrap: anywhere; }
pre {
  position: relative;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
  line-height: 1.5;
}
pre code { font-size: 13px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 20px 0 0; }
.facts div { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.facts dt { font-size: 12.5px; color: var(--text-3); }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.facts code { background: none; padding: 0; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { position: relative; padding-left: 44px; margin-bottom: 22px; counter-increment: step; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
}

.callout { padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--surface); }

main table { margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; }

.op { margin: 0 0 40px; padding-top: 22px; border-top: 1px solid var(--border); }
.op-group { margin: 34px 0 4px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.route { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; font-family: var(--mono); font-size: 14px; }
.method { padding: 2px 8px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.required { margin-left: 6px; color: var(--warn); font-size: 11.5px; font-weight: 600; font-family: var(--sans); }
.type { color: var(--text-3); font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }

.sample { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sample pre { margin: 0; border: 0; border-radius: 0; }
.sample-bar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.sample-bar button { padding: 3px 10px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.sample-bar button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); font-weight: 600; }
.sample-bar .copy { margin-left: auto; color: var(--accent-ink); }
.sample-label { padding: 0 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }

details.errors summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
details.errors ul { margin-top: 8px; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; padding: 16px 16px 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
  .sidebar p { width: 100%; margin: 8px 0 2px; }
  .sidebar #toc-reference { display: contents; }
  main { padding: 24px 16px 80px; }
  main h1 { font-size: 30px; }
}
