/* ApexMindX one page site, v2.
   Direction (art-direction roll, 29 Nov 2026): museum exhibition wayfinding and wall text; a strict 12 column grid where
   only the entrance headline breaks out; the headline is the artwork; soft elevation from one light source at the upper
   inline-start of the room (the same light the 3D key light uses); scroll driven reveals on native CSS scroll timelines;
   navigation sits at the bottom of the viewport. Colour is the fixed ApexMindX palette: Night and purple grounds, coral
   as the one signal (the spark, the call to action, the current room).
   The base styles are the complete static page (JavaScript off, reduced motion, no WebGL). Motion only applies under
   html.motion (boot.js), the 3D world only under html.webgl (scene.js). */

/* ---------- Fonts (self hosted, OFL 1.1) ---------- */
@font-face { font-family: "Sora"; src: url("../fonts/sora-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Sora"; src: url("../fonts/sora-600.woff") format("woff"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("../fonts/readex-pro-arabic-400.woff") format("woff"); font-weight: 400; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Readex Pro"; src: url("../fonts/readex-pro-arabic-600.woff") format("woff"); font-weight: 600 700; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }

/* ---------- Tokens ---------- */
:root {
  --purple: #4A0E8F; --purple-700: #350A68; --lilac: #DCCBF4; --lilac-2: #B794F0; --lilac-3: #A67EE0;
  --coral: #FF4D6A; --coral-hover: #FF6B83;
  --night-0: #0E021E; --night-1: #14032A; --night-2: #1E0538; --night-3: #2A0B4E;
  --font: "Sora", "Readex Pro", system-ui, -apple-system, "Segoe UI", "Geeza Pro", "Noto Sans Arabic", sans-serif;
  --gutter: clamp(16px, 4vw, 48px); --col-gap: clamp(12px, 1.8vw, 24px); --max: 1320px;
  --rail-h: 68px; --top-h: 64px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-expo: cubic-bezier(0.16, 1, 0.3, 1); --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --lh: 1.6;
  /* Type ramp (px at 1440): 12.5 / 14 / 17 / 21 / 28 / 44 / 72, display up to 168 */
  --t-label: 0.78125rem; --t-small: 0.875rem; --t-body: 1.0625rem; --t-lede: clamp(1.1rem, 1rem + 0.4vw, 1.3125rem);
  --t-h3: clamp(1.2rem, 1.05rem + 0.45vw, 1.375rem); --t-h2: clamp(2.1rem, 1.1rem + 3.4vw, 4.5rem);

  /* Night (default theme) */
  --ground: var(--night-1); --ink: #FFFFFF; --text: #EEE8FA; --muted: #BDB5D6; --hair: rgba(183, 148, 240, 0.22);
  --plate: rgba(20, 3, 42, 0.78); --plate-edge: rgba(183, 148, 240, 0.16); --label: #CDB8F2; --focus: #DCCBF4; --link: #D9C6F7; --coral-text: var(--coral);
  --shadow-plate: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 14px 24px 52px -20px rgba(4, 0, 12, 0.85), 4px 6px 14px -6px rgba(4, 0, 12, 0.5);
  --btn-quiet-fg: #FFFFFF; --btn-quiet-edge: rgba(255, 255, 255, 0.42);
  --rail-bg: rgba(14, 2, 30, 0.84); --rail-solid: #120328; --logo-caret: #FFFFFF;
  --pattern: url("../img/pattern%20night.svg");
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ground: #F5F2FA; --ink: #1E0538; --text: #24222B; --muted: #5C5873; --hair: rgba(74, 14, 143, 0.2);
  --plate: rgba(255, 255, 255, 0.86); --plate-edge: rgba(74, 14, 143, 0.12); --label: #4A0E8F; --focus: #4A0E8F; --link: #4A0E8F; --coral-text: #C8193F; /* coral for small text on paper: 5.2:1 */
  --shadow-plate: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 14px 24px 48px -22px rgba(42, 11, 78, 0.32), 3px 5px 12px -6px rgba(42, 11, 78, 0.18);
  --btn-quiet-fg: #1E0538; --btn-quiet-edge: rgba(30, 5, 56, 0.4);
  --rail-bg: rgba(245, 242, 250, 0.88); --rail-solid: #F5F2FA; --logo-caret: #4A0E8F;
  --pattern: url("../img/pattern%20paper.svg");
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; background: var(--ground); scrollbar-color: var(--lilac-3) transparent; }
html:not(.motion) { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html, html:not(.motion) { scroll-behavior: auto; } }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 var(--t-body)/var(--lh) var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; caret-color: var(--coral);
  transition: background-color 400ms ease, color 400ms ease; }
:lang(ar) { --lh: 1.85; }
::selection { background: var(--coral); color: var(--night-2); }
h1, h2, h3 { color: var(--ink); font-weight: 600; margin: 0; text-wrap: balance; }
h2 { font-size: var(--t-h2); line-height: 1.02; letter-spacing: -0.035em; }
h3 { font-size: var(--t-h3); line-height: 1.25; letter-spacing: -0.012em; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.35; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--link); text-underline-offset: 4px; text-decoration-thickness: 1px; }
svg { display: block; }
bdi { unicode-bidi: isolate; }
img { display: block; max-width: 100%; }
main { position: relative; z-index: 1; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); width: 100%; max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto; padding-inline: var(--gutter); }
.room { position: relative; padding-block: clamp(96px, 14vh, 180px); }
.lede { font-size: var(--t-lede); color: var(--muted); max-width: 46ch; line-height: 1.55; }
:lang(ar) .lede { line-height: 1.9; }
.wall { display: grid; gap: 20px; align-content: start; }
.wall-wide { grid-column: 1 / span 6; }
.wall h2 { max-width: 15ch; }
:lang(ar) .wall h2 { max-width: 18ch; }

/* Room label: the museum's room sign, set beside the heading's start edge, not as an eyebrow */
.room-label { display: flex; align-items: baseline; gap: 14px; font-size: var(--t-label); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--label); }
.room-label .rl-no { color: var(--muted); font-weight: 400; }
.room-label .rl-name { display: inline-flex; align-items: center; gap: 10px; }
.room-label .rl-name::before { content: ""; width: 28px; height: 1px; background: var(--coral); }
:lang(ar) .room-label { letter-spacing: 0; text-transform: none; font-size: 0.9rem; }

/* Wall plate: a raised label lit from the upper inline-start */
.plate { background: var(--plate); border: 1px solid var(--plate-edge); border-radius: 4px; box-shadow: var(--shadow-plate); padding: clamp(20px, 2.4vw, 32px); }

/* Focus, skip link */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 300; background: #FFFFFF; color: var(--night-2); padding: 12px 18px; border-radius: 6px; font-weight: 600; }
.skip:focus { top: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: 999px;
  font: 600 0.97rem/1 var(--font); text-decoration: none; white-space: nowrap; border: 0; cursor: pointer; position: relative;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, box-shadow 200ms ease, color 200ms ease; }
.btn:active { transform: scale(0.97); }
.btn-lg { min-height: 60px; padding: 0 32px; font-size: 1.04rem; }
/* Coral call to action with a Deep Night label: 5.8:1 (white on coral would be 3.2:1). */
.btn-cta { background: var(--coral); color: var(--night-2); box-shadow: 0 10px 30px -12px rgba(255, 77, 106, 0.65); }
.btn-quiet { background: transparent; color: var(--btn-quiet-fg); box-shadow: inset 0 0 0 1.5px var(--btn-quiet-edge); }
@media (hover: hover) and (pointer: fine) {
  .btn-cta:hover { background: var(--coral-hover); box-shadow: 0 14px 36px -12px rgba(255, 77, 106, 0.8); }
  .btn-quiet:hover { box-shadow: inset 0 0 0 1.5px var(--btn-quiet-fg); }
}
.btn .icon { flex: none; }
.btn-arrow { transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .btn:hover .btn-arrow { transform: translateX(3px); } [dir="rtl"] .btn:hover .btn-arrow { transform: translateX(-3px); } }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Top corner ---------- */
.top-bar { position: fixed; inset: 0 0 auto 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--gutter) 0; pointer-events: none; }
.top-bar > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: 44px; }
.logo-symbol { flex: none; }
.logo-caret { stroke: var(--logo-caret); }
.logo-spark { fill: var(--coral); }
.wordmark { font-weight: 600; font-size: 1.12rem; letter-spacing: -0.01em; color: var(--ink); font-family: "Sora", system-ui, sans-serif; direction: ltr; }
.wordmark .x { color: var(--coral); }
.top-tools { display: flex; align-items: center; gap: 6px; }
.tool { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 999px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--ground) 62%, transparent); color: var(--ink); font: 600 0.9rem/1 var(--font); text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--hair); transition: box-shadow 200ms ease, transform 160ms var(--ease-out); }
.tool:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) { .tool:hover { box-shadow: inset 0 0 0 1px var(--ink); } }
.lang:lang(ar) { font-family: "Readex Pro", var(--font); }
.theme-btn { padding: 0; width: 44px; }
.theme-btn .i-sun { display: block; } .theme-btn .i-moon { display: none; }
:root[data-theme="light"] .theme-btn .i-sun { display: none; } :root[data-theme="light"] .theme-btn .i-moon { display: block; }
:root:not(.js) .theme-btn { display: none; }

/* ---------- Bottom rail: wayfinding ---------- */
.rail { position: fixed; inset: auto 0 0 0; z-index: 60; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  height: calc(var(--rail-h) + env(safe-area-inset-bottom)); padding: 0 var(--gutter) env(safe-area-inset-bottom);
  background: var(--rail-bg); border-top: 1px solid var(--hair); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); }
.rail-where { display: flex; align-items: baseline; gap: 8px; min-width: 190px; font-size: var(--t-small); color: var(--muted); }
.rw-no { font-weight: 600; color: var(--coral-text); font-size: 1rem; }
.rw-name { color: var(--ink); font-weight: 600; margin-inline-start: 8px; }
.rail-list { display: flex; justify-content: center; gap: 4px; }
.rail-list a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; text-decoration: none; color: var(--muted);
  font-size: var(--t-small); font-weight: 600; transition: color 200ms ease, background-color 200ms ease; }
.rail-list a[aria-current="true"] { color: var(--ink); background: color-mix(in srgb, var(--coral) 14%, transparent); }
.rail-list a[aria-current="true"] .rail-no { color: var(--coral-text); }
@media (hover: hover) and (pointer: fine) { .rail-list a:hover { color: var(--ink); } }
.rail-no { font-weight: 400; font-size: 0.75rem; letter-spacing: 0.04em; }
.rail-icon, .rail-short, .rc-short { display: none; }
.rail-track { position: absolute; inset: -1px 0 auto 0; height: 2px; overflow: hidden; }
.rail-fill { display: block; height: 100%; background: var(--coral); transform-origin: left center; transform: scaleX(var(--p, 0)); }
[dir="rtl"] .rail-fill { transform-origin: right center; }
.rail-cta { min-height: 46px; padding: 0 20px; font-size: 0.92rem; }

/* ---------- Entrance ---------- */
.hero { min-height: 100svh; display: grid; align-items: end; padding-block: calc(var(--top-h) + 48px) calc(var(--rail-h) + 56px); overflow: clip; }
.hero-grid { row-gap: 40px; align-items: end; position: relative; z-index: 2; }
.hero-title { grid-column: 1 / -1; font-size: clamp(3.1rem, 10.4vw, 10.5rem); line-height: 0.9; letter-spacing: -0.04em; max-width: 10.5em; }
.hero-title .w { display: inline-block; }
.hero-title .w > span { display: inline-block; }
:lang(ar) .hero-title { font-size: clamp(2.6rem, 8.2vw, 8.4rem); line-height: 1.22; letter-spacing: 0; max-width: 9em; }
.hero-side { grid-column: 1 / span 5; display: grid; gap: 24px; }
.hero-lede { font-size: var(--t-lede); color: var(--text); max-width: 40ch; line-height: 1.55; }
:lang(ar) .hero-lede { line-height: 1.9; }
.directory { grid-column: 8 / -1; align-self: end; border-top: 1px solid var(--hair); }
.directory a { display: grid; grid-template-columns: 4.2em 1fr auto; align-items: center; min-height: 48px; border-bottom: 1px solid var(--hair); text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.98rem; }
.directory a::after { content: ""; width: 7px; height: 7px; border-top: 1.6px solid currentColor; border-inline-end: 1.6px solid currentColor; transform: rotate(45deg); opacity: 0.55; transition: transform 200ms var(--ease-out), opacity 200ms ease; }
[dir="rtl"] .directory a::after { transform: rotate(-45deg); }
.dir-no { font-weight: 400; font-size: 0.78rem; color: var(--muted); letter-spacing: 0.06em; }
@media (hover: hover) and (pointer: fine) { .directory a:hover::after { opacity: 1; transform: translateX(4px) rotate(45deg); } [dir="rtl"] .directory a:hover::after { transform: translateX(-4px) rotate(-45deg); } }
.stage.stage-hero { position: absolute; inset-block: 0 22%; inset-inline-end: 0; width: min(48%, 760px); display: grid; place-items: center; z-index: 0; }
.skip-intro { position: absolute; z-index: 5; inset-inline-end: var(--gutter); bottom: calc(var(--rail-h) + 20px); min-height: 44px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid var(--hair); font: 600 0.85rem/1 var(--font); }
.scroll-hint { position: absolute; z-index: 2; inset-inline-start: 50%; bottom: calc(var(--rail-h) + 18px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  font-size: var(--t-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
[dir="rtl"] .scroll-hint { transform: translateX(50%); }
:lang(ar) .scroll-hint { letter-spacing: 0; text-transform: none; font-size: 0.85rem; }
.sh-line { width: 1px; height: 28px; background: linear-gradient(var(--coral), transparent); }
:root:not(.motion) .scroll-hint { display: none; }

/* ---------- Ascent rise (hero): the pattern drifts up out of the ground, sparks climb toward the summit ----------
   Runs on its own, loops with no seam (the pattern moves exactly one 60 px tile; every spark starts and ends at opacity 0),
   animates transform and opacity only, sits behind the text (z-index 1 under the grid's 2) and never takes layout space.
   Without html.motion (reduced motion, no JS) it holds a still frame: the pattern at rest and the sparks frozen mid climb. */
.ascent { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: clip; contain: strict; transition: opacity 900ms ease; }
.intro .ascent { opacity: 0; }
.as-field { position: absolute; inset: auto 0 0 0; height: 40%; overflow: clip; opacity: 0.36;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.4) 40%, transparent 88%); mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.4) 40%, transparent 88%); }
:root[data-theme="light"] .as-field { opacity: 0.55; }
.as-drift { position: absolute; inset: 0 0 -60px 0; background-image: var(--pattern); background-size: 150px 60px; background-position: center top; }
.as-sparks { position: absolute; inset-block: 6% 30%; inset-inline-end: 0; width: min(48%, 760px); container-type: size; }
.as-spark { position: absolute; bottom: 0; inset-inline-start: var(--x); width: var(--s); height: var(--s); margin-inline-start: calc(var(--s) / -2);
  --rise: 62vh; --c: var(--lilac); opacity: calc(0.9 - var(--rest) * 0.6);
  transform: translate3d(calc(var(--sx) * var(--rest)), calc(var(--rise) * var(--rest) * -1), 0) scale(calc(1 - var(--rest) * 0.45)) rotate(calc(var(--rest) * 90deg)); }
@supports (height: 1cqh) { .as-spark { --rise: 100cqh; } }
.as-mark { display: block; width: 100%; height: 100%; fill: var(--c); filter: drop-shadow(0 0 calc(var(--s) * 0.45) var(--c)); }
:root[data-theme="light"] .as-spark { --c: var(--lilac-3); }
/* Nine climbers: column, size, sway, period, phase, and where each one rests in the still frame. */
.as-spark:nth-child(1) { --x: 18%; --s: 16px; --sx: 14px; --d: 7s; --p: -0.5s; --rest: 0.62; }
.as-spark:nth-child(2) { --x: 34%; --s: 11px; --sx: -10px; --d: 8.5s; --p: -3.1s; --rest: 0.3; }
.as-spark:nth-child(3) { --x: 50%; --s: 26px; --sx: 8px; --d: 6.5s; --p: -1.7s; --rest: 0.8; --c: var(--coral); }
.as-spark:nth-child(4) { --x: 62%; --s: 14px; --sx: -16px; --d: 9s; --p: -6.2s; --rest: 0.45; }
.as-spark:nth-child(5) { --x: 76%; --s: 20px; --sx: 12px; --d: 7.5s; --p: -4.4s; --rest: 0.18; --c: var(--coral); }
.as-spark:nth-child(6) { --x: 88%; --s: 11px; --sx: -8px; --d: 8s; --p: -2.3s; --rest: 0.7; }
.as-spark:nth-child(7) { --x: 26%; --s: 15px; --sx: 18px; --d: 9.5s; --p: -7.8s; --rest: 0.88; }
.as-spark:nth-child(8) { --x: 44%; --s: 10px; --sx: -12px; --d: 7.2s; --p: -5.5s; --rest: 0.52; }
.as-spark:nth-child(9) { --x: 68%; --s: 18px; --sx: 10px; --d: 8.8s; --p: -0.9s; --rest: 0.36; --c: var(--coral); }
:root[data-theme="light"] .as-spark:nth-child(3), :root[data-theme="light"] .as-spark:nth-child(5), :root[data-theme="light"] .as-spark:nth-child(9) { --c: var(--coral); }

/* ---------- Stages: where each exhibit stands. The 3D world frames these boxes; the still fills them without WebGL. ---------- */
.stage { position: relative; }
.still { display: block; width: 100%; height: 100%; }
.still img { width: 100%; height: 100%; object-fit: contain; }
.webgl .still { display: none; }

/* ---------- The idea ---------- */
.idea-list { grid-column: 1 / span 6; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px var(--col-gap); margin-top: 64px; }
.idea-item { display: grid; gap: 10px; align-content: start; padding-top: 18px; border-top: 1px solid var(--hair); position: relative; }
.ii-mark { position: absolute; top: -6px; inset-inline-start: 0; width: 11px; height: 11px; }
.ii-spark { width: 11px; height: 11px; fill: var(--coral); }
.idea-item h3 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.ii-gloss { color: var(--muted); font-weight: 400; font-size: 0.7em; margin-inline-start: 6px; }
.idea-item p { color: var(--muted); }
.stage.stage-idea { display: none; }
@media (max-width: 999px), (orientation: portrait) and (max-width: 1199px) { html.motion:not(.no-webgl) .stage.stage-idea { display: block; grid-column: 1 / -1; width: 100%; max-width: 460px; aspect-ratio: 1 / 1; justify-self: center; margin-top: 32px; } }
.idea-close { grid-column: 1 / span 6; margin-top: 56px; font-size: var(--t-lede); color: var(--ink); font-weight: 600; max-width: 32ch; }

/* ---------- Services ---------- */
.services { padding-bottom: 0; }
.services-head { margin-bottom: clamp(40px, 8vh, 96px); }
.exhibit { position: relative; min-height: 118vh; display: grid; align-items: center; padding-block: 8vh; }
.exhibit .grid { align-items: center; }
.exhibit .plate { grid-column: 1 / span 5; display: grid; gap: 16px; }
.exhibit .stage { grid-column: 7 / -1; aspect-ratio: 1 / 1; max-height: 74vh; justify-self: center; width: 100%; max-width: 74vh; }
.tomb { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-label); letter-spacing: 0.12em; color: var(--muted); padding-bottom: 14px; border-bottom: 1px solid var(--hair); }
.tomb-no { color: var(--coral-text); font-weight: 600; }
.ex-title { font-size: clamp(1.75rem, 1.2rem + 1.9vw, 2.75rem); letter-spacing: -0.03em; line-height: 1.06; }
:lang(ar) .ex-title { letter-spacing: 0; line-height: 1.35; }
.ex-text { font-size: var(--t-lede); color: var(--text); line-height: 1.55; }
.ex-points { display: grid; gap: 0; margin-top: 4px; }
.ex-points li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 11px 0; border-top: 1px solid var(--hair); color: var(--muted); font-size: 0.97rem; }
.ex-points li::before { content: ""; width: 10px; height: 10px; margin-top: 0.55em; border-top: 1.6px solid var(--lilac-3); border-inline-start: 1.6px solid var(--lilac-3); transform: rotate(45deg) translate(2px, 2px); }

/* ---------- Process ---------- */
.approach .grid { align-items: start; }
.phases { grid-column: 1 / span 6; display: grid; gap: 18px; margin-top: 56px; counter-reset: ph; }
.phase { display: grid; grid-template-columns: 3.4em 1fr; column-gap: 18px; row-gap: 8px; }
.phase:nth-child(even) { margin-inline-start: 8.33%; }
.ph-no { grid-row: span 3; font-size: 2rem; font-weight: 600; line-height: 1; color: var(--coral-text); letter-spacing: -0.03em; }
.phase h3 { align-self: end; }
.phase > p:not(.ph-no):not(.ph-out) { color: var(--muted); }
.ph-out { display: grid; gap: 4px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--hair); }
.ph-out-label { font-size: var(--t-label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); font-weight: 600; }
:lang(ar) .ph-out-label { letter-spacing: 0; text-transform: none; font-size: 0.85rem; }
.ph-out-text { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-weight: 600; font-size: 0.97rem; }
.ph-out-text .icon { color: var(--coral); margin-top: 3px; flex: none; }
.stage-steps, .stage-globe { grid-column: 7 / -1; grid-row: 1 / span 2; position: sticky; top: 14vh; height: 72vh; }
.stage-globe { grid-column: 6 / -1; }

/* ---------- Academy (flag) ---------- */
.tracks { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--col-gap); margin-top: 56px; }
.track { display: grid; gap: 10px; align-content: start; }
.track .icon { color: var(--coral); }
.track p { color: var(--muted); }

/* ---------- Markets ---------- */
.markets .grid { align-items: start; }
.cities { grid-column: 1 / span 5; display: grid; gap: 18px; margin-top: 56px; }
.city { display: grid; gap: 8px; }
.city h3 { display: flex; align-items: center; gap: 12px; font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.25rem); }
.city h3::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px color-mix(in srgb, var(--coral) 22%, transparent); }
.city p { color: var(--muted); }

/* ---------- Principles ---------- */
.pr-list { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--col-gap); margin-top: 56px; }
.pr { display: grid; grid-template-columns: 3em 1fr; gap: 8px 16px; align-content: start; }
.pr-no { grid-row: span 2; font-size: 0.85rem; color: var(--coral-text); font-weight: 600; padding-top: 6px; letter-spacing: 0.06em; }
.pr h3 { font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.85rem); letter-spacing: -0.02em; }
:lang(ar) .pr h3 { letter-spacing: 0; } /* .pr h3 outranks the :lang(ar) h3 reset above; Arabic never takes letter spacing */
.pr p { color: var(--muted); }
.pr:nth-child(2) { margin-top: 64px; } .pr:nth-child(4) { margin-top: 64px; }

/* ---------- Motto ---------- */
.motto { min-height: 150vh; display: grid; align-items: center; }
.motto-main { grid-column: 1 / -1; font-size: clamp(2.8rem, 9vw, 9.5rem); font-weight: 600; line-height: 0.95; letter-spacing: -0.04em; color: var(--ink); text-wrap: balance; }
.motto-main .w { display: inline-block; }
.motto-main:lang(ar) { font-size: clamp(2.4rem, 7.4vw, 7.6rem); line-height: 1.3; letter-spacing: 0; }
.motto-other { grid-column: 1 / -1; margin-top: 32px; font-size: clamp(1.4rem, 1rem + 1.6vw, 2.4rem); color: var(--label); font-weight: 600; }
.motto-other:lang(ar) { font-family: "Readex Pro", var(--font); letter-spacing: 0; }
.motto-other:lang(en) { letter-spacing: -0.02em; }
/* With the 3D type running, the page language line is drawn in 3D; the text stays for screen readers and search. */
.webgl .motto-main { color: transparent; }
.webgl .motto-other { position: absolute; top: var(--mo-top, 72%); inset-inline: 0; margin: 0; padding-inline: var(--gutter); text-align: center; }
.webgl .motto-main::selection, .webgl .motto-main *::selection { color: var(--night-2); }

/* ---------- Contact ---------- */
.contact { min-height: 110vh; display: grid; align-items: center; padding-bottom: clamp(120px, 18vh, 200px); }
.contact-wall { gap: 24px; }
.contact-wall .lede { color: var(--text); }
.book-note { font-size: var(--t-small); color: var(--muted); }
.address { font-size: var(--t-small); color: var(--muted); }
.stage.stage-close { position: absolute; inset-block: 6% 10%; inset-inline-end: 0; width: min(52%, 820px); }
.social { display: flex; flex-wrap: wrap; gap: 10px; }
.social a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 12px; border-radius: 999px; text-decoration: none; color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair); font-weight: 600; font-size: 0.9rem; transition: box-shadow 200ms ease, color 200ms ease, transform 160ms var(--ease-out); }
.social a:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .social a:hover { box-shadow: inset 0 0 0 1px var(--coral); } .social a:hover .icon { color: var(--coral); } }
.social .icon { transition: color 200ms ease; }

/* ---------- Colophon ---------- */
.colophon { position: relative; z-index: 2; background: var(--night-0); color: #EEE8FA; padding: clamp(96px, 14vh, 160px) 0 calc(var(--rail-h) + 40px + env(safe-area-inset-bottom)); overflow: clip;
  --ink: #FFFFFF; --text: #EEE8FA; --muted: #BDB5D6; --hair: rgba(183, 148, 240, 0.2); --link: #D9C6F7; --focus: #DCCBF4; --logo-caret: #FFFFFF; --label: #CDB8F2; }
.colophon-pattern { position: absolute; inset: 0 0 auto 0; height: 220px; background-image: url("../img/pattern%20night.svg"); background-size: 150px 60px; opacity: 0.5;
  -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent); }
.foot-grid { position: relative; row-gap: 56px; }
.foot-brand { grid-column: 1 / span 5; display: grid; gap: 20px; align-content: start; }
.brand-lg .wordmark { font-size: 2.2rem; }
.foot-line { color: var(--muted); max-width: 34ch; }
.foot-motto { grid-column: 7 / -1; display: grid; gap: 10px; }
.fm-en { font-size: clamp(2rem, 1.2rem + 3vw, 4.25rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1; color: #FFFFFF; }
.fm-ar { font-family: "Readex Pro", var(--font); font-size: clamp(1.6rem, 1rem + 2.2vw, 3.1rem); font-weight: 600; color: var(--label); line-height: 1.35; }
.foot-cities { grid-column: 1 / span 5; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--hair); }
.foot-cities li { display: grid; gap: 4px; padding-top: 16px; }
.fc-name { font-weight: 600; color: #FFFFFF; }
.fc-time { font-size: var(--t-small); color: var(--muted); min-height: 1.4em; }
.foot-nav { grid-column: 7 / span 2; }
.foot-nav ul { display: grid; gap: 2px; }
.foot-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .foot-nav a:hover { color: #FFFFFF; text-decoration: underline; } }
.foot-contact { grid-column: 9 / -1; display: grid; gap: 16px; justify-items: start; align-content: start; }
.foot-mail { color: #FFFFFF; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.foot-legal { grid-column: 1 / -1; padding-top: 28px; border-top: 1px solid var(--hair); font-size: var(--t-small); color: var(--muted); }

/* ---------- Booking dialog ---------- */
.book-sentinel { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.book-dialog { width: min(1320px, calc(100vw - 48px)); height: min(1080px, calc(100dvh - 48px)); /* Google's booking page shows the full week from about 1280 px wide and needs about 1000 px tall */ max-width: none; max-height: none; padding: 0; border: 1px solid var(--hair); border-radius: 8px;
  background: var(--night-2); color: #EEE8FA; box-shadow: 30px 50px 120px -40px rgba(0, 0, 0, 0.9); overflow: hidden; display: none; }
.book-dialog[open] { display: grid; grid-template-rows: auto 1fr; }
.book-dialog::backdrop { background: rgba(8, 1, 18, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.motion .book-dialog[open] { animation: dlg-in 320ms var(--ease-expo); }
.motion .book-dialog[open]::backdrop { animation: fade-in 240ms ease; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
.bd-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 22px; border-bottom: 1px solid rgba(183, 148, 240, 0.2); }
[dir="rtl"] .bd-head { padding: 10px 22px 10px 10px; }
.bd-title { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-inline-end: auto; color: #FFFFFF; }
.bd-spark { width: 11px; height: 11px; fill: var(--coral); }
.bd-newtab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; color: #D9C6F7; font-size: 0.9rem; font-weight: 600; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .bd-newtab:hover { text-decoration: underline; } }
.bd-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: #FFFFFF; cursor: pointer; transition: background-color 200ms ease, transform 160ms var(--ease-out); }
.bd-close:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .bd-close:hover { background: rgba(255, 255, 255, 0.16); } }
.bd-body { position: relative; background: #FFFFFF; }
.bd-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity 300ms ease; }
.bd-body.loaded iframe { opacity: 1; }
.bd-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--night-2); color: #EEE8FA; text-align: center; padding: 24px; transition: opacity 240ms ease; }
.bd-body.loaded .bd-loading { opacity: 0; pointer-events: none; }
.bd-pulse { width: 44px; height: 44px; display: grid; place-items: center; }
.bd-pulse-spark { width: 30px; height: 30px; fill: var(--coral); }
.motion .bd-pulse-spark { animation: pulse 1.2s var(--ease-in-out) infinite; }
@keyframes pulse { 50% { transform: scale(0.72) rotate(45deg); opacity: 0.6; } }
.bd-slow { color: #D9C6F7; font-weight: 600; }

/* ---------- Text pages (privacy, 404): one readable column over the static Night backdrop ---------- */
.doc { min-height: 100svh; display: grid; align-items: center; padding: calc(var(--top-h) + 48px) var(--gutter) 72px; }
.doc-body { width: 100%; max-width: 54rem; margin-inline: auto; display: grid; gap: 18px; } /* rem, not ch: ch is measured in the fallback font first, so the column widened when Sora arrived (layout shift) */
.doc-body h1 { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.6rem); line-height: 1.04; letter-spacing: -0.035em; }
.doc-body h2 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem); line-height: 1.25; letter-spacing: -0.012em; margin-top: 18px; }
.doc-meta { color: var(--coral-text); font-size: var(--t-small); font-weight: 600; letter-spacing: 0.06em; }
:lang(ar) .doc-body h1, :lang(ar) .doc-body h2, :lang(ar) .doc-meta, .doc-meta :lang(ar) { letter-spacing: 0; } /* Arabic never takes letter spacing */
.doc-body p { color: var(--text); }
.doc-ar { font-family: "Readex Pro", var(--font); color: var(--muted); }
.doc-back { margin-top: 18px; }
.doc .actions { margin-top: 12px; }

/* ---------- Static backdrop for the page without WebGL (no JS, reduced motion, no WebGL) ---------- */
.world, .world-fallback { position: fixed; inset: 0; width: 100%; height: 100lvh; z-index: 0; pointer-events: none; }
.world { display: none; }
.webgl .world { display: block; }
.world-fallback { background: radial-gradient(80% 60% at 70% 20%, rgba(74, 14, 143, 0.55), transparent 70%), linear-gradient(180deg, var(--night-3), var(--night-1) 60%, var(--night-0)); }
.world-fallback::after { content: ""; position: absolute; inset: 0; background-image: var(--pattern); background-size: 150px 60px; opacity: 0.32;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, transparent 30%, #000 100%); mask-image: radial-gradient(70% 60% at 50% 40%, transparent 30%, #000 100%); }
:root[data-theme="light"] .world-fallback { background: radial-gradient(80% 60% at 70% 20%, rgba(166, 126, 224, 0.28), transparent 70%), linear-gradient(180deg, #EEE7FA, #F5F2FA 60%, #F1EAFB); }
:root[data-theme="light"] .world-fallback::after { opacity: 0.5; }
.webgl .world-fallback { display: none; }

/* ---------- Custom cursor (fine pointers, motion, WebGL) ---------- */
.cursor { display: none; }
.fine.motion.webgl .cursor { display: block; position: fixed; inset: 0 auto auto 0; z-index: 400; pointer-events: none; }
.fine.motion.webgl, .fine.motion.webgl a, .fine.motion.webgl button { cursor: none; }
.fine.motion.webgl .book-dialog, .fine.motion.webgl .book-dialog * { cursor: auto; }
.fine.motion.webgl .book-dialog a, .fine.motion.webgl .book-dialog button { cursor: pointer; }
.cursor-ring { position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink); opacity: 0.6;
  transform: translate3d(var(--rx, -100px), var(--ry, -100px), 0) scale(var(--rs, 1)); transition: box-shadow 200ms ease, opacity 200ms ease; }
.cursor-dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; transform: translate3d(var(--dx, -100px), var(--dy, -100px), 0); }
.cursor-spark { width: 10px; height: 10px; fill: var(--coral); }
.cursor.is-link .cursor-ring { box-shadow: inset 0 0 0 1.5px var(--coral); opacity: 1; }
.cursor.is-object .cursor-ring { box-shadow: inset 0 0 0 1px var(--coral), 0 0 24px rgba(255, 77, 106, 0.35); opacity: 1; }
.cursor.is-down .cursor-ring { --rs: 0.8; }
html.dialog-open .cursor { display: none !important; }

/* ---------- Motion (boot.js sets html.motion; reduced motion never gets it) ---------- */
/* Entrance headline: each word rises inside its own line box on first paint. Opacity stays 1, so the text paints at once. */
.motion .hero-title .w { overflow: clip; overflow-clip-margin: 0.12em; padding-block: 0.04em; margin-block: -0.04em; vertical-align: top; }
.motion .hero-title .w > span { animation: word-rise 1100ms var(--ease-expo) both; }
.motion .hero-title .w1 > span { animation-delay: 70ms; } .motion .hero-title .w2 > span { animation-delay: 140ms; }
.motion .hero-title .w3 > span { animation-delay: 210ms; } .motion .hero-title .w4 > span { animation-delay: 280ms; }
@keyframes word-rise { from { transform: translateY(0.42em) rotate(1.5deg); } }
.motion .hero-side, .motion .directory { animation: soft-in 900ms var(--ease-expo) 380ms both; }
@keyframes soft-in { from { opacity: 0.001; transform: translateY(18px); } }
.intro .scroll-hint { opacity: 0; }
.intro .skip-intro[hidden] { display: inline-flex; align-items: center; }
.skip-intro { animation: soft-in 400ms ease 300ms both; }
.motion .sh-line { animation: drip 2.2s var(--ease-in-out) infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); transform-origin: top; } 55% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* Ascent rise. The drift moves one tile height, so the last frame matches the first. Sparks start below their rest line
   (negative delays put every climber mid flight at first paint), rise the full box, sway, shrink and fade out at the top. */
.motion .as-drift { animation: as-drift 9s linear infinite; will-change: transform; }
@keyframes as-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, -60px, 0); } }
.motion .as-spark { animation: as-climb var(--d) cubic-bezier(0.33, 0, 0.4, 1) var(--p) infinite; will-change: transform, opacity; }
@keyframes as-climb {
  0% { transform: translate3d(0, 0, 0) scale(0.5) rotate(0deg); opacity: 0; }
  14% { opacity: 0.95; }
  50% { transform: translate3d(var(--sx), calc(var(--rise) * -0.5), 0) scale(1.15) rotate(45deg); }
  78% { opacity: 0.75; }
  100% { transform: translate3d(calc(var(--sx) * -0.4), calc(var(--rise) * -1), 0) scale(0.75) rotate(90deg); opacity: 0; }
}
.ascent.is-off .as-drift, .ascent.is-off .as-spark, .dialog-open .as-drift, .dialog-open .as-spark { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .as-drift, .as-spark { animation: none !important; } }

/* Scroll driven reveals on native CSS scroll timelines. Browsers without them show everything at rest. */
@supports (animation-timeline: view()) {
  .motion .reveal { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% cover 24%; }
  .motion h2.reveal, .motion .ex-title.reveal { animation-name: reveal-h; }
  .motion .plate.reveal { animation-name: reveal-plate; }
}
@keyframes reveal { from { opacity: 0; transform: translateY(28px); } }
@keyframes reveal-h { from { opacity: 0; transform: translateY(40px); filter: blur(10px); } }
@keyframes reveal-plate { from { opacity: 0; transform: translateY(48px) scale(0.985); box-shadow: 0 0 0 transparent; } }

/* ---------- Tablet and below ---------- */
@media (max-width: 1099px) {
  .rail { grid-template-columns: 1fr auto; }
  .rail-where { display: none; }
  .rail-list { justify-content: flex-start; }
  .rail-no { display: none; }
}
@media (max-width: 999px) {
  .wall-wide, .hero-side, .directory, .idea-list, .idea-close, .phases, .cities, .exhibit .plate { grid-column: 1 / -1; }
  /* Hidden from first paint whenever the 3D world is expected (motion on, WebGL not ruled out), not only once scene.js
     adds .webgl: hiding it late dropped the bottom aligned hero text by about 250 px (layout shift 0.145 at 768 px). */
  html.motion:not(.no-webgl) .directory { display: none; } /* the rail already lists the services; the summit needs the room */
  .stage.stage-hero { inset-block: 4% auto; inset-inline: 0; width: 100%; height: 56%; }
  .as-sparks { inset-block: 6% 42%; inset-inline: 6%; width: auto; }
  .hero-title { font-size: clamp(3rem, 13vw, 7.5rem); }
  :lang(ar) .hero-title { font-size: clamp(2.5rem, 10.5vw, 6rem); }
  .exhibit { min-height: auto; padding-block: 10vh; }
  .exhibit .grid { row-gap: 28px; }
  .exhibit .stage { grid-column: 1 / -1; grid-row: 1; max-width: 560px; max-height: none; }
  .stage-steps, .stage-globe { position: relative; top: 0; grid-column: 1 / -1; grid-row: auto; height: auto; aspect-ratio: 1 / 1; max-width: 560px; justify-self: center; width: 100%; margin-top: 40px; }
  .stage.stage-close { position: relative; inset: auto; width: 100%; max-width: 560px; aspect-ratio: 1 / 1; margin-inline: auto; }
  .contact { min-height: auto; }
  .phase:nth-child(even) { margin-inline-start: 0; }
  .pr:nth-child(2), .pr:nth-child(4) { margin-top: 0; }
  .tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-brand, .foot-motto, .foot-cities { grid-column: 1 / -1; }
  .foot-nav { grid-column: 1 / span 4; } .foot-contact { grid-column: 5 / -1; }
}

/* ---------- Phones: the rail becomes the bottom tab bar ---------- */
@media (max-width: 759px) {
  :root { --rail-h: 64px; --top-h: 56px; }
  .rail { grid-template-columns: repeat(var(--tabs, 5), minmax(0, 1fr)); gap: 0; padding-inline: 4px; -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--rail-solid); }
  .rail-list { display: contents; }
  .rail-list li { display: contents; }
  .rail-list a, .rail-cta { flex-direction: column; justify-content: center; gap: 3px; min-height: 56px; padding: 4px 2px; border-radius: 12px; font-size: 0.72rem; line-height: 1.1; text-align: center; box-shadow: none; }
  .rail-list a[aria-current="true"] { background: transparent; }
  .rail-list a[aria-current="true"] .rail-icon { color: var(--coral); }
  .rail-icon, .rail-short, .rc-short { display: block; white-space: nowrap; }
  .rail-icon { width: 34px; height: 34px; padding: 6px; }
  .rail-long, .rc-long, .rail-no { display: none; }
  .rail-cta { background: transparent; color: var(--ink); margin: 0; }
  .rail-cta .icon { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: var(--coral); color: var(--night-2); }
  .rail-cta .rc-short { color: var(--ink); }
  :lang(ar) .rail-list a, :lang(ar) .rail-cta { font-size: 0.78rem; }
  .room { padding-block: 88px; }
  .hero { padding-bottom: calc(var(--rail-h) + 36px + env(safe-area-inset-bottom)); }
  .hero-title { font-size: clamp(2.9rem, 15.5vw, 5.5rem); }
  :lang(ar) .hero-title { font-size: clamp(2.4rem, 12vw, 4.4rem); }
  .wordmark { font-size: 1.02rem; }
  .idea-list, .pr-list, .tracks { grid-template-columns: minmax(0, 1fr); }
  .scroll-hint { display: none; }
  .directory { display: none; }
  .hero { min-height: 100svh; }
  .skip-intro { bottom: calc(var(--rail-h) + 14px + env(safe-area-inset-bottom)); }
  .motto { min-height: 110vh; }
  .foot-nav, .foot-contact { grid-column: 1 / -1; }
  .foot-cities { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
  .book-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .plate { padding: 20px; }
  .top-bar { background: linear-gradient(var(--ground) 0%, color-mix(in srgb, var(--ground) 70%, transparent) 60%, transparent); }
  .rail-list a[data-rail-link="academy"] { display: none; }
}
@media (max-width: 359px) { .hero-title { font-size: 2.65rem; } :lang(ar) .hero-title { font-size: 2.2rem; } .actions .btn { flex: 1 1 100%; } .foot-cities { grid-template-columns: minmax(0, 1fr); } }

/* Touch: every control at least 44 by 44 */
@media (pointer: coarse) {
  a, button { min-height: 44px; }
  .address a, .book-note a { display: inline-flex; align-items: center; }
  .directory a { min-height: 52px; }
}
