/* h4d35x0 passive radar: the front door.

   Progressive enhancement, same contract as every other surface here. The
   contacts are a real <ul> of real links in the markup. Without JavaScript
   that list is simply a list and the page works. radar.js adds .is-armed,
   and only then does the list become a scope with positioned blips. Nothing
   is hidden before the script proves it ran, so a broken script can never
   produce a blank page.

   Motion is opt-out by default: the sweep only animates under
   prefers-reduced-motion: no-preference. */

.h4-radar {
  max-width: 96rem;
  margin: 0 auto;
  padding: 2.4rem 1.6rem 6rem;
}

/* ---- status bar ---- */

.h4-radar__bar {
  display: flex;
  gap: 1.2rem;
  align-items: baseline;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--h4-line);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 1.15rem;
  color: var(--h4-dim);
}
.h4-radar__spacer { flex: 1 1 auto; }
.h4-radar__bar b { color: var(--h4-fg); font-weight: 600; }
.h4-radar__bar .warn { color: var(--h4-warn); }

.h4-radar__lede {
  margin: 1.6rem 0 2.4rem;
  max-width: 62ch;
}
.h4-radar__lede p { margin: 0; }

/* ---- the scope ---- */

.h4-radar__stage {
  position: relative;
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

/* Until armed there is no scope at all, just the list below. */
.h4-radar__stage { display: none; }
.h4-radar.is-armed .h4-radar__stage { display: block; }

.h4-radar__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---- contacts ---- */

.h4-radar__contacts {
  list-style: none;
  margin: 2.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.h4-radar.is-armed .h4-radar__contacts {
  position: absolute;
  inset: 0;
  margin: 0;
  display: block;
}

.h4-radar.is-armed .h4-contact {
  position: absolute;
  /* set by radar.js from the contact's own bearing and range */
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
}

.h4-contact__hit {
  display: block;
  width: 100%;
  padding: 0.8rem 1.2rem;
  border: 1px solid var(--h4-line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.h4-radar.is-armed .h4-contact__hit {
  width: auto;
  white-space: nowrap;
  padding: 0.3rem 0.7rem;
  border-color: transparent;
  background: rgba(11, 15, 12, 0.72);
}

.h4-contact__hit:hover,
.h4-contact__hit[aria-current='true'] {
  border-color: var(--h4-accent);
  background: var(--h4-accent-soft);
}

.h4-contact__name {
  color: var(--h4-accent);
}
.h4-radar.is-armed .h4-contact__name::before {
  content: '';
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.6rem;
  border-radius: 50%;
  background: var(--h4-accent);
  vertical-align: middle;
  /* radar.js sets --glow from 1 down to 0 as the sweep moves away */
  box-shadow: 0 0 calc(1.2rem * var(--glow, 0)) rgba(93, 242, 160, var(--glow, 0));
  opacity: calc(0.35 + 0.65 * var(--glow, 0));
}

.h4-contact__lang {
  margin-left: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 1.05rem;
  color: var(--h4-dim);
}

.h4-radar.is-armed .h4-contact__desc { display: none; }
.h4-contact__desc {
  margin: 0.4rem 0 0;
  color: var(--h4-dim);
}

/* the visitor, parked at the centre of their own scope */
.h4-radar.is-armed .h4-contact--self {
  left: 50%;
  top: 50%;
}
.h4-contact--self .h4-contact__name { color: var(--h4-warn); }
.h4-radar.is-armed .h4-contact--self .h4-contact__name::before {
  background: var(--h4-warn);
  box-shadow: 0 0 1.2rem rgba(242, 180, 93, 0.7);
  opacity: 1;
}

/* ---- readout ---- */

.h4-radar__readout {
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--h4-line);
  min-height: 9rem;
}
.h4-radar:not(.is-armed) .h4-radar__readout { display: none; }

.h4-readout__name {
  margin: 0;
  font-size: 1.6rem;
  color: var(--h4-accent);
}
.h4-readout__name--self { color: var(--h4-warn); }
.h4-readout__desc { margin: 0.6rem 0 0; max-width: 62ch; }
.h4-readout__note { margin: 0.6rem 0 0; color: var(--h4-dim); }

.h4-readout__rows {
  margin: 0.8rem 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1.6rem;
  font-size: 1.25rem;
}
.h4-readout__rows dt {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 1.05rem;
  color: var(--h4-dim);
}
.h4-readout__rows dd { margin: 0; }

.h4-readout__link {
  display: inline-block;
  margin-top: 1.2rem;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--h4-accent);
  color: var(--h4-accent);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 1.15rem;
}
.h4-readout__link:hover { background: var(--h4-accent-soft); }

.h4-radar__restraint {
  margin: 2.4rem 0 0;
  color: var(--h4-dim);
}

/* ---- the terminal, still here, one layer down ---- */

.h4-radar__deeper {
  margin-top: 3.2rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--h4-line);
}

@media (max-width: 40em) {
  .h4-radar__stage { max-width: 34rem; }
  .h4-radar.is-armed .h4-contact__hit { font-size: 1.15rem; padding: 0.2rem 0.5rem; }
}
