/* EP-ONB (BR-ONB-18b) — shell del cliente según docs/Technera_UX_Experiencia_Onboarding.md
   Cabina nocturna: el color es escaso y por eso SIGNIFICA (§4.1). Sin rojo en todo el flujo.
   3 voces (§4.2): Space Grotesk = lo que importa · JetBrains Mono = verdad técnica · Inter = humano. */

@font-face { font-family: 'Space Grotesk'; font-weight: 500; font-display: swap;
  src: url('/static/fonts/sg-500.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap;
  src: url('/static/fonts/sg-700.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap;
  src: url('/static/fonts/jbm-400.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-display: swap;
  src: url('/static/fonts/jbm-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap;
  src: url('/static/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap;
  src: url('/static/fonts/inter-600.woff2') format('woff2'); }

:root {
  /* §4.1 — semántica FIJA. Romperla confunde el lenguaje que el cliente aprende. */
  --bg: #0B1116;            /* cabina nocturna */
  --card: #101924; --line: #1d2935; --txt: #e9eef4; --dim: #8da0b5;
  --accent: #FF6A2B;        /* NARANJA: el sistema actuando · hallazgo · acción primaria */
  --ok: #3DD68C;            /* VERDE: evidencia · voz del cliente final · completado */
  --amber: #E8C35B;         /* ÁMBAR: oportunidad detectada (el Hueco) */
  --cyan: #5BC8E8;          /* CYAN: cartografía y datos de mercado */
  --warn: var(--amber);     /* sin rojo en el onboarding (§9): atención = ámbar */
  --err: var(--dim);        /* errores hablan en lenguaje y estructura, no en alarma */
  --display: 'Space Grotesk', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --body: 'Inter', -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--txt); font: 15px/1.55 var(--body); }

/* barrido radar ambiental (§5.2): la cabina respira, no urge. ≤5% opacidad. */
body::before { content: ''; position: fixed; inset: -50%; pointer-events: none; z-index: 0;
  background: conic-gradient(from 0deg, transparent 0 86%, rgba(91,200,232,.05) 93%, transparent 100%);
  animation: radar 7s linear infinite; }
#onb-top, #app, #newchip { position: relative; z-index: 1; }
@keyframes radar { to { transform: rotate(360deg); } }

#onb-top { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: rgba(11,17,22,.92); backdrop-filter: blur(6px); z-index: 5; }
.onb-brand { font-family: var(--display); font-weight: 700; letter-spacing: 3px; font-size: 14px; }
#app { max-width: 760px; margin: 0 auto; padding: 18px 16px 90px; }
h1 { font-family: var(--display); font-weight: 700; font-size: 27px; line-height: 1.22; margin-bottom: 10px; }
h2 { font-family: var(--display); font-weight: 700; font-size: 19px; margin-bottom: 8px; }
.dim { color: var(--dim); font-size: 13px; }
.mono { font-family: var(--mono); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin: 12px 0; }
button.cta { width: 100%; padding: 14px; border: 0; border-radius: 10px;
  background: var(--accent); color: #16100b; font-family: var(--display); font-size: 16px;
  font-weight: 700; cursor: pointer; min-height: 48px; transition: transform .12s ease, filter .12s; }
button.cta:active { transform: scale(.985); }
button.cta:disabled { opacity: .4; cursor: default; }
button.ghost { background: none; border: 1px solid var(--line); color: var(--dim);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; font-family: var(--body); }
input[type="text"], input[type="url"], input[type="email"], input[type="tel"], textarea { width: 100%; padding: 13px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: #0c141c; color: var(--txt);
  font: 16px/1.5 var(--body); }
textarea { resize: vertical; margin-top: 6px; }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
/* error sin alarma cromática (§7): específico, sin culpa, con salida — y sin rojo */
.err-inline { color: var(--txt); font-size: 13px; margin-top: 8px; }
.err-inline:not(:empty)::before { content: '— '; color: var(--dim); }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 26px 14px;
  text-align: center; color: var(--dim); cursor: pointer; }
.drop.has-file { border-color: var(--ok); color: var(--txt); }
.center { text-align: center; }

/* ── Acto 0: hero ─────────────────────────────────────────────────────────── */
.hero-brand { font-family: var(--display); font-weight: 700; letter-spacing: 4px;
  font-size: 13px; color: var(--accent); margin: 14px 0 4px; }

/* ── Puente Acto 0→1 (HU-049): fija la promesa antes del show ─────────────── */
#bridge { position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; animation: brfade .4s ease; }
#bridge .btxt { font-family: var(--display); font-size: 19px; }
#bridge .bagents { display: flex; gap: 16px; }
#bridge .bag { display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; color: var(--dim); opacity: 0; animation: bagin .5s ease forwards; }
#bridge .bag span:first-child { font-size: 26px; }
#bridge .bag:nth-child(1) { animation-delay: .15s; } #bridge .bag:nth-child(2) { animation-delay: .45s; }
#bridge .bag:nth-child(3) { animation-delay: .75s; } #bridge .bag:nth-child(4) { animation-delay: 1.05s; }
@keyframes brfade { from { opacity: 0; } }
@keyframes bagin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Acto 1: sala de control ──────────────────────────────────────────────── */
/* dock de agentes (P4): presencia, no proceso */
.agdock { display: flex; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.ag { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 16px; padding: 4px 11px; transition: all .45s ease; }
.ag .agdot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: 0 0 auto; }
.ag.live { color: var(--txt); border-color: var(--agc, var(--accent)); }
.ag.live .agdot { background: var(--agc, var(--accent)); animation: agpulse 1.6s ease-in-out infinite; }
.ag.was .agdot { background: var(--ok); }
@keyframes agpulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--agc, var(--accent)) 25%, transparent); } }
.agline { font-family: var(--mono); font-size: 12px; color: var(--txt); min-height: 18px;
  margin: 2px 0 8px; }
.agline .agwho { color: var(--agc, var(--accent)); font-weight: 600; }
.phasetimer { font-size: 11px; color: var(--dim); margin: 0 0 6px; }

/* medidor de profundidad (HU-048, P3): el nivel dice qué tan hondo — el % cuánto falta */
.depth { display: flex; align-items: center; gap: 0; margin: 10px 0;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card); }
.depth .dlevel { flex: 1; text-align: center; font-family: var(--mono); font-size: 10px;
  color: var(--dim); padding: 4px 2px; border-bottom: 2px solid var(--line);
  white-space: nowrap; transition: all .5s ease; }
.depth .dlevel.past { color: var(--ok); border-bottom-color: var(--ok); }
.depth .dlevel.now { color: var(--accent); border-bottom-color: var(--accent);
  font-weight: 600; animation: dthresh .5s ease; }
@keyframes dthresh { 0% { transform: translateY(0); } 35% { transform: translateY(-3px); } 100% { transform: none; } }

/* gauges: verdad técnica en mono + anillo de avance */
.gauges { display: flex; gap: 8px; margin: 10px 0; align-items: stretch; }
.gauge { flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 6px; text-align: center; }
.gauge b { display: block; font-family: var(--mono); font-weight: 600; font-size: 20px; color: var(--cyan); }
.gauge span { font-size: 11px; color: var(--dim); }
.gauge.ring { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gauge.ring svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.gauge.ring circle { fill: none; stroke-width: 4; }
.gauge.ring .rbg { stroke: var(--line); }
.gauge.ring .rfg { stroke: var(--accent); stroke-linecap: round;
  transition: stroke-dashoffset .7s ease; }
.gauge.ring b { position: absolute; font-size: 11px; transform: translateY(15px); color: var(--txt); }

/* ruta de vuelo (rail): el conector se llena */
.rail { display: flex; gap: 0; overflow-x: auto; padding: 8px 0; align-items: center;
  -webkit-overflow-scrolling: touch; }
.rail .ph { flex: 0 0 auto; font-size: 11px; padding: 5px 10px; border-radius: 14px;
  border: 1px solid var(--line); color: var(--dim); white-space: nowrap; transition: all .5s ease; }
.rail .ph.done { border-color: var(--ok); color: var(--ok); }
.rail .ph.active { border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 9px rgba(255,106,43,.3); }
.rail .lk { flex: 0 0 14px; height: 1px; background: var(--line); transition: background .5s; }
.rail .lk.done { background: var(--ok); }

/* feed: los hallazgos ATERRIZAN con peso (spring ~12% overshoot, §5.2) */
#feed { margin-top: 8px; }
.logline { font: 12px/1.5 var(--mono); color: var(--dim); padding: 2px 0; word-break: break-word;
  transition: opacity .4s; }
.logline.old { opacity: .45; }
.logline.live::after { content: '▍'; color: var(--accent); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.fcard { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; margin: 8px 0; animation: nodeland .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes nodeland { 0% { opacity: 0; transform: translateY(14px) scale(.97); }
  70% { transform: translateY(-2px) scale(1.012); } 100% { opacity: 1; transform: none; } }
.fcard.jtbd { border-left-color: var(--ok); font-family: var(--display); font-style: italic;
  font-weight: 500; }                              /* la voz del cliente final: única en cursiva */
.fcard.stat .big { font-family: var(--mono); font-weight: 600; font-size: 26px; color: var(--cyan); }
.fcard.hypothesis { border-left-color: var(--ok); position: relative; }
.fcard.gap, .fcard.competitor { border-left-color: var(--amber); }
.fcard .ftitle { font-weight: 700; font-size: 13px; margin-bottom: 4px; font-family: var(--display); }
.fcard .ftag { display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: 10px;
  color: var(--dim); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; }
#newchip { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #16100b; border: 0; border-radius: 20px; font-weight: 700;
  padding: 8px 16px; font-size: 13px; display: none; z-index: 9; cursor: pointer; }

/* cristalización (§5.2): el ÚNICO "todo se enciende" — una vez, irrepetible */
.crystal .fcard, .crystal .rail .ph, .crystal .gauge, .crystal .ag, .crystal .depth .dlevel {
  animation: cwave .9s ease 1; }
.crystal .fcard:nth-child(odd) { animation-delay: .05s; }
.crystal .fcard:nth-child(even) { animation-delay: .12s; }
@keyframes cwave { 35% { border-color: var(--ok); box-shadow: 0 0 14px rgba(61,214,140,.35); } }
.crystal-msg { text-align: center; font-family: var(--display); font-weight: 700; font-size: 20px;
  color: var(--ok); margin: 16px 0; animation: nodeland .6s cubic-bezier(.2,1.4,.4,1); }

/* ── Acto 2: síntesis — reveal en secuencia (200ms stagger) ───────────────── */
.sblock { position: relative; opacity: 0; animation: nodeland .55s cubic-bezier(.2,1.4,.4,1) forwards; }
.sblock:nth-of-type(1) { animation-delay: .05s; } .sblock:nth-of-type(2) { animation-delay: .25s; }
.sblock:nth-of-type(3) { animation-delay: .45s; } .sblock:nth-of-type(4) { animation-delay: .65s; }
.sblock .flagbtn { position: absolute; top: 12px; right: 12px; }
.sblock.flagged { border-color: var(--amber); }
.synbadges { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 2px; }
.synbadge { font-family: var(--mono); font-size: 11px; color: var(--txt);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px 10px; }
.synbadge b { color: var(--cyan); font-weight: 600; }
.synbadge.lvl b { color: var(--accent); }
.jtbd-q { font-family: var(--display); font-style: italic; font-weight: 500; color: var(--txt);
  border-left: 3px solid var(--ok); padding-left: 10px; margin: 8px 0; }
.hyp-row { display: flex; gap: 8px; align-items: baseline; padding: 6px 0;
  border-bottom: 1px dashed var(--line); font-size: 14px; }
.hyp-angle { font-family: var(--mono); font-size: 10px; color: var(--ok);
  border: 1px solid rgba(61,214,140,.4); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.stars { display: flex; gap: 6px; margin-top: 8px; }
.stars button { font-size: 22px; background: none; border: 0; cursor: pointer;
  color: var(--line); min-width: 44px; min-height: 44px; }
.stars button.on { color: var(--amber); }
.pendiente { color: var(--amber); font-size: 13px; }
.demo-badge { background: #32290e; color: var(--amber); font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 10px; }

/* ── Cabina (BR-ONB-12) ───────────────────────────────────────────────────── */
.mrail { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: 10px 0; }
.mnode { flex: 0 0 auto; font-size: 12px; padding: 5px 10px; border-radius: 14px;
  border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.mnode.done { border-color: var(--ok); color: var(--ok); animation: mcheck .4s cubic-bezier(.2,1.6,.4,1); }
.mnode.active { border-color: var(--accent); color: var(--accent); }
@keyframes mcheck { 40% { transform: scale(1.12); } }
.mlink { flex: 0 0 12px; height: 1px; background: var(--line); }
.ctabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line);
  margin: 4px 0 14px; overflow-x: auto; }
.ctab { background: none; border: 0; color: var(--dim); padding: 10px 12px;
  font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; min-height: 44px; font-family: var(--body); }
.ctab.on { color: var(--txt); border-bottom-color: var(--accent); font-weight: 700; }

/* M1: cartas de hipótesis con sello ELEGIDA */
.hypcard { cursor: pointer; position: relative; padding-right: 84px; transition: border-color .2s; }
.hypcard .hypcheck { position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%) rotate(8deg); font-family: var(--display); font-weight: 700;
  font-size: 10px; letter-spacing: 1px; color: transparent; border: 2px solid transparent;
  border-radius: 6px; padding: 3px 7px; }
.hypcard.on { border-color: var(--ok); }
.hypcard.on .hypcheck { color: var(--ok); border-color: var(--ok); animation: stamp .3s cubic-bezier(.2,1.8,.4,1); }
@keyframes stamp { 0% { transform: translateY(-50%) rotate(8deg) scale(1.7); opacity: 0; }
  100% { transform: translateY(-50%) rotate(8deg) scale(1); opacity: 1; } }
.m1-ej { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.m1-ej-btn { font-size: 12px; }
#m1-icp-chip { margin-top: 8px; border-color: var(--cyan); color: var(--cyan); }
#m1-go { position: sticky; bottom: 12px; }

/* M2: tus hipótesis convirtiéndose en producción (flip sutil, una vez) */
.slotrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0;
  border-bottom: 1px dashed var(--line); animation: slotflip .5s ease backwards; }
.slotrow:nth-child(1) { animation-delay: .05s; } .slotrow:nth-child(2) { animation-delay: .15s; }
.slotrow:nth-child(3) { animation-delay: .25s; } .slotrow:nth-child(4) { animation-delay: .35s; }
.slotrow .slot-ico { font-size: 20px; flex: 0 0 auto; }
@keyframes slotflip { from { opacity: 0; transform: rotateX(60deg); } to { opacity: 1; } }
.vcard video { width: 100%; border-radius: 8px; margin-top: 8px; background: #000; }
.vhead { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.vstat { margin-left: auto; font-family: var(--mono); font-size: 10px; padding: 2px 8px;
  border-radius: 10px; border: 1px solid var(--line); color: var(--dim); }
.vstat.done, .vstat.dry_run { border-color: var(--ok); color: var(--ok); }
.vstat.failed { border-color: var(--amber); color: var(--amber); }
.vstat.paused { border-color: var(--amber); color: var(--amber); }
.vstat.rendering { border-color: var(--accent); color: var(--accent); animation: agpulse 1.6s infinite; }
.vbtns { display: flex; gap: 8px; margin-top: 8px; }
.vap.on { border-color: var(--ok); color: var(--ok); }
.quote-big { text-align: center; font-family: var(--mono); font-size: 40px; font-weight: 600;
  color: var(--amber); margin: 8px 0; }
.quote-big span { font-size: 16px; color: var(--dim); }

/* M3: girar la llave — power switch + señal al aire */
.power { width: 112px; height: 112px; border-radius: 50%; border: 3px solid var(--accent);
  background: radial-gradient(circle at 50% 38%, #1a1208, var(--card)); color: var(--accent);
  font-size: 34px; cursor: pointer; display: block; margin: 18px auto 6px; position: relative;
  transition: transform .15s ease, box-shadow .3s; font-family: var(--display); }
.power:active { transform: scale(.94); }
.power:disabled { opacity: .4; cursor: default; }
.power small { display: block; font-size: 10px; letter-spacing: 2px; font-weight: 700; }
.power.firing::after { content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--ok); animation: ping 1s ease-out 1 forwards; }
@keyframes ping { from { transform: scale(1); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
.live-pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok); margin-right: 6px; animation: lpulse 1.8s ease-in-out infinite; }
@keyframes lpulse { 50% { box-shadow: 0 0 0 7px rgba(61,214,140,.18); } }

.frow { display: grid; grid-template-columns: 110px 1fr 36px; gap: 8px; align-items: center;
  padding: 5px 0; font-size: 13px; }
.frow .fbar { background: #0c141c; border-radius: 6px; height: 16px; overflow: hidden; }
.frow .fbar div { background: var(--accent); height: 100%; border-radius: 6px; }
.drrow, .warow { cursor: pointer; display: flex; justify-content: space-between; gap: 10px;
  padding: 12px 14px; }
.wamsg { max-width: 85%; padding: 8px 11px; border-radius: 10px; margin: 4px 0;
  font-size: 14px; background: #15212e; }
.wamsg.in { background: #16202c; }
.wamsg.out { margin-left: auto; background: #15301f; }

/* ── Tours + EJEMPLO (BR-ONB-13) ──────────────────────────────────────────── */
.coach { border-color: var(--accent); box-shadow: 0 0 18px rgba(255,106,43,.14); }
.coach-tag { font-size: 11px; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.ej-badge { background: #32290e; color: var(--amber); font-size: 10px; font-weight: 800;
  padding: 1px 7px; border-radius: 8px; vertical-align: middle; letter-spacing: .5px;
  font-family: var(--mono); }

@media (min-width: 720px) {
  h1 { font-size: 34px; }
  .gauges { gap: 12px; }
}

/* §5.3 — movimiento reducido: la MISMA historia sin coreografía. Loops ambientales fuera. */
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; display: none; }
  .fcard, .sblock, .slotrow, .crystal *, .mnode.done, .hypcard.on .hypcheck { animation: none !important; }
  .sblock { opacity: 1; }
  .ag.live .agdot, .live-pulse, .vstat.rendering, .logline.live::after { animation: none !important; }
  * { transition: none !important; }
}
