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

:root {
  --bg: #0c0a09;
  --bg-warm: #1c1917;
  --bg-card: rgba(28, 25, 23, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-warm: rgba(251, 191, 36, 0.2);
  --text: #fafaf9;
  --text-muted: #a8a29e;
  --text-dim: #78716c;
  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --amber-glow: rgba(245, 158, 11, 0.15);
  --orange: #f97316;
  --red: #ef4444;
  --green: #22c55e;
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Space Grotesk', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: 0.88em; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Mesh Background ─────────────────────────────── */
.mesh-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(249, 115, 22, 0.05) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(245, 158, 11, 0.04) 0%, transparent 50%),
    var(--bg);
}

/* ─── Nav ─────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 18px 24px;
  transition: all 0.3s ease;
}

.nav.scrolled {
  background: rgba(12, 10, 9, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.shield-icon { font-size: 1.3rem; }

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

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

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

.nav-cta {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 16px !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-cta:hover {
  background: var(--bg-glass);
  border-color: var(--text-dim);
}

/* ─── Hero ────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 120px 24px 80px;
  max-width: 1120px;
  margin: 0 auto;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--amber-glow);
  border: 1px solid var(--border-warm);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--amber-light);
  margin-bottom: 24px;
}

.tag-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.text-gradient {
  background: linear-gradient(135deg, var(--amber), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 36px;
  padding: 20px 24px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}

.stat { text-align: center; }

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--amber-light);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.hero-buttons { display: flex; gap: 12px; }

.btn-warm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--amber), var(--orange));
  color: #0c0a09;
  font-weight: 600;
  font-family: var(--font);
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.25);
}

.btn-warm:hover {
  box-shadow: 0 0 36px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-family: var(--font);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: var(--bg-glass);
  border-color: var(--text-dim);
}

/* ─── Hero Code Card ──────────────────────────────── */
.hero-right {
  position: relative;
}

.code-card {
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.code-card.small {
  box-shadow: none;
  border-radius: var(--radius-sm);
}

.code-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.code-dots {
  display: flex;
  gap: 6px;
}

.code-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.code-dots span:nth-child(1) { background: #ef4444; }
.code-dots span:nth-child(2) { background: #f59e0b; }
.code-dots span:nth-child(3) { background: #22c55e; }

.code-filename {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.code-body {
  padding: 20px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--text-muted);
  overflow-x: auto;
}

.code-body .kw { color: #c084fc; }
.code-body .str { color: #86efac; }
.code-body .fn { color: #fbbf24; }
.code-body .num { color: #f97316; }
.code-body .cmt { color: #57534e; font-style: italic; }

/* ─── Floating Cards ──────────────────────────────── */
.float-card {
  position: absolute;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.response-card {
  bottom: -30px;
  left: -40px;
  background: rgba(28, 25, 23, 0.9);
  padding: 14px 18px;
  animation: float-y 4s ease-in-out infinite;
}

.response-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 8px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}

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

.response-body {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.response-body .key { color: #93c5fd; }
.response-body .str { color: #86efac; }
.response-body .num { color: #f97316; }

.header-card {
  top: 20px;
  right: -30px;
  background: rgba(28, 25, 23, 0.9);
  padding: 14px 18px;
  animation: float-y 5s ease-in-out 1s infinite;
}

.header-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
  margin-bottom: 8px;
}

.header-row {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.header-key { color: var(--amber-light); }

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ─── Sections ────────────────────────────────────── */
.section {
  padding: 100px 0;
}

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

.section-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--amber);
  margin-bottom: 12px;
}

.section-heading {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.section-desc {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 48px;
}

/* ─── Algorithm Cards ─────────────────────────────── */
.algo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.algo-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.4s ease;
  position: relative;
  opacity: 0;
  transform: translateY(24px);
}

.algo-card.revealed {
  opacity: 1;
  transform: translateY(0);
}

.algo-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-4px);
}

.algo-featured {
  border-color: var(--border-warm);
  background: var(--amber-glow);
}

.algo-badge {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  background: var(--amber);
  color: #0c0a09;
  border-radius: 999px;
}

.algo-icon {
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.algo-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.algo-card > p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.algo-visual {
  margin-bottom: 16px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Sliding window visual */
.window-bar { display: flex; flex-direction: column; gap: 8px; }

.window-prev, .window-curr {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.window-prev span, .window-curr span {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--amber), var(--orange));
  transition: width 0.6s ease;
}

.algo-formula {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.algo-formula strong { color: var(--amber-light); }

/* Fixed window visual */
.fixed-windows {
  display: flex;
  gap: 6px;
}

.fw {
  flex: 1;
  height: 40px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fw span {
  position: relative;
  z-index: 1;
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--text-muted);
}

.fw-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--amber), var(--orange));
  opacity: 0.25;
  border-radius: 6px;
}

.fw-fill.full {
  background: linear-gradient(90deg, var(--red), #dc2626);
  opacity: 0.35;
}

/* Token bucket visual */
.bucket-visual { text-align: center; }

.bucket {
  display: inline-flex;
  gap: 4px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.token { font-size: 1.1rem; }
.token.dim { opacity: 0.2; }

.bucket-label {
  margin-top: 8px;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

.algo-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ─── Usage Steps ─────────────────────────────────── */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.usage-step {
  padding: 28px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.usage-step.revealed {
  opacity: 1;
  transform: translateY(0);
}

.step-marker {
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  opacity: 0.4;
  line-height: 1;
  margin-bottom: 12px;
}

.usage-step h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.code-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--amber-light);
}

.code-inline code { flex: 1; }

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

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

.step-note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.step-note code {
  color: var(--amber-light);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.usage-step .code-card { margin-top: 0; }

.usage-step .code-body {
  padding: 16px;
  font-size: 0.78rem;
}

/* ─── Features ────────────────────────────────────── */
.features-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-pill {
  display: flex;
  gap: 14px;
  padding: 22px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.4s ease;
}

.feature-pill.revealed {
  opacity: 1;
  transform: translateY(0);
}

.feature-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.pill-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.feature-pill strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.feature-pill p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Options Table ───────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.options-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.options-table thead {
  background: rgba(0, 0, 0, 0.3);
}

.options-table th {
  text-align: left;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.options-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

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

.options-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.options-table code {
  color: var(--amber-light);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ─── CTA ─────────────────────────────────────────── */
.cta-section { padding: 80px 0 100px; }

.cta-box {
  text-align: center;
  padding: 60px 40px;
  background: var(--amber-glow);
  border: 1px solid var(--border-warm);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
}

.cta-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.cta-box h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  position: relative;
}

.cta-box h2 code {
  color: var(--text-dim);
  font-size: 0.85em;
  text-decoration: line-through;
  opacity: 0.7;
}

.cta-box > p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 28px;
  position: relative;
}

.cta-install {
  max-width: 400px;
  margin: 0 auto 28px;
  justify-content: center;
  position: relative;
}

.cta-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  position: relative;
}

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

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer p, .footer a {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.footer a:hover { color: var(--text-muted); }

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

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 100px;
    gap: 40px;
  }

  .float-card { display: none; }

  .algo-grid {
    grid-template-columns: 1fr;
  }

  .features-row {
    grid-template-columns: 1fr 1fr;
  }

  .nav-links a:not(.nav-cta) { display: none; }
}

@media (max-width: 600px) {
  .hero { padding: 90px 16px 40px; }

  .usage-grid { grid-template-columns: 1fr; }

  .features-row { grid-template-columns: 1fr; }

  .hero-stats { flex-direction: column; gap: 16px; }
  .stat-divider { width: 40px; height: 1px; }

  .footer-row { flex-direction: column; gap: 8px; text-align: center; }

  .cta-box { padding: 40px 24px; }

  .section { padding: 60px 0; }
}
