/* THE GOD TERMINAL — orbital scene (js/orbit.js): title, satellites, labels, uplink status. */

.show.show-orbit { position: absolute; inset: 0; pointer-events: auto; }

.orb {
  --sat: 3rem;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  touch-action: none;
  /* Nearly opaque: the dashboard is only a ghost behind the void, never competing with the labels. */
  background: radial-gradient(ellipse 72% 78% at 50% 52%,
    color-mix(in srgb, var(--bg) 93%, transparent),
    color-mix(in srgb, var(--bg) 97%, transparent));
}
.orb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

/* ───────── title + close ───────── */
.orb-head {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: max(1rem, env(safe-area-inset-top)) 5rem 0.4rem;
  text-align: center;
  pointer-events: none;
}
.orb-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 2.4rem + 1.4vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0.12em;
  color: var(--text-bright);
  text-shadow: 0 0 calc(18px * var(--glow-k)) var(--glow), 0 0 calc(3px * var(--glow-k)) var(--text);
  animation: orb-flicker 760ms linear both;
}
.orb-head::after {
  content: '';
  display: block;
  width: min(30rem, 72vw);
  height: 1px;
  margin: 0.45rem auto 0;
  background: linear-gradient(90deg, transparent, var(--line-bright), transparent);
  animation: orb-wipe 700ms 160ms cubic-bezier(.2, .8, .2, 1) both;
}
.orb-close {
  position: absolute;
  top: max(0.9rem, env(safe-area-inset-top));
  right: max(0.9rem, env(safe-area-inset-right));
  min-width: 2.75rem;
  min-height: 2.75rem;
  gap: 0.55rem;
  padding: 0 0.8rem;
  font-size: 1.125rem;
  pointer-events: auto;
}
.orb-close kbd { font-size: 0.75rem; }

/* ───────── satellites ───────── */
.orb-sats { position: absolute; inset: 0; pointer-events: none; }
.orb-sat {
  position: absolute;
  left: 0; top: 0;
  width: var(--sat);
  height: var(--sat);
  transform: scale(0);
  will-change: transform;
}
.orb-sat-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--c);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  transition: transform 150ms cubic-bezier(.2, 1.6, .4, 1), opacity 280ms;
}
.orb-sat-btn:focus-visible { outline: 2px solid var(--c); outline-offset: 4px; }
.orb-sat-btn.is-pressed { transform: scale(1.22); }
.orb-sat-ring {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 16%, transparent) 0 52%, transparent 72%);
  transition: transform 180ms cubic-bezier(.2, 1.6, .4, 1), border-color 160ms, box-shadow 220ms;
}
.orb-sat.is-hover .orb-sat-ring,
.orb-sat-btn:focus-visible .orb-sat-ring {
  transform: scale(1.16);
  border-color: var(--c);
  box-shadow: 0 0 calc(16px * var(--glow-k) + 6px) -2px var(--c), inset 0 0 12px -4px var(--c);
}
/* Target-lock brackets on the chosen satellite. */
.orb-sat-btn::before {
  content: '';
  position: absolute;
  inset: -9px;
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / 10px 2px,
    linear-gradient(var(--c), var(--c)) top left / 2px 10px,
    linear-gradient(var(--c), var(--c)) top right / 10px 2px,
    linear-gradient(var(--c), var(--c)) top right / 2px 10px,
    linear-gradient(var(--c), var(--c)) bottom left / 10px 2px,
    linear-gradient(var(--c), var(--c)) bottom left / 2px 10px,
    linear-gradient(var(--c), var(--c)) bottom right / 10px 2px,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 10px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 4px var(--c));
}
.orb-sat.is-selected .orb-sat-btn::before { animation: orb-lock 460ms cubic-bezier(.2, 1.5, .4, 1) both; }
.orb-sat.is-selected .orb-sat-ring { border-color: var(--c); box-shadow: 0 0 calc(16px * var(--glow-k) + 6px) -2px var(--c); }
.orb-sat.is-linked .orb-sat-ring {
  border-color: color-mix(in srgb, var(--c) 50%, #fff);
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 34%, transparent) 0 55%, transparent 72%);
  box-shadow: 0 0 calc(26px * var(--glow-k) + 8px) 0 var(--c), inset 0 0 14px -4px var(--c);
}
.orb.is-linking .orb-sat:not(.is-selected) .orb-sat-btn { opacity: 0.3; }

.orb-sat-core { position: relative; display: grid; place-items: center; width: 80%; height: 80%; pointer-events: none; }
.orb-sat-icon {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 calc(5px * var(--glow-k) + 1px) color-mix(in srgb, var(--c) 75%, transparent));
}
.orb-sat-icon .bd { fill: var(--c); fill-opacity: 0.2; stroke: var(--c); stroke-width: 1.8; stroke-linejoin: round; }
.orb-sat-icon .pn { fill: var(--c); fill-opacity: 0.45; stroke: var(--c); stroke-width: 1.2; stroke-linejoin: round; }
.orb-sat-icon .ln { fill: none; stroke: var(--c); stroke-width: 1.3; stroke-linecap: round; }
.orb-sat-icon .dt { fill: var(--c); }
.orb-sat-icon .fl {
  fill: color-mix(in srgb, var(--c) 45%, #fff);
  transform-origin: -12px -2.5px;
  animation: orb-flame 140ms steps(2) infinite alternate;
}
.orb-sat-icon .st { animation: orb-steam 1.8s ease-in-out infinite; }
.orb-sat-flash {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle, #fff 0 28%, color-mix(in srgb, var(--c) 70%, transparent) 52%, transparent 72%);
}

/* ───────── labels ───────── */
.orb-label {
  position: absolute;
  left: 0; top: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform, opacity;
}
.orb-label-in {
  padding: 0.2rem 0.55rem 0.26rem;
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
  border-left: 2px solid var(--c);
  border-radius: 5px;
  background: color-mix(in srgb, var(--panel-strong) 80%, transparent);
  white-space: nowrap;
  line-height: 1.25;
  transition: opacity 280ms, border-color 160ms, box-shadow 220ms;
}
.orb-label.is-hover .orb-label-in { border-color: var(--c); box-shadow: 0 0 16px -4px var(--c); }
.orb-label-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-bright);
}
.orb-label-sig {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--c);
  font-variant-numeric: tabular-nums;
}
.orb-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.7rem; }
.orb-bars i { width: 3px; border-radius: 1px; background: currentColor; opacity: 0.22; transition: opacity 200ms; }
.orb-bars i:nth-child(1) { height: 32%; }
.orb-bars i:nth-child(2) { height: 56%; }
.orb-bars i:nth-child(3) { height: 80%; }
.orb-bars i:nth-child(4) { height: 100%; }
.orb-bars i.on { opacity: 1; }
.orb-label.is-blip .orb-sig-num { animation: orb-blip 320ms steps(2) 1; }
.orb.is-linking .orb-label:not(.is-selected) .orb-label-in { opacity: 0.3; }
.orb-label.is-linked .orb-label-in { border-color: var(--c); box-shadow: 0 0 20px -4px var(--c); }
.orb-label.is-linked .orb-sig-num { color: var(--text-bright); }

/* ───────── status ───────── */
.orb-status {
  --c: var(--accent);
  position: absolute;
  left: 0; right: 0;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  width: min(40rem, calc(100% - 2rem));
  min-height: 4.75rem;
  margin: 0 auto;
  padding: 0.85rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.65rem;
  pointer-events: none;
  animation: orb-rise 520ms 420ms cubic-bezier(.2, 1.3, .4, 1) both;
}
.orb-status-row { display: flex; align-items: center; gap: 0.8rem; }
.orb-led {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 10px var(--text);
  animation: orb-breathe 1.8s ease-in-out infinite;
}
.orb-status[data-state="linking"] .orb-led { background: var(--warn); box-shadow: 0 0 12px var(--warn); animation: orb-blink 340ms steps(2) infinite; }
.orb-status[data-state="done"] .orb-led { background: var(--good); box-shadow: 0 0 16px var(--good); animation: none; }
.orb-msg {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-bright);
  text-shadow: var(--text-glow);
}
.orb-status[data-state="idle"] { align-items: center; }
.orb-status[data-state="idle"] .orb-msg {
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  animation: orb-breathe 2.4s ease-in-out infinite;
}
.orb-em { color: var(--c); }
.orb-ok { color: var(--good); font-weight: 800; letter-spacing: 0.06em; }
.orb-dots { display: inline-block; animation: orb-blink 700ms steps(2) infinite; }
.orb-bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent);
}
.orb-status[data-state="idle"] .orb-bar { display: none; }
.orb-bar i { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); }
.orb-bar-back { background: #fff; transition: transform 140ms ease-out; }
.orb-bar-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 60%, #000), var(--c));
  box-shadow: 0 0 10px var(--c);
  transition: transform 420ms cubic-bezier(.3, .8, .3, 1) 220ms;
}
.orb-bar.is-hit { animation: orb-hit 420ms ease-out; }

/* ───────── motion ───────── */
@keyframes orb-flicker {
  0% { opacity: 0; transform: scale(0.94); }
  12% { opacity: 1; }
  18% { opacity: 0.2; }
  30% { opacity: 1; }
  38% { opacity: 0.55; }
  50%, 100% { opacity: 1; transform: none; }
}
@keyframes orb-wipe { from { transform: scaleX(0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes orb-rise { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes orb-lock { from { opacity: 0; scale: 1.9; } to { opacity: 1; scale: 1; } }
@keyframes orb-blink { 50% { opacity: 0.25; } }
@keyframes orb-breathe { 50% { opacity: 0.55; } }
@keyframes orb-blip { 50% { opacity: 0.2; } }
@keyframes orb-flame { from { transform: scaleX(0.75); } to { transform: scaleX(1.1); } }
@keyframes orb-steam { 50% { opacity: 0.25; transform: translateY(-1.5px); } }
@keyframes orb-hit { from { box-shadow: 0 0 18px 2px var(--c), inset 0 0 0 1px #fff; } }

html[data-reduced-motion="on"] .orb-title { animation: orb-rise 300ms ease-out both; }
html[data-reduced-motion="on"] .orb-led,
html[data-reduced-motion="on"] .orb-dots,
html[data-reduced-motion="on"] .orb-sat-icon .fl,
html[data-reduced-motion="on"] .orb-status[data-state="idle"] .orb-msg { animation: none; }

/* ───────── small screens ───────── */
@media (max-width: 599px) {
  /* The phone typer's big text sits right behind the system: hide it fully. */
  .orb { --sat: 2.875rem; background: color-mix(in srgb, var(--bg) 97%, transparent); }
  .orb-head { padding-left: 3.75rem; padding-right: 3.75rem; }
  .orb-title { font-size: 3rem; letter-spacing: 0.06em; }
  .orb-close { min-width: 2.75rem; padding: 0; }
  .orb-msg { font-size: 1rem; }
  .orb-status { padding: 0.75rem 0.95rem; min-height: 4.25rem; }
}
