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

:root {
  --bg: #0D0F14;
  --bg-card: #131620;
  --bg-card-hover: #1A1F2E;
  --accent: #00E5C3;
  --accent-dim: rgba(0, 229, 195, 0.12);
  --text: #E8E6E0;
  --text-muted: #8A8999;
  --text-dim: #505468;
  --border: rgba(255,255,255,0.06);
  --code-bg: #0A0C10;
  --hot: #FF6B6B;
  --ref: #FFD93D;
  --self: #00E5C3;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* === NAV === */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(13,15,20,0.85);
}
.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--text);
}
.nav-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* === HERO === */
.hero { padding: 6rem 2rem 5rem; }
.hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-family: 'IBM Plex Mono', monospace;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.hero-headline {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 1.25rem;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 440px;
  margin-bottom: 2.5rem;
}
.hero-actions { display: flex; gap: 1rem; }

/* Memory Visual */
.memory-visual { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; }
.tier { margin-bottom: 1.5rem; }
.tier:last-of-type { margin-bottom: 0; }
.tier-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent);
  display: block;
  margin-bottom: 0.4rem;
}
.tier-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-bottom: 0.35rem; overflow: hidden; }
.tier-fill { height: 100%; border-radius: 2px; }
.tier-fill.fast { width: 18%; background: var(--hot); }
.tier-fill.medium { width: 62%; background: var(--ref); }
.tier-fill.slow { width: 95%; background: var(--self); }
.tier-rate { font-size: 0.7rem; color: var(--text-dim); font-family: 'IBM Plex Mono', monospace; }
.tier-caption { font-size: 0.7rem; color: var(--text-muted); margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Buttons */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary:hover { background: #00ffda; }
.btn-ghost {
  display: inline-block;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.04); }

/* === SECTIONS === */
.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  max-width: 600px;
}
.section-body {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 560px;
  margin-top: 0.75rem;
  line-height: 1.7;
}

/* === TIERS SECTION === */
.tiers { padding: 5rem 2rem; border-top: 1px solid var(--border); }
.tiers-inner { max-width: 1160px; margin: 0 auto; }
.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 2.5rem;
}
.tier-card { background: var(--bg-card); padding: 2rem; }
.tier-card-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}
.tier-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}
.tier-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; margin-bottom: 1rem; }
.tier-card ul { list-style: none; }
.tier-card ul li {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
}
.tier-card ul li::before { content: '—'; position: absolute; left: 0; color: var(--text-dim); }

/* === ARCHITECTURE === */
.architecture { padding: 5rem 2rem; border-top: 1px solid var(--border); }
.arch-inner { max-width: 1160px; margin: 0 auto; }
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 3rem 0;
}
.metric-val {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.35rem;
}
.metric-key {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.metric-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }

.stack-flow { margin-top: 0.5rem; }
.stack-labels {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.stack-labels span {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
}
.stack-labels span:nth-child(2) { margin-left: 4rem; }
.stack-labels span:nth-child(3) { margin-left: 5rem; }
.stack-labels span:nth-child(4) { margin-left: 6rem; }

.stack-diagram {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.stack-agents, .stack-api, .stack-index, .stack-out {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.agent-chip, .api-fn, .idx-chip, .out-chip {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  border: 1px solid;
  white-space: nowrap;
}
.agent-chip {
  background: rgba(0,229,195,0.08);
  border-color: rgba(0,229,195,0.2);
  color: var(--accent);
}
.stack-agents { width: 180px; }
.stack-arrow {
  width: 48px;
  height: 2px;
  background: linear-gradient(to right, var(--text-dim), transparent);
  flex-shrink: 0;
  margin: 0 0.5rem;
  align-self: center;
}
.stack-note {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  margin-top: 0.25rem;
}
.api-methods { display: flex; flex-direction: column; gap: 0.25rem; }
.api-fn {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
  color: var(--text-muted);
}
.idx-chip {
  background: rgba(255,217,61,0.06);
  border-color: rgba(255,217,61,0.15);
  color: #FFD93D;
}
.stack-index .index-chips { display: flex; flex-direction: column; gap: 0.25rem; }
.stack-out .out-chip {
  background: rgba(255,107,107,0.06);
  border-color: rgba(255,107,107,0.15);
  color: #FF6B6B;
}

/* === CODE SECTION === */
.code-section { padding: 5rem 2rem; border-top: 1px solid var(--border); }
.code-inner { max-width: 1160px; margin: 0 auto; }
.code-tabs { display: flex; gap: 0; margin: 2rem 0 0; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: var(--text); border-color: var(--accent); }
.tab-btn:hover { color: var(--text); }

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

.code-panel pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 8px 8px 8px;
  padding: 2rem;
  overflow-x: auto;
}
.code-panel code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--text-muted);
}
code .k { color: #9d8dff; }
code .p { color: var(--text); }
code .s { color: #7ec8a4; }
code .o { color: #FF6B6B; }
code .c { color: var(--text-dim); }

.code-feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.cf {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.cf-icon { color: var(--accent); font-family: 'IBM Plex Mono', monospace; flex-shrink: 0; }

/* === CLOSING === */
.closing { padding: 7rem 2rem; border-top: 1px solid var(--border); text-align: center; }
.closing-inner { max-width: 700px; margin: 0 auto; }
.closing h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}
.closing p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto 2.5rem;
}
.closing-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn-primary-light {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
}
.btn-ghost-light {
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.15s;
}
.btn-ghost-light:hover { border-color: rgba(255,255,255,0.4); }

/* === FOOTER === */
.footer { border-top: 1px solid var(--border); padding: 2rem; }
.footer-inner { max-width: 1160px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.footer-logo { font-family: 'IBM Plex Mono', monospace; font-weight: 500; }
.footer-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.25rem; }
.footer-links { display: flex; gap: 2rem; }
.footer-links a { font-size: 0.8rem; color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 3rem; }
  .hero-right { display: none; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .tier-grid { grid-template-columns: 1fr; }
  .stack-labels span:nth-child(n) { display: none; }
  .code-feature-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero { padding: 4rem 1.5rem 3rem; }
  .tiers, .architecture, .code-section { padding: 4rem 1.5rem; }
  .closing { padding: 5rem 1.5rem; }
  .metrics-row { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-inner { flex-direction: column; gap: 1.5rem; align-items: flex-start; }
}