/* ────────────────────────────────────────────────────────────────────────
   CORTEX MANAGER — Design tokens (v2 — cyan/púrpura futurista)
   Per uploads/cortex_web_project.md briefing.
   Replaces the amber/industrial tokens used by the backend portal.html;
   the OLD palette is preserved in legacy_tokens.css for reference.
   ──────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* ── Surfaces — deep navy → near-black gradient stack ───────────────── */
  --bg-deep:        #04060f;   /* near-black, full-bleed */
  --bg-base:        #07091a;   /* page background */
  --bg-panel:       #0c102a;   /* sidebars, headers */
  --bg-card:        #11163a;   /* cards, inputs */
  --bg-card-hi:    #161c4a;   /* hover state */
  --bg-elevated:    #1a2158;   /* dropdowns, popovers */

  /* Hero / section radial-gradient anchors */
  --grad-navy-top:    #0a0e2a;
  --grad-navy-bottom: #04060f;
  --grad-cyan-glow:    rgba(0, 229, 255, 0.18);
  --grad-purple-glow:  rgba(139, 92, 246, 0.16);

  /* ── Borders (cool, slightly chromatic) ──────────────────────────────── */
  --border:         #1c2347;
  --border-bright:  #2a3568;
  --border-cyan:    rgba(0, 229, 255, 0.30);
  --border-purple:  rgba(139, 92, 246, 0.28);

  /* ── Text ─────────────────────────────────────────────────────────────── */
  --text-primary:   #f1f4ff;
  --text-secondary: #c5cce5;
  --text-dim:       #8b94b8;
  --text-muted:     #5a6390;
  --text-faint:     #3a4170;

  /* ── Brand accents (cyan = primary, purple = secondary) ─────────────── */
  --cyan:           #00e5ff;
  --cyan-soft:      #5feaff;
  --cyan-deep:      #0096a8;
  --cyan-glow:      rgba(0, 229, 255, 0.45);
  --cyan-veil:      rgba(0, 229, 255, 0.10);

  --purple:         #8b5cf6;
  --purple-soft:    #a78bfa;
  --purple-deep:    #5b21b6;
  --purple-glow:    rgba(139, 92, 246, 0.42);
  --purple-veil:    rgba(139, 92, 246, 0.10);

  /* The brand gradient — cyan → purple, on a dark bed */
  --brand-grad:     linear-gradient(135deg, #00e5ff 0%, #7b5cff 50%, #8b5cf6 100%); /* @kind color */
  --brand-grad-soft: linear-gradient(135deg, rgba(0,229,255,0.12), rgba(139, 92, 246, 0.12)); /* @kind color */

  /* ── Semantic (portal status colors) ─────────────────────────────────── */
  --ok:             #4ade80;   /* online / healthy / safe */
  --ok-glow:        rgba(74, 222, 128, 0.45);
  --ok-veil:        rgba(74, 222, 128, 0.08);

  --warn:           #ffb547;   /* warning / buffering / pending */
  --warn-glow:      rgba(255, 181, 71, 0.42);
  --warn-veil:      rgba(255, 181, 71, 0.10);

  --danger:         #ff3b5c;   /* critical / offline / intrusion */
  --danger-glow:    rgba(255, 59, 92, 0.50);
  --danger-veil:    rgba(255, 59, 92, 0.10);

  --info:           #5b9dff;   /* info / data / tracklets */
  --info-veil:      rgba(91, 157, 255, 0.10);

  /* ── H-service identity colors (used in the "5 percepciones" section) ─ */
  --h1-visual:        #00e5ff;   /* cyan — eyes (primary brand) */
  --h2-acoustic:      #66f0d4;   /* mint — ears */
  --h3-electromag:    #b388ff;   /* lavender — invisible signal */
  --h4-kinetic:       #ff7ed4;   /* pink — touch / vibration */
  --h5-environmental: #ffb547;   /* amber — atmosphere */

  /* ── Visual texture ──────────────────────────────────────────────────── */
  --grid-line:      rgba(255, 255, 255, 0.025);
  --noise-veil:     rgba(255, 255, 255, 0.012);

  /* ── Typography ──────────────────────────────────────────────────────── */
  --font-display:  'Space Grotesk', 'Inter Tight', system-ui, sans-serif;
  --font-sans:     'Space Grotesk', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Type scale (futurista — generous H, compact body) */
  --fs-10:  10px;     /* micro labels */
  --fs-11:  11px;     /* badges, tags */
  --fs-12:  12px;     /* meta, captions */
  --fs-13:  13px;     /* small body */
  --fs-14:  14px;     /* body */
  --fs-15:  15px;     /* body lg */
  --fs-16:  16px;     /* lead */
  --fs-18:  18px;     /* H5 / button-lg */
  --fs-20:  20px;     /* H4 */
  --fs-24:  24px;     /* H3 small */
  --fs-32:  32px;     /* H3 */
  --fs-44:  44px;     /* H2 */
  --fs-60:  60px;     /* H1 / hero subhead */
  --fs-88:  88px;     /* hero display */
  --fs-120: 120px;    /* mega display */

  /* Tracking — display tight, micro labels wide */
  --ls-tighter: -0.025em;
  --ls-tight:   -0.012em;
  --ls-normal:   0;          /* @kind font */
  --ls-wide:     0.04em;
  --ls-wider:    0.08em;
  --ls-widest:   0.16em;

  /* ── Spacing scale (4px base, generous for marketing) ───────────────── */
  --s-1:   4px;
  --s-2:   8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-8:  32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;
  --s-32: 128px;
  --s-40: 160px;

  /* ── Radii ──────────────────────────────────────────────────────────── */
  --r-sm:  4px;
  --r:     8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-2xl: 32px;
  --r-pill: 999px;

  /* ── Shadows + glows ────────────────────────────────────────────────── */
  --shadow-card:   0 1px 0 rgba(255,255,255,0.04) inset,
                   0 4px 16px rgba(0, 8, 32, 0.45);
  --shadow-pop:    0 20px 60px rgba(0, 4, 24, 0.55);
  --shadow-modal:  0 40px 100px rgba(0, 4, 24, 0.75);

  --glow-cyan:     0 0 24px var(--cyan-glow);
  --glow-cyan-sm:  0 0 8px rgba(0, 229, 255, 0.55);
  --glow-purple:   0 0 24px var(--purple-glow);
  --glow-brand:    0 0 32px rgba(0, 229, 255, 0.30),
                   0 0 64px rgba(139, 92, 246, 0.20);

  --glow-ok:       0 0 10px var(--ok-glow);
  --glow-warn:     0 0 10px var(--warn-glow);
  --glow-danger:   0 0 10px var(--danger-glow);

  /* ── Motion ─────────────────────────────────────────────────────────── */
  --t-fast:   120ms;                           /* @kind other */
  --t-base:   240ms;                           /* @kind other */
  --t-slow:   480ms;                           /* @kind other */
  --t-slower: 800ms;                           /* @kind other */
  --ease:     cubic-bezier(0.2, 0.65, 0.2, 1); /* @kind other */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);   /* @kind other */
  --ease-in:  cubic-bezier(0.7, 0, 0.84, 0);   /* @kind other */
}

/* ────────────────────────────────────────────────────────────────────────
   BASE — element defaults. Apply via tags + utility classes.
   ──────────────────────────────────────────────────────────────────────── */

html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
  text-wrap: balance;
}
h1 { font-size: clamp(var(--fs-44), 7vw, var(--fs-88)); font-weight: 700; letter-spacing: var(--ls-tighter); }
h2 { font-size: clamp(var(--fs-32), 4.4vw, var(--fs-60)); font-weight: 700; letter-spacing: var(--ls-tighter); }
h3 { font-size: var(--fs-32); font-weight: 700; }
h4 { font-size: var(--fs-24); font-weight: 600; }
h5 { font-size: var(--fs-18); font-weight: 600; }
h6 { font-size: var(--fs-12); font-weight: 600; letter-spacing: var(--ls-widest); text-transform: uppercase; color: var(--text-dim); }

p {
  font-family: var(--font-sans);
  font-size: var(--fs-15);
  color: var(--text-secondary);
  line-height: 1.65;
  text-wrap: pretty;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color var(--t-fast), text-shadow var(--t-fast);
}
a:hover { color: var(--cyan-soft); text-shadow: var(--glow-cyan-sm); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  color: var(--cyan);
}
pre {
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s-4);
  overflow-x: auto;
  line-height: 1.6;
  color: var(--text-primary);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s-12) 0;
}

::selection {
  background: var(--cyan);
  color: #000;
}

/* Scrollbars (subtle, brand-tinted) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ────────────────────────────────────────────────────────────────────────
   UTILITIES — small, reusable
   ──────────────────────────────────────────────────────────────────────── */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--cyan);
}
.eyebrow::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--cyan);
  box-shadow: var(--glow-cyan-sm);
}

.text-grad {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.glow-text-cyan   { color: var(--cyan); text-shadow: var(--glow-cyan-sm); }
.glow-text-purple { color: var(--purple); text-shadow: 0 0 8px var(--purple-glow); }

/* Grid texture overlay (use as fixed full-bleed bg) */
.grid-bg {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* Radial brand glow — use behind hero / section headers */
.brand-glow-bg {
  position: relative;
  isolation: isolate;
}
.brand-glow-bg::before {
  content: '';
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(40% 50% at 25% 30%, var(--grad-cyan-glow), transparent 70%),
    radial-gradient(45% 55% at 80% 70%, var(--grad-purple-glow), transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(40px);
}
