/* Historia en flujo: el flujo «Así lo resolvemos» (cajas con flechas) y los globos de diálogo. No hacen falta para la
   primera pintura: la hoja va en el cuerpo, justo antes del flujo, y no frena lo que está arriba. Solo se animan
   estados de color y sombra. */

/* ---- Flujo: lista ordenada en cuadrícula. «El problema», 1, 2 (con rama) y 3 (con vuelta) ---- */
.hf-flujo { padding: 3rem 0; }
.hf-flujo h2 { margin: 0 0 1.5rem; }
.hf-lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.25rem; }
.hf-caja { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 1rem 1rem 1rem 3.4rem; min-height: 8rem; transition: border-color .3s, box-shadow .3s; }
.hf-caja h3 { margin: 0 0 .35rem; font-size: 1.02rem; font-weight: 400; line-height: 1.3; color: var(--navy); }
.hf-caja p { margin: 0; font-size: .9rem; line-height: 1.5; color: var(--text-2); }
.hf-n { position: absolute; left: 1rem; top: 1rem; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--blue-tint);
  color: var(--navy); display: grid; place-items: center; font-size: .85rem; transition: background-color .3s, color .3s; }
.hf-caja--problema { padding-left: 1rem; border-color: var(--danger-line); background: var(--danger-tint); }
.hf-et { display: block; margin-bottom: .3rem; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--danger); }
.hf-caja.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.hf-caja.on > .hf-n { background: var(--accent-btn); color: var(--on-accent); }
.hf-caja--problema.on { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-line); }

/* flecha en el hueco entre cajas (decoración: no la leen los lectores de pantalla) */
.hf-lista > .hf-caja:not(:last-child)::after { content: '\2192' / ''; position: absolute; right: -1.7rem; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 1.15rem; line-height: 1; }

/* 5 cajas (el problema y 4 pasos) en pantalla ancha: el problema ocupa la fila de arriba con su flecha hacia abajo y los
   4 pasos van en una sola fila debajo, sin un paso suelto en una segunda fila */
@media (min-width: 1101px) {
  .hf-lista:has(> .hf-caja:nth-child(5):last-child) > .hf-caja--problema { grid-column: 1 / -1; }
  .hf-lista:has(> .hf-caja:nth-child(5):last-child) > .hf-caja--problema::after { content: '\2193' / ''; right: auto; left: 50%; top: auto;
    bottom: -1.75rem; transform: translateX(-50%); }
  /* 6 cajas (el problema y 5 pasos): dos filas parejas de 3; la fila de arriba no apunta al borde y la de abajo sigue
     el orden de lectura, con los números de cada paso */
  .hf-lista:has(> .hf-caja:nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hf-lista:has(> .hf-caja:nth-child(6):last-child) > .hf-caja:nth-child(3)::after { content: none; }
}

/* rama: «¿se resuelve a distancia?» con dos salidas */
.hf-rama { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.hf-rama > li { font-size: .78rem; line-height: 1.35; color: var(--text-2); border: 1px dashed var(--blue-line); border-radius: var(--radius-sm);
  padding: .35rem .5rem; transition: border-color .3s, background-color .3s; }
.hf-rama > li b { display: block; font-weight: 400; color: var(--navy); }
.hf-rama > li.on { border: 1px solid var(--accent); background: var(--accent-tint); }

/* vuelta en ciclo: el último paso regresa a «Operamos» */
.hf-vuelta { display: flex; align-items: center; gap: .35rem; margin-top: .6rem; font-size: .8rem; color: var(--accent-ink); }
.hf-vuelta svg { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.hf-vuelta.on { font-weight: 700; }

@media (max-width: 1100px) { .hf-lista { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.25rem 2rem; }
  .hf-lista > .hf-caja:nth-child(2n)::after { content: none; } }
@media (max-width: 760px) {
  .hf-lista { grid-template-columns: 1fr; gap: 1.9rem; }
  .hf-lista > .hf-caja:not(:last-child)::after { content: '\2193' / ''; right: auto; left: 50%; top: auto; bottom: -1.75rem; transform: translateX(-50%); }
  .hf-lista > .hf-caja:nth-child(2n):not(:last-child)::after { content: '\2193' / ''; }
  .hf-flujo { padding: 2.25rem 0; }
}

/* ---- Globos de diálogo sobre los muñecos: mismo estilo que el mensajito del botón de contacto (.ct-teaser) ---- */
.hf-globos { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.hf-globo { position: absolute; left: 0; top: 0; max-width: 11.5rem; padding: 7px 12px; background: var(--surface); color: var(--navy);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: .86rem; line-height: 1.3; text-align: center;
  animation: hf-globo-in .25s var(--ease) both; }
.hf-globo::after { content: ''; position: absolute; left: var(--cola, 50%); bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: var(--surface);
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg); }
@keyframes hf-globo-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 760px) { .hf-globo { max-width: 8.5rem; padding: 5px 9px; font-size: .74rem; } }
@media (prefers-reduced-motion: reduce) { .hf-globos { display: none; } }

/* movimiento reducido: sin iluminación; el flujo se ve completo y quieto */
@media (prefers-reduced-motion: reduce) { .hf-caja, .hf-n, .hf-rama > li { transition: none; } }
