/* Aeternus Visuals — opening flipbook intro
   Self-contained: pair with assets/intro/intro.js. Not wired into index.html yet. */

html.av-intro-lock,
html.av-intro-lock body { overflow: hidden; }

/* Covers the page between the <head> script running and the overlay mounting, so nothing flashes. */
html.av-intro-cover::after {
  content: "";
  position: fixed;
  inset: 0;
  background: #0a0909;
  z-index: 9990;
}

/* Hold the hero's own entrance animations until the intro hands off. */
html.av-intro-lock .hero-h1,
html.av-intro-lock .hero-scroll { animation-play-state: paused; }

.av-intro {
  position: fixed;
  inset: 0;
  z-index: 9990; /* below the site's custom cursor (9998/9999) */
  background: #0a0909;
  color: #f0eeeb;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

/* Sits where the nav brand sits, so the hand-off reads as one piece. */
.av-brand {
  position: absolute;
  top: 26px;
  left: 52px;
  line-height: 34px;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  animation: avFade .6s .15s both;
}

.av-box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  container-type: inline-size; /* lets the title scale with the frame */
}

.av-stack { position: absolute; inset: 0; }

/* "AETERNUS" with the last photo showing through the letters. Sized to the frame,
   so it grows with it when the frame opens to full screen. */
.av-title {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: .08em;
  font-family: 'Bebas Neue', 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 13vw;
  font-size: 26cqw;
  line-height: 1;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  background-size: cover;
  background-position: center;
  -webkit-background-clip: text;
  background-clip: text;
  /* Faint outline keeps letters readable where they cross dark parts of the photo. */
  -webkit-text-stroke: 1px rgba(240, 238, 235, .35);
  filter: brightness(1.25) saturate(1.1);
  opacity: 0;
}

/* Shutter blades: close to the middle and part again. */
.av-sh {
  position: absolute;
  left: 0;
  right: 0;
  height: 50.5%;
  z-index: 6;
  background: #0a0909;
  transform: scaleY(0);
}
.av-sh-t { top: 0;    transform-origin: top center; }
.av-sh-b { bottom: 0; transform-origin: bottom center; }

.av-frames {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #141212;
}
/* All frames stay painted (so each is ready the instant it's needed); the current one sits on top. */
.av-frames img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.av-frames img.on { z-index: 2; }
/* Blank screen over the frames until playback starts. */
.av-frames::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #141212;
}
.av-playing .av-frames::after { display: none; }

/* Viewfinder corners: they "lock on" to the frame as it opens. */
.av-c {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid rgba(240, 238, 235, .7);
  animation: avLock .45s cubic-bezier(.2, .8, .2, 1) both;
}
.av-tl { top: -12px;    left: -12px;  border-top-width: 1px;    border-left-width: 1px;  --dx: -26px; --dy: -26px; }
.av-tr { top: -12px;    right: -12px; border-top-width: 1px;    border-right-width: 1px; --dx: 26px;  --dy: -26px; }
.av-bl { bottom: -12px; left: -12px;  border-bottom-width: 1px; border-left-width: 1px;  --dx: -26px; --dy: 26px; }
.av-br { bottom: -12px; right: -12px; border-bottom-width: 1px; border-right-width: 1px; --dx: 26px;  --dy: 26px; }

.av-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 20px);
  height: 1px;
  background: rgba(240, 238, 235, .12);
  animation: avFade .6s .25s both;
}
.av-bar i {
  display: block;
  height: 100%;
  background: #e84040;
  transform-origin: left center;
  transform: scaleX(0);
}

.av-meta {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 30px);
  display: flex;
  justify-content: space-between;
  font-size: .55rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(240, 238, 235, .5);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  animation: avFade .6s .25s both;
}
.av-count b { font-weight: 500; color: #f0eeeb; }

.av-skip {
  position: absolute;
  right: 52px;
  bottom: 28px;
  padding: 8px 0;
  background: none;
  border: 0;
  color: rgba(240, 238, 235, .4);
  font: inherit;
  font-size: .55rem;
  letter-spacing: .35em;
  text-transform: uppercase;
  cursor: inherit;
  transition: color .25s;
  animation: avFade .6s .6s both;
}
.av-skip:hover { color: #f0eeeb; }

/* Exit: chrome fades, the frame opens to full screen. */
.av-out .av-c,
.av-out .av-bar,
.av-out .av-meta,
.av-out .av-skip {
  animation: none;
  opacity: 0;
  transition: opacity .3s ease;
}

@keyframes avFade { from { opacity: 0; } }
@keyframes avLock {
  from { opacity: 0; transform: translate(var(--dx), var(--dy)); }
}

/* Breakpoints mirror the site's nav padding so the brand lands exactly on it. */
@media (max-width: 900px) {
  .av-brand { top: 18px; left: 22px; line-height: 36px; }
  .av-skip { right: 22px; bottom: 22px; }
}
@media (max-width: 560px) {
  .av-brand { top: 16px; left: 18px; }
  .av-skip { right: 18px; bottom: 18px; }
  .av-meta { font-size: .5rem; letter-spacing: .22em; }
}
