/* ==========================================================================
   viaje.css — Fase 2: efectos de firma "el viaje".
   Componentes reutilizables en todas las páginas:
     2. Cielo de la noche al amanecer       -> .cielo (lo crea js/viaje.js)
     3. Odómetro                            -> .odometro (lo crea js/viaje.js)
     4. Camión sobre el proceso             -> .tramo .camion (lo crea js/viaje.js)
     5. Barrera de peaje en botones         -> .btn--peaje
     6. Letrero "Llegaste"                  -> .llegada
   ========================================================================== */

/* ==========================================================================
   2. Cielo: de la noche al amanecer
   ========================================================================== */
.cielo {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--cielo-a, #050b15), var(--cielo-b, #08121f));
}
.cielo__alba {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 50% at 50% 100%, rgba(232, 150, 104, 0.85) 0%, rgba(210, 31, 44, 0.22) 45%, rgba(13, 27, 46, 0) 78%);
  opacity: var(--alba, 0);
}

/* Las secciones oscuras dejan ver el cielo */
html.viaje .seccion--noche,
html.viaje .cta { background: transparent; }
html.viaje .seccion--asfalto { background: rgba(3, 8, 15, 0.35); }

/* ==========================================================================
   4. Camión visto desde arriba sobre el proceso
   ========================================================================== */
.camion {
  --largo: 150px;
  --ancho: 34px;
  position: absolute;
  left: 0;
  top: calc(var(--carril) - var(--ancho) / 2);
  z-index: 2;
  width: var(--largo);
  height: var(--ancho);
  pointer-events: none;
  will-change: transform;
}
.camion svg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--largo);
  height: var(--ancho);
  transform: translate(-50%, -50%);
  overflow: visible;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55));
}
@media (max-width: 899px) {
  .camion {
    --largo: 104px;
    --ancho: 24px;
    top: 0;
    left: calc(var(--carril) - var(--ancho) / 2);
    width: var(--ancho);
    height: var(--largo);
  }
  .camion svg { transform: translate(-50%, -50%) rotate(90deg); }
}

/* ==========================================================================
   5. Barrera de peaje en los botones de cotizar (Fase 3: más grande)
   Poste con luz roja, brazo de franjas que cubre ~70 % del botón y
   contrapeso. Se levanta a ~80° con hover, foco de teclado o toque.
   ========================================================================== */
.btn--peaje { margin-top: 10px; }
.peaje {
  position: absolute;
  left: 4px;
  right: 4px;
  top: -9px;
  height: 0;
  pointer-events: none;
  z-index: 2;
}
/* Poste */
.peaje::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -9px;
  width: 16px;
  height: 18px;
  background: linear-gradient(to right, #8794a5, #e3e8ee 45%, #6b7888);
  border: 1px solid var(--asfalto);
  border-radius: 2px;
  z-index: 2;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}
/* Luz roja del poste */
.peaje::after {
  content: "";
  position: absolute;
  left: 3px;
  top: -16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rojo);
  box-shadow: 0 0 8px 2px rgba(210, 31, 44, 0.8);
  z-index: 2;
}
.peaje__brazo {
  position: absolute;
  left: 6px;
  top: -4px;
  width: var(--brazo, 72%);
  height: 9px;
  background: repeating-linear-gradient(90deg, #fff 0 12px, var(--rojo) 12px 24px);
  border-radius: 1px 4px 4px 1px;
  box-shadow: 0 0 0 1.5px rgba(8, 18, 31, 0.9), 0 4px 8px rgba(0, 0, 0, 0.4);
  transform-origin: 2px 50%;
  transition: transform 0.6s cubic-bezier(0.34, 1.35, 0.5, 1);
}
/* Contrapeso al otro lado del eje */
.peaje__brazo::before {
  content: "";
  position: absolute;
  left: -14px;
  top: -2px;
  width: 12px;
  height: 13px;
  background: #2a323d;
  border: 1px solid var(--asfalto);
  border-radius: 2px;
}
.btn--peaje:hover .peaje__brazo,
.btn--peaje:focus-visible .peaje__brazo,
.btn--peaje.is-alzada .peaje__brazo { transform: rotate(-80deg); }

.header .btn--peaje { margin-top: 0; --brazo: 64%; }
.header .peaje { top: -6px; }

/* ==========================================================================
   6. Letrero "Llegaste"
   ========================================================================== */
.llegada {
  position: relative;
  padding-top: clamp(4rem, 9vw, 8rem);
  text-align: center;
  overflow: hidden;
}
/* Horizonte al amanecer detrás del letrero */
.llegada::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 70%;
  background: linear-gradient(to top, rgba(232, 150, 104, 0.22), rgba(210, 31, 44, 0.06) 45%, rgba(13, 27, 46, 0));
  pointer-events: none;
}
.letrero {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 100%;
  will-change: transform;
}
.letrero__panel {
  padding: 6px;
  background: #0b6b3e;
  border-radius: 14px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}
.letrero__marco {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 4px 40px;
  padding: 20px 28px 24px;
  border: 3px solid #fff;
  border-radius: 10px;
  color: #fff;
  text-align: left;
  font-family: var(--f-texto);
  font-weight: 700;
  line-height: 1.05;
}
.letrero__titulo {
  grid-column: 1 / -1;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 3px solid #fff;
  font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4.25rem);
}
.letrero__destinos {
  display: grid;
  gap: 6px;
  font-size: clamp(1.375rem, 1rem + 1.6vw, 2.25rem);
}
.letrero__km {
  justify-self: end;
  padding: 6px 12px 4px;
  background: #fff;
  color: #0b6b3e;
  border-radius: 4px;
  text-align: center;
  font-family: var(--f-display);
  font-weight: 900;
  line-height: 1;
}
.letrero__km small {
  display: block;
  font-family: var(--f-texto);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.letrero__km b { font-size: clamp(2rem, 1.4rem + 2.4vw, 3.25rem); font-weight: 900; }

.letrero__postes {
  display: flex;
  justify-content: space-between;
  width: 58%;
  height: clamp(80px, 12vw, 150px);
}
.letrero__postes span {
  width: 10px;
  background: linear-gradient(to right, #6b7888, #c8d0d9 45%, #5a6778);
}

@media (max-width: 520px) {
  .letrero__marco { gap: 4px 20px; padding: 16px 18px 18px; }
}

/* ==========================================================================
   Movimiento reducido: todo quieto y legible
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html:not(.movimiento-forzado) .letrero { transform: none !important; opacity: 1 !important; }
  html:not(.movimiento-forzado) .peaje__brazo { transition: none; }
}
