/* =========================================================================
   IAbyLio, home: seccion clara del caso AiTed (prefijo ca-)

   Sigue al hero. La paleta se invierte: fondo claro (el blanco roto de la marca), tinta navy,
   azul de marca para lo resuelto y ambar para lo que dolia. Es plana (2D): HTML, CSS y SVG.
   Generada por _backend/caso-aited/construir.py; la anima js/caso-aited.js.

   Dos modos, mismo HTML:

   1. ESTATICO (sin JS, reduced motion, impresion): cada escena es un bloque 16:9 (9:16 en vertical)
      con todo ya colocado y su texto. Se lee entera.
   2. VIVO (html.ca-vivo, lo pone el <head> si hay JS y no hay reduced motion): la seccion se fija
      (position: sticky) y se SOLAPA con el final del hero (margin-top negativo): su escenario ya esta puesto,
      enmascarado, cuando empieza el destello, y el destello es ese mismo fondo revelado en circulo desde la pantalla
      del portatil (mask-image que escribe js/caso-aited.js). Dentro, un unico cuadro 16:9 (o 9:16) con ACTORES
      persistentes que viajan de un tiempo al siguiente. El fondo (reticula, grano y tres manchas que derivan) es de toda
      la ventana; la reticula reacciona al raton (canvas, solo con puntero fino).

   Unidades: el cuadro es un contenedor (cqw): 100cqw = su ancho. Cada pieza lleva su ancho en --w y
   dentro todo va en em (1em = ancho / 20 salvo donde se dice). Solo se animan transform, opacity
   (y sus sueltos translate / scale / rotate).
   ========================================================================= */

.ca {
  position: relative;
  background: #e6e6e1;
  color: #0b0f1e;
  /* mismo margen izquierdo que el logo de la cabecera (barra centrada de max-width --ancho) */
  --ca-izq: max(var(--margen), calc((100cqw - var(--ancho)) / 2 + var(--margen)));
  /* Recorrido fijado de la historia, INCLUIDO el destello (el primer --ca-solape). Los tiempos de la historia son el resto. */
  --ca-recorrido: 610vh;
  /* Scroll de la SALIDA: la ultima escena ya esta dicha y el escenario sigue fijado mientras su propio lienzo se oscurece hasta ser el
     fondo de la pagina (sin degradado que lo tape). Al terminar, la pista se acaba y entra "Dos formas de trabajar". */
  --ca-salida: 70vh;
  /* Scroll que dura el destello = el ultimo tramo del hero (p de 7 a 8) = --hh-recorrido * ULTIMO / (7 + ULTIMO), ULTIMO = 0,5. */
  --ca-solape: calc(var(--hh-recorrido) / 15);
}
@media (max-aspect-ratio: 1/1) {
  .ca { --ca-recorrido: 480vh; --ca-salida: 55vh; }
}
/* Solape con el hero: el escenario claro queda fijado encima del hero justo cuando empieza el destello (100vh del propio
   escenario + el tramo del destello). Antes subia desde abajo tras el blanco. */
html.hh-vivo.ca-vivo .ca {
  margin-top: calc(-100vh - var(--ca-solape));
  margin-top: calc(-100svh - var(--ca-solape));
  position: relative;
  z-index: 3;
  background: transparent;
}

/* ----------------------------------------------------------------- fondo */
.ca-fondo { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: #e6e6e1; pointer-events: none; }
.ca-fondo::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at center, rgba(11, 15, 30, 0.2) 0.1cqw, rgba(11, 15, 30, 0) 0.16cqw);
  background-size: 1.9cqw 1.9cqw;
}
.ca-fondo::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.04 0 0 0 0 0.06 0 0 0 0 0.12 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ca-fondo i { position: absolute; border-radius: 50%; will-change: transform; }
/* La salida: una capa del color de la pagina POR ENCIMA de las manchas y de la reticula y POR DEBAJO del grano; js/caso-aited.js
   le sube la opacidad, asi el propio lienzo se oscurece (los puntos siguen visibles mientras dura y se apagan al final). */
.ca-oscuro { position: absolute; inset: 0; background: var(--base); opacity: 0; pointer-events: none; }
.ca-fondo .m1 { left: -12cqw; top: -18cqw; width: 58cqw; height: 58cqw; background: radial-gradient(circle, rgba(10, 143, 208, 0.12), rgba(10, 143, 208, 0) 68%); }
.ca-fondo .m2 { right: -14cqw; bottom: -22cqw; width: 62cqw; height: 62cqw; background: radial-gradient(circle, rgba(232, 161, 92, 0.17), rgba(232, 161, 92, 0) 68%); }
.ca-fondo .m3 { right: 18cqw; top: -20cqw; width: 44cqw; height: 44cqw; background: radial-gradient(circle, rgba(79, 180, 232, 0.12), rgba(79, 180, 232, 0) 68%); }

/* ======================================================================== *
 * 1. ESTATICO
 * ======================================================================== */
.ca-fondo--escena, .ca-avance, .ca-pista { display: none; }
.ca-cuadro--v { display: none; }
.ca-esc {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 16 / 9;
  width: min(100%, 177.78vh);
  width: min(100%, 177.78svh);
  margin: 0 auto;
}
.ca-esc + .ca-esc { border-top: 1px solid rgba(11, 15, 30, 0.12); }
@media (max-aspect-ratio: 1/1) {
  .ca-cuadro--h { display: none; }
  .ca-cuadro--v { display: block; }
  .ca-esc { aspect-ratio: 9 / 16; width: 100%; }
}

/* ---------------------------------------------------------------- texto */
.ca-texto { position: absolute; z-index: 4; left: var(--ca-izq); width: min(33cqw, calc(100cqw - var(--ca-izq) - 52cqw)); display: grid; gap: 1.4cqw; }
.ca-texto--medio { top: 50%; transform: translateY(-50%); }
.ca-texto--estrecho { width: min(30cqw, calc(100cqw - var(--ca-izq) - 55cqw)); }
.ca-texto--arriba { top: 8cqw; width: min(56cqw, calc(100cqw - 2 * var(--ca-izq))); gap: 1cqw; }
.ca-texto--titulo { top: 50%; transform: translateY(-50%); width: min(42cqw, calc(100cqw - var(--ca-izq) - 46cqw)); gap: 2cqw; }
.ca-frase { margin: 0; font-family: var(--f-display); font-weight: 600; letter-spacing: -0.04em; line-height: 1.02; font-size: max(1.625rem, 3.4cqw); color: #0b0f1e; text-wrap: balance; }
.ca-texto--titulo .ca-frase { font-size: max(2.25rem, 5.4cqw); line-height: 0.98; }
.ca-texto--arriba .ca-frase { font-size: max(1.5rem, 2.9cqw); }
.ca-frase em { font-style: normal; color: #0a8fd0; }
.ca-frase em.dolor { color: #c27a28; }
.ca-linea { margin: 0; font-size: max(0.9375rem, 1.3cqw); line-height: 1.5; color: #3c475c; max-width: 30cqw; text-wrap: pretty; }
.ca-texto--titulo .ca-linea { font-size: max(1.0625rem, 1.7cqw); max-width: 46cqw; }
.ca-texto--arriba .ca-linea { max-width: 46cqw; font-size: max(0.9375rem, 1.15cqw); }
.ca-kicker { margin: 0; font-family: var(--f-mono); font-weight: 500; font-size: max(0.75rem, 1cqw); letter-spacing: 0.1em; text-transform: uppercase; color: #0a7fb8; }

/* vertical */
.ca-texto--movil, .ca-texto--titulo-m { left: 5.5cqw; right: 5.5cqw; width: auto; top: 22cqw; transform: none; gap: 3.4cqw; }
.ca-texto--titulo-m { top: 24cqw; transform: none; gap: 4cqw; }
.ca-cuadro--v .ca-frase { font-size: max(1.75rem, 9cqw); }
.ca-cuadro--v .ca-texto--titulo-m .ca-frase { font-size: max(2.25rem, 11.5cqw); }
.ca-cuadro--v .ca-texto--movil-compacto .ca-frase { font-size: max(1.5rem, 6.2cqw); line-height: 1.04; }
.ca-cuadro--v .ca-texto--movil-compacto .ca-linea { font-size: max(0.9375rem, 3.5cqw); }
.ca-cuadro--v .ca-texto--movil-largo .ca-frase { font-size: max(1.5rem, 7.2cqw); line-height: 1.04; }
.ca-cuadro--v .ca-linea { font-size: max(0.9375rem, 3.8cqw); max-width: none; }
.ca-cuadro--v .ca-texto--titulo-m .ca-linea { font-size: max(1.0625rem, 4.6cqw); }
.ca-cuadro--v .ca-kicker { font-size: max(0.75rem, 3cqw); }

/* ---------------------------------------------------------------- piezas */
.ca-pieza { position: absolute; z-index: 3; width: var(--w); font-size: calc(var(--w) / 20); transform: rotate(var(--r, 0deg)); }
/* Actor del modo vivo: una sola pieza que viaja entre tiempos; su posicion, escala, giro y opacidad los escribe js/caso-aited.js
   (propiedades sueltas translate / rotate / scale, centro de la pieza como origen). */
.ca-actor { transform: none; transform-origin: 50% 50%; }
.ca-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ca-flechas { position: absolute; z-index: 5; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }

.ca-hoja, .ca-plat, .ca-auto, .ca-sat {
  background: #fbfaf6;
  box-shadow: 0 0 0 1px rgba(11, 15, 30, 0.13), 0 0.1em 0 rgba(11, 15, 30, 0.05), 0 1.3em 2.6em -1.1em rgba(11, 15, 30, 0.5);
}

/* hoja de Google Sheets */
.ca-hoja { aspect-ratio: 1 / 0.72; border-radius: 0.55em; overflow: hidden; }
.ca-hoja .barra { position: absolute; left: 0; right: 0; top: 0; height: 2.2em; display: flex; align-items: center; gap: 0.55em; padding: 0 0.8em; background: #edf1ed; border-bottom: 1px solid rgba(11, 15, 30, 0.1); }
.ca-hoja .barra img { width: 1.3em; height: 1.3em; }
.ca-hoja .barra span { width: 2.3em; height: 0.45em; border-radius: 0.25em; background: rgba(11, 15, 30, 0.14); }
.ca-hoja .cuerpo { position: absolute; inset: 2.2em 0 0 0; display: grid; grid-template-rows: repeat(6, 1fr); background-image: linear-gradient(90deg, rgba(11, 15, 30, 0.1) 1px, transparent 1px); background-size: 25% 100%; }
.ca-hoja .f { position: relative; display: flex; align-items: center; gap: 3%; padding: 0 3%; border-bottom: 1px solid rgba(11, 15, 30, 0.1); }
.ca-hoja .f i { display: block; height: 0.5em; border-radius: 0.3em; background: rgba(11, 15, 30, 0.26); }
/* los datos repetidos se resaltan en ambar: una capa encima (mismos renglones en ambar) cuya opacidad enciende js/caso-aited.js
   fila a fila; sin JS queda encendida. Se anima la opacidad de la propia capa, no una variable del padre. */
.ca-hoja .f .hl { position: absolute; inset: 0; display: flex; align-items: center; gap: 3%; padding: 0 3%; background: rgba(232, 161, 92, 0.52); }
.ca-hoja .f .hl i { background: #a8661f; }
.ca-hoja .nombre { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 0.5em; padding: 0.5em 1em 0.5em 0.65em; border-radius: 99px; background: #fff; box-shadow: 0 0 0 1px rgba(11, 15, 30, 0.14), 0 0.5em 1.2em -0.4em rgba(11, 15, 30, 0.45); font-family: var(--f-mono); font-weight: 500; font-size: 1em; line-height: 1; color: #0b0f1e; white-space: nowrap; }
.ca-hoja .nombre img { width: 1.5em; height: 1.5em; }

/* plataforma de pago (Kajabi, Hotmart) */
.ca-plat { aspect-ratio: 20 / 11; border-radius: 0.8em; display: grid; place-items: center; }
.ca-plat .et { position: absolute; left: 1em; top: 0.8em; font-family: var(--f-mono); font-size: 0.85em; letter-spacing: 0.08em; text-transform: uppercase; color: #6a7690; }
.ca-plat .logo { display: block; height: auto; max-height: 4.6em; object-fit: contain; margin-top: -0.9em; }
.ca-plat .ventas { position: absolute; left: 1em; right: 1em; bottom: 0.9em; display: grid; gap: 0.4em; }
.ca-plat .ventas div { display: flex; align-items: center; gap: 0.6em; }
.ca-plat .ventas i { display: block; height: 0.42em; border-radius: 0.25em; background: rgba(11, 15, 30, 0.2); }
.ca-plat .ventas b { display: block; margin-left: auto; width: 1.8em; height: 0.55em; border-radius: 0.3em; background: rgba(10, 143, 208, 0.55); }

/* herramienta de automatizacion (Zapier, Make) */
.ca-auto { aspect-ratio: 20 / 11; border-radius: 0.8em; }
.ca-auto .et { position: absolute; left: 1em; top: 0.8em; font-family: var(--f-mono); font-size: 0.85em; letter-spacing: 0.08em; text-transform: uppercase; color: #6a7690; }
.ca-auto .marca { position: absolute; left: 1em; top: 2.5em; display: flex; align-items: center; gap: 0.7em; }
.ca-auto .marca img { width: 2.8em; height: 2.8em; display: block; }
.ca-auto .marca b { font-family: var(--f-display); font-weight: 600; font-size: 2em; line-height: 1; letter-spacing: -0.03em; }
.ca-auto svg { position: absolute; right: 1em; bottom: 1em; width: 40%; height: auto; }
.ca-auto .cuota { position: absolute; right: -0.8em; top: -0.9em; padding: 0.5em 0.85em; border-radius: 0.5em; background: #e8a15c; color: #0b0f1e; font-family: var(--f-mono); font-weight: 500; font-size: 0.95em; line-height: 1; white-space: nowrap; transform: rotate(4deg); box-shadow: 0 0.5em 1em -0.5em rgba(11, 15, 30, 0.55); }
.ca-auto .error { position: absolute; left: 1em; bottom: 0.9em; display: inline-flex; align-items: center; gap: 0.45em; font-family: var(--f-mono); font-weight: 500; font-size: 0.9em; color: #a8461f; }
.ca-auto .error b { display: grid; place-items: center; width: 1.55em; height: 1.55em; border-radius: 50%; background: #e8a15c; color: #0b0f1e; font-family: var(--f-display); font-weight: 700; font-size: 1em; line-height: 1; }

/* la persona que mantiene las herramientas */
.ca-persona { font-size: calc(var(--w) / 9); }
.ca-persona svg { display: block; width: 100%; height: auto; overflow: visible; }
.ca-persona .rotulo { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 0.7em); padding: 0.55em 1em; border-radius: 99px; background: #0b0f1e; color: #f4f3ee; font-family: var(--f-mono); font-weight: 500; font-size: 1em; line-height: 1; white-space: nowrap; }

/* notas */
.ca-nota { width: auto; display: inline-block; padding: 0.4em 0.8em; border-radius: 0.5em; font-family: var(--f-mono); font-weight: 500; font-size: calc(var(--w) / var(--n, 12)); line-height: 1.1; white-space: nowrap; }
.ca-nota.ambar { background: rgba(232, 161, 92, 0.26); border: 1px dashed #b9793d; color: #7d4a12; }
.ca-nota.azul { background: rgba(10, 143, 208, 0.12); border: 1px solid #0a8fd0; color: #065f8c; }
.ca-leyenda { position: absolute; z-index: 4; display: inline-flex; align-items: center; gap: 0.6cqw; font-family: var(--f-mono); font-size: max(0.7rem, 0.95cqw); color: #7d4a12; }
.ca-leyenda i { display: block; width: 1.8cqw; height: 0.9cqw; border-radius: 0.2cqw; background: rgba(232, 161, 92, 0.6); border: 1px solid #a8661f; }

/* el sistema centralizado: el protagonista del caso */
.ca-sistema { font-size: calc(var(--w) / 25); }
.ca-sistema .ventana { position: relative; aspect-ratio: 25 / 16; overflow: hidden; border-radius: 1.2em; background: #0b0f1e; box-shadow: 0 0 0 0.16em #0a8fd0, 0 0 4em 0.3em rgba(10, 143, 208, 0.42), 0 2em 4em -1.6em rgba(11, 15, 30, 0.7); }
.ca-sistema .barra { display: flex; align-items: center; gap: 0.5em; height: 2.5em; padding: 0 1.1em; border-bottom: 1px solid rgba(143, 205, 241, 0.22); }
.ca-sistema .barra i { display: block; width: 0.7em; height: 0.7em; border-radius: 50%; background: rgba(230, 230, 225, 0.3); }
.ca-sistema .barra span { margin-left: 0.8em; font-family: var(--f-mono); font-size: 0.95em; color: #8fcdf1; }
.ca-sistema .cuerpo { position: absolute; inset: 2.5em 0 0 0; display: grid; grid-template-columns: 7.4em 1fr; align-items: center; gap: 1.6em; padding: 0 2em; }
.ca-sistema .cuerpo svg { width: 100%; height: auto; display: block; }
.ca-sistema .lineas i { display: block; height: 0.7em; margin: 0.8em 0; border-radius: 0.4em; background: rgba(230, 230, 225, 0.32); }
.ca-sistema .chip { position: absolute; left: 50%; display: inline-flex; align-items: center; gap: 0.5em; padding: 0.6em 1.1em; border-radius: 99px; font-family: var(--f-mono); font-weight: 500; font-size: 1em; line-height: 1; white-space: nowrap; transform: translateX(-50%); box-shadow: 0 0.5em 1em -0.5em rgba(11, 15, 30, 0.5); }
.ca-sistema .c1 { top: calc(100% - 1.4em); background: #0a8fd0; color: #0b0f1e; }
.ca-sistema .c2 { top: calc(100% + 2.4em); background: #fbfaf6; color: #065f8c; box-shadow: 0 0 0 1px rgba(10, 143, 208, 0.6), 0 0.5em 1em -0.5em rgba(11, 15, 30, 0.5); }
.ca-sistema .c2 u { display: block; width: 1.3em; height: 1.3em; border-radius: 50%; background: #0a8fd0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.2 2.2 4.6-5' fill='none' stroke='%230b0f1e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }

.ca-estatico .ca-esc[data-k="5"] .ca-sistema .chip { display: none; }

/* programas construidos encima */
.ca-sat { font-size: calc(var(--w) / 21); aspect-ratio: 21 / 10; display: grid; grid-template-columns: 7.2em 1fr; align-items: center; gap: 1.1em; padding: 0 1.3em; border-radius: 0.9em; border-left: 0.4em solid #0a8fd0; }
.ca-sat svg { width: 100%; height: auto; display: block; overflow: visible; }
.ca-sat b { font-family: var(--f-display); font-weight: 600; font-size: 1.6em; line-height: 1.05; letter-spacing: -0.02em; }
/* movil: fila ancha, una linea, texto >= 15 px */
.ca-sat--fila { aspect-ratio: auto; font-size: 1cqw; grid-template-columns: 9cqw minmax(0, 1fr); gap: 3.2cqw; padding: 2.4cqw 3.4cqw; border-radius: 2cqw; border-left-width: 1cqw; }
.ca-sat--fila b { font-size: max(0.9375rem, 4.2cqw); line-height: 1.15; }

/* transformaciones: antes (ambar, discontinuo) -> ahora (azul, solido). Cuerpo, no mono; grandes y alineadas */
.ca-transes { font-size: 1cqw; display: grid; grid-template-columns: minmax(0, 1fr) 3.4cqw minmax(0, 1fr); column-gap: 0.7cqw; row-gap: 0.9cqw; align-items: stretch; }
.ca-transes .cab { align-self: end; font-family: var(--f-mono); font-weight: 500; font-size: max(0.75rem, 0.9cqw); letter-spacing: 0.1em; text-transform: uppercase; }
.ca-transes .cab--de { color: #8a5619; }
.ca-transes .cab--a { color: #0a7fb8; }
.ca-transes .de, .ca-transes .a { display: flex; align-items: center; padding: 0.95cqw 1.3cqw; border-radius: 0.9cqw; font-family: var(--f-texto); font-weight: 600; font-size: max(1.0625rem, 1.25cqw); line-height: 1.28; letter-spacing: -0.005em; text-wrap: pretty; }
.ca-transes .de { background: rgba(232, 161, 92, 0.2); border: 0.14cqw dashed #b9793d; color: #7d4a12; }
.ca-transes .a { background: #0a8fd0; color: #05101c; box-shadow: 0 1.2cqw 2cqw -1.2cqw rgba(10, 143, 208, 0.9), 0 0 0 1px rgba(10, 143, 208, 0.4); }
.ca-transes .fl { align-self: center; width: 100%; height: auto; overflow: visible; }
.ca-cuadro--v .ca-transes { grid-template-columns: minmax(0, 1fr) 7cqw minmax(0, 1fr); column-gap: 0.8cqw; row-gap: 1.6cqw; }
.ca-cuadro--v .ca-transes .cab { font-size: max(0.75rem, 2.9cqw); }
.ca-cuadro--v .ca-transes .de, .ca-cuadro--v .ca-transes .a { padding: 1.9cqw 2.4cqw; border-radius: 2cqw; font-size: max(0.9375rem, 4cqw); line-height: 1.25; border-width: 0.4cqw; }

/* presentacion del caso (tiempo 0): nombre grande y lo que usaban, en gris suave */
.ca-caso { font-size: calc(var(--w) / 20); background: #fbfaf6; border-radius: 1.1em; border-left: 0.35em solid #0a8fd0; padding: 1.6em 1.8em 1.5em; display: grid; gap: 0.5em;
  box-shadow: 0 0 0 1px rgba(11, 15, 30, 0.12), 0 0.1em 0 rgba(11, 15, 30, 0.05), 1.3em 1.6em 3em -1.2em rgba(11, 15, 30, 0.45); }
.ca-caso p { margin: 0; }
.ca-caso .et { font-family: var(--f-mono); font-weight: 500; font-size: 0.82em; letter-spacing: 0.12em; text-transform: uppercase; color: #0a7fb8; }
.ca-caso .nombre { font-family: var(--f-display); font-weight: 700; font-size: 5.4em; line-height: 0.9; letter-spacing: -0.055em; color: #0b0f1e; }
.ca-caso .desc { font-weight: 500; font-size: 0.82em; line-height: 1.35; color: #3c475c; }
.ca-caso .usaban { display: grid; gap: 0.7em; margin-top: 0.9em; padding-top: 1em; border-top: 1px solid rgba(11, 15, 30, 0.13); }
.ca-caso .cap { font-family: var(--f-mono); font-weight: 500; font-size: 0.72em; letter-spacing: 0.1em; text-transform: uppercase; color: #6a7690; }
.ca-caso .fila { display: flex; align-items: center; justify-content: space-between; gap: 0.9em; }
.ca-caso .fila img { display: block; height: 1.55em; width: auto; max-width: 100%; filter: grayscale(1) contrast(0.85); opacity: 0.5; }
.ca-caso .fila img:nth-child(3) { height: 1.3em; }
.ca-cuadro--v .ca-caso { font-size: calc(var(--w) / 21); }
.ca-cuadro--v .ca-caso .et { font-size: max(0.75rem, 0.8em); }
.ca-cuadro--v .ca-caso .desc { font-size: max(0.875rem, 0.82em); }
.ca-cuadro--v .ca-caso .cap { font-size: max(0.75rem, 0.72em); }

/* cifras del ahora: tres columnas repartidas a lo ancho, con aire; solo tipografia, sin rayas ni cajas */
.ca-cifras { position: absolute; z-index: 4; left: var(--ca-izq); right: var(--ca-izq); top: 27.5cqw; display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; column-gap: 4cqw; align-items: start; }
.ca-cifras .cif { display: grid; gap: 1.3cqw; align-content: start; min-width: 0; }
.ca-cifras .rot { margin: 0; font-family: var(--f-mono); font-weight: 500; font-size: max(0.75rem, 0.92cqw); line-height: 1.4; letter-spacing: 0.06em; text-transform: uppercase; color: #7d4a12; }
.ca-cifras .gde { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: max(3.5rem, 6.4cqw); letter-spacing: -0.05em; line-height: 0.95; color: #0a8fd0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ca-cifras .gde--t { font-size: max(1.75rem, 3.5cqw); line-height: 1.02; letter-spacing: -0.04em; }
/* el signo menos: un guion fino del color del numero, a la altura media de las cifras (no el glifo, que sale enorme y grueso) */
.ca-cifras .menos { display: inline-block; width: 0.34em; height: 0.075em; margin-right: 0.08em; border-radius: 0.04em; background: currentColor; vertical-align: 0.29em; }
/* maquina de escribir: lo escrito, el cursor (sin ancho: no mueve el texto) y lo que falta (invisible, ocupa su sitio) */
.ca-cifras .ty-o { visibility: hidden; }
.ca-cifras .ty-k { position: relative; display: inline-block; width: 0; height: 0.8em; vertical-align: baseline; }
.ca-cifras .ty-k::after { content: ''; position: absolute; left: 0.03em; bottom: -0.04em; width: 0.06em; height: 0.82em; background: currentColor; animation: ca-parpadeo 0.9s steps(1) infinite; }
@keyframes ca-parpadeo { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ca-cifras .ty-k::after { animation: none; } }
.ca-cuadro--v .ca-cifras { left: 6cqw; right: 6cqw; top: 60.5cqw; grid-template-columns: 1fr; row-gap: 4.4cqw; }
.ca-cuadro--v .ca-cifras .cif { gap: 1.4cqw; }
.ca-cuadro--v .ca-cifras .rot { font-size: max(0.75rem, 2.9cqw); }
.ca-cuadro--v .ca-cifras .gde { font-size: max(2.5rem, 19cqw); }
.ca-cuadro--v .ca-cifras .gde--t { font-size: max(1.75rem, 11.5cqw); white-space: normal; }

/* boton secundario "Ver mas casos" (lleva a portfolio/) */
.ca-boton { position: absolute; z-index: 6; left: var(--ca-izq); top: 46cqw; display: inline-flex; align-items: center; gap: 0.8cqw; padding: 1cqw 1.6cqw; border-radius: 0.45cqw; border: 0.14cqw solid #0b0f1e; color: #0b0f1e; font-weight: 600; font-size: max(0.9375rem, 1.3cqw); line-height: 1; background: rgba(251, 250, 246, 0.6); text-decoration: none; }
.ca-boton { transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease); }
.ca-boton u { text-decoration: none; font-family: var(--f-display); transition: transform var(--medio) var(--ease); }
/* hover solo con puntero fino (el tactil dispara falsos hover al tocar); el clic responde al instante con un 0,97 */
@media (hover: hover) and (pointer: fine) {
  .ca-boton:hover { background: #0b0f1e; color: #e6e6e1; }
  .ca-boton:hover u { transform: translateX(4px); }
}
.ca-boton:active { transform: scale(0.97); }
.ca-boton:focus-visible { outline: 2px solid #0a8fd0; outline-offset: 4px; }
.ca-cuadro--v .ca-boton { left: 6cqw; top: 152cqw; gap: 2cqw; padding: 3.4cqw 4.4cqw; border-radius: 1.5cqw; border-width: 0.5cqw; font-size: max(1rem, 4.3cqw); }

/* Cabecera: FUNDIDA con el fondo en el hero (oscuro) y en la seccion clara; sin franja ni borde. El cambio de tema (texto claro ->
   tinta -> oscura de siempre) solo ocurre mientras el logo y el boton estan a opacidad 0 (js/caso-aited.js): nunca un salto de color. */
.hm-cabecera.hm-cabecera--sobre,
.hm-cabecera.hm-cabecera--sobre.is-scroll,
.hm-cabecera.hm-cabecera--clara,
.hm-cabecera.hm-cabecera--clara.is-scroll { background: transparent; border-bottom-color: transparent; }
.hm-cabecera--clara .marca__nombre { color: #0b0f1e; }

/* ======================================================================== *
 * 2. VIVO: seccion fijada, un cuadro con las escenas apiladas
 * ======================================================================== */
@media screen {
  html.ca-vivo .ca-estatico { display: none; }
  html.ca-vivo .ca-pista {
    display: block;
    position: relative;
    height: calc(100vh + var(--ca-recorrido) + var(--ca-salida));
    height: calc(100svh + var(--ca-recorrido) + var(--ca-salida));
  }
  html.ca-vivo .ca-escenario {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    container-type: inline-size;
    background: #e6e6e1;
    pointer-events: none; /* solo el boton final recibe clics (y solo cuando se ve) */
  }
  /* Antes del destello el escenario esta puesto pero enmascarado del todo; js/caso-aited.js escribe la mascara (un circulo con borde
     blando que crece desde la pantalla del portatil) y la quita cuando ya cubre. */
  html.hh-vivo.ca-vivo .ca-escenario {
    -webkit-mask-image: radial-gradient(circle at 62% 40%, #000 0, #000 0, transparent 1px);
    mask-image: radial-gradient(circle at 62% 40%, #000 0, #000 0, transparent 1px);
  }
  html.ca-vivo .ca-fondo--escena { display: block; }
  html.ca-vivo .ca-fondo--esc { display: none; }
  /* La reticula de puntos pasa a ser un canvas que reacciona al raton (js); sin el, queda la de css. */
  html.ca-puntos-on .ca-fondo--escena::before { display: none; }
  .ca-puntos { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
  html.ca-vivo .ca-cuadro {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(100cqw, 177.78vh);
    width: min(100cqw, 177.78svh);
    aspect-ratio: 16 / 9;
    transform: translate(-50%, -50%);
    container-type: inline-size;
  }
  html.ca-vivo .ca-cuadro--v { display: none; width: min(100cqw, 56.25vh); width: min(100cqw, 56.25svh); aspect-ratio: 9 / 16; }
  @media (max-aspect-ratio: 1/1) {
    html.ca-vivo .ca-cuadro--h { display: none; }
    html.ca-vivo .ca-cuadro--v { display: block; }
  }
  html.ca-vivo .ca-boton { pointer-events: none; }
  html.ca-vivo .ca-boton.is-activo { pointer-events: auto; }

  /* barra de progreso continua, igual que la del hero pero en tinta */
  html.ca-vivo .ca-avance {
    display: block;
    position: absolute;
    z-index: 7;
    left: var(--ca-izq);
    bottom: max(3.3cqw, env(safe-area-inset-bottom));
    width: 240px;
    height: 2px;
    border-radius: 1px;
    background: rgba(11, 15, 30, 0.22);
    pointer-events: none;
  }
  .ca-avance__relleno { display: block; width: 100%; height: 100%; border-radius: 1px; background: #0b0f1e; transform-origin: 0 50%; transform: scaleX(0); }
  @media (max-aspect-ratio: 1/1) {
    html.ca-vivo .ca-avance { left: 5.5cqw; bottom: max(6cqw, env(safe-area-inset-bottom)); width: 45cqw; }
    /* Tiempo 1 en vertical: la tarjeta "El caso AiTed" centrada entre el final del titular (0,684 del ancho del cuadro por debajo de
       su borde superior) y la barra de progreso (a max(6vw, safe-area) del borde inferior del escenario). El cuadro 9:16 mide
       min(100vw, 56,25svh) de ancho y va centrado en el escenario de 100svh, asi que el mismo calculo vale con la barra de Safari
       visible u oculta y a cualquier alto. Alto de la tarjeta = 0,70 del ancho del cuadro. */
    html.ca-vivo .ca-cuadro--v .ca-caso--centro {
      top: calc(0.4365 * min(100vw, 56.25vh) + 25vh - max(6vw, env(safe-area-inset-bottom)) / 2 - 1px);
      top: calc(0.4365 * min(100vw, 56.25svh) + 25svh - max(6vw, env(safe-area-inset-bottom)) / 2 - 1px);
    }
  }
}

/* Solo mide el scroll de la salida (js/caso-aited.js lee su alto). */
.ca-salida { display: none; }
html.ca-vivo .ca-salida { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: var(--ca-salida); visibility: hidden; pointer-events: none; }
/* Version estatica: corte suave de la ultima escena clara al fondo oscuro. */
.ca-corte { height: clamp(120px, 22vh, 260px); background: linear-gradient(180deg, #e6e6e1 0%, #b9bbbd 20%, #5d6573 50%, #1c2335 80%, var(--base) 100%); pointer-events: none; }
html.ca-vivo .ca-corte { display: none; }

/* ======================================================================== *
 * TACTIL (iPhone, iPad, movil): lo que pesa se recorta. html.hm-tactil lo pone el <head> de index.html con (pointer: coarse).
 * En escritorio ninguna de estas reglas aplica y la pagina queda exactamente igual.
 *  - Destello: el circulo se recorta con clip-path y el borde blando es un disco que se escala con transform (js/caso-aited.js), en vez de
 *    una mascara de degradado que se rasteriza a pantalla completa cada cuadro.
 *  - Sin grano a pantalla completa ni manchas animadas.
 *  - Sombras de menos radio (cada sombra grande agranda la capa y su rasterizado).
 *  - Cada pieza que se mueve con el scroll va en su propia capa de GPU: moverla es solo componer, no repintar el escenario.
 * ======================================================================== */
html.hm-tactil.hh-vivo.ca-vivo .ca-escenario { -webkit-mask-image: none; mask-image: none; background: transparent; }
html.hm-tactil .ca-recorte {
  position: absolute;
  inset: 0;
  background: #e6e6e1;
  -webkit-clip-path: circle(0px at 62% 40%);
  clip-path: circle(0px at 62% 40%);
}
/* Disco de borde blando del destello: degradado fijo de 300 px que js/caso-aited.js traslada y escala (solo transform). */
html.hm-tactil .ca-halo {
  position: absolute;
  left: 0;
  top: 0;
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  transform: scale(0);
  background: radial-gradient(closest-side, #e6e6e1 0, #e6e6e1 72%, rgba(230, 230, 225, 0) 100%);
}
html.hm-tactil .ca-fondo::after { display: none; }
html.hm-tactil .ca-fondo i { will-change: auto; }
html.hm-tactil .ca-hoja, html.hm-tactil .ca-plat, html.hm-tactil .ca-auto, html.hm-tactil .ca-sat {
  box-shadow: 0 0 0 1px rgba(11, 15, 30, 0.13), 0 0.5em 1em -0.7em rgba(11, 15, 30, 0.45);
}
html.hm-tactil .ca-sistema .ventana { box-shadow: 0 0 0 0.16em #0a8fd0, 0 0 1.6em 0.1em rgba(10, 143, 208, 0.4); }
html.hm-tactil .ca-caso { box-shadow: 0 0 0 1px rgba(11, 15, 30, 0.12), 0.5em 0.7em 1.2em -0.8em rgba(11, 15, 30, 0.4); }
html.hm-tactil.ca-vivo .ca-cuadro .ca-actor,
html.hm-tactil.ca-vivo .ca-cuadro [data-v] { will-change: transform, opacity; }

@media print {
  .ca-esc { break-inside: avoid; }
  .ca-corte { display: none; }
}
