:root {
  color-scheme: dark;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: #edf7f5;
  background: #06100f;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(31, 225, 191, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 225, 191, 0.08) 1px, transparent 1px),
    radial-gradient(
      circle at 50% 45%,
      rgba(59, 210, 181, 0.18),
      transparent 32rem
    ),
    linear-gradient(145deg, #06100f 0%, #0c1a18 44%, #071716 100%);
  background-size:
    48px 48px,
    48px 48px,
    auto,
    auto;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: '';
}

body::before {
  background:
    linear-gradient(90deg, transparent, rgba(105, 241, 218, 0.12), transparent),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 6px
    );
  background-size:
    35vw 100%,
    auto;
  animation: field-sweep 7s linear infinite;
  mix-blend-mode: screen;
}

body::after {
  border: 1px solid rgba(112, 248, 220, 0.18);
  clip-path: polygon(5vw 8vh, 95vw 8vh, 95vw 92vh, 5vw 92vh);
  opacity: 0.75;
}

.home-shell,
.error-shell {
  position: relative;
  z-index: 1;
  width: 100vw;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 0;
}

.signal-stage {
  position: relative;
  width: 100vw;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto auto 1fr;
  place-items: center;
  isolation: isolate;
}

.scan-field {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-block: 1px solid rgba(114, 255, 226, 0.18);
}

.scan-field::before {
  position: absolute;
  inset: 12% 0;
  content: '';
  background:
    linear-gradient(90deg, transparent, rgba(121, 255, 229, 0.35), transparent),
    linear-gradient(180deg, transparent, rgba(250, 255, 255, 0.08), transparent);
  transform: skewY(-4deg);
  animation: signal-pass 10s ease-in-out infinite;
}

.scan-field span {
  position: absolute;
  width: 34%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(116, 255, 228, 0.7),
    transparent
  );
  box-shadow: 0 0 18px rgba(116, 255, 228, 0.45);
}

.scan-field span:nth-child(1) {
  top: 24%;
  left: -8%;
  animation: rail-left 12s ease-in-out infinite;
}

.scan-field span:nth-child(2) {
  top: 50%;
  right: -8%;
  animation: rail-right 11s ease-in-out infinite 1.2s;
}

.scan-field span:nth-child(3) {
  bottom: 22%;
  left: 16%;
  animation: rail-left 13s ease-in-out infinite 2s;
}

.site-logo {
  grid-row: 2;
  width: clamp(156px, 18vw, 280px);
  height: auto;
  margin: 0 0 clamp(26px, 4vh, 48px);
  opacity: 0.92;
  filter: drop-shadow(0 0 18px rgba(105, 255, 228, 0.28));
}

.brand-lockup {
  position: relative;
  display: flex;
  justify-content: center;
  width: min(100%, 900px);
  min-height: clamp(84px, 16vw, 172px);
  margin: 0;
  grid-row: 3;
  color: #f5fffd;
  font-size: clamp(4.2rem, 13vw, 10rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: none;
  text-shadow:
    0 0 14px rgba(105, 255, 228, 0.45),
    0 0 44px rgba(36, 206, 184, 0.42);
}

.brand-lockup::before,
.brand-lockup::after {
  position: absolute;
  inset: auto 0;
  height: 2px;
  content: '';
  background: linear-gradient(90deg, transparent, #67ffe1, transparent);
  transform: scaleX(0);
  animation: lock-line 10s ease-in-out infinite;
}

.brand-lockup::before {
  top: -22px;
}

.brand-lockup::after {
  bottom: -24px;
  animation-delay: 0.18s;
}

.letter-track {
  --dx: 0px;
  --dy: 0px;
  --rotate: 0deg;
  display: inline-block;
  min-width: 0.62em;
  text-align: center;
  transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--rotate));
  opacity: 0;
  filter: blur(8px);
  animation: letter-lock 10s cubic-bezier(0.17, 0.84, 0.32, 1) infinite;
}

.letter-track:nth-child(1) {
  --dx: -44vw;
  --dy: -18vh;
  --rotate: -18deg;
  animation-delay: 0s;
}

.letter-track:nth-child(2) {
  --dx: 20vw;
  --dy: -42vh;
  --rotate: 14deg;
  animation-delay: 0.08s;
}

.letter-track:nth-child(3) {
  --dx: -28vw;
  --dy: 34vh;
  --rotate: 16deg;
  animation-delay: 0.16s;
}

.letter-track:nth-child(4) {
  --dx: 0;
  --dy: -48vh;
  --rotate: 0deg;
  animation-delay: 0.24s;
}

.letter-track:nth-child(5) {
  --dx: 32vw;
  --dy: 28vh;
  --rotate: -12deg;
  animation-delay: 0.32s;
}

.letter-track:nth-child(6) {
  --dx: -18vw;
  --dy: -36vh;
  --rotate: 20deg;
  animation-delay: 0.4s;
}

.letter-track:nth-child(7) {
  --dx: 48vw;
  --dy: 12vh;
  --rotate: -18deg;
  animation-delay: 0.48s;
}

.signal-copy {
  grid-row: 4;
  align-self: start;
  margin: clamp(32px, 5vh, 54px) 0 0;
  color: #aee7dd;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  line-height: 1.5;
  text-align: center;
}

.error-shell {
  overflow: hidden;
}

.error-shell h1 {
  margin: 0 0 12px;
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  line-height: 0.95;
}

.error-shell p {
  margin: 0;
  color: #aee7dd;
  font-size: 1.125rem;
  line-height: 1.6;
}

@keyframes letter-lock {
  0% {
    transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--rotate))
      scale(0.72);
    opacity: 0;
    filter: blur(12px);
  }

  34%,
  72% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    opacity: 1;
    filter: blur(0);
  }

  100% {
    transform: translate3d(calc(var(--dx) * -0.26), calc(var(--dy) * -0.22), 0)
      rotate(calc(var(--rotate) * -0.4)) scale(0.92);
    opacity: 0;
    filter: blur(10px);
  }
}

@keyframes lock-line {
  0%,
  100% {
    transform: scaleX(0);
    opacity: 0;
  }

  22%,
  74% {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes signal-pass {
  0%,
  100% {
    transform: translateX(-62%) skewY(-4deg);
    opacity: 0;
  }

  35%,
  70% {
    opacity: 1;
  }

  100% {
    transform: translateX(62%) skewY(-4deg);
  }
}

@keyframes rail-left {
  0%,
  100% {
    transform: translateX(-25%);
    opacity: 0.25;
  }

  50% {
    transform: translateX(180%);
    opacity: 1;
  }
}

@keyframes rail-right {
  0%,
  100% {
    transform: translateX(25%);
    opacity: 0.25;
  }

  50% {
    transform: translateX(-180%);
    opacity: 1;
  }
}

@keyframes field-sweep {
  0% {
    background-position:
      -35vw 0,
      0 0;
  }

  100% {
    background-position:
      135vw 0,
      0 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }

  .letter-track {
    transform: none;
    opacity: 1;
    filter: none;
  }
}

@media (max-width: 620px) {
  body::after {
    clip-path: polygon(
      18px 18px,
      calc(100vw - 18px) 18px,
      calc(100vw - 18px) calc(100vh - 18px),
      18px calc(100vh - 18px)
    );
  }

  .brand-lockup {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .signal-copy {
    width: min(88vw, 360px);
  }
}
