/*
 * The launch screen, one design everywhere: the icon's yellow edge to edge, so its square melts into
 * the screen and only the note stays, in the middle (light and dark alike: it's the brand, not the page).
 * The web app shows it (index.html) until the first screen is drawn; iPhone's launch images are this
 * same page photographed per screen size, at rest (scripts/splash.mjs), and Android draws its own from
 * the manifest (the icon on its background_color). That one is the paper colour, not this yellow: Android
 * also paints the installed app's navigation bar with it, the whole time the app is open. The page under
 * it, and the phone's bar, are the same yellow while it's there, so nothing dark shows before it or around it.
 *
 * The note holds still, as the launch image does, so nothing jumps from one to the other. Only its heart
 * beats, once (lub-dub) and rests, never looping: a loop would read as "loading". The heart is a layer of
 * its own (public/splash-heart.png, cut from icon-512.png) right over the one in the icon, and only grows,
 * so the one under it never shows. Once the app is ready (src/lib/splash.ts) the screen fades to it.
 */
html:has(#splash) {
  background: #fddd4d;
}

#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #fddd4d;
  transition: opacity 360ms cubic-bezier(0.4, 0, 0.2, 1);
}

#splash .door {
  position: relative;
}

#splash img {
  display: block;
  width: 176px;
  height: 176px;
}

/* Where the heart is in icon-512.png: x 92-208, y 68-176 of 512 */
#splash img.heart {
  position: absolute;
  left: 17.96875%;
  top: 13.28125%;
  width: 22.65625%;
  height: 21.09375%;
  transform-origin: 49% 55%;
  animation: splash-heartbeat 560ms 140ms ease-in-out both;
}

@keyframes splash-heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.16);
  }
  32% {
    transform: scale(1);
  }
  48% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(1);
  }
}

#splash.leaving {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  #splash {
    transition: none;
  }

  #splash img.heart {
    animation: none;
  }
}
