/* Evita el parpalleig mentre s'aplica la traducció (només si cal canviar d'idioma). */
html.i18n-pending body { visibility: hidden; }

/* Selector d'idioma local: el normal és triar-lo dins del xip de Commons. Només es
 * mostra si el xip no carrega (html.account-fallback, vegeu scripts/i18n.js). */
.site-fallback {
  display: none;
  position: absolute;
  top: 1rem;
  left: 1rem;
  align-items: center;
  gap: .4rem;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  background: #fff;
  overflow: hidden;
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: #334155;
  font: 600 .8125rem Inter, system-ui, sans-serif;
  letter-spacing: .02em;
  padding: .5rem .7rem;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.lang-switch button + button { border-left: 1px solid #cbd5e1; }
.lang-switch button:hover { background: #f1f5f9; }
.lang-switch button[aria-pressed="true"] { background: #1f7a68; color: #fff; }
.lang-switch button:focus-visible { outline: 3px solid #60a5fa; outline-offset: -2px; }
html[data-theme="dark"] .lang-switch { border-color: #64748b; background: #334155; }
html[data-theme="dark"] .lang-switch button { color: #e2e8f0; }
html[data-theme="dark"] .lang-switch button + button { border-left-color: #64748b; }
html[data-theme="dark"] .lang-switch button:hover { background: #475569; }
html[data-theme="dark"] .lang-switch button[aria-pressed="true"] { background: #2f9c85; color: #071f17; }

@media (max-width: 640px) {
  .site-fallback { top: .65rem; left: .65rem; }
  .lang-switch button { padding: .35rem .5rem; font-size: .75rem; }
}

html.account-fallback .site-fallback { display: inline-flex; }
.fallback-home,
.fallback-theme {
  display: inline-grid;
  place-items: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  background: #fff;
  color: #334155;
  font: 600 1rem Inter, system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.fallback-home:focus-visible,
.fallback-theme:focus-visible { outline: 3px solid #2f9c85; outline-offset: 2px; }
html[data-theme="dark"] .fallback-home,
html[data-theme="dark"] .fallback-theme { border-color: #64748b; background: #334155; color: #e2e8f0; }
html.account-fallback edutictac-account.site-account { display: none; }

/* Xip de compte de Commons (inici, sessió, idioma i tema).
 * Les variables adapten la paleta del xip a la web pública. */
edutictac-account.site-account {
  position: absolute;
  top: 1rem;
  right: 1rem;
  /* Sense açò la caixa absoluta del xip mesura 0 px i retalla el nom. */
  width: max-content;
  font-family: Inter, system-ui, sans-serif;
  /* La paleta és la verda de Commons (la del mateix xip): una sola imatge per a tot l'ecosistema. */
}
header.bg-white { position: relative; }

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body { background-color: #0f172a; color: #e2e8f0; }
html[data-theme="dark"] .bg-white { background-color: #1e293b; }
html[data-theme="dark"] .bg-slate-50 { background-color: #273449; }
html[data-theme="dark"] .bg-slate-100 { background-color: #334155; }
html[data-theme="dark"] .bg-blue-50 { background-color: #172554; }
html[data-theme="dark"] .border-blue-100 { border-color: #1e40af; }
html[data-theme="dark"] .border-slate-200 { border-color: #475569; }
html[data-theme="dark"] .border-amber-200 { border-color: #92400e; }
html[data-theme="dark"] .bg-amber-50 { background-color: #422006; }
html[data-theme="dark"] .text-slate-900 { color: #f1f5f9; }
html[data-theme="dark"] .text-slate-800 { color: #e2e8f0; }
html[data-theme="dark"] .text-slate-700 { color: #cbd5e1; }
html[data-theme="dark"] .text-slate-600 { color: #cbd5e1; }
html[data-theme="dark"] .text-slate-500 { color: #a8b6c9; }
html[data-theme="dark"] .text-blue-600 { color: #60a5fa; }
html[data-theme="dark"] a.bg-slate-50:hover,
html[data-theme="dark"] a.bg-amber-50:hover { background-color: #334155; }

@media (max-width: 640px) {
  edutictac-account.site-account { top: .65rem; right: .65rem; }
  /* En mòbil, el xip ocupa la primera línia per damunt del logotip. */
  header.bg-white:has(> .site-account) { padding-top: 4.25rem; }
}
