:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --fg: #171a1f;
  --muted: #5a6472;
  --line: #e3e6ea;
  --accent: #1d4ed8;
  --accent-fg: #ffffff;
  --btn: #eef0f3;
  --code-bg: #0f1319;
  --code-fg: #e6e8eb;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #151a21;
  --fg: #e7e9ec;
  --muted: #9ba4b1;
  --line: #232a34;
  --accent: #7dabff;
  --accent-fg: #0a0e14;
  --btn: #1a212b;
  --code-bg: #0a0d12;
  --code-fg: #e6e8eb;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0e1014;
    --surface: #151a21;
    --fg: #e7e9ec;
    --muted: #9ba4b1;
    --line: #232a34;
    --accent: #7dabff;
    --accent-fg: #0a0e14;
    --btn: #1a212b;
    --code-bg: #0a0d12;
    --code-fg: #e6e8eb;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

.wrap {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.brand:hover { text-decoration: none; }

.theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--btn);
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s ease;
}
.theme:hover { background: var(--surface); }
.theme svg { width: 1.15rem; height: 1.15rem; display: none; }

:root[data-theme="auto"] .theme .i-auto,
:root[data-theme="light"] .theme .i-light,
:root[data-theme="dark"] .theme .i-dark { display: block; }

/* hero */
.hero { padding: 4rem 0 5rem; }

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.lede {
  margin: 1.5rem 0 0;
  max-width: 34rem;
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border-radius: 0.65rem;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }

/* sections */
section { padding: 1rem 0 4rem; }

h2 {
  margin: 0 0 1.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.tabs [role="tab"] {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.tabs [role="tab"]:hover { color: var(--fg); }
.tabs [role="tab"][aria-selected="true"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* code panels */
.panel[hidden] { display: none; }

.panel {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  overflow: hidden;
  background: var(--surface);
}

.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.panel-label { font-size: 0.85rem; color: var(--muted); }

.copy {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--fg);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.copy:hover { background: var(--bg); }
.copy.copied { color: var(--accent); border-color: var(--accent); }

pre {
  margin: 0;
  padding: 1.1rem;
  background: var(--code-bg);
  overflow-x: auto;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--code-fg);
  white-space: pre;
}

/* versions */
.updated {
  margin: -0.75rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.channels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.channel {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 1.25rem;
  background: var(--surface);
}

.channel h3 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.versions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.versions li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.plat { color: var(--muted); font-size: 0.9rem; }

.ver {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.rev {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.ver:empty::before,
.stamp:empty::before {
  content: "—";
  color: var(--muted);
  font-weight: 400;
}

/* footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}
.links a { color: var(--muted); font-size: 0.9rem; }
.links a:hover { color: var(--fg); text-decoration: none; }

.fineprint { margin: 0; color: var(--muted); font-size: 0.85rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .hero { padding: 2.5rem 0 3.5rem; }
  section { padding-bottom: 3rem; }
  .channels { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
