/* The homepage intro overlay: the screen starts as the hero's blue, the P fills with water and
   sinks, and the edges pull in to the hero card's rectangle. Static (outside React), so its timings
   run from first paint, or from when a background tab is first shown. The fallbacks mirror
   variables.css, which may not have loaded yet.
   The edges start as the P finishes sinking, and the blue screen is gone before the hero copy shows:
   the page's <main> carries a transform, so nothing inside it can be raised above this layer. */
.intro-overlay {
  display: none;
}

html.intro .intro-overlay {
  display: contents;
}

html.intro .intro-surface,
html.intro .intro-p {
  position: fixed;
  pointer-events: none;
}

html.intro .intro-surface {
  --g: var(--gutter, 28px);
  inset: 0;
  z-index: 1500;
  background: var(--c-blue, #76c3fe) url(pattern-light-blue.jpg) center / cover no-repeat;
  animation: intro-frame 0.47s cubic-bezier(0.5, 0, 0, 1) 1.32s both, intro-gone 0s 1.79s forwards;
}

html.intro .intro-p {
  --pw: clamp(96px, 12vw, 168px);
  left: 50%;
  top: 50%;
  z-index: 2002;
  width: var(--pw);
  aspect-ratio: 344 / 482;
  margin-left: calc(var(--pw) / -2);
  margin-top: calc(var(--pw) / 0.7137 / -2);
  animation: intro-settle 0.32s cubic-bezier(0.45, 0, 0.35, 1) 1.1s both, intro-gone 0s 1.44s forwards;
}

.intro-p svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: intro-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.intro-vessel {
  fill: var(--c-off-white, #f1f4f7);
}

.intro-water-back {
  fill: var(--c-blue-deep, #3a84f7);
}

.intro-water-front {
  fill: var(--c-navy, #223749);
}

.intro-level {
  transform: translateY(520px);
}

.intro-back {
  animation: intro-fill 0.85s cubic-bezier(0.45, 0, 0.3, 1) 0.05s both;
}

.intro-front {
  animation: intro-fill 0.9s cubic-bezier(0.45, 0, 0.3, 1) 0.1s both;
}

.intro-drift {
  animation: intro-drift 1.15s linear 2;
}

.intro-drift-back {
  animation-duration: 1.6s;
  animation-direction: reverse;
}

.intro-sinkLevel {
  transform: translateY(560px);
  animation: intro-sink 0.32s cubic-bezier(0.45, 0, 0.35, 1) 1.1s both;
}

/* A tab opened in the background holds the intro on its first frame until it is shown (intro.js).
   Important, because the app's intro rules set the animation shorthand, which resets the play state. */
html.intro-held *,
html.intro-held *::before,
html.intro-held *::after {
  animation-play-state: paused !important;
}

@media (max-width: 768px) {
  html.intro .intro-surface {
    --g: var(--gutter, 16px);
  }
}

@media (prefers-reduced-motion: reduce), print {
  html.intro .intro-overlay {
    display: none;
  }
}

/* Ends exactly on the hero card: one gutter at the sides and bottom, the header's clearance on top. */
@keyframes intro-frame {
  from {
    inset: 0;
    border-radius: 0;
  }
  to {
    inset: var(--header-clearance, calc(var(--g) * 2 + 74px)) var(--g) var(--g);
    border-radius: var(--radius-card, 20px);
  }
}

@keyframes intro-pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
  }
}

@keyframes intro-fill {
  from {
    transform: translateY(520px);
  }
  to {
    transform: translateY(-10px);
  }
}

@keyframes intro-drift {
  to {
    transform: translateX(344px);
  }
}

@keyframes intro-sink {
  from {
    transform: translateY(560px);
  }
  to {
    transform: translateY(-40px);
  }
}

@keyframes intro-settle {
  to {
    transform: translateY(18px);
  }
}

@keyframes intro-gone {
  to {
    visibility: hidden;
  }
}
