/*
 * Banner de horarios de la portada (src/lib/horarios.ts y public/js/horarios.js). Llena la diapositiva del carrusel,
 * que tiene la proporción de las imágenes del banner: horizontal en computador y vertical en celular. Todo se mide con
 * unidades del contenedor (cqw), para que se vea igual en cualquier ancho, como una imagen, pero con texto real.
 */

.hz {
  --hz-amarillo: #ffcc3e;
  --hz-amarillo-2: #f5b700;
  --hz-noche: #0d1a2e;
  --hz-verde: #3ddc97;
  --hz-rojo: #ff8a80;
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  overflow: hidden;
  container: hz / size;
  color: #fff;
  font-family: inherit;
  text-align: left;
  background:
    radial-gradient(65% 90% at 92% 0%, rgba(0, 150, 180, 0.55) 0%, transparent 60%),
    radial-gradient(55% 80% at 0% 100%, rgba(0, 97, 124, 0.85) 0%, transparent 65%),
    linear-gradient(135deg, #004568 0%, #003451 48%, #10152a 100%);
}
.hz *,
.hz *::before,
.hz *::after {
  box-sizing: border-box;
}
.hz p,
.hz ul {
  margin: 0;
  padding: 0;
}
/* El calco trae «span { font-size: 13px }»: dentro del banner cada texto hereda su tamaño. */
.hz :where(span, small, li) {
  font-size: inherit;
}

/* El contenedor no se puede consultar a sí mismo: la grilla va en .hz__marco. */
.hz__marco {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.9fr);
  align-items: center;
  gap: 4cqw;
  padding: 4cqh 6.5cqw 4cqh 6.5cqw;
}

/* ---------- fondo vivo: luces que flotan y una trama de puntos ---------- */
.hz__fondo {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.hz__fondo::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1.4px);
  background-size: 1.6cqw 1.6cqw;
  -webkit-mask-image: linear-gradient(100deg, transparent 5%, #000 45%, #000 75%, transparent 100%);
  mask-image: linear-gradient(100deg, transparent 5%, #000 45%, #000 75%, transparent 100%);
  opacity: 0.55;
}
.hz__orbe {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  animation: hz-flota 16s ease-in-out infinite alternate;
}
.hz__orbe--1 {
  width: 48cqw;
  height: 48cqw;
  top: -24cqw;
  right: -12cqw;
  background: radial-gradient(circle, rgba(0, 190, 220, 0.42) 0%, transparent 68%);
}
.hz__orbe--2 {
  width: 38cqw;
  height: 38cqw;
  bottom: -26cqw;
  left: 26cqw;
  background: radial-gradient(circle, rgba(255, 204, 62, 0.26) 0%, transparent 68%);
  animation-duration: 21s;
  animation-direction: alternate-reverse;
}
.hz__orbe--3 {
  width: 30cqw;
  height: 30cqw;
  top: 12cqh;
  left: -10cqw;
  background: radial-gradient(circle, rgba(60, 165, 143, 0.35) 0%, transparent 68%);
  animation-duration: 25s;
}
@keyframes hz-flota {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-4cqw, 3cqw, 0) scale(1.12);
  }
}

/* ---------- reloj ---------- */
.hz__reloj {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4cqh;
  justify-self: center;
  width: min(100%, 72cqh);
}
.hz__esfera {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 2.2cqw 3cqw rgba(0, 10, 30, 0.45));
}
.hz__cara {
  fill: rgba(255, 255, 255, 0.07);
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.5;
}
.hz__pista-reloj {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 9;
}
.hz__arco {
  fill: none;
  stroke: var(--hz-amarillo);
  stroke-width: 9;
  stroke-linecap: round;
  opacity: 0.75;
}
.hz__arco--activo {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255, 204, 62, 0.85));
}
.hz__marca {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1.2;
  stroke-linecap: round;
}
.hz__marca--hora {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3;
}
.hz__aguja {
  stroke: #fff;
  stroke-linecap: round;
}
.hz__aguja--hora {
  stroke-width: 7;
}
.hz__aguja--minuto {
  stroke-width: 4.5;
}
.hz__aguja--segundo {
  stroke: var(--hz-amarillo);
  stroke-width: 2;
}
.hz__eje {
  fill: var(--hz-amarillo);
  stroke: var(--hz-noche);
  stroke-width: 2.5;
}
/* Sin JavaScript no hay hora: no se muestran manecillas quietas en una hora falsa. */
.hz:not(.hz--vivo) [data-hz-hora],
.hz:not(.hz--vivo) [data-hz-minuto],
.hz:not(.hz--vivo) [data-hz-segundo] {
  display: none;
}
.hz__digital {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  font-weight: 700;
  font-size: 2cqw;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.hz__digital small {
  font-size: 0.5em;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ---------- textos ---------- */
.hz__cuerpo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5cqh;
  min-width: 0;
}
.hz__aviso {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.45em 1em;
  border-radius: 999px;
  background: var(--hz-amarillo);
  color: var(--hz-noche);
  font-weight: 800;
  font-size: 1.05cqw;
  letter-spacing: 0.02em;
}
.hz__antetitulo {
  font-size: 1.05cqw;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--hz-amarillo);
}
.hz__titulo {
  font-size: 3.15cqw;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hz__estado {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.5em 1.1em 0.5em 0.9em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-weight: 700;
  font-size: 1.35cqw;
  --hz-color: var(--hz-verde);
}
.hz__estado[hidden],
.hz__nota[hidden] {
  display: none;
}
.hz__estado--abierto {
  --hz-color: var(--hz-verde);
}
.hz__estado--cierra,
.hz__estado--pausa,
.hz__estado--aviso {
  --hz-color: var(--hz-amarillo);
}
.hz__estado--cerrado {
  --hz-color: var(--hz-rojo);
}
.hz__punto {
  position: relative;
  width: 0.62em;
  height: 0.62em;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--hz-color);
}
.hz__punto::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--hz-color);
  animation: hz-pulso 1.8s ease-out infinite;
}
@keyframes hz-pulso {
  from {
    transform: scale(1);
    opacity: 0.7;
  }
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}
.hz__nota {
  font-size: 1.15cqw;
  font-weight: 700;
  color: var(--hz-amarillo);
}

/* ---------- franjas (días y horas) ---------- */
.hz__franjas {
  list-style: none;
  display: grid;
  gap: 1.3cqh;
  width: 100%;
  max-width: 64cqw;
  margin: 0.6cqh 0 !important;
}
.hz__franja {
  position: relative;
  display: grid;
  grid-template-columns: minmax(13.5cqw, auto) 1fr auto;
  align-items: center;
  gap: 1.8cqw;
  padding: 0.55cqw 1.6cqw 0.55cqw 0.55cqw;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.hz__dias {
  display: block;
  padding: 0.55em 1.4em;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffdc6b 0%, var(--hz-amarillo-2) 100%);
  color: var(--hz-noche);
  font-weight: 800;
  font-size: 1.6cqw;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}
.hz__horas {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.55em;
  font-weight: 700;
  font-size: 1.75cqw;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.hz__tramo {
  white-space: nowrap;
}
.hz__y {
  font-weight: 500;
  opacity: 0.6;
}
.hz__hoy {
  display: none;
  padding: 0.35em 0.85em;
  border-radius: 999px;
  background: rgba(255, 204, 62, 0.16);
  border: 1px solid rgba(255, 204, 62, 0.55);
  color: var(--hz-amarillo);
  font-size: 0.95cqw;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hz__franja--hoy {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 204, 62, 0.75);
  box-shadow:
    0 0 0 1px rgba(255, 204, 62, 0.25),
    0 1.2cqw 3.5cqw -1cqw rgba(255, 204, 62, 0.45);
}
.hz__franja--hoy .hz__hoy {
  display: inline-block;
}
/* Avance de la jornada en curso */
.hz__progreso {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  /* avance de 0 a 1 con escala (compuesta), no con el ancho */
  transform-origin: left center;
  transform: scaleX(var(--hz-avance, 0));
  background: linear-gradient(90deg, var(--hz-verde), var(--hz-amarillo));
  transition: transform 1s linear;
}

.hz__lema {
  font-size: 1.75cqw;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.01em;
  opacity: 0.92;
}

/* ---------- botones ---------- */
.hz__botones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9cqw;
  margin-top: 0.4cqh;
}
.hz .hz__boton,
.hz .hz__boton:hover,
.hz .hz__boton:focus,
.hz .hz__boton:visited {
  color: #fff;
  text-decoration: none;
}
.hz .hz__boton {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.8em 1.35em;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: clamp(12px, 1.08cqw, 17px);
  font-weight: 700;
  line-height: 1;
  /* solo transform: las sombras y fondos se miden con el ancho del banner y animarlos cuesta (PageSpeed) */
  transition: transform 0.2s ease;
}
.hz .hz__boton:hover,
.hz .hz__boton:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.55);
}
.hz .hz__boton:focus-visible {
  outline: 3px solid var(--hz-amarillo);
  outline-offset: 2px;
}
.hz .hz__boton--wa,
.hz .hz__boton--wa:hover,
.hz .hz__boton--wa:focus,
.hz .hz__boton--wa:visited {
  color: #05361d;
}
.hz .hz__boton--wa {
  border-color: #25d366;
  background: #25d366;
}
.hz .hz__boton--wa:hover,
.hz .hz__boton--wa:focus-visible {
  background: #3fe07f;
}
.hz__boton svg {
  width: 1.3em;
  height: 1.3em;
  flex: 0 0 auto;
  fill: currentColor;
}

/* ---------- sin reloj ---------- */
.hz--sin-reloj .hz__marco {
  grid-template-columns: minmax(0, 1fr);
  padding-left: 9cqw;
}

/* ---------- entrada: cada vez que la diapositiva aparece ---------- */
@media (prefers-reduced-motion: no-preference) {
  .carrusel__diapositiva--activa .hz__anima {
    animation: hz-entra 0.75s cubic-bezier(0.2, 0.75, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 85ms);
  }
}
/* Sin opacidad: el texto se ve desde el primer cuadro (si no, PageSpeed retrasa el LCP hasta que aparece). */
@keyframes hz-entra {
  from {
    transform: translate3d(0, 1.4cqw, 0);
  }
  to {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hz__orbe,
  .hz__punto::after {
    animation: none;
  }
}

/* ---------- celular y pantallas verticales ---------- */
@container hz (max-aspect-ratio: 1/1) {
  .hz__marco {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 4cqw;
    padding: 7cqw 6.5cqw;
  }
  .hz__reloj {
    flex-direction: row;
    justify-self: start;
    width: auto;
    gap: 3.5cqw;
  }
  .hz__esfera {
    width: 23cqw;
  }
  .hz__digital {
    align-items: flex-start;
    font-size: 6.4cqw;
  }
  .hz__cuerpo {
    gap: 2.4cqw;
  }
  .hz__aviso,
  .hz__antetitulo {
    font-size: 3.1cqw;
  }
  .hz__titulo {
    font-size: 7.4cqw;
  }
  .hz__estado,
  .hz__nota {
    font-size: 3.6cqw;
  }
  .hz__franjas {
    max-width: none;
    gap: 2.4cqw;
  }
  .hz__franja {
    grid-template-columns: 1fr auto;
    gap: 1.6cqw 2cqw;
    padding: 2.2cqw 3.2cqw 2.4cqw;
    border-radius: 4.5cqw;
  }
  .hz__dias {
    justify-self: start;
    font-size: 4cqw;
    padding: 0.45em 1.1em;
  }
  .hz__hoy {
    font-size: 2.7cqw;
  }
  .hz__horas {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 4.6cqw;
  }
  .hz__lema {
    font-size: 4.1cqw;
  }
  /* En celular la barra de abajo ya trae Llamar, WhatsApp y Cómo llegar; el título ya dice que es el horario. */
  .hz__botones,
  .hz__antetitulo {
    display: none;
  }
}

/* Si la diapositiva no se ve, sus animaciones se pausan. */
.carrusel__diapositiva:not(.carrusel__diapositiva--activa) .hz,
.carrusel__diapositiva:not(.carrusel__diapositiva--activa) .hz *,
.carrusel__diapositiva:not(.carrusel__diapositiva--activa) .hz *::after {
  animation-play-state: paused !important;
}
