/* ==========================================================
   Línea Nube | La Ardilla
   ========================================================== */

/* ==========================================================
   Fuentes: PP Mori
   Regular (400) en cuerpos de texto · SemiBold (600) en titulares
   ========================================================== */

@font-face {
  font-family: "PP Mori";
  src: url("../fonts/PP_Mori/PPMori-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PP Mori";
  src: url("../fonts/PP_Mori/PPMori-SemiBold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-sky: #a2ccf0;
  --color-brown: #5e4532;
  --color-footer: #b29785;
  --color-white: #ffffff;

  /* Ancho de la nube del header: escala con el viewport */
  --header-cloud-w: clamp(210px, 33vw, 460px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "PP Mori", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  color: var(--color-brown);
  background: var(--color-white);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ==========================================================
   Header
   ========================================================== */

.header {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  background: var(--color-sky);
  overflow: hidden;
}

.header__cloud {
  position: relative;
  width: var(--header-cloud-w);
  /* La nube va pegada a la derecha y al borde inferior */
  line-height: 0;
}

.header__cloud-bg {
  width: 100%;
  pointer-events: none;
  user-select: none;
}

.header__logo {
  position: absolute;
  left: 10%;
  right: 12%;
  bottom: 22%;
  display: block;
}

.header__logo img {
  width: 100%;
}

.header__logo:focus-visible {
  outline: 2px solid var(--color-brown);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ==========================================================
   Banner en video (Vimeo)
   ========================================================== */

.video {
  position: relative;
  background: var(--color-sky);
  line-height: 0;
}

.video__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.video__player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Botón de sonido ---- */
.video__sound {
  position: absolute;
  right: clamp(12px, 2vw, 28px);
  bottom: clamp(12px, 2vw, 28px);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(94, 69, 50, 0.85);
  color: var(--color-white);
  font-family: inherit;
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: background-color 0.3s ease, transform 0.3s ease, opacity 0.4s ease;
}

.video__sound:hover {
  background: var(--color-brown);
  transform: scale(1.04);
}

.video__sound:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 3px;
}

.video__sound-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.video__sound-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.video__speaker {
  fill: currentColor;
  stroke-linejoin: round;
}

/* Mientras está en silencio: tachado visible y ondas ocultas */
.video__waves { opacity: 0; }
.video__cross { opacity: 1; }

.video__sound[aria-pressed="true"] .video__waves { opacity: 1; }
.video__sound[aria-pressed="true"] .video__cross { opacity: 0; }

/* Llama la atención mientras el video sigue en silencio */
.video__sound[aria-pressed="false"] {
  animation: video-sound-pulse 2.6s ease-in-out infinite;
}

@keyframes video-sound-pulse {
  0%, 70%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); }
  35%           { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 10px rgba(255, 255, 255, 0.12); }
}

/* Con el sonido activo el botón se reduce a solo el icono */
.video__sound[aria-pressed="true"] .video__sound-label {
  display: none;
}

.video__sound[aria-pressed="true"] {
  padding: 10px;
  opacity: 0.75;
}

@media (prefers-reduced-motion: reduce) {
  .video__sound {
    animation: none;
    transition: none;
  }
}

/* ==========================================================
   Banner (slider de imágenes — en desuso, ver index.html)
   ========================================================== */

.banner {
  position: relative;
  overflow: hidden;
  background: var(--color-sky);
}

.banner__track {
  display: flex;
  transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}

.banner__slide {
  flex: 0 0 100%;
  min-width: 0;
}

.banner__slide img {
  width: 100%;
  height: auto;
  /* Proporción desktop 2161x1216 */
  aspect-ratio: 2161 / 1216;
  object-fit: cover;
}

.banner__dots {
  position: absolute;
  /* Abajo a la izquierda: la nube con el logo ocupa la derecha/centro */
  left: clamp(16px, 3vw, 40px);
  bottom: clamp(14px, 2.5vw, 32px);
  display: flex;
  gap: 10px;
  z-index: 2;
}

.banner__dot {
  position: relative;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid var(--color-brown);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  overflow: visible;
  transition: width 0.4s ease, transform 0.25s ease, background-color 0.3s;
}

/* Anillo que "late" en los puntos inactivos para invitar al click */
.banner__dot::before {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--color-brown);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  animation: banner-dot-pulse 2.2s ease-out infinite;
}

.banner__dot:nth-child(2)::before { animation-delay: 0.3s; }
.banner__dot:nth-child(3)::before { animation-delay: 0.6s; }
.banner__dot:nth-child(4)::before { animation-delay: 0.9s; }

@keyframes banner-dot-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  70%  { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}

.banner__dot:hover {
  transform: scale(1.25);
  background: var(--color-white);
}

.banner__dot:active {
  transform: scale(0.9);
}

/* Punto activo: se estira en píldora y se va llenando como barra de progreso */
.banner__dot.is-active {
  width: 40px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
}

.banner__dot.is-active:hover {
  transform: none;
}

.banner__dot.is-active::before {
  animation: none;
  opacity: 0;
}

.banner__dot.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-brown);
  transform-origin: left center;
  animation: banner-dot-progress var(--banner-interval, 6000ms) linear forwards;
}

@keyframes banner-dot-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Mientras el slider está en pausa (hover, foco) la barra se congela */
.banner.is-paused .banner__dot.is-active::after {
  animation-play-state: paused;
}

.banner__dot:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 3px;
}

/* ==========================================================
   Productos (slider de 3 en 3)
   ========================================================== */

.products {
  /* Productos visibles por vista (JS lo lee para calcular páginas) */
  --per-view: 3;
  position: relative;
  background: #dfe1e2;
}

.products__viewport {
  overflow: hidden;
}

.products__track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 0.6s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}

.products__item {
  position: relative;
  flex: 0 0 calc(100% / var(--per-view));
  min-width: 0;
  overflow: hidden;
}

.products__item img {
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 300;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
}

/* Etiqueta con nombre y color del producto */
.products__tag {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-brown);
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(91, 58, 41, 0.18);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.products__tag strong {
  font-weight: 600;
}

.products__tag span::before {
  content: "·";
  margin-right: 6px;
}

@media (hover: hover) {
  /* Al pasar el mouse: acercamiento suave y el producto "salta" un poco */
  .products__item:hover img {
    transform: scale(1.08) translateY(-2%);
    filter: saturate(1.15) brightness(1.03);
  }

  .products__item:hover .products__tag {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  /* Los productos que no están bajo el mouse se atenúan ligeramente */
  .products__track:hover .products__item:not(:hover) img {
    filter: saturate(0.7) brightness(0.96);
  }
}

.products__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(34px, 3.8vw, 44px);
  height: clamp(34px, 3.8vw, 44px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-brown);
  color: var(--color-white);
  cursor: pointer;
  transform: translateY(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.products__arrow--prev { left: clamp(10px, 1.8vw, 24px); }
.products__arrow--next { right: clamp(10px, 1.8vw, 24px); }

.products__arrow svg {
  width: 55%;
  height: 55%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.products__arrow {
  overflow: hidden;
}

/* En reposo: la flecha "empuja" suavemente hacia su dirección */
.products__arrow--prev svg { animation: products-idle-prev 2.4s ease-in-out infinite; }
.products__arrow--next svg { animation: products-idle-next 2.4s ease-in-out infinite; }

@keyframes products-idle-prev {
  0%, 60%, 100% { transform: translateX(0); }
  70% { transform: translateX(-4px); }
  80% { transform: translateX(1px); }
  90% { transform: translateX(-2px); }
}

@keyframes products-idle-next {
  0%, 60%, 100% { transform: translateX(0); }
  70% { transform: translateX(4px); }
  80% { transform: translateX(-1px); }
  90% { transform: translateX(2px); }
}

.products__arrow:hover {
  background: #4a2e20;
  transform: translateY(-50%) scale(1.1);
}

/* Al pasar el mouse: la flecha sale por un lado y vuelve a entrar por el otro */
.products__arrow--prev:hover svg { animation: products-swoosh-prev 0.55s cubic-bezier(0.65, 0, 0.35, 1); }
.products__arrow--next:hover svg { animation: products-swoosh-next 0.55s cubic-bezier(0.65, 0, 0.35, 1); }

@keyframes products-swoosh-prev {
  0%   { transform: translateX(0);     opacity: 1; }
  45%  { transform: translateX(-160%); opacity: 0; }
  50%  { transform: translateX(160%);  opacity: 0; }
  100% { transform: translateX(0);     opacity: 1; }
}

@keyframes products-swoosh-next {
  0%   { transform: translateX(0);     opacity: 1; }
  45%  { transform: translateX(160%);  opacity: 0; }
  50%  { transform: translateX(-160%); opacity: 0; }
  100% { transform: translateX(0);     opacity: 1; }
}

/* El trazo de la flecha se "dibuja" al hacer click */
.products__arrow svg path {
  stroke-dasharray: 20;
  stroke-dashoffset: 0;
}

.products__arrow.is-clicked svg path {
  animation: products-draw 0.45s ease-out;
}

@keyframes products-draw {
  from { stroke-dashoffset: 20; }
  to   { stroke-dashoffset: 0; }
}

.products__arrow:active {
  transform: translateY(-50%) scale(0.92);
}

.products__arrow:focus-visible {
  outline: 2px solid var(--color-brown);
  outline-offset: 3px;
}

@media (max-width: 767px) {
  .products {
    --per-view: 1;
  }
}

/* ==========================================================
   Nubes
   ========================================================== */

.clouds {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-sky);
  overflow: hidden;
}

.clouds__content {
  position: relative;
  z-index: 1;
  flex: 1 1 44%;
  padding: 2rem 0 2rem clamp(24px, 8.5vw, 120px);
  /* El texto puede montarse un poco sobre la zona de nubes, como en el diseño */
  margin-right: -6%;
}

.clouds__title {
  margin: 0 0 0.55em;
  font-size: clamp(1.9rem, 4.68vw, 4rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
}

.clouds__text {
  margin: 0;
  font-size: clamp(1.1rem, 2.6vw, 2.1rem);
  line-height: 1.2;
}

/* Saltos de línea como en el diseño; en móvil el texto fluye libre */
@media (max-width: 767px) {
  .clouds__br {
    display: none;
  }
}

.clouds__art {
  flex: 0 0 56%;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
}

/* --mx / --my (de -1 a 1) los calcula js/main.js según la posición del mouse */
.clouds__art img {
  width: 100%;
  /* Escala base > 1 para que el paralaje nunca deje ver los bordes */
  scale: 1.06;
  translate: calc(var(--mx, 0) * -2.5%) calc(var(--my, 0) * -2.5%);
  transition: translate 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  animation: clouds-breathe 8s ease-in-out infinite;
}

/* "Respiración" de las nubes: solo crece desde la escala base */
@keyframes clouds-breathe {
  0%, 100% { scale: 1.06; }
  50%      { scale: 1.09; }
}

/* El texto se mueve poco y hacia el lado contrario que las nubes: profundidad */
.clouds__content {
  translate: calc(var(--mx, 0) * 10px) calc(var(--my, 0) * 6px);
  transition: translate 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Entrada de textos (solo si JS preparó la sección) ---- */
.clouds__word {
  display: inline-block;
}

.clouds.is-ready .clouds__word {
  opacity: 0;
  transform: translateY(0.7em) rotate(4deg);
  transition:
    opacity 0.6s ease,
    transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-delay: calc(var(--i) * 80ms);
}

.clouds.is-ready .clouds__text {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease 0.6s, transform 0.7s ease 0.6s;
}

.clouds.is-visible .clouds__word,
.clouds.is-visible .clouds__text {
  opacity: 1;
  transform: none;
}

/* Al pasar el mouse por el título las palabras saltan en ola */
@media (hover: hover) {
  .clouds.is-visible .clouds__title:hover .clouds__word {
    animation: clouds-word-hop 0.55s ease calc(var(--i) * 55ms);
  }
}

@keyframes clouds-word-hop {
  0%, 100% { transform: translateY(0); }
  40%      { transform: translateY(-0.22em); }
  70%      { transform: translateY(0.04em); }
}

@media (max-width: 767px) {
  .clouds {
    flex-direction: column;
    align-items: stretch;
  }

  .clouds__content {
    padding: 2.5rem 24px 0;
  }

  .clouds__art {
    flex-basis: auto;
    margin-top: 1rem;
  }
}

/* ==========================================================
   Conoce más (enlace a Plásticos La Ardilla)
   ========================================================== */

.conoce {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  min-height: clamp(76px, 11vw, 150px);
  padding: 0 clamp(20px, 7vw, 100px);
  background: #60422a;
  color: #e0cebc;
  text-decoration: none;
  overflow: hidden;
}

.conoce__art {
  flex: 0 0 auto;
  align-self: flex-end;
  transform-origin: center bottom;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tamaños proporcionales al mockup (≈19–20% del archivo a 419px) */
.conoce__art--left  { width: clamp(46px, 10vw, 130px); }
.conoce__art--right { width: clamp(58px, 12.5vw, 162px); padding-top: 16px; }

.conoce__text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(1.25rem, 2.9vw, 2.4rem);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.3s ease;
}

/* Subrayado que se dibuja al pasar el mouse */
.conoce__text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.25em;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s ease;
}

/* Los puntos suspensivos "rebotan" en reposo para invitar al click */
.conoce__dots span {
  display: inline-block;
  animation: conoce-dot 1.6s ease-in-out infinite;
}

.conoce__dots span:nth-child(2) { animation-delay: 0.15s; }
.conoce__dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes conoce-dot {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-0.2em); }
}

@media (hover: hover) {
  .conoce:hover .conoce__text {
    color: var(--color-white);
  }

  .conoce:hover .conoce__text::after {
    transform: scaleX(1);
  }

  /* Canasta y maceta se mueven como si saludaran */
  .conoce:hover .conoce__art--left {
    animation: conoce-wiggle 0.7s ease;
  }

  .conoce:hover .conoce__art--right {
    animation: conoce-wiggle 0.7s ease 0.1s;
  }
}

@keyframes conoce-wiggle {
  0%, 100% { transform: rotate(0) translateY(0); }
  25%      { transform: rotate(-5deg) translateY(-4px); }
  50%      { transform: rotate(4deg) translateY(-2px); }
  75%      { transform: rotate(-2deg) translateY(0); }
}

.conoce:focus-visible {
  outline: 3px solid var(--color-white);
  outline-offset: -6px;
}

/* ==========================================================
   Footer
   ========================================================== */

.footer {
  background: var(--color-footer);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(28px, 4.5vw, 56px) clamp(24px, 6.5vw, 90px);
}

.footer__brands {
  display: flex;
  align-items: center;
  gap: clamp(28px, 7.5vw, 100px);
}

/* Tamaños proporcionales al diseño (≈63% del archivo a 1081px) */
.footer__logo--esr       { width: clamp(110px, 13.9vw, 190px); }
.footer__logo--plasticos { width: clamp(105px, 13vw, 176px); }
.footer__logo--ardilla   { width: clamp(140px, 17.4vw, 238px); }

.footer__logo {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.footer__link {
  display: block;
  border-radius: 6px;
}

/* Solo los logos con enlace se animan, para indicar que son clicables */
@media (hover: hover) {
  .footer__link:hover .footer__logo {
    transform: translateY(-4px) scale(1.04);
  }

  /* La ardilla se ladea un poco, como si saludara */
  .footer__link:hover .footer__logo--ardilla {
    transform: translateY(-4px) rotate(-4deg) scale(1.04);
  }
}

.footer__link:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 6px;
}

@media (max-width: 767px) {
  .footer__inner {
    flex-direction: column;
    gap: 28px;
    text-align: center;
  }

  .footer__brands {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 767px) {
  .banner__slide img {
    /* Proporción mobile 781x1201 */
    aspect-ratio: 781 / 1201;
  }
}

@media (prefers-reduced-motion: reduce) {
  .banner__track,
  .banner__dot,
  .products__track,
  .products__arrow {
    transition: none;
  }

  .products__item img,
  .products__tag,
  .clouds__art img,
  .clouds__content,
  .footer__logo {
    transition: none;
  }

  .products__arrow svg,
  .products__arrow svg path,
  .clouds__art img,
  .conoce__dots span,
  .conoce__art {
    animation: none !important;
  }

  .banner__dot::before {
    animation: none;
  }

  .banner__dot.is-active::after {
    animation: none;
    transform: none;
  }
}
