/* ===== BASE ===== */
:root {
  --color-ink: #0F172A;
  --color-paper: #FAFBFC;
  --color-accent: #3B82F6;
  --color-success: #10B981;
  --color-danger: #EF4444;
  --color-warning: #F59E0B;
  --color-ipm: #FDB714;
}

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; }

/* ===== HERO BG (soft dot pattern + gradient mesh) ===== */
.hero-bg {
  background-image:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(253, 183, 20, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
}
.hero-bg::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
}

/* Floating hero bubbles (micro-simulation background) */
.hero-bubble {
  position: absolute;
  bottom: -60px;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  opacity: 0;
  animation: bubbleFloat linear forwards;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-bubble[data-side="user"] {
  background: rgba(59, 130, 246, 0.09);
  color: rgba(59, 130, 246, 0.7);
  border-bottom-right-radius: 4px;
}
.hero-bubble[data-side="bot"] {
  background: rgba(148, 163, 184, 0.09);
  color: rgba(71, 85, 105, 0.7);
  border-bottom-left-radius: 4px;
}
@keyframes bubbleFloat {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.55; }
  90%  { opacity: 0.55; }
  100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}

/* ===== SECTIONS ===== */
.section {
  position: relative;
  scroll-snap-align: start;
  padding-top: 5rem;
  padding-bottom: 4rem;
}
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}
.section-heading {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.section-lead {
  font-size: 1.125rem;
  color: #475569;
  max-width: 42rem;
  line-height: 1.6;
}

/* ===== DOT NAV ===== */
.dot-nav-item {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}
.dot-nav-item:hover { background: #94a3b8; transform: scale(1.4); }
.dot-nav-item.active {
  background: var(--color-accent);
  height: 24px;
  border-radius: 999px;
}
.dot-nav-item .tooltip {
  position: absolute;
  left: 20px; top: 50%;
  transform: translateY(-50%);
  background: var(--color-ink);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.dot-nav-item:hover .tooltip { opacity: 1; }

/* ===== CARDS ===== */
.card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s;
}
.card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.card-flat {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--color-ink);
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-primary:hover { background: #1e293b; }

.btn-ghost {
  background: white;
  color: var(--color-ink);
  border: 1px solid #cbd5e1;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-ghost:hover { border-color: #94a3b8; background: #f8fafc; }

/* ===== KBD ===== */
kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: white;
}

/* ===== PILLS ===== */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.pill-blue { background: #eff6ff; color: #1d4ed8; }
.pill-green { background: #ecfdf5; color: #047857; }
.pill-amber { background: #fffbeb; color: #b45309; }
.pill-red { background: #fef2f2; color: #b91c1c; }
.pill-slate { background: #f1f5f9; color: #475569; }

/* ===== CHAT UI ===== */
.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: msgIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-msg-user {
  background: var(--color-accent);
  color: white;
  border-bottom-right-radius: 6px;
  margin-left: auto;
}
.chat-msg-bot {
  background: #f1f5f9;
  color: var(--color-ink);
  border-bottom-left-radius: 6px;
}
.chat-msg-crisis {
  background: #fef2f2;
  color: #7f1d1d;
  border: 1px solid #fecaca;
  border-bottom-left-radius: 6px;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typing indicator */
.typing-dots { display: inline-flex; gap: 3px; align-items: center; padding: 4px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #94a3b8;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Phone frame */
.phone-frame {
  width: 320px;
  height: 640px;
  border: 10px solid #1e293b;
  border-radius: 40px;
  background: white;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
}
.phone-notch {
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100px; height: 22px;
  background: #1e293b;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  z-index: 10;
}
.phone-screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: #f8fafc;
  padding-top: 22px; /* accommodate notch so header doesn't overlap */
  box-sizing: border-box;
}

/* Code / log panel */
.log-panel {
  background: #0F172A;
  color: #cbd5e1;
  border-radius: 12px;
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  overflow: auto;
  max-height: 400px;
}
.log-line { display: block; }
.log-line .log-time { color: #64748b; }
.log-line .log-info { color: #60a5fa; }
.log-line .log-warn { color: #fbbf24; }
.log-line .log-error { color: #f87171; }
.log-line .log-ok { color: #34d399; }

/* Model toggle */
.model-toggle.active { background: white; color: var(--color-ink); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.model-toggle:not(.active) { color: #94a3b8; }

/* ===== SVG DIAGRAM ===== */
.flow-node {
  transition: all 0.3s;
  cursor: pointer;
}
.flow-node.active rect,
.flow-node.active circle {
  filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.6));
}
.flow-node:hover rect { stroke: var(--color-accent); }
.flow-edge {
  stroke-dasharray: 6 6;
  stroke-dashoffset: 0;
  fill: none;
}
.flow-edge.active {
  animation: flowDash 1s linear infinite;
  stroke: var(--color-accent);
  stroke-width: 2.5;
}
@keyframes flowDash {
  to { stroke-dashoffset: -12; }
}

/* Data packet on wire */
.data-packet {
  fill: #3B82F6;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.8));
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== UTILITY ===== */
.blur-name { filter: blur(4px); user-select: none; }
.gradient-text { background: linear-gradient(135deg, #3B82F6, #6366f1); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .section { padding-top: 4rem; padding-bottom: 3rem; }
  #dot-nav { display: none; }
}
