:root {
  color-scheme: dark;
  --black: #050505;
  --bone: #d4cec3;
  --muted: #8b857d;
  --red: #a43c35;
  --line: #28211f;
  --look-x: 0px;
  --look-y: 0px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  background: var(--black);
  color: var(--bone);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  background: var(--black);
}

body::before,
body::after {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgb(0 0 0 / 15%) 2px 3px);
  opacity: .55;
}

body::after {
  background-image: url("/haunt-assets/grain.svg");
  opacity: .055;
}

::selection {
  background: #792b26;
  color: #f3e9dc;
}

button {
  font: inherit;
}

.page-frame {
  width: min(100%, 1600px);
  margin-inline: auto;
  padding: 0 clamp(20px, 4vw, 64px);
}

.masthead {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  border-bottom: 1px solid #171514;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .14em;
}

.masthead p {
  margin: 0;
}

.station {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.station-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #973a32;
  box-shadow: 0 0 12px rgb(135 41 32 / 20%);
}

.reception {
  text-align: right;
  color: #65615b;
}

.reception span {
  margin-left: 18px;
  color: #a19a8e;
  font-size: 16px;
}

.signal-room {
  position: relative;
}

.signal-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: clamp(520px, 72svh, 850px);
}

.signal-stage::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(0deg, var(--black), transparent 16% 88%, var(--black));
  content: "";
}

.frequency {
  position: absolute;
  z-index: 6;
  top: 22px;
  left: 0;
  margin: 0;
  color: #777068;
  font-size: 9px;
  letter-spacing: .13em;
}

.frequency span {
  margin-inline: 12px;
  color: #61312b;
}

.watcher-drift {
  position: absolute;
  z-index: 1;
  inset: 16% -6% 17%;
  pointer-events: none;
}

.watcher-parallax {
  width: 100%;
  height: 100%;
  transform: translate(var(--look-x), var(--look-y));
}

.watcher {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 47%;
  opacity: .92;
  filter: saturate(.8) contrast(1.04);
}

.signal-title {
  position: absolute;
  z-index: 4;
  inset: 0;
  margin: 0;
  pointer-events: none;
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(78px, 20vw, 290px);
  font-weight: 950;
  line-height: .8;
  letter-spacing: -.075em;
  text-align: center;
}

.title-word {
  position: absolute;
  left: 50%;
  display: block;
  width: max-content;
  max-width: 100%;
  transform: translateX(-50%);
}

.title-word::after {
  position: absolute;
  inset: 0;
  color: #a8342d;
  -webkit-text-stroke: 0;
  clip-path: polygon(0 32%, 100% 32%, 100% 46%, 0 46%);
  opacity: 0;
  content: attr(data-echo);
}

.title-word-top {
  top: 12%;
  color: var(--bone);
  text-shadow: -1px 1px 0 #4e2923;
}

.title-word-bottom {
  bottom: 10%;
  color: #19110f;
  -webkit-text-stroke: 1px #906951;
  text-shadow: 0 1px 0 #1e100d;
}

.interference {
  position: absolute;
  z-index: 5;
  top: 54%;
  right: -2%;
  left: -2%;
  height: 30px;
  pointer-events: none;
  background: linear-gradient(0deg, transparent 0 46%, rgb(182 64 48 / 30%) 46% 49%, transparent 49% 61%, rgb(0 0 0 / 26%) 61% 65%, transparent 65%);
  opacity: .16;
}

.registration {
  position: absolute;
  z-index: 6;
  top: 43%;
  width: 19px;
  height: 70px;
  color: #664036;
  opacity: .7;
}

.registration-left {
  left: 0;
}

.registration-right {
  right: 0;
  transform: rotate(180deg);
}

.registration span {
  position: absolute;
  left: 0;
  width: 18px;
  height: 10px;
  border-top: 1px solid currentColor;
  border-left: 1px solid currentColor;
}

.registration span:last-child {
  top: auto;
  bottom: 0;
  transform: scaleY(-1);
}

.specimen-note,
.side-note,
.russian-title {
  position: absolute;
  z-index: 6;
  margin: 0;
  font-size: 8px;
  line-height: 1.8;
  letter-spacing: .12em;
}

.specimen-note {
  top: 68%;
  left: 0;
  color: #83796e;
}

.specimen-note span {
  color: #584e46;
}

.side-note {
  top: 48%;
  right: 30px;
  color: #8a5c4d;
  writing-mode: vertical-rl;
}

.russian-title {
  right: 0;
  bottom: 24px;
  left: 0;
  color: #8d7263;
  font-size: 10px;
  letter-spacing: .65em;
  text-align: center;
}

.transmission-bar {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 26px 0 31px;
  border-top: 1px solid var(--line);
}

.transmission-copy {
  max-width: 610px;
}

.transmission-label {
  margin: 0 0 10px;
  color: #b17161;
  font-size: 9px;
  letter-spacing: .18em;
}

.transmission-message {
  min-height: 1.7em;
  margin: 0;
  color: #c2b9aa;
  font-size: clamp(12px, 1.2vw, 15px);
  line-height: 1.7;
}

.signal-action {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-width: 177px;
  min-height: 53px;
  padding: 15px 18px;
  border: 1px solid #6e3e32;
  border-radius: 0;
  background: #140b08;
  color: #e0c6b4;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.signal-action:focus-visible {
  outline: 2px solid #e7c1a6;
  outline-offset: 5px;
}

.signal-action:active {
  background: #3a160f;
}

.action-symbol {
  color: #b9735b;
  font-size: 22px;
  font-weight: 400;
  line-height: .75;
}

.signal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 19px 0 25px;
  border-top: 1px solid #171514;
  color: #615850;
  font-size: 8px;
  letter-spacing: .11em;
}

.footer-coordinate {
  color: #976149;
  white-space: nowrap;
}

.signal-room[data-look-x="-4"] { --look-x: -16px; }
.signal-room[data-look-x="-3"] { --look-x: -12px; }
.signal-room[data-look-x="-2"] { --look-x: -8px; }
.signal-room[data-look-x="-1"] { --look-x: -4px; }
.signal-room[data-look-x="1"] { --look-x: 4px; }
.signal-room[data-look-x="2"] { --look-x: 8px; }
.signal-room[data-look-x="3"] { --look-x: 12px; }
.signal-room[data-look-x="4"] { --look-x: 16px; }
.signal-room[data-look-y="-3"] { --look-y: -9px; }
.signal-room[data-look-y="-2"] { --look-y: -6px; }
.signal-room[data-look-y="-1"] { --look-y: -3px; }
.signal-room[data-look-y="1"] { --look-y: 3px; }
.signal-room[data-look-y="2"] { --look-y: 6px; }
.signal-room[data-look-y="3"] { --look-y: 9px; }

.signal-room[data-state="noticed"] .watcher {
  opacity: 1;
  filter: saturate(1.12) contrast(1.09) brightness(1.06);
}

.signal-room[data-state="noticed"] .title-word-bottom {
  color: #280f0b;
  -webkit-text-stroke-color: #ad4c3e;
}

.signal-room[data-state="noticed"] .title-word::after {
  transform: translateX(5px);
  opacity: .44;
}

.signal-room[data-state="noticed"] .interference {
  opacity: .7;
}

.signal-room[data-state="noticed"] .signal-action {
  border-color: #a55540;
  background: #261009;
}

@media (hover: hover) and (pointer: fine) {
  .signal-action:hover {
    border-color: #bd785b;
    background: #25120c;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .watcher-drift {
    animation: slow-drift 18s ease-in-out infinite alternate;
  }

  .watcher-parallax {
    transition: transform 750ms cubic-bezier(.2, .8, .2, 1);
  }

  .watcher,
  .title-word::after,
  .title-word-bottom,
  .interference,
  .signal-action {
    transition: opacity 900ms ease, filter 900ms ease, color 900ms ease, background-color 400ms ease, border-color 400ms ease, transform 900ms ease;
  }

  html[data-visible="false"] .watcher-drift {
    animation-play-state: paused;
  }

  @keyframes slow-drift {
    from { transform: translateY(-2px) scale(1); }
    to { transform: translateY(3px) scale(1.008); }
  }
}

@media (max-width: 767px) {
  .page-frame {
    padding-inline: 22px;
  }

  .masthead {
    min-height: 66px;
    font-size: 8px;
    letter-spacing: .09em;
  }

  .reception {
    max-width: 124px;
    line-height: 1.6;
  }

  .reception span {
    display: none;
  }

  .signal-stage {
    height: clamp(500px, 68svh, 670px);
  }

  .signal-title {
    font-size: clamp(78px, 20.8vw, 162px);
  }

  .title-word-top {
    top: 15%;
  }

  .title-word-bottom {
    bottom: 14%;
  }

  .watcher-drift {
    inset: 24% -8% 26%;
  }

  .frequency {
    top: 25px;
    font-size: 7px;
    letter-spacing: .07em;
  }

  .frequency span {
    margin-inline: 7px;
  }

  .registration {
    top: 45%;
    width: 12px;
    height: 45px;
    opacity: .45;
  }

  .registration span {
    width: 11px;
    height: 8px;
  }

  .side-note {
    top: 42%;
    right: 19px;
    font-size: 6px;
    letter-spacing: .13em;
  }

  .specimen-note {
    top: 69%;
    font-size: 6px;
    letter-spacing: .02em;
  }

  .russian-title {
    bottom: 25px;
    font-size: 8px;
    letter-spacing: .5em;
  }

  .transmission-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 23px;
    padding: 22px 0 27px;
  }

  .transmission-copy {
    max-width: 430px;
  }

  .transmission-label {
    margin-bottom: 9px;
    font-size: 8px;
  }

  .signal-action {
    min-height: 51px;
    width: 100%;
  }

  .signal-footer {
    align-items: flex-start;
    gap: 16px;
    padding-block: 17px 23px;
    font-size: 6px;
    line-height: 1.8;
    letter-spacing: .04em;
  }

  .signal-footer > span:first-child,
  .signal-footer > span:last-child {
    max-width: 100px;
  }

  .signal-footer > span:last-child {
    text-align: right;
  }
}

@media (max-width: 359px) {
  .page-frame {
    padding-inline: 18px;
  }

  .signal-title {
    font-size: 72px;
  }

  .reception {
    max-width: 106px;
    font-size: 7px;
  }

  .side-note {
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .watcher-parallax {
    transform: none;
  }
}

@media (forced-colors: active) {
  body::before,
  body::after,
  .watcher-drift,
  .interference,
  .registration,
  .title-word::after {
    display: none;
  }

  .title-word {
    color: CanvasText;
    -webkit-text-stroke: 0;
    text-shadow: none;
  }

  .signal-action {
    border: 1px solid ButtonText;
    background: ButtonFace;
    color: ButtonText;
  }
}
