/* ===========================================================================================================
   MBRIF — right to left
   -----------------------------------------------------------------------------------------------------------
   Loaded only by the Arabic pages, and last, so it can override every sheet before it. dir="rtl" already turns
   the flow around; what it cannot turn is anything pinned to a physical side, a transform that carries a
   direction, or type set with tracking — Arabic is cursive, and letter-spacing pulls the joins apart.

   Written in physical left/right to match the build, which is written that way throughout.
   =========================================================================================================== */

/* ---- the face ------------------------------------------------------------------------------------------ */
[dir="rtl"] body{font-family:"Cairo",var(--font),sans-serif}
[dir="rtl"] :is(h1,h2,h3,h4,.sx-hero__title,.fu-h,.mi-card__ttl,.rw-col__h,.ip-ask__q,.sx-q__row,.sx-word,
  .hb__link,.hb__cta,.menu__row > a){font-family:"Cairo",sans-serif}

/* tracking and indents are for the Latin face: in Arabic they break the joins between letters */
[dir="rtl"] :is(.sx-crumbs,.sx-pn__a small,.fu-eye,.mi-sov__eye,.mi-card__kicker,.ip-ask__eye,.ip-num__lab,
  .ip-story__kick,.rw-col__n,.fu-card__for,.fu-lim__gen,.fu-who b,.fu-thx__sign,.hb__cta,.hb__drop-eye,
  .hb__num,.menu__cap-name,.nav__tab,.sx-word,.sx-hero__cue,.foot,.mi-rail__btn,.sx-q__row,
  .fu-num b,.ip-stat b,.rw-key b,.ip-story__fig,.fu-lim__lead,.fu-thx__lead,.mi-pil__head h2,
  .fu-h,.mi-sov__h,.rw-col__h,.mi-card__ttl,.vis__title,.pd-step__eye,.pd-step__title){letter-spacing:0;text-indent:0}

/* Cairo sits taller than the Latin face: lines set tight for English close up on each other in Arabic */
[dir="rtl"] .sx-q__row{line-height:1.42}

/* ---- the header bar ------------------------------------------------------------------------------------- */
[dir="rtl"] .hb__drop a:hover svg,[dir="rtl"] .hb__drop a:focus-visible svg{transform:translateX(-4px)}
[dir="rtl"] .hb__lang + .hb__cta{margin-left:0;margin-right:clamp(10px,1.4vw,22px);
  padding-left:0;padding-right:clamp(22px,2vw,32px)}
[dir="rtl"] .hb__lang + .hb__cta::before{left:auto;right:0}

/* ---- the site's own header and menu ----------------------------------------------------------------------- */
[dir="rtl"] .nav__tab--menu{border-left:1px solid rgba(255,255,255,.24);border-right:0}
[dir="rtl"] .nav__tab--report{border-right:1px solid rgba(255,255,255,.24);border-left:0}
[dir="rtl"] .nav__start{border-left:1px solid rgba(255,255,255,.24);border-right:0}
[dir="rtl"] .nav__start .nav__tab--lang::before{left:auto;right:0}
[dir="rtl"] .menu__chapters .menu__row > a::before{margin-right:0;margin-left:0}
[dir="rtl"] .menu__chapters .menu__row:hover > a::before,
[dir="rtl"] .menu__chapters .menu__row:focus-within > a::before{margin-right:0;margin-left:.45em}
[dir="rtl"] .menu__sub > div{padding-left:0;padding-right:calc(.32em + .45em)}
[dir="rtl"] .menu__sub a:hover,[dir="rtl"] .menu__sub a:focus-visible{transform:translateX(-4px)}

/* ---- the banner ------------------------------------------------------------------------------------------- */
[dir="rtl"] :is(.sx-hero--full,.sx-hero--full .sx-hero__title,.sx-hero--full .sx-hero__sub){text-align:right}
[dir="rtl"] .sx-hero__cue{left:auto;right:var(--gutter)}
/* The photograph is nudged sideways so its subject clears the wording. With the wording on the other side,
   the nudge goes the other way as well. The picture itself is never flipped: several carry readable signs. */
[dir="rtl"] .sx-hero__bg img{left:auto;right:0;width:calc(100% + var(--bg-x,18%))}
@media (max-width:767px){
  [dir="rtl"] .sx-hero__bg img{right:0;width:100%}
}
/* and the wash that darkens the ground under the words comes from the other side with them */
@media (min-width:768px){
  [dir="rtl"] .sx-hero__bg::after{background:linear-gradient(270deg,var(--hero) 0%,var(--hero) 18%,color-mix(in srgb,var(--hero) 82%,transparent) 34%,color-mix(in srgb,var(--hero) 30%,transparent) 50%,transparent 60%),linear-gradient(0deg,color-mix(in srgb,var(--hero) 55%,transparent) 0%,transparent 26%)}
}
/* the breadcrumb trail changes corner with the direction */
[dir="rtl"] .sx-crumbs{right:auto;left:var(--gutter)}
[dir="rtl"] .sx-crumbs li + li::before{border-right:0;border-left:1px solid var(--sand)}
[dir="rtl"] .sx-crumbs--fixed{border-right:1px solid var(--line);border-left:0}

/* ---- the way out, at the foot of each part ---------------------------------------------------------------- */
[dir="rtl"] .sx-pn__a--next{text-align:left}
[dir="rtl"] .sx-pn__a--prev:hover .sx-pn__ic{transform:translateX(4px)}
[dir="rtl"] .sx-pn__a--next:hover .sx-pn__ic{transform:translateX(-4px)}
[dir="rtl"] .sx-btn:hover svg,[dir="rtl"] .sx-btn:focus-visible svg{transform:translateX(-3px)}

/* ---- the impact pages -------------------------------------------------------------------------------------- */
/* the rules drawn into a card's corner, and the number tab on a picture */
[dir="rtl"] :is(.mi-card::before,.mi-card::after,.rw-col::before,.rw-col::after,.rw-col__n,
  .ip-block + .ip-block::before,.fu-thx::before){left:auto;right:0}
[dir="rtl"] .fu-thx::after{right:auto;left:0}
[dir="rtl"] .ip-block:first-child{padding-left:clamp(18px,2.4vw,40px);padding-right:0}
[dir="rtl"] .ip-block:last-child{padding-right:clamp(18px,2.4vw,40px);padding-left:0}
/* the panel is printed over the photograph from the other side now */
[dir="rtl"] .ip-story__panel{margin-left:0;margin-right:calc(-1 * clamp(40px,6vw,110px))}
[dir="rtl"] .ip-story__ic{left:auto;right:clamp(22px,2.6vw,38px)}

/* ---- the future -------------------------------------------------------------------------------------------- */
[dir="rtl"] :is(.fu-quote,.fu-lim .fu-quote){padding-left:0}
[dir="rtl"] .fu-quote{padding-right:clamp(40px,4.4vw,64px)}
[dir="rtl"] .fu-lim .fu-quote{padding-right:0}
[dir="rtl"] :is(.fu-quote::before,.fu-lim .fu-quote::before){left:auto;right:0}
[dir="rtl"] .fu-lim .fu-quote::after{margin-left:0;margin-right:.3em}
/* the rail and the call to action run off the other edge of the window */
[dir="rtl"] .mi-rail{padding-left:0;padding-right:max(var(--gutter),calc((100% - 1240px) / 2))}
[dir="rtl"] .fu-cta__in{padding-left:0;padding-right:max(var(--gutter),calc((100% - 1240px) / 2))}
@media (max-width:900px){
  [dir="rtl"] .mi-rail{padding-right:var(--gutter)}
  [dir="rtl"] .fu-cta__in{padding:0 var(--gutter)}
}
/* the marks travel the other way along their loop */
[dir="rtl"] .fu-marquee__row{animation-direction:reverse}

/* ---- the report's own sliders ------------------------------------------------------------------------------
   These are written in physical sides, so right-to-left leaves the track padded on the wrong edge and the
   counters reading backwards. */

/* the three pathways: the track is padded on the side the cards run off, which changes with the direction */
[dir="rtl"] .poss__ways{padding-right:0;padding-left:var(--gutter);scroll-padding-left:auto;scroll-padding-right:0}
[dir="rtl"] .poss__count{margin:0 clamp(8px,1vw,16px) 0 0}

/* "01 / 03" is a pair of numerals, not a sentence: left to right in either language, or the current page and
   the total change places and it reads 03 / 01 */
[dir="rtl"] :is(.poss__count,.leaders__count){direction:ltr}

/* The Possibilities is laid out so the track of cards bleeds off one edge of the window while the words keep
   the gutter on the other. Right to left, those two edges change places: the section opens to the left and the
   words take the gutter on the right, where they then line up with the header above them. */
[dir="rtl"] .poss{padding-right:var(--gutter);padding-left:0}

/* ---- the three impact cards ---------------------------------------------------------------------------------
   The picture is let into one bottom corner and the words are given a little under half the width beside it.
   Right to left the words move across but the picture does not, so the two land on top of one another. */
[dir="rtl"] .icard__shot{right:auto;left:7.8%}
[dir="rtl"] :is(.icard:before,.icard:after){left:auto;right:0}
[dir="rtl"] .icard__ttl span{margin-left:0;margin-right:.42em}
[dir="rtl"] :is(.cta,.tenb__btn,.vcard__cta,.fut__btn,.pway__cta,.icard__more,.ms__skip):is(:hover,:focus-visible) svg{transform:translate(-3px,-3px)}
@media (max-width:767px){
  /* stacked on a narrow screen: the picture is back in the flow, so there is nothing to mirror */
  [dir="rtl"] .icard__shot{left:auto}
  [dir="rtl"] .icard__ttl span{margin-right:0}
}

/* a year range is a number, not a sentence: left to itself the bidi algorithm reads 2025–2027 backwards */
[dir="rtl"] :is(.rw-award i,.rw-col__n){direction:ltr;unicode-bidi:isolate}

/* The community's rows of marks loop by sliding a row the width of itself, so its copy takes its place. Right to
   left the row and its copy overflow the other way — to the left of the box — so the slide has to go the other
   way too; left as it was, the two rows running backwards sat off the screen entirely. */
@keyframes fu-scroll-rtl{from{transform:translateX(0)}to{transform:translateX(calc(100% + var(--gap)))}}
[dir="rtl"] .fu-marquee.is-looping .fu-marquee__row{animation-name:fu-scroll-rtl}

/* The mark in a figure tile is pinned to the corner away from the figure. Right to left the figure moves to the
   other side, so the mark has to as well — left where it was, the two sat on top of each other. */
[dir="rtl"] .tp-tile__ic{right:auto;left:clamp(30px,3vw,48px)}

/* The Innovators chapter centres its words with `translate: 0 -50%`. GSAP clears `translate` on any element
   it animates, so the moment the block is tweened in — arriving at the chapter from the menu, for instance —
   the centring goes with it and the words hang half their own height too low. Centring from the insets needs
   no transform at all, so there is nothing left for the animation to take away. */
@media (min-width:1024px){
  html[dir="rtl"] .inn__core,
  html[dir="rtl"] .inn.is-play .inn__core{top:0;bottom:0;translate:none;height:fit-content;margin-block:auto}
}

/* The Visionaries chapter stands its words beside a stack of cards. They are pushed down to the card's middle
   by a margin worked out from --chh, the card's height; when that does not resolve the margin falls back to
   nothing and the words sit at the top of the column instead. Centring them in the row lines them up with the
   card whatever its height, and needs no measurement at all. */
@media (min-width:768px){
  html[dir="rtl"] .vis__lead{align-self:center;margin-top:0}
}

/* The partner marks sit in a band that breaks out of the column to the full width of the window, pulled over
   with a left margin. Right to left that margin pulls it the wrong way, so the band misses the right edge. */
[dir="rtl"] .ex-net__marks{margin-left:0;margin-right:calc(50% - 50vw)}

/* and the band's rows loop the same way the community's do on the Future page: a row slides the width of
   itself so its copy takes its place. Right to left they overflow to the left of the box, so the slide has to
   go the other way or the rows run off the screen and the band shows empty. */
@keyframes ex-scroll-rtl{from{transform:translateX(0)}to{transform:translateX(calc(100% + var(--gap)))}}
[dir="rtl"] .ex-mq.is-looping .ex-mq__row{animation-name:ex-scroll-rtl}

/* ---- the cover ---------------------------------------------------------------------------------------------
   The report sets the title as two heavy lines, so the light lead-in above them is left empty and taken out of
   the flow rather than holding a line's worth of space. The lines themselves are set tighter than their own
   size, which Latin capitals can take but Arabic cannot — its ascenders and tails meet — so they are given a
   little more room. */
[dir="rtl"] .beat__title .ln--pre{display:none}
[dir="rtl"] .beat__title{line-height:1.04}

/* ---- the trail at the foot of the page --------------------------------------------------------------------
   It is pinned flush into a bottom corner (inset:auto 0 0 auto), not set in from the gutter. Right to left that
   corner is the other one, so it reaches the left edge the way the English reaches the right. The rule for the
   trail inside the banner, further up, keeps its gutter — only this fixed one sits flush. */
/* its one rounded corner is the one facing into the page, so that changes side along with the trail */
[dir="rtl"] .sx-crumbs--fixed{inset:auto auto 0 0;border-radius:0 22px 0 0}
@media (max-width:767px){
  /* on a narrow screen the sheet above pins it with "html body .sx-crumbs.sx-crumbs--fixed", so this has to
     be weighed at least as heavily to turn it round */
  html[dir="rtl"] body .sx-crumbs.sx-crumbs--fixed{left:0;right:auto}
}

/* ---- the Visionaries cards ---------------------------------------------------------------------------------
   "01 / 04" is current-of-total, left to right in either language (right to left it read 04 / 01). Cairo also sets
   smaller than the Latin face at the same size, so the card's small text is given a little more size and air. */
[dir="rtl"] .vcard__count{direction:ltr}
[dir="rtl"] .vcard__text{font-size:clamp(15px,1.2vw,19px);line-height:1.7;font-weight:400}

/* The Venn diagram's three outer circles pin their labels to the circle's left and right ends with flex-start and
   flex-end. Right to left those two words swap sides, so both labels met in the middle on top of each other: put
   each back at the end it sat at in English. Cairo is also set a little larger, without tracking. */
[dir="rtl"] .venn__c--left{justify-content:flex-end}
[dir="rtl"] .venn__c--right{justify-content:flex-start}
[dir="rtl"] .venn__c span{letter-spacing:0;font-size:4.4cqw;line-height:1.3}

/* every "01 / 10" counter: current of total, left to right (right to left it read 10 / 01) */
[dir="rtl"] :is(.tenb__count,.imp__count,.vcard__count,.leaders__count,.poss__count){direction:ltr;unicode-bidi:isolate}

/* ---- the milestones timeline ("Marking key milestones", and the same stage in the full report) ---------------
   Its stage is placed with physical left/right values from the left edge, so right to left only the words turned
   round and the layout stayed as it was: the title column on the left, the year rail on the right, the headline
   flush to the left. Everything is mirrored here: each box measured from the right edge by the same amount. */
html[dir="rtl"] .ms__head{left:auto;right:var(--gutter);text-align:right}
html[dir="rtl"] .ms__year{margin:0 -.03em .06em 0}
html[dir="rtl"] .ms__lead{left:auto;right:23vw;text-align:right}
html[dir="rtl"] .ms__photo{left:auto;right:44vw}
html[dir="rtl"] .ms__frame{left:auto;right:34%}
html[dir="rtl"] .ms__scene[data-layout="2"] .ms__frame,html[dir="rtl"] .ms__scene[data-layout="4"] .ms__frame{left:auto;right:-12%}
html[dir="rtl"] .ms__card{left:auto;right:23vw}
html[dir="rtl"] .ms__more{left:auto;right:calc(44vw - 26px);padding:8px 8px 8px 22px}
html[dir="rtl"] .ms__skip{right:auto;left:clamp(14px,3.4vw,64px);padding:10px 20px 10px 16px}
html[dir="rtl"] .ms__rail{right:auto;left:clamp(14px,3.4vw,64px)}
html[dir="rtl"] .ms__rail ol{justify-items:start}
html[dir="rtl"] .ms__rail ol::before{right:auto;left:5px;border-right:0;border-left:2px dotted rgba(255,255,255,.35)}
html[dir="rtl"] .ms__dot{justify-content:flex-start}
html[dir="rtl"] .ms__dot-label{right:auto;left:-7px;padding:5px 12px 5px 26px;transform:translate(-8px,-50%);letter-spacing:0}
html[dir="rtl"] .ms__dot.is-active .ms__dot-label,html[dir="rtl"] .ms__dot:hover .ms__dot-label,html[dir="rtl"] .ms__dot:focus-visible .ms__dot-label{transform:translate(0,-50%)}
@media (min-width:1024px){
  html[dir="rtl"] .ms__scene[data-layout="2"] .ms__lead{left:auto;right:34vw}
  html[dir="rtl"] .ms__scene[data-layout="2"] .ms__photo{left:auto;right:13vw}
  html[dir="rtl"] .ms__scene[data-layout="2"] .ms__card{left:auto;right:49vw}
  html[dir="rtl"] .ms__scene[data-layout="2"] .ms__more{left:auto;right:calc(13vw + 30vw - 110px)}
  html[dir="rtl"] .ms__scene[data-layout="3"] .ms__photo{left:auto;right:22vw}
  html[dir="rtl"] .ms__scene[data-layout="3"] .ms__lead{left:auto;right:13vw}
  html[dir="rtl"] .ms__scene[data-layout="3"] .ms__card{left:auto;right:57vw}
  html[dir="rtl"] .ms__scene[data-layout="3"] .ms__more{left:auto;right:calc(22vw + 30vw - 60px)}
  html[dir="rtl"] .ms__scene[data-layout="4"] .ms__lead{right:auto;left:13vw;text-align:left}
  html[dir="rtl"] .ms__scene[data-layout="4"] .ms__photo{left:auto;right:13vw}
  html[dir="rtl"] .ms__scene[data-layout="4"] .ms__card{left:auto;right:39vw}
  html[dir="rtl"] .ms__scene[data-layout="4"] .ms__more{left:auto;right:calc(13vw + 24px)}
}
@media (max-width:1023px){
  html[dir="rtl"] .ms__lead{left:auto;right:var(--gutter)}
  html[dir="rtl"] .ms__photo{left:auto;right:28vw}
  html[dir="rtl"] .ms__card{left:auto;right:var(--gutter)}
  html[dir="rtl"] .ms__more{left:auto;right:calc(28vw + 40%)}
}
@media (max-width:767px){
  html[dir="rtl"] .ms__photo{right:var(--gutter);left:calc(var(--gutter) + 22px)}
  html[dir="rtl"] .ms__card{right:var(--gutter);left:calc(var(--gutter) + 44px)}
  html[dir="rtl"] .ms__more{right:auto;left:calc(var(--gutter) + 22px)}
  html[dir="rtl"] .ms__rail{left:8px;right:auto}
}
