/* Selector de idioma (ver js/i18n.js). Va aparte de site.css porque ese
   fichero lo regenera scripts/build.py. */

/* Mientras js/i18n.js aplica el catalán, se oculta la página para que no se
   vea un destello en castellano (el snippet del <head> pone esta clase). */
html.i18n-pending #container {
  visibility: hidden;
}

#container .lang-switch {
  position: relative;
  flex-shrink: 0;
  font-family: "Titillium Web", sans-serif;
}

#container .lang-switch__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

#container .lang-switch svg {
  display: block;
  flex-shrink: 0;
}

#container .lang-switch__chevron {
  margin-left: -2px;
  transition: transform 0.2s ease;
}

#container .lang-switch.is-open .lang-switch__chevron {
  transform: rotate(180deg);
}

#container .lang-switch__toggle:focus-visible,
#container .lang-switch__item:focus-visible {
  outline: 2px solid #d14900;
  outline-offset: 2px;
}

/* Menú desplegable con las dos versiones */
#container .lang-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 168px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.08);
}

#container .lang-switch__menu[hidden] {
  display: none;
}

#container .lang-switch__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #222;
  font-family: inherit;
  font-weight: 400;
  font-size: 15px;
  line-height: 22px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

#container .lang-switch__item:hover,
#container .lang-switch__item:focus-visible {
  background-color: #fbeee6;
}

#container .lang-switch__check {
  color: #d14900;
  visibility: hidden;
}

#container .lang-switch__item[aria-checked="true"] {
  font-weight: 600;
  color: #d14900;
}

#container .lang-switch__item[aria-checked="true"] .lang-switch__check {
  visibility: visible;
}

/* Escritorio: en la cabecera, a la derecha de "Acceder" */
#container .lang-switch--nav .lang-switch__toggle {
  padding: 0 8px 0 10px;
  color: #222;
}

#container .lang-switch--nav .lang-switch__toggle:hover,
#container .lang-switch--nav.is-open .lang-switch__toggle {
  color: #d14900;
  border-color: #d14900;
}

/* Móvil y tablet: arriba a la derecha del hero (fondo de foto oscuro) */
#container .lang-switch--hero {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
}

#container .lang-switch--hero .lang-switch__toggle {
  padding: 0 10px 0 12px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(0, 0, 0, 0.25);
}

#container .lang-switch--hero .lang-switch__toggle:hover,
#container .lang-switch--hero.is-open .lang-switch__toggle {
  border-color: #fff;
  background-color: rgba(0, 0, 0, 0.45);
}

/* Los botones "Regístrate"/"Acceder" de la cabecera traen un ancho fijo de
   Figma calculado para el texto en castellano; en catalán es más largo. */
html[lang="ca"] #container nav .css-6j1yxm,
html[lang="ca"] #container nav .css-m7ikou {
  width: auto;
}
