:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1c1d21;
  --muted: #565a63;
  --border: #e2e3e6;
  --link: #1d4ed8;
  --link-hover: #1e3a8a;
  --focus: #b45309;
  --mark-bg: #fff3c4;
  --measure: 42rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1rem;
}

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.brand img { border-radius: 8px; display: block; }

.nav-list, .footer-links, .link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
}
.nav-list a { text-decoration: none; padding: 0.25rem 0; display: inline-block; }
.nav-list a:hover { text-decoration: underline; }
.nav-list a[aria-current="page"] { color: var(--text); font-weight: 600; }

main { padding-top: 2rem; padding-bottom: 3rem; }

h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2.25rem 0 0.5rem; }
h3 { font-size: 1.075rem; margin: 1.5rem 0 0.25rem; }
p, ul, ol { margin: 0 0 1rem; }
li + li { margin-top: 0.25rem; }

.lead { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.5rem; }
.meta { color: var(--muted); font-size: 0.95rem; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: #f0f1f3;
  padding: 0.1em 0.3em;
  border-radius: 4px;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
}
.toc ol { margin: 0; padding-left: 1.4rem; }

.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
thead th { border-bottom-width: 2px; }
tbody th { font-weight: 600; width: 34%; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.93rem;
  padding: 1.5rem 0 2rem;
}
.site-footer p { margin-bottom: 0.5rem; }
.footer-links { margin-top: 0.75rem; }

/* Только для черновой сборки */
.draft-banner {
  background: #7c2d12;
  color: #fff;
  padding: 0.6rem 1rem;
  text-align: center;
  font-weight: 600;
}
mark.todo {
  background: var(--mark-bg);
  color: #7c2d12;
  padding: 0.05em 0.25em;
  border-radius: 3px;
  font-weight: 600;
}

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  h1 { font-size: 1.65rem; }
  tbody th { width: auto; }
}
