/* =========================================================
   ZAIN BASM — interactive portfolio
   Built from zero: no images, everything is code.
   ========================================================= */

:root {
  --bg: #eef0fb;
  --ink: #15142c;
  --mute: rgba(21, 20, 44, .56);
  --faint: rgba(21, 20, 44, .14);
  --glass: rgba(255, 255, 255, .45);
  --vig: rgba(120, 110, 200, .18);
  --grain: .07;
  --violet: #7b5cff;
  --cyan: #2fb8ff;
  --pink: #ff5fb8;
  --amber: #ffad5c;
  --grad: linear-gradient(100deg, var(--violet), var(--cyan) 45%, var(--pink) 80%, var(--amber));
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.7, 0, .84, 0);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --pixel: "Silkscreen", "Geist Mono", monospace;
  --pad: clamp(20px, 4vw, 56px);
}

/* ---------- Themes ---------- */
[data-theme="ocean"] {
  --bg: #1530c4;
  --ink: #f3f6ff;
  --mute: rgba(243, 246, 255, .62);
  --faint: rgba(243, 246, 255, .2);
  --glass: rgba(255, 255, 255, .06);
  --vig: rgba(4, 10, 70, .55);
  --grain: .1;
  --violet: #9fb4ff; --cyan: #7ff3ff; --pink: #ffffff; --amber: #c9f5ff;
}
[data-theme="dusk"] {
  --bg: #f7e6dc;
  --ink: #2b1420;
  --mute: rgba(43, 20, 32, .58);
  --faint: rgba(43, 20, 32, .14);
  --glass: rgba(255, 255, 255, .4);
  --vig: rgba(200, 90, 90, .16);
  --grain: .08;
  --violet: #e0527e; --cyan: #ff8a5c; --pink: #b04ad8; --amber: #ffb547;
}
[data-theme="night"] {
  --bg: #05050a;
  --ink: #f2f0ff;
  --mute: rgba(242, 240, 255, .52);
  --faint: rgba(242, 240, 255, .14);
  --glass: rgba(255, 255, 255, .03);
  --vig: rgba(0, 0, 0, .75);
  --grain: .09;
  --violet: #8b6bff; --cyan: #3fe6ff; --pink: #ff5fd2; --amber: #ffbe5c;
}

:lang(ar) {
  --display: "Alexandria", "Tajawal", system-ui, sans-serif;
  --serif: "Alexandria", "Tajawal", system-ui, sans-serif;
}

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

html { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--display);
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  cursor: none;
}
body.is-booting { overflow: hidden; height: 100vh; }
@media (pointer: coarse) { body { cursor: auto; } }

button { font: inherit; color: inherit; background: none; border: 0; cursor: none; }
a { color: inherit; text-decoration: none; cursor: none; }
@media (pointer: coarse) { button, a { cursor: pointer; } }
::selection { background: var(--violet); color: #fff; }

/* ---------- Background layers ---------- */
#gl {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block;
}
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-6%, 4%); }
  40% { transform: translate(5%, -7%); } 60% { transform: translate(-3%, 8%); }
  80% { transform: translate(7%, 2%); } 100% { transform: translate(0, 0); }
}
body.no-gl #gl { display: none; }
body.no-gl {
  background:
    radial-gradient(40vw 40vw at 70% 40%, rgba(139,107,255,.35), transparent 70%),
    radial-gradient(30vw 30vw at 30% 70%, rgba(63,230,255,.18), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, var(--vig) 100%);
}

/* ---------- Boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: grid; grid-template-rows: auto 1fr auto auto;
  padding: var(--pad);
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  color: var(--mute);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.3s var(--ease);
}
#boot.is-done { clip-path: inset(0 0 100% 0); }
.boot-top { display: flex; justify-content: space-between; text-transform: uppercase; }
.boot-lines {
  align-self: center; font-family: var(--mono); font-size: clamp(11px, 1.1vw, 14px);
  line-height: 2; color: var(--ink); white-space: pre-wrap; min-height: 12em;
}
.boot-lines .ok { color: var(--cyan); }
.boot-lines .dim { color: var(--mute); }
.boot-lines .caret { display: inline-block; width: .6em; height: 1.1em; background: var(--cyan); vertical-align: -0.2em; animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.boot-bottom { display: flex; justify-content: space-between; align-items: flex-end; text-transform: uppercase; }
.boot-count {
  font-family: var(--display); font-weight: 800; color: var(--ink);
  font-size: clamp(80px, 18vw, 260px); line-height: .8; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.boot-bar { height: 1px; background: var(--faint); margin-top: 18px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 100%; background: var(--grad); transform-origin: left; transform: scaleX(0); }
[dir="rtl"] .boot-bar i { transform-origin: right; }

/* ---------- HUD ---------- */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--pad) * .6) var(--pad);
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  opacity: 0; transform: translateY(-20px);
  transition: opacity 1s var(--ease) .6s, transform 1s var(--ease) .6s;
}
body.is-ready .hud { opacity: 1; transform: none; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; }
.logo-orb {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--violet), var(--cyan), var(--pink), var(--amber), var(--violet));
  animation: spin 6s linear infinite; box-shadow: 0 0 24px rgba(139,107,255,.6);
}
@keyframes spin { to { transform: rotate(1turn); } }
.hud-mid { display: flex; align-items: center; gap: 10px; color: var(--mute); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 var(--cyan); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,230,255,.6); } 100% { box-shadow: 0 0 0 12px rgba(63,230,255,0); } }
.pill {
  padding: 9px 16px; border: 1px solid var(--faint); border-radius: 99px;
  font-family: "Alexandria", var(--mono); font-size: 12px; letter-spacing: 0;
  backdrop-filter: blur(10px); background: rgba(255,255,255,.03);
  transition: border-color .4s, background .4s;
}
.pill:hover { border-color: var(--ink); background: rgba(255,255,255,.08); }
:lang(ar) .pill { font-family: var(--mono); letter-spacing: .14em; }
.hud-right { display: flex; align-items: center; gap: 22px; }
.key-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--pixel); font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink); padding: 6px 2px;
}
.key-btn b { font-weight: 400; color: var(--mute); transition: color .3s; }
.key-btn:hover b { color: var(--ink); }
.swatch {
  width: 12px; height: 12px; border-radius: 3px; background: var(--grad);
  box-shadow: 0 0 0 1px var(--faint); transition: transform .6s var(--ease);
}
.key-btn:hover .swatch { transform: rotate(90deg); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 2px; height: 3px; background: var(--ink); transition: height .3s; }
.sound-on .eq i { animation: eq 1.1s ease-in-out infinite; }
.sound-on .eq i:nth-child(2) { animation-delay: -.4s; animation-duration: 1.4s; }
.sound-on .eq i:nth-child(3) { animation-delay: -.8s; animation-duration: .9s; }
.sound-on .eq i:nth-child(4) { animation-delay: -.2s; animation-duration: 1.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }

.toast {
  position: fixed; left: 50%; bottom: 9vh; z-index: 60; pointer-events: none;
  font-family: var(--pixel); font-size: 14px; letter-spacing: .08em; color: var(--ink);
  padding: 12px 20px; border: 1px solid var(--faint); border-radius: 12px;
  background: var(--glass); backdrop-filter: blur(14px);
  transform: translate(-50%, 20px); opacity: 0; transition: .6s var(--ease);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
body { transition: background-color .9s ease, color .9s ease; }

/* Rail */
.rail {
  position: fixed; right: var(--pad); top: 50%; z-index: 20;
  display: flex; flex-direction: column; gap: 14px; transform: translateY(-50%);
  opacity: 0; transition: opacity 1s var(--ease) .9s;
}
[dir="rtl"] .rail { right: auto; left: var(--pad); }
body.is-ready .rail { opacity: 1; }
.rail button {
  position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  height: 14px; font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--mute);
}
[dir="rtl"] .rail button { flex-direction: row-reverse; }
.rail button span { opacity: 0; transform: translateX(8px); transition: .5s var(--ease); white-space: nowrap; }
.rail button i { width: 14px; height: 1px; background: var(--mute); transition: .5s var(--ease); }
.rail button:hover span, .rail button.on span { opacity: 1; transform: none; }
.rail button.on { color: var(--ink); }
.rail button.on i { width: 36px; background: var(--ink); }

/* Chapter meta */
.chapter-meta {
  position: fixed; left: var(--pad); bottom: calc(var(--pad) * .7); z-index: 20;
  display: flex; gap: 18px; align-items: baseline;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--mute);
  opacity: 0; transition: opacity 1s var(--ease) 1s;
}
[dir="rtl"] .chapter-meta { left: auto; right: var(--pad); }
body.is-ready .chapter-meta { opacity: 1; }
.cm-num b { color: var(--ink); font-weight: 500; }
.cm-name { display: inline-block; transition: opacity .3s, transform .3s; }
.cm-name.swap { opacity: 0; transform: translateY(6px); }

.progress { position: fixed; left: 0; right: 0; bottom: 0; height: 2px; z-index: 20; }
.progress i { display: block; height: 100%; background: var(--grad); transform-origin: left; transform: scaleX(0); }
[dir="rtl"] .progress i { transform-origin: right; }

/* Cursor */
#cursor { position: fixed; inset: 0; z-index: 200; pointer-events: none; mix-blend-mode: difference; }
.c-dot, .c-ring { position: absolute; top: 0; left: 0; border-radius: 50%; will-change: transform; }
.c-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; }
.c-ring {
  width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 1px solid #fff;
  display: grid; place-items: center;
  transition: width .5s var(--ease), height .5s var(--ease), margin .5s var(--ease), background .4s, border-color .4s;
}
.c-ring em { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: #000; opacity: 0; transition: opacity .3s; }
#cursor.hover .c-ring { width: 90px; height: 90px; margin: -45px 0 0 -45px; background: #fff; }
#cursor.hover .c-ring em { opacity: 1; }
#cursor.down .c-ring { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
@media (pointer: coarse) { #cursor { display: none; } }

/* ---------- Story / chapters ---------- */
#story { position: relative; z-index: 5; }
.ch { height: 100vh; height: 100lvh; position: relative; }
.ch-inner {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 calc(var(--pad) * 2.2);
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 1s;
  transform: translate3d(0, calc(var(--p, 0) * -6vh), 0);
}
.ch.is-active .ch-inner { pointer-events: auto; z-index: 2; visibility: visible; transition-delay: 0s; }

.ch-hero .ch-inner { justify-content: flex-end; padding-bottom: 12vh; }
.ch-center .ch-inner { align-items: center; text-align: center; }
.ch-right .ch-inner { align-items: flex-end; text-align: end; }
.ch-work .ch-inner, .ch-contact .ch-inner { justify-content: center; }
.ch-tools .ch-inner { align-items: center; text-align: center; }

/* Split text reveal */
.split { display: block; }
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding: .06em 0 .1em; margin-bottom: -.1em; }
.split .wi {
  display: inline-block; will-change: transform;
  transform: translate3d(0, 115%, 0) rotate(6deg); opacity: 0;
  transition:
    transform .55s var(--ease-in) calc(var(--i) * 12ms),
    opacity .45s ease calc(var(--i) * 12ms);
}
.ch.is-past .split .wi { transform: translate3d(0, -115%, 0) rotate(-6deg); }
.ch.is-active .split .wi {
  transform: none; opacity: 1;
  transition:
    transform 1.1s var(--ease) calc(var(--i) * 32ms + var(--d, 350ms)),
    opacity 0.9s ease calc(var(--i) * 32ms + var(--d, 350ms));
}
.split .sp { display: inline-block; width: .28em; }

/* Generic reveal */
.rv {
  opacity: 0; transform: translate3d(0, 32px, 0);
  transition: opacity .45s ease, transform .55s var(--ease-in);
}
.ch.is-past .rv { transform: translate3d(0, -32px, 0); }
.ch.is-active .rv {
  opacity: 1; transform: none;
  transition: opacity 1s ease var(--rd, .6s), transform 1.2s var(--ease) var(--rd, .6s);
}

/* Typography */
.eyebrow, .tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--mute); margin-bottom: 2.4vh;
}
.tag { display: inline-flex; align-items: center; gap: 12px; }
.tag::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.ch-center .tag::after, .ch-tools .tag::after { content: ""; width: 28px; height: 1px; background: currentColor; }
.ch-right .tag { flex-direction: row-reverse; }

.hero-title {
  font-weight: 800; font-size: clamp(56px, 13vw, 250px); line-height: .84;
  font-variation-settings: "wght" 800, "wdth" 100;
  letter-spacing: -.055em; white-space: nowrap;
  --d: 150ms;
}
.hero-title .wi { transition-property: transform, opacity, filter, font-weight; }
:lang(ar) .hero-title { letter-spacing: 0; line-height: 1.15; font-size: clamp(64px, 14vw, 240px); }
.hero-sub {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(22px, 2.6vw, 44px); color: var(--ink); margin-top: 2.4vh;
  --d: 900ms;
}
:lang(ar) .hero-sub { font-style: normal; font-weight: 300; }
.ch-hero .eyebrow { --rd: .2s; }
.scroll-hint {
  position: absolute; right: calc(var(--pad) * 2.2); bottom: 12vh;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--mute);
  --rd: 1.4s;
}
[dir="rtl"] .scroll-hint { right: auto; left: calc(var(--pad) * 2.2); }
.sh-line { width: 1px; height: 70px; background: var(--faint); position: relative; overflow: hidden; }
.sh-line::after { content: ""; position: absolute; inset: 0; background: var(--ink); animation: drip 2s var(--ease) infinite; }
@keyframes drip { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }

.big {
  font-weight: 700; font-size: clamp(40px, 7.4vw, 136px); line-height: .98; letter-spacing: -.035em;
  max-width: 14ch;
}
.big + .big { --d: 650ms; }
:lang(ar) .big { letter-spacing: 0; line-height: 1.3; font-weight: 600; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.02em; }
:lang(ar) .serif { font-style: normal; font-weight: 300; }
.grad .wi {
  background: var(--grad); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: flow 8s linear infinite;
}
@keyframes flow { to { background-position: 300% 0; } }

.giant {
  font-weight: 800; font-size: clamp(64px, 17vw, 330px); line-height: .85; letter-spacing: -.05em;
}
:lang(ar) .giant { letter-spacing: 0; line-height: 1.2; }
.outline .wi { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.sub {
  font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.8vw, 48px); color: var(--mute);
  margin-top: 2vh; --d: 800ms;
}
:lang(ar) .sub { font-style: normal; font-weight: 300; }

.stack {
  margin-top: 5vh; display: flex; align-items: center; gap: 18px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--mute);
  --rd: 1.2s;
}
.stack i { width: 40px; height: 1px; background: var(--grad); }

/* Work list */
.works { list-style: none; margin-top: 2vh; border-top: 1px solid var(--faint); }
.work {
  position: relative; display: grid; grid-template-columns: 70px 1fr auto; align-items: center;
  padding: 2.4vh 0; border-bottom: 1px solid var(--faint); overflow: hidden;
}
.work:nth-child(1) { --rd: .5s; } .work:nth-child(2) { --rd: .62s; } .work:nth-child(3) { --rd: .74s; }
.work::before {
  pointer-events: none;
  content: ""; position: absolute; inset: 0; background: var(--grad); opacity: .1;
  transform: scaleY(0); transform-origin: bottom; transition: transform .7s var(--ease);
}
.work:hover::before { transform: scaleY(1); }
.w-idx { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.w-name {
  position: relative; font-weight: 800; font-size: clamp(44px, 9vw, 160px); line-height: .95; letter-spacing: -.04em;
  font-family: var(--display);
  transition: transform .8s var(--ease), letter-spacing .8s var(--ease);
}
.w-name::after {
  content: attr(data-text); position: absolute; inset: 0;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  clip-path: inset(0 100% 0 0); transition: clip-path .8s var(--ease);
}
[dir="rtl"] .w-name::after { clip-path: inset(0 0 0 100%); }
.work:hover .w-name { transform: translateX(2vw); letter-spacing: -.02em; }
[dir="rtl"] .work:hover .w-name { transform: translateX(-2vw); }
.work:hover .w-name::after { clip-path: inset(0 0 0 0); }
.w-tag { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); transition: color .4s; }
:lang(ar) .w-tag { font-family: "Alexandria", sans-serif; letter-spacing: 0; font-size: 14px; }
.work:hover .w-tag { color: var(--ink); }
.works.has-hover .work:not(:hover) { opacity: .25; }
.work { transition: opacity .5s ease; }

/* Tools orbit */
.ch-tools .ch-inner { justify-content: space-between; padding-top: 15vh; padding-bottom: 13vh; }
.ring-wrap { position: absolute; inset: 0; pointer-events: none; --rd: .4s; }
.ring { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.ring span {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 99px;
  font-family: var(--mono); font-size: clamp(11px, .9vw, 14px); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: var(--glass); border: 1px solid var(--faint);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  will-change: transform, opacity;
}
.ring span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--grad); }

/* Contact links */
.links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 5vh; --rd: 1.1s; }
.link {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 18px 28px; border: 1px solid var(--faint); border-radius: 99px;
  font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  background: rgba(255,255,255,.02); backdrop-filter: blur(12px);
  position: relative; overflow: hidden; isolation: isolate;
  transition: border-color .4s, color .4s;
}
.link::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink);
  transform: translateY(101%); border-radius: inherit; transition: transform .6s var(--ease);
}
.link:hover { color: var(--bg); border-color: var(--ink); }
.link:hover::before { transform: none; }
.link i { font-style: normal; transition: transform .5s var(--ease); }
.link:hover i { transform: rotate(45deg); }
.foot { margin-top: 6vh; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--mute); --rd: 1.4s; }
:lang(ar) .foot { font-family: "Alexandria", sans-serif; letter-spacing: 0; }

/* =========================================================
   v3 — details, motion & components
   ========================================================= */

/* velocity skew on the active chapter */
.ch-inner { transform: translate3d(0, calc(var(--p, 0) * -6vh), 0) skewY(var(--skew, 0deg)); }

/* dotted focus box (hover signature) */
.key-btn, .logo, .coords, .redact { position: relative; }
.key-btn::after, .logo::after, .redact::after {
  content: ""; position: absolute; inset: -6px -8px; border: 2px dotted transparent;
  pointer-events: none; transition: border-color .2s;
}
.key-btn:hover::after, .logo:hover::after, .redact:hover::after,
.key-btn:focus-visible::after, .logo:focus-visible::after { border-color: var(--ink); }
:focus-visible { outline: none; }
a:focus-visible, button:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

/* ghost chapter number */
.ghost {
  position: fixed; right: -1vw; bottom: -6vw; z-index: 2; pointer-events: none;
  font-family: var(--display); font-weight: 800; font-size: 34vw; line-height: .8; letter-spacing: -.06em;
  color: transparent; -webkit-text-stroke: 1px var(--faint);
  opacity: 0; transition: opacity 1.2s ease 1s; overflow: hidden;
}
body.is-ready .ghost { opacity: 1; }
[dir="rtl"] .ghost { right: auto; left: -1vw; }
.ghost span { display: inline-block; transition: transform .9s var(--ease), opacity .6s; }
.ghost span.out-up { transform: translateY(-40%); opacity: 0; transition-duration: .45s; }
.ghost span.out-down { transform: translateY(40%); opacity: 0; transition-duration: .45s; }
.ghost span.in-up { transform: translateY(40%); opacity: 0; transition: none; }
.ghost span.in-down { transform: translateY(-40%); opacity: 0; transition: none; }

/* cursor coordinates */
.coords {
  position: fixed; left: 50%; bottom: calc(var(--pad) * .7); z-index: 20; transform: translateX(-50%);
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--mute);
  font-variant-numeric: tabular-nums; opacity: 0; transition: opacity 1s var(--ease) 1.1s;
}
body.is-ready .coords { opacity: 1; }

/* 3D flip for giant words */
.giant .w { perspective: 900px; overflow: visible; }
.giant .wi { transform: rotateX(-100deg) translateY(20%); transform-origin: 50% 100%; }
.ch.is-past .giant .wi { transform: rotateX(100deg) translateY(-20%); transform-origin: 50% 0%; }
/* skewed serif lines */
.serif .wi { transform: translate3d(0, 115%, 0) skewX(-14deg); }
.ch.is-past .serif .wi { transform: translate3d(0, -115%, 0) skewX(14deg); }

/* playful letters on hover */
.ch.is-active .giant .wi, .ch.is-active .hero-title .wi {
  transition:
    transform 1.2s var(--ease) calc(var(--i) * 38ms + var(--d, 380ms)),
    opacity 1s ease calc(var(--i) * 38ms + var(--d, 380ms)),
    filter 1s ease calc(var(--i) * 38ms + var(--d, 380ms)),
    translate .5s var(--ease), color .4s;
}
.ch.is-active .giant .wi:hover { translate: 0 -10%; color: var(--violet); }
.ch.is-active .outline .wi:hover { color: transparent; -webkit-text-stroke-color: var(--violet); }

/* signature */
.sign { width: min(340px, 60vw); height: auto; margin-top: 2vh; overflow: visible; }
.sign text {
  font-family: "Mrs Saint Delafield", cursive; font-size: 84px;
  fill: transparent; stroke: var(--violet); stroke-width: 1.2;
  stroke-dasharray: 900; stroke-dashoffset: 900;
}
.ch.is-active .sign text { animation: sign 2.6s cubic-bezier(.65,0,.35,1) 1.2s forwards; }
@keyframes sign { 70% { fill: transparent; } to { stroke-dashoffset: 0; fill: var(--violet); } }
:lang(ar) .sign { direction: ltr; }

/* redacted reveal */
.redact-wrap { margin-top: 3vh; font-family: var(--mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); --rd: 1.3s; }
:lang(ar) .redact-wrap { font-family: "Alexandria", sans-serif; letter-spacing: 0; }
.redact {
  margin-inline-start: 8px; font-family: var(--mono); font-size: 13px; letter-spacing: .1em; color: var(--ink);
  padding: 4px 6px; background: color-mix(in srgb, var(--violet) 18%, transparent);
}
.redact.revealed { background: var(--violet); color: #fff; }

/* stats */
.ch-numbers .ch-inner { justify-content: center; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--faint); margin-top: 2vh; }
.stat { padding: 4vh 2vw 3vh 0; border-inline-end: 1px solid var(--faint); display: flex; flex-direction: column; gap: 1.6vh; }
.stat:last-child { border-inline-end: 0; }
.stat:nth-child(1) { --rd: .4s; } .stat:nth-child(2) { --rd: .52s; } .stat:nth-child(3) { --rd: .64s; } .stat:nth-child(4) { --rd: .76s; }
.stat b {
  font-family: var(--display); font-weight: 800; font-size: clamp(64px, 10vw, 180px); line-height: .85; letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.stat b.inf { background: var(--grad); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: flow 8s linear infinite; }
.stat span { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
:lang(ar) .stat span { font-family: "Alexandria", sans-serif; letter-spacing: 0; font-size: 14px; }

/* marquee bands */
.bands { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: -1; --rd: .2s; }
.band { position: absolute; left: -10vw; right: -10vw; top: 50%; padding: 1.4vh 0; overflow: hidden; white-space: nowrap; }
.band-a { transform: rotate(-7deg) translateY(-40%); background: var(--ink); color: var(--bg); }
.band-b { transform: rotate(5deg) translateY(60%); background: var(--grad); color: #fff; opacity: .92; }
.band-track {
  display: inline-block; font-family: var(--display); font-weight: 800; font-size: clamp(22px, 3.4vw, 54px);
  letter-spacing: -.02em; text-transform: uppercase; will-change: transform;
}
.band-track span { padding: 0 .6em; }
.band-track i { font-style: normal; opacity: .5; }

/* works: lime-style labels + previews */
.w-preview { display: none; }
.work .w-name { pointer-events: none; }
.preview {
  position: fixed; left: 0; top: 0; z-index: 30; width: 360px; pointer-events: none;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--faint);
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 30px 80px -20px rgba(20, 10, 60, .35);
  clip-path: inset(50% 50% 50% 50% round 14px); opacity: 0;
  transition: clip-path .7s var(--ease), opacity .4s;
}
.preview.show { clip-path: inset(0 0 0 0 round 14px); opacity: 1; }
.pv-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--faint); }
.pv-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pv-bar i:first-child { background: #ff6b6b; } .pv-bar i:nth-child(2) { background: #ffc35c; } .pv-bar i:nth-child(3) { background: #4fd08a; }
.pv-bar span { margin-inline-start: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.pv-body { height: 210px; padding: 14px; }
.mini { width: 100%; height: 100%; display: flex; gap: 10px; }
.mini b, .mini s, .mini span { display: block; text-decoration: none; }
/* dentix */
.md-side { width: 34px; display: flex; flex-direction: column; gap: 8px; padding: 6px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.md-side i { height: 6px; border-radius: 3px; background: var(--faint); }
.md-side i:first-child { background: var(--cyan); }
.md-main { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.md-head { display: flex; justify-content: space-between; align-items: center; }
.md-head b { width: 40%; height: 8px; border-radius: 4px; background: var(--ink); opacity: .7; }
.md-head span { width: 22px; height: 22px; border-radius: 50%; background: var(--grad); }
.md-cal { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.md-cal i { border-radius: 4px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.md-cal i.on { background: var(--cyan); animation: blinkcell 2.4s ease-in-out infinite; animation-delay: var(--dl); }
.md-cal i.on2 { background: var(--violet); animation: blinkcell 3s ease-in-out infinite; animation-delay: var(--dl); }
@keyframes blinkcell { 50% { opacity: .35; transform: scale(.85); } }
/* matilda */
.mini-matilda { flex-direction: column; }
.mm-top { display: flex; justify-content: space-between; align-items: center; }
.mm-top b { width: 30%; height: 8px; border-radius: 4px; background: var(--ink); opacity: .7; }
.mm-cart { width: 22px; height: 22px; border-radius: 50%; background: var(--pink); color: #fff; font: 600 11px/22px var(--mono); text-align: center; animation: pop 2s var(--ease) infinite; }
@keyframes pop { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.3); } }
.mm-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mm-card { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 5%, transparent); }
.mm-img { flex: 1; border-radius: 6px; background: radial-gradient(circle at 35% 35%, var(--amber), var(--pink) 60%, var(--violet)); animation: float 3s ease-in-out infinite; }
.mm-card:nth-child(2) .mm-img { animation-delay: -1s; filter: hue-rotate(60deg); }
.mm-card:nth-child(3) .mm-img { animation-delay: -2s; filter: hue-rotate(160deg); }
@keyframes float { 50% { transform: translateY(-4px) scale(.96); } }
.mm-card b { height: 5px; width: 80%; border-radius: 3px; background: var(--ink); opacity: .6; }
.mm-card s { height: 5px; width: 40%; border-radius: 3px; background: var(--pink); }
/* najda */
.mn-radar { position: relative; flex: 1.3; border-radius: 50%; aspect-ratio: 1; max-height: 100%; align-self: center;
  background: repeating-radial-gradient(circle, transparent 0 18px, var(--faint) 18px 19px); border: 1px solid var(--faint); overflow: hidden; }
.mn-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, color-mix(in srgb, var(--red, #ff5c5c) 55%, transparent), transparent 25%); animation: spin 2.6s linear infinite; }
.mn-core { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #ff5c5c; box-shadow: 0 0 0 0 rgba(255,92,92,.6); animation: sos 1.4s infinite; }
@keyframes sos { to { box-shadow: 0 0 0 26px rgba(255,92,92,0); } }
.mn-dot { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); animation: blink .9s steps(1) infinite; }
.mn-dot.d1 { left: 28%; top: 30%; } .mn-dot.d2 { left: 70%; top: 40%; animation-delay: .3s; } .mn-dot.d3 { left: 40%; top: 72%; animation-delay: .6s; }
.mn-side { flex: 1; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.mn-side b { font: 700 18px var(--mono); color: #ff5c5c; letter-spacing: .1em; }
.mn-side span { height: 6px; border-radius: 3px; background: var(--faint); }
.mn-side span:nth-child(2) { width: 90%; } .mn-side span:nth-child(3) { width: 60%; } .mn-side span:nth-child(4) { width: 75%; }
.mn-side em { font: 500 10px var(--mono); letter-spacing: .14em; color: var(--mute); font-style: normal; }

/* terminal */
.term {
  position: fixed; left: var(--pad); bottom: calc(var(--pad) * 1.6); z-index: 80; width: min(520px, calc(100vw - var(--pad) * 2));
  border-radius: 14px; overflow: hidden; border: 1px solid var(--faint);
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 90px -20px rgba(10, 5, 40, .45);
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  transform: translateY(30px) scale(.97); opacity: 0; pointer-events: none; transition: .5s var(--ease);
}
[dir="rtl"] .term { left: auto; right: var(--pad); direction: ltr; }
.term.open { transform: none; opacity: 1; pointer-events: auto; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--faint); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff6b6b; }
.term-bar i:nth-child(2) { background: #ffc35c; } .term-bar i:nth-child(3) { background: #4fd08a; }
.term-bar span { margin-inline-start: 8px; color: var(--mute); font-size: 11px; letter-spacing: .1em; }
.term-bar button { margin-inline-start: auto; font-size: 18px; line-height: 1; color: var(--mute); }
.term-out { max-height: 260px; overflow-y: auto; padding: 14px 16px 4px; line-height: 1.7; white-space: pre-wrap; }
.term-out .c { color: var(--mute); }
.term-out .a { color: var(--violet); }
.term-line { display: flex; gap: 10px; align-items: center; padding: 8px 16px 14px; }
.term-line span { color: var(--violet); }
.term-line input { flex: 1; background: none; border: 0; outline: none; color: var(--ink); font: inherit; caret-color: var(--violet); cursor: none; }

/* click ripple */
.ripple {
  position: fixed; z-index: 150; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 1.5px solid var(--violet); pointer-events: none; animation: ripple .9s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(9); opacity: 0; } }

/* contact: staggered statement */
.ch-contact .big + .big { align-self: flex-end; text-align: end; margin-inline-end: 4vw; }

/* ---------- Phone & tablet ---------- */
@media (max-width: 760px) {
  :root { --pad: 18px; }
  .hud { padding: calc(14px + env(safe-area-inset-top)) var(--pad) 14px; }
  .hud-mid, .rail, .coords, #termBtn { display: none; }
  .hud-right { gap: 14px; }
  .key-btn { font-size: 11px; }
  .key-btn b, .logo-txt { display: none; }
  .pill { padding: 7px 12px; }

  .ch { height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; }
  .ch-inner {
    padding: 0 var(--pad) calc(13vh + env(safe-area-inset-bottom));
    justify-content: flex-end !important; align-items: flex-start !important; text-align: start !important;
  }
  .ch-right .tag, .ch-center .tag, .ch-tools .tag { flex-direction: row; }
  .ch-center .tag::after, .ch-tools .tag::after { display: none; }
  .ch-contact .big + .big { align-self: flex-start; text-align: start; margin: 0; }

  .hero-title { font-size: 19vw; white-space: normal; line-height: .86; }
  .hero-sub { font-size: 24px; }
  .scroll-hint { right: var(--pad); bottom: calc(13vh + env(safe-area-inset-bottom)); }
  .big { font-size: 11.5vw; max-width: none; }
  .giant { font-size: 21vw; }
  .sub { font-size: 21px; }
  .sign { width: 62vw; }

  .works { width: 100%; }
  .work { grid-template-columns: 34px 1fr auto; padding: 2vh 0; }
  .w-name { font-size: 12vw; }
  .w-tag { grid-column: 2 / 4; margin-top: 4px; font-size: 10px; }
  .work .w-preview { display: block; grid-column: 1 / -1; height: 0; overflow: hidden; transition: height .6s var(--ease), margin .6s var(--ease); }
  .work.open .w-preview { height: 150px; margin-top: 12px; }
  .work .w-preview .mini { padding: 10px; border: 1px solid var(--faint); border-radius: 12px; background: var(--glass); }
  .works.has-hover .work:not(:hover) { opacity: 1; }
  .preview { display: none; }

  .ch-tools .ch-inner { justify-content: space-between !important; padding-top: 16vh; }
  .ring span { padding: 7px 12px; font-size: 10px; }

  .stats { grid-template-columns: 1fr 1fr; width: 100%; }
  .stat { padding: 2.6vh 0 2.2vh; border-inline-end: 0; border-bottom: 1px solid var(--faint); }
  .stat:nth-child(odd) { border-inline-end: 1px solid var(--faint); padding-inline-end: 4vw; }
  .stat:nth-child(even) { padding-inline-start: 4vw; }
  .stat b { font-size: 17vw; }

  .links { flex-direction: column; align-items: stretch; width: 100%; gap: 10px; }
  .link { justify-content: space-between; padding: 16px 22px; }
  .ghost { font-size: 52vw; bottom: auto; top: 10vh; }
  .chapter-meta { bottom: calc(18px + env(safe-area-inset-bottom)); }
  .term { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(12vh + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) {
  html { scroll-snap-type: y proximity; scroll-behavior: smooth; }
  body.is-booting { scroll-snap-type: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .band-track { animation: none; }
  .split .wi, .rv { transition-duration: .01s !important; transition-delay: 0s !important; filter: none !important; }
}


/* Mobile refinement: preserve the original chapter design and every feature. */
@media (max-width: 760px) {
  .ch-inner {
    height: 100svh;
    bottom: auto;
    padding-bottom: calc(clamp(64px, 11svh, 100px) + env(safe-area-inset-bottom));
  }
  .ch-hero .ch-inner { padding-bottom: calc(clamp(64px, 11svh, 100px) + env(safe-area-inset-bottom)); }
  .scroll-hint { bottom: calc(clamp(64px, 11svh, 100px) + env(safe-area-inset-bottom)); }
  .split .w { white-space: nowrap; }
  [data-name-en="CURIOSITY"] .giant { font-size: 15.5vw; white-space: nowrap; }
  .hud { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
  .hud-right { gap: clamp(8px, 3vw, 14px); }
  .hud .logo, .hud .key-btn, .hud .pill { min-height: 44px; }
  .hud .logo { min-width: 36px; }
  .key-btn { font-size: clamp(9px, 2.7vw, 11px); }
  .key-btn, .pill, .work, .link { touch-action: manipulation; }
  .ch-work .ch-inner { overflow-y: auto; justify-content: flex-start !important; padding-top: calc(86px + env(safe-area-inset-top)); -webkit-overflow-scrolling: touch; }
  .ch-work .tag { margin-top: auto; flex-shrink: 0; }
  .works { flex-shrink: 0; }
  .work::before { pointer-events: none; }
  .work { min-height: 68px; }
  .ch-contact .ch-inner { overflow-y: auto; justify-content: flex-start !important; padding-top: calc(86px + env(safe-area-inset-top)); }
  .ch-contact .tag { margin-top: auto; }
  .ch-contact .ch-inner > * { flex-shrink: 0; }
  .ch-tools .ch-inner { padding-top: calc(90px + env(safe-area-inset-top)); }
  .chapter-meta { max-width: calc(100% - 36px); font-size: 10px; }
  :lang(ar) .sub { font-size: clamp(17px, 4.7vw, 21px); line-height: 1.65; }
  :lang(ar) .eyebrow { letter-spacing: 0; line-height: 1.8; }
}
@media (max-width: 760px) and (max-height: 600px) {
  .ch-inner { padding-bottom: calc(54px + env(safe-area-inset-bottom)); }
  .big { font-size: min(10vw, 7.8svh); }
  .hero-title { font-size: min(19vw, 15svh); }
  .hero-sub, .sub { font-size: 20px; }
  .sign { width: 42vw; max-height: 65px; }
  .stat { padding-block: 12px; }
  .stat b { font-size: min(17vw, 13svh); }
  .stat span { font-size: 10px; }
  .ch-contact .links { margin-top: 18px; }
  .ch-contact .link { padding-block: 12px; }
  .ch-contact .foot { margin-top: 14px; }
}

/* Smooth scrolling and mobile rendering, without changing the chapter design. */
.ch-inner { transition: visibility 0s linear .35s; }
.ch.is-active .ch-inner { transition-delay: 0s; }
.split .w { padding-bottom: .2em; margin-bottom: -.2em; }
@media (pointer: coarse) {
  html { scroll-snap-type: none; }
  .ch { scroll-snap-stop: normal; }
}
@media (max-width: 760px) {
  .ch-inner > * { flex-shrink: 0; }
  .ch-inner { transform: none; }
  .eyebrow { max-width: 100%; font-size: clamp(9px, 2.35vw, 11px); letter-spacing: .12em; line-height: 1.8; overflow-wrap: normal; }
  .hero-title { font-size: 19vw; }
  .big { max-width: 100%; line-height: 1.1; }
  .serif, .hero-sub, .sub { line-height: 1.25; }
  .split .w { padding-top: .12em; padding-bottom: .22em; margin-bottom: -.22em; }
  .split .wi { transition-duration: .55s; transition-delay: calc(var(--i) * 18ms + .08s); }
  .big + .big { --d: .2s; }
  .rv { --rd: .15s; }
  .ch.is-active .sign text { animation-duration: 1.2s; animation-delay: .15s; }
  .grain { inset: 0; animation: none; }
  .ring span { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .ch-work .ch-inner, .ch-contact .ch-inner { scrollbar-width: thin; }
}
@media (prefers-reduced-motion: reduce) {
  .ripple { animation-duration: .01s; }
}

@media (max-width: 760px) and (max-height: 600px) {
  .hero-title { font-size: min(19vw, 15svh); }
}

/* Restore the original name typography and avoid full-screen repaint work. */
.hero-title .w { padding: .06em 0 .1em; margin-bottom: -.1em; }
.grain { inset: 0; animation: none; }
.ch:not(.is-active) .split .wi { will-change: auto; }
@media (min-width: 761px) {
  .hero-title { font-size: clamp(56px, 13vw, 250px); line-height: .84; letter-spacing: -.055em; }
}

/* Keep the signature tied to its own chapter, including Safari back-scroll. */
@media (max-width: 760px), (pointer: coarse) {
  .ch:not(.is-active) .ch-inner { visibility: hidden; transition: none; }
  .ch .sign { visibility: hidden; opacity: 0; }
  .ch .sign text { animation: none !important; stroke-dashoffset: 900; fill: transparent; }
  .ch.is-active.signature-ready .sign { visibility: visible; opacity: 1; }
  .ch.is-active.signature-ready .sign text { animation: sign 1.2s cubic-bezier(.65,0,.35,1) .6s forwards !important; }
}
@media (prefers-reduced-motion: reduce) {
  .ch.is-active.signature-ready .sign text { animation: none !important; stroke-dashoffset: 0; fill: var(--violet); }
}

/* A stable mobile chapter height prevents browser-toolbar jumps. */
@media (max-width: 760px), (pointer: coarse) {
  .ch { height: var(--mobile-chapter-height, 100svh); }
  .ch-inner { height: var(--mobile-chapter-height, 100svh); }
  .ch.is-active.signature-ready .sign text { animation-delay: 0s !important; }
}

/* Preserve native scroll position; the active fixed chapter is not an anchor target. */
html, body, #story, .ch, .ch-inner { overflow-anchor: none; }
html, body { scroll-snap-type: none !important; }
.ch { scroll-snap-align: none; scroll-snap-stop: normal; }
@media (max-width: 760px), (pointer: coarse) {
  html { scroll-behavior: auto; }
  #gl { image-rendering: auto; }
}

/* Keep both contact headline lines together on desktop. */
@media (min-width: 761px) {
  .ch-contact .big + .big {
    align-self: flex-start;
    text-align: start;
    margin-inline-end: 0;
    max-width: 100%;
  }
}

.ch .sign { visibility: hidden; opacity: 0; }
.ch .sign text { animation: none !important; }
.ch.is-active.signature-ready .sign { visibility: visible; opacity: 1; }
.ch.is-active.signature-ready .sign text {
  animation: sign 1.2s cubic-bezier(.65,0,.35,1) forwards !important;
}
@media (prefers-reduced-motion: reduce) {
  .ch.is-active.signature-ready .sign text { animation: none !important; stroke-dashoffset: 0; fill: var(--violet); }
}

/* Keep the original chapter animation and transparent controls. */
.project-dialog {
  position: fixed; margin: auto; width: min(620px, calc(100% - 32px));
  max-height: 85svh; overflow-y: auto; padding: clamp(22px, 5vw, 40px);
  background: var(--bg); color: var(--ink); border: 1px solid var(--faint);
  border-radius: 16px; font-family: var(--display); cursor: auto;
}
.project-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.project-dialog h2 { margin-block: 16px; font-size: 32px; }
.project-dialog h3 { margin-block: 20px 8px; font-size: 18px; }
.project-dialog p { font-size: 16px; line-height: 1.8; }
.project-dialog > a { display: inline-block; margin-top: 24px; }
.project-dialog button, .project-dialog a { cursor: pointer; }
button.w-name { text-align: start; }
.cm-num, .count, .ghost span, #clock, #year, .w-idx, .w-name {
  direction: ltr;
  unicode-bidi: isolate;
}
:lang(ar) .eyebrow, :lang(ar) .tag { letter-spacing: 0; line-height: 1.7; }
:lang(ar) .split .w { padding-block: .12em .2em; }
:lang(ar) .foot { line-height: 1.8; }
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  .ch-inner { top: 0; bottom: auto; padding-top: calc(86px + env(safe-area-inset-top)); }
  .hero-title { font-size: min(17vw, 130px); max-width: 100%; white-space: nowrap; }
  .hero-title .wi { font-variation-settings: "wght" 800, "wdth" 100 !important; }
  .ch-inner {
    height: min(var(--mobile-chapter-height, 100svh), var(--mobile-visible-height, 100svh));
    overflow-y: auto;
    justify-content: safe flex-end !important;
  }
}
