/* V8 time-reactive broadcast engine and diegetic audio control. */

.irj-audio-surveillance,
.irj-test-signal,
.irj-rerun-chip,
.irj-sandstorm-chip {
  font-family: var(--font-mono);
  letter-spacing: 0.055em;
}

.irj-audio-surveillance {
  position: fixed;
  left: var(--p-space-4);
  bottom: var(--p-space-4);
  z-index: var(--p-z-focus);
  min-height: var(--control-target);
  max-width: min(18rem, calc(100vw - var(--p-space-8)));
  padding: var(--p-space-2) var(--p-space-3);
  display: grid;
  gap: 2px;
  border: 1px solid var(--white-line);
  border-radius: var(--p-radius-0);
  background: var(--ink-raised);
  box-shadow: 3px 3px 0 rgb(9 11 15 / 42%);
  color: var(--on-dark);
  text-align: left;
  cursor: pointer;
}

.broadcast-page .irj-audio-surveillance {
  bottom: calc(36px + var(--p-space-4));
}

.irj-audio-surveillance span {
  font: 500 11px/1.2 var(--font-jp);
  letter-spacing: 0.045em;
}

.irj-audio-surveillance small {
  color: var(--on-dark-muted);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.25;
}

.irj-audio-surveillance[aria-pressed="true"] {
  border-color: var(--red);
  box-shadow: inset 3px 0 0 var(--red), 3px 3px 0 rgb(9 11 15 / 42%);
}

.irj-audio-surveillance:hover {
  border-color: var(--red);
  background: var(--navy);
}

.irj-audio-surveillance:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

.irj-test-signal {
  position: fixed;
  top: calc(var(--masthead-height) + 72px);
  right: var(--p-space-4);
  z-index: var(--p-z-focus);
  min-height: 30px;
  padding: 5px var(--p-space-2);
  display: flex;
  align-items: baseline;
  gap: var(--p-space-2);
  border: 1px solid var(--red);
  background: var(--ink);
  box-shadow: 3px 3px 0 rgb(9 11 15 / 40%);
  color: var(--on-dark);
  pointer-events: none;
}

.broadcast-page .irj-test-signal {
  top: calc(var(--masthead-height) + 108px);
}

.irj-test-signal span {
  font: 500 10px var(--font-jp);
}

.irj-test-signal small,
.irj-test-signal b {
  font-size: 9px;
  font-weight: 600;
}

.irj-test-signal b {
  color: var(--red);
  font-variant-numeric: tabular-nums;
}

/* 14:00-18:59 — CENSORED FEED */
.irj-mode-censored .transmission-card figure::before {
  position: absolute;
  inset: 0;
  z-index: 2;
  content: "";
  background:
    linear-gradient(var(--ink), var(--ink)) 8% 24% / 46% 6% no-repeat,
    linear-gradient(var(--ink), var(--ink)) 76% 62% / 18% 5% no-repeat,
    linear-gradient(var(--ink), var(--ink)) 22% 78% / 36% 4% no-repeat;
  opacity: 0.72;
  pointer-events: none;
}

.irj-mode-censored .record-line {
  flex-wrap: wrap;
}

.irj-mode-censored .record-line::after {
  content: "検閲済  CLEARED";
  padding: 2px 5px;
  border: 1px solid var(--red-dark);
  color: var(--red-dark);
  font: 600 9px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* 19:00-22:59 — ANTHEM HOUR */
.irj-mode-anthem .network-masthead {
  border-top: 2px solid var(--red);
}

.irj-mode-anthem .ticker-window p::before {
  content: "国歌斉唱中  ANTHEM IN PROGRESS  ◆";
  margin-right: var(--p-space-6);
  padding: 2px 6px;
  border: 1px solid rgb(255 255 255 / 46%);
  color: var(--warm-white);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

/* 23:00-00:59 — RITUAL RERUN */
body.irj-mode-ritual::before,
body.irj-sandstorm::before {
  position: fixed;
  inset: 0;
  z-index: 50;
  content: "";
  pointer-events: none;
}

body.irj-mode-ritual::before {
  background: radial-gradient(circle at 50% 42%, transparent 46%, rgb(9 11 15 / 42%) 100%);
}

.irj-rerun-chip {
  position: absolute;
  top: clamp(78px, 11vh, 116px);
  left: clamp(14px, 2.4vw, 36px);
  z-index: 8;
  padding: 6px 9px;
  display: grid;
  gap: 2px;
  border-left: 3px solid var(--red);
  background: rgb(9 11 15 / 92%);
  color: var(--on-dark);
  pointer-events: none;
}

.irj-rerun-chip span {
  font: 500 12px var(--font-jp);
}

.irj-rerun-chip small {
  color: var(--on-dark-muted);
  font-size: 9px;
  font-weight: 600;
}

@media (prefers-reduced-motion: no-preference) {
  .irj-mode-ritual .broadcast-clock {
    animation: irj-rerun-clock 2.4s ease-in-out infinite;
  }
}

@keyframes irj-rerun-clock {
  0%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  50% {
    opacity: 0.72;
    filter: brightness(1.18);
  }
}

/* 01:00-05:59 / 25:00 — SANDSTORM */
body.irj-sandstorm::before {
  background:
    linear-gradient(90deg, rgb(200 32 45 / 7%), transparent 16%, transparent 84%, rgb(200 32 45 / 7%)),
    radial-gradient(circle at 50% 42%, transparent 36%, rgb(9 11 15 / 64%) 100%);
}

body.irj-sandstorm::after {
  opacity: 0.19;
  mix-blend-mode: screen;
}

.irj-sandstorm .network-masthead {
  border-top: 2px solid var(--red);
  border-bottom-color: var(--red-dark);
  box-shadow:
    inset 0 -1px 0 var(--red-dark),
    0 3px 0 rgb(200 32 45 / 14%);
}

.irj-sandstorm .network-footer {
  border-top-color: var(--red-dark);
  box-shadow: inset 0 2px 0 rgb(200 32 45 / 18%);
}

.irj-sandstorm .packet-cta,
.irj-sandstorm .mobile-tabbar a[aria-current="page"] {
  box-shadow: inset 0 3px 0 var(--red);
}

.irj-sandstorm .news-ticker {
  border-color: var(--red-dark);
  background: color-mix(in srgb, var(--navy) 72%, var(--red-dark));
  background-blend-mode: multiply;
}

.irj-sandstorm .ticker-window p {
  color: var(--warm-white);
  filter: contrast(1.12) saturate(0.78);
  mix-blend-mode: screen;
}

.irj-sandstorm .site-custodian img {
  filter:
    contrast(1.1)
    saturate(1.14)
    drop-shadow(0 0 3px rgb(200 32 45 / 74%));
}

.irj-sandstorm .site-custodian::before {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  content: "";
  background:
    radial-gradient(circle at 40% 49%, rgb(255 82 94 / 86%) 0 1px, transparent 3px),
    radial-gradient(circle at 60% 49%, rgb(255 82 94 / 86%) 0 1px, transparent 3px);
  filter: drop-shadow(0 0 3px var(--red));
  pointer-events: none;
}

.irj-sandstorm-chip {
  position: fixed;
  right: 104px;
  bottom: 104px;
  z-index: 70;
  max-width: min(27rem, calc(100vw - var(--p-space-8)));
  padding: var(--p-space-2) var(--p-space-3);
  display: grid;
  justify-items: end;
  gap: 3px;
  border-right: 4px solid var(--red);
  background: rgb(9 11 15 / 94%);
  box-shadow: 4px 4px 0 rgb(139 21 30 / 52%);
  color: var(--on-dark);
  text-align: right;
  pointer-events: none;
}

.irj-sandstorm-chip span {
  font: 500 12px var(--font-jp);
  letter-spacing: 0.08em;
}

.irj-sandstorm-chip small {
  color: var(--on-dark-muted);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.35;
}

@media (prefers-reduced-motion: no-preference) {
  body.irj-sandstorm::after {
    animation: irj-sandstorm-noise 0.62s steps(7) infinite;
  }
}

@keyframes irj-sandstorm-noise {
  0%,
  100% {
    opacity: 0.14;
    transform: translate3d(-3%, -4%, 0);
  }
  33% {
    opacity: 0.21;
    transform: translate3d(4%, -1%, 0);
  }
  66% {
    opacity: 0.17;
    transform: translate3d(-1%, 4%, 0);
  }
}

@media (max-width: 700px) {
  .irj-audio-surveillance {
    left: 10px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    max-width: min(15rem, calc(100vw - 78px));
  }

  .broadcast-page .irj-audio-surveillance {
    bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .irj-test-signal {
    top: calc(var(--masthead-height) + 72px);
    right: 10px;
  }


  .broadcast-page .irj-test-signal {
    top: calc(var(--masthead-height) + 72px);
  }

  .irj-rerun-chip {
    top: 76px;
    left: 10px;
  }

  .irj-sandstorm .site-custodian::before {
    width: 48px;
    height: 48px;
  }

  .irj-sandstorm-chip {
    right: 10px;
    bottom: calc(126px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .irj-audio-surveillance {
    max-width: calc(100vw - 76px);
  }

  .irj-audio-surveillance small {
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .irj-audio-surveillance,
  .irj-mode-ritual .broadcast-clock,
  body.irj-sandstorm::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }

  body.irj-sandstorm::after {
    opacity: 0.17;
  }
}
