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

:root {
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #7a7a9a;
  --bg-page: #fafbfc;
  --bg-card: #ffffff;
  --bg-code: #f4f5f7;
  --border: #e8e9ed;
  --accent: #3b5bdb;
  --accent-light: #edf2ff;
  --accent-dark: #2b4acb;
  --success: #2f9e44;
  --radius: 8px;
  --max-w: 880px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-dark); }

code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── NAV ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 251, 252, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.nav-brand span { color: var(--accent); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.nav-links a:hover { color: var(--accent); }

/* ── HERO ── */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 100px 24px 80px;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 20px;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.hero h1 span { color: var(--accent); }
.hero p.lead {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 36px;
  line-height: 1.6;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── INNER PAGE HERO ── */
.page-hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 72px 24px 48px;
}
.page-hero .breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.page-hero .breadcrumb a { color: var(--text-muted); }
.page-hero .breadcrumb a:hover { color: var(--accent); }
.page-hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}
.page-hero h1 span { color: var(--accent); }
.page-hero p.lead {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.6;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  transition: all .15s;
  cursor: pointer;
  border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 8px 18px; font-size: 13px; }

/* ── HERO INSTALL ── */
.hero-install {
  margin-top: 40px;
  background: var(--text-primary);
  color: #c9d1d9;
  border-radius: var(--radius);
  padding: 18px 24px;
  font-family: var(--font-mono);
  font-size: 14px;
  text-align: left;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.8;
}
.hero-install .prompt { color: var(--accent); user-select: none; }
.hero-install .comment { color: #6a737d; }

/* ── SECTIONS ── */
section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px 24px;
}
section + section { padding-top: 0; }
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
section h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}
section > p {
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 680px;
}
section h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 40px 0 12px;
}
section h3:first-of-type { margin-top: 0; }

/* ── STATS ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.stat-card .num { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── FEATURE GRID ── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color .2s;
}
.feature-card:hover { border-color: var(--accent); }
.feature-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 16px;
}
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; margin-top: 0; }
.feature-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* ── ARCHITECTURE LAYERS ── */
.arch-layers { display: flex; flex-direction: column; gap: 16px; }
.arch-layer {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 28px;
  display: flex; gap: 20px; align-items: flex-start;
}
.arch-layer .layer-num {
  flex-shrink: 0; width: 36px; height: 36px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.arch-layer h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.arch-layer p { font-size: 14px; color: var(--text-secondary); }

/* ── DOMAINS GRID ── */
.domains {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.domain-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color .2s;
}
.domain-item:hover { border-color: var(--accent); }
.domain-item .icon { font-size: 22px; flex-shrink: 0; width: 40px; text-align: center; }
.domain-item .info h4 { font-size: 14px; font-weight: 600; }
.domain-item .info p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── TABLES ── */
.cmd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 32px;
}
.cmd-table th {
  text-align: left; font-weight: 600;
  padding: 12px 16px; border-bottom: 2px solid var(--border);
  color: var(--text-muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px;
}
.cmd-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cmd-table tr:last-child td { border-bottom: none; }
.cmd-table code { white-space: nowrap; }

.skills-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.skills-table th {
  text-align: left; font-weight: 600;
  padding: 12px 16px; border-bottom: 2px solid var(--border);
  color: var(--text-muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px;
}
.skills-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.skills-table tr:last-child td { border-bottom: none; }
.skills-table code { white-space: nowrap; }
.skills-table .category {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--accent);
  padding: 4px 8px; background: var(--accent-light);
  border-radius: 4px; display: inline-block;
}

/* ── CODE BLOCK ── */
.code-block {
  background: #1e1e2e; color: #cdd6f4;
  border-radius: var(--radius); padding: 20px 24px;
  font-family: var(--font-mono); font-size: 13.5px;
  line-height: 1.7; overflow-x: auto; margin-bottom: 24px;
}
.code-block .prompt { color: #89b4fa; }
.code-block .comment { color: #6c7086; }
.code-block .flag { color: #a6e3a1; }
.code-block .string { color: #f9e2af; }

/* ── TECH LIST ── */
.tech-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.tech-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px;
}
.tech-item strong { min-width: 110px; flex-shrink: 0; }
.tech-item span { color: var(--text-secondary); }

/* ── USE CASES ── */
.use-cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.use-case {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.use-case h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.use-case p { font-size: 14px; color: var(--text-secondary); line-height: 1.55; }

/* ── SECURITY ── */
.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.security-item { display: flex; gap: 12px; align-items: flex-start; }
.security-item .check {
  flex-shrink: 0; width: 24px; height: 24px;
  border-radius: 50%; background: #ebfbee; color: var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; margin-top: 2px;
}
.security-item h4 { font-size: 14px; font-weight: 600; }
.security-item p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── FAQ ── */
.faq-item { border-bottom: 1px solid var(--border); padding: 24px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; margin-top: 0; }
.faq-item p { font-size: 14px; color: var(--text-secondary); line-height: 1.65; }

/* ── CONTENT PROSE ── */
.prose { max-width: 680px; }
.prose p { color: var(--text-secondary); margin-bottom: 16px; line-height: 1.7; }
.prose h2 { font-size: 24px; font-weight: 700; margin: 48px 0 12px; letter-spacing: -0.3px; }
.prose h3 { font-size: 18px; font-weight: 700; margin: 32px 0 8px; }
.prose ul, .prose ol { color: var(--text-secondary); margin-bottom: 16px; padding-left: 24px; }
.prose li { margin-bottom: 6px; line-height: 1.6; }

/* ── RELATED PAGES ── */
.related-pages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.related-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  transition: border-color .2s;
  display: block; color: var(--text-primary);
}
.related-card:hover { border-color: var(--accent); color: var(--text-primary); }
.related-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.related-card p { font-size: 13px; color: var(--text-muted); }

/* ── CLUSTER LINKS (for index) ── */
.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.cluster-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color .2s; display: block; color: var(--text-primary);
}
.cluster-card:hover { border-color: var(--accent); color: var(--text-primary); }
.cluster-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; margin-top: 0; }
.cluster-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* ── FOOTER ── */
footer { border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 40px 24px;
  display: flex; justify-content: space-between;
  align-items: flex-start; flex-wrap: wrap; gap: 32px;
}
.footer-col h4 {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted); margin-bottom: 12px;
}
.footer-col a { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  max-width: var(--max-w); margin: 0 auto; padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted); text-align: center;
}

/* ── SIDEBAR TOC LAYOUT ── */
.page-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  max-width: calc(var(--max-w) + 200px + 48px);
  margin: 0 auto;
  gap: 0;
}
.sidebar-toc {
  position: sticky;
  top: 72px;
  align-self: start;
  padding: 24px 0 24px 24px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.sidebar-toc h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 12px;
}
.sidebar-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-toc li { margin: 0; }
.sidebar-toc a {
  display: block;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: all .15s;
  line-height: 1.4;
}
.sidebar-toc a:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--accent);
}
.sidebar-toc a.active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-light);
}
.page-main {
  min-width: 0;
}
/* override sections inside page-main to use full width */
.page-main .page-hero { max-width: var(--max-w); }
.page-main section { max-width: var(--max-w); }
.page-main footer { max-width: none; }

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
  .page-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-toc {
    display: none;
  }
}
@media (max-width: 600px) {
  .hero { padding: 64px 20px 56px; }
  .hero h1 { font-size: 28px; }
  .page-hero { padding: 56px 20px 36px; }
  .page-hero h1 { font-size: 26px; }
  section { padding: 56px 20px; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 13px; }
  .arch-layer { flex-direction: column; }
}
