/* ==========================================================================
   Language switch — Carbon content switcher
   ========================================================================== */

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--cds-border-strong);
  border-radius: var(--cds-radius);
}

.lang-switch__btn {
  min-width: 4.5rem;
  height: 2rem;
  padding: 0 var(--cds-spacing-04);
  font-size: 0.875rem;
  line-height: 1;
  color: var(--cds-text-primary);
  background: transparent;
  transition:
    background var(--cds-duration-fast) var(--cds-ease-productive),
    color var(--cds-duration-fast) var(--cds-ease-productive);
}

.lang-switch__btn + .lang-switch__btn {
  border-left: 1px solid var(--cds-border-strong);
}

.lang-switch__btn:hover {
  background: var(--cds-layer-hover);
}

.lang-switch__btn[aria-pressed="true"] {
  color: var(--cds-background);
  background: var(--cds-text-primary);
  font-weight: 600;
}

.lang-switch__btn:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: -2px;
}

/* "Beta" note on a language whose translation is still being improved. */
.lang-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--cds-spacing-02, 0.25rem);
}

.lang-switch__beta {
  padding: 0.0625rem 0.3125rem;
  font-family: var(--cds-font-sans, inherit);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  /* A filled, moving gradient pill: readable on both the plain and the selected button. */
  color: var(--cds-white);
  background: linear-gradient(
    90deg,
    var(--cds-blue-60),
    var(--cds-purple-60),
    #d02670,
    var(--cds-cyan-60),
    var(--cds-blue-60)
  );
  background-size: 300% 100%;
  border-radius: 999px;
  animation: lang-switch-beta 4s linear infinite;
}

@keyframes lang-switch-beta {
  to {
    background-position: 150% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-switch__beta {
    animation: none;
  }
}

/* ---- Light / dark switch (components/theme-toggle.js), next to the language switch ---- */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.125rem;
  height: 2.125rem;
  margin-left: var(--cds-spacing-03, 0.5rem);
  padding: 0;
  border: 1px solid var(--cds-border-strong);
  border-radius: var(--cds-radius);
  background: transparent;
  color: var(--cds-text-primary);
  cursor: pointer;
  vertical-align: middle;
  transition: background var(--cds-duration-fast) var(--cds-ease-productive);
}

.theme-toggle:hover { background: var(--cds-layer-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--cds-focus); outline-offset: -2px; }
.theme-toggle svg { width: 1.125rem; height: 1.125rem; transition: transform 0.4s var(--cds-ease-expressive); }
.theme-toggle:active svg { transform: rotate(40deg); }

/* Language switch + light/dark switch, kept together. */
.site-controls {
  display: inline-flex;
  align-items: center;
  flex: none;
}

/* A small warning dot on the Khmer button when the current page is not translated yet, so
   readers notice before they switch. (components/translation-notice.js) */
.lang-switch__btn { position: relative; }
.lang-switch__alert {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cds-support-warning, #f1c21b);
  box-shadow: 0 0 0 1.5px var(--cds-layer, #fff);
}
