/* ============================================================================
   LocalLights — signals: the report grid, the Still lit? prompt, the fab.

   Tokens only, from css/style.css. Every class here is prefixed rg-; the
   shared .bsheet / .tiles / .tile / .fab names ride along on the same
   elements so the brand's rules apply too, and these win ties by loading
   later. Built for a thumb in a dark car: big tiles, amber on navy, nothing
   fiddly.
   ========================================================================= */

/* ---------------------------------------------------------- the sheet --- */

.rg-wrap {
  position: fixed; inset: 0;
  z-index: 150;                       /* over the card and the dock, under toasts */
  overscroll-behavior: contain;
}
.rg-scrim {
  position: absolute; inset: 0;
  background: var(--night);
  opacity: .72;
  animation: rg-fade .18s ease;
}
.rg-wrap .rg-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: block;
  margin: 0 auto;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--night-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -14px 44px var(--night);
  padding: 0 0 calc(18px + env(safe-area-inset-bottom, 0px));
  transform: none;
  opacity: 1;
  animation: rg-up .24s cubic-bezier(.2, .8, .3, 1);
  will-change: transform;
}
/* A dismissed sheet stops taking taps at once, so the thing under it (the
   fab, a marker) gets the next one even mid-animation. */
.rg-wrap.is-closing { pointer-events: none; }
.rg-wrap.is-closing .rg-scrim { animation: rg-fade .18s ease reverse forwards; }
.rg-wrap.is-closing .rg-sheet { animation: rg-down .18s ease forwards; }

.rg-handle {
  width: 40px; height: 5px;
  border-radius: 3px;
  background: var(--line);
  margin: 10px auto 4px;
}
.rg-body { padding: 6px 16px 0; }

.rg-head { padding: 4px 2px 12px; }
.rg-head.rg-center { text-align: center; }
.rg-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: .01em;
  color: var(--text);
}
.rg-where {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-2);
}

/* --------------------------------------------------------------- grid --- */

.rg-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rg-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 108px;
  padding: 13px 13px 12px;
  border-radius: var(--radius, 14px);
  background: var(--night-3);
  border: 1.5px solid var(--line);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, border-color .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.rg-tile .rg-ico {
  display: block;
  width: 30px; height: 30px;
  margin-bottom: auto;
  color: var(--amber);
}
.rg-tile .rg-ico svg, .rg-thumb .rg-ico svg, .rg-fab svg { display: block; width: 100%; height: 100%; }
.rg-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rg-tile .rg-label {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.15;
}
.rg-tile .rg-sub {
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-3);
}

/* Small accents only: the map's glow stays the loudest thing on screen. */
.rg-tile.rg-new_display .rg-ico { color: var(--bulb-green); }
.rg-tile.rg-dark .rg-ico        { color: var(--text-2); }
.rg-tile.rg-tune_in .rg-ico     { color: var(--bulb-blue); }
.rg-tile.rg-wrong_spot .rg-ico  { color: var(--bulb-red); }

/* The fifth tile lies across both columns so the grid has no orphan. */
.rg-tile.rg-wrong_spot {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
}
.rg-tile.rg-wrong_spot .rg-ico { margin-bottom: 0; }

@media (hover: hover) {
  .rg-tile:not(:disabled):hover { border-color: var(--amber); }
}
.rg-tile:not(:disabled):active { transform: translateY(1px) scale(.99); border-color: var(--amber); }
.rg-tile:focus-visible, .rg-thumb:focus-visible, .rg-skip:focus-visible, .rg-input:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
.rg-tile:disabled {
  opacity: .5;
  cursor: default;
}
.rg-tile:disabled .rg-ico { color: var(--text-3); }
.rg-tile:disabled .rg-sub { color: var(--text-2); }

/* The tapped tile glows while its signal is on the way; the rest wait. */
.rg-tile.is-busy, .rg-thumb.is-busy, .rg-send.is-busy {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber), 0 0 26px var(--glow);
  animation: rg-pulse .9s ease-in-out infinite;
}
.rg-tiles[aria-busy="true"] .rg-tile:not(.is-busy),
.rg-thumbs[aria-busy="true"] .rg-thumb:not(.is-busy) { opacity: .4; }

.rg-foot {
  margin: 12px 2px 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-3);
  text-align: center;
}

/* -------------------------------------------------- tune in, wrong spot --- */

.rg-form { padding: 2px 0 4px; }
.rg-flabel {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.rg-opt { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--text-3); }
.rg-form .rg-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 54px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--night);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  -webkit-appearance: none;
  appearance: none;
}
.rg-form .rg-input::placeholder { color: var(--text-3); opacity: 1; }
.rg-form .rg-input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--glow);
}
.rg-form .rg-input:disabled { opacity: .6; }
.rg-fmrow { display: flex; align-items: stretch; gap: 8px; }
.rg-fmprefix {
  display: grid; place-items: center;
  flex: 0 0 auto;
  min-width: 58px;
  padding: 0 12px;
  border-radius: var(--radius-sm, 10px);
  background: var(--night-3);
  border: 1.5px solid var(--line);
  color: var(--amber);
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
}
.rg-fm .rg-input {
  font-family: var(--display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: .02em;
}
.rg-input.is-shake { animation: rg-shake .3s ease; border-color: var(--danger); }
.rg-err  { margin: 8px 2px 0; font-size: 13px; line-height: 1.35; color: var(--danger); }
.rg-note { margin: 8px 2px 0; font-size: 12.5px; line-height: 1.35; color: var(--text-3); }
.rg-actions { display: flex; gap: 10px; margin-top: 14px; }
.rg-actions .btn { flex: 1 1 auto; min-height: 48px; }

/* ---------------------------------------------------------- still lit --- */

.rg-wrap-lit .rg-sheet { max-width: 480px; }
.rg-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 2px;
}
.rg-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 136px;
  padding: 12px;
  border-radius: var(--radius, 14px);
  background: var(--night-3);
  border: 1.5px solid var(--line);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, border-color .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.rg-thumb .rg-ico { width: 50px; height: 50px; }
.rg-thumb .rg-label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.1;
}
.rg-thumb.rg-up {
  border-color: var(--amber);
  box-shadow: 0 0 30px var(--glow);
}
.rg-thumb.rg-up .rg-ico   { color: var(--amber); }
.rg-thumb.rg-down .rg-ico { color: var(--text-2); }
.rg-thumb:not(:disabled):active { transform: translateY(1px) scale(.98); }
.rg-skip {
  display: block;
  margin: 12px auto 0;
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.rg-skip:active { color: var(--text-2); }

/* ---------------------------------------------------------------- fab --- */

/* Amber bulb with a plus, breathing. The host decides where it sits; this
   only decides what it looks like. */
.rg-fab {
  width: 56px; height: 56px;
  padding: 0;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--amber);
  color: var(--night);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 22px var(--night), 0 0 18px 2px var(--glow);
  animation: rg-breathe 2.8s ease-in-out infinite;
  transition: transform .08s ease;
}
.rg-fab svg { width: 30px; height: 30px; }
.rg-fab:active { transform: scale(.95); background: var(--amber-2); }
.rg-fab:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
@media (hover: hover) { .rg-fab:hover { background: var(--amber-2); } }

/* -------------------------------------------------------------- motion --- */

@keyframes rg-fade   { from { opacity: 0; } to { opacity: .72; } }
@keyframes rg-up     { from { transform: translateY(14%); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes rg-down   { to { transform: translateY(100%); opacity: .6; } }
@keyframes rg-pulse  { 0%, 100% { box-shadow: 0 0 0 1px var(--amber), 0 0 14px var(--glow); }
                       50%      { box-shadow: 0 0 0 1px var(--amber), 0 0 34px 4px var(--glow); } }
@keyframes rg-breathe { 0%, 100% { box-shadow: 0 8px 22px var(--night), 0 0 16px 2px var(--glow); }
                        50%      { box-shadow: 0 8px 22px var(--night), 0 0 30px 8px var(--glow); } }
@keyframes rg-shake  { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@media (prefers-reduced-motion: reduce) {
  .rg-fab, .rg-tile.is-busy, .rg-thumb.is-busy, .rg-send.is-busy { animation: none; }
  .rg-wrap .rg-sheet, .rg-scrim, .rg-wrap.is-closing .rg-sheet, .rg-wrap.is-closing .rg-scrim { animation-duration: .01ms; }
}
