/*
 * Nicotinos language switcher — component-owned CSS.
 *
 * Shared tokens (coordinate with Agent 4 / brand.css):
 *   --nic-ink, --nic-ink-soft, --nic-accent
 * Local fallbacks keep the switcher usable if brand.css order changes.
 * Do not restyle this block from extra.css / brand chrome.
 */

.nic-lang-switcher {
  --nic-ls-ink: var(--nic-ink, #0b0b0c);
  --nic-ls-ink-soft: var(--nic-ink-soft, #1c1c1f);
  --nic-ls-accent: var(--nic-accent, #e6007e);
  --nic-ls-border: var(--nic-border, #c9d4e0);
  --nic-ls-surface: var(--nic-surface, #ffffff);
  --nic-ls-muted: var(--nic-muted, #8a97a6);
  --nic-ls-hover: var(--nic-surface-hover, #f3f6f9);
  --nic-ls-focus: var(--nic-focus, var(--nic-ls-ink));

  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 10px;
  z-index: 40;
}

.nic-lang-switcher__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nic-lang-switcher__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--nic-ls-border);
  background: var(--nic-ls-surface);
  color: var(--nic-ls-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  border-radius: 0;
}

.nic-lang-switcher__toggle:hover,
.nic-lang-switcher.is-open .nic-lang-switcher__toggle {
  border-color: var(--nic-ls-ink);
}

.nic-lang-switcher__toggle:focus {
  outline: none;
}

.nic-lang-switcher__toggle:focus-visible {
  outline: 2px solid var(--nic-ls-focus);
  outline-offset: 2px;
}

.nic-lang-switcher__toggle-label {
  max-width: 9.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nic-lang-switcher__chevron {
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}

.nic-lang-switcher.is-open .nic-lang-switcher__chevron {
  transform: rotate(180deg);
}

.nic-lang-switcher__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  max-height: min(70vh, 420px);
  overflow: auto;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--nic-ls-surface);
  border: 1px solid var(--nic-ls-border);
  box-shadow: 0 8px 24px rgba(11, 11, 12, 0.12);
}

.nic-lang-switcher__option {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--nic-ls-ink-soft);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
}

a.nic-lang-switcher__option:hover {
  background: var(--nic-ls-hover);
  color: var(--nic-ls-ink);
}

.nic-lang-switcher__option:focus {
  outline: none;
}

.nic-lang-switcher__option:focus-visible {
  outline: 2px solid var(--nic-ls-focus);
  outline-offset: -2px;
  background: var(--nic-ls-hover);
}

.nic-lang-switcher__option.is-current {
  font-weight: 700;
  color: var(--nic-ls-ink);
  background: var(--nic-ls-hover);
  box-shadow: inset 3px 0 0 var(--nic-ls-accent);
}

.nic-lang-switcher__option.is-unavailable {
  color: var(--nic-ls-muted);
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .nic-lang-switcher {
    margin-right: 4px;
  }

  .nic-lang-switcher__toggle {
    padding: 8px 10px;
    font-size: 12px;
  }

  .nic-lang-switcher__menu {
    min-width: 180px;
    right: -4px;
    /* Prefer opening within the viewport on narrow headers */
    max-width: min(90vw, 280px);
  }
}
