/* LoginStack i18n styles.
   - Hides the document body briefly while the translator does its first pass,
     to avoid a flash of English on non-English pages.
   - Styles the language switcher in the topbar. */

html.i18n-pending body { visibility: hidden !important; }
html.i18n-ready   body { visibility: visible !important; }

/* ── Language switcher ────────────────────────────────────────────── */
.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  font-family: var(--font-body, system-ui, sans-serif);
}
.lang-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--slate-200, #E3E8EF);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink, #0B1220);
  line-height: 1;
  white-space: nowrap;
}
.lang-switch__btn:hover { border-color: var(--slate-300, #C1CAD6); background: var(--slate-50, #F6F8FB); }
.lang-switch__btn:focus-visible { outline: 2px solid var(--sky-500, #2E86F0); outline-offset: 2px; }
.lang-switch__flag {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 13px;
  overflow: hidden;
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(11, 18, 32, .16),
    0 1px 1px rgba(11, 18, 32, .08);
  background: #fff;
}
.lang-switch__flag--fr {
  background: linear-gradient(90deg, #1f4fbf 0 33.333%, #fff 33.333% 66.666%, #ef4135 66.666% 100%);
}
.lang-switch__flag--de {
  background: linear-gradient(180deg, #111 0 33.333%, #dd0000 33.333% 66.666%, #ffce00 66.666% 100%);
}
.lang-switch__flag--es {
  background: linear-gradient(180deg, #aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75% 100%);
}
.lang-switch__flag--en {
  background:
    linear-gradient(33deg, transparent 0 41%, #fff 41% 47%, #c8102e 47% 53%, #fff 53% 59%, transparent 59% 100%),
    linear-gradient(-33deg, transparent 0 41%, #fff 41% 47%, #c8102e 47% 53%, #fff 53% 59%, transparent 59% 100%),
    linear-gradient(90deg, transparent 0 40%, #fff 40% 60%, transparent 60% 100%),
    linear-gradient(180deg, transparent 0 36%, #fff 36% 64%, transparent 64% 100%),
    linear-gradient(90deg, transparent 0 45%, #c8102e 45% 55%, transparent 55% 100%),
    linear-gradient(180deg, transparent 0 43%, #c8102e 43% 57%, transparent 57% 100%),
    #012169;
}
.lang-switch__code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--slate-700, #2C3646);
  text-transform: uppercase;
}
.lang-switch__caret {
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--slate-500, #5A6579);
  border-bottom: 1.5px solid var(--slate-500, #5A6579);
  transform: rotate(45deg) translateY(-2px);
  margin-left: 2px;
  transition: transform .15s ease;
}
.lang-switch.is-open .lang-switch__caret {
  transform: rotate(-135deg) translateY(-2px);
}

.lang-switch__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--slate-200, #E3E8EF);
  border-radius: 10px;
  box-shadow: var(--shadow-2, 0 8px 24px -12px rgba(11,18,32,.14));
  display: none;
  z-index: 80;
}
.lang-switch.is-open .lang-switch__menu { display: block; }
.lang-switch__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink, #0B1220);
  text-align: left;
  line-height: 1.2;
}
.lang-switch__option:hover { background: var(--slate-50, #F6F8FB); }
.lang-switch__option.is-current { background: var(--sky-50, #EEF4FC); color: var(--sky-700, #0A4DAD); }
.lang-switch__option .lang-switch__flag {
  width: 20px;
  height: 14px;
}
.lang-switch__option .lang-switch__check {
  margin-left: auto;
  color: var(--sky-700, #0A4DAD);
  font-weight: 700;
  font-size: 13px;
}
.lang-switch__option:not(.is-current) .lang-switch__check { display: none; }

/* On narrow viewports the switcher collapses to flag-only. */
@media (max-width: 980px) {
  .lang-switch__code { display: none; }
  .lang-switch__btn { padding: 0 10px; }
}

.drawer-lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--slate-200, #E3E8EF);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: var(--ink, #0B1220);
}
.drawer-lang:hover {
  background: var(--slate-50, #F6F8FB);
  border-color: var(--slate-300, #C1CAD6);
}
.drawer-lang .lang-switch__flag {
  width: 18px;
  height: 13px;
}

/* Cards / hero text in longer languages may overflow — give them headroom. */
html[lang="de"] h1, html[lang="de"] h2, html[lang="de"] h3,
html[lang="fr"] h1, html[lang="fr"] h2,
html[lang="es"] h1, html[lang="es"] h2 {
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}
html[lang="de"] .btn, html[lang="fr"] .btn, html[lang="es"] .btn { white-space: normal; }
