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

/* .site-footer {
  margin-top: var(--space-7);
} */

/* =========================
   FOOTER MAIN (AZUL + PARTICLES)
========================= */

.footer {
  position: relative;
  overflow: hidden;

  background: linear-gradient(135deg, #123a8c 0%, #1557b0 45%, #1f6feb 100%);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 -8px 24px rgba(0, 0, 0, 0.12);
}

/* Forzar texto blanco dentro del footer */
.footer,
.footer * {
  color: var(--color-bg);
}

.footer a {
  color: var(--color-bg);
}

/* =========================
   Partículas
========================= */

#particles-js {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35; /* mobile */
}

#particles-js canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* =========================
   Contenedor principal
========================= */

.footer__container {
  position: relative;
  z-index: 1;

  width: min(1400px, 100%);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);

  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.footer__col {
  min-width: 0;
}

/* =========================
   Brand
========================= */
.footer__brand-link {
  display: flex;
  justify-content: center;
  width: 50%;
  margin-bottom: var(--space-3);
}

.footer__brand-logo {
  margin: 0 auto;
}

.footer__text {
  margin: 0;
  max-width: 46ch;
  line-height: var(--line-height-base);
  opacity: 0.9;
  text-align: center;
}

/* =========================
   Navegación
========================= */

.footer__title {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-base);
  font-weight: 700;
}

.footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-3);
}

.footer__item {
  margin: 0;
}

.footer__link {
  text-decoration: none;
  opacity: 0.92;
}

.footer__link:hover {
  opacity: 1;
}

/* Focus accesible */
.footer__link:focus-visible,
.footer__social-link:focus-visible {
  outline: 2px solid var(--color-bg);
  outline-offset: 3px;
  border-radius: 6px;
}

/* =========================
   Contacto
========================= */

.footer__contact {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-3);
}

.footer__contact-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: var(--space-3);
  align-items: center;
}

.footer__icon {
  opacity: 0.95;
}

.footer__muted {
  opacity: 0.9;
}

/* =========================
   Social
========================= */

.footer__social {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-3);
}

.footer__social-link {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  text-decoration: none;
}

.footer__social-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* =========================
   BARRA INFERIOR (BLANCA)
========================= */

.footer-bar {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.footer-bar__container {
  width: min(var(--container), 100%);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);

  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  align-items: center;
}

.footer-bar__copy {
  margin: 0;
  color: var(--color-text);
  line-height: 1.4;
  text-align: center;
}

.footer-bar__nav {
  display: flex;
  justify-content: center;
  gap: 0;
}

.footer-bar__link {
  position: relative;
  padding: 0 var(--space-3);
  color: var(--color-text);
  text-decoration: none;
}

/* Punto separador */
.footer-bar__link::after {
  content: "·";
  position: absolute;
  right: 0;
  top: 40%;
  transform: translateY(-50%);
  font-size: 2.4em;
  line-height: 1;
}

.footer-bar__link:last-child::after {
  content: none;
}

.footer-bar__link:first-child {
  padding-left: 0;
}

.footer-bar__link:last-child {
  padding-right: 0;
}

.footer-bar__link:hover {
  color: var(--color-link-hover);
}

.footer-bar__link:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================
   Responsive
========================= */

/* Tablet / Desktop pequeño: Brand centrado arriba + 3 columnas abajo */
@media (min-width: 700px) {
  #particles-js {
    opacity: 0.45;
  }

  .footer__container {
    grid-template-columns: repeat(3, 1fr);
    column-gap: var(--space-5);
    row-gap: var(--space-6);
    align-items: start;
    padding-inline: var(--space-4);
  }

  /* Brand arriba + centrado */
  .footer__col--brand {
    grid-column: 1 / -1;

    display: grid;
    justify-items: center;
    text-align: center;

    max-width: 820px;
    margin-inline: auto;
  }

  /* Mejor lectura del texto: centrado el bloque pero texto alineado */
  .footer__text {
    max-width: 60ch;
    text-align: center;
  }

  /* 3 columnas: centradas como grupo, texto alineado */
  .footer__col--nav,
  .footer__col--contact {
    justify-self: center;
    text-align: left;
  }
}

/* =========================
   Footer-bar fine tuning (≥800px)
========================= */
@media (min-width: 800px) {
  .footer-bar__container {
    grid-template-columns: 1fr auto;
    column-gap: var(--space-5);
    align-items: center;
  }

  /* Copy: evitar 2 líneas en anchos intermedios */
  .footer-bar__copy {
    text-align: left;
    font-size: 0.95rem; /* ajusta si quieres: 0.92–1.00 */
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* importante en grid para que funcione ellipsis */
  }

  .footer-bar__nav {
    justify-content: flex-end;
    white-space: nowrap; /* mantiene los enlaces en una línea */
  }

  .footer-bar__link {
    font-size: 0.95rem; /* acompaña al copy */
  }
}

/* Desktop grande: 4 columnas en línea */
@media (min-width: 1200px) {
  #particles-js {
    opacity: 0.6;
  }

  .footer__container {
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    column-gap: var(--space-5);
    row-gap: var(--space-6);
  }

  .footer__col--brand {
    grid-column: auto;
    display: block;
    text-align: left;
    max-width: none;
    margin-inline: 0;
  }

  .footer__text {
    max-width: 40ch;
  }

  /* En desktop grande, alineamos las columnas al inicio para que “respire” mejor */
  .footer__col--nav,
  .footer__col--contact {
    justify-self: start;
  }
}

/* =========================
   MOBILE (<700px) · Layout por bloques
   - Brand centrado arriba
   - Nav (col 2 y 3) en 2 columnas si cabe
   - Contacto centrado abajo
========================= */

@media (max-width: 699px) {
  /* Contenedor: aire y centrado */
  .footer__container {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    justify-items: center; /* centra los bloques */
    text-align: center;
  }

  /* Col 1 (brand) */
  .footer__col--brand {
    justify-items: center;
    text-align: left;
    width: 100%;
    max-width: 520px;
  }

  /* Texto: centrado (en móvil queda mejor) */
  .footer__text {
    margin-inline: auto;
  }

  /* Contenedor de NAVS (cols 2 y 3): 2 columnas si cabe */
  .footer__col--nav {
    width: 100%;
    max-width: 560px;
    text-align: center; /* títulos y enlaces alineados */
  }

  /* Aquí usamos el layout global: hacemos que los dos NAV queden "en línea"
     aplicando grid al contenedor y posicionando cada nav.
     Como no podemos crear wrapper, usamos grid del propio footer__container:
     - En móvil, el footer__container será 2 columnas solo para navs.
  */
  .footer__container {
    grid-template-columns: 1fr 1fr;
  }

  /* Brand ocupa ambas columnas */
  .footer__col--brand {
    grid-column: 1 / -1;
  }

  /* Navs en columnas 1 y 2 */
  .footer__col--nav:nth-of-type(1) {
    /* primer nav (Servicios) */
    grid-column: 1;
    justify-self: center;
  }
  .footer__col--nav:nth-of-type(2) {
    /* segundo nav (Recursos) */
    grid-column: 2;
    justify-self: center;
  }

  /* Contacto abajo ocupando todo */
  .footer__col--contact {
    grid-column: 1 / -1;
    justify-self: center;
    text-align: center; /* mantiene lectura */
    width: 100%;
    max-width: 560px;
  }

  /* Centrar Social dentro de contacto */
  .footer__social {
    justify-content: center;
  }

  /* Contact items: que no se "desparrame" */
  .footer__contact {
    justify-items: center; /* antes: start */
  }

  /* 2) Centra el bloque de cada fila (icono+texto) dentro del UL */
  .footer__contact-item {
    grid-template-columns: 18px auto; /* en vez de 18px 1fr */
    justify-content: center;
  }
}

/* =========================
   Footer-bar mobile fine tuning (≤520px)
========================= */
@media (max-width: 520px) {
  /* 1) Aplica a TODO el bloque blanco */
  .site-footer .footer-bar {
    font-size: 14px;
    line-height: 1.35;
  }

  /* 2) Asegura que copy y enlaces heredan el tamaño */
  .site-footer .footer-bar__copy,
  .site-footer .footer-bar__link {
    font-size: inherit;
    line-height: inherit;
  }

  /* 3) Por si alguna regla previa fuerza nowrap/ellipsis */
  .site-footer .footer-bar__copy,
  .site-footer .footer-bar__nav {
    white-space: normal;
  }

  /* 4) El separador “·” queda proporcional al nuevo tamaño */
  .site-footer .footer-bar__link::after {
    font-size: 2em;
  }
}
