/* Banners: carrusel a pantalla completa con tomas de los videos oficiales (banners.js).
   La foto ocupa todo el fondo, sin tarjetas ni color agregado. Encima van: grano fino y viñeta (iguales en todas, para que se lean
   como una sola sesión), el texto en HTML y la etiqueta del producto. Diseño base 1920 x 800: los tamaños escalan con el ancho. */
.bn {
  --ink: #0D1424;
  --out: var(--ease-out, cubic-bezier(.23, 1, .32, 1));
  position: relative; overflow: hidden; isolation: isolate; background: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

/* Grano y viñeta: encima de la foto, debajo de los controles */
.bn::before, .bn::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.bn::before { display: none; }   /* sin grano encima: sobre tomas de video se leía como foto borrosa */
.bn::after { background: radial-gradient(120% 140% at 50% 45%, rgba(13, 20, 36, 0) 56%, rgba(13, 20, 36, .22) 100%); }
.bn::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply; opacity: .075;
}

.bn__track {
  position: relative; z-index: 1; display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.bn__track::-webkit-scrollbar { display: none; }
.bn__track:focus-visible { outline: 3px solid #fff; outline-offset: -8px; }

.bn-s {
  --px: .5;                           /* qué parte de la foto se ve cuando se recorta de lado (0 = izquierda, 1 = derecha): lo calcula banners.js */
  position: relative; flex: 0 0 100%; overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always;
  /* Ocupa toda la pantalla bajo la cabecera, en cualquier dispositivo; la foto (12:5) se recorta con object-fit */
  height: var(--hero-h, 100vh); min-height: 360px;
}

/* Foto + etiquetas se mueven juntas (zoom lento al activarse), para que la etiqueta no se corra del producto */
.bn-s__stage { position: absolute; inset: 0; container-type: size; transform: scale(1); transform-origin: 50% 50%; transition: transform 700ms var(--out); }
/* Sin zoom lento: ampliar una toma de video la vuelve más blanda; la foto se queda quieta y nítida */
.bn-s.is-active .bn-s__stage { transform: none; }
.bn-s__stage picture { display: contents; }
.bn-s__img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: calc(var(--px) * 100%) 50%; user-select: none; -webkit-user-drag: none; }
.bn-s__veil { position: absolute; inset: 0; pointer-events: none; background: var(--velo); }

/* Texto */
.bn-s__copy {
  position: absolute; z-index: 3; top: 0; bottom: 0; left: calc(var(--x) * 1%); width: calc(var(--w) * 1%);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.bn-s--oscuro .bn-s__copy { color: var(--ink); }
.bn-s--claro .bn-s__copy { color: #fff; }
.bn-s__title {
  margin: 0; font-weight: 700; letter-spacing: -.036em; line-height: .96; text-wrap: balance;
  font-size: max(2rem, calc(var(--t) / 19.2 * 1vw));
}
.bn-s--claro .bn-s__title { text-shadow: 0 2px 28px rgba(0, 0, 0, .18); }
.bn-s__lead {
  margin: .9em 0 0; max-width: 20em; font-weight: 450; letter-spacing: -.012em; line-height: 1.38; text-wrap: pretty;
  font-size: max(.95rem, 1.4vw); opacity: .86;
}
.bn-s__btn {
  display: inline-flex; align-items: center; gap: .7em; margin-top: 1.5em; min-height: 44px; padding: 0 1.7em;
  border: 0; border-radius: 999px; font: inherit; font-weight: 600; letter-spacing: -.01em; text-decoration: none; cursor: pointer;
  font-size: max(.92rem, 1.15vw); height: max(44px, 3.33vw);
  transition: scale 160ms var(--out), background-color 160ms ease;
}
.bn-s--oscuro .bn-s__btn { background: var(--ink); color: #fff; }
.bn-s--claro .bn-s__btn { background: #fff; color: var(--ink); }
.bn-s__btn svg { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bn-s__btn:active { scale: .97; }
.bn-s__btn:focus-visible, .bn-tag:focus-visible { outline: 3px solid #2A5BA8; outline-offset: 3px; }
.bn-s--claro .bn-s__btn:focus-visible { outline-color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .bn-s--oscuro .bn-s__btn:hover { background: #17345F; }
  .bn-s--claro .bn-s__btn:hover { background: #E6EDF8; }
}

/* Etiqueta de producto sobre la foto: punto + nombre. Abre la ficha del producto. Una diapositiva con dos productos
   le da a cada etiqueta su propio --tx/--ty; el --tx de la diapositiva es el centro del recorte en celular. */
.bn-tag {
  position: absolute; z-index: 2; left: calc(var(--tx) * 100%); top: calc(var(--ty) * 100%);
  /* Con la foto recortada (cover) el punto sigue al producto: tamaño real de la foto y lo que se desplaza por el recorte */
  --Wi: max(100cqw, calc(100cqh * 2.4)); --Hi: max(100cqh, calc(100cqw / 2.4));
  left: calc((100cqw - var(--Wi)) * var(--px) + var(--tx) * var(--Wi)); top: calc((100cqh - var(--Hi)) * .5 + var(--ty) * var(--Hi));
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer;
  transform: translate(-11px, -50%); transform-origin: 11px 50%;
}
.bn-tag--izq { flex-direction: row-reverse; transform: translate(calc(-100% + 11px), -50%); transform-origin: calc(100% - 11px) 50%; }
.bn-tag__dot { position: relative; flex: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 7px rgba(255, 255, 255, .32), 0 6px 18px rgba(13, 20, 36, .28); }
.bn-tag__dot::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7); opacity: 0; }
.bn-tag__name {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px; white-space: nowrap;
  background: rgba(255, 255, 255, .94); color: var(--ink); font-weight: 600; font-size: 18px; letter-spacing: -.01em;
  box-shadow: 0 8px 24px rgba(13, 20, 36, .18);
}
.bn-tag { transition: scale 160ms var(--out); }
.bn-tag:active { scale: .96; }

/* Entradas: el texto sube y aparece al activarse la diapositiva (escalonado); la etiqueta aparece al final */
.bn--js .bn-s__copy > * { opacity: 0; translate: 0 1rem; transition: opacity 220ms ease, translate 220ms ease; }
.bn--js .bn-s.is-active .bn-s__copy > * { opacity: 1; translate: 0 0; transition: opacity 520ms var(--out), translate 560ms var(--out); transition-delay: calc(var(--i, 0) * 70ms + 140ms); }
.bn--js .bn-tag { opacity: 0; scale: .92; transition: opacity 200ms ease, scale 200ms ease; }
.bn--js .bn-s.is-active .bn-tag { opacity: 1; scale: 1; transition: opacity 420ms var(--out) 520ms, scale 420ms var(--out) 520ms; }
.bn--js .bn-s.is-active .bn-tag:active { scale: .96; transition-delay: 0s; transition-duration: 120ms; }
.bn--js .bn-s.is-active .bn-tag__dot::after { animation: bn-pulso 2.6s var(--out) 1.4s infinite; }
@keyframes bn-pulso { 0% { opacity: .85; scale: .8; } 70%, 100% { opacity: 0; scale: 1.7; } }

/* Celular: la foto se recorta en vertical (4:5) centrada en el producto y el texto baja sobre un velo oscuro */
@media (max-width: 820px) {
  /* En el celular la etiqueta es solo el punto (más grande, con zona de toque de 50 px): el nombre ya está en el título */
  /* En el celular la foto es otra toma (vertical): el punto de la etiqueta no coincidiría con el producto. Lleva al producto el botón */
  .bn-tag { display: none; }
  .bn-tag--izq { flex-direction: row; transform: translate(-13px, -50%); transform-origin: 13px 50%; }
  .bn-tag::before { content: ""; position: absolute; inset: -12px; }
  .bn-tag__dot { width: 26px; height: 26px; }
  .bn-tag__name { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bn-s__veil { background: linear-gradient(0deg, rgba(13, 20, 36, .84) 0%, rgba(13, 20, 36, .52) 34%, rgba(13, 20, 36, 0) 60%); }
  .bn-s__copy { left: 0; right: 0; width: auto; top: auto; padding: 0 1.25rem 4.4rem; color: #fff !important; }
  .bn-s__title { font-size: clamp(1.75rem, 7.8vw, 2.3rem); text-shadow: none !important; }
  .bn-s__lead { display: none; }
  .bn-s__btn { margin-top: 1em; padding: 0 1.4em; font-size: .95rem; height: 46px; background: #fff !important; color: var(--ink) !important; }
  /* Si el producto está en la mitad de abajo de la foto, el texto sube */
  .bn-s--alto .bn-s__veil { background: linear-gradient(180deg, rgba(13, 20, 36, .84) 0%, rgba(13, 20, 36, .5) 36%, rgba(13, 20, 36, 0) 62%); }
  .bn-s--alto .bn-s__copy { top: 0; bottom: auto; padding: 1.5rem 1.25rem 0; }
  /* Letras movidas desde el panel (banners.js pone top, alineación y --velo-m) */
  .bn-s--txt .bn-s__veil { background: var(--velo-m); }
  .bn-s--txt .bn-s__title { font-size: calc(clamp(1.75rem, 7.8vw, 2.3rem) * var(--esc, 1)); overflow-wrap: anywhere; }
  .bn-s--txt .bn-s__btn { height: calc(46px * var(--esc, 1)); font-size: calc(.95rem * var(--esc, 1)); }
  .bn-s--osc .bn-s__copy { color: var(--ink) !important; }
  .bn-s--osc .bn-s__btn { background: var(--ink) !important; color: #fff !important; }
}

@media (prefers-reduced-motion: reduce) {
  .bn-s__stage, .bn-s.is-active .bn-s__stage { transform: none; transition: none; }
  .bn--js .bn-s__copy > *, .bn--js .bn-s.is-active .bn-s__copy > * { opacity: 1; translate: none; transition: none; }
  .bn--js .bn-tag, .bn--js .bn-s.is-active .bn-tag { opacity: 1; scale: 1; transition: none; }
  .bn--js .bn-s.is-active .bn-tag__dot::after { animation: none; }
}

/* Arrastrar con el mouse (banners.js): la tira sigue al mouse; el "snap" se apaga mientras dura el arrastre */
@media (hover: hover) and (pointer: fine) {
  .bn--js .bn__track { cursor: grab; }
}
.bn__track.sin-snap { scroll-snap-type: none; }
.bn__track.is-dragging { scroll-behavior: auto; cursor: grabbing; user-select: none; -webkit-user-select: none; }
.bn-s__img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

/* Al cargar, el HTML trae los banners de la página; banners.js los reemplaza por lo elegido en el panel (/admin/ > Banners).
   Hasta que termina, el carrusel no se ve, para que no asome un banner oculto o eliminado. Si el script fallara, aparece igual a los 3 s. */
.bn:not(.bn--listo) { background: #eef2f7; }
.bn:not(.bn--listo) .bn__track { opacity: 0; animation: bn-mostrar .2s ease 3s forwards; }
.bn--listo .bn__track { animation: bn-entrar .28s cubic-bezier(.23, 1, .32, 1); }
@keyframes bn-mostrar { to { opacity: 1; } }
@keyframes bn-entrar { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bn--listo .bn__track { animation: none; } }
