:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --text: #1f2328;
  --muted: #5d6670;
  --line: #e2e5e9;
  --accent: #6b4fd8;
  --accent-soft: #efebfd;
  --code-bg: #f1f2f4;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181b;
    --bg-soft: #1f2125;
    --text: #e6e6e6;
    --muted: #a0a6ad;
    --line: #30333a;
    --accent: #a48cff;
    --accent-soft: #2a2442;
    --code-bg: #26282d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #17181b;
  --bg-soft: #1f2125;
  --text: #e6e6e6;
  --muted: #a0a6ad;
  --line: #30333a;
  --accent: #a48cff;
  --accent-soft: #2a2442;
  --code-bg: #26282d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

code, kbd {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 5px;
}

kbd { border: 1px solid var(--line); border-bottom-width: 2px; }

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

header.top .bar {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
}

header.top .brand { font-weight: 600; color: var(--text); white-space: nowrap; }
header.top nav { display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; font-size: 14px; }
header.top nav a { color: var(--muted); white-space: nowrap; }
header.top nav a:hover { color: var(--text); }

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 64px; }

.hero { padding: 56px 0 32px; }
.hero h1 { font-size: 44px; line-height: 1.15; margin: 0 0 12px; }
.hero p.lead { font-size: 20px; color: var(--muted); max-width: 720px; margin: 0 0 24px; }

.buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 500;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button:hover { text-decoration: none; filter: brightness(1.08); }

section { padding: 32px 0; border-top: 1px solid var(--line); }
section:first-of-type { border-top: none; }
h2 { font-size: 28px; margin: 0 0 16px; }
h3 { font-size: 19px; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
ul { margin: 0 0 12px; padding-left: 22px; }
li { margin: 4px 0; }
.muted { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 16px 0; }
.card { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } .hero h1 { font-size: 34px; } }

figure { margin: 0; }
figure img { display: block; max-width: 100%; height: auto; border-radius: 10px; }
figure.shadow img { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.gallery { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; margin: 16px 0; }
.gallery figure { flex: 1 1 280px; max-width: 360px; }

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

.note { background: var(--accent-soft); border-radius: 8px; padding: 12px 16px; margin: 12px 0; }

details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 8px 0; background: var(--bg-soft); }
details summary { cursor: pointer; font-weight: 500; }
details p { margin: 8px 0 0; color: var(--muted); }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer .bar { max-width: 1040px; margin: 0 auto; padding: 20px 16px; }

header.top nav { flex: 1; min-width: 0; }
header.top select.lang {
  flex: none;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
