:root {
  --ink: #f6efe3;
  --dim: rgba(246, 239, 227, .66);
  --faint: rgba(246, 239, 227, .26);
  --gold: #e6bd78;
  --gold-hi: #ffe3b0;
  --bg: #07080a;
  --ease: cubic-bezier(.16, .84, .24, 1);
  --ease-io: cubic-bezier(.72, 0, .18, 1);

  /* one spacing scale for everything */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* page gutters, widened by the notch / home indicator where there is one */
  --pad: clamp(18px, 3.4vw, 44px);
  --gl: max(var(--pad), env(safe-area-inset-left, 0px));
  --gr: max(var(--pad), env(safe-area-inset-right, 0px));
  --gt: env(safe-area-inset-top, 0px);
  --gb: env(safe-area-inset-bottom, 0px);

  --ar: "Aref Ruqaa", "Geeza Pro", "Noto Naskh Arabic", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-kerning: normal;
  font-optical-sizing: auto;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.loading { overflow: hidden; }

::selection { background: rgba(230, 189, 120, .92); color: var(--bg); text-shadow: none; }

:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 5px; border-radius: 4px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mono {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.ar {
  font-family: var(--ar);
  font-weight: 700;
  letter-spacing: 0;
  direction: rtl;
  line-height: 1.35;
}

#gl, #fallback {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100lvh;
  display: block;
  z-index: 0;
}
#fallback { object-fit: cover; display: none; }
body.nogl #gl { display: none; }
body.nogl #fallback { display: block; }

/* scroll: one snap point per scene */
#track { position: relative; z-index: -1; }
#track > div { height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; }

/* soft darkening where the words sit */
.fx-shade {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgba(4, 5, 7, .72) 0%, rgba(4, 5, 7, .28) 34%, rgba(4, 5, 7, 0) 58%),
    linear-gradient(180deg, rgba(4, 5, 7, .45) 0%, rgba(4, 5, 7, 0) 18%);
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--pad) + var(--gt)) var(--gr) 0 var(--gl);
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .34em;
  border-radius: 2px;
}
/* pull ".AI" back in: the E carries .34em of trailing tracking */
.brand span { color: var(--gold); letter-spacing: .1em; margin-left: -.26em; }

#sound {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: rgba(7, 8, 10, .25);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--faint);
  color: var(--dim);
  padding: 9px 14px 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: 500 11px/1 var(--mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: border-color .3s, color .3s, background-color .3s;
}
/* three tiny level bars: flat when off, alive when on */
#sound::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: none;
  background:
    linear-gradient(currentColor, currentColor) 0 100% / 1.5px 45% no-repeat,
    linear-gradient(currentColor, currentColor) 50% 100% / 1.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 1.5px 65% no-repeat;
  opacity: .8;
}
#sound[aria-pressed="true"]::before { color: var(--gold); opacity: 1; animation: eq 1.1s ease-in-out infinite alternate; }
@keyframes eq {
  0%   { background-size: 1.5px 40%, 1.5px 100%, 1.5px 60%; }
  50%  { background-size: 1.5px 90%, 1.5px 45%, 1.5px 100%; }
  100% { background-size: 1.5px 55%, 1.5px 75%, 1.5px 35%; }
}
#sound b { color: var(--ink); font-weight: 500; }
#sound[aria-pressed="true"] b { color: var(--gold); }
#sound:focus-visible { outline-offset: 3px; border-radius: 999px; }
@media (hover: hover) {
  #sound:hover { border-color: rgba(230, 189, 120, .6); color: var(--ink); background-color: rgba(7, 8, 10, .4); }
  .brand:hover span { color: var(--gold-hi); }
}

.prog {
  position: fixed;
  z-index: 10;
  left: var(--gl);
  right: var(--gr);
  bottom: calc(var(--pad) * .8 + var(--gb));
  display: flex;
  align-items: center;
  gap: var(--s4);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.prog .bar { flex: 1; height: 1px; background: var(--faint); position: relative; }
.prog .bar > i { position: absolute; inset: 0; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }

/* scene marks on the rail; built by ui.js */
.tk {
  position: absolute;
  top: 50%;
  width: max(14px, calc(100% / var(--n, 16)));
  height: 32px;
  translate: -50% -50%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 999px;
}
.tk::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: rgba(246, 239, 227, .42);
  transition: transform .4s var(--ease), background-color .4s;
}
.tk.past::before { background: var(--ink); }
.tk.now::before { background: var(--gold); transform: scale(1.9); box-shadow: 0 0 0 1.5px rgba(7, 8, 10, .5); }
.tk:focus-visible { outline-offset: -6px; }
@media (hover: hover) { .tk:hover::before { transform: scale(2.2); background: var(--gold-hi); } }

.tip {
  position: absolute;
  left: 0;
  bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(246, 239, 227, .18);
  background: rgba(7, 8, 10, .55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font: 600 13px/1 "Inter Tight", system-ui, sans-serif;
  letter-spacing: -.005em;
  pointer-events: none;
  opacity: 0;
  translate: var(--tx, 0) 4px;
  transition: opacity .25s, translate .35s var(--ease);
}
.tip b { color: var(--gold); font-weight: 500; font-size: 10px; letter-spacing: .16em; }
.tip.show { opacity: 1; translate: var(--tx, 0) 0; }

/* the rail sits back while you watch; touching it (or hovering on desktop) brings it forward */
.prog .bar, .prog #count { transition: opacity .35s ease; }
.prog .bar { opacity: .28; }
.prog #count { opacity: .45; }
.prog.scrub-on .bar, .prog.scrub-on #count { opacity: 1; }
@media (hover: hover) { .prog:hover .bar, .prog:hover #count { opacity: 1; } }
.prog .bar:focus-within, .prog .bar:has(.tip.show) { opacity: 1; }
/* no browser scrollbar over the film */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* scrubber: a finger-sized strip over the rail; the rail thickens while you slide */
.scrub { position: absolute; left: -12px; right: -12px; top: 50%; height: 44px; translate: 0 -50%; z-index: 2;
  touch-action: none; cursor: pointer; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.prog .bar { transition: height .18s var(--ease), background-color .18s, opacity .35s ease; }
.prog.scrub-on .bar { height: 3px; background: rgba(246, 239, 227, .26); }
.prog.scrub-on .tk::before { background: rgba(246, 239, 227, .7); }
.tk.aim::before { transform: scale(2.6); background: var(--gold-hi); }
.prog.scrub-on .tip { transition: opacity .15s, translate .15s var(--ease); }
#gl, #fallback { transition: opacity .2s ease; }
body.jumping #gl, body.jumping #fallback, body.jumping #story { opacity: 0; }
#story { transition: opacity .2s ease; }

/* ---------- scenes ---------- */

#story { position: relative; z-index: 5; }

.sc {
  position: fixed;
  left: var(--gl);
  right: var(--gr);
  bottom: calc(clamp(64px, 11vh, 120px) + var(--gb));
  max-width: 1100px;
  pointer-events: none;
}
/* scenes that are neither showing nor leaving are hidden outright, so no clipped glyph
   tops peek out of their masks */
.sc:not(.on):not(.off):not(.pre) { visibility: hidden; }

.sc .yr {
  font-weight: 200;
  font-size: clamp(64px, 13vw, 210px);
  line-height: .84;
  letter-spacing: -.04em;
  margin: 0 0 .12em -.045em;
  color: rgba(246, 239, 227, .94);
  font-variant-numeric: lining-nums;
}
.sc .yr.long { font-size: clamp(46px, 7.4vw, 124px); letter-spacing: -.035em; }
.sc .yr.word { font-size: clamp(48px, 9vw, 150px); letter-spacing: -.035em; }
/* titles are gold, everything that follows is white */
.sc h2 {
  font-weight: 700;
  font-size: clamp(30px, 4.4vw, 66px);
  line-height: 1.02;
  letter-spacing: -.018em;
  word-spacing: .06em;
  margin: 0 0 .42em;
  color: var(--gold);
  text-wrap: balance;
  text-shadow: 0 1px 24px rgba(0, 0, 0, .35);
}
.sc .ln {
  font-weight: 500;
  font-size: clamp(17px, 1.6vw, 23px);
  line-height: 1.42;
  letter-spacing: .002em;
  margin: 0;
  max-width: 36ch;
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 1px 18px rgba(0, 0, 0, .45);
}
.sc .nt { margin: var(--s4) 0 0; color: rgba(255, 255, 255, .72); text-wrap: balance; }
.nb { white-space: nowrap; }

/* masked reveal */
.m { display: block; overflow: hidden; padding-bottom: .06em; }
.m > span {
  display: inline-block;
  transform: translate3d(0, 105%, 0);
  transition: none;
}
.sc.on .m > span { transform: none; transition: transform 1s var(--ease) var(--d, 0s); }
.sc.off .m > span { transform: translate3d(0, -105%, 0); transition: transform .4s var(--ease); }
/* Ruqaa has deep descenders; give them room inside the mask */
.m.ar { padding: .08em 0 .22em; }

/* ---------- intro ---------- */

.sc.intro {
  inset: 0;
  max-width: none;
  padding: var(--gt) var(--gr) 0 var(--gl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.sc.intro .ar {
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.2;
  color: var(--gold);
  margin: 0 0 var(--s1);
  text-shadow: 0 1px 24px rgba(7, 8, 10, .35);
}
.sc.intro h1 {
  font-weight: 900;
  font-size: clamp(46px, 13.4vw, 228px);
  letter-spacing: .16em;
  line-height: .9;
  margin: 0 0 0 .16em; /* re-centre: the last letter carries trailing tracking */
}
.sc.intro .ln { margin: 0 auto; max-width: none; }

/* the Arabic: blur to sharp. It can show while the page loads (.pre), then stays. */
.sc.intro .ar > span { transform: scale(1.03); opacity: 0; filter: blur(12px); }
.sc.intro.pre.ar-in .ar > span,
.sc.intro.on .ar > span {
  transform: none;
  opacity: 1;
  filter: blur(0);
  transition: opacity 1.3s var(--ease), filter 1.5s var(--ease), transform 1.8s var(--ease);
}
.sc.intro.off .ar > span { opacity: 0; filter: blur(6px); transform: none; transition: opacity .4s, filter .4s; }

/* the title, letter by letter: wide tracking that settles (ui.js splits the letters) */
.sc.intro h1.split { overflow: visible; }
.sc.intro h1.split > span { transform: none; transition: none; }
.ltrs { position: relative; display: inline-block; font-kerning: none; }
.l {
  display: inline-block;
  opacity: 0;
  filter: blur(14px);
  transform: translate3d(calc(var(--o, 0) * .2em), 0, 0);
}
.sc.intro.on .l {
  opacity: 1;
  filter: blur(0);
  transform: none;
  transition:
    opacity .9s var(--ease) calc(.3s + var(--i, 0) * .06s),
    filter 1.2s var(--ease) calc(.3s + var(--i, 0) * .06s),
    transform 2s var(--ease) calc(.3s + var(--i, 0) * .03s);
}
.sc.intro.off .l { opacity: 0; filter: blur(8px); transform: translate3d(0, -.08em, 0); transition: opacity .35s, filter .35s, transform .4s var(--ease); }

/* one pass of light across the title, on first arrival only */
.ltrs::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  white-space: nowrap;
  pointer-events: none;
  color: transparent;
  background: linear-gradient(100deg, rgba(232, 182, 104, 0) 44.5%, rgba(236, 192, 122, .8) 48.5%, rgba(255, 232, 190, .95) 50%, rgba(236, 192, 122, .8) 51.5%, rgba(232, 182, 104, 0) 55.5%) 120% 0 / 250% 100% no-repeat;
  filter: drop-shadow(0 0 12px rgba(255, 196, 110, .4));
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
}
html.first .sc.intro.on .ltrs::after { animation: sweep 1.25s cubic-bezier(.4, 0, .5, 1) 1.2s both; }
@keyframes sweep {
  0% { background-position: 120% 0; opacity: 1; }
  100% { background-position: -20% 0; opacity: 1; }
}

/* the horizon: the loading line, then it draws out across the frame */
.hz {
  position: relative;
  width: min(78vw, 940px);
  height: 1px;
  margin: clamp(18px, 3.4vh, 36px) 0 clamp(16px, 3vh, 30px);
}
.hz i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(230, 189, 120, 0), var(--gold) 24%, var(--gold-hi) 50%, var(--gold) 76%, rgba(230, 189, 120, 0));
  transform: scaleX(0);
  transform-origin: 50% 50%;
}
.hz i::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: -4px;
  height: 9px;
  background: radial-gradient(closest-side, rgba(255, 214, 150, .5), rgba(255, 214, 150, 0));
}
.sc.intro.pre .hz i { transform: scaleX(calc(.04 + var(--p, 0) * .14)); transition: transform .6s var(--ease); }
.sc.intro.on .hz i { transform: scaleX(1); opacity: .9; transition: transform 1.7s var(--ease-io) .05s, opacity 1.7s; }
.sc.intro.off .hz i { transform: scaleX(.2); opacity: 0; transition: transform .45s var(--ease), opacity .35s; }

/* the line under it rises a beat later than in other scenes */
.sc.intro.on .ln > span { transition-delay: .95s; }

/* scroll cue: a falling grain of light */
.sc.intro .hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--pad) * .8 + var(--gb) + clamp(40px, 7vh, 72px));
  translate: -50% 0;
  margin: 0;
  padding-left: .32em; /* balance the trailing tracking */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  color: var(--dim);
  letter-spacing: .32em;
  font-size: 10px;
  opacity: 0;
  transition: opacity .3s;
}
.sc.intro .hint i { position: relative; order: 2; width: 1px; height: 40px; overflow: hidden; background: rgba(246, 239, 227, .16); margin-left: -.32em; }
.sc.intro .hint i::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 16px;
  background: linear-gradient(rgba(230, 189, 120, 0), var(--gold-hi));
  animation: fall 2.4s var(--ease-io) infinite;
}
.sc.intro.on .hint { opacity: 1; transition: opacity 1.2s 1.9s; }
@keyframes fall {
  0% { transform: translateY(-16px); }
  65%, 100% { transform: translateY(40px); }
}

/* final */
.sc.final .sig { margin-top: var(--s5); }
.sc.final .sig .ar { font-size: clamp(26px, 2.6vw, 36px); color: var(--gold); margin: 0 0 var(--s1); text-align: left; }
.sc.final .credit { margin-top: var(--s4); color: rgba(246, 239, 227, .5); letter-spacing: .14em; font-size: 9.5px; text-shadow: 0 1px 10px rgba(7, 8, 10, .9); }

/* ---------- loader ---------- */
/* A black curtain under the words. On the intro, the family name and the loading line
   are drawn by the intro itself; when ready the curtain parts at the horizon line. */

#loader {
  --feather: 24vh;
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s5);
}
#loader::before, #loader::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: -1;
  transition: transform 1.9s cubic-bezier(.5, 0, .16, 1), opacity 1s ease .8s;
}
#loader::before {
  top: 0;
  height: calc(var(--hz, 50%) + var(--feather));
  background: linear-gradient(180deg, var(--bg) calc(100% - var(--feather)), rgba(7, 8, 10, 0));
}
#loader::after {
  bottom: 0;
  height: calc(100% - var(--hz, 50%) + var(--feather));
  background: linear-gradient(0deg, var(--bg) calc(100% - var(--feather)), rgba(7, 8, 10, 0));
}
#loader.done { pointer-events: none; }
#loader.done::before { transform: translate3d(0, -100%, 0); opacity: 0; }
#loader.done::after { transform: translate3d(0, 100%, 0); opacity: 0; }
#loader > * { transition: opacity .6s; }
#loader.done > * { opacity: 0; }
#loader .ar { color: var(--gold); font-size: 30px; margin: 0; }
html.intro-boot #loader > * { display: none; }
.ld-bar { width: 120px; height: 1px; background: var(--faint); position: relative; overflow: hidden; }
.ld-bar i { position: absolute; inset: 0; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); transition: transform .4s; }

/* the HUD waits for the title */
.hud, .prog { transition: opacity 1.2s var(--ease) 1.5s; }
body.loading .hud, body.loading .prog { opacity: 0; pointer-events: none; transition: none; }

/* a slow dolly back as the curtain parts */
html.go #gl, html.go #fallback { animation: dolly 3s var(--ease) both; }
@keyframes dolly { from { scale: 1.08; } }

.noscript { position: fixed; inset: auto 0 45% 0; text-align: center; z-index: 60; font-weight: 700; }

@media (max-width: 760px) {
  .sc { bottom: calc(70px + var(--gb)); }
  .sc .nt { font-size: 10px; letter-spacing: .14em; }
  .fx-shade {
    background:
      linear-gradient(0deg, rgba(4, 5, 7, .8) 0%, rgba(4, 5, 7, .35) 42%, rgba(4, 5, 7, 0) 66%),
      linear-gradient(180deg, rgba(4, 5, 7, .45) 0%, rgba(4, 5, 7, 0) 16%);
  }
  .sc.intro h1 { font-size: min(15vw, 72px); letter-spacing: .13em; margin-left: .13em; }
  .tk::before { width: 2px; height: 2px; margin: -1px 0 0 -1px; }
}

/* desktop only: the frame and the words drift a few pixels against the cursor */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  #gl, #fallback { scale: 1.025; translate: calc(var(--mx, 0) * -12px) calc(var(--my, 0) * -7px); }
  .sc { translate: calc(var(--mx, 0) * 6px) calc(var(--my, 0) * 4px); }
}

/* reduced motion: nothing slides, scales or blurs; words simply fade */
@media (prefers-reduced-motion: reduce) {
  .m > span, .sc.on .m > span, .sc.off .m > span { transform: none; opacity: 0; }
  .sc.on .m > span { opacity: 1; transition: opacity .6s ease; transition-delay: 0s; }
  .sc.off .m > span { transition: opacity .25s ease; }
  .sc.intro .ar > span, .sc.intro .l { filter: none; transform: none; }
  .sc.intro.pre.ar-in .ar > span, .sc.intro.on .ar > span { transition: opacity .8s ease; }
  .sc.intro.on .l { transition: opacity .8s ease .1s; }
  .sc.intro.on .ln > span { transition-delay: .3s; }
  .sc.intro.on .hint { transition-delay: .6s; }
  .ltrs::after { display: none; }
  .hz i, .sc.intro.on .hz i { transition: opacity .8s ease; }
  .sc.intro .hint i::after { animation: none; transform: translateY(12px); }
  #sound[aria-pressed="true"]::before { animation: none; background-size: 1.5px 55%, 1.5px 100%, 1.5px 70%; }
  #loader::before, #loader::after { transition: opacity .9s ease; }
  #loader.done::before, #loader.done::after { transform: none; }
  html.go #gl, html.go #fallback { animation: none; }
  .hud, .prog { transition-delay: .4s; }
  .tip { transition: opacity .2s; }
}

/* the sources link on the final scene */
.sc .src a { pointer-events: auto; color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(230, 189, 120, .4); padding-bottom: 2px; }
.sc .src a:hover { color: var(--gold-hi); border-color: var(--gold-hi); }

/* the family album: real photographs, laid out like prints above the words */
.album {
  position: absolute;
  left: 0;
  width: calc(100vw - 2 * var(--pad));
  bottom: calc(100% + 4vh);
  height: min(54vh, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 36px);
  pointer-events: none;
}
.album figure {
  margin: 0;
  height: 100%;
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translate3d(0, 24px, 0) rotate(calc((var(--k) - 1.5) * 1.6deg)) scale(.97);
  transition: opacity .9s var(--ease), transform 1.1s var(--ease);
  transition-delay: calc(.25s + var(--k) * .14s);
}
.sc.on .album figure { opacity: 1; transform: translate3d(0, 0, 0) rotate(calc((var(--k) - 1.5) * 1.6deg)); }
.sc.off .album figure { opacity: 0; transition-duration: .35s; transition-delay: 0s; }
.album img {
  display: block;
  height: auto;
  width: auto;
  max-height: 100%;
  max-width: 100%;
  border: clamp(5px, .6vw, 10px) solid #f4efe6;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  background: #f4efe6;
}
@media (max-width: 760px) {
  .album {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 14px;
    height: min(47vh, 520px);
    bottom: calc(100% + 5vh);
  }
  .album figure { width: 100%; height: 100%; min-height: 0; justify-content: center; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .album figure { transition-duration: .01s; transition-delay: 0s; }
}

/* Family: his children, two columns above the title */
.family { position: absolute; left: 0; bottom: calc(100% + 4vh); display: flex; gap: clamp(36px, 6vw, 96px); pointer-events: none; }
.family .mono { margin: 0 0 1.1em; font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); opacity: 0; transition: opacity .8s var(--ease) .2s; }
.family ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .32em; }
.family li { font-size: clamp(22px, 2.6vw, 38px); font-weight: 600; letter-spacing: -.01em; line-height: 1.1; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.55);
  opacity: 0; transform: translate3d(0, 14px, 0); transition: opacity .8s var(--ease), transform 1s var(--ease); transition-delay: calc(.3s + var(--k) * .07s); }
.sc.on .family .mono { opacity: 1; }
.sc.on .family li { opacity: 1; transform: none; }
.sc.off .family li, .sc.off .family .mono { opacity: 0; transition-duration: .35s; transition-delay: 0s; }
@media (max-width: 760px) {
  .family { gap: 44px; bottom: calc(100% + 5vh); }
  .family li { font-size: clamp(20px, 5.6vw, 26px); }
}
@media (prefers-reduced-motion: reduce) { .family li { transition-duration: .01s; transition-delay: 0s; } }

/* Opening title: "The Marafie Family" is longer than the old wordmark */
.sc.intro h1 { font-size: clamp(24px, 6.4vw, 124px); letter-spacing: .12em; margin-left: .12em; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 760px) { .sc.intro h1 { font-size: 6.2vw; letter-spacing: .06em; margin-left: .06em; } }

/* The string: pearls on a gold thread carrying the family name (cards 02–06, tribute, final) */
.sc .thread { margin: 0 0 var(--s2); padding: .12em 0 .3em; font-size: clamp(19px, 1.8vw, 27px); line-height: 1.2; }
.thread > span { display: inline-flex; align-items: center; gap: .5em; }
.beads { display: inline-flex; align-items: center; height: 1em; }
.beads i { position: relative; width: clamp(14px, 1.2vw, 20px); height: 10px; }
.beads i::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(230, 189, 120, .6); transform-origin: 0 50%; }
.beads i:first-child::before { background: linear-gradient(90deg, rgba(230, 189, 120, 0), rgba(230, 189, 120, .6)); }
.beads i::after { content: ""; position: absolute; right: -2.5px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #e9dcc4 55%, #b49f80); box-shadow: 0 0 6px rgba(255, 236, 200, .35); }
.beads i.him::after { right: -4.5px; width: 9px; height: 9px; margin-top: -4.5px;
  background: radial-gradient(circle at 35% 30%, var(--gold-hi), var(--gold) 60%, #a37a40);
  box-shadow: 0 0 0 3px rgba(230, 189, 120, .16), 0 0 16px rgba(255, 214, 150, .55); }
.nm { display: inline-flex; gap: .3em; margin-left: .2em; font-family: var(--ar); font-weight: 700; color: var(--gold); white-space: nowrap; text-shadow: 0 1px 18px rgba(7, 8, 10, .5); }
.nm .pre { display: inline-grid; }
.nm .pre > * { grid-area: 1 / 1; }
.nm .was { justify-self: end; }
.thread.heir .was { opacity: 0; }
.thread .tr { display: none; }
.thread.trail .tr { display: block; flex: 0 1 clamp(28px, 10vw, 180px); height: 1px; margin-left: .3em; transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(230, 189, 120, .6), rgba(230, 189, 120, 0)); }
.sc.final .thread { font-size: clamp(24px, 2.6vw, 36px); margin: 0 0 var(--s1); }
.sc.final .thread.trail .tr { flex-basis: clamp(40px, 24vw, 320px); }

@media (prefers-reduced-motion: no-preference) {
  .sc:not(.on):not(.off) .beads i.new::before { transform: scaleX(0); }
  .sc:not(.on):not(.off) .beads i.new::after { transform: scale(0); opacity: 0; }
  .sc:not(.on):not(.off) .thread.trail .tr { transform: scaleX(0); }
  .sc:not(.on):not(.off) .thread.heir .was { opacity: 1; }
  .sc:not(.on):not(.off) .thread.heir:not(.still) .is { clip-path: inset(-.5em 0 -.5em 100%); -webkit-clip-path: inset(-.5em 0 -.5em 100%); }
  .sc.on .beads i.new::before { transition: transform .7s var(--ease-io) .4s; }
  .sc.on .beads i.new::after { transition: transform .7s var(--ease) 1s, opacity .3s 1s; }
  .sc.on .thread.trail .tr { transition: transform 1.4s var(--ease) .9s; }
  .sc.on .thread.heir .was { transition: opacity .5s ease 1.25s; }
  .sc.on .thread.heir .is { clip-path: inset(-.5em 0 -.5em 0); -webkit-clip-path: inset(-.5em 0 -.5em 0); transition: clip-path 1.1s var(--ease-io) 1.45s, -webkit-clip-path 1.1s var(--ease-io) 1.45s; }
  .sc.on.handover .ln > span { transition-delay: 1.5s; }
  .sc.on.handover .nt > span { transition-delay: 1.7s; }
}
@media (prefers-reduced-motion: reduce) {
  .sc:not(.on):not(.off) .thread.heir:not(.still) .was { opacity: 1; }
  .sc:not(.on):not(.off) .thread.heir:not(.still) .is { opacity: 0; }
  .sc.on .thread.heir .was { transition: opacity .4s ease .7s; }
  .sc.on .thread.heir .is { transition: opacity .7s ease .9s; }
  .sc.intro.on .ded > span { transition-delay: .45s; }
}

/* Opening dedication: the light crosses the family name, then settles on his */
.sc.intro .ded { margin: clamp(14px, 2.6vh, 26px) 0 0; padding-left: .3em; font-size: clamp(10px, .8vw, 12px); letter-spacing: .3em;
  text-transform: uppercase; color: var(--dim); text-wrap: balance; text-shadow: 0 1px 14px rgba(7, 8, 10, .6); }
.sc.intro .ded b { font-weight: 500; color: var(--ink); white-space: nowrap; }
.sc.intro.on .ded b { color: var(--gold); transition: color 1.2s var(--ease) 2.45s; }
.sc.intro.on .hint { transition-delay: 2.6s; }
/* his name in Arabic, spelled as on diwanmarafie.com; no tracking, so the letters stay joined */
.sc.intro .arn { font-family: var(--ar); font-size: clamp(20px, 1.9vw, 28px); line-height: 1.3; letter-spacing: 0;
  text-transform: none; color: var(--gold); text-align: center; margin: clamp(4px, 1vh, 10px) 0 0; padding: .06em 0 .24em;
  text-shadow: 0 1px 14px rgba(7, 8, 10, .6); }
@media (prefers-reduced-motion: reduce) { .sc.intro.on .arn > span { transition-delay: .55s; } }
@media (max-width: 760px) { .sc.intro .ded { font-size: 10px; letter-spacing: .14em; } }
@media (max-height: 500px) { .sc.intro .hint { display: none; } }

/* Rail: the family's marks are pearls, his is a gold ring */
.tk.kin::before { background: rgba(230, 189, 120, .75); }
.tk.him::before { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: rgba(7, 8, 10, .6); box-shadow: inset 0 0 0 1px var(--gold); }
.tk.him:is(.past, .now)::before { background: var(--gold); }
.tk.him.now::before { transform: scale(1.5); }
