/* ══════════════════════════════════════════════════════════════════════
   ZYRN — THE LANGUAGE SWITCH   (every page, English and Arabic)

   A pill with two stations, EN and ع, and a disc of Vapor that sits on the
   language you are reading. Press it and the disc travels: it stretches
   along the track while it moves (it is a body with mass, not a dot being
   teleported), the label inside it re-encodes on the way, and a line of
   the glint's light leaves the pill and crosses the whole window in the
   direction the NEXT language reads. The page is erased behind that line
   and the counterpart page is written in behind the next one — Arabic from
   the right, English from the left. Same field underneath, never touched:
   the language changes, the surface does not.

   The pill is laid out left-to-right on both sites on purpose. EN stays
   on the left and ع on the right, so the switch is the same object in the
   same hand position whichever page you are on.

   Built from the glint (styles.css) — the rim light is the same element
   main.js injects into every control, and the travelling line is that
   light leaving the control.
   ══════════════════════════════════════════════════════════════════════ */

.lang{
  --lw:62px; --lh:30px; --kd:22px; --kp:3px;
  position:relative;isolation:isolate;flex:none;
  display:inline-block;width:var(--lw);height:var(--lh);
  border-radius:999px;direction:ltr;
  border:1px solid var(--hair-strong);
  background:rgba(14,15,18,0.42);
  box-shadow:var(--glass-inner);
  color:var(--vapor);text-decoration:none;
  -webkit-tap-highlight-color:transparent;
  transition:transform 240ms var(--ease-reveal),box-shadow 380ms var(--ease-reveal),border-color 300ms;
}
.lang:hover{transform:translateY(-1px) scale(1.02);border-color:rgba(242,243,245,0.24);box-shadow:var(--glass-inner),0 0 26px -9px var(--glint-1)}
.lang:focus-visible{outline:1px solid var(--vapor);outline-offset:3px}

/* ── the Arabic face ────────────────────────────────────────────────
   IBM Plex Sans Arabic — the Plex family's own Arabic, so it sits beside
   the site's IBM Plex Mono as a relative rather than a guest. Declared
   here under the site's own names, restricted to the Arabic block, and
   twice: once as it is, and once enlarged for the places the site sets
   tiny mono metadata, where an Arabic letter at the Latin size reads as
   dust. Space Grotesk and Plex Mono keep every Latin letter and digit.
   Files are served by Google Fonts; only a page that prints Arabic loads
   them (the English pages ask for one glyph, the ع on this switch). */
@font-face{font-family:'ZY Arabic';font-style:normal;font-weight:400;font-display:swap;
  src:url(https://fonts.gstatic.com/s/ibmplexsansarabic/v15/Qw3CZRtWPQCuHme67tEYUIx3Kh0PHR9N6Ys43PWrfQ.woff2) format('woff2');
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFC;size-adjust:106%}
@font-face{font-family:'ZY Arabic';font-style:normal;font-weight:500;font-display:swap;
  src:url(https://fonts.gstatic.com/s/ibmplexsansarabic/v15/Qw3NZRtWPQCuHme67tEYUIx3Kh0PHR9N6YPO_-CRXMR5Kw.woff2) format('woff2');
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFC;size-adjust:106%}
@font-face{font-family:'ZY Arabic';font-style:normal;font-weight:600;font-display:swap;
  src:url(https://fonts.gstatic.com/s/ibmplexsansarabic/v15/Qw3NZRtWPQCuHme67tEYUIx3Kh0PHR9N6YPi-OCRXMR5Kw.woff2) format('woff2');
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFC;size-adjust:106%}
@font-face{font-family:'ZY Arabic Meta';font-style:normal;font-weight:400;font-display:swap;
  src:url(https://fonts.gstatic.com/s/ibmplexsansarabic/v15/Qw3NZRtWPQCuHme67tEYUIx3Kh0PHR9N6YPO_-CRXMR5Kw.woff2) format('woff2');
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFC;size-adjust:128%}
@font-face{font-family:'ZY Arabic Meta';font-style:normal;font-weight:500;font-display:swap;
  src:url(https://fonts.gstatic.com/s/ibmplexsansarabic/v15/Qw3NZRtWPQCuHme67tEYUIx3Kh0PHR9N6YPi-OCRXMR5Kw.woff2) format('woff2');
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFC;size-adjust:128%}

/* the two stations */
.lang__o{
  position:absolute;top:0;bottom:0;width:50%;
  display:grid;place-items:center;
  font-family:'IBM Plex Mono',ui-monospace,monospace;font-size:10px;font-weight:500;
  letter-spacing:0.12em;line-height:1;
  color:rgba(242,243,245,0.46);
  transition:color 300ms,opacity 300ms;
  pointer-events:none;user-select:none;
}
.lang__o--en{left:0;padding-left:2px}
.lang__o--ar{right:0;padding-right:2px;font-family:'ZY Arabic','IBM Plex Mono',sans-serif;font-size:14px;letter-spacing:0;transform:translateY(-1px)}
.lang:hover .lang__o{color:rgba(242,243,245,0.74)}

/* the disc. Its position is --at (0 = EN, 1 = ع); its BODY is ::before so the
   stretch never squashes the letter riding inside it */
.lang__k{
  --at:0;
  position:absolute;top:calc((var(--lh) - 2px - var(--kd)) / 2);left:var(--kp);
  width:var(--kd);height:var(--kd);
  transform:translateX(calc(var(--at) * (var(--lw) - 2px - var(--kd) - 2 * var(--kp))));
  transition:transform 520ms cubic-bezier(.7,0,.18,1);
  pointer-events:none;z-index:2;
}
.lang[data-cur="ar"] .lang__k{--at:1}
.lang__k::before{
  content:'';position:absolute;inset:0;border-radius:999px;
  background:var(--vapor);
  box-shadow:0 0 0 1px rgba(242,243,245,0.5),0 0 14px -2px var(--glint-2),0 0 26px -6px var(--glint-1);
  transform-origin:var(--from,left) center;
}
.lang__k i{
  position:absolute;inset:0;display:grid;place-items:center;
  font-style:normal;color:var(--obsidian);
  font-family:'IBM Plex Mono',ui-monospace,monospace;font-size:9px;font-weight:500;letter-spacing:0.06em;
}
.lang[data-cur="ar"] .lang__k i{font-family:'ZY Arabic','IBM Plex Mono',sans-serif;font-size:13px;letter-spacing:0;padding-bottom:1px}
/* the station under the disc is the disc's own label: hide it so it never shows through the edge */
.lang[data-cur="en"] .lang__o--en,.lang[data-cur="ar"] .lang__o--ar{opacity:0}

/* in transit: the body stretches toward where it is going and recovers */
.lang.is-going .lang__k::before{animation:lang-stretch 520ms cubic-bezier(.7,0,.18,1) both}
@keyframes lang-stretch{
  0%  {transform:scaleX(1)}
  18% {transform:scaleX(.86) scaleY(1.08)}
  52% {transform:scaleX(1.9) scaleY(.82)}
  82% {transform:scaleX(.94) scaleY(1.04)}
  100%{transform:scaleX(1)}
}
.lang.is-going .lang__o{opacity:0 !important}
/* a ring thrown off the pill on the press */
.lang::after{
  content:'';position:absolute;inset:-1px;border-radius:inherit;pointer-events:none;
  border:1px solid var(--glint-2);opacity:0;
}
.lang.is-going::after{animation:lang-ring 640ms cubic-bezier(.16,1,.3,1) both}
@keyframes lang-ring{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(1.45,1.9)}}

/* the glint rim (main.js injects .gl into every control it lights) */
.lang .gl{z-index:1}
.lang:hover .gl,.lang:focus-visible .gl,.lang.is-going .gl{opacity:1}
.lang:hover .gl__b,.lang:focus-visible .gl__b{animation-play-state:running}
.lang.is-going .gl__b{animation-play-state:running;animation-duration:.5s}

/* ── THE CROSSING — the line that carries the page across ───────────── */
.langcut{position:fixed;inset:0;z-index:80;pointer-events:none;overflow:hidden}
.langcut__l{
  position:absolute;left:0;right:0;height:1px;top:var(--y,50%);
  transform-origin:var(--o,right) center;
  background:linear-gradient(90deg,transparent,var(--glint-1) 12%,var(--glint-2) 50%,var(--glint-1) 88%,transparent);
  box-shadow:0 0 12px 1px var(--glint-1),0 0 32px 2px var(--glint-0);
}
/* the head: a bright point riding the front of the line */
.langcut__h{
  position:absolute;top:calc(var(--y,50%) - 3px);height:7px;width:120px;border-radius:999px;
  background:radial-gradient(closest-side,var(--vapor),rgba(242,243,245,.55) 40%,transparent);
  filter:blur(.4px);
}

/* the arriving page holds its content until the line writes it in */
html.is-langin .shell,html.is-langin body > main{clip-path:inset(0 0 0 100%)}
html.is-langin[dir="ltr"] .shell,html.is-langin[dir="ltr"] body > main{clip-path:inset(0 100% 0 0)}

@media (max-width:899px){
  .lang{--lw:54px;--lh:30px;--kd:22px}
  .lang__o{font-size:9px}
}
@media (prefers-reduced-motion:reduce){
  .lang__k{transition:none}
  .lang.is-going .lang__k::before,.lang.is-going::after{animation:none}
  html.is-langin .shell,html.is-langin body > main{clip-path:none}
}

/* the switch made the phone bar 8px wider than a 390px screen on the landing page, whose
   mark column is the widest (143px): the 1fr/auto/1fr grid sizes both outer columns to it.
   Below 420px the bar's gaps close up so mark + toggle + switch + button fit. */
@media (max-width:420px){
  .nav__row{gap:8px;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}
  .nav__end{gap:8px}
}
