/* Arabic support.
   1) The Arabic font is registered under the design's own family names, limited to Arabic code points,
      so every existing rule (and canvas text) picks it up for Arabic letters and keeps the Latin fonts for Latin.
   2) Arabic pages are dir="rtl": the layout mirrors. The two horizontal scrollers (work cards, path timeline)
      keep their left-to-right geometry for the scroll code and are mirrored visually with `scale`, which
      composes with the transforms the scripts set; their contents are flipped back so text reads normally. */
@font-face{font-family:'Switzer';src:url(fonts/arabic/plex-arabic-400.woff2) format('woff2');font-weight:400;font-display:swap;size-adjust:108%;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F}
@font-face{font-family:'Switzer';src:url(fonts/arabic/plex-arabic-500.woff2) format('woff2');font-weight:500;font-display:swap;size-adjust:108%;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F}
@font-face{font-family:'Switzer';src:url(fonts/arabic/plex-arabic-600.woff2) format('woff2');font-weight:600;font-display:swap;size-adjust:108%;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F}
@font-face{font-family:'Switzer';src:url(fonts/arabic/plex-arabic-700.woff2) format('woff2');font-weight:700;font-display:swap;size-adjust:108%;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F}
@font-face{font-family:'General Sans';src:url(fonts/arabic/plex-arabic-500.woff2) format('woff2');font-weight:500;font-display:swap;size-adjust:108%;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F}
@font-face{font-family:'General Sans';src:url(fonts/arabic/plex-arabic-600.woff2) format('woff2');font-weight:600;font-display:swap;size-adjust:108%;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F}
@font-face{font-family:'General Sans';src:url(fonts/arabic/plex-arabic-700.woff2) format('woff2');font-weight:700;font-display:swap;size-adjust:108%;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F}

html.lang-ar :is(h1,h2,h3,h4,p,li,blockquote,figcaption,dd,dt,small,.lede,.org,.when,.txt,.mo-txt,.copy,.tldr,.kd-note,.hire-card,.gcopy,.lt,.ab,.nf){direction:rtl}
/* Arabic typography. The Arabic faces above use size-adjust:108%: Arabic letters look smaller than Latin at the
   same font size, so they are drawn slightly larger everywhere (Latin text is untouched). Letter-spacing is
   removed because it pulls joined Arabic letters apart, and wrapped headings get room for the taller letters
   and marks above and below the line. */
html.lang-ar body *{letter-spacing:0!important}
html.lang-ar :is(h1,h2,h3,h4,blockquote,blockquote span,.rv){line-height:1.3}
html.lang-ar :is(p,li,.lede){line-height:1.75}
html.lang-ar body{word-break:normal}

/* language switch in the nav pill */
.lang-sw{font-weight:600}
html.lang-ar .lang-sw{font-family:Switzer,system-ui,sans-serif}
.mobile-menu .lang-m{font-weight:600}
/* case pages have no phone menu: keep the switch next to "Contact" */
@media (max-width:900px),(pointer:coarse){html.casepg .nav .links .lang-sw{display:inline-block!important}}

/* mirrored horizontal scrollers: first item on the right, travelling right-to-left. Each strip is mirrored
   about the centre of the screen (--vc, set by the page bootstrap), so positions the scripts measure stay
   symmetric; the items inside are flipped back so they read normally. */
html[dir=rtl] :is(#track,#tlTrack){direction:ltr;scale:-1 1;transform-origin:var(--vc,50vw) 50%}
html[dir=rtl] #tlRail{direction:ltr;scale:-1 1}
html[dir=rtl] :is(#track>.card,#tlTrack>.ep,#tlRail .dot>span){scale:-1 1;direction:rtl}
html.rtl-measure[dir=rtl] :is(#track,#tlTrack,#tlRail,#track>.card,#tlTrack>.ep,#tlRail .dot>span){scale:none}

/* signed figures (+60%, -30%, $600K) keep their usual order instead of turning into "60%+" */
html.lang-ar :is(.impact b,.imp b,.mx b,li>b,b.nf-count,.stats b){unicode-bidi:plaintext}
/* gaps written for left-to-right text: move them to the other side */
html.lang-ar .card .mx b{margin-right:0;margin-left:5px}
html.lang-ar .skills span:hover{padding-left:13px;padding-right:10px}
html.lang-ar .skills span:hover i{margin-right:0;margin-left:7px}
@media(hover:none){html.lang-ar .skills span i{margin-right:0;margin-left:6px}}
html.lang-ar .gskip span{margin-right:0;margin-left:6px}
/* the smallest labels (story map, time-of-day dial) are too small to read in Arabic at 10-11px */
html.lang-ar .rail .lb{font-size:13px}
html.lang-ar .rail .dlb{font-size:12px}
html.lang-ar :is(.dial .lb small,.dial-menu button b){font-size:12.5px}
/* story map labels are placed for left-to-right anchoring; keep that so they sit beside their dot, not on it */
html.lang-ar .rail text{direction:ltr}

/* ---- About portrait (both languages; kept here with the other site overrides) ----
   Image-based living portrait: the still portrait with expression and blink layers stacked on it. Only the face area
   of a layer shows (soft mask), so the body never shimmers when the expression changes. --fx/--fy: face centre. */
.pf-me .vme.imgs{--fx:46%;--fy:26%}
.pf-me .vme.imgs img{position:absolute;inset:0;width:100%;height:100%;display:block;transition:opacity .35s ease}
.pf-me .vme.imgs :is(.face:not([data-face=now]),.blink){-webkit-mask-image:radial-gradient(ellipse 19% 17% at var(--fx) var(--fy),#000 62%,transparent 100%);mask-image:radial-gradient(ellipse 19% 17% at var(--fx) var(--fy),#000 62%,transparent 100%)}
/* the template hides every img in .pf-me once the portrait is alive (it meant the still image): keep the layers */
.pf.alive .pf-me .vme.imgs img{opacity:1}
.pf.alive .pf-me .vme.imgs img.blink{opacity:0;transition:opacity .06s linear}
/* he looks towards the text: the art faces left, so English (text on the right) shows it mirrored */
html:not([dir=rtl]) .pf-me>:is(img,.vme){scale:-1 1}

/* About fact cards: "$600K" is wider than the original's "92" and ran under the corner arrow on narrower screens.
   Keep room for the arrow, let the figures shrink a little on small widths, and put the arrow on the left in Arabic. */
.facts b{font-size:clamp(24px,2.3vw,30px)}
.f-sys b{padding-inline-end:18px}
html[dir=rtl] .f-sys .f-go{right:auto;left:14px}
html[dir=rtl] .f-sys:hover .f-go{transform:translateX(-3px)}
/* the contact title is display-size: the general 1.3 heading line-height pushed the step chips down into the
   game's "drag me back" hint on short screens */
html.lang-ar #contact h2{line-height:1.12}
/* the avatar photo looks to its left: in English (avatar left of the name) mirror it so he faces his name, as in Arabic */
html:not([dir=rtl]) .me>img{scale:-1 1}
/* the floating notes carry Ahmed's own wins, not quotes from other people: no decorative quotation mark */
.kd-note blockquote::before{content:none}
/* keep the note's close button clear of the text, and on the left in Arabic (where lines start on the right) */
.kd-note blockquote{padding-inline-end:26px}
html[dir=rtl] .kd-x{right:auto;left:6px}

/* "I'm here as…" chooser under the hero line (persona.js). Small glass chips in the site's style. */
.persona{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px;margin:12px auto 0;max-width:800px;opacity:0;animation:pIn .8s 1.4s forwards}
@keyframes pIn{to{opacity:1}}
.persona .pl{font-size:12.5px;color:var(--ink2);margin-inline-end:4px}
.persona button{font:500 12.5px/1 Switzer,system-ui,sans-serif;padding:7px 12px;border-radius:999px;border:1px solid rgba(255,255,255,.9);background:rgba(255,251,247,.62);color:var(--ink);cursor:pointer;
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:0 4px 14px -8px rgba(120,60,30,.35);transition:background .25s,color .25s,transform .25s}
.persona button:hover{transform:translateY(-1px);background:rgba(255,251,247,.9)}
.persona button[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:#fff}
#bio .pcta{white-space:nowrap;color:var(--accent);font-weight:600;text-decoration:none;border-bottom:1.5px solid currentColor}
.persona button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.persona .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* a path chosen by link or by an earlier visit: the line is hidden for a moment until persona.js has swapped it in */
html.pp #bio{opacity:0}
#bio,.pproof{transition:opacity .22s}
.copy.pswap #bio,.copy.pswap .pproof{opacity:0}
/* proof numbers: three small facts under the line */
.pproof{display:flex;flex-wrap:wrap;justify-content:center;gap:6px 18px;margin:10px auto 0;padding:0;list-style:none;max-width:760px;font-size:13px;color:var(--ink2)}
.pproof[hidden]{display:none}
.pproof li{white-space:nowrap}
.pproof b{color:var(--ink);font-weight:650;font-size:15px;margin-inline-end:2px;unicode-bidi:plaintext}
.pproof li+li::before{content:"";display:inline-block;width:4px;height:4px;border-radius:50%;background:var(--accent);opacity:.55;vertical-align:middle;margin-inline-end:14px}
/* the first card of a chosen path */
.card.pfirst::before{content:attr(data-start);position:absolute;top:-11px;inset-inline-start:22px;z-index:3;font:600 11.5px/1 Switzer,system-ui,sans-serif;letter-spacing:.02em;
  padding:6px 10px;border-radius:999px;background:var(--accent);color:#fff;box-shadow:0 6px 16px -8px rgba(160,70,30,.6)}
html.lang-ar .card.pfirst::before{font-family:inherit;letter-spacing:0}
@media(prefers-reduced-motion:reduce){.persona{animation:none;opacity:1}#bio,.pproof{transition:none}}
@media(max-height:760px) and (min-width:901px){.pproof{display:none}}
@media(max-width:520px){.pproof{font-size:12px;gap:4px 12px}.pproof b{font-size:13.5px}.pproof li+li::before{margin-inline-end:10px}}
@media(max-width:520px){.persona{gap:5px;margin-top:10px}.persona .pl{flex-basis:100%;text-align:center;margin:0 0 2px}.persona button{padding:6px 10px;font-size:12px}}
