:root {
  color-scheme: dark;
  --pulse: 1;
  --film-brightness: 1;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

body {
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

button {
  color: inherit;
  font: inherit;
}

#cosmos-shell,
#black-hole-fill,
#black-hole-film {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#cosmos-shell {
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  clip-path: circle(0 at 50% 50%);
}

.scene-live #cosmos-shell {
  animation: universe-born 5.4s cubic-bezier(.22, .65, .3, 1) forwards;
}

#black-hole-fill {
  z-index: 0;
  display: block;
  object-fit: cover;
  opacity: .42;
  transform: scale(1.04);
  transition: transform 4.2s cubic-bezier(.4, 0, .2, 1), opacity 2s ease;
}

#black-hole-film {
  z-index: 1;
  inset: auto;
  top: 50%;
  left: 50%;
  width: min(100vw, 383.24vh);
  height: auto;
  display: block;
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) scale(var(--pulse));
  transform-origin: 50% 50%;
  filter: brightness(var(--film-brightness));
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
  transition: transform 4.2s cubic-bezier(.4, 0, .2, 1), opacity 2s ease;
}

#singularity-seed {
  position: fixed;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff5dd;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.25);
  box-shadow: 0 0 4px rgba(255, 245, 221, .8), 0 0 18px rgba(255, 221, 164, .35);
  pointer-events: none;
}

.seed-live #singularity-seed {
  animation: seed-awakens 2.7s ease-in-out forwards;
}

#opening {
  position: fixed;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

h1 {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(1040px, calc(100% - 48px));
  margin: 0;
  color: #fff;
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: 42px;
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: 0;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -44%);
  transition: opacity 2.8s ease, transform 2.8s ease;
  text-wrap: balance;
}

.words-live h1 {
  opacity: 1;
  transform: translate(-50%, -50%);
}

#begin-journey {
  position: absolute;
  left: 50%;
  bottom: max(58px, calc(env(safe-area-inset-bottom) + 42px));
  min-width: 178px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 2px;
  background: rgba(0, 0, 0, .18);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 1.8s ease, transform 1.8s ease, border-color .35s ease, background-color .35s ease;
  pointer-events: none;
}

.action-live #begin-journey {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

#begin-journey:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, .08);
}

#begin-journey:focus-visible,
#contact-link:focus-visible,
#music-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

#contact-link {
  position: fixed;
  z-index: 5;
  left: max(24px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  min-height: 36px;
  align-items: center;
  color: inherit;
  font-size: 12px;
  text-decoration: none;
  opacity: 0;
  transition: opacity 1.6s ease;
}

#music-toggle {
  position: fixed;
  z-index: 5;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  min-width: 76px;
  min-height: 36px;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  letter-spacing: 0;
  text-align: right;
  cursor: pointer;
  opacity: 0;
  transition: opacity 1.6s ease, color .35s ease;
}

.music-ui-live #contact-link,
.music-ui-live #music-toggle {
  opacity: .48;
}

.music-ui-live #contact-link:hover,
.music-ui-live #music-toggle:hover,
.music-ui-live #music-toggle[aria-pressed="true"] {
  opacity: .9;
}

.departing h1,
.departing #begin-journey {
  opacity: 0;
  pointer-events: none;
  transition-duration: 1.4s;
}

.departing #begin-journey {
  transform: translate(-50%, 8px);
}

.departing #black-hole-film {
  opacity: .72;
  transform: translate(-50%, -50%) scale(.72);
}

.departing #black-hole-fill {
  opacity: .5;
  transform: scale(1.02);
}

.engine-fallback #black-hole-fill,
.engine-fallback #black-hole-film {
  display: none;
}

.engine-fallback #cosmos-shell {
  opacity: 1;
  clip-path: none;
}

.engine-fallback #cosmos-shell::before,
.engine-fallback #cosmos-shell::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(255, 228, 183, .16);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
}

.engine-fallback #cosmos-shell::before {
  width: min(55vw, 640px);
  height: min(12vw, 140px);
}

.engine-fallback #cosmos-shell::after {
  width: min(18vw, 210px);
  height: min(18vw, 210px);
  border-color: rgba(255, 255, 255, .08);
  background: #000;
}

@keyframes universe-born {
  0% {
    opacity: 0;
    clip-path: circle(0 at 50% 50%);
  }
  12% {
    opacity: 1;
    clip-path: circle(2px at 50% 50%);
  }
  100% {
    opacity: 1;
    clip-path: circle(80vmax at 50% 50%);
  }
}

@keyframes seed-awakens {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.25);
  }
  28% {
    opacity: .75;
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(4);
  }
}

@media (max-width: 700px) {
  h1 {
    width: calc(100% - 42px);
    font-size: 30px;
    line-height: 1.32;
  }

  #begin-journey {
    bottom: max(72px, calc(env(safe-area-inset-bottom) + 54px));
  }

  #music-toggle {
    right: 18px;
    bottom: max(15px, env(safe-area-inset-bottom));
  }

  #contact-link {
    left: 18px;
    bottom: max(15px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  #cosmos-shell,
  #black-hole-fill,
  #black-hole-film,
  #singularity-seed,
  h1,
  #contact-link,
  #begin-journey {
    animation: none !important;
    transition-duration: .25s !important;
  }

  .scene-live #cosmos-shell {
    opacity: 1;
    clip-path: none;
  }

  .seed-live #singularity-seed {
    opacity: 0;
  }
}
