/* ==========================================================================
   Landing page motion — loaded by index.html only (see build_home in sitegen.py).
   --------------------------------------------------------------------------
   Rules this file keeps, so the motion stays quiet and cheap on every screen:
     * nothing here exists for a reader who asked for reduced motion: every moving
       rule is inside `prefers-reduced-motion: no-preference`;
     * nothing is hidden unless the page is scripted (`.js`), so a page whose script
       never loads is never left blank;
     * only `transform`-family properties and `opacity` move, so a phone's
       compositor does the work. `translate` and `scale` are used as their own
       properties so an entrance never fights a hover (`transform`) or the
       scroll-linked drift that landing.js writes into `translate`;
     * entrances are `animation … backwards`: the from-state holds during the delay,
       and when the animation ends the element is back under its normal rules, so
       the hover and press states of cards and buttons work again at once;
     * everything slides from the inline-start edge (the right, in Arabic) —
       `--flip` is +1 in RTL and -1 in LTR;
     * what loops (the dot, the button's shine) and what lasts long (the light) is
       paused whenever the hero is off screen (`.lm-live` is set by landing.js).
   ========================================================================== */

@property --lm-p{syntax:"<number>";inherits:false;initial-value:0}

:root{--flip:-1}
html[dir="rtl"]{--flip:1}

/* ------------------------------------------------------------ layout fix
   «آخر ما نُشر» draws six cards. In a grid of five columns (any desktop) that is five
   and one orphan. Three columns of larger cards divide six at every width from a
   tablet up; a phone keeps its two. Not a motion rule, so it is outside the query. */
@media (min-width:700px){
  .page-home .cards-block .card-grid{
    grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr));
  }
}

@media (prefers-reduced-motion:no-preference){

.page-home{
  --rise:30px;
  --slide:34px;
  --lm-clip-from:inset(0 0 0 100%);
}
html[dir="ltr"] .page-home{--lm-clip-from:inset(0 100% 0 0)}
@media (max-width:640px){.page-home{--rise:20px;--slide:22px}}

@keyframes lm-rise{from{opacity:0;transform:translate3d(0,var(--rise),0)}}
@keyframes lm-drop{from{opacity:0;transform:translate3d(0,calc(var(--rise) * -.6),0)}}
@keyframes lm-pop{from{opacity:0;transform:translate3d(0,var(--rise),0) scale(.95)}}
@keyframes lm-card{from{opacity:0;transform:translate3d(calc(var(--flip) * var(--slide) * 1.3),0,0) scale(.94)}}
@keyframes lm-slide{from{opacity:0;transform:translate3d(calc(var(--flip) * var(--slide)),0,0)}}
@keyframes lm-fade{from{opacity:0}}
@keyframes lm-zoom{from{scale:1.2}}
@keyframes lm-show{to{opacity:1}}

/* ------------------------------------------------------------------ hero
   One sequence, about two seconds long, that reads in the order the page is meant
   to be read: the photograph settles, the badge drops in, the headline arrives word
   by word (words, not letters — Arabic letters must stay joined), then the line
   under it, the search, the suggestions and the two buttons. */
.js .hero-photo{animation:lm-photo 2.2s var(--ease-out) backwards}
@keyframes lm-photo{from{opacity:0;scale:1.18}}
.hero.lm-live .hero-photo{will-change:translate}
.hero.lm-live .hero-copy{will-change:translate,opacity}

.js .hero-eyebrow{animation:lm-drop .8s var(--ease-out) .1s backwards}

/* the headline is hidden only until landing.js has split it into words; if the
   script never gets there, the last rule shows it after 1.4s anyway */
.js .hero h1:not(.lm-split){opacity:0;animation:lm-show .01s 1.4s forwards}
.lm-w{
  display:inline-block;
  animation:lm-word 1.1s var(--ease-out) calc(.24s + var(--i,0) * 85ms) backwards;
}
@keyframes lm-word{
  from{opacity:0;transform:translate3d(0,.45em,0);filter:blur(7px)}
}
@media (max-width:640px){
  /* a blurred word is a repaint per frame; a phone gets the same arrival without it */
  @keyframes lm-word{from{opacity:0;transform:translate3d(0,.4em,0)}}
}

.js .hero-lede{animation:lm-rise .9s var(--ease-out) .9s backwards}
.js .hero-search{
  position:relative;overflow:hidden;isolation:isolate;
  animation:lm-pop 1s var(--ease-out) 1.05s backwards;
}
.js .hero-chips{animation:lm-rise .9s var(--ease-out) 1.2s backwards}
.js .hero-actions > *{animation:lm-rise .9s var(--ease-out) 1.3s backwards}
.js .hero-actions > :nth-child(2){animation-delay:1.42s}
.js .hero-credit{animation:lm-fade 1.2s ease 2s backwards}

/* a single pass of light across the search box once it has landed */
.js .hero-search::after{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(105deg,transparent 36%,rgba(255,255,255,.9) 50%,transparent 64%);
  translate:calc(var(--flip) * 135%) 0;
  animation:lm-gloss 1.6s ease-in-out 2.3s 1 both;
}
[data-theme="dark"].js .hero-search::after{
  background:linear-gradient(105deg,transparent 36%,rgba(230,196,119,.3) 50%,transparent 64%);
}
@keyframes lm-gloss{to{translate:calc(var(--flip) * -135%) 0}}

/* the badge's dot, breathing */
.js .hero-eyebrow .dot{position:relative}
.js .hero-eyebrow .dot::after{
  content:"";position:absolute;inset:-5px;border-radius:50%;
  border:1.5px solid var(--gold-500);opacity:0;
  animation:lm-ping 3.2s ease-out 1.6s 5;
}
@keyframes lm-ping{0%{scale:.55;opacity:.8}75%,100%{scale:2.3;opacity:0}}

/* the primary button catches the light now and then */
.js .hero .btn-primary{position:relative;overflow:hidden;isolation:isolate}
.js .hero .btn-primary::after{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(105deg,transparent 38%,rgba(255,255,255,.55) 50%,transparent 62%);
  translate:calc(var(--flip) * 140%) 0;
  animation:lm-shine 7s ease-in-out 3.4s 3;
}
@keyframes lm-shine{
  0%,64%{translate:calc(var(--flip) * 140%) 0}
  86%,100%{translate:calc(var(--flip) * -140%) 0}
}

/* the ground: a soft light that comes up behind the text and settles. It plays once and
   stops, and stops sooner when the hero is off screen: a layer that animates for ever keeps
   a phone composing frames (and its battery draining) for as long as the page is open. */
.page-home .hero{
  --lm-glow:rgba(255,247,218,.85);
}
[data-theme="dark"] .page-home .hero{
  --lm-glow:rgba(230,196,119,.2);
}
.js .hero::before{
  content:"";position:absolute;z-index:-1;pointer-events:none;
  inset-block-start:-30%;inset-inline-start:0;inline-size:72%;block-size:115%;
  background:radial-gradient(closest-side,var(--lm-glow),transparent 72%);
  animation:lm-glow 9s ease-in-out .3s 1 both;
}
@keyframes lm-glow{
  from{opacity:0;translate:calc(var(--flip) * -6%) 0}
  to{opacity:1;translate:calc(var(--flip) * 5%) 4%}
}
/* what loops stops when the hero is out of sight */
.hero:not(.lm-live)::before,
.hero:not(.lm-live) .hero-eyebrow .dot::after,
.hero:not(.lm-live) .btn-primary::after{animation-play-state:paused}

/* ---------------------------------------------------------------- groups
   A group is a block whose children arrive one after another when it scrolls into
   view: the four figures, the rows of pictures, the stories, the latest cards, a
   section's heading. landing.js marks the block (`.lm-group`), numbers the children
   (`--i`) and adds `.lm-in` when the block is seen. The block's own `.reveal`
   (site.css) is switched off, so nothing is faded twice. */
.js .page-home .lm-group.reveal{opacity:1;transform:none;transition:none}
.js .page-home .lm-group > .reveal{
  opacity:1;transform:none;
  transition:transform .22s var(--ease-out),box-shadow .22s,border-color .22s;
}
.js .page-home .lm-group:not(.lm-in) > *{opacity:0}
.js .page-home .lm-group.lm-in > *{
  animation:lm-rise .95s var(--ease-out) calc(var(--i,0) * 85ms) backwards;
}
.js .page-home .lm-group--head.lm-in > *{
  animation-duration:.85s;animation-delay:calc(var(--i,0) * 110ms);
}
.js .page-home .lm-group--pop.lm-in > *{animation-name:lm-pop}
.js .page-home .lm-group--rail.lm-in > *{
  animation-name:lm-card;animation-duration:1s;animation-delay:calc(var(--i,0) * 75ms);
}
/* the picture inside a tile settles as the tile arrives */
.js .page-home .lm-group.lm-in .tile-img,
.js .page-home .lm-group.lm-in .rail-card > img{
  animation:lm-zoom 2s var(--ease-out) calc(var(--i,0) * 75ms) backwards;
}

/* ------------------------------------------------------------- the journey
   The spine is drawn as you scroll (landing.js writes --lm-p, 0 to 1); each stop's
   dot pops onto it with one ripple, the year slides in, the three pictures are
   drawn open one after another, and the words follow. */
.journey-list{isolation:isolate}
.journey-list.lm-draw::before{transform-origin:top;scale:1 var(--lm-p)}
.journey-list.lm-draw::after{
  content:"";position:absolute;z-index:-1;pointer-events:none;
  inset-block:10px;inset-inline-start:15px;inline-size:2px;border-radius:2px;
  background:var(--line);opacity:.7;
}
@media (min-width:900px){.journey-list.lm-draw::after{inset-inline-start:21px}}

.js .page-home .journey-stop.reveal{opacity:1;transform:none;transition:none}
.js .page-home .journey-stop:not(.lm-in) :is(.js-year,.js-photos,.js-ph,.js-copy > *){opacity:0}
.js .page-home .journey-stop.lm-in .js-photos{animation:lm-fade .6s ease backwards}
.js .page-home .journey-stop:not(.lm-in) .js-dot{scale:0}

.js-dot::after{
  content:"";position:absolute;inset:-7px;border-radius:50%;
  border:2px solid var(--gold-400);opacity:0;pointer-events:none;
}
.js .page-home .journey-stop.lm-in .js-dot{animation:lm-dot .9s var(--ease-spring) .05s backwards}
.js .page-home .journey-stop.lm-in .js-dot::after{animation:lm-ripple 1.9s ease-out .45s backwards}
@keyframes lm-dot{from{scale:0}}
@keyframes lm-ripple{from{scale:.6;opacity:.9}to{scale:2.3;opacity:0}}

.js .page-home .journey-stop.lm-in .js-year{animation:lm-slide .9s var(--ease-out) .12s backwards}

.js-ph:nth-child(1){--k:0}
.js-ph:nth-child(2){--k:1}
.js-ph:nth-child(3){--k:2}
.js .page-home .journey-stop.lm-in .js-ph{
  animation:lm-wipe 1.2s var(--ease-out) calc(.25s + var(--k,0) * 150ms) backwards;
}
.js .page-home .journey-stop.lm-in .js-ph img{
  animation:lm-zoom 1.9s var(--ease-out) calc(.25s + var(--k,0) * 150ms) backwards;
}
@keyframes lm-wipe{from{clip-path:var(--lm-clip-from)}}

.js-copy > :nth-child(1){--j:0}
.js-copy > :nth-child(2){--j:1}
.js-copy > :nth-child(3){--j:2}
.js-copy > :nth-child(4){--j:3}
.js .page-home .journey-stop.lm-in .js-copy > *{
  animation:lm-rise .85s var(--ease-out) calc(.4s + var(--j,0) * 100ms) backwards;
}

/* ----------------------------------------------------------- pictures load in
   A picture that is still coming (landing.js marks it) is clear, and dissolves in when
   it arrives, over the tile's lapis ground, instead of snapping into place. */
.tile-img,.rail-card > img,.js-ph img{
  transition:transform .9s var(--ease-out),opacity .9s ease;
}
.lm-img-pending{opacity:0}

/* ------------------------------------------------------------ small things */
.btn > span[aria-hidden="true"],
.js-go > span[aria-hidden="true"]{display:inline-block;transition:translate .25s var(--ease-out)}
.btn:hover > span[aria-hidden="true"],
.js-go:hover > span[aria-hidden="true"]{translate:-5px 0}

/* a pointer leaves a patch of light on the tile it is over; a finger has no hover, so
   it gets a press instead */
@media (hover:hover) and (pointer:fine){
  a.tile::after,.rail-card::after{
    content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:0;
    transition:opacity .4s ease;
    background:radial-gradient(380px circle at var(--mx,50%) var(--my,50%),rgba(255,233,170,.3),transparent 62%);
  }
  a.tile:hover::after,.rail-card:hover::after{opacity:1}
}
@media (hover:none){
  a.tile,.rail-card,.card,.btn{-webkit-tap-highlight-color:transparent}
  a.tile:active,.rail-card:active,.card:active{transform:scale(.975);transition-duration:.12s}
}

/* ------------------------------------------------------------------ «فاجئني»
   The button's show (landing.js, initSurprise). One of three shows plays per click, at random:
   satellites (a globe of photographs round a gold core, rings and small photographs on them),
   stack (photographs dealt, riffled, fanned and gathered on a table) and film (archive strips
   slide past a projector gate). landing.js moves every element each frame and sets the colours
   (--lm-* variables on the overlay); this file says how they look. The overlay exists only while
   it plays. */
.lm-pile{
  position:fixed;inset:0;z-index:600;overflow:hidden;cursor:pointer;touch-action:none;
  background:var(--paper);
  animation:lm-pile-veil .26s ease-out backwards;
}
@keyframes lm-pile-veil{from{opacity:0}}
.lm-sky,.lm-dawn,.lm-flash{position:absolute;inset:0;pointer-events:none;opacity:0}
.lm-sky{background:var(--lm-sky)}
.lm-dawn{background:var(--paper)}
.lm-flash{background:radial-gradient(circle at 50% 50%,rgba(255,250,235,.95),rgba(246,214,140,.35) 38%,transparent 70%)}
.lm-flare{
  position:absolute;left:0;right:0;top:50%;height:2px;margin-top:-1px;
  opacity:0;pointer-events:none;
  background:linear-gradient(90deg,transparent,var(--lm-flare),transparent);
}
.lm-beam{
  position:absolute;left:-15%;top:-25%;width:95%;height:150%;
  transform:rotate(28deg);transform-origin:0 0;opacity:0;pointer-events:none;
  background:linear-gradient(90deg,var(--lm-beam),transparent 75%);
}
.lm-rays{
  position:absolute;left:50%;top:50%;width:160vmax;height:160vmax;margin:-80vmax 0 0 -80vmax;
  opacity:0;pointer-events:none;
  background:repeating-conic-gradient(from 0deg,var(--lm-ray) 0deg 3deg,transparent 3deg 14deg);
  -webkit-mask-image:radial-gradient(closest-side,#000 8%,transparent 68%);
  mask-image:radial-gradient(closest-side,#000 8%,transparent 68%);
}
.lm-stars,.lm-motes{position:absolute;inset:0;pointer-events:none}
.lm-star{position:absolute;border-radius:50%;background:var(--lm-star);opacity:0;margin:0}
.lm-mote{position:absolute;left:50%;top:50%;border-radius:50%;background:var(--lm-mote);opacity:0}
.lm-stage{position:absolute;inset:0;perspective:1500px;pointer-events:none}
.lm-core{
  position:absolute;left:50%;top:50%;border-radius:50%;opacity:0;
  background:radial-gradient(closest-side,var(--lm-glow),var(--lm-glowMid) 42%,transparent 100%);
}
.lm-orbit{
  position:absolute;left:50%;top:50%;border-radius:50%;opacity:0;
  border:1.5px solid var(--lm-ring);box-shadow:0 0 14px var(--lm-ringGlow);
}
.lm-shoot{
  position:absolute;left:0;top:0;width:240px;height:2px;margin:0;border-radius:2px;opacity:0;
  background:linear-gradient(90deg,transparent,var(--lm-star));
  transform-origin:0 50%;
}
.lm-table{
  position:absolute;left:50%;top:50%;border-radius:50%;opacity:0;pointer-events:none;
  background:radial-gradient(closest-side,rgba(20,28,36,.42),rgba(20,28,36,0) 100%);
}

/* a card: a cream print with a face; a card with no picture is a ruled sheet with a seal */
.lm-card{
  position:absolute;left:50%;top:50%;width:250px;height:300px;margin:-150px 0 0 -125px;
  box-sizing:border-box;padding:8px 8px 26px;border-radius:6px;
  background:#fffaf0;
  box-shadow:0 1px 2px rgba(20,28,36,.28),0 18px 40px -8px rgba(20,28,36,.45);
  transform-origin:50% 50%;opacity:0;
  backface-visibility:hidden;-webkit-backface-visibility:hidden;
}
.lm-face{position:absolute;overflow:hidden;border-radius:2px;background:#e5dac4}
.lm-card .lm-face{inset:8px 8px 26px}
.lm-face > img{display:block;width:100%;height:100%;object-fit:cover}
.lm-card--doc .lm-face{
  background:#f4ecd8 linear-gradient(rgba(122,98,52,.26) 1px,transparent 1px) 0 18px/100% 21px;
}
.lm-card--doc .lm-face::before{
  content:"";position:absolute;inset-block-start:12px;inset-inline-end:12px;
  inline-size:26px;block-size:26px;border-radius:50%;border:2px solid var(--gold-400);
  box-shadow:inset 0 0 0 4px #f4ecd8,inset 0 0 0 6px rgba(212,169,79,.5);
}
.lm-moon{
  position:absolute;left:50%;top:50%;width:34px;height:42px;margin:-21px 0 0 -17px;
  box-sizing:border-box;padding:3px 3px 9px;border-radius:3px;
  background:#fffaf0;box-shadow:0 2px 6px rgba(0,0,0,.35);opacity:0;
}
.lm-moon .lm-face{inset:3px 3px 9px}
.lm-gloss{
  position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(105deg,transparent 38%,rgba(255,250,236,.8) 50%,transparent 62%);
  transform:translateX(120%);
}
.lm-ring{
  position:absolute;inset:-5px;border-radius:9px;
  border:2px solid var(--gold-400);opacity:0;pointer-events:none;
}

/* film: two strips with sprocket holes; frames are landscape, some blank, as film is */
.lm-strip{
  position:absolute;left:0;top:0;opacity:0;
  background:linear-gradient(var(--lm-strip),var(--lm-strip)) center / 100% calc(100% - 28px) no-repeat;
}
.lm-strip::before,.lm-strip::after{
  content:"";position:absolute;left:0;right:0;height:14px;
  background:repeating-linear-gradient(90deg,transparent 0 12px,var(--lm-strip) 12px 24px);
}
.lm-strip::before{top:0}
.lm-strip::after{bottom:0}
.lm-frame{position:absolute;overflow:hidden;border-radius:2px;background:#0c0905}
.lm-frame .lm-face{inset:0;background:#0c0905}
.lm-gate{
  position:absolute;left:50%;top:50%;border-radius:4px;background:#0c0905;opacity:0;
  box-shadow:0 2px 4px rgba(0,0,0,.4),0 26px 60px -12px rgba(0,0,0,.6);
}
.lm-gate .lm-face{inset:0;background:#0c0905;border-radius:3px}

/* the stack's cards turn over in the air, so their backs must stay visible while they turn */
.lm-card--flip{backface-visibility:visible;-webkit-backface-visibility:visible}
.lm-back{
  position:absolute;inset:8px;border-radius:3px;opacity:0;
  background:
    radial-gradient(circle at 50% 50%,#f2dda6 0 7%,transparent 8%),
    repeating-conic-gradient(from 0deg,#1d3a56 0deg 22.5deg,#0d1a24 22.5deg 45deg);
  box-shadow:inset 0 0 0 2px rgba(212,169,79,.8);
}
.lm-card--down .lm-face{opacity:0}
.lm-card--down .lm-back{opacity:1}
}/* /prefers-reduced-motion:no-preference */
