/* =========================================================================
   THE DOOR — يمان
   The visitor enters through the bowl of the noon that closes her name in
   Arabic, and lands in the street Yammah was filmed in.

   Layers, back to front: the video window (clipped), the mark, the rim.
   Only transform, opacity and clip-path are animated.
   ========================================================================= */

.door {
  position: relative;
  background: var(--ink);
  /* vh first: iOS before 15.4 drops svh and would collapse the stage to zero */
  height: 100vh;
  height: 100svh;
}
/* The stage used to run 240svh on a mouse so the pin could stick and the wheel
   could scrub the dive. But the sting also plays itself on a timer, and it
   always won: it landed at scrollY 0 and left 1260px of sticky runway that
   scrolled nothing, so the page only started moving on the twelfth notch.
   One screen on every pointer, the same as touch, and the first notch moves. */

.door__pin {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--ink);
}

/* ---- 1. the window on the other side ------------------------------------ */

.door__window {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  -webkit-clip-path: circle(0px at 50% 50%);
  clip-path: circle(0px at 50% 50%);
  will-change: clip-path;
}
/* The counter-zoom lives on an inner element: scaling the clipped box would
   scale the hole with it. */
.door__zoom {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  transform: scale(1.4);
  transform-origin: 50% 50%;
  will-change: transform;
}
.door__zoom video,
.door__zoom img {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--grade);
}
/* One <video> now; the cut is chosen by <source media> in the markup. */

/* ---- 2. the mark, and 3. the rim over the footage ------------------------ */

.door__mark,
.door__rim {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.door__mark { z-index: 1; }
.door__rim { z-index: 3; }
.door__window { z-index: 2; }

.door__la { fill: var(--flame); }
.door__ar { fill: var(--flame); }
.door__rimline {
  fill: none;
  stroke: var(--flame-lift);
  stroke-width: 3;
  opacity: 0;
}

/* The one sign of life: a warm light comes up inside the bowl of the noon,
   so the aperture reads as a way in before anything moves. */
/* Light spilling out of the bowl, drawn over the footage so it is actually
   seen. It is the only thing that moves before the dive. */
.door__glow {
  fill: none;
  stroke: var(--gold);
  stroke-width: 10;
  opacity: 0;
  filter: blur(9px);
}
.door.is-live .door__glow {
  animation: doorGlow 1600ms var(--out) 260ms both;
}
@keyframes doorGlow {
  0%   { opacity: 0;   stroke-width: 4;  }
  55%  { opacity: 0.9; stroke-width: 13; }
  100% { opacity: 0.4; stroke-width: 8;  }
}
@media (prefers-reduced-motion: reduce) {
  /* The decorative breath goes; the dive stays. */
  .door.is-live .door__glow { animation: none; opacity: 0.55; stroke-width: 9; }
}

/* ---- the landed state --------------------------------------------------- */

.door__land {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--gutter);
  padding-bottom: clamp(3rem, 12vh, 7rem);
  opacity: 0;
  visibility: hidden;
  transition: opacity 620ms var(--out);
}
.door__land::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  /* Measured against the footage, not guessed: the credit and the replay sat at
     3.0:1 under the old ramp. It climbs hard over the bottom 46% where every
     line of type lives, then releases so her face is not behind a scrim. */
  background: linear-gradient(to top,
    rgba(7, 9, 14, 0.94) 0%,
    rgba(7, 9, 14, 0.86) 34%,
    rgba(7, 9, 14, 0.62) 46%,
    rgba(7, 9, 14, 0.10) 60%,
    rgba(7, 9, 14, 0.38) 100%);
  pointer-events: none;
}
.door.is-landed .door__land { opacity: 1; visibility: visible; }

/* The landing is set like a line of the bill: a flame rule opens it, the
   credit runs under it with the year hanging at the right, a hairline closes
   it. Before this the door delivered into a quote over footage, which is the
   one arrangement every artist site already has. */
.door__land { --door-measure: min(100%, calc(var(--t-h2) * 8.8)); }
@media (max-width: 620px) { .door__land { --door-measure: 100%; } }
.door__say {
  position: relative;
  max-width: var(--door-measure);
  padding-top: var(--s4);
  border-top: 2px solid var(--flame-deep);
  font-family: var(--display);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 42;
  font-weight: 700;
  font-size: var(--t-h2);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--paper);
  text-wrap: balance;
}
.door__cite {
  position: relative;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s3);
  max-width: var(--door-measure);
  margin-top: var(--s3);
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mute);
}
.door__acts {
  position: relative;
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
@media (max-width: 620px) {
  .door__acts .btn { flex: 1 1 100%; justify-content: center; }
}

.door__replay {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 0.2rem;
  min-height: 44px;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
  transition: color 220ms var(--out);
}
.door__replay svg { width: 15px; height: 15px; }

.door__cue {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--t-micro);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mute-dim);
}
.door__cue svg { width: 11px; height: 18px; }
/* Below 900px the box office owns this edge and overlaps the cue outright.
   The bar is the better affordance there, so the cue stands down. */
@media (max-width: 899px) { .door__cue { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  .door.is-landed .door__cue svg { animation: doorNudge 2.6s var(--in-out) infinite; }
}
@keyframes doorNudge {
  0%, 70%, 100% { transform: translateY(0); opacity: 0.75; }
  85%           { transform: translateY(4px); opacity: 1; }
}

/* While the dive runs the page is held still, or one momentum fling scrolls
   straight past it. A safety timer in the script always lifts this. */
body.door-open .boxoffice { display: none; }

html.door-hold,
html.door-hold body {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

/* ---- the mark's type ----------------------------------------------------
   The viewBox is the stage in px, so one user unit is one pixel and the same
   clamps the rest of the site uses work here. */

.door__la {
  font-family: var(--display);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 30;
  font-weight: 700;
  font-size: var(--t-h2);
  letter-spacing: -0.02em;
  opacity: 0.92;
}
.door__ar {
  font-family: var(--arabic-display);
  font-weight: 700;
  /* The Arabic leads on the door because the Arabic is the door: the bigger
     the bowl, the gentler the zoom that has to swallow the screen. */
  font-size: var(--t-mark);
  direction: rtl;
}

/* ------------------------------------------------------------------
   Hover belongs to a pointer that can hover. On iOS a tapped element
   keeps its hover state until something else is tapped, so an
   unguarded :hover reads as a control stuck mid-press. These are the
   same rules, behind the one query that keeps them off a thumb.
   ------------------------------------------------------------------ */
@media (hover: hover) and (pointer: fine) {
  .door__replay:hover { color: var(--flame-lift); 
  }
}

.door__cite .num { color: var(--plaster); letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
