/*
 * The live pieces: the ISS instrument in the hero, the Moon's grab handle and readout, the
 * spinnable Earth at the bottom and the contact form in the beacon box. Instruments use Space
 * Mono, like the rest of the flight deck.
 */

/* ---------- The ISS, right now ---------- */
.iss {
  position: absolute;
  right: calc(var(--gutter) + 2.6rem);
  bottom: calc(6.6rem + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  width: 14.5rem;
  padding: 0.9rem 0.95rem 0.95rem;
  border: 1px solid rgb(159 232 255 / 0.22);
  border-radius: 0.5rem;
  background: rgb(2 3 10 / 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font: 400 0.64rem/1.45 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hud);
}
.iss__head { display: flex; align-items: center; gap: 0.5rem; color: var(--star); letter-spacing: 0.2em; }
.iss__dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--hud-dim); }
.iss.is-live .iss__dot { background: #7dffb0; box-shadow: 0 0 8px #7dffb0; }
.motion .iss.is-live .iss__dot { animation: twinkle 1.4s ease-in-out infinite; }
.iss__mode { margin-left: auto; padding: 0.15rem 0.4rem; border: 1px solid rgb(159 232 255 / 0.3); border-radius: 0.25rem; font-size: 0.58rem; color: var(--hud-dim); cursor: help; }
.iss.is-live .iss__mode { border-color: rgb(125 255 176 / 0.45); color: #7dffb0; }
.iss__where { margin-top: 0.55rem; text-transform: none; letter-spacing: 0.02em; font: 400 0.95rem/1.25 var(--font); color: var(--muted); }
.iss__where b { font-weight: 400; color: var(--star); }
.iss__nums { margin-top: 0.3rem; font-variant-numeric: tabular-nums; color: var(--hud-dim); }
.iss__map { display: block; width: 100%; aspect-ratio: 2; height: auto; margin-top: 0.7rem; border-top: 1px solid rgb(159 232 255 / 0.14); border-bottom: 1px solid rgb(159 232 255 / 0.14); }
.iss__find {
  margin-top: 0.7rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgb(242 196 109 / 0.5);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.iss__find:hover, .iss__find[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); }

/* ---------- The Moon: a grab handle over it, and a readout below ---------- */
.intro { position: relative; }
.moon-hit {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: grab;
  touch-action: pan-y;
  pointer-events: none;
  will-change: transform;
}
.moon-hit.is-on { pointer-events: auto; }
.moon-hit.is-dragging { cursor: grabbing; }
.moon-hit:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }
.moon-read {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 16rem;
  margin-left: -8rem;
  text-align: center;
  font: 400 0.64rem/1.55 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hud);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  will-change: transform;
}
.moon-read.is-on { opacity: 1; }
.moon-read__name { color: var(--hud); }
.moon-read__phase { color: var(--star); }
.moon-read__note { color: rgb(243 239 226 / 0.55); }
.moon-read__today { margin-top: 0.4rem; padding: 0.25rem 0.55rem; border: 1px solid rgb(242 196 109 / 0.5); border-radius: 999px; background: rgb(2 3 10 / 0.6); font: inherit; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); cursor: pointer; pointer-events: auto; }
.moon-read__today:hover { background: var(--gold); color: var(--on-gold); }

/* ---------- The Earth at the bottom turns too ---------- */
.signoff { position: relative; }
.signoff > * { position: relative; z-index: 1; }
.signoff > .earth-grip--home { position: absolute; left: 50%; right: auto; bottom: 0; z-index: 0; width: 100vw; height: 42%; margin-left: -50vw; }
.splash { flex-wrap: wrap; }
.splash__drag { flex-basis: 100%; padding-left: 1.1rem; color: var(--hud-dim); }
.moon-read.is-side { text-align: right; }

/* ---------- The contact form, in T's beacon box ---------- */
.signal--form { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.signal--form .signal__lede { margin-top: 1rem; max-width: 32ch; color: var(--muted); }
.signal--form .signal__alt { margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: 0.92rem; color: var(--muted); }
.signal--form .signal__alt .email { margin-top: 0.6rem; gap: 0.7rem 1rem; }
.signal--form .signal__alt .email__addr { font-size: clamp(1rem, 1.6vw, 1.25rem); }
.signal--form .signal__alt .btn { min-height: 2.4rem; padding: 0.5rem 0.95rem; font-size: 0.68rem; }
.sform { display: grid; gap: 1.1rem; }
.sform__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.sform__field { display: grid; gap: 0.45rem; }
.sform label, .sform legend { font: 400 0.64rem/1.2 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--hud); }
.sform input:not([type="radio"]), .sform textarea {
  width: 100%;
  min-width: 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgb(243 239 226 / 0.18);
  border-radius: 0.7rem;
  background: rgb(2 3 10 / 0.55);
  font: 400 1rem/1.45 var(--font);
  color: var(--star);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.sform textarea { min-height: 7.5rem; resize: vertical; }
.sform input::placeholder, .sform textarea::placeholder { color: rgb(146 154 185 / 0.75); }
.sform input:focus, .sform textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgb(242 196 109 / 0.18); }
.sform [aria-invalid="true"] { border-color: #ff8a7a; }
.sform__err { font-size: 0.82rem; color: #ffb4a8; }
.sform__err:empty { display: none; }
.sform__kind { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; border: 0; }
.sform__kind legend { width: 100%; margin-bottom: 0.55rem; padding: 0; }
.sform__kind label { position: relative; font: inherit; letter-spacing: 0; text-transform: none; }
.sform__kind input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sform__kind span { display: inline-block; padding: 0.5rem 0.9rem; border: 1px solid rgb(243 239 226 / 0.2); border-radius: 999px; font: 400 0.9rem/1.2 var(--font); color: var(--muted); transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.sform__kind input:checked + span { border-color: var(--gold); background: rgb(242 196 109 / 0.14); color: var(--star); }
.sform__kind input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.sform__kind label:hover span { border-color: rgb(242 196 109 / 0.6); }
.sform__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sform__send { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.2rem; }
.sform__send .btn[disabled] { opacity: 0.7; cursor: progress; }
.sform__note { font: 400 0.64rem/1.5 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--hud-dim); }
.sform__status { font-size: 0.92rem; color: #ffb4a8; }
.sform__status:empty { display: none; }
.signal.is-sending::after { animation-duration: 0.7s; }
.sform__done { display: grid; gap: 0.8rem; align-content: start; padding: 1.4rem 0; }
.sform__done:focus { outline: none; }
.sform__done h4 { font: 300 clamp(1.6rem, 3vw, 2.4rem)/1.1 var(--font); letter-spacing: 0.04em; text-transform: uppercase; color: var(--star); }
.sform__done p { color: var(--muted); max-width: 40ch; }
.sform__done .sform__demo { font: 400 0.64rem/1.5 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--hud-dim); }
.sform__done .btn { justify-self: start; }

@media (max-width: 62em) {
  .signal--form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 52em) {
  /* a compact strip above the bottom of the hero */
  .iss { left: var(--gutter); right: var(--gutter); bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px)); width: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 0.8rem; padding: 0.7rem 0.8rem; }
  .iss__head, .iss__where { grid-column: 1; }
  .iss__where { margin-top: 0.3rem; font-size: 0.85rem; }
  .iss__nums, .iss__map { display: none; }
  .iss__find { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  .iss__mode { margin-left: 0.4rem; }
}
@media (max-width: 40em) {
  .sform__row { grid-template-columns: minmax(0, 1fr); }
  .moon-read { width: 12rem; margin-left: -6rem; font-size: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .motion .iss.is-live .iss__dot { animation: none; }
}

/* ---------- the globe you climb away from can be spun too ---------- */
.earth-grip--globe { position: fixed; z-index: 3; display: none; height: auto; border-radius: 50%; cursor: grab; touch-action: pan-y; }
.earth-grip--globe.is-on { display: block; }
.earth-grip--globe.is-dragging { cursor: grabbing; }
