/* ============================================================
   Daner Solar · Recorrido 3D de bombeo solar
   Usa los tokens de la web (variables.css) con valores de respaldo.
   Día por defecto; Noche con html[data-theme="dark"].
   Portada: el modelo gira solo y la página se desplaza normal.
   Explorar: pantalla completa (no mueve la página ni deja hueco).
   ============================================================ */
.recorrido-bombeo {
  --rb-fondo: linear-gradient(180deg, #e3eef7 0%, #f1f6fa 60%, #e7edf2 100%);
  --rb-titulo: var(--noche, #082640);
  --rb-texto: var(--texto, #3b4f63);
  --rb-suave: var(--tinta-suave, #52657a);
  --rb-acento: var(--sol-texto, #a85300);
  --rb-panel: rgba(255, 255, 255, 0.94);
  --rb-borde: rgba(8, 38, 64, 0.12);
  --rb-sombra: 0 14px 34px rgba(8, 38, 64, 0.16), 0 2px 6px rgba(8, 38, 64, 0.08);
  --rb-etq-fondo: rgba(255, 255, 255, 0.97);
  --rb-etq-texto: var(--noche, #082640);
  --rb-punto: var(--sol, #fe9216);
  --rb-linea: rgba(8, 38, 64, .8);
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 300px;
}
:root[data-theme="dark"] .recorrido-bombeo {
  --rb-fondo: radial-gradient(120% 90% at 70% 0%, #163d61 0%, #0a2845 46%, #061a2d 100%);
  --rb-titulo: #ffffff;
  --rb-texto: #e3ecf5;
  --rb-suave: #a6c0d6;
  --rb-acento: var(--sol, #fe9216);
  --rb-panel: rgba(7, 27, 47, 0.94);
  --rb-borde: rgba(126, 178, 224, 0.26);
  --rb-sombra: 0 14px 36px rgba(0, 0, 0, 0.45);
  --rb-etq-fondo: rgba(6, 26, 45, 0.95);
  --rb-etq-texto: #ffffff;
  --rb-linea: rgba(255, 255, 255, .92);
}

/* El marco es lo que se va a pantalla completa; la sección conserva su lugar en la página */
.rb-marco {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: 1fr;
  border-radius: 14px; overflow: hidden; isolation: isolate;
  background: var(--rb-fondo); box-shadow: var(--rb-sombra);
}
.rb-escenario { position: relative; min-height: 0; outline: none; cursor: pointer; touch-action: pan-y; }
.rb-escenario:focus-visible { box-shadow: inset 0 0 0 3px var(--azul-vivo, #008eff); }
.rb-poster, .rb-lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rb-poster img, img.rb-poster { width: 100%; height: 100%; object-fit: cover; display: block; }
.rb-poster { transition: opacity .6s ease; }
.recorrido-bombeo.is-listo .rb-poster { opacity: 0; pointer-events: none; }
.rb-lienzo { opacity: 0; transition: opacity .6s ease; }
.recorrido-bombeo.is-listo .rb-lienzo { opacity: 1; }

/* ---------- Portada ---------- */
.rb-portada {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; justify-items: start; gap: 10px;
  padding: 72px 26px 24px;
  background: linear-gradient(180deg, rgba(5, 25, 43, 0) 0%, rgba(5, 25, 43, .55) 45%, rgba(5, 25, 43, .82) 100%);
  pointer-events: none;
  transition: opacity .35s ease;
}
.recorrido-bombeo .rb-portada__titulo {
  margin: 0; max-width: 22ch; color: #fff;
  font: 700 clamp(1.25rem, 2.1vw, 1.75rem)/1.15 var(--f-display, "Space Grotesk", Arial, sans-serif);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
.recorrido-bombeo .rb-portada__sub { margin: 0; max-width: 46ch; color: #e3ecf5; font: 400 .95rem/1.45 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); }
.rb-activar {
  pointer-events: auto; position: relative; margin-top: 6px;
  font: 600 1rem/1 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif);
  padding: .95rem 1.35rem; border: 0; border-radius: 6px; cursor: pointer;
  color: var(--noche, #082640); background: var(--sol, #fe9216);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28), inset 0 -2px 0 rgba(0, 0, 0, .12);
}
.rb-activar:hover { background: var(--sol-600, #e97d05); }
.rb-activar:focus-visible { outline: 3px solid var(--azul-vivo, #008eff); outline-offset: 3px; }
/* parpadeo suave: un halo que crece y se apaga, para invitar al clic sin molestar */
.rb-activar::after {
  content: ""; position: absolute; inset: -3px; border-radius: 9px; pointer-events: none;
  border: 2px solid rgba(254, 146, 22, .8); opacity: 0;
}
/* el halo arranca con la primera interacción de la persona (ver recorrido-carga.js) */
.con-interaccion .rb-activar::after { animation: rbHalo 2.4s ease-out infinite; }
@keyframes rbHalo {
  0% { transform: scale(1); opacity: .9; }
  70% { transform: scale(1.12, 1.35); opacity: 0; }
  100% { transform: scale(1.12, 1.35); opacity: 0; }
}
.recorrido-bombeo.is-cargando .rb-activar { cursor: progress; }

/* Marca de agua de Daner Solar: arriba a la derecha en la portada, abajo a la derecha al explorar */
.rb-marca { position: absolute; right: 16px; top: 14px; width: 104px; height: auto; pointer-events: none; opacity: .9; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35)); }
.rb--explorando .rb-marca { top: auto; bottom: 14px; }
.rb-marca--noche { display: none; }
:root[data-theme="dark"] .rb-marca--dia { display: none; }
:root[data-theme="dark"] .rb-marca--noche { display: block; }

/* Carga */
.rb-carga {
  position: absolute; left: 50%; top: 18px; width: min(240px, 50%); height: 4px;
  transform: translateX(-50%); border-radius: 3px; background: rgba(255, 255, 255, .25); overflow: hidden;
  opacity: 0; transition: opacity .3s;
}
.recorrido-bombeo.is-cargando .rb-carga { opacity: 1; }
.rb-carga__barra { display: block; height: 100%; background: var(--rb-punto); transform-origin: left; transform: scaleX(0.04); transition: transform .2s; }

/* Aviso de cómo usarlo y botón de salir (solo al explorar) */
.recorrido-bombeo .rb-aviso {
  position: absolute; left: 50%; top: 18px; transform: translate(-50%, -8px);
  max-width: min(640px, calc(100% - 140px)); margin: 0; padding: 12px 16px; border-radius: 8px;
  font: 500 .95rem/1.4 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); text-align: center;
  color: #fff; background: rgba(5, 25, 43, .88); box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  opacity: 0; pointer-events: none; transition: opacity .4s ease, transform .4s ease;
}
.rb-aviso.is-visible { opacity: 1; transform: translate(-50%, 0); }
.rb-salir {
  position: absolute; right: 16px; top: 14px; display: none;
  font: 600 .95rem/1 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif);
  padding: .7rem 1.05rem; border-radius: 6px; cursor: pointer;
  color: var(--rb-titulo); background: var(--rb-panel); border: 1px solid var(--rb-borde);
  box-shadow: 0 4px 12px rgba(8, 38, 64, .18);
}
.rb-salir:focus-visible { outline: 3px solid var(--azul-vivo, #008eff); outline-offset: 2px; }

/* ---------- Explorar: pantalla completa ---------- */
html.rb-sin-desplazar, html.rb-sin-desplazar body { overflow: hidden; }
/* Mientras se explora, los botones flotantes de la web (WhatsApp, Ing. Daner, aviso de cookies) no tapan los controles */
html.rb-sin-desplazar .wa-float, html.rb-sin-desplazar .asistente-lanzador, html.rb-sin-desplazar .asistente,
html.rb-sin-desplazar .aviso-cookies, html.rb-sin-desplazar .cookie-banner { visibility: hidden; }
.recorrido-bombeo.rb--explorando .rb-marco {
  position: fixed; inset: 0; z-index: 2147483000; border-radius: 0;
  grid-template-rows: minmax(0, 1fr) auto;
}
.rb--explorando .rb-escenario { cursor: grab; touch-action: none; }
.rb--explorando .rb-escenario:active { cursor: grabbing; }
.rb--explorando .rb-portada { opacity: 0; visibility: hidden; }
.rb--explorando .rb-salir { display: block; }
.rb-panel { display: none; }
.rb--explorando .rb-panel { display: grid; }

/* Etiquetas sobre el modelo */
.rb-etiquetas { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rb-etiqueta { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; transition: opacity .35s ease; will-change: transform; }
.rb-etiqueta.is-visible { opacity: 1; }
.rb-etiqueta[hidden] { display: none; }
.rb-etiqueta__punto {
  position: absolute; left: -5.5px; top: -5.5px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--rb-punto); box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 1px 4px rgba(0, 0, 0, .35);
}
.rb-etiqueta__linea { position: absolute; left: 0; top: -0.75px; height: 1.5px; transform-origin: 0 50%; background: var(--rb-linea); box-shadow: 0 0 2px rgba(0, 0, 0, .45); }
.rb-etiqueta__texto {
  position: absolute; left: 0; top: 0; display: block; padding: 7px 11px; border-radius: 6px;
  font: 600 .88rem/1.25 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif);
  color: var(--rb-etq-texto); background: var(--rb-etq-fondo); white-space: nowrap;
  box-shadow: 0 4px 14px rgba(8, 38, 64, .18); border: 1px solid var(--rb-borde);
}
.rb-etiqueta__nota { display: block; font-weight: 400; font-size: .8rem; color: var(--rb-acento); }

/* Pantallas angostas: puntos numerados sobre el modelo y leyenda en el panel */
.rb--numerado .rb-etiqueta__texto, .rb--numerado .rb-etiqueta__linea { display: none; }
.rb--numerado .rb-etiqueta__punto {
  left: -12px; top: -12px; width: 24px; height: 24px; display: grid; place-items: center;
  font: 700 .78rem/1 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); color: var(--noche, #082640);
}
.rb--numerado .rb-etiqueta__punto::after { content: attr(data-num); }
.rb-leyenda { display: none; margin: 10px 0 0; padding: 0; list-style: none; }
.rb--numerado .rb-leyenda { display: grid; gap: 6px; }
.recorrido-bombeo .rb-leyenda li { display: flex; gap: 8px; align-items: baseline; font: 400 .9rem/1.35 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); color: var(--rb-texto); }
.rb-leyenda__num {
  flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--rb-punto); color: var(--noche, #082640); font-weight: 700; font-size: .74rem;
}

/* Panel del paso */
.rb-panel {
  grid-template-columns: 1fr auto; gap: 14px 28px; align-items: end;
  padding: 18px 26px 20px; background: var(--rb-panel); border-top: 1px solid var(--rb-borde);
}
.rb-paso { max-width: 900px; }
.rb-paso__cabeza { display: flex; gap: 12px; align-items: baseline; margin-bottom: 4px; }
.rb-paso__num, .rb-paso__rotulo { font: 600 .84rem/1 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); font-variant-numeric: tabular-nums; }
.rb-paso__num { color: var(--rb-suave); }
.rb-paso__rotulo { color: var(--rb-acento); }
.rb-paso__titulo { margin: 0 0 6px; font: 700 clamp(1.15rem, 1.6vw, 1.45rem)/1.2 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); color: var(--rb-titulo); }
.recorrido-bombeo .rb-paso__texto { margin: 0; max-width: 70ch; font: 400 1rem/1.5 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); color: var(--rb-texto); }
.rb-controles { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.rb-botones { display: flex; gap: 8px; }
.rb-botones button {
  font: 600 .95rem/1 var(--f-cuerpo, "IBM Plex Sans", Arial, sans-serif); padding: .8rem 1.15rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--rb-borde); background: transparent; color: var(--rb-titulo); box-shadow: 0 2px 6px rgba(8, 38, 64, .10);
}
.rb-botones .rb-siguiente { background: var(--sol, #fe9216); border-color: var(--sol, #fe9216); color: var(--noche, #082640); min-width: 8em; }
.rb-botones button:disabled { opacity: .4; cursor: default; }
.rb-botones button:focus-visible, .rb-puntos button:focus-visible { outline: 3px solid var(--azul-vivo, #008eff); outline-offset: 2px; }
.rb-puntos { display: flex; gap: 4px; }
.rb-puntos button { width: 22px; height: 22px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
.rb-puntos button::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--rb-suave); opacity: .45; transition: transform .2s, opacity .2s, background .2s;
}
.rb-puntos button[aria-current="step"]::before { background: var(--rb-punto); opacity: 1; transform: scale(1.35); }
.rb-vivo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 760px) {
  .recorrido-bombeo { aspect-ratio: 4 / 3.4; min-height: 0; }
  .rb-marco { border-radius: 10px; }
  .rb-portada { padding: 40px 14px 14px; gap: 6px; background: linear-gradient(180deg, rgba(5, 25, 43, 0) 0%, rgba(5, 25, 43, .7) 40%, rgba(5, 25, 43, .86) 100%); }
  .recorrido-bombeo .rb-portada__titulo { font-size: 1.12rem; max-width: none; }
  .recorrido-bombeo .rb-portada__sub { display: none; }
  .rb-activar { padding: .85rem 1rem; }
  .rb-activar { width: 100%; text-align: center; }
  .rb-marca { width: 84px; right: 12px; }
  /* panel compacto: el texto se desplaza dentro y los botones quedan siempre abajo, a la mano */
  .rb-panel { grid-template-columns: 1fr; gap: 8px; padding: 12px 16px 0; max-height: 42dvh; overflow-y: auto; overscroll-behavior: contain; }
  .recorrido-bombeo .rb-paso__titulo { font-size: 1.08rem; margin-bottom: 4px; }
  .rb-controles { position: sticky; bottom: 0; gap: 8px; padding: 8px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--rb-panel); }
  .rb-puntos { order: -1; }
  .rb-botones button { padding: .9rem 1rem; font-size: 1rem; }
  .recorrido-bombeo .rb-leyenda li { font-size: .86rem; }
  .rb--numerado .rb-leyenda { gap: 4px; margin-top: 8px; }
  .recorrido-bombeo .rb-paso__texto { font-size: .92rem; line-height: 1.45; }
  .rb-controles { align-items: stretch; }
  .rb-botones button { flex: 1; }
  .rb-puntos { justify-content: center; flex-wrap: wrap; }
  .recorrido-bombeo .rb-aviso { top: auto; bottom: 12px; max-width: calc(100% - 24px); font-size: .88rem; padding: 10px 12px; }
  .recorrido-bombeo.rb--explorando .rb-marca { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .rb-etiqueta, .rb-poster, .rb-lienzo, .rb-aviso, .rb-portada { transition: none; }
  .rb-activar::after { animation: none; }
}
