/* radioctl SHARE MY LOCATION - styles for web/geoshare.js.
 *
 * EVERY selector is namespaced `.rgs-` / `#rgs-`. Three other stylesheets
 * (style.css, live.css, edit.css) are owned by other surfaces and this
 * file is dropped into pages that load any of them, so a bare `.card` or
 * `button` rule here could restyle somebody else's page.
 *
 * Colours come from the host page's variables where they exist, with a
 * literal fallback in every var() - this module has to look right on
 * live.css's near-black field palette AND on style.css's map chrome, and
 * it must still be legible if neither is loaded.
 *
 * The person hue (#ff4fa3) is app.js's TECH_COLOR on purpose: the colour
 * of the indicator that says "you are broadcasting" is the colour of the
 * pin other people are looking at.
 */

.rgs-gone { display: none !important; }

/* ------------------------------------------------------------------ *
 * the card
 * ------------------------------------------------------------------ */
.rgs-card {
  --rgs-person: #ff4fa3;
  background: var(--bg2, #1c2027);
  border: 1px solid var(--line, #323a46);
  border-radius: 12px;
  padding: 11px 13px 12px;
  color: var(--fg, #d7dce3);
  font: 15px/1.4 "Segoe UI", system-ui, -apple-system, sans-serif;
}
/* no mount point given: float it out of the way, bottom-left, clear of
 * the map's own bottom-right control stack */
.rgs-card.rgs-float {
  position: fixed;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 900;
  width: min(320px, calc(100vw - 24px));
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}
/* ... and while the fixed bar is up, sit above it rather than under it */
html.rgs-live .rgs-card.rgs-float {
  bottom: calc(104px + env(safe-area-inset-bottom));
}

.rgs-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.rgs-ico { display: flex; color: var(--rgs-person, #ff4fa3); }
.rgs-title {
  font-size: 11px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted, #8a93a0);
  flex: 1 1 auto;
  min-width: 0;
}
.rgs-chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line, #323a46);
  color: var(--muted, #8a93a0);
  background: var(--bg3, #242a33);
  white-space: nowrap;
}
.rgs-card.rgs-live .rgs-chip {
  border-color: var(--rgs-person, #ff4fa3);
  color: #ffd0e6;
  background: #4a1230;
}
.rgs-card.rgs-warn .rgs-chip {
  border-color: var(--warn, #f0b849);
  color: var(--warn, #f0b849);
}

.rgs-copy {
  margin: 0 0 9px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--fg, #d7dce3);
}
.rgs-note {
  margin: 7px 0 0;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted, #8a93a0);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.rgs-btn {
  display: block;
  width: 100%;
  min-height: 46px;              /* field control: >= 44 px touch target */
  border: 0;
  border-radius: 10px;
  background: var(--rgs-person, #ff4fa3);
  color: #23000f;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.6px;
  cursor: pointer;
}
.rgs-btn:active { filter: brightness(0.9); }
.rgs-btn:disabled {
  background: var(--bg3, #242a33);
  color: var(--muted, #8a93a0);
  cursor: not-allowed;
}
.rgs-btn.rgs-btnstop {
  background: transparent;
  color: var(--fg, #d7dce3);
  border: 2px solid var(--rgs-person, #ff4fa3);
}

/* ------------------------------------------------------------------ *
 * THE ON-STATE. Fixed to the viewport, so it is on screen at every
 * scroll position and cannot be mistaken for a toast that will fade.
 * ------------------------------------------------------------------ */
.rgs-bar {
  --rgs-person: #ff4fa3;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483000;           /* above the map, its panes and controls */
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: #3a0c22;
  border-top: 3px solid var(--rgs-person, #ff4fa3);
  color: #ffe4f0;
  font: 13px/1.3 "Segoe UI", system-ui, -apple-system, sans-serif;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
}
/* on but currently withheld (off site, no fix, offline): still loudly ON,
 * amber rather than pink so the two are never confused at a glance */
.rgs-bar.rgs-warn {
  background: #3a2e12;
  border-top-color: var(--warn, #f0b849);
  color: #ffe7bd;
}
.rgs-bar.rgs-muted { background: #23262c; border-top-color: #5a626e;
                     color: #cfd5de; }

.rgs-bartext { flex: 1 1 auto; min-width: 0; }
.rgs-bartext b {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
/* WRAPS rather than ellipsising. On a 375 px phone the sub-line is
 * "<park> · visible to signed-in staff · updated N s ago" and a single
 * nowrap line cut it at "visible to signed-in staff · ..." - i.e. it
 * dropped exactly the part that says the pin is still alive. Two lines
 * of 11.5 px is a cheaper price than a bar that hides its own freshness. */
.rgs-bartext span {
  display: block;
  font-size: 11.5px;
  line-height: 1.3;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.rgs-livedot {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--rgs-person, #ff4fa3);
  box-shadow: 0 0 0 0 rgba(255, 79, 163, 0.7);
  animation: rgs-pulse 1.8s ease-out infinite;
}
.rgs-bar.rgs-warn .rgs-livedot {
  background: var(--warn, #f0b849);
  box-shadow: 0 0 0 0 rgba(240, 184, 73, 0.7);
  animation-name: rgs-pulse-warn;
}
.rgs-bar.rgs-muted .rgs-livedot { background: #8a93a0; animation: none; }

@keyframes rgs-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 79, 163, 0.75); }
  70%  { box-shadow: 0 0 0 11px rgba(255, 79, 163, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 79, 163, 0); }
}
@keyframes rgs-pulse-warn {
  0%   { box-shadow: 0 0 0 0 rgba(240, 184, 73, 0.75); }
  70%  { box-shadow: 0 0 0 11px rgba(240, 184, 73, 0); }
  100% { box-shadow: 0 0 0 0 rgba(240, 184, 73, 0); }
}

.rgs-stop {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 10px;
  border: 2px solid currentColor;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
}
.rgs-stop:active { background: rgba(0, 0, 0, 0.5); }

/* the bar is fixed, so give the document room to scroll past it rather
 * than parking its last line permanently underneath (sized for the
 * two-line sub-text above) */
html.rgs-live body { padding-bottom: 104px; }

/* A pulsing indicator is exactly what a reduced-motion setting is about,
 * but "am I broadcasting" must survive it - so the motion goes and the
 * ink stays (a solid ring instead of a pulse). */
@media (prefers-reduced-motion: reduce) {
  .rgs-livedot {
    animation: none;
    box-shadow: 0 0 0 4px rgba(255, 79, 163, 0.35);
  }
  .rgs-bar.rgs-warn .rgs-livedot {
    box-shadow: 0 0 0 4px rgba(240, 184, 73, 0.35);
  }
}

/* very narrow phones only. The WORD "stop" is kept as long as it fits:
 * the bare square glyph is a weaker exit than the word, and the exit is
 * half of what this bar is for. A 375 px phone still reads "STOP". */
@media (max-width: 330px) {
  .rgs-bar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .rgs-stop { padding: 0 11px; }
  .rgs-stop span { display: none; }   /* the square glyph carries it */
}
