/* ==========================================================================
   HEADER — Figma node 293:479 (1440x160)
   El header NO ocupa espacio en el flujo: en Figma está superpuesto sobre el
   hero de cada página (por eso todos los heroes tienen padding-top 200px, que
   ya incluye los 160px del header). Su fondo es una imagen con la onda rosa
   y debajo de la onda es transparente, así que debe ir en position:absolute
   sobre el hero — si se pone en flujo normal, el fondo del menú se corta y
   no empalma con el hero (bug reportado).
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1010;
  height: var(--header-h);
  padding: 16px 0 0;

  /* --------------------------------------------------------------------
     FONDO DE LA CABECERA — SIN DEFORMAR LA ONDA.

     El SVG mide 1440 x 184.69 y su borde superior es recto de lado a lado;
     lo curvo es solo el borde de abajo. Antes se pintaba con
     `background-size: 100% 100%` sobre un alto FIJO (160/120px), asi que al
     estrechar la pantalla la onda se comprimia en horizontal pero no en
     vertical: a 390px de ancho la curva salia 2.5 veces mas pronunciada que
     en el diseno. Ese era el "banner/cabecera deformado".

     Ahora se pinta en DOS capas:
       1. la onda, con alto proporcional al ancho de pantalla, anclada abajo;
       2. un relleno solido del mismo morado que rellena lo que quede arriba.
     Como el borde superior del SVG es recto y de color --color-primario, la
     union entre ambas capas es invisible a cualquier tamano.

     `--header-wave-h`: a 1440px vale 160px, exactamente el valor actual del
     diseno, asi que el escritorio NO cambia. Por debajo encoge en proporcion
     al ancho (11.111vw = 160/1440) y nunca supera el alto de la cabecera.
     -------------------------------------------------------------------- */
  --header-wave-h: min(var(--header-h), 11.111vw);
  background-image:
    url('../images/desktop/header/header-bg.svg'),
    linear-gradient(var(--color-primario), var(--color-primario));
  background-size:
    100% var(--header-wave-h),
    100% calc(100% - var(--header-wave-h) + 1px); /* +1px evita una linea de costura por redondeo subpixel */
  background-position: left bottom, left top;
  background-repeat: no-repeat, no-repeat;
  pointer-events: none; /* deja pasar el clic en la zona transparente de la onda */
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  pointer-events: auto;
}

/* Logo: 199x78 en Figma */
.site-header__logo img {
  width: 199px;
  height: auto;
}

/* Menú: bloque de 857px con los 6 enlaces repartidos (space-between) */
.site-header__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;              /* separación mínima: nunca se tocan */
  width: var(--w-8col);
  max-width: 100%;
}

.site-header__nav a {
  font-family: var(--font-heading);
  /* Figma usa 20px con SF Pro Display; Inter (la sustituta libre) es más ancha
     y a 20px las 6 etiquetas suman 858px, justo el ancho del bloque, dejando
     los enlaces pegados. El tamaño acompaña al ancho del bloque (que también
     escala), con tope en los 18px que caben a 1440px. */
  font-size: clamp(12px, 1.25vw, 18px);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--color-blanco);
  white-space: nowrap;
  transition: color 0.2s ease;
}
.site-header__nav a.is-active,
.site-header__nav a:hover {
  color: var(--color-secundario);
  font-weight: var(--fw-bold);
}

.site-header__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.site-header__burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-blanco);
}

@media (max-width: 1023px) {
  /* El alto lo da --header-h, redefinido para este rango en tokens.css, para
     que `calc(var(--header-h) + ...)` calcule sobre el valor real. */
  .site-header__logo img { width: 150px; }
  .site-header__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 16px;
    padding: 24px var(--grid-margin) 32px;
    background: var(--color-primario);
  }
  .site-header__nav.is-open { display: flex; }
  .site-header__burger { display: flex; }
}

/* ==========================================================================
   FOOTER — Figma node 621:1027 (1440x936)
   ========================================================================== */

.site-footer {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--color-bg);
}

/* --- Bloque superior (rosa claro): "Únete a nuestra comunidad" ----------- */
.site-footer__top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  padding: 80px var(--grid-margin);
  background: var(--color-bg);
}

.site-footer__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--w-8col);
  max-width: 100%;
  text-align: center;
}
.site-footer__intro h2 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 3vw, var(--fs-h3));
  font-weight: var(--fw-bold);
  color: var(--color-primario);
  text-transform: uppercase;
}
.site-footer__intro p {
  font-family: var(--font-heading);
  font-size: var(--fs-body-lg);
  color: var(--color-gris-oscuro);
}

/* Dos iconos de 89px repartidos en un bloque de 200px */
.site-footer__social {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 200px;
}
.site-footer__social img { width: 89px; height: 89px; }

/* --- Pleca (onda rosa + morada) -----------------------------------------
   La onda rosa + morada conecta el bloque superior con el fondo morado sin recortes. */
.site-footer__pleca {
  position: relative;
  z-index: 5;
  width: 100%;
  line-height: 0;
  margin-bottom: -2px;
}
.site-footer__pleca img {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Bloque inferior (morado) ------------------------------------------- */
.site-footer__bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 80px;
  width: 100%;
  padding: 0 var(--grid-margin) 40px;
  background: var(--color-primario);
  color: var(--color-blanco);
  box-sizing: border-box;
}

.site-footer__bottom > * {
  max-width: var(--container-max);
  width: 100%;
}

/* Fila logo + aviso */
.site-footer__row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0px;
  gap: 10px;
  width: 100%;
}
.site-footer__logo img { width: 199px; height: auto; }

.site-footer__warning {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0px;
  gap: 20px;
  width: 740px;
  height: 120px;
  flex-shrink: 0;
}
.site-footer__warning img { width: 89px; height: 89px; flex-shrink: 0; }
.site-footer__warning p {
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 24px;
  text-transform: uppercase;
  color: #FFFFFF;
  flex-grow: 1;
}

/* Bloque legal: enlaces + tarjeta UNE + copyright, separados 16px entre sí
   (en Figma es un grupo propio; antes heredaban el gap de 80px del padre y
   por eso el pie quedaba desarmado). */
.site-footer__legal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0px;
  gap: 16px;
  width: 100%;
}

.site-footer__links {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0px;
  gap: 20px;
  width: 857px;
  height: 24px;
}
.site-footer__links a {
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 24px;
  color: #FFFFFF;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.site-footer__links a:hover { color: var(--color-secundario); }

.site-footer__une {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 24px 60px 24px 40px;
    gap: 32px;
    width: 100%;
    min-height: 162px;
    background: #FFFFFF;
    border-radius: 24px;
  }
.site-footer__une p {
    width: 950px;
    max-width: 100%;
    height: auto;
    font-family: var(--font-heading);
    font-size: 16px;
    line-height: 19px;
    color: #543784;
  }

/* Bloque de sellos: 199x112 en Figma, 2x2 */
.site-footer__badges {
  width: 199px;
  height: 112px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  align-items: center;
  justify-items: center;
  gap: 8px 12px;
  flex-shrink: 0;
}
.site-footer__badges img { max-height: 48px; width: auto; }

.site-footer__copy {
  width: 817px;
  height: 19px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  line-height: 19px;
  color: #FFFFFF;
}

@media (max-width: 1023px) {
  .site-footer__top {
    padding: 60px var(--grid-margin);
    gap: 28px;
  }
  .site-footer__intro h2 {
    font-size: clamp(20px, 3.5vw, 26px);
  }
  .site-footer__intro p {
    font-size: clamp(14px, 2.2vw, 17px);
  }
  .site-footer__social {
    width: auto;
    gap: 24px;
    justify-content: center;
  }
  .site-footer__social img {
    width: 68px;
    height: 68px;
  }

  .site-footer__bottom {
    gap: 40px;
    padding: 0 var(--grid-margin) 40px;
  }
  .site-footer__row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    width: 100%;
  }
  .site-footer__logo img {
    width: 160px;
  }
  .site-footer__warning {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    width: auto;
    max-width: 640px;
    height: auto;
  }
  .site-footer__warning img {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
  }
  .site-footer__warning p {
    font-size: 15px;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .site-footer__legal {
    gap: 20px;
    width: 100%;
  }
  .site-footer__links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px 28px;
    width: 100%;
    height: auto;
  }
  .site-footer__links a {
    font-size: 16px;
    line-height: 1.3;
    white-space: nowrap;
  }

  .site-footer__une {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    padding: 24px;
    border-radius: 20px;
  }
  .site-footer__une p {
    width: 100%;
    font-size: 13px;
    line-height: 1.5;
  }
  .site-footer__badges {
    width: 100%;
    height: auto;
    grid-template-columns: repeat(4, auto);
    justify-content: flex-start;
    gap: 16px 24px;
  }
  .site-footer__badges img {
    max-height: 44px;
  }

  .site-footer__copy {
    width: 100%;
    height: auto;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
  }
}

@media (max-width: 767px) {
  .site-footer__top {
    padding: 48px var(--grid-margin);
    gap: 24px;
  }
  .site-footer__intro h2 {
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.25;
  }
  .site-footer__intro p {
    font-size: 14px;
    line-height: 1.4;
  }
  .site-footer__social {
    gap: 20px;
  }
  .site-footer__social img {
    width: 54px;
    height: 54px;
  }

  .site-footer__pleca {
    position: relative;
    z-index: 2;
    height: auto;
    line-height: 0;
    margin-bottom: -1px;
  }
  .site-footer__pleca img {
    width: 100%;
    height: auto;
    display: block;
  }

  .site-footer__bottom {
    position: relative;
    z-index: 1;
    gap: 32px;
    padding: 24px var(--grid-margin) 32px;
  }
  .site-footer__row {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    width: 100%;
  }
  .site-footer__logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  .site-footer__logo img {
    width: 170px;
    max-width: 80%;
    height: auto;
    display: block;
    margin: 0 auto;
  }
  .site-footer__warning {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    width: 100%;
    height: auto;
  }
  .site-footer__warning img {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
  }
  .site-footer__warning p {
    font-size: 13px;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .site-footer__links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 18px;
    width: 100%;
    height: auto;
  }
  .site-footer__links a {
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
  }
}

@media (max-width: 504px) {
  .site-footer__links {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
  }
  .site-footer__links a {
    text-align: center;
  }

  .site-footer__une {
    padding: 18px 16px;
    border-radius: 16px;
    gap: 20px;
  }
  .site-footer__une p {
    font-size: 12px;
    line-height: 1.5;
  }
  .site-footer__badges {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    justify-items: center;
  }
  .site-footer__badges img {
    max-height: 38px;
  }

  .site-footer__copy {
    font-size: 12px;
    text-align: left;
  }
}

/* ==========================================================================
   Botón flotante de WhatsApp — Figma "Isolation_Mode" 244x54.

   En Figma es un carril absoluto que arranca en y=395 y llega hasta el final
   de la página, con el botón en `sticky top:0` dentro. Es decir: empieza a la
   altura del hero y, al hacer scroll, sube hasta quedarse pegado arriba.
   ========================================================================== */
.whatsapp-float-wrap {
  position: fixed;
  top: 84px;
  right: max(var(--grid-margin), calc((100vw - var(--container-max)) / 2 + var(--grid-margin)));
  z-index: 1020;
  width: clamp(120px, 11vw, 160px);
  pointer-events: none;
  transition: top 0.25s ease, right 0.25s ease, width 0.25s ease;
}

.whatsapp-float {
  display: block;
  width: 100%;
  pointer-events: auto;
  transition: transform 0.2s ease;
}
.whatsapp-float:hover { transform: translateX(-4px); }
.whatsapp-float img { display: block; width: 100%; height: auto; }

@media (min-width: 1720px) {
  .whatsapp-float-wrap {
    top: 34px;
    right: max(24px, calc((100vw - var(--container-max)) / 2 - 150px));
  }
}

@media (max-width: 1023px) {
  .whatsapp-float-wrap {
    top: 80px;
    right: var(--grid-margin);
    width: clamp(110px, 15vw, 136px);
  }
}

@media (max-width: 767px) {
  .whatsapp-float-wrap {
    top: 76px;
    right: var(--grid-margin);
    width: clamp(96px, 25vw, 120px);
  }
}
