/* =============================================
   KNOW YOUR TOPIC — MARKETING SITE STYLES
   ============================================= */

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

:root {
  --bg:           #0f1017;
  --bg-alt:       #13141c;
  --surface:      #1a1c27;
  --surface-2:    #20222f;
  --border:       #2a2d3e;
  --border-2:     #363a50;
  --primary:      #6366f1;
  --primary-h:    #7c7ff5;
  --primary-dim:  rgba(99,102,241,0.12);
  --primary-glow: rgba(99,102,241,0.25);
  --text:         #e8eaf2;
  --text-2:       #9096b4;
  --text-3:       #5c6180;
  --green:        #22c55e;
  --amber:        #f59e0b;
  --red:          #ef4444;
  --chat-bg:      #111318;
  --chat-header:  #2563eb;
  --chat-user:    #3b82f6;
  --radius:       0.625rem;
  --radius-lg:    1rem;
  --radius-xl:    1.5rem;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --nav-h:        64px;
  --t:            0.2s ease;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); overflow-x: hidden; max-width: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; max-width: 100%; }
a { color: inherit; text-decoration: none; }
pre, code { font-family: 'SF Mono','Fira Code','Cascadia Code',Consolas,monospace; }
code { font-size: .875em; color: var(--primary-h); background: var(--primary-dim); padding: .1em .35em; border-radius: 4px; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* --- BUTTONS --- */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: var(--radius); font-weight: 500; font-size: .9375rem; cursor: pointer; transition: all var(--t); border: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; padding: 10px 20px; }
.btn-primary:hover { background: var(--primary-h); transform: translateY(-1px); box-shadow: 0 8px 24px var(--primary-glow); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-2); padding: 10px 20px; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim); }
.btn-lg { padding: 13px 26px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 7px 14px; font-size: .875rem; }

/* --- NAV --- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--nav-h); backdrop-filter: blur(20px); background: rgba(15,16,23,.8); border-bottom: 1px solid transparent; transition: border-color var(--t), background var(--t); }
.nav.scrolled { border-bottom-color: var(--border); background: rgba(15,16,23,.95); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1rem; transition: color var(--t); }
.nav-logo:hover { color: var(--primary-h); }
.logo-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--primary); border-radius: 8px; color: #fff; flex-shrink: 0; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a:not(.btn) { color: var(--text-2); font-size: .9375rem; font-weight: 450; transition: color var(--t); }
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text-2); border-radius: 2px; transition: all var(--t); }
.nav-mobile { display: none; flex-direction: column; gap: 4px; padding: 12px 24px 16px; background: rgba(15,16,23,.98); border-bottom: 1px solid var(--border); }
.nav-mobile a:not(.btn) { padding: 10px 0; color: var(--text-2); font-size: 1rem; border-bottom: 1px solid var(--border); }
.nav-mobile.open { display: flex; }

/* --- HERO --- */
.hero { position: relative; padding: calc(var(--nav-h) + 80px) 0 100px; overflow: hidden; text-align: center; }
.hero-bg-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(99,102,241,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(99,102,241,.04) 1px,transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse 80% 60% at 50% 0%,black 40%,transparent 100%); pointer-events: none; }
.hero-glow { position: absolute; top: -20%; left: 50%; transform: translateX(-50%); width: 700px; height: 400px; background: radial-gradient(ellipse,var(--primary-glow) 0%,transparent 70%); pointer-events: none; }
.hero-title { font-size: clamp(2.5rem,6vw,4.25rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 14px; background: linear-gradient(135deg,var(--text) 30%,var(--primary-h) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-tagline { font-size: clamp(.875rem,1.5vw,1rem); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: 20px; }
.hero-description { font-size: clamp(1rem,2vw,1.2rem); color: var(--text-2); max-width: 600px; margin: 0 auto 40px; line-height: 1.7; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 64px; }
.hero-stats { display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px 40px; max-width: 640px; margin: 0 auto; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 0 28px; }
.stat-num { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; }
.stat-label { font-size: .8125rem; color: var(--text-3); margin-top: 2px; }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* --- TICKER --- */
.ticker-section { overflow: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-alt); padding: 16px 0; }
.ticker-track { display: flex; animation: ticker 30s linear infinite; width: max-content; }
.ticker-item { display: flex; align-items: center; gap: 10px; padding: 8px 32px; color: var(--text-2); font-size: .9rem; font-weight: 500; white-space: nowrap; border-right: 1px solid var(--border); }
.ticker-detail { font-size: .8rem; color: var(--text-3); }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* --- SECTIONS --- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); }
.section-header { text-align: center; max-width: 640px; margin: 0 auto 64px; }
.section-label { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: 12px; }
.section-title { font-size: clamp(1.75rem,4vw,2.5rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; color: var(--text); margin-bottom: 16px; }
.section-subtitle { color: var(--text-2); font-size: 1.0625rem; line-height: 1.65; }

/* --- FEATURES GRID --- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(300px,1fr)); gap: 20px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; transition: border-color var(--t),transform var(--t),box-shadow var(--t); position: relative; overflow: hidden; }
.feature-card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 50% at 50% -10%,var(--primary-dim),transparent); opacity: 0; transition: opacity var(--t); }
.feature-card:hover { border-color: var(--border-2); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.feature-card:hover::before { opacity: 1; }
.feature-icon { font-size: 1.75rem; margin-bottom: 16px; display: block; }
.feature-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 10px; }
.feature-desc { font-size: .9375rem; color: var(--text-2); line-height: 1.65; }

/* =============================================
   PORTAL PREVIEW
   ============================================= */
.preview-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.preview-tab { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .875rem; font-weight: 500; font-family: var(--font); padding: 8px 18px; border-radius: 100px; cursor: pointer; transition: all var(--t); }
.preview-tab:hover { border-color: var(--border-2); color: var(--text); }
.preview-tab.active { background: var(--primary-dim); border-color: var(--primary); color: var(--primary-h); }
.browser-frame { border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; box-shadow: 0 32px 80px rgba(0,0,0,.5),0 0 0 1px rgba(255,255,255,.03); }
.browser-bar { display: flex; align-items: center; gap: 10px; background: #111218; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.browser-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.browser-dot.red { background: #ff5f57; } .browser-dot.yellow { background: #febc2e; } .browser-dot.green { background: #28c840; }
.browser-url { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; margin: 0 auto; width: 340px; color: var(--text-3); font-size: .8rem; font-family: 'SF Mono',Consolas,monospace; }
.app-shell { display: flex; height: 520px; background: var(--bg); overflow: hidden; }
.mock-sidebar { width: 200px; min-width: 200px; background: #0d0e14; border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 0; font-size: .8rem; overflow: hidden; }
.mock-sidebar-logo { display: flex; align-items: center; gap: 8px; padding: 0 14px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .8rem; color: var(--text); margin-bottom: 8px; }
.mock-logo-icon { width: 24px; height: 24px; background: var(--primary); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.mock-sidebar-section { display: flex; justify-content: space-between; align-items: center; padding: 6px 14px; font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.mock-plus { color: var(--text-3); font-size: 1rem; }
.mock-sidebar-item { display: flex; align-items: center; gap: 8px; padding: 7px 14px; color: var(--text-2); font-size: .8rem; cursor: pointer; transition: background var(--t),color var(--t); }
.mock-sidebar-item:hover { background: var(--surface); color: var(--text); }
.mock-sidebar-item.active { background: var(--primary-dim); color: var(--primary-h); }
.mock-sidebar-bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 8px; }
.mock-main { flex: 1; overflow-y: auto; padding: 24px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.mock-main::-webkit-scrollbar { width: 4px; } .mock-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Shared mock elements */
.mock-page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.mock-page-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.mock-page-desc { font-size: .78rem; color: var(--text-3); }
.mock-btn { display: inline-flex; align-items: center; gap: 5px; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 500; padding: 6px 12px; border-radius: 6px; font-family: var(--font); cursor: pointer; }
.mock-badge { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 500; padding: 2px 8px; border-radius: 100px; }
.mock-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.mock-badge.done    { background: rgba(34,197,94,.12);  color: #22c55e; } .mock-badge.done::before    { background: #22c55e; }
.mock-badge.pending { background: rgba(245,158,11,.12); color: #f59e0b; } .mock-badge.pending::before { background: #f59e0b; }
.mock-badge.processing { background: rgba(99,102,241,.15); color: var(--primary-h); } .mock-badge.processing::before { background: var(--primary); animation: pulse 1.5s infinite; }
.mock-badge.failed  { background: rgba(239,68,68,.12);  color: #ef4444; } .mock-badge.failed::before  { background: #ef4444; }
.mock-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.mock-tab { font-size: .8rem; font-weight: 500; padding: 8px 16px; color: var(--text-3); border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.mock-tab.active { color: var(--text); border-bottom-color: var(--primary); }
.mock-topic-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; cursor: pointer; transition: border-color var(--t); }
.mock-topic-card:hover { border-color: var(--border-2); }
.mock-topic-card.active-card { border-color: var(--primary); background: var(--primary-dim); }
.mock-topics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mock-topic-name { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.mock-topic-slug { font-size: .72rem; color: var(--text-3); font-family: 'SF Mono',monospace; margin-bottom: 10px; }
.mock-topic-meta { display: flex; align-items: center; justify-content: space-between; }
.mock-topic-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.mock-tag { font-size: .65rem; padding: 2px 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 100px; color: var(--text-3); }
.mock-topic-updated { font-size: .68rem; color: var(--text-3); }
.mock-source-list { display: flex; flex-direction: column; gap: 8px; }
.mock-source-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.mock-source-icon { width: 28px; height: 28px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.mock-source-info { flex: 1; min-width: 0; }
.mock-source-name { font-size: .82rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-source-url  { font-size: .7rem; color: var(--text-3); font-family: 'SF Mono',monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-source-type { font-size: .68rem; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 100px; white-space: nowrap; }
.mock-add-source-banner { display: flex; align-items: center; justify-content: space-between; background: rgba(99,102,241,.08); border: 1px solid rgba(99,102,241,.25); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: .78rem; color: var(--primary-h); }
.mock-process-summary { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 20px; }
.mock-stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; text-align: center; }
.mock-stat-card .num { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.mock-stat-card .lbl { font-size: .7rem; color: var(--text-3); margin-top: 2px; }
.mock-stat-card.green .num { color: var(--green); } .mock-stat-card.amber .num { color: var(--amber); } .mock-stat-card.red .num { color: var(--red); } .mock-stat-card.indigo .num { color: var(--primary-h); }
.mock-process-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; background: var(--primary); color: #fff; font-size: .85rem; font-weight: 600; padding: 11px; border-radius: 8px; margin-bottom: 20px; font-family: var(--font); cursor: pointer; }
.mock-pipeline-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .8rem; }
.mock-pipeline-row:last-child { border-bottom: none; }
.mock-pipeline-name { flex: 1; color: var(--text-2); }
.mock-pipeline-reset { font-size: .7rem; color: var(--text-3); padding: 2px 8px; border: 1px solid var(--border); border-radius: 5px; }
.mock-key-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.mock-key-name { font-size: .82rem; font-weight: 600; color: var(--text); flex: 1; }
.mock-key-value { font-size: .73rem; font-family: 'SF Mono',monospace; color: var(--text-3); background: var(--surface-2); padding: 2px 8px; border-radius: 5px; }
.mock-key-meta { font-size: .7rem; color: var(--text-3); }
.mock-key-delete { color: var(--red); font-size: .7rem; opacity: .6; cursor: pointer; }
.mock-query-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-top: 14px; min-width: 0; overflow: hidden; }
.mock-query-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin-bottom: 8px; }
.mock-query-code { background: #0a0b10; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font-size: .72rem; font-family: 'SF Mono',Consolas,monospace; color: #c9d1d9; line-height: 1.6; white-space: pre; overflow-x: auto; max-width: 100%; display: block; }

/* =============================================
   NPM BADGE
   ============================================= */
.npm-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary-dim); color: var(--primary-h);
  font-size: .8125rem; font-weight: 600;
  padding: 7px 14px; border-radius: 8px;
  margin-top: 20px; transition: background var(--t), border-color var(--t), box-shadow var(--t);
  border: 1px solid rgba(99,102,241,.3);
  will-change: auto;
}
.npm-badge:hover { background: rgba(99,102,241,.22); border-color: var(--primary); box-shadow: 0 4px 16px var(--primary-glow); }
.npm-badge-inline { margin-top: 16px; display: flex; width: fit-content; }

/* =============================================
   CHAT WIDGET DEMO
   ============================================= */
/* Mobile-only elements hidden by default (shown via media query) */
.chat-mobile-trigger  { display: none; }
.chat-sheet-handle    { display: none; }
.chat-mobile-overlay  { display: none; }

.chat-demo-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

/* Left controls */
.chat-demo-controls { display: flex; flex-direction: column; gap: 28px; }
.chat-demo-group-label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }

.mode-toggle { display: flex; flex-direction: column; gap: 8px; }
.mode-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: .875rem; font-weight: 500;
  padding: 10px 14px; border-radius: var(--radius);
  cursor: pointer; transition: all var(--t); font-family: var(--font);
  text-align: left;
}
.mode-btn:hover { border-color: var(--border-2); color: var(--text); }
.mode-btn.active { background: var(--primary-dim); border-color: var(--primary); color: var(--primary-h); }

.prompt-chips { display: flex; flex-direction: column; gap: 8px; }
.prompt-chip {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: .8125rem; font-weight: 500;
  padding: 9px 14px; border-radius: var(--radius);
  cursor: pointer; transition: all var(--t); font-family: var(--font);
  text-align: left;
}
.prompt-chip:hover { border-color: var(--border-2); color: var(--text); }
.prompt-chip.active { background: var(--primary-dim); border-color: var(--primary); color: var(--primary-h); }

.source-type-indicator { display: flex; align-items: center; gap: 10px; }
.src-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 100px;
}
.src-badge.website  { background: rgba(59,130,246,.15); color: #60a5fa; }
.src-badge.video    { background: rgba(34,197,94,.15);  color: #4ade80; }
.src-badge.pdf      { background: rgba(239,68,68,.15);  color: #f87171; }
.src-badge.social   { background: rgba(167,139,250,.15);color: #c4b5fd; }
.src-indicator-desc { font-size: .78rem; color: var(--text-3); }

.chat-feature-list { display: flex; flex-direction: column; gap: 8px; }
.chat-feature { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--text-2); }
.chat-feature-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.chat-feature-dot.green  { background: var(--green); }
.chat-feature-dot.blue   { background: #60a5fa; }
.chat-feature-dot.red    { background: #f87171; }
.chat-feature-dot.purple { background: var(--primary-h); }

/* Right preview area */
.chat-demo-preview { position: relative; }

/* ---- BUBBLE MODE: page with widget ---- */
.chat-bubble-scene {
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.4);
  height: 600px; background: #1a1d2b; position: relative;
}
.fake-page { padding: 28px; height: 100%; overflow: hidden; }
.fake-page-bar { display: flex; align-items: center; gap: 6px; background: #13141c; border-radius: 8px; padding: 8px 14px; margin-bottom: 20px; }
.fake-page-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.fake-page-url { font-size: .72rem; color: var(--text-3); font-family: monospace; margin-left: 8px; }
.fake-page-content { display: flex; flex-direction: column; gap: 10px; }
.fake-line { height: 12px; background: var(--border); border-radius: 3px; }
.fake-heading { height: 20px; background: var(--surface-2); border-radius: 3px; width: 55%; }
.fake-line.w80 { width: 80%; } .fake-line.w65 { width: 65%; } .fake-line.w90 { width: 90%; }
.fake-line.w50 { width: 50%; } .fake-line.w70 { width: 70%; } .fake-line.w40 { width: 40%; }

/* The floating widget panel */
.chat-bubble-widget {
  position: absolute; bottom: 20px; right: 20px;
  width: 320px; display: flex; flex-direction: column;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.08);
  height: 520px;
}

/* ---- FULLSCREEN MODE ---- */
.chat-fullscreen-scene {
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.4);
  height: 600px; display: flex; flex-direction: column;
}
.chat-fullscreen-scene .chat-widget-inner { flex: 1; display: flex; flex-direction: column; }

/* ---- SHARED CHAT WIDGET INNER ---- */
.chat-widget-inner { background: var(--chat-bg); display: flex; flex-direction: column; height: 100%; }

.chat-header {
  background: var(--chat-header); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-title { font-weight: 700; font-size: .9375rem; color: #fff; }
.chat-header-right { display: flex; align-items: center; gap: 8px; }
.chat-live-badge { display: flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; color: rgba(255,255,255,.9); }
.chat-live-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; }
.chat-header-btn { width: 28px; height: 28px; background: rgba(255,255,255,.15); border: none; border-radius: 7px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #fff; }
.chat-header-btn:hover { background: rgba(255,255,255,.25); }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; scrollbar-color: #2a2d3e transparent; }
.chat-messages::-webkit-scrollbar { width: 4px; } .chat-messages::-webkit-scrollbar-thumb { background: #2a2d3e; border-radius: 2px; }

/* User message */
.chat-msg-user { display: flex; justify-content: flex-end; }
.chat-msg-user-bubble { background: var(--chat-user); color: #fff; padding: 10px 14px; border-radius: 18px 18px 4px 18px; font-size: .875rem; line-height: 1.5; max-width: 78%; }

/* AI message */
.chat-msg-ai { display: flex; gap: 10px; align-items: flex-start; }
.chat-avatar { width: 28px; height: 28px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: #fff; flex-shrink: 0; margin-top: 2px; }
.chat-msg-ai-content { flex: 1; min-width: 0; }
.chat-msg-ai-bubble { background: #1e2030; border: 1px solid #2a2d40; color: #d1d5e8; padding: 12px 14px; border-radius: 4px 18px 18px 18px; font-size: .875rem; line-height: 1.55; display: inline-block; max-width: 100%; }
.confidence-badge { display: inline-flex; align-items: center; font-size: .65rem; font-weight: 700; padding: 2px 7px; border-radius: 100px; margin-left: 6px; vertical-align: middle; letter-spacing: .04em; }
.confidence-badge.high   { background: rgba(34,197,94,.2);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.confidence-badge.medium { background: rgba(245,158,11,.2); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }

/* Sources */
.chat-sources { margin-top: 8px; }
.chat-sources-label { font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #5c6180; margin-bottom: 8px; }
.chat-source-card { background: #1a1c2a; border: 1px solid #252836; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.chat-source-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.chat-src-type { font-size: .65rem; font-weight: 700; padding: 3px 8px; border-radius: 100px; letter-spacing: .04em; }
.chat-src-type.video   { background: rgba(34,197,94,.2);  color: #4ade80; }
.chat-src-type.pdf     { background: rgba(239,68,68,.2);  color: #f87171; }
.chat-src-type.website { background: rgba(59,130,246,.2); color: #60a5fa; }
.chat-src-type.social  { background: rgba(167,139,250,.2);color: #c4b5fd; }
.chat-src-name { font-size: .8rem; font-weight: 600; color: #d1d5e8; }

/* Video player mock */
.chat-video-player { margin: 0 12px; background: #0a0a0f; border-radius: 6px; overflow: hidden; }
.chat-video-screen { height: 100px; background: linear-gradient(135deg,#0f1018 0%,#1a1c28 100%); display: flex; align-items: center; justify-content: center; position: relative; }
.chat-video-play { width: 32px; height: 32px; background: rgba(255,255,255,.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.chat-video-play svg { margin-left: 2px; }
.chat-video-bar { background: #0d0e14; padding: 7px 10px; display: flex; align-items: center; gap: 8px; }
.chat-video-time { font-size: .7rem; color: #9096b4; font-family: monospace; }
.chat-video-track { flex: 1; height: 3px; background: #2a2d3e; border-radius: 2px; position: relative; }
.chat-video-progress { position: absolute; left: 0; top: 0; height: 100%; width: 28%; background: var(--primary); border-radius: 2px; }
.chat-video-icons { display: flex; gap: 8px; color: #5c6180; }
.chat-video-icons svg { width: 14px; height: 14px; }

.chat-transcript { margin: 8px 12px 0; padding: 8px 10px; border-left: 2px solid var(--primary); background: rgba(99,102,241,.06); border-radius: 0 6px 6px 0; font-size: .75rem; color: #9096b4; line-height: 1.5; font-style: italic; }

/* Jump to section */
.chat-jump-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin: 8px 12px 12px; padding: 5px 12px;
  background: transparent; border: 1px solid rgba(59,130,246,.4);
  color: #60a5fa; font-size: .75rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; font-family: var(--font);
  transition: all var(--t);
}
.chat-jump-btn:hover { background: rgba(59,130,246,.1); border-color: #60a5fa; }

/* PDF excerpt */
.chat-pdf-excerpt { margin: 0 12px 0; padding: 10px; font-size: .78rem; color: #9096b4; line-height: 1.6; border-top: 1px solid #252836; }
.chat-pdf-actions { display: flex; gap: 8px; padding: 8px 12px 12px; }
.chat-pdf-page-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: #252836; border: 1px solid #363a50; color: #9096b4; font-size: .72rem; font-weight: 500; border-radius: 6px; cursor: pointer; font-family: var(--font); }
.chat-pdf-open-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: transparent; border: 1px solid rgba(99,102,241,.4); color: var(--primary-h); font-size: .72rem; font-weight: 500; border-radius: 6px; cursor: pointer; font-family: var(--font); transition: all var(--t); }
.chat-pdf-open-btn:hover { background: var(--primary-dim); }

/* Website source */
.chat-web-excerpt { padding: 8px 12px; font-size: .78rem; color: #9096b4; line-height: 1.55; border-top: 1px solid #252836; font-style: italic; }
.chat-web-link { display: flex; align-items: center; gap: 6px; padding: 8px 12px 12px; font-size: .78rem; color: #60a5fa; cursor: pointer; }
.chat-web-link svg { opacity: .7; }

/* Social post cards */
.chat-social-card { background: #0f1018; border: 1px solid #252836; border-radius: 8px; padding: 10px 12px; margin: 0 12px 8px; }
.chat-social-platform { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.chat-social-icon { width: 18px; height: 18px; border-radius: 4px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-social-icon.x    { background: #000; }
.chat-social-icon.ig   { background: linear-gradient(135deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); }
.chat-social-platform-name { font-size: .7rem; font-weight: 700; color: #9096b4; letter-spacing: .04em; }
.chat-social-handle { font-size: .7rem; color: #5c6180; }
.chat-social-text { font-size: .78rem; color: #c9d1d9; line-height: 1.5; margin-bottom: 8px; }
.chat-social-view-btn { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-family: var(--font); transition: all var(--t); border: none; }
.chat-social-view-btn.x  { background: rgba(0,0,0,.4); color: #e2e8f0; border: 1px solid #2a2d40; }
.chat-social-view-btn.x:hover { background: #000; }
.chat-social-view-btn.ig { background: rgba(220,39,67,.12); color: #f472b6; border: 1px solid rgba(220,39,67,.25); }
.chat-social-view-btn.ig:hover { background: rgba(220,39,67,.22); }

/* Chat input */
.chat-input-bar { padding: 12px; border-top: 1px solid #1e2030; flex-shrink: 0; }
.chat-input-inner { display: flex; align-items: center; gap: 8px; background: #1a1c2a; border: 1px solid #2a2d40; border-radius: 100px; padding: 8px 8px 8px 16px; }
.chat-input-inner input { flex: 1; background: none; border: none; outline: none; color: #d1d5e8; font-size: .875rem; font-family: var(--font); }
.chat-input-inner input::placeholder { color: #5c6180; }
.chat-send-btn { width: 30px; height: 30px; background: var(--chat-user); border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background var(--t); }
.chat-send-btn:hover { background: #2563eb; }

/* Typing animation */
.chat-typing { display: flex; align-items: center; gap: 4px; padding: 10px 14px; background: #1e2030; border: 1px solid #2a2d40; border-radius: 4px 18px 18px 18px; width: fit-content; }
.typing-dot { width: 6px; height: 6px; background: #5c6180; border-radius: 50%; animation: typing-bounce .8s infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

/* =============================================
   USE CASES
   ============================================= */
.usecases-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(300px,1fr)); gap: 20px; }
.usecase-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; transition: border-color var(--t),transform var(--t),box-shadow var(--t);
  position: relative; overflow: hidden;
}
.usecase-card:hover { border-color: var(--border-2); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.usecase-icon-wrap { width: 48px; height: 48px; background: var(--primary-dim); border: 1px solid rgba(99,102,241,.2); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 16px; }
.usecase-subtitle { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 6px; }
.usecase-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 10px; }
.usecase-desc { font-size: .9375rem; color: var(--text-2); line-height: 1.65; margin-bottom: 14px; }
.usecase-example { font-size: .8125rem; color: var(--text-3); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-style: italic; }

/* --- STEPS --- */
.steps { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 24px; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 28px; }
.step-number { font-size: 4rem; font-weight: 800; line-height: 1; margin-bottom: 20px; letter-spacing: -.05em; background: linear-gradient(135deg,var(--primary-dim),transparent); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.step-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 10px; }
.step-desc  { font-size: .9375rem; color: var(--text-2); line-height: 1.65; }

/* --- API SECTION --- */
.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
/* min-width: 0 lets the grid item shrink below its min-content size (needed for pre/code blocks) */
.api-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; min-width: 0; overflow: hidden; }
.api-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.api-card-icon { font-size: 1.5rem; }
.api-card h3 { font-size: 1.125rem; font-weight: 600; }
.api-card > p { color: var(--text-2); font-size: .9375rem; line-height: 1.65; margin-bottom: 20px; }
.code-block { background: #0a0b10; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.code-header { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg); }
.code-dot { width: 10px; height: 10px; border-radius: 50%; }
.code-lang { margin-left: auto; margin-right: 8px; font-size: .75rem; font-weight: 600; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }
.copy-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: .75rem; font-family: var(--font); padding: 3px 10px; border-radius: 5px; cursor: pointer; transition: all var(--t); }
.copy-btn:hover { background: var(--border); color: var(--text); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }
.code-block pre { padding: 16px; font-size: .8125rem; line-height: 1.7; color: #c9d1d9; overflow-x: auto; white-space: pre; max-width: 100%; display: block; }

/* --- TECH STACK --- */
.tech-pills { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 800px; margin: 0 auto; }
.tech-pill { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .9375rem; font-weight: 500; padding: 10px 20px; border-radius: 100px; transition: all var(--t); cursor: default; }
.tech-pill:hover { border-color: var(--primary); color: var(--primary-h); background: var(--primary-dim); transform: translateY(-2px); }

/* --- CTA --- */
.cta-section { background: var(--bg); }
.cta-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 72px 48px; text-align: center; overflow: hidden; }
.cta-glow { position: absolute; top: -60%; left: 50%; transform: translateX(-50%); width: 600px; height: 400px; background: radial-gradient(ellipse,rgba(99,102,241,.15) 0%,transparent 70%); pointer-events: none; }
.cta-card h2 { font-size: clamp(1.75rem,4vw,2.5rem); font-weight: 700; letter-spacing: -.025em; margin-bottom: 16px; position: relative; }
.cta-card p  { color: var(--text-2); font-size: 1.0625rem; max-width: 480px; margin: 0 auto 36px; line-height: 1.65; position: relative; }
.cta-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; position: relative; }

/* --- FOOTER --- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9375rem; }
.footer-credit { font-size: .875rem; color: var(--text-3); }

/* --- SCROLL ANIMATIONS --- */
@keyframes pulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.5; transform:scale(.8); } }
.fade-up { opacity: 0; transform: translateY(24px); transition: opacity .55s ease, transform .55s ease; }
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ==============================================
   RESPONSIVE
   Desktop styles untouched above.
   Mobile gets purpose-built layouts for complex
   interactive sections (portal preview, chat demo).
   ============================================== */

/* ── Tablet (≤ 900px) ── */
@media (max-width: 900px) {
  .chat-demo-layout { grid-template-columns: 1fr; }
  .chat-bubble-widget { width: 300px; height: 480px; }
  .mock-sidebar { width: 160px; min-width: 160px; }
  .mock-topics-grid { grid-template-columns: 1fr; }
  .mock-process-summary { grid-template-columns: repeat(2,1fr); }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  .container { padding: 0 18px; max-width: 100%; }

  /* Section spacing */
  .section { padding: 64px 0; }
  .section-header { margin-bottom: 40px; }

  /* Nav */
  .nav-inner { padding: 0 18px; }
  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  /* Hero */
  .hero { padding: calc(var(--nav-h) + 60px) 0 72px; }
  /* Constrain glow so it can't push layout wider than viewport */
  .hero-glow { width: 100%; max-width: 100%; }
  /* Full-width CTA buttons on mobile */
  .hero-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .hero-actions .btn { justify-content: center; }
  .hero-stats { padding: 20px; }
  .stat { padding: 0 12px; }

  /* Grids → single column */
  .features-grid,
  .usecases-grid,
  .steps,
  .api-grid { grid-template-columns: 1fr; }

  /* ── Portal Preview ──
     Strip the browser chrome — mock content
     becomes a clean contained card. */
  .browser-frame { border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,.4); }
  .browser-bar { display: none; }
  .app-shell { height: auto; min-height: 360px; display: block; overflow: hidden; }
  .mock-sidebar { display: none; }
  .mock-main { flex: none; width: 100%; padding: 18px; height: auto; overflow: hidden; }
  .mock-topics-grid { grid-template-columns: 1fr; }
  .mock-process-summary { grid-template-columns: repeat(2,1fr); gap: 8px; }
  /* Contain pre-formatted code blocks */
  .mock-query-box { overflow: hidden; }
  .mock-query-code { max-width: 100%; overflow-x: auto; }

  /* ── Chat Demo ──
     Show only the widget; controls move to a
     bottom sheet opened by a button. */
  .chat-demo-layout { display: block; }

  /* Widget scenes */
  .chat-bubble-scene,
  .chat-fullscreen-scene { height: 500px; }

  /* ── Bubble mode: page context visible at top, widget rises from bottom ── */
  .chat-bubble-scene .fake-page {
    display: block;
    padding: 14px;
    height: 100%;
    overflow: hidden;
  }
  .chat-bubble-scene .fake-page-bar { margin-bottom: 14px; }
  /* Add a subtle glow to the fake page so it looks like a real app is behind */
  .chat-bubble-scene .fake-page::after {
    content: '';
    position: absolute;
    top: 10%; left: 50%;
    transform: translateX(-50%);
    width: 160px; height: 100px;
    background: radial-gradient(ellipse, rgba(99,102,241,.18) 0%, transparent 70%);
    pointer-events: none;
  }
  .chat-bubble-scene .fake-page-content { opacity: 0.45; }

  /* Widget anchored to bottom, ~76% tall — matches real floating widget behavior */
  .chat-bubble-widget {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 76%;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
  }

  /* ── Fullscreen mode: widget fills edge-to-edge, no fake page ── */
  .chat-fullscreen-scene { overflow: hidden; }
  .chat-fullscreen-scene .chat-widget-inner { height: 100%; }

  /* ── "Try different prompts" trigger button ── */
  .chat-mobile-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: .9rem;
    font-weight: 500;
    padding: 13px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font);
    transition: border-color var(--t), color var(--t), background var(--t);
  }
  .chat-mobile-trigger:hover {
    border-color: var(--primary);
    color: var(--primary-h);
    background: var(--primary-dim);
  }

  /* ── Controls → fixed bottom sheet ── */
  .chat-demo-controls {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 400;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 0 20px 28px;
    max-height: 82vh;
    overflow-y: auto;
    /* Slide in from below */
    transform: translateY(100%);
    transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .chat-demo-controls.mobile-open {
    transform: translateY(0);
  }

  /* Sheet drag handle + header */
  .chat-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0 4px;
    position: relative;
    flex-shrink: 0;
  }
  .chat-sheet-pill {
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 4px;
    background: var(--border-2);
    border-radius: 2px;
  }
  .chat-sheet-title {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text);
  }
  .chat-sheet-close {
    width: 30px; height: 30px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-2);
    transition: background var(--t), color var(--t);
  }
  .chat-sheet-close:hover { background: var(--border); color: var(--text); }

  /* ── Overlay behind sheet ── */
  .chat-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 399;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  .chat-mobile-overlay.open { display: block; }

  /* CTA + footer */
  .cta-card { padding: 48px 24px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ── Small mobile (≤ 480px) ── */
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .section { padding: 52px 0; }
  .section-header { margin-bottom: 32px; }

  /* Hero stats: tight row → 2×2 grid */
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    max-width: 100%;
  }
  .stat { padding: 8px 0; }
  .stat-divider { display: none; }

  /* Portal tabs */
  .preview-tabs { gap: 6px; }
  .preview-tab { font-size: .78rem; padding: 6px 10px; }

  /* Chat widget height */
  .chat-bubble-scene,
  .chat-fullscreen-scene { height: 470px; }

  /* Mode buttons side by side inside sheet */
  .mode-toggle { flex-direction: row; }
  .mode-btn { flex: 1; justify-content: center; font-size: .82rem; padding: 9px 10px; }

  /* Prompt chips: 2-per-row in sheet */
  .prompt-chips { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .prompt-chip { flex: 1 1 calc(50% - 3px); min-width: 0; text-align: center; font-size: .8rem; }

  /* Cards */
  .feature-card, .usecase-card { padding: 20px 16px; }
  .step-card { padding: 24px 18px; }
  .api-card { padding: 22px 16px; }

  /* Code blocks */
  .code-block pre { font-size: .75rem; padding: 12px; }

  /* CTA */
  .cta-card { padding: 36px 14px; }
}
