/* The date's journey down the page (journey.js). Ported from the NaturalOLI site, Hijazi ink.
   This file owns the vertical space between the story sections: a band above each section[data-oj]
   and one after the last. The layer is a body child over the page content and under the nav (z-index 1,
   no pointer events): the plates draw in the empty gaps, centred and fixed; the date roams the page. */

:root { --oj-band: clamp(400px, 50vh, 480px); }
@media (max-width: 809.98px) { :root { --oj-band: clamp(330px, 44svh, 390px); } }

main > section[data-oj] { margin-top: var(--oj-band); }
main#main { padding-bottom: calc(var(--oj-band) + 60px); }   /* padding, not margin: the last plate measures to main's bottom */

.oj {
  --ink-soft: #4d3a2c;
  --gold-t: #9a6420;
  --gold-d: #5b3418;
  --gold: #d5a35a;
  --olive: #820D13;
  --stone: #f5e7cd;
  --stone-lit: #fffaf0;
  --oj-sw: 1.2;
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 0;
  overflow: clip;
  pointer-events: none;
  color: var(--ink-soft);
  font-family: "Cairo", sans-serif;
}
.oj *,
.oj *::before,
.oj *::after { box-sizing: border-box; }

.oj-band {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(46% 62% at 50% 48%, var(--stone-lit), rgba(255, 250, 240, 0) 100%);
}
.oj-band--first { justify-content: flex-start; padding-top: 56px; }   /* room for the roshan crown under the hero */
/* the wall each roshan hangs on: coral-stone (منقبي) courses with a timber band (تكليلة) every few courses, as
   on the houses of Al-Balad. Static, faint, fading out toward the band's edges; it never moves */
.oj-band::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='96'%3E%3Cg fill='none' stroke='%236e4822' stroke-opacity='.08'%3E%3Cpath d='M0 16.5H120M0 32.5H120M0 48.5H120M0 64.5H120M0 80.5H120M30.5 0V16M90.5 0V16M.5 16V32M60.5 16V32M30.5 32V48M90.5 32V48M.5 64V80M60.5 64V80M30.5 80V96M90.5 80V96'/%3E%3C/g%3E%3Crect y='50' width='120' height='12' fill='%238a5530' fill-opacity='.2'/%3E%3Cpath d='M0 51.5H120M0 60.5H120' stroke='%234e2611' stroke-opacity='.12'/%3E%3C/svg%3E");
  background-position: center;
  -webkit-mask-image: radial-gradient(60% 70% at 50% 48%, #000 25%, transparent 100%);
  mask-image: radial-gradient(60% 70% at 50% 48%, #000 25%, transparent 100%);
}

.oj-box {
  width: min(440px, 100% - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.oj-art { position: relative; z-index: 2; width: clamp(300px, 26vw, 374px); }   /* max 374: wider, the filling funnel's throat (it scales with the plate) lets the piece (fixed size) slip through */
/* the hands' layer (old ways): over the moving piece, the same size and place as the plate */
.oj-box { position: relative; }
.oj-front { position: absolute; left: 0; right: 0; top: 0; z-index: 4; display: flex; justify-content: center; pointer-events: none; }
.oj-front .oj-art { position: static; z-index: auto; }
.oj-art svg { display: block; width: 100%; height: auto; overflow: visible; }

/* fine line plate: date-brown ink, red for the living parts, round ends */
.oj-art path[pathLength] {
  fill: none;
  stroke: var(--gold-d);
  stroke-width: var(--oj-sw);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0;
}
.oj-art path.w { stroke-opacity: 0.5; }
.oj-art path.s { stroke: var(--gold); }
.oj-art path.o { stroke: var(--olive); stroke-opacity: 0.8; }
.oj-art path.g { stroke: #b08743; stroke-width: calc(var(--oj-sw) * 1.9); }
/* paper-cut: the thin cut lines that draw first, under the sheets; awns and fine marks on top */
.oj-art path.c { stroke: #7a5230; stroke-width: 0.45; stroke-opacity: 0.75; }
.oj-art path.a { stroke: #a8731f; stroke-width: 0.5; stroke-opacity: 0.85; }
.oj-art path.d { stroke: #8a6236; stroke-width: 0.6; stroke-opacity: 0.6; }
.oj-art path.o { stroke-width: 0.9; }
.oj-art path.h { stroke: #e0843a; stroke-width: 1.1; }
.oj-art path.oj-fun { stroke: #cfab7a; stroke-width: 2.6; }   /* the tub machine's funnel: kraft strips, like the chutes */
.oj-art .oj-fill { will-change: opacity; }
.oj-art .oj-shade { fill: var(--gold-d); fill-opacity: 0.06; }
.oj-art .oj-fill { opacity: 0; }
.oj-band--tub .oj-art { width: clamp(330px, 62vw, 880px); }
.oj-mark {
  position: absolute;
  top: 35%;
  left: 91.5%;
  font-family: "Cairo", sans-serif;
  font-size: 0.74rem;
  line-height: 1;
  color: var(--gold-t);
  white-space: nowrap;
  opacity: 0;
}
.oj[dir="rtl"] .oj-mark { left: auto; right: 91.5%; }

.oj-label { position: relative; z-index: 2; margin: 34px 0 0;   /* clear of the roshan's sill brackets */
  max-width: 100%; }
.oj-eb, .oj-line { opacity: 0; }
/* the eyebrow is a little hand-cut kraft tag laid on the page */
.oj-eb {
  display: inline-block;
  padding: 1px 14px 2px;
  background: #e6c999;
  color: #5b3418;
  clip-path: polygon(0 8%, 6% 0, 52% 6%, 97% 0, 100% 46%, 98% 100%, 44% 93%, 3% 100%, 1% 55%);
  font-family: "Cairo", sans-serif;
  font-size: 0.8rem;
  line-height: 1.4;
}
.oj[lang="en"] .oj-eb { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.72rem; }
.oj-line {
  display: block;
  will-change: transform, opacity;
  margin-top: 6px;
  font-family: "Cairo", sans-serif;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

/* the date, the paste it becomes, and the bar (with its golden crust and its wrap on top) */
.oj-olive {
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 39px;
  visibility: hidden;
  will-change: transform;
  z-index: 3;
}
.oj.is-on .oj-olive { visibility: visible; }
.oj-olive__fruit,
.oj-olive__paste,
.oj-olive__drop { position: absolute; inset: 0; }
.oj-olive__paste { opacity: 0; }
.oj-olive__drop { left: -22%; right: -22%; top: 17%; bottom: 17%; opacity: 0; }
.oj-olive__gold, .oj-olive__rim, .oj-olive__wrap { position: absolute; inset: 0; opacity: 0; }
.oj-olive svg { display: block; width: 100%; height: 100%; }
.oj-olive__shadow {
  position: absolute;
  left: -5px;
  right: -5px;
  bottom: -6px;
  height: 9px;
  background: radial-gradient(closest-side, rgba(60, 28, 10, 0.34), rgba(60, 28, 10, 0));
  opacity: 0.9;
}

@media (max-width: 809.98px) {
  .oj { --oj-sw: 1.5; }
  .oj-art { width: min(88vw, 360px); }
  .oj-band--tub .oj-art { width: min(92vw, 380px); }
  .oj-box { width: min(380px, 100% - 24px); }
  .oj-label { margin-top: 26px; }
  .oj-line { font-size: 0.95rem; }
  .oj-band--first { padding-top: 46px; }
}

/* reduced motion: the finished plates (journey.js sets each one's moving parts to their end state) */
.oj.is-still .oj-art path[pathLength] { stroke-dashoffset: 0; opacity: 1; }
.oj.is-still .oj-art .oj-fill { opacity: 1; }
.oj.is-still .oj-eb,
.oj.is-still .oj-line,
.oj.is-still .oj-mark { opacity: 1; }

/* the helping hand: fine line ink, drawn on and erased with the dash offset; transform set in journey.js */
.oj-hand {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  opacity: 0;
  will-change: transform;
}
.oj-hand.is-on { opacity: 1; }
.oj-hand svg { display: block; overflow: visible; }
.oj-hand path {
  fill: none;
  stroke: var(--gold-d);
  stroke-width: 1.3px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}
.oj-hand .w { stroke: var(--olive); stroke-opacity: 0.5; }
.oj.is-still .oj-hand { display: none; }

/* the feed chutes that lead down to a plate's rim from the page sides: same ink as the plates, drawn with them */
/* a strip of kraft paper on the page, its soft shadow under it; it runs in behind the plate's arch card */
.oj-chute { position: absolute; z-index: 1; left: 0; top: 0; width: 0; height: 0; }
.oj-chute svg { display: block; overflow: visible; filter: drop-shadow(0 1.4px 0.8px rgba(58, 28, 8, 0.2)); }
.oj-chute path {
  fill: none;
  stroke: #d6b483;
  stroke-width: 4.2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0;
}
.oj.is-still .oj-chute path { stroke-dashoffset: 0; opacity: 1; }




/* ---- T1 film (journey.js filmTick): plates 1-6 are an old film; the last plate comes to colour ---- */
/* the sepia print: a colour-matrix filter on the plate and its hands (static; those SVGs repaint anyway) */
.oj-band--aged .oj-art svg,
.oj-band--aged .oj-label { filter: brightness(0.86) sepia(0.7) contrast(0.95); }
.oj-film {
  position: absolute;
  left: 1.6%;
  right: 1.6%;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 64% 62% at 50% 50%, #000 70%, transparent 100%);
  mask-image: radial-gradient(ellipse 64% 62% at 50% 50%, #000 70%, transparent 100%);
}
.oj-film > * { position: absolute; inset: 0; will-change: transform, opacity; }
.oj-film__age { will-change: auto; }
.oj-film__grain { inset: -20%; background: url("assets/film-grain.png") 0 0 / 96px 96px repeat; opacity: 0.55; }
.oj-film__dust { inset: -25%; background: url("assets/film-dust.png") center / 210px 210px repeat; opacity: 0; }
.oj-film__scratch { left: 0; right: auto; width: 100%; opacity: 0;
  background: linear-gradient(90deg, transparent calc(50% - 0.6px), rgba(255, 246, 225, 0.75) 50%, transparent calc(50% + 0.6px)) 0 0 / 2px 100% no-repeat; }
.oj-film__flick { background: #fff8e8; opacity: 0; }
/* the light leak: a warm burn of gold and red, wider than the frame, swept across it */
.oj-film__leak { left: -40%; right: -40%; opacity: 0;
  background:
    radial-gradient(ellipse 22% 55% at 42% 40%, rgba(255, 214, 140, 0.95), rgba(255, 170, 70, 0) 100%),
    radial-gradient(ellipse 30% 70% at 55% 55%, rgba(236, 118, 40, 0.75), rgba(236, 118, 40, 0) 100%),
    radial-gradient(ellipse 26% 80% at 66% 45%, rgba(170, 30, 30, 0.55), rgba(170, 30, 30, 0) 100%); }
/* the sprocket edges of the film strip, outside the roshan on both sides */
.oj-reel { position: absolute; width: 5.4%; z-index: 3; overflow: hidden; opacity: 0; pointer-events: none; will-change: transform, opacity;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent); }
.oj-reel--l { left: -6.2%; }
.oj-reel--r { right: -6.2%; }
.oj-reel i { position: absolute; left: 0; right: 0; top: 0; height: calc(100% + 40px); will-change: transform;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='20'%3E%3Crect width='16' height='20' fill='%23241409'/%3E%3Crect x='4' y='5' width='8' height='10' rx='2' fill='%23F7EBD3'/%3E%3C/svg%3E") 0 0 / 100% auto repeat-y; }
.oj.is-still .oj-reel, .oj.is-still .oj-film__leak { display: none; }

/* ---- F2 scan (journey.js f2*): the jump into the future ---- */
/* the canvas over the last band while the scan runs: the laser, the lock, the tiles streaming down */
.f2-cv { position: absolute; left: 0; z-index: 4; pointer-events: none; }
/* the last plate's caption comes in with the future; until then its slot holds the jump's subtitle */
.oj-band--tub:not(.oj-band--future) .oj-eb, .oj-band--tub:not(.oj-band--future) .oj-line { visibility: hidden; }
.oj-band--tub .oj-line { max-width: 34em; margin-inline: auto; }
.oj-band--future .oj-eb, .oj-band--future .oj-line { animation: f2-in 0.7s ease-out both; }
.oj.is-still .oj-band--future .oj-eb, .oj.is-still .oj-band--future .oj-line { animation: none; }
@keyframes f2-in { from { opacity: 0; transform: translate3d(0, 6px, 0); } to { opacity: 1; transform: none; } }
/* «وكبرت جدة…»: a small film subtitle with a clock racing forward, only while the jump runs */
.f2-sub { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 9px;
  white-space: nowrap; padding: 4px 16px 5px 12px; border-radius: 3px; background: rgba(28, 14, 8, 0.82); color: #F4E6C8; opacity: 0; pointer-events: none;
  font-family: "Cairo", sans-serif; font-weight: 600; font-size: 1.02rem; line-height: 1.5; letter-spacing: 0.01em; }
.f2-clock { position: relative; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid #D9A04A; background: #2A140A; }
.f2-clock i { position: absolute; left: 50%; bottom: 50%; width: 1.6px; margin-left: -0.8px; background: #FFE2A0; border-radius: 1px; transform-origin: 50% 100%; will-change: transform; }
.f2-h1 { height: 7px; }
.f2-h2 { height: 4.5px; width: 2.2px !important; margin-left: -1.1px !important; }
/* ---- M1 car (journey.js car*): the time-travel car that drives the piece into the future ---- */
.m1-car { position: absolute; left: 0; top: 0; width: 160px; height: 76px; z-index: 3; pointer-events: none; opacity: 0;
  transform-origin: 0 0; will-change: transform, opacity; }
.m1-car svg { display: block; width: 100%; height: 100%; overflow: visible; }
.m1-car--old { filter: brightness(0.9) sepia(0.62) contrast(0.96); }   /* in the old film it wears the film's colour */
.m1-car--up { z-index: 2; }                                              /* the door under the piece as it pops out */
/* the road the car waits on below the tannour: a paper strip with a dashed centre line */
.m1-road { position: absolute; left: 0; right: 0; height: 9px; pointer-events: none; opacity: 0;
  background: linear-gradient(#8B6B48, #8B6B48) 0 0 / 100% 1.5px no-repeat,
    repeating-linear-gradient(90deg, rgba(247, 235, 211, 0.95) 0 16px, transparent 16px 30px) 0 4px / 100% 1.6px no-repeat,
    rgba(120, 88, 56, 0.16);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }

/* ---- M1B: the lens and the present ---- */
/* the lens round the time hole: plate 6 hands over to its still on the canvas, which bends it (--lz: what is left) */
.m1-lensing::before, .m1-lensing > .oj-box { opacity: var(--lz, 0); }
/* the present: a clean daylight band, a faint modern lattice in brand red, no old stone; the plate is a framed shot */
.oj-band--tub {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M14.6 14.6H29.4V29.4H14.6ZM22 11.5L32.5 22 22 32.5 11.5 22ZM22 0V11.5M22 32.5V44M0 22H11.5M32.5 22H44' fill='none' stroke='%23820D13' stroke-opacity='.06' stroke-width='.8'/%3E%3C/svg%3E") center / 44px 44px,
    radial-gradient(60% 70% at 50% 45%, #FFFCF5, rgba(255, 252, 245, 0) 100%),
    linear-gradient(#FDF5E6, #F9EEDB 50%, #FDF5E6);
}
.oj-band--tub::before { display: none; }
.oj-band--tub .oj-art svg { border-radius: 8px; box-shadow: 0 18px 40px -22px rgba(74, 36, 14, 0.55), 0 2px 6px rgba(74, 36, 14, 0.12); overflow: hidden; }
.oj-band--tub .oj-label { margin-top: 18px; }
.oj-band--future .oj-eb { background: #820D13; color: #FBF2E0; clip-path: none; border-radius: 2px; }
/* the present fills its band like a frame of film: a taller last band on desktop; on a phone, room above the
   plate for the portal the car drops out of */
@media (min-width: 810px) { main#main { padding-bottom: calc(clamp(330px, 62vw, 880px) * 0.5625 + 210px); } }
@media (max-width: 809.98px) { main#main { padding-bottom: calc(var(--oj-band) + 150px); } .oj-band--tub { padding-top: 96px; } }
/* phone: room under the tannour's caption where the car parks, so nothing covers the oven */
@media (max-width: 809.98px) { #contact[data-oj] { margin-top: calc(var(--oj-band) + 120px); } .oj-band--oven { padding-bottom: 120px; } }

/* ---- the present, waiting for the car: the empty frame with a closed portal at its far edge, and «واليوم» ---- */
.oj-wait {
  position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 16 / 9; overflow: hidden; pointer-events: none;
  border-radius: 8px; background: linear-gradient(#FFFCF5, #F7EBD6); box-shadow: inset 0 0 0 2px #C38427, 0 18px 40px -22px rgba(74, 36, 14, 0.45);
}
.oj-wait__sheen { position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; will-change: transform;
  background: linear-gradient(100deg, transparent, rgba(195, 132, 39, 0.16) 50%, transparent); animation: oj-sheen 4.2s ease-in-out infinite; }
.oj-wait__glow { position: absolute; left: 11%; top: 66%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; will-change: opacity, transform;
  background: radial-gradient(closest-side, rgba(150, 215, 255, 0.85), rgba(80, 160, 255, 0.35) 45%, rgba(80, 160, 255, 0) 100%); animation: oj-glow 2.6s ease-in-out infinite; }
.oj[dir="rtl"] .oj-wait__glow { left: 89%; }
@keyframes oj-sheen { 0%, 30% { transform: translateX(0); } 100% { transform: translateX(350%); } }
@keyframes oj-glow { 0%, 100% { opacity: 0.45; transform: scale(0.8); } 50% { opacity: 0.9; transform: scale(1.08); } }
.oj-band--tub.oj-band--wait .oj-eb { visibility: visible; background: #820D13; color: #FBF2E0; clip-path: none; border-radius: 2px; }
.motion-off .oj-wait i { animation-play-state: paused; }
.oj-wait::before { content: ""; position: absolute; inset: 0; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M14.6 14.6H29.4V29.4H14.6ZM22 11.5L32.5 22 22 32.5 11.5 22ZM22 0V11.5M22 32.5V44M0 22H11.5M32.5 22H44' fill='none' stroke='%23C38427' stroke-opacity='.35' stroke-width='.8'/%3E%3C/svg%3E") center / 44px 44px; }
