/* H2F Studio CRT signal wall */

.hero-media.hero-monitor-wall {
  position: relative;
  width: 126%;
  min-height: 0;
  aspect-ratio: 3 / 2;
  margin: 0 -14% 0 -12%;
  justify-self: end;
  isolation: isolate;
}

.crt-wall-base,
.crt-screen-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.crt-wall-base {
  z-index: 0;
  display: block;
  object-fit: contain;
  filter: contrast(1.04) saturate(0.76);
  user-select: none;
}

.crt-screen-layer {
  z-index: 1;
  pointer-events: none;
}

.crt-screen {
  --screen-rotate: 0deg;
  position: absolute;
  overflow: hidden;
  border-radius: 14% / 19%;
  transform: rotate(var(--screen-rotate));
  background: #020502;
  box-shadow:
    inset 0 0 1.2rem rgba(0, 0, 0, 0.82),
    0 0 0.65rem rgba(182, 255, 60, 0.09);
}

.crt-screen::before,
.crt-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.crt-screen::before {
  background:
    radial-gradient(ellipse at center, transparent 51%, rgba(0, 0, 0, 0.66) 100%),
    linear-gradient(90deg, rgba(255, 30, 30, 0.035), transparent 30%, rgba(45, 105, 255, 0.04));
  box-shadow: inset 0 0 0.4rem rgba(0, 0, 0, 0.74);
}

.crt-screen::after {
  opacity: 0.2;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12) 0,
    rgba(255, 255, 255, 0.12) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: soft-light;
}

.crt-screen__media {
  position: absolute;
  inset: -4%;
  display: block;
  width: 108%;
  height: 108%;
  object-fit: cover;
  filter: brightness(0.76) contrast(1.14) saturate(0.76);
  transform: scale(1.015);
}

.crt-screen__video {
  z-index: 2;
  opacity: 0;
}

.crt-video-screen.is-playing .crt-screen__video {
  opacity: 1;
}

.crt-video-screen.is-playing .crt-screen__poster {
  opacity: 0;
}

.crt-cycle__item {
  opacity: 0;
}

.crt-cycle__item--a {
  opacity: 1;
}

.crt-screen--stage {
  left: 1.95%;
  top: 37.3%;
  width: 13.35%;
  height: 10.74%;
  --screen-rotate: -0.35deg;
}

.crt-screen--ritual {
  left: 1.69%;
  top: 63.48%;
  width: 15.1%;
  height: 16.7%;
  --screen-rotate: -0.45deg;
}

.crt-screen--arg {
  left: 25.52%;
  top: 58.4%;
  width: 10.81%;
  height: 12.3%;
  --screen-rotate: 0.3deg;
}

.crt-screen--character {
  left: 44.79%;
  top: 57.71%;
  width: 11.33%;
  height: 14.55%;
  --screen-rotate: -0.25deg;
}

.crt-screen--signals {
  left: 69.92%;
  top: 40.14%;
  width: 11.78%;
  height: 10.64%;
  --screen-rotate: 0.32deg;
}

.crt-screen--game {
  left: 69.79%;
  top: 59.67%;
  width: 11.78%;
  height: 16.31%;
  --screen-rotate: 0.18deg;
}

.crt-screen--dream {
  left: 89.58%;
  top: 42.87%;
  width: 9.24%;
  height: 10.94%;
  --screen-rotate: 0.45deg;
}

.crt-wall-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.crt-motion-toggle {
  position: absolute;
  top: 4.5%;
  right: 5.5%;
  z-index: 5;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid rgba(182, 255, 60, 0.52);
  border-radius: 0;
  color: var(--text);
  background: rgba(3, 5, 3, 0.9);
  font: 700 10px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.crt-motion-toggle[hidden] {
  display: none;
}

.crt-motion-toggle:hover {
  border-color: var(--glow);
  color: var(--glow);
}

.crt-motion-toggle:focus-visible {
  outline: 2px solid var(--glow);
  outline-offset: 4px;
}

.crt-motion-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0.7rem rgba(182, 255, 60, 0.72);
}

.crt-motion-toggle[aria-pressed="true"] .crt-motion-indicator {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--glow-dim);
}

.hero-monitor-wall.is-active .crt-screen::after {
  animation: crt-scanline-drift 8s linear infinite;
}

.hero-monitor-wall.is-active .crt-drift .crt-screen__media {
  animation: crt-image-drift 11s ease-in-out infinite alternate;
}

.hero-monitor-wall.is-active .crt-cycle__item--a {
  animation: crt-cycle-a 12s steps(1, end) infinite;
}

.hero-monitor-wall.is-active .crt-cycle__item--b {
  animation: crt-cycle-b 12s steps(1, end) infinite;
}

.hero-monitor-wall.is-active .crt-cycle__item--c {
  animation: crt-cycle-c 12s steps(1, end) infinite;
}

@keyframes crt-scanline-drift {
  to {
    background-position: 0 12px;
  }
}

@keyframes crt-image-drift {
  0% {
    transform: scale(1.035) translate3d(-0.5%, -0.3%, 0);
  }

  100% {
    transform: scale(1.1) translate3d(0.8%, 0.55%, 0);
  }
}

@keyframes crt-cycle-a {
  0%,
  31% {
    opacity: 1;
  }

  32%,
  100% {
    opacity: 0;
  }
}

@keyframes crt-cycle-b {
  0%,
  31% {
    opacity: 0;
  }

  32%,
  64% {
    opacity: 1;
  }

  65%,
  100% {
    opacity: 0;
  }
}

@keyframes crt-cycle-c {
  0%,
  64% {
    opacity: 0;
  }

  65%,
  100% {
    opacity: 1;
  }
}

@media (max-width: 1040px) {
  .hero-media.hero-monitor-wall {
    width: 116%;
    margin-right: -10%;
    margin-left: -6%;
  }
}

@media (max-width: 820px) {
  .hero-media.hero-monitor-wall {
    width: min(100%, 760px);
    min-height: 0;
    margin: 10px auto 0;
    justify-self: center;
  }
}

@media (max-width: 580px) {
  .hero-media.hero-monitor-wall {
    width: calc(100% + 28px);
    min-height: 0;
    margin: 8px 0 0 -14px;
  }

  .crt-screen--character .crt-screen__video {
    display: none;
  }

  .crt-motion-toggle {
    top: 2.5%;
    right: 3.5%;
    min-height: 42px;
    padding: 9px 10px;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-monitor-wall.is-active .crt-screen::after,
  .hero-monitor-wall.is-active .crt-drift .crt-screen__media,
  .hero-monitor-wall.is-active .crt-cycle__item {
    animation: none;
  }
}
