:root {
  color-scheme: light dark;
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #111827;
  --muted: #5f6b7a;
  --border: #d9e0e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --code: #eef2f7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1117;
    --panel: #111821;
    --text: #edf2f7;
    --muted: #aab6c4;
    --border: #253241;
    --accent: #36c2b4;
    --accent-strong: #7de0d5;
    --code: #182231;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.72;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
}

.site-header,
.site-footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 20px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 34px 20px 56px;
}

.document {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 44px);
}

.doc-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: -8px;
  margin-bottom: 28px;
}

h1,
h2,
h3 {
  line-height: 1.28;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 18px;
}

h2 {
  border-top: 1px solid var(--border);
  font-size: 1.45rem;
  margin: 36px 0 12px;
  padding-top: 26px;
}

h3 {
  font-size: 1.1rem;
  margin: 26px 0 8px;
}

p,
ul,
table {
  margin: 0 0 16px;
}

ul {
  padding-left: 1.4rem;
}

li + li {
  margin-top: 6px;
}

code {
  background: var(--code);
  border-radius: 4px;
  padding: 0.08em 0.3em;
}

.language-switch {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.links {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-top: 24px;
}

.link-card {
  display: block;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  text-decoration: none;
}

.link-card strong {
  display: block;
  color: var(--text);
}

.link-card span {
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
