/* ================= VIDEO INTRO ================= */
#envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--envelope-bg-mid);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  transition: opacity 1.6s ease;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#envelope-screen.hide {
  opacity: 0;
  pointer-events: none;
}

#envelope-screen.gone {
  display: none;
}

.video-intro-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.intro-video-poster {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 135%;
  height: 135%;
  transform: translate3d(-50%, -50%, 0);
  object-fit: cover;
  object-position: center center;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.35s ease;
  pointer-events: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.intro-video-poster.is-hidden {
  opacity: 0;
}

.intro-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 135%;
  height: 135%;
  transform: translate3d(-50%, -50%, 0);
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.video-intro-wrap.is-playing .intro-video,
.intro-video.intro-video--ready {
  opacity: 1;
}

.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: calc(clamp(48px, 10vh, 80px) + env(safe-area-inset-bottom, 0px));
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.video-overlay.playing {
  opacity: 0;
  pointer-events: none;
}

.video-overlay.loading .video-instruction {
  animation: none;
  opacity: 0.85;
  transform: none;
}

.video-instruction {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(13px, 2.2vw, 17px);
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #241d14;
  margin: 0;
  margin-inline-start: 14px;
  opacity: 0;
  animation: fadeInInstruction 1.2s ease forwards 0.8s;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

@keyframes fadeInInstruction {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 0.85;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .intro-video-poster,
  .intro-video {
    width: 125%;
    height: 125%;
  }

  .video-instruction {
    letter-spacing: 0.28em;
    font-size: 12px;
    padding: 0 16px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-video-poster,
  .intro-video,
  .video-instruction {
    animation: none !important;
    opacity: 1;
  }

  .video-instruction {
    transform: none;
  }

  #envelope-screen {
    transition-duration: 0.6s;
  }
}
