/* Home page intro (see intro.js). Only active while <html> has the "intro" class. */

/* While the intro plays: no scrolling, and the real top section waits underneath. */
html.intro, html.intro body { overflow: hidden; }
html.intro .hero-bg nav,
html.intro .hero-bg .hero-photo { opacity: 0; animation: none; }
.hero-bg nav { transition: opacity .7s ease; }
.hero-bg .hero-photo { transition: opacity .5s ease; }

.intro-stage {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
  background: #0b0b0b;
  color: #ffffff;
}

/* The photo, as large as the screen allows, with soft edges */
.intro-photo {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(100vw, 92svh);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  transform-origin: 0 0;
  will-change: transform, filter, opacity;
}
.intro-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 24%, #000 76%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 10%, #000 78%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, transparent 0%, #000 24%, #000 76%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 10%, #000 78%, transparent 100%);
          mask-composite: intersect;
  animation: intro-photo-in 2.6s cubic-bezier(.2,.7,.2,1) both;
}

@keyframes intro-photo-in {
  from { opacity: 0; transform: scale(1.12); filter: brightness(.4); }
  to   { opacity: 1; transform: none; filter: brightness(.95); }
}

/* Darkens the bottom so the headline stays readable over the photo */
.intro-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(11,11,11,0) 50%, rgba(11,11,11,.6) 78%, rgba(11,11,11,.92) 100%);
  pointer-events: none;
}

/* The headline, in front of the photo: a bigger copy of the page headline, same font and
   same two lines, so it can travel into place without changing. */
.intro-title {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(11svh, 88px);
  transform: translateX(-50%);
  transform-origin: 0 0;
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: min(6vw, 9svh, 7rem);
  line-height: 1.18;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: left;
  text-shadow: 0 8px 40px rgba(0,0,0,.6);
  will-change: transform;
}
.intro-title .hero-line {
  display: block;
  opacity: 0;
  transform: translateY(40px);
  animation: intro-line-in 1.1s cubic-bezier(.2,.7,.2,1) forwards;
}
.intro-title .hero-line:nth-child(1) { animation-delay: .7s; }
.intro-title .hero-line:nth-child(2) { animation-delay: .95s; }

@keyframes intro-line-in {
  to { opacity: 1; transform: none; }
}

/* "Scroll" hint */
.intro-hint {
  position: absolute;
  z-index: 2;
  /* Centred with margins, so its fade-in animation (which moves it) can't push it sideways */
  left: 0;
  right: 0;
  width: max-content;
  margin: 0 auto;
  bottom: 3.5svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: rgba(255,255,255,.7);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  opacity: 0;
  animation: intro-line-in .8s ease 1.9s forwards;
}
.intro-hint span {
  position: relative;
  width: 2px;
  height: 34px;
  border-radius: 2px;
  background: rgba(255,255,255,.18);
  overflow: hidden;
}
.intro-hint span::after {
  content: '';
  position: absolute;
  left: 0;
  top: -40%;
  width: 100%;
  height: 40%;
  background: #008080;
  animation: intro-hint-line 1.6s ease-in-out 2.2s infinite;
}
@keyframes intro-hint-line {
  to { top: 100%; }
}
.intro-hint:hover { color: #ffffff; }

/* Leaving: the stage's hint and darkening fade while the photo and headline move into place */
.intro-stage.leaving .intro-hint { opacity: 0; animation: none; transition: opacity .3s ease; }
.intro-stage.leaving::after { opacity: 0; transition: opacity .6s ease; }

@media (max-width: 640px) {
  .intro-photo { top: 44%; }
  /* Headline tucked just under the photo, overlapping its faded bottom edge */
  .intro-title { bottom: auto; top: calc(44% + min(42vw, 38svh)); }
}

/* Dark cover until the intro stage is on screen, so the normal page never flashes first. */
html.intro body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 89;
  background: #0b0b0b;
}
html.intro .hero-bg h1,
html.intro .hero-bg h1 ~ * { opacity: 0; }
.intro-stage.leaving { pointer-events: none; }
