/* ============================================================
   Y3K RTL OVERRIDES
   Applied conditionally when is_rtl() is true.
   Most layout already uses CSS logical properties.
   This file handles edge cases.
   ============================================================ */

/* --- Arabic font fallback for body text --- */
body.y3k-dark-mode[dir="rtl"],
html[lang^="ar"] body.y3k-dark-mode {
  font-family: 'Inter', 'Noto Kufi Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Keep JetBrains Mono for English-only elements even in RTL */
body.y3k-dark-mode[dir="rtl"] .y3k-tag,
body.y3k-dark-mode[dir="rtl"] .y3k-section__label,
body.y3k-dark-mode[dir="rtl"] .y3k-hero__tagline,
body.y3k-dark-mode[dir="rtl"] .bento-card__meta-key,
body.y3k-dark-mode[dir="rtl"] .bento-card__meta-val,
body.y3k-dark-mode[dir="rtl"] .bento-card__date,
body.y3k-dark-mode[dir="rtl"] .y3k-single-post__date,
body.y3k-dark-mode[dir="rtl"] .y3k-single-post__read-time,
body.y3k-dark-mode[dir="rtl"] .y3k-stat__number,
body.y3k-dark-mode[dir="rtl"] .y3k-timeline__role,
body.y3k-dark-mode[dir="rtl"] .y3k-vault__metric-number,
body.y3k-dark-mode[dir="rtl"] code,
body.y3k-dark-mode[dir="rtl"] pre {
  font-family: var(--y3k-font-mono);
  direction: ltr;
  unicode-bidi: isolate;
}

/* --- Terminal tagline cursor on correct side --- */
body.y3k-dark-mode[dir="rtl"] .y3k-hero__tagline::before {
  content: ' <';
}

body.y3k-dark-mode[dir="rtl"] .y3k-hero__tagline::after {
  content: '_';
}

/* --- Timeline alignment for RTL --- */
[dir="rtl"] .y3k-timeline::before {
  inset-inline-start: auto;
  inset-inline-end: 20px;
}

[dir="rtl"] .y3k-timeline__entry {
  padding-inline-start: 0;
  padding-inline-end: 60px;
}

[dir="rtl"] .y3k-timeline__node {
  inset-inline-start: auto;
  inset-inline-end: 13px;
}

/* --- Bento card meta overlay --- */
[dir="rtl"] .bento-card__meta-key {
  direction: ltr;
  unicode-bidi: isolate;
}

/* --- Post navigation arrows --- */
[dir="rtl"] .y3k-single-post__nav-link--prev .y3k-single-post__nav-label {
  /* Reverse arrows in RTL */
}

[dir="rtl"] .y3k-single-post__nav-link--next {
  text-align: start;
}

[dir="rtl"] .y3k-single-post__nav-link--prev {
  text-align: end;
}

/* --- Scanline direction --- */
[dir="rtl"] .y3k-scanline::after {
  inset-inline-start: auto;
  inset-inline-end: -100%;
}

[dir="rtl"] .y3k-scanline:hover::after {
  animation: y3k-scan-rtl 0.8s ease-in-out;
}

@keyframes y3k-scan-rtl {
  0% {
    inset-inline-end: -100%;
  }
  100% {
    inset-inline-end: 100%;
  }
}

/* --- Mobile timeline RTL --- */
@media (max-width: 689px) {
  [dir="rtl"] .y3k-timeline::before {
    inset-inline-end: 12px;
  }

  [dir="rtl"] .y3k-timeline__entry {
    padding-inline-end: 44px;
  }

  [dir="rtl"] .y3k-timeline__node {
    inset-inline-end: 5px;
  }
}
