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

:root {
  --color-bg: #0F1117;
  --color-surface: #1A1D27;
  --color-border: #2A2D3A;
  --color-text: #F8F9FA;
  --color-text-muted: #8B95A5;
  --color-blue: #4C8BF5;
  --color-amber: #F5A623;
  --color-green: #34D399;
  --color-red: #EF4444;
  --font-display: 'Geist', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 96px;
  --max-width: 1120px;
  --radius: 8px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

@media (min-width: 768px) {
  .container { padding: 0 120px; }
}

a {
  color: var(--color-blue);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

a:hover { opacity: 0.85; }

code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-amber);
}

/* ===== Nav ===== */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}

@media (min-width: 768px) {
  .nav-inner { padding: 0 120px; }
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
}

.logo:hover { opacity: 1; }
.logo-text { letter-spacing: -0.02em; }

.nav-links {
  display: none;
  gap: 24px;
  flex: 1;
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

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

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

.nav-cta {
  margin-left: auto;
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text) !important;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.nav-cta:hover {
  border-color: var(--color-blue);
  background: rgba(76, 139, 245, 0.08);
  opacity: 1;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  transition: all 0.15s ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-blue);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: #3a7de8;
  opacity: 1;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
  opacity: 1;
}

.btn-large {
  padding: 16px 40px;
  font-size: 1.125rem;
  width: 100%;
  max-width: 320px;
  display: block;
  margin: 0 auto;
}

/* ===== Hero ===== */
.hero {
  padding: 140px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(ellipse, rgba(76, 139, 245, 0.06) 0%, rgba(245, 166, 35, 0.03) 40%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

@media (min-width: 768px) {
  .hero-inner { padding: 0 120px; }
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 32px;
  animation: fadeInUp 0.6s ease both;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s ease 0.1s both;
}

@media (min-width: 768px) {
  .hero h1 { font-size: 3.5rem; }
}

.refract-line {
  background: linear-gradient(90deg, var(--color-blue), var(--color-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  max-width: 560px;
  margin: 0 auto 40px;
  font-size: 1.125rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  animation: fadeInUp 0.6s ease 0.2s both;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 64px;
  animation: fadeInUp 0.6s ease 0.3s both;
}

.hero-visual {
  animation: fadeInUp 0.6s ease 0.4s both;
}

/* ===== Terminal ===== */
.terminal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
}

.terminal-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.terminal-body {
  padding: 20px;
  overflow-x: auto;
}

.terminal-body code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  background: none;
  padding: 0;
  color: var(--color-text);
  white-space: pre;
}

.prompt { color: var(--color-green); }
.muted { color: var(--color-text-muted); }
.accent-blue { color: var(--color-blue); }
.accent-amber { color: var(--color-amber); }

/* ===== Section labels ===== */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.section-intro {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 640px;
  line-height: 1.6;
  margin-bottom: 48px;
}

/* ===== Problem ===== */
.problem {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.problem-grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 768px) {
  .problem-grid { grid-template-columns: repeat(3, 1fr); }
}

.problem-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px 24px;
}

.problem-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 12px;
  color: var(--color-red);
}

.problem-card p {
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ===== How it works ===== */
.how-it-works {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

@media (min-width: 768px) {
  .flow {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
  }
}

.flow-step {
  text-align: center;
  max-width: 240px;
  flex-shrink: 0;
}

.flow-icon {
  margin-bottom: 16px;
}

.flow-step h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
}

.flow-step p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.flow-step--accent h3 {
  background: linear-gradient(90deg, var(--color-blue), var(--color-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.flow-arrow {
  padding-top: 0;
  flex-shrink: 0;
  transform: rotate(90deg);
}

@media (min-width: 768px) {
  .flow-arrow {
    padding-top: 20px;
    transform: none;
  }
}

/* ===== Routing ===== */
.routing {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.routing-demo {
  display: grid;
  gap: 32px;
}

@media (min-width: 768px) {
  .routing-demo { grid-template-columns: 1.2fr 1fr; align-items: start; }
}

.routing-code {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
}

.code-filename {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.routing-code pre {
  padding: 20px;
  overflow-x: auto;
}

.routing-code code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  background: none;
  padding: 0;
  color: var(--color-text);
}

.key { color: var(--color-blue); }
.string { color: var(--color-green); }
.num { color: var(--color-amber); }
.bool { color: var(--color-amber); }

.matcher-grid {
  display: grid;
  gap: 12px;
}

.matcher {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  gap: 12px;
}

.matcher-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-amber);
  white-space: nowrap;
}

.matcher-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: right;
}

/* ===== Providers ===== */
.providers {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.provider-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .provider-grid { grid-template-columns: repeat(2, 1fr); }
}

.provider-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.provider-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.provider-type {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(76, 139, 245, 0.1);
  color: var(--color-blue);
}

.provider-note {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.providers-footnote {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ===== Features ===== */
.features {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.feature-list {
  display: grid;
  gap: 32px;
}

@media (min-width: 768px) {
  .feature-list { grid-template-columns: repeat(2, 1fr); }
}

.feature h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 8px;
}

.feature p {
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ===== Pricing ===== */
.pricing {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.pricing-card {
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
}

.pricing-header {
  margin-bottom: 32px;
}

.pricing-header h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.pricing-amount {
  margin-bottom: 4px;
}

.pricing-currency {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  vertical-align: top;
}

.pricing-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 4rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.pricing-period {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 32px;
}

.pricing-features li {
  padding: 8px 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--color-border);
  padding-left: 24px;
  position: relative;
}

.pricing-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-blue);
}

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

.pricing-note {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

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

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--color-text);
  opacity: 1;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}