/* ==========================================================================
   LAUNCH SCREEN
   Once per visit (LaunchScreen.liquid decides). The emblem assembles: the
   gold star turns into place, the light, teal and red facets glide in around
   it from the sides they belong to, and the letters of the wordmark rise one
   after another. Then the logo flies to the bar while the paper ground
   clears, and the bar's own logo takes over where it lands.

   Short distances, long easing, nothing bounces. 1.5 seconds in all.
   ========================================================================== */

.launch-screen {
  display: none;
}

.is-launching .launch-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background-color: var(--paper);
  pointer-events: none;
  animation: launch-screen-clear 460ms var(--ease-in-out) 1040ms both;
}

.launch-screen__logo {
  width: 280px;
  max-width: 66%;
  color: var(--ink);
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .launch-screen__logo {
    width: 380px;
  }
}

.launch-screen__logo svg {
  width: 100%;
  height: auto;
}

/* The flight to the bar, measured by the script; without a measurement the
   logo simply fades with the ground. */
.is-launch-measured .launch-screen__logo {
  animation: launch-screen-fly 500ms var(--ease-screen) 1000ms both;
}

/* The bar's logo stays out of sight until the flight has landed on it. */
.is-launching [data-launch-target] svg {
  animation: launch-screen-handover 1500ms step-end both;
}

/* THE EMBLEM */

.is-launching .launch-screen .esquire-logo__gold {
  animation: launch-screen-star 820ms var(--ease-out) both;
}

.is-launching .launch-screen .esquire-logo__light {
  animation: launch-screen-light 760ms var(--ease-out) 120ms both;
}

.is-launching .launch-screen .esquire-logo__teal {
  animation: launch-screen-teal 760ms var(--ease-out) 180ms both;
}

.is-launching .launch-screen .esquire-logo__red {
  animation: launch-screen-red 760ms var(--ease-out) 240ms both;
}

/* THE WORDMARK */

.is-launching .launch-screen .esquire-logo__wordmark path {
  animation: launch-screen-letter 600ms var(--ease-out) both;
}

.is-launching .launch-screen .esquire-logo__wordmark path:nth-child(1) {
  animation-delay: 400ms;
}

.is-launching .launch-screen .esquire-logo__wordmark path:nth-child(2) {
  animation-delay: 440ms;
}

.is-launching .launch-screen .esquire-logo__wordmark path:nth-child(3) {
  animation-delay: 480ms;
}

.is-launching .launch-screen .esquire-logo__wordmark path:nth-child(4) {
  animation-delay: 520ms;
}

.is-launching .launch-screen .esquire-logo__wordmark path:nth-child(5) {
  animation-delay: 560ms;
}

.is-launching .launch-screen .esquire-logo__wordmark path:nth-child(6) {
  animation-delay: 600ms;
}

.is-launching .launch-screen .esquire-logo__wordmark path:nth-child(7) {
  animation-delay: 640ms;
}

/* KEYFRAMES */

@keyframes launch-screen-star {
  from {
    opacity: 0;
    transform: rotate(-90deg) scale(0.4);
  }
}

@keyframes launch-screen-light {
  from {
    opacity: 0;
    transform: translate(-30px, 0);
  }
}

@keyframes launch-screen-teal {
  from {
    opacity: 0;
    transform: translate(22px, -26px);
  }
}

@keyframes launch-screen-red {
  from {
    opacity: 0;
    transform: translate(22px, 26px);
  }
}

@keyframes launch-screen-letter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes launch-screen-fly {
  to {
    color: var(--launch-color, var(--ink));
    transform: translate(var(--launch-x), var(--launch-y)) scale(var(--launch-scale));
  }
}

@keyframes launch-screen-clear {
  99% {
    background-color: transparent;
    visibility: visible;
  }
  100% {
    background-color: transparent;
    visibility: hidden;
  }
}

@keyframes launch-screen-handover {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
