:root {
  --bg: #1d2125;
  --bg-alt: #22272b;
  --bg-card: #22272b;
  --border: #2c333a;
  --border-strong: #454f59;
  --text: #c7d1db;
  --text-muted: #9fadbc;
  --text-dim: #8c9bab;
  --accent: #579dff;
  --accent-strong: #85b8ff;
  --accent-dim: rgba(87, 157, 255, 0.14);
  --code-bg: #1d2125;
  --code-text: #c5d0e0;
  --radius: 6px;
  --radius-lg: 8px;
  --max-width: 1180px;
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f7f8f9;
  --bg-alt: #f1f2f4;
  --bg-card: #ffffff;
  --border: #dfe1e6;
  --border-strong: #c1c7d0;
  --text: #172b4d;
  --text-muted: #626f86;
  --text-dim: #8590a2;
  --accent: #0c66e4;
  --accent-strong: #0055cc;
  --accent-dim: rgba(12, 102, 228, 0.10);
  --code-bg: #172b4d;
  --code-text: #d3dbe7;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition), color var(--transition);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

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

code {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  border: 1px solid var(--border);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 16px;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 24px; }
h3 { font-size: 1.2rem; }
h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(29, 33, 37, 0.85);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .site-header {
  background: rgba(247, 248, 249, 0.85);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
}

.logo:hover {
  color: var(--text);
}

.logo-mark {
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 1.5rem;
  line-height: 1;
}

.logo-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.primary-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.primary-nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.primary-nav a:hover {
  color: var(--text);
}

.nav-cta {
  border: 1px solid var(--border-strong);
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text) !important;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--text);
  font-size: 1rem;
  display: grid;
  place-items: center;
  transition: border-color var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-moon { display: none; }
[data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: inline; }

/* ---------- Hero ---------- */

.hero {
  padding: 100px 0 80px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at top, var(--accent-dim) 0%, transparent 60%),
    var(--bg);
}

.badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  margin-bottom: 32px;
}

.hero h1 {
  max-width: 880px;
  margin: 0 auto 24px;
}

.hero-accent {
  color: var(--accent);
}

.hero-sub {
  max-width: 720px;
  margin: 0 auto 40px;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-meta {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.hero-meta strong {
  color: var(--text-muted);
}

/* ---------- Sections ---------- */

.section {
  padding: 88px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.two-col {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 60px;
  align-items: start;
}

@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; gap: 40px; }
}

.bullet-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.bullet-list li {
  position: relative;
  padding: 8px 0 8px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.bullet-list li:last-child {
  border-bottom: none;
}

.bullet-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.bullet-list strong {
  color: var(--text);
}

.callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: sticky;
  top: 96px;
}

.callout h3 {
  margin-top: 0;
  color: var(--accent);
}

.callout ul {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.callout li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.callout li:last-child {
  border-bottom: none;
}

.callout strong {
  color: var(--text);
}

/* ---------- ASCII diagram ---------- */

.ascii-diagram {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 0;
  text-align: center;
  margin: 40px 0 60px;
  white-space: pre;
  overflow-x: auto;
}

/* ---------- How grid ---------- */

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.how-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color var(--transition), transform var(--transition);
}

.how-card:hover {
  border-color: var(--accent);
}

.how-number {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.how-card h3 {
  margin: 0 0 12px;
}

.how-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
}

/* ---------- Code tabs ---------- */

.code-tabs {
  display: flex;
  gap: 4px;
  margin: 32px 0 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.code-panel {
  display: none;
  position: relative;
  margin-top: 8px;
}

.code-panel.active {
  display: block;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 1;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}

.code-foot {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 24px;
  text-align: center;
}

/* ---------- Spec grid ---------- */

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.spec-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  color: var(--text);
  transition: all var(--transition);
}

.spec-card:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.spec-code {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.spec-card h3 {
  margin: 0 0 12px;
}

.spec-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 20px;
}

.spec-version {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---------- SDK grid ---------- */

.sdk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}

@media (max-width: 720px) {
  .sdk-grid { grid-template-columns: 1fr; }
}

.sdk-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.sdk-card h3 {
  margin: 0 0 16px;
  font-size: 1.4rem;
}

.install {
  display: block;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 0 0 20px;
  font-size: 0.92rem;
}

.sdk-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.sdk-card li {
  color: var(--text-muted);
  padding: 6px 0 6px 20px;
  position: relative;
  font-size: 0.92rem;
}

.sdk-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ---------- Ecosystem grid ---------- */

.eco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.eco-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.eco-card h3 {
  color: var(--accent);
  font-size: 1rem;
  margin: 0 0 10px;
}

.eco-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* ---------- CTA section ---------- */

.cta-section {
  padding: 100px 0 120px;
  text-align: center;
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 40px;
  text-align: left;
}

.cta-card {
  position: relative;
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: var(--text);
  transition: all var(--transition);
  min-height: 220px;
}

.cta-card:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.cta-num {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 0.1em;
}

.cta-card h3 {
  margin: 0 0 10px;
}

.cta-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
}

.cta-arrow {
  position: absolute;
  bottom: 24px;
  right: 28px;
  color: var(--accent);
  font-size: 1.4rem;
  transition: transform var(--transition);
}

.cta-card:hover .cta-arrow {
  transform: translateX(4px);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 64px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

@media (max-width: 800px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.footer-tag {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  padding: 4px 0;
}

.site-footer ul a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer ul a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

.footer-bottom p {
  margin: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .primary-nav { display: none; }
  .header-row { gap: 12px; }
  .hero { padding: 60px 0 50px; }
  .section { padding: 60px 0; }
  .hero-meta { gap: 16px; font-size: 0.78rem; }
  .ascii-diagram { font-size: 10px; }
}
