/* Musiveo Translate - switcher + toast. Dark-mode aware via Musiveo vars with fallbacks. */
/* All control/menu selectors are scoped to this plugin's data attributes so
   theme menus, rails, and mobile toggles cannot inherit switcher styles. */
[data-mt-switcher] { font-family: inherit; max-width: 100%; }
[data-mt-switcher] .mt-dropdown { position: relative; display: inline-flex; max-width: 100%; }
[data-mt-switcher] .mt-dropdown.is-open { z-index: 10002; }
[data-mt-switcher] .mt-dropdown__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 50px; height: 36px; min-width: 50px; padding: 0 7px;
  border-radius: 999px; cursor: pointer;
  background: var(--mt-bg, #111318); color: var(--mt-fg, #fff);
  border: 1px solid var(--mt-border, rgba(255,255,255,.14));
  font: inherit; font-size: 12px; font-weight: 700; line-height: 1;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none; appearance: none;
}
[data-mt-switcher] .mt-dropdown__btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
[data-mt-switcher] .mt-dropdown__btn:active { transform: translateY(0); }
[data-mt-switcher] .mt-dropdown__btn:focus-visible { outline: 2px solid var(--mt-accent, #8b5cf6); outline-offset: 2px; }
[data-mt-switcher] .mt-dropdown__btn .mt-chev { display: none; }
[data-mt-switcher] .mt-dropdown__btn .mt-code { flex: none; }
[data-mt-switcher] .mt-popup__btn {
  width: auto; min-width: 76px; max-width: 100%; justify-content: flex-start;
  padding: 0 10px; font-size: 12px; font-weight: 700;
}
[data-mt-switcher] .mt-popup__btn .mt-code {
  min-width: 24px; height: 20px; padding: 0 6px; border-radius: 6px;
  font-size: 10px; letter-spacing: .03em;
}
[data-mt-switcher] .mt-popup__label {
  flex: 1 1 auto; min-width: 0; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; line-height: 1;
}
[data-mt-switcher] .mt-visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: 0 !important; overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important; white-space: nowrap !important; border: 0 !important;
}

[data-mt-menu].mt-menu {
  position: absolute; z-index: 9999; top: calc(100% + 8px); right: 0; min-width: 230px;
  max-width: calc(100vw - 32px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--mt-menu-bg, #1a1d24); color: var(--mt-menu-fg, #fff);
  border: 1px solid var(--mt-border, rgba(255,255,255,.12)); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.4); max-height: 320px; overflow: auto;
  overscroll-behavior: contain;
}
[data-mt-menu].mt-menu[hidden] { display: none; }
[data-mt-menu].mt-menu.is-left { left: 0; right: auto; }
[data-mt-menu].mt-menu.is-up { top: auto; bottom: calc(100% + 8px); }
[data-mt-menu].mt-menu.is-fixed { position: fixed; z-index: 10001; }
[data-mt-menu].mt-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-width: 0; padding: 9px 10px; border: 0; background: transparent; color: inherit;
  border-radius: 9px; cursor: pointer; font: inherit; font-size: 13.5px; text-align: left;
  -webkit-appearance: none; appearance: none;
}
[data-mt-menu].mt-menu button:hover,
[data-mt-menu].mt-menu button.is-active,
[data-mt-menu].mt-menu button:focus-visible {
  background: rgba(255,255,255,.08); outline: none;
}
[data-mt-menu].mt-menu button:focus-visible { box-shadow: inset 0 0 0 1px var(--mt-accent, #8b5cf6); }
[data-mt-menu].mt-menu button small { opacity: .55; font-weight: 400; margin-left: auto; white-space: nowrap; }
[data-mt-switcher] .mt-code,
[data-mt-menu] .mt-code {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px;
  background: rgba(255,255,255,.1); font-size: 11px; font-weight: 700; letter-spacing: .04em;
}

/* The language control opens a real centered dialog, not a dropdown. The
 * overlay is a sibling of the button and uses viewport coordinates so a
 * clipped or narrow host cannot turn it into a cramped popover. */
[data-mt-menu].mt-language-overlay {
  position: fixed !important;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 10050;
  display: flex; align-items: center; justify-content: center;
  width: auto; min-width: 0; max-width: none; height: auto; max-height: none;
  margin: 0; padding: 24px; overflow: auto;
  background: rgba(8, 10, 15, .72);
  border: 0; border-radius: 0; box-shadow: none;
  -webkit-overflow-scrolling: touch;
}
[data-mt-menu].mt-language-overlay[hidden] { display: none !important; pointer-events: none !important; }
/* Keep generated language dialogs above theme/admin overlays. */
[data-mt-menu][id^="mt-switcher-menu-"] { z-index: 99999 !important; }
[data-mt-menu][id^="mt-switcher-menu-"][hidden] { display: none !important; pointer-events: none !important; }
[data-mt-menu] .mt-language-dialog {
  display: flex; flex-direction: column;
  width: 480px; max-width: 100%; max-height: calc(100vh - 48px);
  overflow: hidden; color: var(--mt-menu-fg, #fff);
  background: var(--mt-menu-bg, #1a1d24);
  border: 1px solid var(--mt-border, rgba(255,255,255,.14));
  border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.48);
}
[data-mt-menu] .mt-language-dialog__header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--mt-border, rgba(255,255,255,.1));
}
[data-mt-menu] .mt-language-dialog__header > div { min-width: 0; }
[data-mt-menu] .mt-language-dialog__header strong { display: block; font-size: 19px; line-height: 1.2; }
[data-mt-menu] .mt-language-dialog__eyebrow {
  display: block; margin-bottom: 5px; color: var(--mt-muted, rgba(255,255,255,.55));
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
[data-mt-menu] .mt-language-close {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.08); color: inherit; cursor: pointer;
  font: inherit; font-size: 24px; line-height: 1;
}
[data-mt-menu] .mt-language-close:hover,
[data-mt-menu] .mt-language-close:focus-visible { background: rgba(255,255,255,.16); outline: none; }
[data-mt-menu] .mt-language-current {
  display: flex; align-items: center; gap: 10px; margin: 14px 16px 0; padding: 10px 12px;
  color: var(--mt-muted, rgba(255,255,255,.65)); background: rgba(255,255,255,.06);
  border-radius: 10px; font-size: 12px; font-weight: 600;
}
[data-mt-menu] .mt-language-list {
  display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto;
  padding: 14px 16px 18px; overscroll-behavior: contain;
}
[data-mt-menu] .mt-language-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px;
  padding: 9px 12px; border: 1px solid transparent; border-radius: 11px;
  background: rgba(255,255,255,.035); color: inherit; text-align: left;
}
[data-mt-menu] .mt-language-row:hover,
[data-mt-menu] .mt-language-row:focus-visible { background: rgba(255,255,255,.1); outline: none; }
[data-mt-menu] .mt-language-row.is-active {
  border-color: var(--mt-accent, #8b5cf6); background: rgba(139,92,246,.16);
}
[data-mt-menu] .mt-language-row .mt-code { flex: 0 0 38px; min-width: 38px; height: 28px; }
[data-mt-menu] .mt-language-row__text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; gap: 2px; }
[data-mt-menu] .mt-language-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; }
[data-mt-menu] .mt-language-row__text small { opacity: .7; font-size: 11px; font-weight: 400; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-mt-menu] .mt-language-check { flex: 0 0 18px; color: var(--mt-accent, #a78bfa); font-size: 16px; font-weight: 800; opacity: 0; }
[data-mt-menu] .mt-language-row.is-active .mt-language-check { opacity: 1; }

[data-mt-switcher] .mt-pills { display: flex; flex-wrap: wrap; gap: 8px; }
[data-mt-switcher] .mt-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border-radius: 999px; border: 1px solid var(--mt-border, rgba(255,255,255,.14));
  background: transparent; color: inherit; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
[data-mt-switcher] .mt-pill.is-active { background: var(--mt-accent, #6c5ce7); border-color: transparent; color: #fff; }
[data-mt-switcher] .mt-pill__code { font-size: 11px; opacity: .7; font-weight: 800; }
[data-mt-switcher] .mt-compact { position: relative; display: inline-block; }
[data-mt-switcher] .mt-compact__btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--mt-bg, #111318); color: var(--mt-fg, #fff); border: 1px solid var(--mt-border, rgba(255,255,255,.14)); font-weight: 800; font-size: 12px;
}
[data-mt-switcher] .mt-compact [data-mt-menu].mt-menu { right: 0; left: auto; min-width: 190px; }
.mt-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px);
  background: #111318; color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; z-index: 10000; opacity: 0;
  transition: opacity .3s ease, transform .3s ease, box-shadow .3s ease; box-shadow: 0 12px 34px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12); pointer-events: none; max-width: 90vw;
}
.mt-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Japanese / CJK typography guard: keep headings readable after translation. */
body.mt-lang-ja, body.mt-lang-cjk { overflow-wrap: break-word; }
body.mt-lang-ja h1, body.mt-lang-ja h2, body.mt-lang-ja h3,
body.mt-lang-cjk h1, body.mt-lang-cjk h2, body.mt-lang-cjk h3 {
  line-break: strict; word-break: normal; letter-spacing: 0;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC", system-ui, sans-serif;
}
html[data-mt-lang="ar"] body { direction: rtl; }

/* The trigger is allowed to shrink with its host; the dialog itself is
 * viewport-sized and independent of the host container. */
@media (max-width: 420px) {
  [data-mt-menu].mt-language-overlay { padding: 12px; }
  [data-mt-menu] .mt-language-dialog { max-height: calc(100vh - 24px); border-radius: 15px; }
  [data-mt-menu] .mt-language-dialog__header { padding: 17px 16px 12px; }
  [data-mt-menu] .mt-language-list { padding: 12px; }
  [data-mt-switcher] .mt-popup__label { max-width: 92px; }
}
@media (max-height: 344px) {
  [data-mt-menu].mt-language-overlay { padding: 10px; }
  [data-mt-menu] .mt-language-dialog { max-height: calc(100vh - 20px); }
  [data-mt-menu] .mt-language-list { padding-top: 10px; }
}

@media (prefers-color-scheme: light) {
  [data-mt-switcher] .mt-dropdown__btn { --mt-bg: #f1f2f6; --mt-fg: #14161b; --mt-border: rgba(0,0,0,.1); }
  [data-mt-menu].mt-menu { --mt-menu-bg: #fff; --mt-menu-fg: #14161b; --mt-muted: rgba(0,0,0,.55); }
  [data-mt-menu].mt-menu button:hover, [data-mt-menu].mt-menu button.is-active { background: rgba(0,0,0,.06); }
  [data-mt-switcher] .mt-code, [data-mt-menu] .mt-code { background: rgba(0,0,0,.07); }
}
