/* ==========================================================================
   AHMED HENDAWI — resume.ahmedhendawi.net
   Living design file palette: graphite canvas, cream ink, safety-orange
   signal — Archivo (motorway-signage DNA) + Geist Mono telemetry labels.
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  /* hex/rgba base so pre-OKLCH browsers (Safari < 15.4) still get the palette */
  --bg:          #101216;
  --bg-2:        #191c21;
  --bg-3:        #22262c;
  --ink:         #f2f1ec;
  --ink-2:       #c0bfb8;
  --ink-3:       #908f88;
  --amber:       #f95d1d;
  --amber-soft:  rgba(249, 93, 29, 0.14);
  --green:       #4fd783;
  --red:         #f4564a;
  --line:        rgba(242, 241, 236, 0.10);
  --line-strong: rgba(242, 241, 236, 0.22);
  --dot:         rgba(242, 241, 236, 0.05);

  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* 92vw reads as a generous margin on desktop but collapses to ~14px on a
     360px phone, where text then grazes the bezel. The 100vw-2.5rem term only
     binds under ~500px, so it floors the gutter at 20px without touching any
     larger layout. */
  --container: min(92vw, 100vw - 2.5rem, 82rem);
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --sp-section: clamp(6rem, 12vw, 11rem);

  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);      /* expo-ish */
  --ease-io:  cubic-bezier(0.77, 0, 0.175, 1);

  /* z scale */
  --z-marquee: 1;
  --z-header: 100;
  --z-menu: 200;
  --z-loader: 300;
  --z-cursor: 400;
}

/* wide-gamut palette where supported */
@supports (color: oklch(50% 0 0)) {
  :root {
    --bg:    oklch(16% 0.008 261);
    --bg-2:  oklch(20% 0.009 261);
    --bg-3:  oklch(24% 0.01 261);
    --ink:   oklch(95% 0.004 95);
    --ink-2: oklch(78% 0.006 95);
    --ink-3: oklch(64% 0.008 95);
    --amber: oklch(70% 0.19 42);
  }
}

/* ---------- Day shift (light theme) ----------
   Same control room at 10am: daylight concrete, graphite ink, the signal
   deepened to burnt safety-orange so it keeps AA contrast on the light
   surface. Cool graphite-tinted neutrals — never cream. */

html[data-theme="light"] {
  --bg:          #f4f4f6;
  --bg-2:        #e9eaee;
  --bg-3:        #dcdee4;
  --ink:         #17191d;
  --ink-2:       #43464d;
  --ink-3:       #5b5f68;
  --amber:       #b83b00;
  --amber-soft:  rgba(184, 59, 0, 0.12);
  --green:       #14794a;
  --red:         #bb2419;
  --line:        rgba(23, 25, 29, 0.12);
  --line-strong: rgba(23, 25, 29, 0.28);
  --dot:         rgba(23, 25, 29, 0.055);
  color-scheme: light;
}
@supports (color: oklch(50% 0 0)) {
  html[data-theme="light"] {
    --bg:    oklch(96.5% 0.003 261);
    --bg-2:  oklch(93% 0.004 261);
    --bg-3:  oklch(89% 0.006 261);
    --ink:   oklch(21% 0.008 261);
    --ink-2: oklch(38% 0.008 261);
    --ink-3: oklch(47% 0.01 261);
    --amber: oklch(53% 0.17 42);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color-scheme: dark;
  scrollbar-color: var(--bg-3) var(--bg);
}

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
/* no-Lenis fallback (reduced motion / JS off has no overlay anyway) */
body.menu-open { overflow: hidden; }

body {
  margin: 0;
  background:
    radial-gradient(circle, var(--dot) 1px, transparent 1.4px) 0 0 / 28px 28px,
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::selection { background: var(--amber); color: var(--bg); }

h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: calc(var(--z-loader) + 1);
  padding: 0.6rem 1rem;
  background: var(--amber);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transform: translateY(-300%);
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

.container {
  width: var(--container);
  margin-inline: auto;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Telemetry meta line used in section heads — the HUD grammar of the site */
.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1.25rem;
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}
.sec-title {
  font-size: clamp(2.25rem, 5.5vw, 4.25rem);
  line-height: 0.98;
  font-weight: 700;
  font-stretch: 115%;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.sec-title em {
  font-style: normal;
  color: var(--amber);
}
.sec-meta {
  color: var(--ink-3);
  text-align: end;
  white-space: nowrap;
  padding-bottom: 0.4rem;
}
.sec-meta b { color: var(--ink-2); font-weight: 500; }

section { padding-block: calc(var(--sp-section) / 2); }

/* ---------- Scroll progress + cursor ---------- */

.progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 2px;
  z-index: calc(var(--z-header) + 1);
  pointer-events: none;
}
.progress__bar {
  height: 100%;
  width: 100%;
  background: var(--amber);
  transform-origin: 0 0;
  transform: scaleX(0);
}

.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid var(--amber);
  border-radius: 50%;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: 0;
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
              margin 0.25s var(--ease-out), opacity 0.3s ease, background-color 0.25s ease;
}
.cursor.is-active {
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  background: var(--amber-soft);
}
@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor { display: none; }
}

/* ---------- Loader — grid calibration ----------
   The overlay draws the site's real layout grid (container edges + interior
   columns) while short lines about the craft cycle, then the panels wipe
   away column-by-column — the hero is already sitting on that grid.
   Sequenced by main.js (CAL config there); the pre-JS state is five solid
   panels covering the viewport. */

.cal {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  pointer-events: none;
  /* CSS-only fallback: if JS never runs, the overlay lets go at 3s.
     main.js cancels this by adding .cal--live. */
  animation: cal-away 0.6s ease 3s forwards;
}
.cal--live { animation: none; }
@keyframes cal-away {
  to { opacity: 0; visibility: hidden; }
}
.cal__panels {
  position: absolute;
  inset: 0;
  display: flex; /* equal columns until JS measures the real grid */
}
.cal__panels i {
  flex: 1 1 auto;
  background: var(--bg);
  will-change: transform;
}
.cal__panels.is-measured { display: block; }
.cal__panels.is-measured i {
  position: absolute;
  top: 0;
  bottom: 0;
}
.cal__lines { position: absolute; inset: 0; }
.cal__lines i { position: absolute; background: var(--line-strong); }
.cal__lines i.v { top: 0; bottom: 0; width: 1px; }
.cal__lines i.h { left: 0; right: 0; height: 1px; }
.cal__lines .tick {
  position: absolute;
  width: 9px; height: 9px;
  margin: -4px 0 0 -4px;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) center / 9px 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) center / 1px 9px no-repeat;
  opacity: 0;
}
.cal__cross {
  position: absolute;
  top: 0; left: 0;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  opacity: 0;
}
.cal__cross i { position: absolute; background: var(--amber); }
.cal__cross i:first-child { left: 0; right: 0; top: 50%; height: 1px; }
.cal__cross i:last-child { top: 0; bottom: 0; left: 50%; width: 1px; }
/* rotating craft micro-copy, positioned at the hero topline's reading edge.
   Mono leads (Latin, tracked); AR falls through to Alexandria and the global
   RTL rule zeroes the tracking. */
.cal__line {
  position: absolute;
  font-family: var(--font-mono);
  font-size: clamp(0.82rem, 1.5vw, 1.05rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  white-space: nowrap;
  max-width: 90vw;
}
/* post-intro: the drawn grid can stay as permanent texture
   (CAL.GRID_OPACITY in main.js — the one-line toggle) */
.cal__lines--keep {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
body.is-loading { overflow: hidden; }

/* ---------- Header ---------- */

.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-header);
  transition: background-color 0.35s ease, border-color 0.35s ease, backdrop-filter 0.35s ease;
  border-bottom: 1px solid transparent;
}
.header.is-scrolled {
  background: rgba(16, 18, 22, 0.92);
  border-bottom-color: var(--line);
}
@supports (backdrop-filter: blur(0)) {
  .header.is-scrolled {
    background: rgba(16, 18, 22, 0.78);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 0.9rem;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-weight: 800;
  font-stretch: 125%;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.brand i { font-style: normal; color: var(--amber); }
.brand .mono { color: var(--ink-3); letter-spacing: 0.08em; margin-inline-start: 0.6rem; }

.nav {
  display: flex;
  gap: 0.25rem;
}
.nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: color 0.25s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0.85rem; right: 0.85rem; bottom: 0.2rem;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: 100% 0;
  transition: transform 0.35s var(--ease-out);
}
.nav a:hover, .nav a.is-active { color: var(--ink); }
.nav a:hover::after, .nav a.is-active::after {
  transform: scaleX(1);
  transform-origin: 0 0;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.status i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(249, 93, 29, 0.5); /* fallback */
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--amber) 50%, transparent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(249, 93, 29, 0.45);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--amber) 45%, transparent);
  }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem 1.5rem;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform 0.4s var(--ease-out);
}
.btn > * { position: relative; }
.btn:hover { color: var(--bg); border-color: var(--ink); }
.btn:hover::before { transform: translateY(0); }

.btn--solid {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--bg);
}
.btn--solid::before { background: var(--ink); }
.btn--solid:hover { color: var(--bg); border-color: var(--ink); }

.menu-btn {
  display: none;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.5rem 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.menu-btn__lines {
  display: grid;
  gap: 5px;
  width: 22px;
}
.menu-btn__lines i {
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s var(--ease-out), opacity 0.3s ease;
}
body.menu-open .menu-btn__lines i:first-child { transform: translateY(3.25px) rotate(45deg); }
body.menu-open .menu-btn__lines i:last-child { transform: translateY(-3.25px) rotate(-45deg); }

/* Mobile menu overlay */
.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  background:
    radial-gradient(circle, rgba(242, 241, 236, 0.08) 1px, transparent 1.4px) 0 0 / 28px 28px,
    var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--gutter);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
body.menu-open .menu {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}
/* keep the header (and its toggle) clickable above the open menu */
body.menu-open .header {
  z-index: calc(var(--z-menu) + 1);
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom-color: transparent;
}
.menu a.menu__link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  font-size: clamp(2rem, 9vw, 3.25rem);
  font-weight: 700;
  font-stretch: 115%;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1;
}
.menu a.menu__link .mono { color: var(--ink-3); }
.menu__foot {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0;
  overflow: clip;
  /* faint horizon glow: depth even before (or without) the particle scene */
  background: radial-gradient(90% 46% at 62% 38%,
    rgba(249, 93, 29, 0.07) 0%,
    rgba(242, 241, 236, 0.03) 42%,
    transparent 70%);
}
.hero__scene,
.hero__static {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__scene { display: block; width: 100%; height: 100%; }
.hero__static {
  background: radial-gradient(90% 46% at 62% 38%,
    rgba(249, 93, 29, 0.07) 0%,
    rgba(242, 241, 236, 0.03) 42%,
    transparent 70%);
}
.hero::after {
  /* keeps type legible over the scene */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom,
    rgba(16, 18, 22, 0.55) 0%,
    transparent 30%,
    transparent 55%,
    rgba(16, 18, 22, 0.9) 100%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  z-index: 2;
  padding-top: clamp(7rem, 16vh, 11rem);
}
.hero__topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  color: var(--ink-2);
  margin-bottom: clamp(1.5rem, 4vh, 3rem);
}
.hero__topline .tick {
  width: 2.5rem;
  height: 1px;
  background: var(--amber);
}
.hero__name {
  font-size: clamp(2.75rem, 9.5vw, 6rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.025em;
  line-height: 0.92;
  text-transform: uppercase;
}
.hero__name .line {
  display: block;
  overflow: hidden;
  padding-block: 0.04em; /* keep descender-free caps from clipping */
}
.hero__name .line > span { display: inline-block; will-change: transform; }
.hero__name .dot { color: var(--amber); }

.hero__sub {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.5rem 4rem;
  align-items: end;
  margin-top: clamp(1.75rem, 4vh, 3rem);
}
.hero__role {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 600;
  font-stretch: 110%;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.hero__role em { font-style: normal; color: var(--amber); }
.hero__tag {
  color: var(--ink-2);
  max-width: 44ch;
  text-wrap: pretty;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: clamp(1.75rem, 4vh, 2.75rem);
}

.hero__foot {
  position: relative;
  z-index: 2;
  margin-top: clamp(2.5rem, 6vh, 4.5rem);
  border-top: 1px solid var(--line);
  background: rgba(16, 18, 22, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.hero__foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero__foot-inner b { color: var(--ink); font-weight: 500; }
.hero__foot-inner .amber { color: var(--amber); }
.hero__foot-item { display: flex; align-items: baseline; gap: 0.6rem; white-space: nowrap; }
.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.scroll-hint i {
  width: 1px;
  height: 2rem;
  background: var(--ink-3);
  position: relative;
  overflow: hidden;
}
.scroll-hint i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--amber);
  animation: scrollhint 1.8s var(--ease-io) infinite;
}
@keyframes scrollhint {
  0% { transform: translateY(-100%); }
  55% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* ---------- Clients marquee ---------- */

.clients {
  padding-block: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: var(--z-marquee);
  overflow: clip;
}
.clients__head {
  display: flex;
  justify-content: center;
  text-align: center;
  /* sits outside .container (the marquee below it is full-bleed), so it needs
     its own gutter or it wraps hard against both edges on a phone */
  padding-inline: 1.25rem;
  color: var(--ink-3);
  margin-bottom: 1.75rem;
}
.marquee {
  display: flex;
  overflow: clip;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee__track {
  display: flex;
  align-items: center;
  gap: clamp(3rem, 6vw, 5.5rem);
  padding-inline-end: clamp(3rem, 6vw, 5.5rem);
  flex-shrink: 0;
  animation: marquee 36s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee {
  to { transform: translateX(-100%); }
}
.marquee__track img {
  height: clamp(22px, 3vw, 30px);
  width: auto;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}
.marquee__track img:hover { opacity: 1; }

/* ---------- About ---------- */

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: start;
}
.about__portrait {
  position: relative;
  max-width: 26rem;
}
.about__portrait img {
  width: 100%;
  filter: saturate(0.85) contrast(1.02);
}
.about__portrait::before,
.about__portrait::after {
  content: "";
  position: absolute;
  width: 1.1rem; height: 1.1rem;
  border: 1px solid var(--amber);
}
.about__portrait::before {
  top: -0.5rem; left: -0.5rem;
  border-right: 0; border-bottom: 0;
}
.about__portrait::after {
  bottom: -0.5rem; right: -0.5rem;
  border-left: 0; border-top: 0;
}
.about__caption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  color: var(--ink-3);
}
.about__statement {
  font-size: clamp(1.5rem, 3.1vw, 2.6rem);
  line-height: 1.28;
  font-weight: 500;
  letter-spacing: -0.01em;
  max-width: 24ch;
  text-wrap: pretty;
}
.about__statement { color: var(--ink); }
.about__statement .w { opacity: 0.42; }  /* JS scrub brightens each word; opacity (not color) so theme flips stay legible */
.about__statement em { font-style: normal; color: var(--amber); }
.about__more {
  margin-top: 2rem;
  max-width: 52ch;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* Telemetry stats strip */
.stats {
  margin-top: clamp(3.5rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-strong);
}
.stats__item {
  padding: 1.5rem 0 0;
  padding-inline-end: 1.5rem;
  position: relative;
}
.stats__item::before {
  content: "";
  position: absolute;
  top: -1px;
  inset-inline-start: 0;
  width: 2rem; height: 1px;
  background: var(--amber);
}
.stats__num {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stats__num sup {
  font-size: 0.45em;
  color: var(--amber);
  top: -0.9em;
}
.stats__label {
  display: block;
  margin-top: 0.4rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Expertise ---------- */

.skills { border-top: 1px solid var(--line); }
.skills__list { border-top: 1px solid var(--line); }
.skill {
  position: relative;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(1.1rem, 2.4vw, 1.6rem) 0.75rem;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}
.skill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg-2);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.4s var(--ease-out);
}
.skill:hover::before { transform: scaleY(1); }
.skill__idx {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  transition: color 0.3s ease;
}
.skill:hover .skill__idx { color: var(--amber); }
.skill__name {
  font-size: clamp(1.5rem, 3.6vw, 2.75rem);
  font-weight: 700;
  font-stretch: 115%;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  line-height: 1.05;
  transition: transform 0.4s var(--ease-out);
}
.skill:hover .skill__name { transform: translateX(0.75rem); }
.skill__note {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: end;
  transition: color 0.3s ease;
}
.skill:hover .skill__note { color: var(--ink-2); }

.domains {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.domains__label { color: var(--ink-3); margin-right: 0.75rem; }
.domains li {
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}
.domains li:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* ---------- Experience (the route) ---------- */

.xp__wrap {
  position: relative;
  padding-inline-start: clamp(1.75rem, 4vw, 3rem);
}
.xp__rail {
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-start: 0;
  width: 1px;
}
.xp__rail-bg,
.xp__rail-draw {
  position: absolute;
  inset: 0;
  width: 1px;
}
.xp__rail-bg { background: var(--line); }
.xp__rail-draw {
  background: var(--amber);
  transform: scaleY(0);
  transform-origin: 0 0;
}
.xp__item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr);
  gap: 1.5rem 3rem;
  padding-block: clamp(1.75rem, 4vw, 2.75rem);
  border-bottom: 1px solid var(--line);
}
.xp__item:last-child { border-bottom: 0; }
.xp__node {
  position: absolute;
  inset-inline-start: calc(-1 * clamp(1.75rem, 4vw, 3rem) - 4px);
  top: calc(clamp(1.75rem, 4vw, 2.75rem) + 0.55em);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--ink-3);
}
.xp__item.is-now .xp__node {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 0 0 rgba(249, 93, 29, 0.45); /* fallback */
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--amber) 45%, transparent);
  animation: pulse 2.2s infinite;
}
.xp__dates {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.9;
}
.xp__dates b {
  display: block;
  color: var(--ink);
  font-weight: 500;
}
.xp__dates .now { color: var(--amber); }
.xp__loc { display: block; margin-top: 0.5rem; }
.xp__role {
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.xp__role a {
  color: var(--amber);
  position: relative;
  white-space: nowrap;
}
.xp__role a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: 100% 0;
  transition: transform 0.35s var(--ease-out);
}
.xp__role a:hover::after {
  transform: scaleX(1);
  transform-origin: 0 0;
}
.xp__bullets {
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
  max-width: 62ch;
  color: var(--ink-2);
}
.xp__bullets li {
  padding-inline-start: 1.25rem;
  position: relative;
  text-wrap: pretty;
}
.xp__bullets li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0; top: 0.66em;
  width: 0.5rem; height: 1px;
  background: var(--amber);
}

/* Earlier roles — condensed log */
.xp-earlier { margin-top: clamp(3rem, 7vw, 5rem); }
.xp-earlier__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.xp-earlier__title {
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  font-weight: 700;
  font-stretch: 115%;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.xp-earlier__head .mono { color: var(--ink-3); }
.log { border-top: 1px solid var(--line-strong); }
.log__row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1.4fr) minmax(0, 1fr) 6rem;
  gap: 0.5rem 2rem;
  align-items: baseline;
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s ease;
}
.log__row:hover { background: var(--bg-2); }
.log__dates, .log__loc {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.log__role { font-weight: 600; font-stretch: 108%; }
.log__role span { color: var(--ink-3); font-weight: 400; }
.log__co { color: var(--ink-2); }
.log__loc { text-align: end; }

/* ---------- Work ---------- */

.work__list {
  display: grid;
  gap: clamp(4rem, 9vw, 7.5rem);
}
.project {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
}
.project:nth-child(even) .project__media { order: 2; }
.project__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-2);
}
.project__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 115%;   /* parallax headroom */
  top: -7.5%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.55s ease;
  will-change: transform;
}
.project__media img.is-current { opacity: 1; }
.project__media::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(242, 241, 236, 0.08);
  pointer-events: none;
}
.project__platform {
  position: absolute;
  top: 1rem;
  inset-inline-start: 1rem;
  z-index: 2;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(16, 18, 22, 0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.project__count {
  position: absolute;
  bottom: 1rem;
  inset-inline-end: 1rem;
  z-index: 2;
  color: rgba(242, 241, 236, 0.85);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}
.project__meta { padding-bottom: 0.5rem; }
.project__tag {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.project__tag::before {
  content: "";
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--amber);
}
.project__title {
  margin-top: 1rem;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: -0.015em;
  line-height: 1.05;
  transition: color 0.3s ease;
}
.project__title em { font-style: normal; color: var(--ink-3); }
.project__desc {
  margin-top: 1rem;
  color: var(--ink-2);
  max-width: 40ch;
  text-wrap: pretty;
}
.project__link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}
.project__link svg {
  width: 0.9rem; height: 0.9rem;
  transition: transform 0.3s var(--ease-out);
}
.project a:hover .project__link svg { transform: translate(3px, -3px); }
.project a:hover .project__title { color: var(--amber); }
.project > a {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  gap: inherit;
  align-items: end;
}

/* ---------- Contact ---------- */

.contact {
  border-top: 1px solid var(--line-strong);
  padding-top: calc(var(--sp-section) / 1.6);
}
.contact__title {
  font-size: clamp(2.75rem, 9vw, 6rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.025em;
  line-height: 0.95;
  text-transform: uppercase;
  max-width: 12ch;
}
.contact__title .line { display: block; overflow: hidden; padding-block: 0.04em; }
.contact__title .line > span { display: inline-block; }
.contact__title em { font-style: normal; color: var(--amber); }
.contact__grid {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: start;
}
.contact__email {
  display: inline-block;
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  font-weight: 600;
  font-stretch: 110%;
  letter-spacing: -0.01em;
  color: var(--ink);
  position: relative;
  padding-bottom: 0.2rem;
}
.contact__email::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: 100% 0;
  transition: transform 0.4s var(--ease-out);
}
.contact__email:hover::after {
  transform: scaleX(1);
  transform-origin: 0 0;
}
.contact__note { margin-top: 1.25rem; color: var(--ink-2); max-width: 38ch; text-wrap: pretty; }
.contact__list {
  margin-top: 2.5rem;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.contact__list a, .contact__list .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.9rem 0.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  transition: color 0.25s ease, padding-left 0.3s var(--ease-out);
}
.contact__list a:hover { color: var(--ink); padding-inline-start: 0.75rem; }
.contact__list .mono { color: var(--ink-3); }

/* Form */
.form {
  border: 1px solid var(--line-strong);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  position: relative;
}
.form__title {
  font-weight: 700;
  font-stretch: 115%;
  text-transform: uppercase;
  font-size: 1.15rem;
  letter-spacing: -0.005em;
}
.form__hint { color: var(--ink-3); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 0.35rem; }
.form__grid {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.field { display: grid; gap: 0.5rem; }
.field--full { grid-column: 1 / -1; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.field input, .field textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  padding: 0.85rem 1rem;
  border-radius: 2px;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); opacity: 1; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--amber);
  background: var(--bg-3);
}
.field textarea { resize: vertical; min-height: 7.5rem; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chips label { position: relative; display: inline-flex; }
.chips input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.chips span {
  padding: 0.5rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: all 0.25s ease;
}
.chips input:checked + span {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--bg);
}
.chips input:focus-visible + span {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.form__foot {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.form__msg { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; }
.form__msg.is-ok { color: var(--green); }
.form__msg.is-err { color: var(--red); }
/* Spam honeypot. Hidden by clipping, never by an off-screen offset: in RTL
   the left side is scrollable overflow, so left:-9999px inflated the document
   to ~11000px wide and the page failed to composite (blank screen in AR). */
.hp {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}

/* ---------- Footer ---------- */

.footer {
  margin-top: calc(var(--sp-section) / 2);
  border-top: 1px solid var(--line);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 1.5rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.footer__inner a { color: var(--ink-2); }
.footer__inner a:hover { color: var(--amber); }

/* ---------- Responsive ---------- */

@media (max-width: 64rem) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
  .status span { display: none; } /* keep the pulse dot, drop the word */
  .theme-btn { width: 40px; height: 40px; }
  .about__grid { grid-template-columns: 1fr; }
  .about__portrait { max-width: 20rem; }
  .contact__grid { grid-template-columns: 1fr; }
  .project,
  .project > a { grid-template-columns: 1fr; align-items: start; }
  .project:nth-child(even) .project__media { order: 0; }
  .log__row { grid-template-columns: minmax(7rem, 9rem) 1fr; }
  .log__co { grid-column: 2; }
  .log__loc { grid-column: 2; text-align: start; }
}

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .brand { white-space: nowrap; }
  .brand .mono { display: none; }
  .header__inner { gap: 0.75rem; }
  .header__actions { gap: 0.6rem; }
  /* the word already dropped at 64rem, and a bare pulse dot states nothing on
     its own — the hero foot still carries "Status / Available" */
  .status { display: none; }
  /* the theme switch swaps into the menu foot here — paired rules live with
     the component (see "Theme toggle" below) so source order stays correct */
  .header .btn { padding: 0.7rem 0.85rem; font-size: 0.7rem; }
  .menu-btn { gap: 0.45rem; }
  /* Brand + status + theme + CV + Menu will not fit a 360px header — the
     hamburger reads on its own, so the label goes to assistive tech only
     (clipped, not display:none, so the button keeps its accessible name). */
  .menu-btn__label {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .hero__sub { grid-template-columns: 1fr; }
  .hero__foot-inner { flex-wrap: wrap; gap: 0.75rem 1.5rem; }
  .hero__foot-item--hide-s { display: none; }
  .stats { grid-template-columns: 1fr 1fr; row-gap: 1.5rem; }
  .skill { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .skill__note { display: none; }
  .xp__item { grid-template-columns: 1fr; gap: 0.75rem; }
  .form__grid { grid-template-columns: 1fr; }
  .sec-head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  /* nowrap is right when the meta sits opposite the title; stacked under it
     on a phone the line just runs off-screen instead ("Since 2014 · Cairo →
     Jeddah → Kuwait → Riyadh"). */
  .sec-meta { text-align: start; white-space: normal; }
}

/* ---------- Day shift: component overrides ----------
   Everything token-driven flips automatically; these are the handful of
   literal-color surfaces that need their own daylight value. */

html[data-theme="light"] .header.is-scrolled {
  background: rgba(244, 244, 246, 0.92);
}
@supports (backdrop-filter: blur(0)) {
  html[data-theme="light"] .header.is-scrolled {
    background: rgba(244, 244, 246, 0.78);
  }
}
html[data-theme="light"] .menu {
  background:
    radial-gradient(circle, rgba(23, 25, 29, 0.07) 1px, transparent 1.4px) 0 0 / 28px 28px,
    var(--bg);
}
html[data-theme="light"] .hero,
html[data-theme="light"] .hero__static {
  background: radial-gradient(90% 46% at 62% 38%,
    rgba(184, 59, 0, 0.06) 0%,
    rgba(23, 25, 29, 0.03) 42%,
    transparent 70%);
}
html[data-theme="light"] .hero::after {
  background: linear-gradient(to bottom,
    rgba(244, 244, 246, 0.55) 0%,
    transparent 30%,
    transparent 55%,
    rgba(244, 244, 246, 0.92) 100%);
}
html[data-theme="light"] .hero__foot {
  background: rgba(244, 244, 246, 0.55);
}
/* client logos ship as white SVGs; flatten to ink for daylight */
html[data-theme="light"] .marquee__track img {
  filter: brightness(0);
  opacity: 0.55;
}
html[data-theme="light"] .marquee__track img:hover { opacity: 0.9; }

/* ---------- Theme toggle (day / night shift) ---------- */

/* menu-foot copy — only surfaces below 40rem, where the header drops its own
   (see Responsive). Scoped to .menu so it outranks the base .theme-btn rule
   below regardless of source order. */
.menu .theme-btn { display: none; }

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.theme-btn:hover,
.theme-btn:focus-visible { color: var(--amber); border-color: var(--amber); }
.theme-btn svg { width: 18px; height: 18px; display: block; }
.theme-btn .i-moon { display: none; }
html[data-theme="light"] .theme-btn .i-sun { display: none; }
html[data-theme="light"] .theme-btn .i-moon { display: block; }

/* Where the switch lives: the header row on desktop, the menu foot on phones
   (no room beside brand + CV + hamburger at 360px, and it pairs naturally
   with the language toggle already down there). Both rules sit here, after
   the base .theme-btn, so source order resolves them correctly. */
.menu .theme-btn { display: none; }
@media (max-width: 40rem) {
  .header .theme-btn { display: none; }
  .menu .theme-btn { display: inline-flex; }
}

/* theme flip: ease the big surfaces so day/night doesn't hard-cut */
html.theme-flip body,
html.theme-flip .header.is-scrolled,
html.theme-flip .hero__foot {
  transition: background-color 0.45s ease, color 0.45s ease;
}

/* ---------- Experience layer ----------
   The narrative instruments: journey HUD (right-edge phase rail), phase
   readout (bottom-left telemetry), contextual cursor label, and the
   capability scanner. All injected/driven by JS — none of this exists for
   reduced-motion, touch, or no-JS visitors. Tokens only; no new hues. */

/* Journey HUD — the route, drawn as stops on the right edge */
.hud {
  position: fixed;
  inset-inline-end: clamp(1rem, 2.2vw, 1.9rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 90; /* under the header, over content */
  display: none;
  gap: 1.05rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
.hud.is-on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
@media (min-width: 64rem) {
  .hud { display: grid; }
}
.hud__stop {
  position: relative;
  width: 12px;
  height: 12px;
  padding: 0;
}
.hud__stop::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--ink-3);
  opacity: 0.55;
  transform: scale(0.7);
  transition: transform 0.3s var(--ease-out), background-color 0.3s ease, opacity 0.3s ease;
}
.hud__stop:hover::before { opacity: 1; transform: scale(1); }
.hud__stop.is-active::before {
  background: var(--amber);
  opacity: 1;
  transform: scale(1);
}
.hud__stop span {
  position: absolute;
  inset-inline-end: 1.5rem;
  top: 50%;
  transform: translate(6px, -50%);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
}
.hud__stop:hover span,
.hud__stop.is-active span { opacity: 1; transform: translate(0, -50%); }
.hud__stop.is-active span { color: var(--amber); }

/* Phase readout — bottom-left telemetry line, scrambles between phases */
.phase-readout {
  position: fixed;
  inset-inline-start: clamp(1rem, 2.2vw, 1.9rem);
  bottom: 1.1rem;
  z-index: 90;
  display: none;
  color: var(--ink-3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
.phase-readout.is-on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
@media (min-width: 64rem) {
  .phase-readout { display: block; }
}

/* Contextual cursor: the ring becomes a labelled lens over projects */
.cursor__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cursor.is-label {
  width: 78px; height: 78px;
  margin: -39px 0 0 -39px;
  background: rgba(16, 18, 22, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.cursor.is-label .cursor__label { opacity: 1; }
html[data-theme="light"] .cursor.is-label { background: rgba(244, 244, 246, 0.6); }

/* Capability scanner: the row crossing the reading line carries the same
   state as a hover — scroll sweeps the list like a status board */
.skill.is-hot::before { transform: scaleY(1); }
.skill.is-hot .skill__idx { color: var(--amber); }
.skill.is-hot .skill__name { transform: translateX(0.75rem); }
.skill.is-hot .skill__note { color: var(--ink-2); }

/* Project plates tilt in 3D toward the cursor (JS-driven) */
.project__media { will-change: transform; }

/* ---------- Language toggle (script morph) ----------
   A track whose knob carries the active language's glyph. The knob slides
   LEFT toward Arabic and RIGHT toward English — the control itself teaches
   the direction change — while the label rolls vertically (current exits
   up, target enters from below). Geometry is deliberately physical (not
   dir-flipped): Arabic always lives on the left, English on the right,
   in both language modes. */

.lang-toggle {
  position: relative;
  display: inline-block;
  width: 6.6rem;
  height: 44px; /* full touch target is the track */
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.3s ease;
}
.lang-toggle:hover,
.lang-toggle:focus-visible { border-color: var(--amber); }
.lang-toggle__opt {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color 0.25s ease;
}
.lang-toggle__opt--ar { left: 0; }
.lang-toggle__opt--en { right: 0; }
.lang-toggle:hover .lang-toggle__opt { color: var(--amber); }
.lang-toggle__knob {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  overflow: hidden;
  /* EN rest pose: right half; switching to AR slides it left (RTL-wards) */
  transform: translateX(calc(100% + 2px));
  transition: transform 0.4s var(--ease-out);
  will-change: transform;
}
.lang-toggle.is-ar .lang-toggle__knob { transform: translateX(0); }
.lang-toggle__face {
  grid-area: 1 / 1;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
  transition: transform 0.35s var(--ease-out), opacity 0.3s ease;
}
.lang-toggle__face--ar,
.lang-toggle__opt--ar {
  /* عربي renders in Alexandria always — a tiny always-loaded subset face
     covers exactly these glyphs, so EN visitors see the true script */
  font-family: "Alexandria", var(--font-sans);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
}
/* label roll: current exits up, target enters from below */
.lang-toggle__face--ar { transform: translateY(130%); opacity: 0; }
.lang-toggle.is-ar .lang-toggle__face--ar { transform: translateY(0); opacity: 1; }
.lang-toggle.is-ar .lang-toggle__face--en { transform: translateY(-130%); opacity: 0; }
@media (max-width: 40rem) {
  .header .lang-toggle { display: none; } /* lives in the menu overlay instead */
}

/* ---------- Arabic (RTL) ----------
   Alexandria leads the sans stack (it covers Latin, so mixed lines sit on
   one face). The mono stack keeps Geist Mono first: digits/coordinates keep
   the telemetry voice, and Arabic glyphs — absent from Geist — fall through
   to Alexandria per-glyph. Arabic script is never letter-spaced; emphasis
   uses the accent color (the site never used true italics). */

html[dir="rtl"] {
  --font-sans: "Alexandria", "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", "Alexandria", ui-monospace, "SF Mono", Menlo, monospace;
}
[dir="rtl"] * { letter-spacing: 0 !important; } /* connected script: tracking breaks letterforms */
[dir="rtl"] body { line-height: 1.75; }

/* Arabic runs taller and slightly wider than condensed Archivo caps —
   looser leading, gently reduced display ceilings */
[dir="rtl"] .hero__name { font-size: clamp(2.5rem, 8.6vw, 5.4rem); line-height: 1.18; }
[dir="rtl"] .hero__name .line,
[dir="rtl"] .contact__title .line { padding-block: 0.18em 0.08em; } /* extra top room for Arabic ascenders like hamza on أ */
[dir="rtl"] .sec-title { font-size: clamp(2rem, 5vw, 3.9rem); line-height: 1.18; }
[dir="rtl"] .contact__title { font-size: clamp(2.4rem, 8vw, 5.3rem); line-height: 1.12; }
[dir="rtl"] .about__statement { line-height: 1.55; }
[dir="rtl"] .xp__role { line-height: 1.45; }
[dir="rtl"] .menu a.menu__link { line-height: 1.3; }
[dir="rtl"] .skill__name { line-height: 1.35; }

/* direction-coupled motion + ornaments */
[dir="rtl"] .marquee { direction: ltr; } /* keep marquee LTR so translateX(-100%) scrolls naturally left; logos are directionless */
[dir="rtl"] .marquee__track { animation-direction: normal; }
[dir="rtl"] .project__link svg { transform: scaleX(-1); }
[dir="rtl"] .project a:hover .project__link svg { transform: scaleX(-1) translate(3px, -3px); }
[dir="rtl"] .nav a::after { transform-origin: 0 0; }
[dir="rtl"] .nav a:hover::after,
[dir="rtl"] .nav a.is-active::after { transform-origin: 100% 0; }
[dir="rtl"] .xp__role a::after { transform-origin: 0 0; }
[dir="rtl"] .xp__role a:hover::after { transform-origin: 100% 0; }
[dir="rtl"] .contact__email::after { transform-origin: 0 0; }
[dir="rtl"] .contact__email:hover::after { transform-origin: 100% 0; }
[dir="rtl"] .skill:hover .skill__name,
[dir="rtl"] .skill.is-hot .skill__name { transform: translateX(-0.75rem); }
[dir="rtl"] .hud__stop span { transform: translate(-6px, -50%); }
[dir="rtl"] .hud__stop:hover span,
[dir="rtl"] .hud__stop.is-active span { transform: translate(0, -50%); }

/* Latin fragments that must never reorder: numbers, handles, phone, email.
   direction:ltr keeps "11+" digit-then-plus; text-align:right pins the
   number to the RTL start edge so it shares one edge with its Arabic label */
[dir="rtl"] .stats__num,
[dir="rtl"] .contact__list .mono,
[dir="rtl"] .phase-readout { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .stats__num { text-align: right; }
[dir="rtl"] .stats__label { line-height: 1.7; margin-top: 0.5rem; }
[dir="rtl"] #f-email { direction: ltr; text-align: end; }

/* reading progress fills from the reading edge: right → left in Arabic */
[dir="rtl"] .progress__bar { transform-origin: 100% 0; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .marquee { overflow-x: auto; }
  .marquee__track { animation: none; }
  .marquee__track[aria-hidden="true"] { display: none; }
  .hero__scene { display: none; }
  .about__statement .w { opacity: 1; }
  .cal { display: none; animation: none; }
}
