/* Load after posters.css. The last screen of the film. */
.project-notes {
  --notes-trigger-bottom: clamp(2.7rem, 7svh, 4.75rem);
  z-index: 5;
  inset: 0;
  width: auto;
  margin: 0;
  pointer-events: none;
}

.project-notes summary {
  position: absolute;
  bottom: var(--notes-trigger-bottom);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  padding: .65rem .1rem;
  font: 500 1.12rem/1.3 var(--title);
  letter-spacing: .01em;
  text-decoration: none;
  filter: var(--hover-defocus);
  transition: filter .45s var(--ease);
  pointer-events: auto;
  white-space: nowrap;
}

@media (hover: hover) {
  .project-notes summary:hover { filter: blur(0); }
}
.project-notes summary:is(:active, :focus-visible),
.project-notes[open] > summary { filter: blur(0); }
@media (hover: none) and (pointer: coarse) {
  .project-notes summary {
    filter: none;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 1.2px currentColor;
    transition: text-shadow .2s var(--ease), -webkit-text-fill-color .2s var(--ease);
  }
  .project-notes summary:is(:active, :focus-visible), .project-notes[open] > summary {
    filter: none;
    -webkit-text-fill-color: currentColor;
    text-shadow: none;
  }
}

.project-choices { transition: visibility 0s; }

.project-choices > * {
  transform: translate(0, -50%);
  transition: transform .25s var(--ease), opacity .2s var(--ease);
  transition-delay: var(--tick-stagger, 0ms);
}

.stage:has(.project-notes[open]) .project-choices {
  visibility: hidden;
  transition-delay: .35s;
}

.stage:has(.project-notes[open]) .project-choices > * {
  transform: translate(3rem, -50%);
  opacity: 0;
}

.stage:has(.project-notes[open]) .project-choices button { pointer-events: none; }

.project-notes .notes-sheet {
  --sheet-ground: #0b0b0a;
  --sheet-ink: #f5eddf;
  --sheet-secondary: var(--ui-ink);
  width: min(72rem, calc(100vw - 2 * var(--gutter)));
  height: min(54svh, 34rem, calc((100vw - 2 * var(--gutter)) / 2.1), calc(100svh - 9rem));
  max-height: none;
  padding: clamp(3.5rem, 6vw, 5rem) clamp(1.5rem, 7vw, 7rem);
  top: 50%;
  bottom: auto;
  color: var(--sheet-ink);
  background: radial-gradient(ellipse at 50% 0%, rgb(245 237 223 / 3%), transparent 65%), var(--sheet-ground);
  border: 0;
  --screen-radius: clamp(.8rem, 1.35vw, 1.35rem);
  border-radius: var(--screen-radius);
  box-shadow: 0 2rem 7rem rgb(0 0 0 / 70%);
  transform: translate(-50%, -50%);
  container-type: inline-size;
  text-align: center;
  font: 400 clamp(1.13rem, 1.7vw, 1.3rem)/1.6 var(--title);
  scrollbar-width: none;
  scroll-padding-block: 2rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  overflow-wrap: anywhere;
  pointer-events: auto;
}

.project-notes .notes-sheet::-webkit-scrollbar { display: none; }

.project-notes .notes-sheet:focus-visible {
  outline-offset: -6px;
}

/* Focus the projected words independently of the aperture and native scroll. */
.notes-contents {
  min-width: 0;
  display: flow-root;
  transform-origin: 50% 0%;
}
.project-notes[data-focusing] .notes-contents {
  animation: credits-focus 3800ms linear both;
}
.project-notes[data-focusing] .notes-contents:focus-within {
  animation: none;
}
@keyframes credits-focus {
  0%, 19% { opacity: 0; filter: blur(12px); transform: scale(.978); }
  42% { opacity: .12; filter: blur(6px); transform: scale(.99); }
  64% { opacity: .6; filter: blur(1.8px); transform: scale(1.008); }
  79% { opacity: .9; filter: blur(.15px); transform: scale(1.003); }
  89% { opacity: .97; filter: blur(.65px); transform: scale(.999); }
  100% { opacity: 1; filter: blur(0); transform: scale(1); }
}

@media (hover: none) and (pointer: coarse) {
  @keyframes credits-focus {
    0%, 19% { opacity: 0; transform: scale(.978); }
    42% { opacity: .12; text-shadow: 0 0 6px currentColor; -webkit-text-fill-color: transparent; transform: scale(.99); }
    64% { opacity: .6; text-shadow: 0 0 2px currentColor; -webkit-text-fill-color: transparent; transform: scale(1.008); }
    79% { opacity: .9; text-shadow: 0 0 .5px currentColor; -webkit-text-fill-color: currentColor; transform: scale(1.003); }
    100% { opacity: 1; text-shadow: none; -webkit-text-fill-color: currentColor; transform: scale(1); }
  }
  .notes-projection .notes-projector-beam, .notes-projection .notes-projector-haze { filter: none; }
}

.notes-frame {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  --screen-radius: clamp(.8rem, 1.35vw, 1.35rem);
  border-radius: var(--screen-radius);
  isolation: isolate;
  pointer-events: auto;
}
.project-notes[open] .notes-frame { display: block; }
.notes-screen {
  position: relative;
  border-radius: inherit;
  --leak-visibility: .64;
}
.project-notes .notes-frame .notes-sheet {
  position: relative;
  inset: auto;
  transform: none;
}
.notes-frame .notes-close {
  position: absolute;
  z-index: 3;
  top: .75rem;
  right: .85rem;
}

/* A full-screen optical wash meets the cone at the bottom of the aperture. */
.notes-projection {
  --projection-duration: 2200ms;
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  pointer-events: none;
  opacity: 0;
  mask-image: linear-gradient(transparent, #000 5%, #000 94%, transparent);
}
.notes-projection::before,
.notes-projector-beam,
.notes-projector-beam::before,
.notes-projector-haze,
.notes-projector-haze::before,
.notes-projection::after {
  position: absolute;
  inset: 0;
}
.notes-projection::before,
.notes-projector-beam::before,
.notes-projector-haze::before,
.notes-projection::after {
  content: '';
}
.notes-projection::before {
  bottom: auto;
  height: var(--projection-screen-height);
  border-radius: var(--screen-radius);
  background:
    radial-gradient(ellipse at 46% 65%, rgb(255 229 188 / 10%), transparent 76%),
    linear-gradient(110deg, rgb(244 218 178 / 4%), rgb(255 236 204 / 8%) 48%, rgb(244 218 178 / 4%));
}
.notes-projector-beam {
  top: var(--projection-screen-height);
  filter: blur(11px);
}
.notes-projector-beam::before {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: radial-gradient(ellipse at 50% 100%,
    rgb(255 226 180 / 22%), rgb(245 210 161 / 13%) 43%, rgb(245 210 161 / 6%) 83%);
}
.notes-projector-haze {
  bottom: auto;
  height: var(--projection-screen-height);
  overflow: hidden;
  opacity: .8;
  filter: blur(18px);
  mask-image: radial-gradient(ellipse at 50% 53%, #000 20%, transparent 74%);
}
.notes-projector-haze::before {
  inset: -65%;
  background:
    conic-gradient(from 23deg at 50% 68%,
      transparent 0deg, rgb(255 232 195 / 17%) 28deg, transparent 57deg,
      rgb(250 219 174 / 4%) 103deg, transparent 141deg,
      rgb(255 236 204 / 20%) 188deg, transparent 222deg,
      rgb(255 227 187 / 10%) 285deg, transparent 326deg),
    radial-gradient(ellipse at 37% 43%, rgb(255 231 192 / 13%), transparent 28%),
    radial-gradient(ellipse at 62% 61%, rgb(255 231 192 / 11%), transparent 24%);
  transform-origin: 50% 68%;
}
.notes-projection::after {
  clip-path: polygon(0 0, 100% 0, 100% var(--projection-screen-height),
    50% 100%, 0 var(--projection-screen-height));
  background:
    radial-gradient(circle at 43% 14%, rgb(255 235 201 / 54%) 0 .7px, transparent 1.6px),
    radial-gradient(circle at 55% 25%, rgb(255 235 201 / 44%) 0 .8px, transparent 1.8px),
    radial-gradient(circle at 29% 33%, rgb(255 235 201 / 38%) 0 .6px, transparent 1.7px),
    radial-gradient(circle at 73% 41%, rgb(255 235 201 / 48%) 0 .8px, transparent 1.8px),
    radial-gradient(circle at 48% 46%, rgb(255 235 201 / 44%) 0 .7px, transparent 1.6px),
    radial-gradient(circle at 35% 51%, rgb(255 235 201 / 42%) 0 .8px, transparent 1.9px),
    radial-gradient(circle at 58% 71%, rgb(255 235 201 / 40%) 0 .6px, transparent 1.7px),
    radial-gradient(circle at 52% 77%, rgb(255 235 201 / 42%) 0 .7px, transparent 1.7px),
    radial-gradient(circle at 46% 87%, rgb(255 235 201 / 36%) 0 .8px, transparent 1.9px);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 15%, transparent 76%);
  opacity: 0;
}
.project-notes[data-projecting] .notes-projection {
  animation: credits-projector var(--projection-duration) ease-out both;
}
.project-notes[data-projecting] .notes-projector-haze::before {
  animation: credits-scatter var(--projection-duration) cubic-bezier(.2,.5,.5,1) both;
}
.project-notes[data-projecting] .notes-projection::after {
  animation: credits-dust var(--projection-duration) ease-out both;
}
@keyframes credits-projector {
  0% { opacity: 0; }
  17% { opacity: .8; }
  30%, 55% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes credits-scatter {
  0% { transform: rotate(-26deg) scale(.94); }
  55% { transform: rotate(15deg) scale(1.04); }
  100% { transform: rotate(48deg) scale(1.12); }
}
@keyframes credits-dust {
  0%, 12% { opacity: 0; transform: translate(-2px, 7px); }
  31%, 64% { opacity: .85; }
  100% { opacity: 0; transform: translate(5px, -15px); }
}

/* Fixed mattes let the native scroll read as a roll through a film aperture. */
.notes-screen::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(to bottom,
    #0b0b0a 0%, rgb(11 11 10 / 94%) 3%, transparent 15%,
    transparent 87%, rgb(11 11 10 / 88%) 98%, #0b0b0a 100%);
}

.project-notes .notes-sheet h2:not(.film-title) {
  max-width: 18ch;
  padding: 0;
  margin: .25rem auto 2.6rem;
  border: 0;
  font: 400 clamp(2.65rem, 5vw, 4.5rem)/1.02 var(--title);
  text-transform: none;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.project-notes .notes-sheet .film-title {
  margin: .25rem auto 2.6rem;
  color: var(--paper);
  font-size: clamp(1.45rem, min(8.7cqi, 10svh), 5.7rem);
}

.project-notes .notes-sheet h3 {
  margin-block: 2.8rem .9rem;
  font: italic 400 1.1rem/1.3 var(--title);
  letter-spacing: .035em;
  text-transform: none;
  color: var(--sheet-secondary);
}

.project-notes .notes-sheet p,
.project-notes .notes-sheet dl {
  max-width: 52ch;
  margin-inline: auto;
}

.project-notes .notes-sheet dl:not(.notes-film-data) {
  max-width: 40ch;
  text-align: center;
  padding-block: .6rem 1.4rem;
}

.project-notes .notes-sheet p + p {
  margin-top: 1.2rem;
}

.project-notes .notes-sheet dt {
  color: var(--sheet-secondary);
  font-size: .85em;
  font-style: italic;
}

.project-notes .notes-sheet dd {
  margin: .1rem 0 0;
  font-size: 1.1em;
}

.project-notes .notes-sheet dd + dt {
  margin-top: 1.8rem;
}

.notes-film-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem 1.5rem;
}

.project-notes .notes-sheet strong {
  color: var(--sheet-ink);
  font-weight: 500;
}

.project-notes .notes-sheet a {
  color: var(--ui-ink);
  text-decoration-color: rgb(191 191 191 / 45%);
}

.project-notes .notes-sheet a:hover {
  text-decoration-color: currentColor;
}

.slide:has(.project-notes[open]) .poster-copy {
  opacity: 0;
  pointer-events: none;
  transition-duration: .24s, .72s;
}

.slide .poster-image {
  transition: opacity .56s var(--ease);
}

.slide:has(.project-notes[open]) .poster-image {
  opacity: .46;
}

@media (max-width: 640px) {
  .project-notes .notes-sheet {
    width: calc(100vw - 2rem);
    height: min(56svh, 30rem, calc(100svh - 7.5rem));
    padding: 3.5rem 1.5rem 2.5rem;
    font-size: 1.12rem;
  }

  .project-notes .notes-sheet h2:not(.film-title) {
    margin-bottom: 2rem;
    font-size: clamp(2.45rem, 10vw, 3.4rem);
  }
  .project-notes .notes-sheet .film-title { margin-bottom: 2rem; }

  .project-notes .notes-sheet h3 {
    margin-top: 2.25rem;
  }

}

@media (max-height: 520px) {
  .project-notes { --notes-trigger-bottom: 2.35rem; }
  .project-notes .notes-sheet {
    height: min(64svh, calc(100svh - 7rem));
    padding-top: 3.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notes-projection { display: none; }
  .project-notes[data-focusing] .notes-contents { animation: none; }
  .project-notes *,
  .slide:has(.project-notes[open]) .poster-copy {
    transition: none !important;
  }
}
