/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0b;
  --bg-card: #111113;
  --bg-card-hover: #18181b;
  --border: #27272a;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.12);
  --violet: #a78bfa;
  --green: #4ade80;
  --red: #f87171;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 1120px;
  --radius: 12px;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* === Nav === */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(10, 10, 11, 0.8);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-logo:hover { text-decoration: none; }

.logo-svg { flex-shrink: 0; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn:hover { text-decoration: none; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #06b6d4;
  border-color: #06b6d4;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

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

/* === Hero === */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 140px 24px 80px;
  text-align: center;
}

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

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--violet), #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

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

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-bottom: 40px;
}

.stat { text-align: center; }

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-sep {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* === Sections === */
.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 80px 0; }

section h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.section-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 48px;
}

/* === Slideshow === */
.demo { background: var(--bg); }

.slideshow { position: relative; }

.slideshow-nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.slide-tab {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.slide-tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.slideshow-viewport {
  position: relative;
  min-height: 400px;
}

.slide {
  display: none;
  animation: fadeIn 0.3s ease;
}

.slide.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slideshow-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.slide-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.slide-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.slide-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.dot.active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

.dot:hover { background: var(--text-muted); }

/* === Demo Cards === */
.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.demo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  min-width: 0;
}

.demo-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.demo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.demo-dot.red { background: var(--red); }
.demo-dot.green { background: var(--green); }

.demo-label {
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.demo-tokens {
  margin-left: auto;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.demo-savings {
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(74, 222, 128, 0.15);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.demo-card pre {
  padding: 16px;
  overflow-x: auto;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-height: 380px;
  overflow-y: auto;
}

.demo-card pre code {
  font-family: var(--font-mono);
  white-space: pre;
  word-break: keep-all;
}

.demo-after {
  border-color: rgba(34, 211, 238, 0.3);
}

.demo-after pre { color: var(--green); }

.truncated {
  color: var(--text-muted);
  opacity: 0.5;
  font-style: italic;
}

/* === Features === */
.features { background: var(--bg-card); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

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

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

.feature-icon {
  margin-bottom: 12px;
  line-height: 1;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* === Savings Table === */
.savings { background: var(--bg); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 500px;
}

th {
  text-align: left;
  padding: 14px 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

td:first-child { color: var(--text); }

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--bg-card); }

td code {
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.8rem;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(74, 222, 128, 0.12);
  color: var(--green);
  font-weight: 700;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.badge-best {
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent);
}

/* === Install === */
.install { background: var(--bg-card); }

.install-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.install-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  min-width: 0;
}

.install-primary {
  border-color: rgba(34, 211, 238, 0.4);
}

.install-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.install-card > p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.code-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow-x: auto;
  min-width: 0;
}

.code-block code {
  color: var(--green);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.code-block-wide {
  max-width: 400px;
  margin: 0 auto;
}

.copy-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

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

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

.releases-link {
  font-size: 0.875rem;
  font-weight: 600;
}

.install-setup {
  text-align: center;
}

.install-setup h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

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

/* === Commands === */
.commands { background: var(--bg); }

.commands-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.cmd-group {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  min-width: 0;
}

.cmd-group h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 14px;
}

.cmd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(39, 39, 42, 0.5);
  font-size: 0.8rem;
  min-width: 0;
}

.cmd:last-child { border-bottom: none; }

.cmd code {
  color: var(--text);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cmd span {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-align: right;
  flex-shrink: 0;
}

/* === CTA + Social === */
.cta {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg) 100%);
  text-align: center;
  padding: 100px 0;
}

.social-share {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.share-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.share-links {
  display: flex;
  gap: 12px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all 0.2s;
}

.share-btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.15);
}

/* === Footer === */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-right {
  display: flex;
  gap: 20px;
}

.footer-right a {
  color: var(--text-muted);
  transition: color 0.2s;
}

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

/* === Responsive === */
@media (max-width: 768px) {
  .nav-links a:not(.btn) { display: none; }

  .hero { padding: 120px 20px 60px; }

  .hero-stats { gap: 20px; }
  .stat-value { font-size: 1.5rem; }

  .demo-grid,
  .features-grid,
  .install-grid,
  .commands-grid {
    grid-template-columns: 1fr;
  }

  .slideshow-viewport { min-height: auto; }

  .demo-card pre {
    font-size: 0.7rem;
    max-height: 300px;
  }

  section { padding: 60px 0; }

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .slideshow-nav { gap: 6px; }
  .slide-tab { padding: 4px 10px; font-size: 0.7rem; }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .features-grid,
  .commands-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
