html {
  --max: 720px;
  --wide: 960px;
  --pad: clamp(20px, 5vw, 40px);
  --header-h: 52px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --accent: #c45c00;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f7f7f7;
  --inset: #f3f3f3;
  --text: #2d2d2d;
  --heading: #111111;
  --muted: #666666;
  --ghost: #999999;
  --rule: #e6e6e6;
  --code-border: #e0e0e0;
  --link: #3873ad;
  --link-hover: #245a8a;
  --scroll-track: #f0f0f0;
  --scroll-thumb: #c8c8c8;
  --scroll-thumb-hover: #a8a8a8;
  --good: #587c0a;
  --bad: #c82829;
  --kw: #8959a8;
  --ty: #c82829;
  --fn: #4271ae;
  --str: #718c00;
  --attr: #4271ae;
  --header-bg: color-mix(in srgb, #ffffff 92%, transparent);
}

html[data-theme="dark"] {
  --bg: #121212;
  --surface: #1a1a1a;
  --inset: #161616;
  --text: #d4d4d4;
  --heading: #fafafa;
  --muted: #9e9e9e;
  --ghost: #616161;
  --rule: #2e2e2e;
  --code-border: #383838;
  --link: #6cb6ff;
  --link-hover: #9cd2ff;
  --scroll-track: #1a1a1a;
  --scroll-thumb: #484848;
  --scroll-thumb-hover: #626262;
  --good: #98c379;
  --bad: #f07178;
  --kw: #c792ea;
  --ty: #f07178;
  --fn: #82aaff;
  --str: #c3e88d;
  --attr: #82aaff;
  --header-bg: color-mix(in srgb, #121212 92%, transparent);
}

html { scrollbar-color: var(--scroll-thumb) var(--scroll-track); }

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

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--scroll-track); border-radius: 999px; }
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid var(--scroll-track);
}
*::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

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

::selection { background: var(--surface); color: var(--heading); }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--pad);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.site-header .logo {
  font-weight: 700;
  font-size: 15px;
  color: var(--heading);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.site-header .logo:hover { color: var(--link); text-decoration: none; }

.site-header .tag {
  font-size: 12px;
  color: var(--ghost);
  font-family: var(--mono);
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.site-header .spacer { flex: 1; }

.site-header .nav-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
}
.site-header .nav-link:hover { color: var(--heading); background: var(--surface); text-decoration: none; }

.site-header .nav-link.primary {
  color: var(--heading);
  border: 1px solid var(--rule);
  background: var(--surface);
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.theme-toggle:hover { color: var(--heading); }

/* layout */
.page-main {
  padding-bottom: clamp(48px, 8vw, 80px);
}

.page-container {
  width: 100%;
  max-width: calc(var(--wide) + var(--pad) * 2);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.section {
  max-width: var(--max);
  margin: 0 auto;
}

.section.wide { max-width: var(--wide); }

/* hero */
.hero {
  padding: clamp(40px, 8vw, 72px) 0 clamp(36px, 6vw, 56px);
  max-width: var(--max);
  margin: 0 auto;
}

.hero-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--heading);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero .subtitle {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--muted);
  max-width: 42ch;
  margin-bottom: 28px;
  line-height: 1.55;
}

.hero .subtitle code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--heading);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--rule);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--ghost); text-decoration: none; color: var(--heading); }

.btn.accent {
  background: var(--heading);
  color: var(--bg);
  border-color: var(--heading);
}
html[data-theme="light"] .btn.accent { background: #111; color: #fff; }
html[data-theme="dark"] .btn.accent { background: #fafafa; color: #121212; }
.btn.accent:hover { opacity: 0.9; }

.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--heading); background: var(--surface); }

/* code block */
.code-block {
  background: var(--inset);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  font-size: 12px;
  color: var(--ghost);
}

.code-head .dots { display: flex; gap: 6px; }
.code-head .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--rule);
}
.code-head .dot:nth-child(1) { background: #ff5f57; }
.code-head .dot:nth-child(2) { background: #febc2e; }
.code-head .dot:nth-child(3) { background: #28c840; }

.code-body {
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-body .kw { color: var(--kw); }
.code-body .ty { color: var(--ty); }
.code-body .fn { color: var(--fn); }
.code-body .str { color: var(--str); }
.code-body .attr { color: var(--attr); }
.code-body .cmt { color: var(--ghost); font-style: italic; }
.code-body .ok { color: var(--good); }

.copy-sm {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
}
.copy-sm:hover { color: var(--heading); }

/* install */
.install-section { padding: 48px 0; }

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ghost);
  margin-bottom: 12px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 20px;
}

.install-cmd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--inset);
  border: 1px solid var(--code-border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.install-cmd .prompt { color: var(--ghost); flex-shrink: 0; }
.install-cmd .cmd { color: var(--heading); }

.install-note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

/* features */
.features {
  padding: 48px 0;
  border-top: 1px solid var(--rule);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feature {
  padding: 20px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
}

.feature .icon {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 10px;
}

.feature h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 6px;
}

.feature p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* compare */
.compare-section {
  padding: 48px 0;
  border-top: 1px solid var(--rule);
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compare-card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}

.compare-card .label {
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.compare-card.bad .label { color: var(--bad); }
.compare-card.good .label { color: var(--good); }

.compare-card pre {
  margin: 0;
  padding: 14px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--inset);
}

/* cta */
.cta {
  margin: clamp(40px, 6vw, 64px) auto 0;
  max-width: var(--max);
  padding: clamp(24px, 4vw, 40px) 0;
  text-align: center;
}

.cta-box {
  padding: 36px 28px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
}

.cta-box h2 {
  font-size: 1.4rem;
  color: var(--heading);
  margin-bottom: 8px;
}

.cta-box p {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 15px;
}

.cta-box .hero-actions { justify-content: center; margin-bottom: 0; }

/* footer */
.site-footer {
  width: 100%;
  max-width: calc(var(--wide) + var(--pad) * 2);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 28px) var(--pad) clamp(32px, 5vw, 48px);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ghost);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--heading); text-decoration: none; }

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  }
}

@media (max-width: 640px) {
  html { --pad: clamp(16px, 4.5vw, 24px); }

  .site-header {
    gap: 8px;
    padding: 0 var(--pad);
  }

  .site-header .tag { display: none; }
  .site-header .nav-link:not(.primary) { display: none; }

  .hero .subtitle { max-width: none; }

  .compare-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }

  .install-cmd {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .cta-box {
    padding: clamp(24px, 6vw, 32px) clamp(16px, 4vw, 24px);
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (min-width: 1200px) {
  html { --max: 760px; }
}