/* =========================================================
   Arabic, right-to-left pages (<html lang="ar" dir="rtl">).
   Load last, after the page's own and the motion stylesheets.

   Flexbox and grid already mirror for right-to-left, so this file only
   handles what does not: Arabic fonts, Arabic's lack of italics and
   letter-spacing, arrows that should point the other way, sideways
   animations, and the few things positioned from the left.
   ========================================================= */

/* ---------- Fonts ---------- */
:root[dir="rtl"] {
  --sans: "Noto Sans Arabic", "Noto Sans", Helvetica, Arial, sans-serif;
  --serif: "Noto Naskh Arabic", "Copernicus", "Times New Roman", serif;
}

/* Arabic has no italics, and spacing letters out breaks the joins
   between them (this also covers the buttons' hover spacing) */
[dir="rtl"] :is(.h-display, .h-page, .h-section, .h-cta, .quote) em {
  font-style: normal;
}

[dir="rtl"] body,
[dir="rtl"] body * {
  letter-spacing: normal !important;
}

/* Arabic letters need a little more room above and below, and the
   Naskh face looks larger than the Latin serif at the same size */
[dir="rtl"] :is(.h-display, .h-page, .h-section, .h-cta, .card__title) {
  line-height: 1.35;
}

[dir="rtl"] .h-display { font-size: clamp(48px, 6.8vw, 96px); }
[dir="rtl"] .h-section { font-size: clamp(30px, 3.4vw, 46px); }

/* The line chart grows the same way as the mirrored bar and square
   charts (towards the left) */
[dir="rtl"] .stat-spark {
  scale: -1 1;
}

/* ---------- Numbers in the impact cards ----------
   The rolling digits are separate boxes, so they must stay in
   left-to-right order; they keep the Latin display font. */
[dir="rtl"] .stat-card__value {
  direction: ltr;
  justify-content: flex-end;
  font-family: "Copernicus", "Times New Roman", serif;
}

/* ---------- Arrows point the other way ---------- */
[dir="rtl"] :is(.hero-badge, .btn, .text-link) svg {
  scale: -1 1;
}

@keyframes rtl-arrow {
  0%, 60%, 100% { translate: 0 0; }
  75% { translate: -5px 0; }
  90% { translate: -1px 0; }
}

@keyframes rtl-nudge {
  0%, 80%, 100% { translate: 0 0; }
  86% { translate: -5px 0; }
  92% { translate: 0 0; }
  96% { translate: -3px 0; }
}

[dir="rtl"].motion .page .text-link svg { animation-name: rtl-arrow; }
[dir="rtl"].motion .hero-badge svg { animation-name: rtl-nudge; }

[dir="rtl"].motion .page :is(.card--link, .job, .news-card):hover .text-link svg {
  transform: translateX(-5px);
}

/* "Learn more" underline starts at the words, on the right */
[dir="rtl"].motion .page .text-link {
  background-position: 100% 100%;
}

/* ---------- Home: platform diagram ----------
   The connectors are drawn for a node on the left and the hub on the
   right; mirroring them keeps the curves, the drawing and the data
   pulses running between each party and the hub. */
[dir="rtl"] .eco__link {
  transform: scaleX(-1);
}

/* ---------- Numbered steps: progress runs right to left ---------- */
[dir="rtl"].motion .page .ruled-grid > .step::before {
  transform-origin: right;
}

[dir="rtl"].motion .page .ruled-grid > .step::after {
  left: auto;
  right: 0;
  margin: 0 -5px -3.5px 0;
}

[dir="rtl"].motion .page .ruled-grid > .step.is-active::after {
  left: auto;
  right: 100%;
  transition: right var(--stage, 1.3s) linear, opacity 0.2s ease;
}

/* ---------- Skip link sits at the start (right) ---------- */
[dir="rtl"] .skip-link {
  left: auto;
  right: 16px;
}

/* ---------- Inner pages in Arabic (review comments 2026-11-09) ---------- */
/* Grid dividers sit on the inline end, so the last cell of a short row
   still closes against the empty space */
[dir="rtl"] .ruled-grid > * {
  border-right: 0;
  border-left: 1px solid var(--line);
  margin-right: 0;
  margin-left: -1px;
}

/* Regulator mock dashboard: title gap after the window dots */
[dir="rtl"] .mock-window__bar span:last-child {
  margin-left: 0;
  margin-right: 12px;
}

/* Meter fills grow from the right */
[dir="rtl"].motion .page .mock-meter__track span {
  transform-origin: right;
}

/* FAQ accordion */
[dir="rtl"] .faq__btn {
  text-align: right;
}

[dir="rtl"] .faq__panel {
  padding: 0 46px 30px 64px;
}

[dir="rtl"] .faq__panel ul {
  padding: 0 22px 0 0;
}

@media (max-width: 640px) {
  [dir="rtl"] .faq__panel {
    padding: 0 0 26px;
  }
}

/* Careers: rows nudge towards the reading direction */
[dir="rtl"].motion .page .job:hover {
  transform: translateX(-6px);
}

/* Emails are typed left to right */
[dir="rtl"] .field input[type="email"] {
  direction: ltr;
  text-align: right;
}

/* Arabic serif titles need a little more line height */
[dir="rtl"] :is(.news-card__title, .article__title, .form-card__title, .office__city) {
  line-height: 1.4;
}

/* Arabic heroes: the designer's pattern mirrored, dense side at the top-left */
[dir="rtl"] .page .panel.panel--blue.hero.pattern::before {
  background-image: url("images/mosadad-pattern-blue-rtl.png?v=20261111c");
  background-position: center top;
}

/* News text cover: Arabic stays upright (no synthetic italics) */
[dir="rtl"] .news-cover__title em {
  font-style: normal;
}

/* Arabic Home: the moving tide mirrored, like the other Arabic heroes */
[dir="rtl"] .page .panel.hero--home .hero-tide {
  transform: scaleX(-1);
}
