/* ═══════════════════════════════════════════════════════════
   Whittle Protocol — Design System
   Premium dark theme with glassmorphism and micro-animations
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Palette */
  --bg: #0A0D14;
  --bg-raised: #0F1219;
  --surface: #151A24;
  --surface-2: #1C2230;
  --border: #252D3D;
  --border-light: #2D3648;
  
  --accent: #2D9F6F;
  --accent-light: #3DBF85;
  --accent-dim: rgba(45, 159, 111, 0.12);
  --accent-glow: rgba(45, 159, 111, 0.25);

  --text: #E4E8F0;
  --text-secondary: #8892A8;
  --text-dim: #5A6580;

  --blue: #4A90D9;
  --coral: #E06050;
  --amber: #E8A838;
  --purple: #8B5CF6;
  --teal: #14B8A6;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --section-pad: 120px 0;
  --inner-max: 1180px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

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

html { scroll-behavior: smooth; }

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

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

/* ═══════════════════════════════════════ BUTTONS ═══════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-light);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 22px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-dim); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 22px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  border: none; cursor: pointer;
  transition: color 0.2s;
}
.btn-ghost:hover { color: var(--text); }

.btn-lg { padding: 14px 28px; font-size: 14px; border-radius: var(--radius); }
.btn-full { width: 100%; }

/* ═══════════════════════════════════════ NAV ═══════════════════════════════════════ */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(10, 13, 20, 0.85);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--inner-max);
  margin: 0 auto;
  display: flex; align-items: center;
  padding: 14px 24px;
  gap: 32px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; letter-spacing: 4px;
  color: var(--accent-light);
}
.nav-links {
  display: flex; gap: 28px;
}
.nav-links a {
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-cta { margin-left: auto; display: flex; gap: 10px; }

/* ═══════════════════════════════════════ HERO ═══════════════════════════════════════ */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 24px 80px;
  position: relative;
  overflow: hidden;
  max-width: var(--inner-max);
  margin: 0 auto;
  gap: 60px;
}
.hero-glow {
  position: absolute;
  top: -200px; left: -100px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  filter: blur(80px);
  animation: pulse 6s ease-in-out infinite alternate;
}
@keyframes pulse {
  from { opacity: 0.4; transform: scale(1); }
  to { opacity: 0.7; transform: scale(1.1); }
}
.hero-grid {
  position: absolute; inset: 0;
  background-image: 
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.15;
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, black 30%, transparent 100%);
}
.hero-content {
  flex: 1;
  position: relative; z-index: 2;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--accent-dim);
  border: 1px solid rgba(45, 159, 111, 0.25);
  border-radius: 100px;
  font-size: 12px; font-weight: 600; color: var(--accent-light);
  margin-bottom: 24px;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
#hero h1 {
  font-size: 52px; font-weight: 900; line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent-light), var(--teal), var(--blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 17px; color: var(--text-secondary); line-height: 1.7;
  max-width: 480px; margin-bottom: 32px;
}
.hero-actions {
  display: flex; gap: 12px;
  margin-bottom: 48px;
}
.hero-stats {
  display: flex; align-items: center; gap: 24px;
}
.stat { display: flex; flex-direction: column; }
.stat-value {
  font-size: 22px; font-weight: 800; color: var(--accent-light);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 11px; color: var(--text-dim); font-weight: 500; letter-spacing: 0.5px; }
.stat-divider { width: 1px; height: 32px; background: var(--border); }

/* Code window */
.hero-code {
  flex: 0 0 420px;
  position: relative; z-index: 2;
}
.code-window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.code-dots {
  display: flex; gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.code-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-light);
}
.code-dots span:nth-child(1) { background: #E06050; }
.code-dots span:nth-child(2) { background: #E8A838; }
.code-dots span:nth-child(3) { background: #2D9F6F; }
.code-title {
  padding: 8px 16px;
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.code-window pre {
  padding: 16px;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  overflow-x: auto;
}
.code-response {
  border-top: 1px solid var(--border);
  background: rgba(45, 159, 111, 0.04);
}
.code-arrow {
  padding: 4px 16px;
  font-size: 12px; color: var(--accent); font-weight: 600;
}
.c-key { color: var(--blue); }
.c-str { color: var(--accent-light); }
.c-num { color: var(--amber); }
.c-brace { color: var(--text-dim); }
.c-dim { color: var(--text-dim); }

/* ═══════════════════════════════════════ SECTIONS ═══════════════════════════════════════ */
section { padding: var(--section-pad); }
.section-inner {
  max-width: var(--inner-max);
  margin: 0 auto; padding: 0 24px;
}
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 3px;
  color: var(--accent); margin-bottom: 12px;
}
.section-inner h2 {
  font-size: 36px; font-weight: 800; letter-spacing: -0.8px;
  margin-bottom: 12px;
}
.section-sub {
  font-size: 16px; color: var(--text-secondary); max-width: 560px;
  margin-bottom: 48px;
}

/* ═══════════════════════════════════════ FEATURES ═══════════════════════════════════════ */
#features { background: var(--bg-raised); }
.features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.feature-card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s;
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(45, 159, 111, 0.08);
}
.feature-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.feature-card h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 8px;
}
.feature-card p {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6;
}
.feature-card code {
  font-size: 11px; color: var(--accent); padding: 4px 8px;
  background: var(--accent-dim); border-radius: 4px;
}

/* ═══════════════════════════════════════ PLAYGROUND ═══════════════════════════════════════ */
.playground-container {
  display: grid; grid-template-columns: 280px 1fr; gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 480px;
}
.playground-sidebar {
  padding: 24px;
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
  display: flex; flex-direction: column; gap: 8px;
}
.pg-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--text-dim); margin-top: 8px;
}
.pg-value {
  font-size: 12px; font-weight: 600; color: var(--accent-light);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.playground-sidebar select,
.playground-sidebar input[type="range"] {
  width: 100%;
}
.playground-sidebar select {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font); font-size: 12px;
  cursor: pointer;
}
.playground-sidebar select:focus { outline: none; border-color: var(--accent); }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--border);
  border-radius: 2px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--accent-glow);
}
#pg-run { margin-top: auto; }

.playground-results {
  padding: 24px;
  display: flex; flex-direction: column;
}
.pg-req-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--text-dim); margin-bottom: 8px;
}
.pg-code {
  flex: 1;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
  overflow: auto;
  color: var(--text);
  white-space: pre;
  min-height: 120px;
}
.pg-response.loading {
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══════════════════════════════════════ DOCS ═══════════════════════════════════════ */
#docs { background: var(--bg-raised); }
.docs-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
  margin-bottom: 48px;
}
.doc-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.doc-card h3 {
  font-size: 15px; font-weight: 700; margin-bottom: 12px;
}
.doc-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.doc-card pre {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--mono); font-size: 12px;
  color: var(--accent-light);
  overflow-x: auto;
  margin-bottom: 8px;
}
.doc-note { font-size: 12px; color: var(--text-dim); }
.doc-note code { font-size: 11px; color: var(--accent); }

.rate-table { margin-top: 12px; }
.rate-row {
  display: flex; padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.rate-row span { flex: 1; }
.rate-row span:not(:first-child) { text-align: right; color: var(--accent); }
.rate-header { color: var(--text-dim); font-weight: 600; font-size: 11px; }
.rate-header span:not(:first-child) { color: var(--text-dim); }

.error-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.error-item { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 10px; }
.err-code {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; padding: 2px;
  background: rgba(224, 96, 80, 0.1);
  border-radius: 4px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--coral);
}

/* Endpoint list */
.docs-endpoints h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.endpoint-list { display: flex; flex-direction: column; gap: 8px; }
.endpoint-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.endpoint-item:hover { border-color: var(--accent); }
.ep-method {
  padding: 3px 8px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.ep-method.post { background: rgba(45, 159, 111, 0.12); color: var(--accent); }
.ep-method.get { background: rgba(74, 144, 217, 0.12); color: var(--blue); }
.ep-path { font-family: var(--mono); font-size: 13px; color: var(--text); flex: 1; }
.ep-desc { font-size: 12px; color: var(--text-dim); }

/* ═══════════════════════════════════════ PRICING ═══════════════════════════════════════ */
.pricing-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.price-card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  transition: all 0.3s;
}
.price-card:hover { transform: translateY(-2px); }
.price-featured {
  border-color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
}
.price-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  padding: 4px 12px;
  background: var(--accent);
  color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  border-radius: 100px;
  white-space: nowrap;
}
.price-tier {
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 8px;
}
.price-amount { margin-bottom: 24px; }
.price-dollar { font-size: 18px; color: var(--text-dim); }
.price-amount { font-size: 42px; font-weight: 900; color: var(--text); }
.price-period { font-size: 14px; color: var(--text-dim); font-weight: 400; }
.price-custom { font-size: 28px; font-weight: 800; color: var(--text-secondary); }
.price-features {
  list-style: none; margin-bottom: 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.price-features li {
  font-size: 13px; color: var(--text-secondary);
  padding-left: 20px; position: relative;
}
.price-features li::before {
  content: '✓';
  position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}

/* ═══════════════════════════════════════ FOOTER ═══════════════════════════════════════ */
#footer {
  border-top: 1px solid var(--border);
  padding: 60px 0 0;
}
.footer-inner {
  max-width: var(--inner-max);
  margin: 0 auto; padding: 0 24px;
  display: flex; gap: 80px;
}
.footer-brand { flex: 1; }
.footer-brand p { font-size: 13px; color: var(--text-dim); margin-top: 12px; }
.footer-links { display: flex; gap: 48px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h4 { font-size: 12px; font-weight: 700; color: var(--text-dim); letter-spacing: 1px; margin-bottom: 4px; }
.footer-col a { font-size: 13px; color: var(--text-secondary); transition: color 0.2s; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  margin-top: 48px; padding: 20px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-bottom p { font-size: 12px; color: var(--text-dim); }

/* ═══════════════════════════════════════ RESPONSIVE ═══════════════════════════════════════ */
@media (max-width: 900px) {
  #hero { flex-direction: column; min-height: auto; padding-top: 100px; }
  .hero-code { flex: none; width: 100%; }
  .features-grid { grid-template-columns: 1fr; }
  .playground-container { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
}
@media (max-width: 600px) {
  #hero h1 { font-size: 32px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; gap: 16px; }
}
