/* Shared public Light/Dark + EN/AR controls. */
.public-pref {
  --public-pref-accent: var(--brand, var(--blog-brand, #E0813F));
  --public-pref-text: var(--text, var(--blog-text, #111827));
  --public-pref-muted: var(--text-muted, var(--blog-text-muted, #6B7280));
  --public-pref-bg: rgba(255, 255, 255, .72);
  --public-pref-border: rgba(17, 24, 39, .10);
  --public-pref-active-bg: rgba(224, 129, 63, .12);
  --public-pref-active-border: rgba(224, 129, 63, .18);
  --public-pref-shadow: 0 8px 22px rgba(17, 24, 39, .08);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--public-pref-border);
  border-radius: 999px;
  background: var(--public-pref-bg);
  box-shadow: var(--public-pref-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  flex: 0 0 auto;
}

.public-pref__btn {
  position: relative;
  isolation: isolate;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--public-pref-muted);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  font: inherit;
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  direction: ltr;
  transition: color .18s ease, transform .18s ease;
}

.public-pref__btn--theme {
  width: 126px;
}

.public-pref__btn--lang {
  width: 98px;
}

.public-pref__btn::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border: 1px solid var(--public-pref-active-border);
  border-radius: 999px;
  background: var(--public-pref-active-bg);
  box-shadow: 0 2px 8px rgba(17, 24, 39, .06);
  pointer-events: none;
  transform: translateX(0);
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), background-color .18s ease, border-color .18s ease;
  z-index: 0;
}

.public-pref__btn[data-theme="dark"]::before,
.public-pref__btn[data-lang="ar"]::before {
  transform: translateX(100%);
}

.public-pref__btn:hover {
  color: var(--public-pref-text);
}

.public-pref__btn:active {
  transform: scale(.985);
}

.public-pref__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--public-pref-accent) 72%, transparent);
  outline-offset: 3px;
}

.public-pref__option {
  position: relative;
  z-index: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: inherit;
  color: inherit;
  transition: color .18s ease;
}

.public-pref__btn[data-theme="light"] .public-pref__option:nth-of-type(1),
.public-pref__btn[data-theme="dark"] .public-pref__option:nth-of-type(2),
.public-pref__btn[data-lang="en"] .public-pref__option:nth-of-type(1),
.public-pref__btn[data-lang="ar"] .public-pref__option:nth-of-type(2) {
  color: var(--public-pref-text);
}

.public-pref__option i {
  color: currentColor;
  font-size: 11px;
}

.public-pref__option--ar {
  direction: rtl;
  font-weight: 800;
}

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

[data-theme="dark"] .public-pref {
  --public-pref-text: var(--text, var(--blog-text, #F5F1EC));
  --public-pref-muted: rgba(245, 241, 236, .58);
  --public-pref-bg: rgba(18, 18, 18, .76);
  --public-pref-border: rgba(255, 255, 255, .10);
  --public-pref-active-bg: rgba(224, 129, 63, .16);
  --public-pref-active-border: rgba(224, 129, 63, .22);
  --public-pref-shadow: 0 10px 24px rgba(0, 0, 0, .20);
}

[dir="rtl"] .public-pref {
  direction: rtl;
}

@media (max-width: 520px) {
  .public-pref {
    gap: 3px;
    padding: 2px;
  }

  .public-pref__btn {
    height: 32px;
    font-size: 10.25px;
  }

  .public-pref__btn--theme {
    width: 82px;
  }

  .public-pref__btn--lang {
    width: 70px;
  }

  .public-pref__option {
    padding: 0 4px;
    gap: 0;
  }

  .public-pref__option i {
    display: none;
  }
}
