.loading { height: 260px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.loading span { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); animation: loading-dot .7s ease-in-out infinite alternate; }
.loading span:nth-child(2) { animation-delay: .12s; }
.loading span:nth-child(3) { animation-delay: .24s; }

.page-loading-screen {
  position: fixed;
  z-index: 3000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.page-loading-stage {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  background: #333;
  transition: opacity .45s ease .38s;
}
.page-loading-screen.is-complete .page-loading-stage { opacity: 0; }

.page-loading-vessel { display: grid; place-items: center; }
.page-loading-letter {
  position: relative;
  z-index: 1;
  width: 74px;
  height: 74px;
  background: rgba(255, 255, 255, .2);
  -webkit-mask: var(--asimov-mark);
  mask: var(--asimov-mark);
}
/* The same glyph again, filled and clipped to a rising waterline. */
.page-loading-letter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper);
  -webkit-mask: var(--asimov-mark);
  mask: var(--asimov-mark);
  clip-path: polygon(0 100%, 0 89%, 16% 84%, 31% 90%, 47% 84%, 63% 89%, 79% 83%, 100% 88%, 100% 100%);
  animation: loading-water 2.8s cubic-bezier(.42, 0, .2, 1) var(--page-loading-delay, 0ms) infinite;
}
.page-loading-reveal {
  position: absolute;
  inset: 0;
  z-index: 2;
  isolation: isolate;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.page-loading-reveal::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 8px;
  background: #333;
  transform: translateX(-50%);
}
.page-loading-screen.is-complete .page-loading-reveal::before {
  animation: loading-join-clear .01s linear .83s forwards;
}
.page-loading-screen.is-complete .page-loading-reveal { visibility: visible; }
.page-loading-seam {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background: var(--paper);
  opacity: 0;
  transform: translate(-50%, 101%);
}
.page-loading-panel {
  position: absolute;
  z-index: 0;
  top: 50%;
  width: 71vmax;
  height: 142vmax;
  overflow: hidden;
  background: #333;
}
.page-loading-panel-left { left: calc(50% + 1px); transform: translate(-100%, -50%); }
.page-loading-panel-right { left: calc(50% - 1px); transform: translateY(-50%); }
.page-loading-screen.is-complete .page-loading-seam {
  animation: loading-seam .65s cubic-bezier(.93, 0, .1, 1.01) .08s both, loading-seam-fade .1s ease .73s forwards;
}
.page-loading-screen.is-complete .page-loading-panel-left {
  animation: loading-panel-left-round .42s ease-out .75s both, loading-panel-left-exit .9s ease-in-out .83s forwards;
}
.page-loading-screen.is-complete .page-loading-panel-right {
  animation: loading-panel-right-round .42s ease-out .75s both, loading-panel-right-exit .9s ease-in-out .83s forwards;
}

@keyframes loading-seam {
  from { opacity: 1; transform: translate(-50%, 101%); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes loading-seam-fade {
  to { opacity: 0; }
}
@keyframes loading-join-clear {
  to { opacity: 0; }
}
@keyframes loading-panel-left-round {
  to { border-bottom-right-radius: 100%; }
}
@keyframes loading-panel-right-round {
  to { border-bottom-left-radius: 100%; }
}
@keyframes loading-panel-left-exit {
  to { transform: translate(-100%, -50%) translateX(-101%); }
}
@keyframes loading-panel-right-exit {
  to { transform: translateY(-50%) translateX(101%); }
}

@keyframes loading-dot { to { opacity: .25; } }
@keyframes loading-water {
  0%, 12% { clip-path: polygon(0 100%, 0 89%, 16% 84%, 31% 90%, 47% 84%, 63% 89%, 79% 83%, 100% 88%, 100% 100%); }
  52%, 72% { clip-path: polygon(0 100%, 0 24%, 16% 18%, 31% 25%, 47% 19%, 63% 25%, 79% 17%, 100% 23%, 100% 100%); }
  100% { clip-path: polygon(0 100%, 0 89%, 16% 84%, 31% 90%, 47% 84%, 63% 89%, 79% 83%, 100% 88%, 100% 100%); }
}
@media (prefers-reduced-motion: reduce) {
  .page-loading-screen { transition: opacity .14s ease, visibility .14s ease; }
  .page-loading-screen.is-complete { opacity: 0; visibility: hidden; pointer-events: none; }
  .page-loading-reveal { display: none; }
  .loading span,
  .page-loading-letter::after { animation: none; }
  .page-loading-letter::after { clip-path: polygon(0 100%, 0 42%, 16% 37%, 31% 43%, 47% 37%, 63% 43%, 79% 36%, 100% 42%, 100% 100%); }
}
