/* ------------------------------------------------------------------------------
   Landing v2 — the pinned hero film («الشروق إلى الذاكرة»).

   One picture of the shrine — the daylight one by day, the lit one in the dark theme —
   starts as the panel the first screen has always had and, as the page is scrolled,
   widens until it is the whole screen. There is no second picture to dissolve into, so
   no seam: the photographs of the archive then rise around it, and the search comes
   back. The first screen is only the picture and the title; the search, the
   suggestions and the buttons arrive at the end. Without scripting (or with reduced
   motion) this is the plain first screen with everything on it.
   landing-v2.js writes every moving value inline.
   -------------------------------------------------------------------------- */
.film{
  --hero-ink:#3a2c0d;--hero-lede:#6a5426;--hero-line:rgba(142,105,26,.28);
  --hero-chip:rgba(255,253,245,.62);--hero-chip-line:rgba(142,105,26,.34);--hero-frame:#8e691a;
  --hero-shadow:0 22px 55px rgba(120,88,20,.28);
  --hero-shadow-hover:0 28px 65px rgba(120,88,20,.34), 0 0 45px rgba(255,236,178,.9);
  /* the closing act and the veils: cream on the day page, night on the dark one */
  --film-ground:#fdf5e0;--film-veil:253,245,224;--film-vb:.88;
  --film-text:#3a2c0d;--film-num:#7a5410;--film-sub:#6a5426;
  --film-text-shadow:0 1px 18px rgba(253,245,224,.9);
  --film-h:calc(100svh - var(--header-h));
  position:relative;color:var(--hero-ink);background:var(--film-ground);
}
[data-theme="dark"] .film{
  --hero-ink:#fff8e6;--hero-lede:#d8cdb6;--hero-line:rgba(230,196,119,.22);
  --hero-chip:rgba(230,196,119,.13);--hero-chip-line:rgba(230,196,119,.34);--hero-frame:rgba(230,196,119,.5);
  --hero-shadow:0 22px 55px rgba(0,0,0,.55), 0 0 35px rgba(230,196,119,.2);
  --hero-shadow-hover:0 28px 65px rgba(0,0,0,.65), 0 0 45px rgba(230,196,119,.3);
  --film-ground:#070b13;--film-veil:3,5,10;--film-vb:.5;
  --film-text:#fff8e6;--film-num:#f3d98e;--film-sub:#e8dcc0;
  --film-text-shadow:0 2px 24px rgba(0,0,0,.75),0 0 40px rgba(240,200,110,.25);
}
.film h1{font-size:var(--step-5);line-height:1.22;margin-block-end:var(--sp-4);color:var(--hero-ink);text-wrap:balance}
.film .hero-lede{font-size:var(--step-1);color:var(--hero-lede);max-inline-size:56ch;margin-block-end:var(--sp-6);text-wrap:pretty}
.film .hero-chips{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 var(--sp-5);font-family:var(--font-ui);font-size:13px;color:var(--hero-lede)}
.film .hero-chips a{padding:5px 13px;border-radius:var(--r-pill);text-decoration:none;background:var(--hero-chip);border:1px solid var(--hero-chip-line);color:var(--hero-ink)}
.film .hero-actions{display:flex;flex-wrap:wrap;gap:var(--sp-3)}
.film .btn-ghost{background:var(--hero-chip);color:var(--hero-ink);border-color:var(--hero-chip-line)}
[data-theme="dark"] .film .btn-ghost{background:rgba(230,196,119,.14);color:var(--gold-300);border-color:rgba(230,196,119,.42)}
.film .hero-credit{position:absolute;z-index:6;inset-block-end:8px;inset-inline-start:14px;margin:0;
  font-family:var(--font-ui);font-size:11px;color:var(--film-text);opacity:.75;text-shadow:var(--film-text-shadow)}
.film .hero-credit a{color:inherit;text-decoration:underline;text-underline-offset:2px}
.film .hero-credit .credit-night{display:none}
[data-theme="dark"] .film .hero-credit .credit-day{display:none}
[data-theme="dark"] .film .hero-credit .credit-night{display:inline}

/* ---- the stage: by default, the plain first screen ---- */
.film-stage{
  position:relative;isolation:isolate;overflow:hidden;
  min-block-size:var(--film-h);
  background:linear-gradient(165deg,#fdf5e0 0%,#f7e5b8 30%,#eed292 60%,#ddba66 100%);
  border-block-end:1px solid var(--hero-line);
  display:flex;align-items:center;
  padding-block:clamp(2.5rem,6vw,5rem);
}
[data-theme="dark"] .film-stage{background:linear-gradient(165deg,#0a1620 0%,#102431 45%,#16303f 75%,#0d1a24 100%)}
.film-sky,.film-starfield,.film-fade,.film-veil,.film-prints,.film-act2,.film-dawn,.film-cue{display:none}

/* the picture. Its edge fades into the ground on the side the text is on and along its
   bottom; --f and --b are what the script takes to nothing as it fills the screen. */
.film-pic{
  position:absolute;z-index:0;inset-block-start:0;inset-inline-end:0;
  inline-size:min(42%,680px);block-size:100%;max-inline-size:none;object-fit:cover;object-position:50% 24%;
  --f:30%;--b:80%;
  -webkit-mask-image:linear-gradient(to left,transparent 0,transparent calc(var(--f) * .1),#000 var(--f)),linear-gradient(to bottom,#000 var(--b),transparent 100%);
  -webkit-mask-composite:source-in;
  mask-image:linear-gradient(to left,transparent 0,transparent calc(var(--f) * .1),#000 var(--f)),linear-gradient(to bottom,#000 var(--b),transparent 100%);
  mask-composite:intersect;pointer-events:none;user-select:none;
}
/* by day the daylight photograph, in the dark theme the lit one — only the shown one is fetched */
.film-pic--night{display:none!important}
[data-theme="dark"] .film-pic--day{display:none!important}
[data-theme="dark"] .film-pic--night{display:block!important}

.film-act1{position:relative;z-index:3;inline-size:100%}
.film-act1 .hero-grid{display:grid;grid-template-columns:minmax(0,1fr);align-items:center}
.film-act1 .hero-copy{max-inline-size:min(100%,660px)}
@media (max-width:900px){
  .film-stage{align-items:flex-end;padding-block:0 2.2rem}
  .film-pic{inline-size:100%;block-size:46%;--f:0%;--b:60%}
  .film-act1{padding-block-start:46vw}
}

/* ---- the film (scripting on, motion allowed) ---- */
.film-on .film-track{block-size:calc(var(--film-len,4.6) * var(--film-h))}
.film-on .film-stage{
  position:sticky;inset-block-start:var(--header-h);block-size:var(--film-h);min-block-size:0;
  display:block;padding:0;border:0;
}
.film-on .film-sky,.film-on .film-fade,.film-on .film-veil,.film-on .film-prints,.film-on .film-act2{display:block}
.film-on .film-sky{position:absolute;inset:0;z-index:0;
  background:linear-gradient(165deg,#fdf5e0 0%,#f7e5b8 30%,#eed292 60%,#ddba66 100%)}
[data-theme="dark"] .film-on .film-sky{background:linear-gradient(165deg,#0a1620 0%,#102431 45%,#16303f 75%,#0d1a24 100%)}
.film-on .film-pic{
  inset:0;inline-size:100%;block-size:100%;
  object-position:50% var(--pic-y,24%);
  -webkit-mask-image:none;mask-image:none;
  will-change:transform,clip-path;
}
.film-on .film-fade{
  position:absolute;inset:0;z-index:1;pointer-events:none;will-change:opacity;
  background:linear-gradient(to left,var(--film-ground) calc(100% - var(--pic-w,42%)),transparent calc(100% - var(--pic-w,42%) + 14%));
}
@media (max-width:900px){
  .film-on .film-fade{
    background:linear-gradient(to top,var(--film-ground) 54%,transparent 72%);
  }
}

/* the first screen of the film is only the picture and the title: what a visitor can do
   (search, suggestions, the two buttons) is in the header and arrives again at the end */
.film-on .film-act1 .hero-search,
.film-on .film-act1 .hero-chips,
.film-on .film-act1 .hero-actions,
.film-on .film-act1 .hero-eyebrow{display:none}
.film-on .film-act1 h1{font-size:clamp(2.4rem,1.5rem + 4.2vw,5rem);margin-block-end:var(--sp-5)}
.film-on .film-act1 .hero-lede{margin-block-end:0}

/* a quiet cue that there is more: one thin line with a light running down it, four times */
.film-on .film-cue{display:block;position:absolute;z-index:6;inset-block-end:clamp(14px,3.5vh,30px);left:50%;
  inline-size:2px;block-size:clamp(38px,7vh,60px);margin-inline-start:-1px;border-radius:2px;
  background:linear-gradient(to bottom,transparent,var(--hero-line));overflow:hidden;opacity:0;
  animation:film-cue-in .8s ease 2.2s forwards}
.film-on .film-cue::after{content:"";position:absolute;inset-inline:0;inset-block-start:-40%;block-size:40%;
  background:linear-gradient(to bottom,transparent,var(--hero-frame));animation:film-cue-run 2.1s ease-in-out 2.6s 4}
@keyframes film-cue-in{to{opacity:1}}
@keyframes film-cue-run{to{inset-block-start:110%}}
.film-on .film-cue.is-gone{opacity:0!important;animation:none}

/* night only: a few stars in the black above the shrine, once the picture has filled the screen */
.film-starfield{position:absolute;inset:0;z-index:1;opacity:0;pointer-events:none;
  background-image:
    radial-gradient(1.4px 1.4px at 8% 12%,rgba(255,236,190,.9),transparent 60%),
    radial-gradient(1px 1px at 21% 31%,rgba(255,236,190,.7),transparent 60%),
    radial-gradient(1.6px 1.6px at 33% 8%,rgba(255,236,190,.85),transparent 60%),
    radial-gradient(1px 1px at 47% 22%,rgba(255,236,190,.6),transparent 60%),
    radial-gradient(1.5px 1.5px at 58% 6%,rgba(255,236,190,.8),transparent 60%),
    radial-gradient(1px 1px at 69% 27%,rgba(255,236,190,.7),transparent 60%),
    radial-gradient(1.6px 1.6px at 81% 11%,rgba(255,236,190,.9),transparent 60%),
    radial-gradient(1px 1px at 92% 24%,rgba(255,236,190,.65),transparent 60%)}
[data-theme="dark"] .film-on .film-starfield{display:block}

/* the veil keeps the closing words and the search readable over the picture and draws
   the eye to the middle */
.film-on .film-veil{position:absolute;inset:0;z-index:2;opacity:0;pointer-events:none;
  background:
    linear-gradient(to bottom,rgba(var(--film-veil),.94) 0%,rgba(var(--film-veil),.74) 20%,rgba(var(--film-veil),0) 46%,rgba(var(--film-veil),0) 60%,rgba(var(--film-veil),var(--film-vb)) 100%),
    radial-gradient(120% 90% at 50% 58%,transparent 52%,rgba(var(--film-veil),.5) 100%)}

/* the archive's photographs: small prints laid over the picture */
.film-on .film-prints{position:absolute;inset:0;z-index:4;direction:ltr;pointer-events:none}
.film-print{
  position:absolute;inset-inline-start:0;inset-block-start:0;display:block;
  inline-size:var(--w,120px);padding:4px;border-radius:3px;
  background:linear-gradient(160deg,#fffdf4,#f1e1b3);
  box-shadow:0 0 0 1px rgba(160,118,40,.5),0 12px 30px rgba(70,46,8,.38),0 0 26px rgba(255,248,222,.5);
  opacity:0;pointer-events:none;will-change:transform,opacity;
  transition:box-shadow .25s ease;
}
[data-theme="dark"] .film-print{
  background:linear-gradient(160deg,#fff7df,#ecd69c);
  box-shadow:0 0 0 1px rgba(212,169,79,.55),0 10px 30px rgba(0,0,0,.55),0 0 40px rgba(240,200,110,.35)}
.film-print img{display:block;inline-size:100%;block-size:auto;aspect-ratio:4/3;object-fit:cover;border-radius:1px;filter:sepia(.18) saturate(.95)}
.film-print.is-live{pointer-events:auto}
.film-print.is-live:hover img{filter:none}
.film-print.is-live:hover,.film-print.is-live:focus-visible{
  box-shadow:0 0 0 2px #f3d98e,0 14px 40px rgba(0,0,0,.5),0 0 70px rgba(255,226,150,.7);z-index:2}

/* the two acts of copy */
.film-on .film-act{position:absolute;inset:0;z-index:5;pointer-events:none}
.film-on .film-act1{display:flex;align-items:center;padding-block:0;will-change:transform,opacity}
.film-on .film-act1 .hero-copy{pointer-events:auto;padding-inline:0}
.film-on .film-act1.is-gone{visibility:hidden}
.film-act2{display:none;flex-direction:column;justify-content:space-between;align-items:center;text-align:center;
  padding:clamp(1.4rem,4.5vh,3rem) 1rem clamp(1.4rem,5vh,3rem);color:var(--film-text)}
.film-on .film-act2{display:flex;opacity:0;will-change:opacity}
.film-on .film-act2.is-live > *{pointer-events:auto}
.film-top{max-inline-size:min(92vw,760px)}
.film-act2 h2{font-size:clamp(1.7rem,1.1rem + 3vw,3.3rem);line-height:1.25;margin:0 0 clamp(.9rem,2.5vh,1.6rem);
  color:var(--film-text);text-wrap:balance;text-shadow:var(--film-text-shadow)}
.film-figs{list-style:none;margin:0;padding:0;display:flex;justify-content:center;gap:clamp(1rem,4vw,3rem)}
.film-figs li{display:flex;flex-direction:column;align-items:center;gap:2px;font-family:var(--font-ui)}
.film-figs b{font-size:clamp(1.35rem,1rem + 1.8vw,2.3rem);font-weight:700;color:var(--film-num);font-variant-numeric:tabular-nums;
  text-shadow:var(--film-text-shadow)}
.film-figs span{font-size:clamp(.72rem,.68rem + .2vw,.88rem);color:var(--film-sub);font-weight:600;text-shadow:var(--film-text-shadow)}
.film-foot{display:flex;flex-direction:column;align-items:center;gap:var(--sp-3);inline-size:min(100%,580px)}
.film-foot .hero-search{inline-size:100%;margin:0}
.film-foot .hero-chips{justify-content:center;margin:0}
.film-foot .hero-actions{justify-content:center;margin:0}
[data-theme="dark"] .film-foot .hero-search{background:rgba(10,18,30,.82);color:#fff8e6;border-color:rgba(230,196,119,.6)}
[data-theme="dark"] .film-foot .hero-search svg{color:#f3d98e}
.film-foot .hero-chips > span:first-child{color:var(--film-sub);font-weight:600;text-shadow:var(--film-text-shadow)}

@media (max-width:900px){
  .film-on .film-act1{align-items:flex-end;padding-block:0 3.4rem}
  .film-on .film-act1 .hero-grid{padding-inline:var(--gutter,16px)}
  .film .hero-lede{display:none}
  .film-on .film-act1 h1{font-size:clamp(2rem,8.4vw,2.6rem);margin-block-end:0}
  .film-on .film-act1 .hero-lede{display:block;font-size:1rem;margin-block-start:var(--sp-3)}
  .film-foot .hero-chips{display:none}
  /* the copy sits on the bottom edge here, so the cue line would run through it */
  .film-on .film-cue{display:none}
}
@media (max-width:640px){
  .film .hero-search .hs-key{display:none}
  .film .btn-lg{padding:12px 20px;font-size:14.5px}
}
@media (max-height:620px) and (min-width:901px){
  .film-on .film-act1 .hero-lede{display:none}
  .film-foot .hero-chips{display:none}
}

/* the way out: a short fade into the page's own paper, so the sections below arrive like
   morning instead of a hard cut */
.film-on .film-dawn{display:block;block-size:min(9vh,80px);margin-block-start:-1px;
  background:linear-gradient(to bottom,var(--film-ground),var(--paper))}

/* test hook: a frozen frame has no entrance animation */
.film-still *,.film-still *::after{animation:none!important}
.film-still .film-cue{opacity:1}
@media (prefers-reduced-motion:reduce){
  .film-on .film-track{block-size:auto}
}

/* ------------------------------------------------------------------------------
   The millennium («ألفية حوزة النجف الأشرف · ١٤٤٨ هج»), as a line of the hero's own copy.

   Not a banner: one small row above the headline, set like the eyebrow it sits where — the
   calligrapher's writing at signature size (cut from the scan by tools/make_calligraphy.py and
   painted through a mask in the text's own muted colour, no gradient, no glow), a hairline, and
   one plain sentence. It arrives with the rest of the copy, no animation of its own.
   Elsewhere on the site the same thing is only a sentence in the page's own text.
   -------------------------------------------------------------------------- */
.mill-line{display:flex;align-items:center;gap:.75rem;margin:0 0 var(--sp-4);max-inline-size:34rem;
  font-family:var(--font-ui);font-size:12.5px;font-weight:500;line-height:1.65;color:var(--hero-lede)}
.mill-line .mill-text{padding-inline-start:.75rem;border-inline-start:1px solid var(--hero-line)}
.mill-ink{flex:none;display:block;inline-size:124px;aspect-ratio:1268/537;background:currentColor;opacity:.85}
@supports ((-webkit-mask-image:url(x)) or (mask-image:url(x))){
  .mill-ink{-webkit-mask:url(../img/alfiya.webp) center/contain no-repeat;mask:url(../img/alfiya.webp) center/contain no-repeat}
}
.js .mill-line{animation:lm-drop .8s var(--ease-out) .15s backwards}
@media (max-width:900px){
  .mill-line{gap:.6rem;font-size:12px;margin-block-end:var(--sp-3)}
  .mill-ink{inline-size:100px}
}

/* the search, once, when a hard scroll was stopped on it: a soft ring of light, so the visitor
   sees what they were held here for */
.film-foot .hero-search.is-hit{animation:film-hit 1.1s ease-out}
@keyframes film-hit{
  0%{box-shadow:0 0 0 0 rgba(212,169,79,.75)}
  60%{box-shadow:0 0 0 14px rgba(212,169,79,0)}
  100%{box-shadow:0 0 0 0 rgba(212,169,79,0)}
}

/* the closing note's label sits on its title like every other section's (the prose rule for
   headings would push the title 48px away from it) */
.closing .prose .section-title{margin-block-start:0}
