/* ============================================================
   NIGHT NINE — THE SECOND FACE (scene-night9-faces.js)
   Her face comes up out of the dark with the eyes running red
   and says what he did. Then another face comes through it,
   warm, and says something small and alive. Sized in
   percentages of the overlay — the page is zoomed.
   ============================================================ */
#n9Faces {
  position: fixed;
  inset: 0;
  z-index: 1000020;
  background: #000;
  opacity: 0;
  transition: opacity 0.9s ease;
  overflow: hidden;
  cursor: default;
  user-select: none;
}
#n9Faces.n9f-up  { opacity: 1; }
#n9Faces.n9f-out { opacity: 0; transition: opacity 1.5s ease; pointer-events: none; }

#n9Faces .n9f-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.18s ease, transform 1.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  transform: scale(1);
}
/* she comes nearer with every line */
#n9Faces[data-near="1"] .n9f-stage { transform: scale(1.1); }
#n9Faces[data-near="2"] .n9f-stage { transform: scale(1.24); }
#n9Faces[data-near="3"] .n9f-stage { transform: scale(1.42); }
/* the other face stands where it stands */
#n9Faces.n9f-kindly .n9f-stage { transform: scale(1.03); transition: opacity 0.6s ease, transform 5s ease-out; }

#n9Faces .n9f-frames {
  position: relative;
  height: 96%;
  aspect-ratio: 1 / 1;
  max-width: 96%;
}
#n9Faces .n9f-frames img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
/* her: four pictures on one spot — the eyes as they were, the red at their
   rims, the tears, the sockets. The first comes out of a blur; the rest
   arrive on the hit. Each is set so the eyes stay on one line. */
#n9Faces .n9f-her { transition: opacity 0.25s ease; }
#n9Faces .n9f-her.n9f-on { opacity: 1; }
#n9Faces .n9f-h0, #n9Faces .n9f-h1 { transform: translateY(-2%); }
#n9Faces .n9f-h2 { transform: translateY(4%); }
#n9Faces .n9f-h3 { transform: translateY(2.8%) scale(0.92); }
#n9Faces .n9f-h0 { filter: blur(16px) brightness(0.75); transition: opacity 3.2s ease, filter 3.4s ease; }
#n9Faces .n9f-h0.n9f-on { filter: blur(0) brightness(1); }
#n9Faces .n9f-h0.n9f-past { opacity: 0; transition: opacity 0.25s ease; }
#n9Faces .n9f-h3.n9f-on { filter: saturate(1.25) contrast(1.08); }
#n9Faces .n9f-her.n9f-gone { opacity: 0; filter: blur(10px) saturate(0.2) brightness(0.6); transition: opacity 3.4s ease, filter 3.4s ease; }

/* the other one: a face in the same dark, warm, whole */
#n9Faces .n9f-kind {
  filter: blur(10px) brightness(0.7);
  transition: opacity 3.6s ease, filter 3.8s ease;
  -webkit-mask-image: radial-gradient(ellipse 50% 52% at 50% 46%, #000 30%, rgba(0, 0, 0, 0.72) 55%, rgba(0, 0, 0, 0.28) 78%, rgba(0, 0, 0, 0) 98%);
          mask-image: radial-gradient(ellipse 50% 52% at 50% 46%, #000 30%, rgba(0, 0, 0, 0.72) 55%, rgba(0, 0, 0, 0.28) 78%, rgba(0, 0, 0, 0) 98%);
}
#n9Faces .n9f-kind.n9f-on { opacity: 1; filter: blur(0) brightness(1); }
#n9Faces .n9f-kind.n9f-rest { opacity: 0; filter: blur(8px) brightness(0.8); transition: opacity 2.4s ease, filter 2.4s ease; }

/* a line is said: the face steps back into the dark */
#n9Faces.n9f-said .n9f-stage { opacity: 0.1; transition: opacity 0.7s ease, transform 1.5s cubic-bezier(0.2, 0.7, 0.2, 1); }

/* the hit between lines */
#n9Faces .n9f-frames.n9f-jolt   { animation: n9fJolt 0.34s steps(1, end) 1; }
#n9Faces .n9f-frames.n9f-jolt-2 { animation: n9fJoltHard 0.5s steps(1, end) 1; }

/* the red comes in from the edges; later the gold takes its place */
#n9Faces .n9f-red, #n9Faces .n9f-gold {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
#n9Faces .n9f-red {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 44%, rgba(90, 0, 0, 0.22) 74%, rgba(120, 0, 0, 0.5) 100%);
  transition: opacity 1.6s ease;
}
#n9Faces[data-near="1"] .n9f-red { opacity: 0.4; }
#n9Faces[data-near="2"] .n9f-red { opacity: 0.75; }
#n9Faces[data-near="3"] .n9f-red { opacity: 1; animation: n9fPulse 1.05s ease-in-out infinite; }
#n9Faces.n9f-kindly .n9f-red { opacity: 0; animation: none; transition: opacity 2.8s ease; }
#n9Faces .n9f-gold {
  background: radial-gradient(ellipse at 50% 46%, rgba(255, 196, 120, 0.16) 0%, rgba(196, 140, 70, 0.08) 42%, rgba(0, 0, 0, 0) 72%);
  transition: opacity 3.4s ease;
}
#n9Faces.n9f-kindly .n9f-gold { opacity: 1; }

/* the voices */
#n9Faces .n9f-word {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-family: 'Special Elite', 'Courier Prime', 'Courier New', Courier, monospace;
  font-size: 1.85rem;
  line-height: 1.5;
  letter-spacing: 0.12em;
  color: #efe6e2;
  text-shadow: 0 0 16px rgba(170, 20, 20, 0.7), 0 0 2px rgba(255, 220, 220, 0.5);
  opacity: 0;
  filter: blur(7px);
  transition: opacity 0.8s ease, filter 0.9s ease;
  pointer-events: none;
}
#n9Faces .n9f-word.n9f-on { opacity: 1; filter: blur(0); }
/* the other voice: low on the picture, warm, small */
#n9Faces .n9f-word.n9f-warm {
  top: 86%;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: #f3e6cf;
  text-shadow: 0 0 10px #000, 0 0 24px #000, 0 0 16px rgba(196, 140, 70, 0.55);
}

@keyframes n9fJolt {
  0%   { filter: brightness(1.9) contrast(1.3); transform: translate(3px, -2px); }
  30%  { filter: brightness(0.5); transform: translate(-3px, 2px); }
  60%  { filter: brightness(1.3); transform: translate(1px, 1px); }
  100% { filter: none; transform: none; }
}
@keyframes n9fJoltHard {
  0%   { filter: brightness(2.3) contrast(1.4); transform: translate(6px, -4px) scale(1.015); }
  20%  { filter: brightness(0.35); transform: translate(-7px, 3px); }
  40%  { filter: brightness(1.7); transform: translate(4px, 4px) scale(1.01); }
  70%  { filter: brightness(0.75); transform: translate(-2px, -2px); }
  100% { filter: none; transform: none; }
}
@keyframes n9fPulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  #n9Faces .n9f-stage { transition: opacity 0.4s ease; transform: none !important; }
  #n9Faces .n9f-frames.n9f-jolt, #n9Faces .n9f-frames.n9f-jolt-2 { animation: none; }
  #n9Faces[data-near="3"] .n9f-red { animation: none; }
}
