/* A22 landing — the screening room: one film at a time, dark stage,
   projector-sweep transitions, file index down the right edge */

:root {
  --black: #0a0a0c;
  --ink: #f2f0eb;
  --muted: #8a8a92;
  --hairline: rgba(242, 240, 235, 0.16);
  --accent: #8a1e2d;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--black);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---- the curtain (cold open) ---- */

.curtain {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  cursor: pointer;
  transition: opacity 1.1s ease 0.4s;
  /* the veil is opaque; the light only plays on its surface
     (JS drives --mx/--my/--r, children inherit) */
  --mx: 50vw; --my: 44vh; --r: 150px;
}

/* heavier grain swims inside the pool of light */
.veil-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(circle calc(var(--r) * 1.25) at var(--mx) var(--my),
    #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 78%);
  mask-image: radial-gradient(circle calc(var(--r) * 1.25) at var(--mx) var(--my),
    #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 78%);
}

/* the ident sits in the dark; it glows only where the light passes */
.curtain-lit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle calc(var(--r) * 1.6) at var(--mx) var(--my),
    #000 0%, rgba(0, 0, 0, 0.45) 52%, transparent 80%);
  mask-image: radial-gradient(circle calc(var(--r) * 1.6) at var(--mx) var(--my),
    #000 0%, rgba(0, 0, 0, 0.45) 52%, transparent 80%);
}

.curtain-lit .curtain-mark { color: var(--ink); }

/* warm light pooled on the fabric */
.lens {
  position: fixed;
  inset: 0;
  z-index: 41;
  pointer-events: none;
  mix-blend-mode: screen;
  --mx: 50vw; --my: 44vh; --r: 150px;
  background:
    radial-gradient(circle calc(var(--r) * 0.45) at var(--mx) var(--my),
      rgba(244, 238, 226, 0.07) 0%, transparent 80%),
    radial-gradient(circle calc(var(--r) * 1.6) at var(--mx) var(--my),
      rgba(244, 238, 226, 0.1) 0%, transparent 72%);
  transition: opacity 0.9s ease;
}

.lens.off { opacity: 0; }

.curtain-plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

.curtain-mark {
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: 0.2em;
  margin-left: 0.2em; /* optically recenter tracked text */
  color: rgba(242, 240, 235, 0.14); /* nearly lost in the dark until lit */
  animation: mark-in 2.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes mark-in { from { opacity: 0; letter-spacing: 0.42em; } to { opacity: 1; letter-spacing: 0.2em; } }

/* leaving: wordmark tracks out like end credits, curtain lifts */
.curtain.exit { opacity: 0; pointer-events: none; }
.curtain.exit .curtain-mark { animation: mark-out 1.1s cubic-bezier(0.6, 0, 0.8, 1) both; }

@keyframes mark-out { to { opacity: 0; letter-spacing: 0.55em; } }

/* ---- power-on: the room comes to life after the curtain ----
   the screening room is live beneath the veil (that's what the light
   reveals), so only the chrome hides pre-entry; the frame just flickers
   and settles as the curtain lifts */

body:not(.entered) .nav,
body:not(.entered) .arrow,
body:not(.entered) .rail,
body:not(.entered) .bar { opacity: 0 !important; }

body.entered .frame-wrap { animation: power-on 1.4s 0.2s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
body.entered .nav  { animation: fade-up 0.9s 1.0s ease backwards; }
body.entered .rail { animation: fade-up 0.9s 1.15s ease backwards; }
body.entered .bar  { animation: fade-up 0.9s 1.3s ease backwards; }
body.entered .arrow { animation: arrow-in 0.9s 1.15s ease backwards; }

@keyframes power-on {
  0%   { transform: scale(0.985); filter: brightness(0.85); }
  35%  { filter: brightness(1.55); }
  50%  { filter: brightness(0.8); }
  66%  { filter: brightness(1.18); }
  100% { transform: none; filter: none; }
}

@keyframes fade-up  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes arrow-in { from { opacity: 0; } to { opacity: 0.35; } }

/* ---- nav ---- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 32px;
}

.nav .mark {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.28em;
  color: var(--ink);
  text-decoration: none;
}

.nav .links a {
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.75;
}

.nav .links a:hover { opacity: 1; }

/* ---- the room ---- */

.theater {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* light spilling from the screen into the room; hue follows the film */
.room-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.4s ease;
  background: radial-gradient(58% 46% at 50% 44%,
              hsl(var(--h, 214) 45% 13% / 0.6) 0%, transparent 72%);
}

.room-glow.on { opacity: 1; }

/* ---- the screen ---- */

.frame-wrap {
  position: relative;
  z-index: 5;
  width: min(48vw, 750px);
}

.frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: #000;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.55);
}

.film {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.film.active { opacity: 1; }

.film video, .film .ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.82) saturate(0.95);
}

/* per-company placeholder footage, hue set inline via --h */
.ph {
  background:
    radial-gradient(120% 100% at 78% 18%, hsl(var(--h) 42% 16%) 0%, transparent 62%),
    radial-gradient(150% 110% at 15% 85%, hsl(var(--h) 34% 11%) 0%, transparent 58%),
    linear-gradient(160deg, hsl(var(--h) 30% 5%) 0%, hsl(var(--h) 38% 9%) 48%, hsl(var(--h) 28% 4%) 100%);
  background-size: 180% 180%;
  animation: drift 26s ease-in-out infinite alternate;
}

@keyframes drift {
  from { background-position: 0% 0%; }
  to   { background-position: 100% 100%; }
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* projector sweep between reels */
.shutter {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #000;
  transform: translateX(-101%);
  pointer-events: none;
}

.shutter.sweep { animation: sweep 950ms cubic-bezier(0.65, 0, 0.35, 1) both; }

@keyframes sweep {
  0%   { transform: translateX(-101%); }
  45%  { transform: translateX(0); }
  55%  { transform: translateX(0); }
  100% { transform: translateX(101%); }
}

/* ---- progress + titles ---- */

.progress {
  height: 1px;
  margin-top: -1px;
  background: rgba(242, 240, 235, 0.12);
  position: relative;
  z-index: 6;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.titles {
  display: flex;
  align-items: baseline;
  gap: 22px;
  margin-top: 20px;
}

.file-no, .stage-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.file-no::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 12px;
  background: var(--accent);
}

/* A24-style title card: substantial uppercase letterforms */
.film-name {
  margin: 0;
  font-weight: 650;
  font-size: clamp(26px, 3.2vw, 44px);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

/* title-card entrance, restarted per film */
.titles.enter .film-name { animation: track-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) both; }
.titles.enter .file-no   { animation: rise-in 0.9s 0.05s ease both; }
.titles.enter .stage-tag { animation: rise-in 0.9s 0.15s ease both; }

@keyframes track-in { from { opacity: 0; letter-spacing: 0.14em; } to { opacity: 1; letter-spacing: 0; } }
@keyframes rise-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- arrows ---- */

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 24px;
  padding: 18px;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.4s ease;
}

.arrow:hover { opacity: 1; }
.arrow-prev { left: max(18px, 4vw); }
.arrow-next { right: max(72px, 7vw); }

/* ---- file index rail ---- */

.rail {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: right;
}

.idx {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.4s ease, color 0.4s ease;
  white-space: nowrap;
}

.idx .nm {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  vertical-align: bottom;
  opacity: 0;
  transition: max-width 0.7s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease,
              margin-right 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.idx:hover, .idx.current { opacity: 1; color: var(--ink); }

.idx:hover .nm, .idx.current .nm {
  max-width: 220px;
  opacity: 1;
  margin-right: 12px;
}

.idx.current .no { color: var(--accent); }

/* ---- bottom bar ---- */

.bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  padding: 20px 32px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.bar a { color: var(--muted); text-decoration: none; }
.bar a:hover { color: var(--ink); }

/* ---- mobile ---- */

@media (max-width: 760px) {
  .frame-wrap { width: 86vw; }
  .titles { flex-wrap: wrap; gap: 10px 16px; margin-top: 16px; }
  .film-name { font-size: 28px; width: 100%; order: 2; }
  .arrow { display: none; }
  .rail {
    top: auto;
    bottom: 58px;
    right: 0;
    left: 0;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 16px;
    text-align: center;
  }
  .idx .nm { display: none; }
  .nav { padding: 18px 20px; }
  .bar { padding: 16px 20px; }
}
