:root {
  --site-font: Studio, Arial, sans-serif;
  --inline-start: left;
  --inline-end: right;
  --inline-sign: 1;
}

:root[dir=rtl] {
  --site-font: Studio, "Noto Sans Arabic", Tahoma, "Segoe UI", Arial, sans-serif;
  --inline-start: right;
  --inline-end: left;
  --inline-sign: -1;
}

.switch {
  position: relative;
  flex: none;
  margin-inline-start: auto;
  font-size: 15px;
}

.switch-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: 44px;
  padding: 0 12px;
  border: 1px solid #555;
  border-radius: 24px;
  background: #111;
  color: #eee;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.switch-toggle::-webkit-details-marker {
  display: none;
}

.switch-code {
  min-inline-size: 2ch;
}

.switch-label {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.switch-toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-block-start: -3px;
  border-right: 1.5px solid;
  border-bottom: 1.5px solid;
  transform: rotate(45deg);
}

.switch[open] .switch-toggle::after {
  margin-block-start: 3px;
  transform: rotate(225deg);
}

.switch-panel {
  position: absolute;
  z-index: 6;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  min-inline-size: 148px;
  padding: 4px;
  border: 1px solid #515151;
  border-radius: 10px;
  background: #161616;
  box-shadow: 0 16px 34px #0009;
}

.switch-panel a {
  display: flex;
  align-items: center;
  inline-size: 100%;
  min-block-size: 44px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #eee;
  text-align: start;
  font-family: var(--site-font);
}

.switch-toggle:hover,
.switch-panel a:hover {
  background: #262626;
  text-decoration: none;
}

.switch-panel [aria-current=page],
.switch-panel [aria-current=page]:hover {
  background: #eee;
  color: #111;
  font-weight: 650;
}

[data-localized]:lang(ar),
.switch-panel a[lang=ar] {
  letter-spacing: normal;
}
