/* ───────── Send a Signal ─────────
   Full-screen night sky that opens over the homepage. The site header stays on top;
   one glass control deck docks at the bottom and its contents change per step:
   Tune → Speak → Send → Land → Echo → Explore. Uses the site's tokens (styles.css). */

.signal {
  --sg-deck: rgba(20, 17, 52, 0.84);
  --sg-faint: #8f89bd;
  position: fixed; inset: 0; z-index: 46; background: var(--bg);
  font-weight: 300;
}
.signal[hidden] { display: none; }
.signal [hidden] { display: none !important; }
html.signal-open, body.signal-open { overflow: hidden; }
/* While the sky is open, the journey's own floating controls step aside. */
body.signal-open .rail, body.signal-open .progress, body.signal-open .globe-reset,
body.signal-open .pin-tip, body.signal-open .globe-hit { visibility: hidden; }
body.signal-open .site-header::before { opacity: 1; background: linear-gradient(to bottom, rgba(11, 10, 29, 0.96) 55%, rgba(11, 10, 29, 0)); }
/* the nav shows Send a Signal as the current place while the sky is open */
body.signal-open .site-nav a.active { color: var(--muted); }
.site-nav a[aria-current='page'] { color: var(--accent); }

.sg-sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
.sg-sky.pan { cursor: grab; }
.signal :focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; border-radius: 6px; }

.sg-close {
  position: absolute; z-index: 3; top: calc(var(--header-h) + 8px); right: var(--gutter);
  width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; color: var(--text);
  background: rgba(11, 10, 29, 0.65); border: 1px solid var(--line-strong); border-radius: 50%;
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.sg-close:hover { border-color: var(--pink); background: rgba(255, 111, 216, 0.12); }

/* deck */
.sg-deck {
  position: absolute; z-index: 2; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  margin-inline: auto; max-width: 940px;
  background: var(--sg-deck); border: 1px solid var(--line); border-radius: 22px; padding: 22px 26px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(163, 124, 255, 0.08);
}
.sg-stage { display: flex; flex-direction: column; gap: 14px; animation: sg-rise 0.45s ease both; }
@keyframes sg-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sg-eyebrow { margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.sg-h1, .sg-h2 { margin: 0; font-weight: 300; letter-spacing: -0.01em; text-wrap: balance; line-height: 1.15; }
.sg-h1 { font-size: clamp(24px, 3.1vw, 34px); }
.sg-h2 { font-size: clamp(22px, 2.6vw, 30px); display: block; }
.sg-h1 em, .sg-h2 em { font-style: normal; color: var(--pink); }
.sg-sub { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; max-width: 52ch; }
.sg-fine { font-size: 13px; color: var(--sg-faint); line-height: 1.45; }
.sg-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sg-row.between { justify-content: space-between; }

.sg-btn {
  border-radius: 999px; padding: 11px 20px; min-height: 44px; font-size: 14px; font-weight: 500; letter-spacing: 0.04em;
  cursor: pointer; border: 1px solid transparent; transition: box-shadow 0.2s, opacity 0.2s, background-color 0.2s, border-color 0.2s;
}
.sg-btn.primary { background: var(--accent); color: var(--bg-deep); box-shadow: 0 0 24px rgba(163, 124, 255, 0.45); }
.sg-btn.primary:hover:not(:disabled) { box-shadow: 0 0 34px rgba(163, 124, 255, 0.75); }
.sg-btn.pink { background: var(--pink); color: var(--bg-deep); box-shadow: 0 0 24px rgba(255, 111, 216, 0.45); }
.sg-btn.pink:hover:not(:disabled) { box-shadow: 0 0 34px rgba(255, 111, 216, 0.7); }
.sg-btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.sg-btn.ghost:hover:not(:disabled) { border-color: var(--accent); }
.sg-btn:disabled { opacity: 0.38; cursor: not-allowed; box-shadow: none; }

/* tune */
.sg-tune { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 30px; align-items: center; }
.sg-tune-copy { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sg-dial { width: clamp(210px, 27vw, 264px); height: auto; max-width: 100%; display: block; touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
.sg-dial text { font-family: var(--font); pointer-events: none; }
.sg-dial text.sg-mono { font-family: var(--mono); }
.sg-needle { transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1); transform-origin: 150px 150px; }
.sg-freq { display: flex; align-items: baseline; gap: 14px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
#sg-freq-num { font-size: 28px; color: var(--text); letter-spacing: 0.02em; }
#sg-freq-label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
#sg-freq-label.locked { color: var(--pink); }

/* speak */
.sg-msg {
  width: 100%; resize: none; background: rgba(11, 10, 29, 0.65); border: 1px solid var(--line); border-radius: 14px; color: var(--text);
  font: 300 19px/1.45 var(--font); padding: 14px 16px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.sg-msg:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(163, 124, 255, 0.18); }
.sg-msg::placeholder { color: var(--sg-faint); }
.sg-count { font-family: var(--mono); font-variant-numeric: tabular-nums; margin-left: 8px; }
.sg-care { margin: 0; border-top: 1px solid var(--line); padding-top: 12px; }
.sg-chip { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; border: 1px solid currentColor; }

/* landed */
.sg-big { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.sg-big .n { font-size: clamp(44px, 6vw, 64px); font-weight: 300; line-height: 1; color: var(--pink); font-variant-numeric: tabular-nums; text-shadow: 0 0 30px rgba(255, 111, 216, 0.45); }
.sg-big .t { color: var(--muted); font-size: 17px; max-width: 40ch; line-height: 1.45; }

/* echoes */
.sg-echoes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 40vh; overflow: auto; }
.sg-echoes li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 2px; border-top: 1px solid var(--line); }
.sg-echoes li:first-child { border-top: 0; }
.sg-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 9px; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: sg-blink 1.4s ease-in-out infinite; }
.sg-echoes li.sent .sg-dot { background: var(--pink); box-shadow: 0 0 14px var(--pink); animation: none; }
@keyframes sg-blink { 50% { opacity: 0.35; } }
.sg-echo-meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sg-faint); margin: 0 0 5px; }
.sg-echo-text { margin: 0; font-size: 18px; line-height: 1.4; min-height: 1.4em; }
.sg-echo-btn { white-space: nowrap; padding: 9px 15px; font-size: 13px; }
.sg-echoes li.waiting { opacity: 0.5; }
.sg-echoes li.waiting .sg-echo-text { color: var(--sg-faint); font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; }
.sg-explore-hint { margin: 0; }

/* tooltip */
.sg-tip {
  position: fixed; z-index: 47; max-width: 290px; background: var(--sg-deck); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; pointer-events: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.sg-tip .sg-tip-k { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; }
.sg-tip p { margin: 6px 0; font-size: 16px; line-height: 1.4; }
.sg-tip .sg-tip-m { font-size: 12px; color: var(--sg-faint); }

@media (max-width: 680px) {
  .sg-deck { padding: 18px; border-radius: 18px; }
  .sg-tune { grid-template-columns: 1fr; gap: 12px; justify-items: center; }
  .sg-tune-copy { align-items: center; text-align: center; }
  .sg-tune .sg-sub { display: none; }
  .sg-dial { width: min(220px, 62vw); }
  .sg-freq { justify-content: center; }
  .sg-row { justify-content: center; }
  .sg-echoes li { grid-template-columns: 12px minmax(0, 1fr); }
  .sg-echo-btn { grid-column: 2; justify-self: start; }
}
/* arrival: look first, then the Send button fades in */
.sg-look-intro { display: none; flex-direction: column; gap: 10px; }
.looking .sg-look-intro { display: flex; }
.sg-btn.sg-waiting { opacity: 0; visibility: hidden; transform: translateY(6px); }
#sg-again2 { transition: opacity 0.9s ease, transform 0.9s ease, visibility 0s, box-shadow 0.2s; }
#sg-again2.sg-waiting { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .sg-stage, .sg-dot { animation: none; }
  .sg-needle { transition: none; }
}
