/* CSS-only letterpress entrance. JS creates six small paper sheets; the
   browser only composites transform and opacity. */
#loader {
  align-items: center;
  background: var(--paper);
  display: grid;
  inset: 0;
  justify-items: center;
  overflow: hidden;
  position: fixed;
  transition:
    opacity 300ms ease,
    visibility 300ms ease;
  z-index: 1000;
}

#loader.is-done {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.loader-stack {
  height: 220px;
  position: relative;
  width: min(330px, 72vw);
}
.loader-paper {
  background: var(--paper-soft);
  border: 1px solid var(--ink);
  box-shadow: 3px 4px 0 var(--paper-edge);
  clip-path: polygon(
    0 0,
    100% 0,
    100% 95%,
    94% 100%,
    88% 96%,
    80% 100%,
    72% 96%,
    64% 100%,
    56% 96%,
    48% 100%,
    40% 96%,
    32% 100%,
    24% 96%,
    16% 100%,
    8% 96%,
    0 100%
  );
  inset: 0;
  opacity: 0;
  padding: 0.9rem;
  position: absolute;
  transform: translateY(-70px) rotate(calc(var(--rot) * 3));
}
#loader.is-ready .loader-paper {
  animation: paper-drop 430ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  animation-delay: var(--d);
}
.loader-paper:nth-child(1) {
  --rot: -3deg;
  --d: 0ms;
}
.loader-paper:nth-child(2) {
  --rot: 2.5deg;
  --d: 100ms;
}
.loader-paper:nth-child(3) {
  --rot: -2deg;
  --d: 200ms;
}
.loader-paper:nth-child(4) {
  --rot: 3deg;
  --d: 300ms;
}
.loader-paper:nth-child(5) {
  --rot: -1.5deg;
  --d: 400ms;
}
.loader-paper:nth-child(6) {
  --rot: 2deg;
  --d: 500ms;
}

@keyframes paper-drop {
  65% {
    opacity: 1;
    transform: translateY(4px) rotate(var(--rot));
  }
  to {
    opacity: 1;
    transform: rotate(var(--rot));
  }
}

#loader.is-tearing .loader-paper {
  animation: paper-tear 400ms ease-in forwards;
  animation-delay: calc(var(--d) * 0.25);
}
@keyframes paper-tear {
  to {
    opacity: 0;
    transform: translate(calc(var(--rot) * 10px), -90px) rotate(calc(var(--rot) * 5));
  }
}

.loader-paper__club {
  border-bottom: 2px solid var(--accent);
  font-family: var(--font-display);
  font-size: var(--fs-md);
  line-height: 1;
  padding-bottom: 0.4rem;
  text-transform: uppercase;
}
.loader-paper__line {
  background: var(--ink-rule);
  height: 4px;
  margin-top: 0.65rem;
  opacity: 0.55;
}
.loader-paper__line--short {
  width: 58%;
}
.loader-status {
  bottom: 12%;
  position: absolute;
  text-align: center;
  width: min(330px, 72vw);
}
.loader-status__text,
.loader-skip {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.loader-progress {
  background: var(--paper-edge);
  height: 2px;
  margin-top: 0.55rem;
}
.loader-progress__fill {
  background: var(--accent);
  height: 100%;
  width: 0;
}
#loader.is-ready .loader-progress__fill {
  animation: loader-fill 1.35s linear forwards;
}
@keyframes loader-fill {
  to {
    width: 100%;
  }
}
.loader-skip {
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  bottom: 1rem;
  padding: 0.35rem 0.65rem;
  position: absolute;
  right: 1rem;
}
.loader-skip:hover {
  color: var(--accent);
}

@media (max-width: 520px) {
  .loader-stack {
    height: 190px;
  }
}
