/* ============================================================================
   css/base.css — Sistema de diseño KOGNITIA (v2, luminoso)
   Tokens + componentes usados por TODAS las páginas. Cada demo sobreescribe
   los tokens de color en su propio <style> para ser "un mundo diferente"
   sin duplicar CSS. Diseño claro, colorido y premium.
   ============================================================================ */

/* ── Tipografía ── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ── Tokens (tema claro por defecto — la marca KOGNITIA) ── */
:root {
  --bg:        #f7f8fc;   /* fondo de página */
  --bg-soft:   #eef1f8;   /* secciones alternas */
  --bg-card:   #ffffff;   /* tarjetas y chat */
  --surface:   #f1f4fa;   /* rellenos suaves (burbujas, inputs) */
  --line:      #e2e7f0;   /* bordes */
  --text:      #16203a;   /* tinta principal */
  --text-dim:  #5b6780;   /* tinta secundaria */
  --accent:    #0aa678;   /* esmeralda Kognitia */
  --accent-2:  #ff9d3d;   /* ámbar cálido */
  --accent-3:  #6c8bff;   /* azul acento de apoyo (gradientes) */
  --accent-ink:#ffffff;   /* texto sobre --accent */
  --radius:    18px;
  --radius-sm: 12px;
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --shadow-lift: 0 22px 48px -20px rgba(22, 32, 58, .22);
  --maxw: 1160px;
}

/* ── Reset básico ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -.02em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
section { padding: 88px 0; position: relative; }
@media (max-width: 640px) { section { padding: 60px 0; } }

/* ── Utilidades de texto ── */
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.kicker::before { content: ""; width: 26px; height: 2px; background: var(--accent); border-radius: 2px; }
.h-xl { font-size: clamp(2.1rem, 5.4vw, 3.6rem); font-weight: 800; }
.h-lg { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-weight: 700; }
.h-md { font-size: clamp(1.2rem, 2.2vw, 1.5rem); font-weight: 700; }
.lead { font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--text-dim); max-width: 640px; }
.grad-text {
  background: linear-gradient(96deg, var(--accent), var(--accent-3) 55%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 28px; border-radius: 999px;
  font-weight: 600; font-size: 15.5px; line-height: 1;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, background .25s, color .25s, border-color .25s;
  will-change: transform;
}
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--accent) 55%, transparent);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 18px 38px -10px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn-ghost {
  border: 1.5px solid var(--line); color: var(--text);
  background: var(--bg-card);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-sm { padding: 11px 20px; font-size: 14px; }

/* ── Navegación ── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 90;
  transition: background .3s, border-color .3s, backdrop-filter .3s, box-shadow .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  backdrop-filter: blur(14px);
  border-color: var(--line);
  box-shadow: 0 6px 24px -18px rgba(22,32,58,.25);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.nav-logo { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.nav-logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.75); opacity: .6; } }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14.5px; font-weight: 500; }
.nav-links a { color: var(--text-dim); transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-burger { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-burger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: .3s; }
@media (max-width: 860px) {
  .nav-links {
    position: fixed; inset: 72px 0 auto 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 40px -24px rgba(22,32,58,.3);
    max-height: 0; overflow: hidden; transition: max-height .35s ease;
  }
  .nav-links.open { max-height: 420px; }
  .nav-links a { padding: 16px 24px; width: 100%; border-top: 1px solid var(--line); }
  .nav-links .btn { margin: 16px 24px; }
  .nav-burger { display: flex; }
  .nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-burger.open span:nth-child(2) { opacity: 0; }
  .nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ── Tarjetas ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), border-color .35s, box-shadow .35s;
}
.card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-lift); }

/* ── Reveal on scroll (activado por js/main.js) ── */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: .08s; } .reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; } .reveal-d4 { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .01ms !important; }
}

/* ── Fondo decorativo (aurora de color) ── */
.aurora { position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.aurora::before, .aurora::after {
  content: ""; position: absolute; width: 58vmax; height: 58vmax; border-radius: 50%;
  filter: blur(90px); opacity: .22;
}
.aurora::before { background: var(--accent); top: -28vmax; right: -16vmax; animation: drift 16s ease-in-out infinite alternate; }
.aurora::after { background: var(--accent-2); bottom: -32vmax; left: -18vmax; opacity: .18; animation: drift 20s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(6vmax, 4vmax) scale(1.12); } }

/* ── Chips / etiquetas ── */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-card);
  font-size: 13.5px; font-weight: 500; color: var(--text-dim);
  transition: border-color .25s, color .25s, transform .25s, box-shadow .25s;
}
.chip:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); box-shadow: 0 8px 18px -12px color-mix(in srgb, var(--accent) 50%, transparent); }

/* ══════════════════════════════════════════════════════════════════════════
   WIDGET DE CHAT (compartido por las 5 demos y el mock del home)
   ══════════════════════════════════════════════════════════════════════════ */
.chat-shell {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column;
  height: 560px; max-height: 78vh;
}
.chat-head {
  display: flex; align-items: center; gap: 13px;
  padding: 16px 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--bg-card)), var(--bg-card));
  border-bottom: 1px solid var(--line);
}
.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 20px;
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.chat-head-info { min-width: 0; }
.chat-head-name { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; }
.chat-head-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.chat-head-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.chat-live-tag {
  margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  padding: 5px 11px; border-radius: 999px; text-transform: uppercase;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-card));
}
.chat-body {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.msg {
  max-width: 82%; padding: 12px 16px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: break-word;
  animation: msg-in .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes msg-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.msg-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg-user {
  align-self: flex-end; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 75%, var(--accent-3)));
  border: 0; border-bottom-right-radius: 6px;
}
.msg-note { align-self: center; font-size: 12.5px; color: var(--text-dim); background: none; border: 0; text-align: center; padding: 4px 10px; }
.msg .src {
  display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--text-dim);
}
.msg .src a { color: var(--accent); font-weight: 600; }
.typing { display: inline-flex; gap: 5px; padding: 14px 18px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: ty 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ty { 0%,60%,100% { transform: none; opacity: .4; } 30% { transform: translateY(-6px); opacity: 1; } }
.chat-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 12px; }
.chat-chips .chip { font-size: 12.5px; padding: 7px 13px; cursor: pointer; }
.chat-input-row {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--line); background: var(--bg-soft);
}
.chat-input-row input {
  flex: 1; background: var(--bg-card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 13px 20px; color: var(--text);
  font: inherit; font-size: 14.5px; outline: none; transition: border-color .25s;
}
.chat-input-row input:focus { border-color: var(--accent); }
.chat-input-row input::placeholder { color: var(--text-dim); }
.chat-send {
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  transition: transform .2s, box-shadow .2s;
}
.chat-send:hover { transform: scale(1.08); box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.chat-send:disabled { opacity: .45; transform: none; box-shadow: none; cursor: default; }
.chat-send svg { width: 19px; height: 19px; }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 44px 0 34px;
  color: var(--text-dim); font-size: 14px;
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; align-items: flex-start; }
.footer a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-note { margin-top: 22px; font-size: 12.5px; opacity: .8; }

/* ── Banda marquee (nichos) ── */
.marquee { overflow: hidden; border-block: 1px solid var(--line); padding: 18px 0; background: var(--bg-card); }
.marquee-track { display: flex; gap: 46px; width: max-content; animation: marquee 26s linear infinite; }
.marquee-track span { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text-dim); display: flex; align-items: center; gap: 46px; white-space: nowrap; }
.marquee-track span::after { content: "•"; color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }
