/* ==========================================================
   HEADER — CONTENEDOR PRINCIPAL
   ========================================================== */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;

  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(247, 248, 249, 0.86);
  backdrop-filter: blur(10px);
}


/* ==========================================================
   HEADER — DISTRIBUCIÓN INTERNA
   ========================================================== */

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;

  height: var(--header-h);
}


/* ==========================================================
   MARCA
   ========================================================== */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  flex-shrink: 0;

  color: var(--text);
  text-decoration: none;
}

.brand-logo {
    display: block;
    width: 52px;
    height: auto;
}



.brand-name {
  font-weight: 600;
  letter-spacing: 0.2px;
}

/*
 * Se conserva la clase por compatibilidad,
 * aunque el tagline ya no se muestra en el header.
 */
.brand-tagline {
  display: none;
}


/* ==========================================================
   NAVEGACIÓN DE ESCRITORIO
   ========================================================== */

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;

  /*
   * Empuja la navegación y el selector de idioma
   * hacia el extremo derecho.
   */
  margin-left: auto;
}

.nav-link {
  padding: 0.35rem 0;

  color: var(--text-2);
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;

  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}


/* ==========================================================
   SELECTOR DE IDIOMA — BASE
   ========================================================== */

.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.45rem;

  flex-shrink: 0;

  font-size: 0.95rem;
  font-weight: 600;
}

.language-switcher img {
  display: block;
  width: 18px;
  height: 18px;

  opacity: 0.85;
}

.language-switcher a {
  color: var(--muted);
  text-decoration: none;

  transition: color 0.2s ease;
}

.language-switcher a:hover,
.language-switcher a:focus-visible,
.language-switcher a.active {
  color: #2f7f4f;
}

.language-switcher a.active {
  cursor: default;
}

.language-switcher .separator {
  color: var(--muted);
  opacity: 0.5;

  user-select: none;
}


/* ==========================================================
   SELECTOR DE IDIOMA — ESCRITORIO
   ========================================================== */

.language-switcher--desktop {
  display: flex;
  margin-left: 0.75rem;
}


/* ==========================================================
   BOTÓN HAMBURGUESA
   ========================================================== */

.menu-toggle {
  display: none;

  width: 42px;
  height: 42px;
  padding: 9px;

  margin-left: auto;

  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text);

  cursor: pointer;
}

.menu-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.menu-toggle:focus-visible {
  outline: 2px solid #2f7f4f;
  outline-offset: 2px;
}

.menu-toggle span {
  display: block;

  width: 100%;
  height: 2px;
  margin: 5px 0;

  border-radius: 9px;
  background: currentColor;

  transition:
    transform 180ms ease,
    opacity 180ms ease;
}


/* ==========================================================
   BOTÓN HAMBURGUESA — ESTADO ABIERTO
   Compatible con clase .is-open y aria-expanded="true"
   ========================================================== */

.menu-toggle.is-open span:nth-child(1),
.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2),
.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open span:nth-child(3),
.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}


/* ==========================================================
   NAVEGACIÓN MÓVIL — ESTADO BASE
   ========================================================== */

.mobile-nav {
  display: none;
}

.mobile-nav__languages {
  display: none;
}


/* ==========================================================
   TABLET Y MÓVIL
   El menú pasa a hamburguesa a partir de 1100 px.
   ========================================================== */

@media (max-width: 1100px) {

  /*
   * Se ocultan la navegación y el selector
   * de idioma de escritorio.
   */
  .header-nav,
  .language-switcher--desktop {
    display: none;
  }

  /*
   * El botón queda pegado al extremo derecho.
   */
  .menu-toggle {
    display: block;
    margin-left: auto;
  }

  /*
   * Panel desplegable.
   */
  .mobile-nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    left: 0;

    display: flex;
    flex-direction: column;

    padding: 1rem var(--gutter) 1.5rem;

    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(247, 248, 249, 0.98);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.75rem);

    pointer-events: none;

    transition:
      opacity 180ms ease,
      transform 180ms ease,
      visibility 180ms ease;
  }

  /*
   * Estado abierto del panel.
   */
  .mobile-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);

    pointer-events: auto;
  }

  /*
   * Enlaces del menú desplegable.
   */
  .mobile-nav__link {
    display: block;

    padding: 0.9rem 0;

    border-bottom: 1px solid rgba(0, 0, 0, 0.07);

    color: var(--text);
    font-size: 1.05rem;
    font-weight: 500;
    text-decoration: none;
  }

  .mobile-nav__link:hover,
  .mobile-nav__link:focus-visible {
    color: #2f7f4f;
  }

  .mobile-nav__link:last-of-type {
    border-bottom: 0;
  }

  /*
   * Selector de idioma dentro del menú móvil.
   */
  .mobile-nav__languages {
    display: flex;

    margin: 1rem 0 0;
    padding-top: 1rem;

    border-top: 1px solid rgba(0, 0, 0, 0.07);
  }
}


/* ==========================================================
   MÓVILES ESTRECHOS
   ========================================================== */

@media (max-width: 480px) {

  .header-inner {
    gap: 0.75rem;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 24px;
    height: 24px;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .mobile-nav {
    padding-right: max(var(--gutter), env(safe-area-inset-right));
    padding-left: max(var(--gutter), env(safe-area-inset-left));
  }
}


/* ==========================================================
   ACCESIBILIDAD — MOVIMIENTO REDUCIDO
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

  .mobile-nav,
  .menu-toggle span,
  .nav-link,
  .language-switcher a {
    transition: none;
  }
}