/* Cinematic intro — isolated component. Runs once per browser session; see intro.js.
   Animates only opacity, transform and clip-path (no layout properties).
   Timeline (3.7 s total): 0.6 s darkness/silhouette · 1.8 s light reveal · 2.7 s vehicle scan · 3.3 s brand reveal · 3.7 s hand-off to hero. */

.intro {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  overflow: hidden;
  background: radial-gradient(120% 90% at 68% 42%, #0a2129 0%, #040a0f 55%, #010305 100%);
}

.intro.is-visible {
  display: block;
  animation: introOut 3.7s linear both;
}

/* Skip: quick fade-out instead of the timeline. */
.intro.is-leaving {
  animation: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.intro-stage {
  position: absolute;
  inset: 0;
}

.intro-car {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Base layer: the vehicle is barely visible, then sits in the dark. */
.intro-car-base {
  opacity: 0;
  filter: brightness(0.5) saturate(0.6);
  animation: introBase 3.7s linear both;
}

/* Lit layer: revealed left-to-right behind the scan line (45% → 100% of the viewport). */
.intro-car-lit {
  opacity: 0;
  filter: brightness(1.12) saturate(0.7);
  clip-path: inset(0 55% 0 45%);
  animation: introLit 3.7s linear both;
}

/* Cold, very faint sweep of light across the stage. */
.intro-light {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(140, 250, 225, 0.09) 50%, transparent 62%);
  opacity: 0;
  animation: introLight 3.7s linear both;
}

/* Thin mint scan line that travels across the vehicle. */
.intro-scan {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 45%;
  width: 1.5px;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(126, 242, 212, 0.85) 30%, rgba(126, 242, 212, 0.85) 70%, transparent);
  box-shadow: 0 0 14px rgba(126, 242, 212, 0.4);
  animation: introScan 3.7s linear both;
}

/* Original logo, revealed with a mask wipe. Size and proportions are kept from the site logo. */
.intro-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(170px, 24vw, 320px);
  height: auto;
  transform: translate(-50%, -50%);
  clip-path: inset(0 100% 0 0);
  animation: introLogo 3.7s linear both;
}

.intro-skip {
  font: 500 11px/1 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a9bdc7;
  background: rgba(4, 10, 15, 0.45);
  border: 1px solid rgba(169, 189, 199, 0.28);
  padding: 12px 14px;
  min-height: 40px;
  cursor: pointer;
  border-radius: 2px;
}

.intro-skip {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 2;
}

.intro-skip:hover,
.intro-skip:focus-visible {
  color: #e8f7f2;
  border-color: rgba(126, 242, 212, 0.6);
  outline: none;
}

/* Replay lives in the header next to NOTES (styled by the shared .notes-toggle rules). */
.intro-replay[hidden] {
  display: none !important;
}

@keyframes introOut {
  0%, 89.2% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes introBase {
  0% { opacity: 0; transform: translate3d(2.5%, 0, 0) scale(1.03); }
  16.2% { opacity: 0.28; transform: translate3d(1%, 0, 0) scale(1.02); }
  48.6% { opacity: 0.55; transform: translate3d(0, 0, 0) scale(1); }
  73% { opacity: 0.5; }
  89.2% { opacity: 0.12; }
  100% { opacity: 0; }
}

@keyframes introLit {
  0%, 48.6% { opacity: 1; clip-path: inset(0 55% 0 45%); }
  73% { opacity: 1; clip-path: inset(0 0 0 45%); }
  89.2% { opacity: 0.2; clip-path: inset(0 0 0 45%); }
  100% { opacity: 0; clip-path: inset(0 0 0 45%); }
}

@keyframes introLight {
  0% { opacity: 0; transform: translate3d(-60%, 0, 0); }
  16.2% { opacity: 1; }
  48.6% { opacity: 0; transform: translate3d(60%, 0, 0); }
  100% { opacity: 0; transform: translate3d(60%, 0, 0); }
}

@keyframes introScan {
  0%, 48.6% { opacity: 0; transform: translate3d(0, 0, 0); }
  52% { opacity: 1; }
  73% { opacity: 1; transform: translate3d(55vw, 0, 0); }
  76% { opacity: 0; transform: translate3d(55vw, 0, 0); }
  100% { opacity: 0; transform: translate3d(55vw, 0, 0); }
}

@keyframes introLogo {
  0%, 73% { opacity: 1; clip-path: inset(0 100% 0 0); }
  89.2% { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 0; clip-path: inset(0 0 0 0); }
}

@media (max-width: 640px) {
  .intro-car { object-position: 74% 50%; }
  .intro-logo { width: 58vw; }
  .intro-skip { right: 16px; bottom: 16px; }
}

/* ≤800px: Replay is an item in the mobile menu (see app.js), not a floating control. */
@media (max-width: 800px) {
  .intro-replay { display: none !important; }
}

.mobile-menu .mobile-menu-replay {
  grid-column: 1 / -1;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(142, 219, 200, 0.14);
  border-right: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.mobile-menu .mobile-menu-replay:hover,
.mobile-menu .mobile-menu-replay:focus-visible {
  background: rgba(142, 219, 200, 0.08);
  color: var(--mint);
  outline: none;
}

.mobile-menu .mobile-menu-replay[hidden] { display: none; }


@media (prefers-reduced-motion: reduce) {
  .intro,
  .intro.is-visible,
  .intro-car-base,
  .intro-car-lit,
  .intro-light,
  .intro-scan,
  .intro-logo { animation: none !important; }
  .intro { display: none !important; }
}
