/* The photographic surface and its final frame share the same ink throughout. */
.clarity .last-light { position: relative; isolation: isolate; }
.clarity .last-light-scene { z-index: -2; }
.film-poster-surface { isolation: isolate; position: relative; width: 100%; height: 100%; }
.film-poster-surface::after,
.film-transition::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url('/assets/film-grain-v52.png') repeat; background-size: 210px;
  mix-blend-mode: soft-light; opacity: .48;
}
.clarity .last-light-scene img { filter: sepia(.21) saturate(.78) contrast(.95); }
.clarity .last-light::before {
  z-index: -1;
  background: linear-gradient(180deg, rgba(57,47,53,.30), transparent 24%, transparent 48%, rgba(57,47,53,.36) 72%, rgba(57,47,53,.82));
}
.clarity .last-light.is-film-open::before { opacity: var(--film-shade-opacity, 0); }
.clarity .last-light.is-film-open .film-poster-surface,
.clarity .last-light.is-film-open > :is(.last-light-top, h2, .last-light-bottom) { opacity: 0; pointer-events: none; }
.clarity .last-light > :is(.last-light-top, h2, .last-light-bottom) { position: relative; z-index: 5; }
.film-transition {
  display: none; position: absolute; inset: 3svh 4vw; overflow: hidden; z-index: 4;
  pointer-events: none; contain: paint; isolation: isolate; transform: scale(var(--horizon-scale, 1));
}
.film-transition::after { z-index: 1; opacity: calc(.48 * var(--film-grain-visibility, 1)); }
.film-transition::before {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(57,47,53,.30), transparent 24%, transparent 48%, rgba(57,47,53,.36) 72%, rgba(57,47,53,.82));
  opacity: var(--film-grain-visibility, 1);
}
.film-transition.is-fallback::before, .film-transition.is-fallback::after { opacity: 0; }
.film-transition canvas { display: block; width: 100%; height: 100%; }
.film-transition.is-fallback { background: #392f35; }
.film-stage {
  position: absolute; inset: 3svh 4vw; z-index: 3;
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(16px, 2.4vw, 34px);
  background: #392f35; color: #faf7f2;
  transform: scale(var(--horizon-scale, 1)); transform-origin: center;
}
.film-stage[hidden] { display: none; }
body:has(.last-light.is-film-open.is-film-in-view) .mobile-dock { visibility: hidden; pointer-events: none; }
.film-stage .film-header {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin: 0; flex-shrink: 0;
}
.film-stage .film-header > span { font: 400 clamp(22px, 2vw, 30px)/1.15 var(--font-display), serif; }
.film-stage .film-header button {
  display: inline-flex; align-items: center; gap: 14px; min-height: 44px;
  padding: 8px 0 8px 16px; border: 0; border-bottom: 1px solid rgba(250,247,242,.42);
  background: transparent; color: #faf7f2; font: 400 15px/1.3 var(--font-body), sans-serif;
  transition: border-color .25s ease;
}
.film-stage .film-header button:hover { border-color: #faf7f2; }
.film-stage :is(button, a):focus-visible { outline: 2px solid #faf7f2; outline-offset: 5px; }
.film-close-icon { font-size: 25px; font-weight: 400; line-height: 1; }
.film-screen { display: grid; place-items: center; flex: 1; min-height: 0; min-width: 0; }
.last-light[data-film-state='opening'] .film-screen { pointer-events: none; }
.film-screen video { display: block; width: 100%; height: 100%; min-height: 0; max-height: 100%; object-fit: contain; background: #392f35; }
.film-stage .film-note { flex-shrink: 0; margin: 0; font-size: 14px; line-height: 1.45; color: #faf7f2; }
.film-stage .film-note a { text-decoration: underline; text-underline-offset: 4px; margin-left: .25em; }
.film-status:empty { display: none; }
.film-stage .film-status { margin: 0; font-size: 14px; line-height: 1.4; }
@media (max-width: 640px) {
  .film-stage { inset: 50% 4vw auto; gap: 20px; padding: 22px 16px; transform: translateY(-50%) scale(var(--horizon-scale, 1)); }
  .film-stage .film-header { align-items: center; gap: 12px; }
  .film-stage .film-header > span { max-width: 12ch; font-size: 25px; }
  .film-stage .film-header button { padding-left: 8px; gap: 8px; font-size: 14px; }
  .film-screen { flex: none; }
  .film-screen video { height: auto; aspect-ratio: 16 / 9; }
}
@media (max-height: 600px) and (orientation: landscape) {
  .film-stage { inset: 50% 4vw auto; height: calc(100svh - var(--bar-height, 80px) - 32px); padding: 10px 18px; gap: 8px; transform: translateY(-50%) scale(var(--horizon-scale, 1)); }
  .film-stage .film-header > span { max-width: none; font-size: 24px; }
  .film-screen { flex: 1; }
  .film-screen video { height: 100%; aspect-ratio: auto; }
  .film-stage .film-note { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .film-transition { display: none !important; } }
@media print { .film-stage, .film-transition { display: none; } }
