/* Arabic (RTL) preview for the docs pages (js/rtl-mode.js). The docs stay English; previews marked
   dir="rtl" lang="ar" use the Arabic typeface and mirror. Colors are set here for both themes. */

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/plex-arabic-400.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F,
    U+2E41;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/plex-arabic-500.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F,
    U+2E41;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/plex-arabic-600.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F,
    U+2E41;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/plex-arabic-700.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F,
    U+2E41;
}

/* ---------- EN / العربية switch in the top bar ---------- */
.px-lang {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 3px;
  border-radius: 9px;
  background: #f2f4f7;
  border: 1px solid #e4e7ec;
}
.px-lang a {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: #667085;
  text-decoration: none;
  transition:
    background-color 0.15s,
    color 0.15s;
}
.px-lang a[lang='ar'] {
  font-family: 'IBM Plex Sans Arabic', var(--font-family), sans-serif;
}
.px-lang a:hover {
  color: #101828;
}
.px-lang a[aria-current] {
  background: #fff;
  color: #101828;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}
html[data-px-theme='dark'] .px-lang {
  background: #1b2335;
  border-color: #2a3446;
}
html[data-px-theme='dark'] .px-lang a {
  color: #98a2b3;
}
html[data-px-theme='dark'] .px-lang a[aria-current] {
  background: #2a3446;
  color: #fff;
}

/* ---------- notice ---------- */
.px-rtl-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 24px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 13px;
  line-height: 19px;
  color: #1e3a8a;
}
.gl > .px-rtl-note {
  margin: -8px 0 16px;
}
.px-rtl-note b {
  font-weight: 600;
}
.px-rtl-note__ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font:
    600 15px/1 'IBM Plex Sans Arabic',
    sans-serif;
}
.px-rtl-note > span:nth-child(2) {
  flex: 1;
}
.px-rtl-note__num {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #bfdbfe;
}
.px-rtl-note__num button {
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font:
    500 12px/1 var(--font-family),
    'IBM Plex Sans Arabic',
    sans-serif;
  color: #475467;
  cursor: pointer;
}
.px-rtl-note__num button[aria-pressed='true'] {
  background: #2563eb;
  color: #fff;
}
.px-rtl-note a {
  flex: none;
  font-weight: 500;
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 3px;
}
html[data-px-theme='dark'] .px-rtl-note {
  background: #12203d;
  border-color: #1e3a6b;
  color: #c7d7fe;
}
html[data-px-theme='dark'] .px-rtl-note__num {
  background: #0f1830;
  border-color: #1e3a6b;
}
html[data-px-theme='dark'] .px-rtl-note__num button {
  color: #b4bccd;
}
html[data-px-theme='dark'] .px-rtl-note a {
  color: #93c5fd;
}
@media (max-width: 760px) {
  .px-rtl-note {
    flex-wrap: wrap;
    margin: 10px 16px 0;
  }
}

/* ---------- Arabic previews ---------- */
.px-rtl [dir='rtl'][lang='ar'] {
  font-family: 'IBM Plex Sans Arabic', var(--font-family), sans-serif;
}
.px-rtl [dir='rtl'][lang='ar'] * {
  letter-spacing: normal !important; /* Arabic letters connect; tracking breaks them */
}
.px-rtl [dir='rtl'][lang='ar'] code,
.px-rtl [dir='rtl'][lang='ar'] kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.px-rtl [dir='rtl'][lang='ar'] input,
.px-rtl [dir='rtl'][lang='ar'] textarea,
.px-rtl [dir='rtl'][lang='ar'] select,
.px-rtl [dir='rtl'][lang='ar'] button {
  font-family: inherit;
}
/* emails and similar fields stay left-to-right */
.px-rtl [dir='rtl'] input[type='email'],
.px-rtl [dir='rtl'] input[type='url'],
.px-rtl [dir='rtl'] input[type='tel'] {
  direction: ltr;
  text-align: right;
}

/* icons: directional ones turn around */
.px-rtl .px-mirror svg,
.px-rtl .px-mirror .ico,
.px-rtl .px-mirror i {
  transform: scaleX(-1);
}
.px-rtl .px-mirror {
  position: relative;
}
.px-rtl .px-mirror::after {
  content: 'RTL';
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: #eff6ff;
  color: #2563eb;
  font:
    600 9px/16px var(--font-family),
    sans-serif;
}
html[data-px-theme='dark'] .px-rtl .px-mirror::after {
  background: #172340;
  color: #93c5fd;
}

/* component library pieces that use physical left/right */
.px-rtl [dir='rtl'] .px-switch__track::after {
  left: auto;
  right: 2px;
}
.px-rtl [dir='rtl'] .px-switch input:checked + .px-switch__track::after {
  transform: translateX(calc(var(--switch-h) - var(--switch-w)));
}
/* directional icons point the other way */
.px-rtl [dir='rtl'] svg:has(> path[d='M5 12h14M13 6l6 6-6 6']),
.px-rtl [dir='rtl'] svg:has(> path[d='m15 6-6 6 6 6']),
.px-rtl [dir='rtl'] svg:has(> path[d='m9 6 6 6-6 6']),
.px-rtl [dir='rtl'] svg:has(> use[href='#i-arrow']),
.px-rtl [dir='rtl'] svg:has(> use[href='#i-chev-r']),
.px-rtl [dir='rtl'] .ico-arrow {
  transform: scaleX(-1);
}

/* icon names are English: keep them readable inside the mirrored grid */
.px-rtl #grid > * {
  direction: ltr;
}
.px-rtl .dt-spec[dir='rtl'] {
  display: block;
  text-align: right;
}
@media (max-width: 480px) {
  .px-lang a {
    padding: 0 7px;
  }
}
