/* Ordelvio site languages: the language switch and the language hint.
   Themed by custom properties on .l10n-switch; dark by default for black-field
   sites. Positioned with logical properties so the corner follows the page
   direction. No third-party fonts: system stacks per script via :lang(). */

.l10n-switch {
  --l10n-bg: rgba(10, 12, 14, 0.94);
  --l10n-fg: #f3f6f7;
  --l10n-muted: #a3adb3;
  --l10n-border: rgba(255, 255, 255, 0.16);
  --l10n-hover: rgba(255, 255, 255, 0.08);
  --l10n-accent: #2fd6c8;
  --l10n-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --l10n-radius: 12px;
  --l10n-gap: 16px;
  --l10n-z: 2147483000;
  --l10n-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  position: fixed;
  z-index: var(--l10n-z);
  inset-block-end: max(var(--l10n-gap), env(safe-area-inset-bottom, 0px));
  inset-inline-end: max(var(--l10n-gap), env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-inline-size: calc(100vw - 2 * var(--l10n-gap));
  margin: 0;
  padding: 0;
  color: var(--l10n-fg);
  font: 500 15px/1.35 var(--l10n-font);
  letter-spacing: normal;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  pointer-events: none;
}

.l10n-switch[data-theme="light"] {
  --l10n-bg: rgba(255, 255, 255, 0.97);
  --l10n-fg: #101417;
  --l10n-muted: #57636b;
  --l10n-border: rgba(16, 20, 23, 0.16);
  --l10n-hover: rgba(16, 20, 23, 0.06);
  --l10n-accent: #0b8f86;
  --l10n-shadow: 0 12px 32px rgba(16, 20, 23, 0.18);
}

@media (prefers-color-scheme: light) {
  .l10n-switch[data-theme="auto"] {
    --l10n-bg: rgba(255, 255, 255, 0.97);
    --l10n-fg: #101417;
    --l10n-muted: #57636b;
    --l10n-border: rgba(16, 20, 23, 0.16);
    --l10n-hover: rgba(16, 20, 23, 0.06);
    --l10n-accent: #0b8f86;
    --l10n-shadow: 0 12px 32px rgba(16, 20, 23, 0.18);
  }
}

.l10n-switch[data-corner="bottom-start"] {
  inset-inline-end: auto;
  inset-inline-start: max(var(--l10n-gap), env(safe-area-inset-left, 0px));
  align-items: flex-start;
}

.l10n-switch[data-corner="top-end"],
.l10n-switch[data-corner="top-start"] {
  inset-block-end: auto;
  inset-block-start: max(var(--l10n-gap), env(safe-area-inset-top, 0px));
}

.l10n-switch[data-corner="top-start"] {
  inset-inline-end: auto;
  inset-inline-start: max(var(--l10n-gap), env(safe-area-inset-left, 0px));
  align-items: flex-start;
}

.l10n-switch *,
.l10n-switch *::before,
.l10n-switch *::after {
  box-sizing: border-box;
}

.l10n-switch__details {
  position: relative;
  margin: 0;
  pointer-events: auto;
}

.l10n-switch__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-inline-size: 44px;
  min-block-size: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--l10n-border);
  border-radius: 999px;
  background: var(--l10n-bg);
  color: var(--l10n-fg);
  box-shadow: var(--l10n-shadow);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.l10n-switch__trigger::-webkit-details-marker,
.l10n-switch__trigger::marker {
  display: none;
  content: "";
}

.l10n-switch__trigger:hover,
.l10n-switch__details[open] > .l10n-switch__trigger {
  border-color: var(--l10n-accent);
}

.l10n-switch__globe {
  flex: none;
  inline-size: 18px;
  block-size: 18px;
}

.l10n-switch__short {
  white-space: nowrap;
}

.l10n-switch__panel {
  position: absolute;
  inset-block-end: calc(100% + 8px);
  inset-inline-end: 0;
  inline-size: max-content;
  min-inline-size: 220px;
  max-inline-size: min(320px, calc(100vw - 2 * var(--l10n-gap)));
  max-block-size: min(70vh, 680px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--l10n-border);
  border-radius: var(--l10n-radius);
  background: var(--l10n-bg);
  box-shadow: var(--l10n-shadow);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  scrollbar-width: thin;
  animation: l10n-switch-in 120ms ease-out;
}

.l10n-switch[data-corner$="-start"] .l10n-switch__panel {
  inset-inline-end: auto;
  inset-inline-start: 0;
}

.l10n-switch[data-corner^="top-"] .l10n-switch__panel {
  inset-block-end: auto;
  inset-block-start: calc(100% + 8px);
}

.l10n-switch__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.l10n-switch__list > li {
  margin: 0;
  padding: 0;
}

.l10n-switch__item {
  display: grid;
  grid-template-columns: 1fr 18px;
  align-items: center;
  gap: 12px;
  min-block-size: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--l10n-fg);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  text-align: start;
  outline: none;
}

.l10n-switch__item:hover {
  background: var(--l10n-hover);
}

.l10n-switch__name {
  justify-self: start;
  unicode-bidi: isolate;
}

.l10n-switch__item[aria-current="true"] {
  color: var(--l10n-accent);
  font-weight: 650;
}

.l10n-switch__check {
  grid-column: 2;
  inline-size: 18px;
  block-size: 18px;
}

.l10n-switch__trigger:focus-visible,
.l10n-switch__item:focus-visible,
.l10n-hint a:focus-visible,
.l10n-hint__close:focus-visible {
  outline: 2px solid var(--l10n-accent);
  outline-offset: 2px;
}

.l10n-switch__item:focus-visible {
  outline-offset: -2px;
  background: var(--l10n-hover);
}

.l10n-sr {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* The hint: one dismissible line in the visitor's language, shown beside the trigger. */
.l10n-hint {
  order: -1;
  display: flex;
  align-items: center;
  gap: 4px;
  max-inline-size: min(380px, calc(100vw - 2 * var(--l10n-gap)));
  margin: 0;
  padding-block: 0;
  padding-inline: 14px 0;
  border: 1px solid var(--l10n-border);
  border-radius: var(--l10n-radius);
  background: var(--l10n-bg);
  color: var(--l10n-fg);
  box-shadow: var(--l10n-shadow);
  font-size: 14px;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: l10n-switch-in 160ms ease-out;
}

.l10n-switch__details[open] ~ .l10n-hint {
  visibility: hidden;
}

.l10n-switch[data-corner^="top-"] .l10n-hint {
  order: 1;
}

.l10n-hint__text {
  margin: 0;
  padding: 10px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.l10n-hint a {
  color: var(--l10n-accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.l10n-hint__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  inline-size: 44px;
  block-size: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--l10n-radius);
  background: transparent;
  color: var(--l10n-muted);
  font: inherit;
  cursor: pointer;
}

.l10n-hint__close:hover {
  color: var(--l10n-fg);
}

.l10n-hint__close svg {
  inline-size: 16px;
  block-size: 16px;
}

/* System font stacks per script; names that need another script use it. */
.l10n-switch :lang(ar),
.l10n-switch:lang(ar) {
  font-family: "Geeza Pro", "Segoe UI", Tahoma, system-ui, sans-serif;
}

.l10n-switch :lang(hi),
.l10n-switch:lang(hi) {
  font-family: "Kohinoor Devanagari", "Nirmala UI", Mangal, system-ui, sans-serif;
}

.l10n-switch :lang(ja),
.l10n-switch:lang(ja) {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}

.l10n-switch :lang(ko),
.l10n-switch:lang(ko) {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

.l10n-switch :lang(zh-Hans),
.l10n-switch:lang(zh-Hans) {
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

.l10n-switch :lang(zh-Hant),
.l10n-switch:lang(zh-Hant) {
  font-family: "PingFang TC", "Microsoft JhengHei UI", "Microsoft JhengHei", system-ui, sans-serif;
}

@keyframes l10n-switch-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .l10n-switch__trigger,
  .l10n-switch__panel,
  .l10n-hint {
    transition: none;
    animation: none;
  }
}

@media (forced-colors: active) {
  .l10n-switch__trigger,
  .l10n-switch__panel,
  .l10n-hint {
    border-color: CanvasText;
  }

  .l10n-switch__item[aria-current="true"] {
    color: Highlight;
  }
}

@media print {
  .l10n-switch {
    display: none !important;
  }
}
