/* ═══════════════════════════════════════════════════════════════════════
   /agencias — FORMA DE COLABORACIÓN (AgenciasGarantias)
   Bento de 5 tarjetas con escenas animadas. Prefijos propios:
     .ag-gar-*  rejilla y tarjeta (AgenciasGarantias / AgenciasGarantiaCard)
     .ag-gv-*   escenas (AgenciasGarantiasVisuales)
   No modifica .ag-card ni otros estilos globales.

   Ajustes rápidos: variables de .ag-gar-grid (colores, alto de escena).
   Las escenas usan container queries sobre .ag-gar-escena: su disposición
   depende del ancho de la tarjeta, no del viewport.
═══════════════════════════════════════════════════════════════════════ */

#garantias.ag-section--alt {
  background-color: rgba(11, 13, 15, 0.26);
}

.ag-gar-grid {
  --ag-gar-panel: #17191D;
  --ag-gar-panel-borde: rgba(255, 255, 255, 0.08);
  --ag-gar-tenue: #8C877F;          /* ≈ 4.9:1 sobre --ag-gar-panel */
  --ag-gar-raya: rgba(232, 227, 218, 0.14);
  --ag-gar-ambar: #D18A3D;          /* énfasis puntual (hito, respuestas) */
  --ag-gar-escena-h: 214px;

  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* Tablet: 2 columnas; la última tarjeta a todo el ancho */
@media (min-width: 640px) {
  .ag-gar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ag-gar-card--completa-tablet {
    grid-column: 1 / -1;
  }
}

/* Escritorio: 6 columnas · 4 + 2 · 2 + 2 + 2 */
@media (min-width: 1024px) {
  .ag-gar-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .ag-gar-card,
  .ag-gar-card--completa-tablet {
    grid-column: span 2;
  }

  .ag-gar-card--ancha {
    grid-column: span 4;
  }
}

@media (max-width: 639px) {
  .ag-gar-grid {
    --ag-gar-escena-h: 200px;
  }
}

/* ── TARJETA ───────────────────────────────────────────────────────── */
.ag-gar-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.ag-gar-escena {
  position: relative;
  flex: none;
  height: var(--ag-gar-escena-h);
  overflow: hidden;
  container-type: inline-size;
}

.ag-gar-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 22px 22px;
}

.ag-gar-texto {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ag-muted);
}

/* ── PIEZAS COMUNES DE LAS ESCENAS ─────────────────────────────────── */
.ag-gv {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 20px 12px;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ag-muted);
}

.ag-gv-icono {
  display: block;
}

.ag-gv-raya {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--ag-gar-raya);
}

.ag-gv-raya--corta {
  width: 62%;
}

/* Ficha que viaja: punto sobre la línea + etiqueta encima */
.ag-gv-ficha {
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 0;
}

.ag-gv-ficha__punto {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ag-accent);
  box-shadow: 0 0 0 3px rgba(200, 184, 149, 0.18);
}

.ag-gv-ficha__texto {
  position: absolute;
  left: 0;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 3px 8px;
  border: 1px solid var(--ag-border);
  border-radius: 999px;
  background: #1D1C19;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ag-text);
  white-space: nowrap;
}

.ag-gv-ficha--respuesta .ag-gv-ficha__punto {
  background: var(--ag-gar-ambar);
  box-shadow: 0 0 0 3px rgba(209, 138, 61, 0.2);
}

.ag-gv-ficha--respuesta .ag-gv-ficha__texto {
  border-color: rgba(209, 138, 61, 0.42);
  color: #EBCB9F;
}

/* ── 1. RELACIÓN CON EL CLIENTE ────────────────────────────────────── */
.ag-gv-rel__flujo {
  display: flex;
  align-items: flex-start;
  width: 100%;
  max-width: 540px;
}

.ag-gv-rel__nodo {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 88px;
}

.ag-gv-rel__marco {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}

.ag-gv-rel__icono {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--ag-gar-panel-borde);
  border-radius: 12px;
  background: var(--ag-gar-panel);
  color: var(--ag-muted);
}

.ag-gv-rel__nodo--agencia .ag-gv-rel__icono {
  width: 62px;
  height: 62px;
  border-color: rgba(200, 184, 149, 0.55);
  border-radius: 16px;
  background: #1B1A17;
  color: var(--ag-accent);
}

.ag-gv-rel__anillo {
  position: absolute;
  inset: -6px;
  border: 1px solid var(--ag-accent);
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
}

.ag-gv-rel__nombre {
  font-size: 12px;
  font-weight: 500;
  color: var(--ag-muted);
  white-space: nowrap;
}

.ag-gv-rel__nodo--agencia .ag-gv-rel__nombre {
  font-weight: 600;
  color: var(--ag-heading);
}

.ag-gv-rel__via {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  height: 64px;
}

/* Conexión: --d (0–1) la traza; no hay conexión Cliente–BIVIA */
.ag-gv-rel__linea {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: linear-gradient(90deg, rgba(200, 184, 149, 0.18), rgba(200, 184, 149, 0.55), rgba(200, 184, 149, 0.18));
  transform-origin: 0 50%;
  transform: scaleX(var(--d, 1));
}

/* Rótulo fijo de cada conexión (debajo de la línea) */
.ag-gv-rel__rotulo {
  position: absolute;
  left: 50%;
  top: calc(50% + 9px);
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--ag-gar-tenue);
  white-space: nowrap;
}

/* Tarjeta ancha (escritorio): nodos algo mayores */
@container (min-width: 560px) {
  .ag-gv-rel__nodo {
    width: 96px;
  }

  .ag-gv-rel__marco {
    width: 72px;
    height: 72px;
  }

  .ag-gv-rel__via {
    height: 72px;
  }

  .ag-gv-rel__icono {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }

  .ag-gv-rel__nodo--agencia .ag-gv-rel__icono {
    width: 70px;
    height: 70px;
    border-radius: 18px;
  }

  .ag-gv-rel__anillo {
    border-radius: 22px;
  }
}

/* Carril: ocupa toda la conexión; --av (0–1) lleva la ficha de un
   extremo al otro. Invisible en reposo. */
.ag-gv-rel__carril {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(calc(var(--av, 0) * 100%));
  pointer-events: none;
}

/* Tarjeta estrecha (tablet, móvil): el flujo se apila en vertical */
@container (max-width: 439px) {
  .ag-gv-rel__flujo {
    flex-direction: column;
    align-items: stretch;
    max-width: 250px;
  }

  .ag-gv-rel__nodo {
    flex-direction: row;
    gap: 12px;
    width: auto;
  }

  .ag-gv-rel__marco {
    width: 52px;
    height: auto;
  }

  .ag-gv-rel__icono {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .ag-gv-rel__nodo--agencia .ag-gv-rel__icono {
    width: 48px;
    height: 48px;
    border-radius: 13px;
  }

  .ag-gv-rel__anillo {
    inset: -5px;
    border-radius: 17px;
  }

  /* 36 + 24 + 48 + 24 + 36 = 168px: cabe en la escena de 200px de móvil */
  .ag-gv-rel__via {
    flex: none;
    width: 52px;
    height: 24px;
  }

  .ag-gv-rel__linea {
    left: 50%;
    right: auto;
    top: 0;
    bottom: 0;
    width: 1px;
    height: auto;
    margin: 0 0 0 -0.5px;
    background: linear-gradient(180deg, rgba(200, 184, 149, 0.18), rgba(200, 184, 149, 0.55), rgba(200, 184, 149, 0.18));
    transform-origin: 50% 0;
    transform: scaleY(var(--d, 1));
  }

  .ag-gv-rel__carril {
    transform: translateY(calc(var(--av, 0) * 100%));
  }

  /* En vertical las fichas pasan junto a la línea: sin rótulos fijos */
  .ag-gv-rel__rotulo {
    display: none;
  }

  .ag-gv-rel__carril .ag-gv-ficha {
    left: 50%;
    top: 0;
  }

  .ag-gv-rel__carril .ag-gv-ficha__texto {
    left: 14px;
    top: 0;
    bottom: auto;
    transform: translateY(-50%);
  }
}

/* ── 2. ENTREGA BAJO TU MARCA ──────────────────────────────────────── */
.ag-gv-marca__lienzo {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 172px;
}

.ag-gv-marca__ventana {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  width: 64%;
  height: 156px;
  overflow: hidden;
  border: 1px solid var(--ag-gar-panel-borde);
  border-radius: 10px;
  background: var(--ag-gar-panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.ag-gv-marca__barra {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 9px;
  border-bottom: 1px solid var(--ag-gar-panel-borde);
}

.ag-gv-marca__barra i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(232, 227, 218, 0.18);
}

.ag-gv-marca__cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ag-gv-marca__logo {
  position: relative;
  overflow: hidden;
  padding-bottom: 4px;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--ag-accent);
  white-space: nowrap;
}

.ag-gv-marca__subrayado,
.ag-gv-marca__brillo {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1.5px;
}

.ag-gv-marca__subrayado {
  right: 0;
  background: var(--ag-accent);
  transform-origin: 0 50%;
}

.ag-gv-marca__brillo {
  width: 30%;
  background: linear-gradient(90deg, rgba(255, 248, 234, 0), #FFF8EA, rgba(255, 248, 234, 0));
  opacity: 0;
}

.ag-gv-marca__menu {
  display: flex;
  gap: 5px;
}

.ag-gv-marca__menu i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--ag-gar-raya);
}

.ag-gv-marca__cuerpo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 9px 10px;
}

.ag-gv-marca__bloque {
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 5px;
  background: rgba(232, 227, 218, 0.07);
}

.ag-gv-marca__bloque--principal {
  grid-column: 1 / -1;
  height: 42px;
  background: linear-gradient(120deg, rgba(200, 184, 149, 0.24), rgba(200, 184, 149, 0.06));
}

.ag-gv-marca__doc {
  position: absolute;
  right: 3%;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 34%;
  height: 92px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: #1E1F23;
}

.ag-gv-marca__doc-titulo {
  font-size: 11px;
  font-weight: 600;
  color: var(--ag-text);
}

.ag-gv-marca__bandeja-fondo {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: 44%;
  height: 58px;
  border: 1px solid var(--ag-gar-panel-borde);
  border-radius: 8px;
  background: #121316;
}

.ag-gv-marca__bandeja {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 44%;
  height: 42px;
  padding-bottom: 8px;
  border: 1px solid rgba(200, 184, 149, 0.25);
  border-top-color: rgba(200, 184, 149, 0.5);
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #1C1B18, #141412);
}

.ag-gv-marca__bandeja-etiqueta {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ag-accent);
}

/* ── 3. CONFIDENCIALIDAD ───────────────────────────────────────────── */
.ag-gv-conf__lienzo {
  position: relative;
  width: 100%;
  max-width: 280px;
  height: 168px;
}

/* El contenedor fija la posición y el giro final; GSAP anima la hoja
   interior (así no pisa el rotate del CSS). */
.ag-gv-conf__doc {
  position: absolute;
  top: 8px;
  width: 46%;
  height: 124px;
}

.ag-gv-conf__doc--brief {
  left: 3%;
  z-index: 1;
  transform: rotate(-5deg);
}

.ag-gv-conf__doc--diseno {
  top: 0;
  left: 27%;
  z-index: 2;
}

.ag-gv-conf__doc--materiales {
  left: 51%;
  z-index: 3;
  transform: rotate(5deg);
}

.ag-gv-conf__hoja {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  height: 100%;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: #191B1F;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.ag-gv-conf__doc--brief .ag-gv-conf__hoja {
  background: #141619;
}

.ag-gv-conf__doc--materiales .ag-gv-conf__hoja {
  background: #1E2024;
}

.ag-gv-conf__tipo {
  font-size: 11px;
  font-weight: 600;
  color: var(--ag-text);
}

.ag-gv-conf__maqueta,
.ag-gv-conf__miniaturas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.ag-gv-conf__maqueta i {
  height: 12px;
  border-radius: 3px;
  background: var(--ag-gar-raya);
}

.ag-gv-conf__maqueta i:first-child {
  grid-column: 1 / -1;
  height: 20px;
  background: rgba(200, 184, 149, 0.18);
}

.ag-gv-conf__miniaturas i {
  aspect-ratio: 4 / 3;
  border-radius: 3px;
  background: rgba(200, 184, 149, 0.14);
}

.ag-gv-conf__banda {
  position: absolute;
  left: 0;
  right: 0;
  top: 94px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
}

.ag-gv-conf__cinta {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(200, 184, 149, 0.38);
  border-radius: 6px;
  background: #141412;
  transform-origin: 0 50%;
}

.ag-gv-conf__contenido {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ag-accent);
}

.ag-gv-conf__candado {
  display: block;
  overflow: visible;
}

.ag-gv-conf__realce {
  position: absolute;
  inset: -3px;
  border: 1px solid var(--ag-accent);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
}

/* ── 4. COORDINACIÓN ───────────────────────────────────────────────── */
.ag-gv-coord__lienzo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 300px;
}

/* Orígenes de cada aportación (quedan como referencia, punteados) */
.ag-gv-coord__origenes {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.ag-gv-coord__origen {
  padding: 3px 9px;
  border: 1px dashed rgba(232, 227, 218, 0.22);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ag-gar-tenue);
  white-space: nowrap;
}

.ag-gv-coord__panel {
  padding: 10px;
  border: 1px solid var(--ag-gar-panel-borde);
  border-radius: 10px;
  background: var(--ag-gar-panel);
}

.ag-gv-coord__titulo {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ag-text);
}

.ag-gv-coord__titulo-punto {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ag-accent);
}

.ag-gv-coord__filas {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ag-gv-coord__fila {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.ag-gv-coord__chip {
  position: relative;
  z-index: 1;
  flex: none;
  width: 76px;
  padding: 2px 0;
  border: 1px solid var(--ag-border);
  border-radius: 999px;
  background: #1D1C19;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
  color: var(--ag-text);
}

.ag-gv-coord__notas {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  transform-origin: 0 50%;
}

.ag-gv-coord__notas i {
  height: 3px;
  border-radius: 2px;
  background: var(--ag-gar-raya);
}

.ag-gv-coord__notas i + i {
  width: 58%;
}

.ag-gv-coord__check {
  flex: none;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(200, 184, 149, 0.45);
  border-radius: 50%;
  color: var(--ag-accent);
}

.ag-gv-coord__escaner {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 24px;
  border: 1px solid rgba(200, 184, 149, 0.55);
  border-radius: 6px;
  background: rgba(200, 184, 149, 0.06);
  opacity: 0;
  pointer-events: none;
}

/* ── 5. ALCANCE Y CALENDARIO ───────────────────────────────────────── */
.ag-gv-cal__lienzo {
  --ag-gv-cal-nombre: 78px;
  width: 100%;
  max-width: 520px;
}

.ag-gv-cal__cabecera {
  display: grid;
  grid-template-columns: var(--ag-gv-cal-nombre) 1fr;
  align-items: end;
  height: 16px;
  margin-bottom: 8px;
}

.ag-gv-cal__eje {
  font-size: 11px;
  color: var(--ag-gar-tenue);
}

.ag-gv-cal__marcas {
  position: relative;
  height: 6px;
}

.ag-gv-cal__marcas i,
.ag-gv-cal__guias i {
  position: absolute;
  width: 1px;
}

.ag-gv-cal__marcas i {
  bottom: 0;
  height: 6px;
  background: rgba(232, 227, 218, 0.25);
  transform-origin: 50% 100%;
}

.ag-gv-cal__guias {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ag-gv-cal-nombre);
  right: 0;
  pointer-events: none;
}

.ag-gv-cal__guias i {
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.05);
  transform-origin: 50% 0;
}

.ag-gv-cal__marcas i:nth-child(1), .ag-gv-cal__guias i:nth-child(1) { left: 0; }
.ag-gv-cal__marcas i:nth-child(2), .ag-gv-cal__guias i:nth-child(2) { left: 25%; }
.ag-gv-cal__marcas i:nth-child(3), .ag-gv-cal__guias i:nth-child(3) { left: 50%; }
.ag-gv-cal__marcas i:nth-child(4), .ag-gv-cal__guias i:nth-child(4) { left: 75%; }
.ag-gv-cal__marcas i:nth-child(5), .ag-gv-cal__guias i:nth-child(5) { left: calc(100% - 1px); }

.ag-gv-cal__cuerpo {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ag-gv-cal__fila {
  display: grid;
  grid-template-columns: var(--ag-gv-cal-nombre) 1fr;
  align-items: center;
  height: 26px;
}

.ag-gv-cal__nombre {
  font-size: 12px;
  color: var(--ag-muted);
}

.ag-gv-cal__fila--hito .ag-gv-cal__nombre {
  color: var(--ag-heading);
}

.ag-gv-cal__pista {
  position: relative;
  height: 100%;
}

/* La longitud ilustra la secuencia; no representa tiempo real */
.ag-gv-cal__barra {
  position: absolute;
  top: 50%;
  left: var(--ini);
  width: calc(var(--fin) - var(--ini));
  height: 10px;
  margin-top: -5px;
  overflow: hidden;
  border: 1px solid rgba(200, 184, 149, 0.5);
  border-radius: 3px;
  background: rgba(200, 184, 149, 0.3);
  transform-origin: 0 50%;
}

.ag-gv-cal__barra-luz {
  position: absolute;
  inset: 0;
  background: rgba(255, 240, 215, 0.5);
  opacity: 0;
}

/* Dependencia: del final de la etapa anterior al inicio de ésta */
.ag-gv-cal__dependencia {
  position: absolute;
  left: var(--ini);
  top: -19px;
  width: 1px;
  height: 26px;
  background: rgba(200, 184, 149, 0.45);
  transform-origin: 50% 0;
}

.ag-gv-cal__hito {
  position: absolute;
  top: 50%;
  left: var(--ini);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
}

.ag-gv-cal__rombo {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--ag-gar-ambar);
  transform: rotate(45deg);
}

.ag-gv-cal__hito-anillo {
  position: absolute;
  inset: -6px;
  border: 1px solid var(--ag-gar-ambar);
  border-radius: 50%;
  opacity: 0;
}

/* Cursor de la repetición: --av (0–1) lo lleva de izquierda a derecha */
.ag-gv-cal__cursor-carril {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: var(--ag-gv-cal-nombre);
  right: 0;
  opacity: 0;
  transform: translateX(calc(var(--av, 0) * 100%));
  pointer-events: none;
}

.ag-gv-cal__cursor {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--ag-accent);
}
