/* ============================================================
   LA CADENA — componente rector ROCALDE (F1 · 2026-09-23)
   Problema → Captación → Experiencia → Conversión → Seguimiento.
   Un solo lenguaje: visor de cámara (esquinas) + riel + señal.
   Solo anima transform / opacity (y el trazo del arco, una vez).
   Estado por defecto del HTML = recorrido completo: sin JS o con
   reduced-motion se ve la cadena terminada, nunca vacía.
   Modos: data-rh-chain="story" (coreografía) · "static" (sello).
   ============================================================ */

.rocalde-home .rh-chain {
  --c-ok: var(--rh-orange, #F26A1B);
  --c-try: var(--rh-teal, #1E9BC4);
  --c: var(--c-ok);
  --c-dim: rgba(198, 214, 226, 0.26);
  --c-lost: rgba(198, 214, 226, 0.42);
  --mk: 18px;
  --arc: 30px;
  position: relative;
  color: var(--rh-text-on-dark, #F4F7FA);
  font-family: var(--rh-font);
}
.rocalde-home .rh-chain[data-phase="idle"],
.rocalde-home .rh-chain[data-phase="fail"] { --c: var(--c-try); }

.rocalde-home .rh-chain__sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- cabecera: fase + mensaje + repetir ---- */
.rocalde-home .rh-chain__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 22px;
}
.rocalde-home .rh-chain__kicker {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--rh-text-dim-on-dark, rgba(198, 214, 226, 0.72));
}
.rocalde-home .rh-chain__led {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--c);
  box-shadow: 0 0 10px var(--c);
  transition: background-color .4s ease, box-shadow .4s ease;
}
.rocalde-home .rh-chain__phase { color: #fff; transition: opacity .25s ease; }
.rocalde-home .rh-chain__msg {
  letter-spacing: 0.02em; text-transform: none; font-weight: 500; font-size: 13.5px;
  transition: opacity .25s ease;
}
.rocalde-home .rh-chain.is-swap .rh-chain__phase,
.rocalde-home .rh-chain.is-swap .rh-chain__msg { opacity: 0; }

.rocalde-home .rh-chain__replay {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 12px/1 var(--rh-font); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--rh-text-dim-on-dark, rgba(198, 214, 226, 0.72));
  background: none; border: 1px solid var(--rh-line-on-dark, rgba(214, 222, 227, 0.13));
  border-radius: 999px; padding: 7px 12px; cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease, color .2s ease, border-color .2s ease;
}
.rocalde-home .rh-chain.is-ended .rh-chain__replay { opacity: 1; pointer-events: auto; }
.rocalde-home .rh-chain__replay:hover,
.rocalde-home .rh-chain__replay:focus-visible { color: #fff; border-color: rgba(242, 106, 27, 0.6); }
.rocalde-home .rh-chain__replay svg { width: 13px; height: 13px; }

/* ---- pista: arco + riel + estaciones ---- */
.rocalde-home .rh-chain__track {
  position: relative;
  padding-top: var(--arc);
  margin-top: 8px;
}
.rocalde-home .rh-chain__stations {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
/* el riel une el centro de la 1ª estación con el de la 5ª */
.rocalde-home .rh-chain__rail {
  position: absolute; left: 10%; right: 10%;
  top: calc(var(--arc) + var(--mk) / 2);
  height: 0; pointer-events: none;
}
.rocalde-home .rh-chain__seg {
  position: absolute; top: 0; width: 25%; height: 0;
}
.rocalde-home .rh-chain__seg:nth-child(1) { left: 0; }
.rocalde-home .rh-chain__seg:nth-child(2) { left: 25%; }
.rocalde-home .rh-chain__seg:nth-child(3) { left: 50%; }
.rocalde-home .rh-chain__seg:nth-child(4) { left: 75%; }
/* tramo vacío: trazo punteado, lo que existe "de palabra" */
.rocalde-home .rh-chain__seg::before {
  content: ""; position: absolute; left: calc(var(--mk) / 2 + 4px); right: calc(var(--mk) / 2 + 4px);
  top: -0.5px; height: 1px;
  background: repeating-linear-gradient(90deg, var(--c-dim) 0 4px, transparent 4px 9px);
}
/* el corte: entre Experiencia y Conversión no hay nada que tome la consulta */
.rocalde-home .rh-chain__seg--break::before {
  -webkit-mask-image: linear-gradient(90deg, #000 0 34%, transparent 34% 66%, #000 66%);
          mask-image: linear-gradient(90deg, #000 0 34%, transparent 34% 66%, #000 66%);
}
/* tramo construido: línea continua que se suelda de izquierda a derecha */
.rocalde-home .rh-chain__seg::after {
  content: ""; position: absolute; left: calc(var(--mk) / 2 + 3px); right: calc(var(--mk) / 2 + 3px);
  top: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--c), rgba(242, 106, 27, 0.75));
  box-shadow: 0 0 12px rgba(242, 106, 27, 0.45);
  transform: scaleX(1); transform-origin: 0 50%;
  transition: transform .42s cubic-bezier(0.65, 0, 0.35, 1);
}
.rocalde-home .rh-chain:not([data-phase="done"]) .rh-chain__seg:not(.is-built)::after { transform: scaleX(0); }

/* arco de seguimiento: la consulta vuelve a la relación (5 → 2).
   Un div con borde elíptico; se revela de derecha a izquierda una vez. */
.rocalde-home .rh-chain__arc {
  position: absolute; left: 25%; right: 0;
  bottom: calc(var(--mk) / 2 + 3px);
  height: calc(var(--arc) - 8px);
  border: 1.25px solid rgba(242, 106, 27, 0.6); border-bottom: 0;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  clip-path: inset(0 0 0 0);
  transition: clip-path .9s cubic-bezier(0.65, 0, 0.35, 1), opacity .3s ease;
}
/* punta: la relación vuelve a entrar por captación */
.rocalde-home .rh-chain__arc::after {
  content: ""; position: absolute; left: -4px; bottom: -3px;
  border: 4px solid transparent; border-top: 6px solid rgba(242, 106, 27, 0.8); border-bottom: 0;
}
.rocalde-home .rh-chain:not([data-phase="done"]) .rh-chain__arc { clip-path: inset(0 0 0 100%); opacity: 0; transition-duration: .2s; }

/* la señal: una consulta concreta viajando por el riel */
.rocalde-home .rh-chain__token {
  position: absolute; left: 0; top: 0;
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 18px 2px var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent), 0 0 18px 2px var(--c);
  opacity: 0;
  will-change: transform, opacity;
}
.rocalde-home .rh-chain__token::before {
  content: ""; position: absolute; right: 6px; top: 50%;
  width: 46px; height: 2px; margin-top: -1px;
  background: linear-gradient(90deg, transparent, var(--c));
  opacity: 0; transition: opacity .2s ease;
}
.rocalde-home .rh-chain__token.is-moving::before { opacity: 0.8; }
.rocalde-home .rh-chain[data-phase="done"] .rh-chain__token { opacity: 1; }

/* ---- estación: visor + nombre + estado ---- */
.rocalde-home .rh-chain__st {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  min-width: 0;
}
.rocalde-home .rh-chain__mk {
  position: relative; width: var(--mk); height: var(--mk);
  color: var(--c-dim);
  /* esquinas de visor dibujadas con 8 gradientes: un solo nodo, sin SVG */
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 5px 1.5px,
    linear-gradient(currentColor, currentColor) 0 0 / 1.5px 5px,
    linear-gradient(currentColor, currentColor) 100% 0 / 5px 1.5px,
    linear-gradient(currentColor, currentColor) 100% 0 / 1.5px 5px,
    linear-gradient(currentColor, currentColor) 0 100% / 5px 1.5px,
    linear-gradient(currentColor, currentColor) 0 100% / 1.5px 5px,
    linear-gradient(currentColor, currentColor) 100% 100% / 5px 1.5px,
    linear-gradient(currentColor, currentColor) 100% 100% / 1.5px 5px;
  background-repeat: no-repeat;
  transition: color .35s ease, transform .5s cubic-bezier(0.22, 1, 0.36, 1);
}
.rocalde-home .rh-chain__mk i {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: currentColor;
  transition: transform .35s ease, box-shadow .35s ease;
}
.rocalde-home .rh-chain__name {
  margin-top: 14px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--rh-text-dim-on-dark, rgba(198, 214, 226, 0.72));
  white-space: nowrap;
  transition: color .35s ease;
}
.rocalde-home .rh-chain__name b { font-weight: 500; color: var(--c-dim); margin-right: 6px; letter-spacing: 0.04em; }
.rocalde-home .rh-chain__note {
  margin-top: 6px; min-height: 1.4em;
  font-size: 13px; line-height: 1.35; color: var(--rh-text-dim-on-dark, rgba(198, 214, 226, 0.72));
  opacity: 0; transform: translateY(4px);
  transition: opacity .3s ease, transform .3s ease, color .3s ease;
}

/* encendida: la consulta pasó por aquí */
.rocalde-home .rh-chain__st.is-on .rh-chain__mk,
.rocalde-home .rh-chain[data-phase="done"] .rh-chain__mk { color: var(--c); }
.rocalde-home .rh-chain__st.is-on .rh-chain__mk i,
.rocalde-home .rh-chain[data-phase="done"] .rh-chain__mk i { box-shadow: 0 0 12px var(--c); }
.rocalde-home .rh-chain__st.is-on .rh-chain__name,
.rocalde-home .rh-chain[data-phase="done"] .rh-chain__name { color: #fff; }
.rocalde-home .rh-chain__st.is-on .rh-chain__note,
.rocalde-home .rh-chain[data-phase="done"] .rh-chain__note { opacity: 1; transform: none; }
/* el eslabón donde se pierde */
.rocalde-home .rh-chain__st.is-lost .rh-chain__mk { color: var(--c-lost); transform: rotate(45deg) scale(.8); }
.rocalde-home .rh-chain__st.is-lost .rh-chain__mk i { transform: scale(0); }
.rocalde-home .rh-chain__st.is-lost .rh-chain__name { color: rgba(244, 247, 250, 0.55); }
.rocalde-home .rh-chain__st.is-lost .rh-chain__note { opacity: 1; transform: none; color: rgba(244, 247, 250, 0.62); font-style: italic; }
/* estructura construida pero aún sin recorrer: visor cerrado a media luz */
.rocalde-home .rh-chain[data-phase="weld"] .rh-chain__st.is-lock .rh-chain__mk,
.rocalde-home .rh-chain[data-phase="success"] .rh-chain__mk { color: rgba(242, 106, 27, 0.5); }
.rocalde-home .rh-chain[data-phase="success"] .rh-chain__name b { color: rgba(242, 106, 27, 0.6); }
/* soldadura: el visor se cierra sobre el eslabón al construirlo */
.rocalde-home .rh-chain__st.is-lock .rh-chain__mk { animation: rh-chain-lock .55s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes rh-chain-lock {
  from { transform: scale(1.7); opacity: .4; }
  to   { transform: scale(1);   opacity: 1; }
}
/* destino: seguimiento, único eslabón con peso propio al final */
.rocalde-home .rh-chain[data-phase="done"] .rh-chain__st:last-child .rh-chain__mk i { transform: scale(1.35); }

/* línea viva (solo móvil): narra el paso actual en un único lugar */
.rocalde-home .rh-chain__live { display: none; }

/* ---- en el hero: ocupa todo el ancho, reemplaza las viñetas ---- */
.rocalde-home .rh-hero--chain .rh-hero__ctas { margin-bottom: 0; }
.rocalde-home .rh-hero--chain .rh-hero__inner { row-gap: clamp(24px, 3.6vh, 36px); }
.rocalde-home .rh-hero__inner > .rh-chain {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rh-line-on-dark, rgba(214, 222, 227, 0.13));
  padding-top: 18px;
}
@media (min-width: 901px) {
  /* el título gana ancho (4 líneas, no 5) para que la cadena entre en el primer pantallazo */
  .rocalde-home .rh-hero--chain .rh-hero__inner {
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
    padding-top: clamp(56px, 7.5vh, 104px);
    padding-bottom: clamp(44px, 6vh, 80px);
  }
  .rocalde-home .rh-hero--chain .rh-hero__title { font-size: clamp(40px, 4.3vw, 62px); max-width: 22ch; margin-bottom: 18px; }
  .rocalde-home .rh-hero--chain .rh-hero__sub { margin-bottom: 26px; }
}

/* ---- Galaxy / móvil ---- */
@media (max-width: 900px) {
  /* el claim y su demostración juntos: título → cadena → texto → CTA */
  .rocalde-home .rh-hero--chain .rh-hero__inner { row-gap: 0; padding-top: 64px; padding-bottom: 56px; }
  .rocalde-home .rh-hero--chain .rh-hero__copy { display: contents; }
  .rocalde-home .rh-hero--chain .rh-hero__copy > .rh-eyebrow { order: 1; }
  .rocalde-home .rh-hero--chain .rh-hero__title { order: 2; margin-bottom: 0; }
  .rocalde-home .rh-hero__inner > .rh-chain { order: 3; margin: 22px 0 24px; padding-top: 16px; }
  .rocalde-home .rh-hero--chain .rh-hero__sub { order: 4; margin-bottom: 24px; }
  .rocalde-home .rh-hero--chain .rh-hero__ctas { order: 5; }
  .rocalde-home .rh-hero--chain .rh-hero__emblem { margin-bottom: 8px; }
  .rocalde-home .rh-hero--chain .rh-emblem__core { width: clamp(120px, 34vw, 170px); }
}
@media (max-width: 640px) {
  .rocalde-home .rh-chain { --mk: 16px; --arc: 24px; }
  .rocalde-home .rh-chain__msg { display: none; }
  .rocalde-home .rh-chain__kicker { font-size: 11px; }
  .rocalde-home .rh-chain__replay span { display: none; }
  .rocalde-home .rh-chain__replay { padding: 7px 9px; }
  .rocalde-home .rh-chain__name { margin-top: 10px; font-size: 10.5px; letter-spacing: 0.02em; text-transform: none; font-weight: 600; }
  .rocalde-home .rh-chain__name b { display: none; }
  .rocalde-home .rh-chain__note { display: none; }
  .rocalde-home .rh-chain__live {
    display: block; margin: 12px 0 0; min-height: 1.4em;
    font-size: 14px; font-weight: 500; color: #fff;
    transition: opacity .2s ease;
  }
  .rocalde-home .rh-chain__live.is-lost { color: rgba(244, 247, 250, 0.62); font-style: italic; }
  .rocalde-home .rh-chain__live.is-swap { opacity: 0; }
  .rocalde-home .rh-chain__live:empty { visibility: hidden; }
  .rocalde-home .rh-chain__live::before {
    content: ""; display: inline-block; width: 14px; height: 1.5px; margin: 0 8px 4px 0;
    background: var(--c); vertical-align: middle;
  }
}

/* ---- movimiento reducido: estado final, sin coreografía ---- */
@media (prefers-reduced-motion: reduce) {
  .rocalde-home .rh-chain *,
  .rocalde-home .rh-chain *::before,
  .rocalde-home .rh-chain *::after { transition: none !important; animation: none !important; }
}
