/* Ample Studio 1:1 Loading Animation Overlay & Transition Styles */
/* Ported directly from thesayak.com */

.preloader-overlay {
  z-index: 100000;
  contain: layout paint;
  will-change: transform;
  background: #ffffff;
  place-items: center;
  display: grid;
  position: fixed;
  inset: 0;
  overflow: hidden;
  transform: translate(0);
}

.preloader-overlay.preloader-playing {
  animation: 0.8s cubic-bezier(0.76, 0, 0.24, 1) 5s forwards reveal-site;
}

.loader-visual {
  aspect-ratio: 700 / 685;
  opacity: 0;
  width: clamp(132px, 16vw, 180px);
  position: relative;
}

.loader-visual-ready {
  opacity: 1;
}

.battery {
  z-index: 1;
  transform-origin: 50%;
  align-items: center;
  width: 52px;
  height: 18px;
  display: flex;
  position: absolute;
  top: calc(3% - 2px);
  left: 50%;
  transform: translate(-50%);
}

.loader-visual-ready .battery {
  animation: 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) 4.48s both battery-ready;
}

.battery-body {
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid #161616;
  border-radius: 5px;
  flex: 1;
  align-items: stretch;
  gap: 2px;
  height: 18px;
  padding: 2.5px;
  display: flex;
}

.battery-cell {
  opacity: 0;
  transform-origin: 50%;
  background: linear-gradient(#39eba0 0%, #24cb71 100%);
  border-radius: 1.5px;
  flex: 1;
  transform: scaleY(0.55);
}

.loader-visual-ready .battery-cell {
  animation: 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards charge-cell;
}

.battery-cell:first-child { animation-delay: 0.45s; }
.battery-cell:nth-child(2) { animation-delay: 1.4s; }
.battery-cell:nth-child(3) { animation-delay: 2.35s; }
.battery-cell:nth-child(4) { animation-delay: 3.3s; }
.battery-cell:nth-child(5) { animation-delay: 4.25s; }

.battery-terminal {
  background: #161616;
  border-radius: 0 2px 2px 0;
  flex-shrink: 0;
  width: 3px;
  height: 7px;
}

.character {
  aspect-ratio: 700 / 685;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  width: 100%;
  display: block;
}

.character img {
  width: 100%;
  height: 100%;
  display: block;
}

#app.siteRevealing {
  will-change: opacity;
  animation: 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) 5s both site-fade-in;
}

#app.siteRevealing::after {
  z-index: 99999;
  content: "";
  pointer-events: none;
  background: #0d99ff;
  animation: 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) 5s both blue-wash;
  position: fixed;
  inset: 0;
}

html.preloader-skipped #app-preloader {
  display: none !important;
}

html.preloader-skipped #app.siteRevealing {
  opacity: 1 !important;
  animation: none !important;
}

html.preloader-skipped #app.siteRevealing::after {
  display: none !important;
}

@keyframes reveal-site {
  0% { transform: translate(0, 0); }
  to { transform: translateY(-100%); }
}

@keyframes reveal-site-mobile {
  0% {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    transform: translate(0, 0);
  }
  25% {
    border-bottom-right-radius: 24px;
    border-bottom-left-radius: 24px;
  }
  to {
    border-bottom-right-radius: 32px;
    border-bottom-left-radius: 32px;
    transform: translateY(-102%);
  }
}

@keyframes battery-ready {
  0%, to { transform: translate(-50%) scale(1); }
  55% { transform: translate(-50%) scale(1.08); }
}

@keyframes charge-cell {
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes site-fade-in {
  0% { opacity: 0.05; }
  to { opacity: 1; }
}

@keyframes blue-wash {
  0% { opacity: 0.55; }
  to { opacity: 0; }
}

@media (max-width: 600px) {
  .preloader-overlay {
    backface-visibility: hidden;
    height: 100dvh;
    transform: translate(0, 0);
  }
  .preloader-overlay.preloader-playing {
    animation: 0.78s cubic-bezier(0.32, 0.72, 0, 1) 5s forwards reveal-site-mobile;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.16);
  }
  .loader-visual, .character {
    width: 132px;
  }
  .battery {
    width: 46px;
    height: 16px;
  }
  .battery-body {
    gap: 1.5px;
    height: 16px;
    padding: 2px;
  }
  .battery-terminal {
    width: 2.5px;
    height: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .preloader-overlay.preloader-playing {
    animation-delay: 0.15s;
  }
  #app.siteRevealing, #app.siteRevealing::after, .battery {
    animation-delay: 0s;
  }
  .battery-cell {
    opacity: 1;
    transform: none;
    animation-delay: 0s !important;
  }
}
