@font-face {
  font-family: "Bebas Neue";
  src: url("/assets/bebas-neue.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --void: #050608;
  --bone: #ece4d5;
  --flare: #ff5b32;
  --signal: #8aa8d2;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--void);
}

body {
  color: var(--bone);
  text-rendering: optimizeLegibility;
}

.terminator {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(
      circle at 18% 23%,
      rgba(58, 87, 110, 0.18) 0,
      rgba(18, 30, 40, 0.08) 26%,
      transparent 44%
    ),
    linear-gradient(180deg, #07090d 0%, var(--void) 68%, #0d0e0d 100%);
}

.terminator::after {
  content: "";
  position: absolute;
  z-index: 7;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), transparent 26%),
    radial-gradient(circle at 50% 45%, transparent 46%, rgba(0, 0, 0, 0.3) 120%);
}

.terminator__stars {
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: 0.72;
  background:
    radial-gradient(circle at 63% 9%, rgba(236, 228, 213, 0.9) 0 1px, transparent 1.5px),
    radial-gradient(circle at 76% 17%, rgba(138, 168, 210, 0.78) 0 1px, transparent 1.5px),
    radial-gradient(circle at 89% 8%, rgba(236, 228, 213, 0.7) 0 1px, transparent 1.5px),
    radial-gradient(circle at 54% 28%, rgba(236, 228, 213, 0.62) 0 1px, transparent 1.5px),
    radial-gradient(circle at 94% 34%, rgba(236, 228, 213, 0.64) 0 1px, transparent 1.5px);
}

.terminator__word {
  position: absolute;
  z-index: 1;
  top: 14vh;
  left: 50%;
  margin: 0;
  color: var(--bone);
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(300px, 37.4vw, 620px);
  font-weight: 400;
  line-height: 0.7;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  transform: translateX(-50%) rotate(-0.8deg);
  transform-origin: 50% 50%;
  animation: word-arrives 900ms cubic-bezier(0.2, 0.74, 0.2, 1) both;
}

.terminator__earth {
  position: absolute;
  z-index: 2;
  top: -13vh;
  left: -8.5vw;
  display: block;
  width: min(47vw, 780px);
  height: auto;
  filter: saturate(0.78) contrast(1.04);
  animation: earth-arrives 1.25s 80ms cubic-bezier(0.2, 0.74, 0.2, 1) both;
}

.terminator__terrain {
  position: absolute;
  z-index: 3;
  bottom: -1px;
  left: 50%;
  display: block;
  width: 112vw;
  max-width: none;
  height: auto;
  transform: translateX(-50%);
  filter: contrast(1.03) brightness(0.92);
  animation: terrain-arrives 1s 100ms cubic-bezier(0.2, 0.74, 0.2, 1) both;
}

.terminator__habitat {
  position: absolute;
  z-index: 4;
  top: 27.5vh;
  left: 59%;
  display: block;
  width: clamp(360px, 34.5vw, 540px);
  height: auto;
  transform: translateX(-50%);
  filter:
    drop-shadow(0 20px 22px rgba(0, 0, 0, 0.48))
    contrast(1.04);
  animation: habitat-arrives 900ms 220ms cubic-bezier(0.2, 0.74, 0.2, 1)
    both;
}

.terminator__meta {
  position: absolute;
  z-index: 6;
  right: clamp(24px, 3.2vw, 52px);
  bottom: max(24px, env(safe-area-inset-bottom));
  left: clamp(24px, 3.2vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: rgba(236, 228, 213, 0.88);
  font-family: "SFMono-Regular", "Cascadia Code", "Liberation Mono", monospace;
  font-size: clamp(9px, 0.7vw, 11px);
  line-height: 1.3;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  animation: meta-arrives 700ms 450ms ease-out both;
}

.terminator__meta p {
  margin: 0;
}

.terminator__signal {
  display: flex;
  align-items: center;
  gap: 10px;
}

.terminator__signal span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--flare);
  box-shadow: 0 0 0 0 rgba(255, 91, 50, 0.48);
  animation: beacon 2.8s ease-out infinite;
}

@keyframes word-arrives {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) rotate(-0.8deg);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) rotate(-0.8deg);
  }
}

@keyframes earth-arrives {
  from {
    opacity: 0;
    transform: translate(-18px, 10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

@keyframes terrain-arrives {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(28px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes habitat-arrives {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(22px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes meta-arrives {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes beacon {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 91, 50, 0.48);
  }

  70%,
  100% {
    box-shadow: 0 0 0 9px rgba(255, 91, 50, 0);
  }
}

@media (max-width: 720px) {
  .terminator__stars {
    opacity: 0.5;
  }

  .terminator__word {
    top: 22vh;
    font-size: 38.2vw;
    letter-spacing: -0.018em;
    transform: translateX(-50%) scaleY(1.62) rotate(-0.5deg);
  }

  .terminator__earth {
    top: -9vh;
    left: -18vw;
    width: 78vw;
  }

  .terminator__terrain {
    bottom: -1px;
    left: 47%;
    width: auto;
    height: 110vh;
  }

  .terminator__habitat {
    top: 36vh;
    left: 56%;
    width: 82vw;
  }

  .terminator__meta {
    right: 20px;
    bottom: max(18px, env(safe-area-inset-bottom));
    left: 20px;
    justify-content: center;
    text-align: center;
  }

  .terminator__signal {
    display: none;
  }

  @keyframes word-arrives {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(10px) scaleY(1.62)
        rotate(-0.5deg);
    }

    to {
      opacity: 1;
      transform: translateX(-50%) translateY(0) scaleY(1.62)
        rotate(-0.5deg);
    }
  }
}

@media (max-height: 620px) and (min-width: 721px) {
  .terminator__word {
    top: 9vh;
    font-size: 35vw;
  }

  .terminator__earth {
    top: -28vh;
  }

  .terminator__terrain {
    width: 104vw;
  }

  .terminator__habitat {
    top: 16vh;
    width: min(28vw, 430px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .terminator__word,
  .terminator__earth,
  .terminator__terrain,
  .terminator__habitat,
  .terminator__meta,
  .terminator__signal span {
    animation: none;
  }
}
