/* ───────────────────────────────────────────────────────────────
   mtwKernel marketing site — single stylesheet, no framework.
   Design tokens mirror the dashboard's download.html so brand is
   coherent between the public site and the kernel UI.
   ─────────────────────────────────────────────────────────────── */

:root {
  --bg-0: #07080c;
  --bg-1: #0d1020;
  --bg-2: #161a30;
  --bg-3: #1a1f35;
  --line: #1d2138;
  --line-soft: #232742;
  --line-strong: #2a3050;

  --text: #e4e7f1;
  --text-dim: #b8bdd1;
  --text-muted: #8b91a8;
  --text-faint: #6c7191;

  --indigo: #6366f1;
  --indigo-dark: #4f46e5;
  --indigo-light: #818cf8;
  --teal: #3dd6c8;
  --cyan: #06b6d4;

  --grad-core: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --grad-accent: linear-gradient(135deg, #818cf8 0%, #3dd6c8 100%);
  --grad-bg: radial-gradient(ellipse at top, var(--bg-2) 0%, var(--bg-1) 50%, var(--bg-0) 100%);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Inter", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--grad-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

/* ─── Background layers ──────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 1200px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(99,102,241,0.15) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
}

/* ─── Shell ──────────────────────────────────────────────────── */
.shell {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 28px 96px;
}

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 88px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.brand-mark { width: 36px; height: 36px; }
.brand-name b { color: #fff; font-size: 16px; letter-spacing: -0.01em; }

.topnav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
}
.topnav > a {
  color: var(--text-muted);
  transition: color 0.15s;
}
.topnav > a:hover { color: #fff; }

.lang {
  display: inline-flex;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
  font-family: var(--font-mono);
}
.lang button {
  padding: 4px 10px;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.lang button:hover { color: #fff; }
.lang button.active {
  background: var(--grad-core);
  color: #fff;
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 24px 0 48px;
}

.eyebrow {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-pill);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 28px;
  background: rgba(99,102,241,0.04);
}

h1 {
  font-size: clamp(40px, 7vw, 76px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0 0 20px;
  color: #fff;
}

.accent {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lede {
  max-width: 680px;
  margin: 0 auto 40px;
  color: var(--text-dim);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.install-line {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #07080c;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  max-width: 100%;
  box-shadow: 0 6px 32px rgba(99,102,241,0.18);
}
.install-line .prompt {
  color: var(--indigo);
  user-select: none;
}
.install-line code {
  color: #d4d8e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--line-soft);
  color: var(--text-muted);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.copy-btn:hover {
  color: #fff;
  border-color: var(--indigo);
}
.copy-btn.copied {
  color: var(--teal);
  border-color: var(--teal);
}
.copy-btn.small { padding: 3px 9px; font-size: 10px; }
.copy-btn svg { width: 12px; height: 12px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--grad-core);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 6px 24px rgba(99,102,241,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(99,102,241,0.45), inset 0 1px 0 rgba(255,255,255,0.2);
  filter: brightness(1.05);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: transparent;
  border: 1px solid var(--line-soft);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-secondary:hover {
  border-color: var(--indigo);
  background: rgba(99,102,241,0.06);
}

.hero-platforms {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.platform-pill svg { opacity: 0.8; }

.hero-foot {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  margin: 0;
}

/* ─── Stats ──────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 32px;
  margin: 64px 0 96px;
  background: linear-gradient(180deg, rgba(99,102,241,0.05) 0%, rgba(99,102,241,0.01) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.stat { text-align: center; }
.stat-n {
  display: block;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-l {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Section heading utility ────────────────────────────────── */
.section-h {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-align: center;
  margin: 0 0 16px;
  color: #fff;
}
.section-sub {
  max-width: 620px;
  margin: 0 auto 48px;
  text-align: center;
  color: var(--text-dim);
  font-size: 16px;
}

/* ─── Modules ────────────────────────────────────────────────── */
.modules { margin-bottom: 120px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.mod-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.mod-card:hover {
  background: rgba(99,102,241,0.05);
  border-color: rgba(99,102,241,0.3);
  transform: translateY(-1px);
}
.mod-emoji {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 6px;
}
.mod-card b { color: #fff; font-size: 14px; font-weight: 600; }
.mod-card span:not(.mod-emoji) {
  font-size: 12px;
  color: var(--text-muted);
}

.mod-card-more {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-style: dashed;
}
.mod-card-more a {
  color: var(--indigo-light);
  font-size: 14px;
  font-weight: 600;
}

/* ─── How it works ───────────────────────────────────────────── */
.how { margin-bottom: 120px; }

.diagram {
  display: grid;
  grid-template-columns: 1fr auto 1.2fr auto 1fr;
  gap: 16px;
  align-items: stretch;
  margin: 40px 0 56px;
}

.d-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.d-col h3 {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin: 0 0 4px;
  font-weight: 700;
}

.d-card {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  background: rgba(99,102,241,0.04);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.d-card b { color: #fff; font-size: 13px; font-weight: 600; }
.d-card span { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.d-kernel {
  background: linear-gradient(180deg, rgba(99,102,241,0.12) 0%, rgba(99,102,241,0.03) 100%);
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 0 60px rgba(99,102,241,0.15);
}
.d-stack { display: flex; flex-direction: column; gap: 4px; }
.d-stack-row {
  padding: 8px 12px;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.d-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Code snippet block ─────────────────────────────────────── */
.snippet {
  background: #07080c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 720px;
  margin: 0 auto;
}
.snippet-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.4);
}
.snippet-tab {
  padding: 12px 18px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.snippet-tab:hover { color: #fff; }
.snippet-tab.is-on {
  color: #fff;
  border-bottom-color: var(--indigo);
}
.snippet-code {
  margin: 0;
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #d4d8e8;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
}
.snippet-code .k { color: var(--indigo-light); }
.snippet-code .s { color: var(--teal); }

/* ─── Install section ────────────────────────────────────────── */
.install { margin-bottom: 120px; }

.install-tabs {
  display: flex;
  width: fit-content;
  margin: 0 auto 24px;
  padding: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  gap: 4px;
  justify-content: center;
}
.install-tab {
  padding: 8px 18px;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}
.install-tab:hover { color: #fff; }
.install-tab.is-on {
  background: var(--grad-core);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

.install-panes {
  max-width: 720px;
  margin: 0 auto;
}
.install-pane { display: none; }
.install-pane.is-on { display: flex; flex-direction: column; gap: 12px; }

.install-block {
  position: relative;
  padding: 18px 20px;
  background: #07080c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.install-block .copy-btn {
  position: absolute;
  top: 14px;
  right: 14px;
}
.install-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}
.install-block pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #d4d8e8;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}
.install-link {
  color: var(--indigo-light);
  font-weight: 600;
  font-size: 14px;
}
.install-link:hover { text-decoration: underline; }
.install-foot {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.install-foot code {
  background: rgba(0,0,0,0.4);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--indigo-light);
}

.install-after {
  text-align: center;
  margin-top: 32px;
  color: var(--text-muted);
  font-size: 13px;
}
.install-after code {
  background: rgba(0,0,0,0.4);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--indigo-light);
  font-family: var(--font-mono);
}

/* ─── Why ────────────────────────────────────────────────────── */
.why { margin-bottom: 120px; }

.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.why-card {
  padding: 28px 24px;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.2s;
}
.why-card:hover {
  border-color: rgba(99,102,241,0.35);
  transform: translateY(-2px);
}
.why-icon { font-size: 28px; margin-bottom: 12px; }
.why-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.why-card p {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.55;
}
.why-card code {
  background: rgba(0,0,0,0.4);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--indigo-light);
  font-family: var(--font-mono);
}

/* ─── CTA ────────────────────────────────────────────────────── */
.cta {
  text-align: center;
  padding: 80px 24px;
  background: linear-gradient(180deg, rgba(99,102,241,0.1) 0%, rgba(99,102,241,0.02) 100%);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 80px;
  box-shadow: 0 0 100px rgba(99,102,241,0.1);
}
.cta h2 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 32px;
  color: #fff;
}
.cta-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  color: var(--text-faint);
}
.footer a {
  color: var(--text-muted);
  transition: color 0.15s;
}
.footer a:hover { color: #fff; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .diagram {
    grid-template-columns: 1fr;
  }
  .d-arrow {
    transform: rotate(90deg);
    margin: -8px auto;
  }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .shell { padding: 20px 16px 64px; }
  .topbar { margin-bottom: 56px; gap: 12px; }
  .topnav { gap: 14px; font-size: 13px; }
  .topnav > a:not(.lang) { display: none; }
  .topnav .lang { order: 99; }
  .topnav > a[href="https://github.com/fastslack/mtwKernel"] { display: inline; }

  h1 { font-size: clamp(32px, 9vw, 48px); }

  .install-line { flex-wrap: wrap; }
  .install-line code { white-space: normal; word-break: break-all; }

  .install-tabs { flex-wrap: wrap; }
  .install-tab { flex: 1 0 40%; }

  .footer { flex-direction: column; align-items: flex-start; }
}

/* ─── Reduce motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }
  html { scroll-behavior: auto; }
}

/* ─── Focus states ───────────────────────────────────────────── */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--indigo-light);
  outline-offset: 2px;
  border-radius: 6px;
}
