/* ============================================================
   FlAI Documentation — Custom Styles
   ============================================================ */

/* --- Base Reset & Variables --------------------------------- */
:root {
  --bg: #09090B;
  --bg-card: #111113;
  --bg-popover: #18181B;
  --fg: #FAFAFA;
  --fg-muted: #A1A1AA;
  --fg-subtle: #71717A;
  --border: #27272A;
  --border-subtle: #1F1F23;
  --accent: #818CF8;
  --accent-muted: rgba(129, 140, 248, 0.12);
  --accent-hover: rgba(129, 140, 248, 0.08);
  --ring: #818CF8;
  --sidebar-w: 260px;
  --toc-w: 220px;
  --header-h: 56px;
  --content-max: 768px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
}

::selection {
  background: rgba(129, 140, 248, 0.3);
  color: #fff;
}

a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--fg); }

/* --- Scrollbar ---------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-subtle); }

/* --- Layout ------------------------------------------------- */
/*
 * Layout system: set data-layout on <body> to control page structure.
 *   "home" — centered narrow content, no sidebar (homepage)
 *   "docs" — sidebar + toc + content column (documentation)
 *   "full" — no sidebar, wide centered content (blueprints, etc.)
 */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--header-max, none);
}

.header-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo .logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: rgba(99,102,241,0.1);
  border-radius: 6px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 32px;
}

.header-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
}
.header-nav a:hover {
  color: var(--fg);
  background: var(--accent-hover);
}
.header-nav a.active {
  color: var(--fg);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-gh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}
.header-gh:hover { color: var(--fg); background: var(--accent-hover); }

.header-gh svg { width: 18px; height: 18px; fill: currentColor; }

/* Mobile menu toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.mobile-toggle:hover { color: var(--fg); background: var(--accent-hover); }
.mobile-toggle svg { width: 20px; height: 20px; }

/* --- Sidebar ------------------------------------------------ */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 20px 16px 40px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  z-index: 50;
}

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--fg-subtle);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  padding: 5px 8px;
  border-radius: 6px;
  transition: all 0.12s;
  line-height: 1.5;
}
.sidebar-link:hover {
  color: var(--fg);
  background: var(--accent-hover);
}
.sidebar-link.active {
  color: var(--fg);
  background: var(--accent-muted);
}

/* --- Table of Contents (right) ------------------------------ */
.toc {
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  width: var(--toc-w);
  overflow-y: auto;
  padding: 24px 16px 40px;
  border-left: 1px solid var(--border);
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--fg-subtle);
  margin-bottom: 12px;
}

.toc-link {
  display: block;
  font-size: 12px;
  color: var(--fg-subtle);
  padding: 3px 0;
  border-left: 2px solid transparent;
  padding-left: 10px;
  transition: all 0.12s;
  line-height: 1.5;
}
.toc-link:hover {
  color: var(--fg-muted);
  border-left-color: var(--border);
}
.toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* --- Main Content ------------------------------------------- */
/* Base: no sidebar/toc margins — layouts opt in */
.main-content {
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

.content-inner {
  max-width: var(--content-max);
}

/* Layout: home — centered narrow container, no sidebar */
[data-layout="home"] { --header-max: 1080px; }
[data-layout="home"] .main-content {
  padding: 0;
}
[data-layout="home"] .homepage-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Layout: docs — sidebar + toc + content */
[data-layout="docs"] .main-content {
  margin-left: var(--sidebar-w);
  margin-right: var(--toc-w);
  padding: 40px 48px 80px;
}

/* Layout: full — wide centered content, no sidebar */
[data-layout="full"] { --header-max: 1200px; }
[data-layout="full"] .main-content {
  padding: 0;
}
[data-layout="full"] .homepage-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* --- Typography --------------------------------------------- */
.page-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--fg);
  margin-bottom: 8px;
}

.page-desc {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.3px;
  color: var(--fg);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  margin-top: 32px;
  margin-bottom: 12px;
}

h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-top: 24px;
  margin-bottom: 8px;
}

p {
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

ul, ol {
  color: var(--fg-muted);
  padding-left: 24px;
  margin-bottom: 16px;
}
li { margin-bottom: 4px; line-height: 1.6; }

strong { color: var(--fg); font-weight: 600; }
code:not([class*="language-"]) {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  background: rgba(129, 140, 248, 0.08);
  color: #c4b5fd;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(129, 140, 248, 0.12);
}

/* --- Code Blocks -------------------------------------------- */
pre {
  background: #0C0C0E !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  margin: 0 0 20px !important;
  padding: 0 !important;
  overflow: hidden;
  position: relative;
}

pre code {
  display: block;
  padding: 16px 20px !important;
  font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
  font-size: 12.5px !important;
  line-height: 1.65 !important;
  overflow-x: auto;
  background: none !important;
  border: none !important;
  color: #d4d4d8 !important;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-subtle);
}

.code-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-subtle);
  text-transform: lowercase;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-subtle);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
}
.copy-btn:hover {
  color: var(--fg-muted);
  border-color: var(--fg-subtle);
  background: rgba(255,255,255,0.03);
}
.copy-btn.copied { color: #4ade80; border-color: #4ade80; }

/* --- Install Command ---------------------------------------- */
.install-cmd {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0C0C0E;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #d4d4d8;
}

.install-cmd .prompt {
  color: var(--accent);
  user-select: none;
}

.install-cmd .cmd-text { flex: 1; }

.install-cmd .copy-btn {
  flex-shrink: 0;
}

/* --- Props / Parameters Table ------------------------------- */
.props-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 13px;
}

.props-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.props-table tbody td {
  padding: 10px 12px;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.props-table tbody tr:last-child td {
  border-bottom: none;
}

.props-table .prop-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: #c4b5fd;
  white-space: nowrap;
}

.props-table .prop-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #6ee7b7;
  white-space: nowrap;
}

.props-table .prop-default {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--fg-subtle);
}

.props-table .prop-required {
  color: #f87171;
  font-size: 11px;
  font-weight: 600;
}

/* --- Cards / Callouts --------------------------------------- */
.callout {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.6;
  display: flex;
  gap: 10px;
}

.callout-info {
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}

.callout-warn {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.15);
  color: #fcd34d;
}

.callout-tip {
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.15);
  color: #86efac;
}

.callout-icon {
  flex-shrink: 0;
  font-size: 15px;
  line-height: 1.5;
}

/* --- Feature Grid (homepage) -------------------------------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.feature-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
}
.feature-card:hover {
  border-color: #3f3f46;
}

.feature-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 18px;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 6px;
}

.feature-card p {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.5;
}

/* --- Component Grid (homepage) ------------------------------ */
.component-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 48px;
}

.component-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: all 0.15s;
}
.component-chip:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: var(--accent-muted);
}
.component-chip .chip-icon {
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.5;
}

/* --- Hero Section (homepage) -------------------------------- */
.hero {
  padding: 80px 0 60px;
  text-align: left;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--accent-muted);
  border: 1px solid rgba(129, 140, 248, 0.2);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  color: var(--fg);
  margin-bottom: 16px;
}

.hero h1 .gradient {
  background: linear-gradient(135deg, #818CF8, #c084fc, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .tagline {
  font-size: 18px;
  color: var(--fg-muted);
  max-width: 540px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.hero-btns {
  display: flex;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
}
.btn-primary:hover {
  background: #e4e4e7;
  color: var(--bg);
}

.btn-secondary {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  color: var(--fg);
  border-color: #3f3f46;
  background: rgba(255,255,255,0.03);
}

/* --- Steps -------------------------------------------------- */
.steps {
  counter-reset: step;
  margin-bottom: 24px;
}

.step {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 1px solid rgba(129, 140, 248, 0.2);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-content { flex: 1; padding-top: 2px; }

.step-content h4 {
  margin-top: 0;
  margin-bottom: 6px;
}

.step-content p {
  font-size: 13px;
}

/* --- Divider ------------------------------------------------ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* --- Footer ------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 12px;
}

.site-footer a {
  color: var(--fg-muted);
}
.site-footer a:hover { color: var(--fg); }

/* --- Breadcrumb --------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-subtle);
  margin-bottom: 24px;
}

.breadcrumb a {
  color: var(--fg-subtle);
}
.breadcrumb a:hover { color: var(--fg-muted); }

.breadcrumb .sep {
  color: var(--border);
  font-size: 11px;
}

/* --- Color Swatch ------------------------------------------- */
.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.color-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.color-swatch .swatch {
  width: 24px; height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.color-swatch .swatch-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--fg-muted);
}

/* --- Component Preview Placeholder -------------------------- */
.preview-placeholder {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--fg-subtle);
  margin-bottom: 24px;
  font-size: 13px;
}

.preview-placeholder .preview-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.3;
}

/* (Homepage/layout overrides moved to data-layout system above) */

/* --- Responsive --------------------------------------------- */
@media (max-width: 1200px) {
  .toc { display: none; }
  [data-layout="docs"] .main-content { margin-right: 0; }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    background: var(--bg);
    z-index: 90;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 80;
  }
  .sidebar-overlay.open {
    display: block;
  }
  [data-layout="docs"] .main-content {
    margin-left: 0;
    padding: 28px 20px 60px;
  }
  .mobile-toggle { display: block; }
  .header-nav { display: none; }

  .feature-grid { grid-template-columns: 1fr; }
  .component-grid { grid-template-columns: repeat(2, 1fr); }

  .hero h1 { font-size: 36px; }
  .hero .tagline { font-size: 16px; }
}

@media (max-width: 480px) {
  .component-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .hero-btns { flex-direction: column; }
  .homepage-container { padding: 0 20px; }
}

/* --- Prism.js Overrides (One Dark style) -------------------- */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #636c83; }

.token.punctuation { color: #9ca3af; }

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol { color: #f0abfc; }

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin { color: #86efac; }

.token.operator,
.token.entity,
.token.url { color: #93c5fd; }

.token.atrule,
.token.attr-value,
.token.keyword { color: #818CF8; }

.token.function,
.token.class-name { color: #fcd34d; }

.token.regex,
.token.important,
.token.variable { color: #f97316; }

/* --- Nav / Prev-Next ---------------------------------------- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.page-nav a {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  flex: 1;
  transition: all 0.15s;
}
.page-nav a:hover {
  border-color: #3f3f46;
  background: rgba(255,255,255,0.015);
}

.page-nav .nav-label {
  font-size: 11px;
  color: var(--fg-subtle);
  margin-bottom: 2px;
}

.page-nav .nav-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.page-nav .nav-next {
  text-align: right;
}

/* --- Tag badges --------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.tag-required {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.tag-optional {
  background: rgba(161, 161, 170, 0.1);
  color: var(--fg-subtle);
  border: 1px solid rgba(161, 161, 170, 0.15);
}

/* --- Dependency list ---------------------------------------- */
.dep-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.dep-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--fg-muted);
}

.dep-chip .dep-icon {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* --- Component Previews ------------------------------------ */
.component-preview {
  background: #0C0C0E;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.preview-frame {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 14px;
}

/* Demo bubble styles */
.demo-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
}

.demo-bubble-user {
  align-self: flex-end;
  background: #6366F1;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.demo-bubble-assistant {
  align-self: flex-start;
  background: #1E1E22;
  color: #d4d4d8;
  border-bottom-left-radius: 4px;
}

.demo-bubble-system {
  align-self: center;
  background: transparent;
  border: 1px dashed #3f3f46;
  color: #71717A;
  font-size: 12px;
  max-width: 90%;
}

/* Demo typing dots */
.demo-typing {
  align-self: flex-start;
  background: #1E1E22;
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
}

.demo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #71717A;
  animation: demo-bounce 1.2s infinite;
}

.demo-dot:nth-child(2) { animation-delay: 0.2s; }
.demo-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes demo-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Demo input bar */
.demo-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 12px;
}

.demo-input-field {
  flex: 1;
  color: #71717A;
  font-size: 14px;
}

.demo-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #6366F1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Demo tool call */
.demo-tool-call {
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 10px;
  overflow: hidden;
  max-width: 85%;
  align-self: flex-start;
}

.demo-tool-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #27272A;
  font-size: 12px;
  color: #A1A1AA;
}

.demo-tool-body {
  padding: 10px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #86efac;
  white-space: pre;
}

.demo-tool-result {
  padding: 8px 12px;
  border-top: 1px solid #27272A;
  font-size: 12px;
  color: #d4d4d8;
}

/* Demo code block */
.demo-code-block {
  background: #0C0C0E;
  border: 1px solid #27272A;
  border-radius: 10px;
  overflow: hidden;
  max-width: 90%;
  align-self: flex-start;
}

.demo-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid #27272A;
  font-size: 11px;
  color: #71717A;
}

.demo-code-body {
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #d4d4d8;
  line-height: 1.6;
  overflow-x: auto;
}

/* Demo thinking indicator */
.demo-thinking {
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 10px;
  overflow: hidden;
  max-width: 85%;
  align-self: flex-start;
}

.demo-thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #A1A1AA;
  cursor: pointer;
}

.demo-thinking-body {
  padding: 0 12px 10px;
  font-size: 12px;
  color: #71717A;
  font-style: italic;
  line-height: 1.5;
}

/* Demo citation */
.demo-citation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.15);
  border-radius: 6px;
  font-size: 12px;
  color: #818CF8;
  cursor: pointer;
}

/* Demo image preview */
.demo-image-preview {
  width: 160px;
  height: 120px;
  border-radius: 10px;
  background: linear-gradient(135deg, #27272A 0%, #18181B 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717A;
  font-size: 24px;
  align-self: flex-start;
}

/* Demo conversation list */
.demo-conversation-list {
  background: #111113;
  border: 1px solid #27272A;
  border-radius: 10px;
  overflow: hidden;
}

.demo-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #1F1F23;
  transition: background 0.1s;
}

.demo-conv-item:last-child { border-bottom: none; }
.demo-conv-item.selected { background: rgba(129, 140, 248, 0.08); }

.demo-conv-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #27272A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #71717A;
  flex-shrink: 0;
}

.demo-conv-text {
  flex: 1;
  min-width: 0;
}

.demo-conv-title {
  font-size: 13px;
  font-weight: 500;
  color: #FAFAFA;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-conv-preview {
  font-size: 12px;
  color: #71717A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-conv-time {
  font-size: 11px;
  color: #52525B;
  flex-shrink: 0;
}

/* Demo model selector */
.demo-model-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 8px;
  font-size: 13px;
  color: #FAFAFA;
  cursor: pointer;
}

.demo-model-selector .chevron {
  color: #71717A;
  font-size: 10px;
}

/* Demo token usage */
.demo-token-usage {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 10px;
  font-size: 13px;
  color: #A1A1AA;
}

.demo-token-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.demo-token-value {
  color: #FAFAFA;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Streaming cursor animation */
.demo-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: #818CF8;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: demo-blink 1s infinite;
}

@keyframes demo-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Preview label */
.preview-label {
  padding: 6px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Homepage Redesign — hp- prefixed
   ============================================================ */

/* --- Hero --------------------------------------------------- */
.hp-hero {
  padding: 100px 0 40px;
  text-align: center;
}

.hp-title {
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--fg);
  margin-bottom: 16px;
  background: linear-gradient(135deg, #FAFAFA 40%, #818CF8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hp-tagline {
  font-size: 18px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 32px;
  font-weight: 400;
}

.hp-hero-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* --- Live Demo Phone Frame ---------------------------------- */
.hp-demo-section {
  display: flex;
  justify-content: center;
  padding: 48px 0 56px;
}

.hp-phone-frame {
  width: 380px;
  background: #111113;
  border: 1px solid #27272A;
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 20px 60px rgba(0,0,0,0.5),
    0 4px 16px rgba(0,0,0,0.3);
  position: relative;
}

.hp-phone-notch {
  width: 120px;
  height: 6px;
  background: #27272A;
  border-radius: 3px;
  margin: 10px auto 0;
}

.hp-chat-app {
  display: flex;
  flex-direction: column;
  height: 520px;
}

/* Chat header */
.hp-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #1F1F23;
}

.hp-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hp-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366F1, #818CF8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.hp-chat-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.hp-chat-model {
  font-size: 11px;
  color: var(--fg-subtle);
  line-height: 1.3;
}

.hp-chat-header-dots {
  display: flex;
  gap: 3px;
}

.hp-chat-header-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--fg-subtle);
}

/* Chat messages */
.hp-chat-messages {
  flex: 1;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.hp-msg {
  display: flex;
}

.hp-msg-user {
  justify-content: flex-end;
}

.hp-msg-assistant {
  justify-content: flex-start;
}

.hp-msg-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
}

.hp-msg-bubble-user {
  background: #6366F1;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.hp-msg-bubble-assistant {
  background: #1A1A1E;
  color: #d4d4d8;
  border-bottom-left-radius: 4px;
}

/* Blinking cursor */
.hp-cursor {
  display: inline-block;
  width: 2px;
  height: 15px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: hp-blink 1s step-end infinite;
}

@keyframes hp-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Typing indicator */
.hp-typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: #1A1A1E;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.hp-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #52525B;
  animation: hp-bounce 1.4s ease-in-out infinite;
}

.hp-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.hp-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes hp-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat input */
.hp-chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 20px;
  border-top: 1px solid #1F1F23;
}

.hp-chat-input-field {
  flex: 1;
  padding: 10px 14px;
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 10px;
  font-size: 13px;
  color: #52525B;
}

.hp-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #6366F1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

/* --- Three-line Pitch --------------------------------------- */
.hp-pitch {
  text-align: center;
  padding: 0 0 56px;
}

.hp-pitch p {
  font-size: 14px;
  color: var(--fg-subtle);
  line-height: 2.2;
  margin: 0;
}

/* --- Install Terminal ---------------------------------------- */
.hp-install {
  padding: 0 0 64px;
  display: flex;
  justify-content: center;
}

.hp-terminal {
  width: 100%;
  max-width: 520px;
  background: #0C0C0E;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.hp-terminal-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.hp-terminal-dots {
  display: flex;
  gap: 6px;
}

.hp-tdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.hp-tdot-r { background: #ef4444; opacity: 0.7; }
.hp-tdot-y { background: #eab308; opacity: 0.7; }
.hp-tdot-g { background: #22c55e; opacity: 0.7; }

.hp-terminal-title {
  font-size: 12px;
  color: var(--fg-subtle);
  flex: 1;
  text-align: center;
}

.hp-terminal-spacer {
  width: 48px;
}

.hp-terminal-body {
  padding: 16px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 2;
}

.hp-terminal-line {
  color: #d4d4d8;
}

.hp-t-prompt {
  color: var(--accent);
  user-select: none;
  margin-right: 8px;
}

/* --- Component Showcase ------------------------------------- */
.hp-showcase {
  padding: 0 0 80px;
}

.hp-showcase-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.hp-showcase-tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-subtle);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.hp-showcase-tab:hover {
  color: var(--fg-muted);
}

.hp-showcase-tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.hp-showcase-panels {
  background: #0C0C0E;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
}

.hp-showcase-panel {
  display: none;
}

.hp-showcase-panel.active {
  display: block;
}

.hp-showcase-demo {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
}

/* Showcase demo bubbles */
.hp-demo-msg {
  display: flex;
}

.hp-demo-msg-user {
  justify-content: flex-end;
}

.hp-demo-msg-ai {
  justify-content: flex-start;
}

.hp-demo-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
}

.hp-demo-bubble-user {
  background: #6366F1;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.hp-demo-bubble-ai {
  background: #1A1A1E;
  color: #d4d4d8;
  border-bottom-left-radius: 4px;
}

/* Tool call card */
.hp-demo-toolcall {
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 10px;
  overflow: hidden;
  max-width: 90%;
}

.hp-toolcall-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #27272A;
}

.hp-toolcall-icon {
  color: var(--fg-muted);
  display: flex;
}

.hp-toolcall-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--fg);
  font-weight: 500;
}

.hp-toolcall-status {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

.hp-toolcall-done {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
}

.hp-toolcall-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hp-toolcall-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hp-toolcall-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.hp-toolcall-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #d4d4d8;
  background: none;
  border: none;
  padding: 0;
}

/* Thinking indicator */
.hp-demo-thinking {
  background: #18181B;
  border: 1px solid #27272A;
  border-radius: 10px;
  overflow: hidden;
  max-width: 90%;
}

.hp-thinking-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--fg-muted);
}

.hp-thinking-header svg {
  color: var(--fg-subtle);
  flex-shrink: 0;
}

.hp-thinking-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--fg-subtle);
  cursor: pointer;
  display: flex;
  padding: 2px;
}

.hp-thinking-content {
  padding: 0 14px 14px;
  border-top: 1px solid #27272A;
  padding-top: 12px;
}

.hp-thinking-content p {
  font-size: 12.5px;
  color: var(--fg-subtle);
  line-height: 1.6;
  margin: 0;
  font-style: italic;
}

.hp-thinking-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  background: rgba(129, 140, 248, 0.08);
  color: #c4b5fd;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(129, 140, 248, 0.12);
}

/* Streaming code block */
.hp-demo-codeblock {
  background: #0F0F12;
  border: 1px solid #27272A;
  border-radius: 10px;
  overflow: hidden;
  max-width: 90%;
}

.hp-demo-codeblock-header {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid #27272A;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-subtle);
}

.hp-demo-codeblock pre {
  margin: 0 !important;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

.hp-demo-codeblock pre code {
  display: block;
  padding: 14px !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 12px !important;
  line-height: 1.65 !important;
  color: #d4d4d8 !important;
  background: none !important;
  border: none !important;
}

/* --- Footer ------------------------------------------------- */
.hp-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  text-align: center;
  font-size: 12px;
  color: var(--fg-subtle);
}

.hp-footer a {
  color: var(--fg-muted);
}

.hp-footer a:hover {
  color: var(--fg);
}

.hp-footer-sep {
  margin: 0 8px;
  color: var(--border);
}

/* --- Homepage responsive ------------------------------------ */
@media (max-width: 860px) {
  .hp-hero { padding: 72px 0 32px; }
  .hp-title { font-size: 52px; letter-spacing: -2px; }
  .hp-tagline { font-size: 16px; }

  .hp-phone-frame { width: 340px; }
  .hp-chat-app { height: 460px; }

  .hp-showcase-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .hp-showcase-tab {
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .hp-hero { padding: 56px 0 24px; }
  .hp-title { font-size: 40px; letter-spacing: -1.5px; }
  .hp-tagline { font-size: 15px; }
  .hp-hero-btns { flex-direction: column; align-items: center; }

  .hp-phone-frame { width: 100%; max-width: 340px; }
  .hp-chat-app { height: 420px; }
  .hp-msg-bubble { font-size: 13px; }
  .hp-chat-messages { padding: 12px 14px; }

  .hp-pitch p { font-size: 13px; }

  .hp-terminal-body { padding: 14px 16px; font-size: 12px; }

  .hp-showcase-demo { padding: 20px 16px; }
  .hp-demo-bubble { font-size: 13px; }
}
