/* Agentitos de DaVincci: los agentes de OASIS dibujados como bolitas con ojos, para la web y el kit de marca.
   Mismo dibujo que OASIS (web/src/nodos/agentito.css y bolitas/bolitas.css, v4): orbe negro plano, ojos blancos y UN
   rasgo por rol. Aquí no hay React: el marcado es fijo (ver agentitos.js › marcado) y funciona sin scripts.

   <span class="agentito ag-t64" data-rol="codigo" data-animo="reposo" role="img" aria-label="…">
     <span class="ag-orbe"></span><span class="ag-anillo"></span>
     <span class="ag-cara"><span class="ag-mirada">
       <span class="ag-ojo"><i class="ag-parpado"></i></span><span class="ag-ojo"><i class="ag-parpado"></i></span>
     </span></span>
   </span>

   Solo se animan transform, translate y opacity. Sin scripts o con movimiento reducido queda la pose quieta. */

.agentito {
  --t: 68px;
  --ag-negro: #0c0c0c;
  --ag-ojo: #f4f4f4;
  --ag-filo: rgba(255, 255, 255, 0.28);
  --ag-trazo: color-mix(in srgb, currentColor 46%, transparent);
  --ag-aviso: #c4932f;
  --ag-peligro: #ee8573;
  --ag-abre: 1;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--t);
  height: var(--t);
  vertical-align: middle;
}
/* Tamaños por clase (la CSP de los sitios no admite style=""). Para otro tamaño, define --t en tu CSS. */
.ag-t24 { --t: 24px; } .ag-t28 { --t: 28px; } .ag-t30 { --t: 30px; } .ag-t32 { --t: 32px; } .ag-t36 { --t: 36px; } .ag-t40 { --t: 40px; } .ag-t44 { --t: 44px; } .ag-t46 { --t: 46px; } .ag-t48 { --t: 48px; } .ag-t56 { --t: 56px; } .ag-t64 { --t: 64px; } .ag-t68 { --t: 68px; } .ag-t72 { --t: 72px; } .ag-t84 { --t: 84px; } .ag-t96 { --t: 96px; } .ag-t128 { --t: 128px; } .ag-t190 { --t: 190px; }
/* Sobre el lienzo crema los orbes se ven enteros: sin filo. */
.ag-lienzo .agentito { --ag-filo: transparent; }
.ag-orbe {
  position: absolute;
  inset: 0;
  border-radius: var(--ag-forma, 50%);
  background: var(--ag-negro);
  outline: 1px solid var(--ag-filo);
}
.ag-anillo {
  position: absolute;
  inset: calc(var(--t) * -0.075);
  border: 1px solid transparent;
  border-radius: var(--ag-forma-anillo, 50%);
}
.ag-cara { position: absolute; inset: 0; display: grid; place-items: center; }
.ag-mirada {
  display: flex;
  align-items: center;
  gap: calc(var(--t) * 0.16);
  margin-top: calc(var(--t) * -0.04);
  /* La mirada: --mx y --my van de -1 a 1 (agentitos.js o una línea de tiempo de scroll). */
  translate: calc(var(--mx, 0) * var(--t) * 0.075) calc(var(--my, 0) * var(--t) * 0.075);
}
.ag-ojo { position: relative; width: calc(var(--t) * 0.12); height: calc(var(--t) * 0.2); }
.ag-parpado {
  position: absolute;
  inset: 0;
  border-radius: var(--ag-ojo-forma, 999px);
  background: var(--ag-ojo);
  transform: scaleY(var(--ag-abre));
  transform-origin: 50% 60%;
}

/* ---------- Un rasgo por rol (los ojos o la silueta; nunca accesorios) ---------- */

/* líder: ojos serenos y un anillo fino con un punto por cada agente de su equipo. */
.agentito[data-rol='lider'] { --ag-abre: 0.62; }
.ag-orbita { position: absolute; inset: calc(var(--t) * -0.17); border: 1px solid var(--ag-trazo); border-radius: 50%; }
.ag-n1 { --n: 1; } .ag-n2 { --n: 2; } .ag-n3 { --n: 3; } .ag-n4 { --n: 4; } .ag-n5 { --n: 5; } .ag-n6 { --n: 6; } .ag-n7 { --n: 7; } .ag-n8 { --n: 8; }
.ag-orbita i:nth-child(1) { --i: 0; } .ag-orbita i:nth-child(2) { --i: 1; } .ag-orbita i:nth-child(3) { --i: 2; } .ag-orbita i:nth-child(4) { --i: 3; } .ag-orbita i:nth-child(5) { --i: 4; } .ag-orbita i:nth-child(6) { --i: 5; } .ag-orbita i:nth-child(7) { --i: 6; } .ag-orbita i:nth-child(8) { --i: 7; }
.ag-orbita i {
  --p: max(3px, calc(var(--t) * 0.075));
  position: absolute; left: 50%; top: 50%; width: var(--p); height: var(--p); margin: calc(var(--p) / -2);
  border-radius: 50%; background: currentColor; opacity: 0.8;
  transform: rotate(calc(var(--i) * 1turn / var(--n))) translateY(calc(var(--t) * -0.67));
}

/* planificador: la única silueta cuadrada; ojos de punto. */
.agentito[data-rol='planificador'] { --ag-forma: 30%; --ag-forma-anillo: 34%; }
.agentito[data-rol='planificador'] .ag-ojo { width: calc(var(--t) * 0.11); height: calc(var(--t) * 0.11); }
.agentito[data-rol='planificador'] .ag-mirada { transform: translate(-12%, -12%); }

/* código: los ojos son < >. */
.agentito[data-rol='codigo'] .ag-ojo { width: calc(var(--t) * 0.13); }
.agentito[data-rol='codigo'] .ag-parpado { border-radius: 0; clip-path: polygon(100% 0, 100% 24%, 40% 50%, 100% 76%, 100% 100%, 0 57%, 0 43%); }
.agentito[data-rol='codigo'] .ag-ojo + .ag-ojo .ag-parpado { clip-path: polygon(0 0, 100% 43%, 100% 57%, 0 100%, 0 76%, 60% 50%, 0 24%); }

/* revisión: entrecierra un ojo. */
.agentito[data-rol='revision'] { --ag-abre: 0.95; }
.agentito[data-rol='revision'] .ag-ojo + .ag-ojo .ag-parpado { transform: scaleY(0.3); }

/* verificador: un ojo es una mira y el otro guiña. */
.agentito[data-rol='verificador'] .ag-ojo:first-child { width: calc(var(--t) * 0.18); height: calc(var(--t) * 0.18); }
.agentito[data-rol='verificador'] .ag-ojo:first-child .ag-parpado {
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, #000 0 20%, transparent 23% 50%, #000 52% 68%, transparent 70%);
  mask: radial-gradient(circle, #000 0 20%, transparent 23% 50%, #000 52% 68%, transparent 70%);
}
.agentito[data-rol='verificador'] .ag-ojo + .ag-ojo .ag-parpado { transform: scaleY(0.14); }

/* investigación: un ojo grande, como visto con lupa. */
.agentito[data-rol='investigacion'] .ag-mirada { gap: calc(var(--t) * 0.1); }
.agentito[data-rol='investigacion'] .ag-ojo { width: calc(var(--t) * 0.1); height: calc(var(--t) * 0.1); }
.agentito[data-rol='investigacion'] .ag-ojo + .ag-ojo { width: calc(var(--t) * 0.24); height: calc(var(--t) * 0.24); }

/* render: un solo ojo panorámico. */
.agentito[data-rol='render'] .ag-ojo + .ag-ojo { display: none; }
.agentito[data-rol='render'] .ag-ojo { width: calc(var(--t) * 0.5); height: calc(var(--t) * 0.1); overflow: hidden; border-radius: 3px; }
.agentito[data-rol='render'] .ag-parpado { border-radius: 3px; }

/* infra: ojos de píxel. */
.agentito[data-rol='infra'] { --ag-ojo-forma: 1px; }
.agentito[data-rol='infra'] .ag-ojo { width: calc(var(--t) * 0.12); height: calc(var(--t) * 0.12); }

/* diseño: un ojo redondo y uno cuadrado. */
.agentito[data-rol='diseno'] .ag-ojo { width: calc(var(--t) * 0.13); height: calc(var(--t) * 0.13); }
.agentito[data-rol='diseno'] .ag-ojo:first-child .ag-parpado { border-radius: 50%; }
.agentito[data-rol='diseno'] .ag-ojo + .ag-ojo .ag-parpado { border-radius: 1px; }

/* datos: dos barras de una gráfica. */
.agentito[data-rol='datos'] { --ag-ojo-forma: 2px; }
.agentito[data-rol='datos'] .ag-mirada { align-items: flex-end; gap: calc(var(--t) * 0.07); }
.agentito[data-rol='datos'] .ag-ojo { width: calc(var(--t) * 0.09); height: calc(var(--t) * 0.14); }
.agentito[data-rol='datos'] .ag-ojo + .ag-ojo { height: calc(var(--t) * 0.24); }
.agentito[data-rol='datos'] .ag-parpado { transform-origin: 50% 100%; }

/* redactor: ojos de comillas. */
.agentito[data-rol='redactor'] .ag-mirada { gap: calc(var(--t) * 0.06); transform: translateY(-10%); }
.agentito[data-rol='redactor'] .ag-ojo { width: calc(var(--t) * 0.13); height: calc(var(--t) * 0.13); }
/* vigía: ojos altos y muy abiertos, de guardia */
.agentito[data-rol='vigia'] { --ag-abre: 1; }
.agentito[data-rol='vigia'] .ag-ojo { width: calc(var(--t) * 0.1); height: calc(var(--t) * 0.27); }
.agentito[data-rol='redactor'] .ag-parpado { border-radius: 50% 50% 50% 0; }

/* ---------- Expresiones (el estado); van después de los roles para ganarles ---------- */
.agentito[data-animo='reposo']:is([data-rol='general'], :not([data-rol])) { --ag-abre: 0.84; }
.agentito[data-animo='pensando'] .ag-mirada { transform: translate(12%, -16%); }
.agentito[data-animo='trabajando']:is([data-rol='general'], [data-rol='lider'], :not([data-rol])) { --ag-abre: 0.42; }
.agentito[data-animo='trabajando'] .ag-mirada { transform: translateY(10%); }
.agentito[data-animo='trabajando'] .ag-anillo { border-color: var(--ag-trazo); }
.agentito[data-animo='esperando'] .ag-parpado { transform: scale(1.12); }
.agentito[data-animo='esperando'] .ag-mirada { transform: translateY(8%); }
.agentito[data-animo='esperando'] .ag-anillo { border-color: var(--ag-aviso); }
.agentito[data-animo='dormido'] { --ag-abre: 0.12; }
.agentito[data-animo='dormido'] .ag-parpado { opacity: 0.55; transform: scaleY(0.12); }

/* error (ojos en ×) y terminado (ojos en ^): la forma del ojo cambia entera, sea cual sea el rol. El :is() de los
   dos ojos iguala el peso de las reglas de rol (0,5,0), y gana por ir después. */
.agentito:is([data-animo='error'], [data-animo='terminado']) .ag-mirada { align-items: center; gap: calc(var(--t) * 0.1); transform: none; }
.agentito:is([data-animo='error'], [data-animo='terminado']) :is(.ag-ojo, .ag-ojo + .ag-ojo) { display: block; width: calc(var(--t) * 0.18); height: calc(var(--t) * 0.18); overflow: visible; }
.agentito:is([data-animo='error'], [data-animo='terminado']) :is(.ag-ojo, .ag-ojo + .ag-ojo) .ag-parpado { border-radius: 0; -webkit-mask: none; mask: none; transform: none; opacity: 1; }
.agentito[data-animo='error'] :is(.ag-ojo, .ag-ojo + .ag-ojo) .ag-parpado { clip-path: polygon(14% 0, 50% 36%, 86% 0, 100% 14%, 64% 50%, 100% 86%, 86% 100%, 50% 64%, 14% 100%, 0 86%, 36% 50%, 0 14%); }
.agentito[data-animo='error'] .ag-anillo { border-color: var(--ag-peligro); }
.agentito[data-animo='terminado'] :is(.ag-ojo, .ag-ojo + .ag-ojo) .ag-parpado { clip-path: polygon(50% 16%, 100% 66%, 86% 80%, 50% 44%, 14% 80%, 0 66%); }
.agentito[data-animo='terminado'] .ag-mirada { transform: translateY(-6%); }
.agentito[data-animo='terminado'] .ag-anillo { border-color: color-mix(in srgb, currentColor 30%, transparent); }

/* A 28 px o menos: sin anillo ni órbita; el rasgo se sigue leyendo. */
.agentito[data-chico] .ag-anillo, .agentito[data-chico] .ag-orbita { display: none; }

/* ---------- Movimiento: solo si el visitante no pidió reducirlo ---------- */
@media (prefers-reduced-motion: no-preference) {
  .ag-mirada { transition: translate 260ms cubic-bezier(0.16, 1, 0.3, 1), transform 240ms cubic-bezier(0.16, 1, 0.3, 1); }
  .ag-parpado { transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms; }

  /* Parpadeo: agentitos.js pone .parpadea (190 ms) y la quita; entre parpadeos no corre nada. */
  .agentito.parpadea .ag-parpado { animation: ag-parpadear 190ms cubic-bezier(0.65, 0, 0.35, 1) 1; }
  @keyframes ag-parpadear { 50% { transform: scaleY(0.08); } }

  /* El gesto de trabajo de cada rol. Corre solo mientras el agentito está «trabajando» y a la vista (.fuera lo pausa). */
  .agentito[data-animo='trabajando'] .ag-anillo { animation: ag-latir 2.4s ease-in-out infinite; }
  .agentito[data-animo='trabajando']:is([data-rol='general'], :not([data-rol])) .ag-mirada { animation: ag-leer 1.6s ease-in-out infinite; }
  .agentito[data-animo='pensando'] .ag-mirada { animation: ag-pensar 3.2s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
  .agentito[data-rol='lider'][data-animo='trabajando'] .ag-orbita { animation: ag-girar 8s linear infinite; }
  .agentito[data-rol='planificador'][data-animo='trabajando'] .ag-mirada { animation: ag-cuadricula 3.2s infinite; }
  .agentito[data-rol='codigo'][data-animo='trabajando'] .ag-ojo { animation: ag-etiqueta-i 1.3s ease-in-out infinite; }
  .agentito[data-rol='codigo'][data-animo='trabajando'] .ag-ojo + .ag-ojo { animation-name: ag-etiqueta-d; }
  .agentito[data-rol='revision'][data-animo='trabajando'] .ag-mirada { animation: ag-leer-lento 3.4s ease-in-out infinite; }
  .agentito[data-rol='verificador'][data-animo='trabajando'] .ag-ojo:first-child { animation: ag-enfocar 1.4s ease-in-out infinite; }
  .agentito[data-rol='investigacion'][data-animo='trabajando'] .ag-mirada { animation: ag-buscar 3.2s linear infinite; }
  .agentito[data-rol='render'][data-animo='trabajando'] .ag-ojo::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 9%; background: var(--ag-negro); animation: ag-cabezal 2.2s linear infinite; }
  .agentito[data-rol='infra'][data-animo='trabajando'] .ag-parpado { animation: ag-led 0.8s steps(1) infinite; }
  .agentito[data-rol='infra'][data-animo='trabajando'] .ag-ojo + .ag-ojo .ag-parpado { animation-delay: -0.4s; }
  .agentito[data-rol='diseno'][data-animo='trabajando'] .ag-ojo + .ag-ojo { animation: ag-rombo 2.6s ease-in-out infinite; }
  .agentito[data-rol='datos'][data-animo='trabajando'] .ag-ojo { transform-origin: 50% 100%; animation: ag-barra 1.1s ease-in-out infinite alternate; }
  .agentito[data-rol='datos'][data-animo='trabajando'] .ag-ojo + .ag-ojo { animation-delay: -0.55s; }
  .agentito[data-rol='redactor'][data-animo='trabajando'] .ag-mirada { animation: ag-cursor 1.06s steps(1) infinite; }

  @keyframes ag-latir { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.9; } }
  @keyframes ag-leer { 0%, 100% { transform: translate(-5%, 10%); } 50% { transform: translate(5%, 10%); } }
  @keyframes ag-pensar { 0%, 12% { transform: translate(-14%, -16%); } 40%, 60% { transform: translate(14%, -16%); } 88%, 100% { transform: translate(-14%, -16%); } }
  @keyframes ag-girar { to { transform: rotate(360deg); } }
  @keyframes ag-cuadricula { 0%, 20% { transform: translate(-14%, -14%); } 25%, 45% { transform: translate(14%, -14%); } 50%, 70% { transform: translate(-14%, 14%); } 75%, 95% { transform: translate(14%, 14%); } 100% { transform: translate(-14%, -14%); } }
  @keyframes ag-etiqueta-i { 50% { transform: translateX(-45%); } }
  @keyframes ag-etiqueta-d { 50% { transform: translateX(45%); } }
  @keyframes ag-leer-lento { 0%, 100% { transform: translateX(-12%); } 50% { transform: translateX(12%); } }
  @keyframes ag-enfocar { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.78); } }
  @keyframes ag-buscar { 0% { transform: rotate(0) translateX(10%) rotate(0); } 100% { transform: rotate(360deg) translateX(10%) rotate(-360deg); } }
  @keyframes ag-cabezal { from { transform: translateX(-100%); } to { transform: translateX(1111%); } }
  @keyframes ag-led { 0% { opacity: 1; } 50% { opacity: 0.25; } }
  @keyframes ag-rombo { 0%, 30% { transform: rotate(0); } 50%, 80% { transform: rotate(45deg) scale(0.9); } 100% { transform: rotate(0); } }
  @keyframes ag-barra { from { transform: scaleY(0.45); } to { transform: scaleY(1.1); } }
  @keyframes ag-cursor { 0% { opacity: 1; } 50% { opacity: 0.35; } }

  .agentito.fuera *, .agentito.fuera *::after { animation-play-state: paused !important; }
}
