/* ============================================================
   THE RAIL — left margin, every page
   Coffee & Trades

   Four modules:
     the bell      · session clock, cup fills through the day
     running hot   · biggest movers right now, auto-selected
     near the cove · names approaching a mapped zone  [PREMIUM]
     what's brewing· this week's catalysts

   Everything scoped to #ct-beans. Desktop only by design.
   ============================================================ */

#ct-beans {
  display: none;
  width: 168px;
  z-index: 5;
  font-family: 'DM Mono', monospace;
  pointer-events: auto;
}

/* In-flow on the desk grid — left of the centered column, every page. */
@media (min-width: 1200px) {
  #ct-beans {
    display: block;
    position: relative;
    top: auto;
    left: auto;
    width: auto;
  }
}

/* ---------- module frame ---------- */

#ct-beans .rl-mod {
  padding: 0 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

#ct-beans .rl-mod:last-child { border-bottom: none; margin-bottom: 0; }

#ct-beans .rl-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 3px;
}

#ct-beans .rl-title {
  font-size: 8.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink3);
}

#ct-beans .rl-mod-cove .rl-title { color: var(--gold); }

#ct-beans .rl-count { font-size: 7.5px; letter-spacing: .08em; color: var(--rule2); }

#ct-beans .rl-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 9px; line-height: 1.4; font-style: italic;
  color: var(--ink3); margin-bottom: 6px;
}

#ct-beans .rl-empty {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px; font-style: italic; color: var(--ink3);
  padding: 8px 0;
}

/* ---------- rows ---------- */

#ct-beans .rl-row {
  padding: 4px 0;
  border-top: 1px dotted var(--rule);
  cursor: pointer;
  border-radius: 3px;
  transition: background .14s ease;
}

#ct-beans .rl-row:first-of-type { border-top: none; }
#ct-beans .rl-row:hover { background: var(--paper2); }
#ct-beans .rl-row:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- the bell ---------- */

#ct-beans .rl-bell-body { display: flex; align-items: center; gap: 8px; }
#ct-beans .rl-bell-cup { flex-shrink: 0; width: 28px; height: 28px; }

#ct-beans .rl-bell-time {
  font-family: 'Playfair Display', serif;
  font-size: 15px; font-weight: 600; line-height: 1.1; color: var(--ink);
}

#ct-beans .rl-bell-state { font-size: 8.5px; letter-spacing: .1em; margin-top: 2px; }
#ct-beans .rl-bell-state.open   { color: var(--green); }
#ct-beans .rl-bell-state.pre    { color: var(--gold); }
#ct-beans .rl-bell-state.closed { color: var(--ink3); }
#ct-beans .rl-bell-note { font-size: 8px; color: var(--ink3); margin-top: 3px; }

/* ---------- running hot ---------- */

#ct-beans .rl-hot-row { display: flex; align-items: center; gap: 6px; }
#ct-beans .rl-hot-sym { font-size: 12px; width: 38px; flex-shrink: 0; color: var(--ink); }
#ct-beans .rl-hot-spark { flex: 1; min-width: 0; height: 16px; }
#ct-beans .rl-hot-chg { font-size: 11px; width: 50px; text-align: right; flex-shrink: 0; }
#ct-beans .rl-hot-chg.up { color: var(--green); }
#ct-beans .rl-hot-chg.dn { color: var(--red); }

/* ---------- near the cove ---------- */

#ct-beans .rl-cove-top { display: flex; align-items: baseline; gap: 6px; }
#ct-beans .rl-cove-sym { font-size: 11.5px; color: var(--ink); }

#ct-beans .rl-cove-pill {
  font-size: 7.5px; letter-spacing: .08em;
  padding: 1.5px 5px; border-radius: 2px; border: 1px solid;
}

#ct-beans .rl-cove-pill.dz { background: var(--green-bg); color: var(--green); border-color: var(--green-bd); }
#ct-beans .rl-cove-pill.sz { background: var(--red-bg);   color: var(--red);   border-color: var(--red-bd); }

#ct-beans .rl-cove-dist { font-size: 10px; color: var(--gold); margin-left: auto; }
#ct-beans .rl-cove-dist.inside { font-weight: 500; }
#ct-beans .rl-cove-meta { font-size: 8.5px; color: var(--ink3); margin-top: 2px; }

/* locked state for non-members */

#ct-beans .rl-lock {
  position: relative;
  border: 1px dashed var(--rule);
  border-radius: 4px;
  padding: 13px 14px;
  overflow: hidden;
}

#ct-beans .rl-lock-ghost { opacity: .38; pointer-events: none; }

#ct-beans .rl-lock-ghost .rl-ghost-bar {
  height: 8px; border-radius: 2px;
  background: var(--rule); margin-bottom: 7px;
}

#ct-beans .rl-lock-veil {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 7px;
  background: rgba(250, 248, 244, .55);
  text-align: center; padding: 8px;
}

#ct-beans .rl-lock-tag { font-size: 8px; letter-spacing: .14em; color: var(--amber); }

#ct-beans .rl-lock-copy {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px; line-height: 1.4;
  color: var(--ink2); max-width: 158px;
}

#ct-beans .rl-lock-btn {
  font-family: 'DM Sans', sans-serif;
  background: var(--gold); color: var(--ink);
  border: 0; font-size: 10px; font-weight: 500;
  padding: 5px 13px; border-radius: 4px; cursor: pointer;
}

#ct-beans .rl-lock-btn:hover { filter: brightness(1.06); }

/* ---------- what's brewing ---------- */

#ct-beans .rl-mod-brew .rl-row { padding: 3px 0; }
#ct-beans .rl-brew-row { display: flex; align-items: baseline; gap: 6px; }

#ct-beans .rl-brew-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0; border: 1px solid var(--rule2); background: transparent;
}

#ct-beans .rl-brew-row.key .rl-brew-dot { background: var(--gold); border-color: var(--gold); }
#ct-beans .rl-brew-when { font-size: 7.5px; letter-spacing: .05em; color: var(--ink3); width: 48px; flex-shrink: 0; }

#ct-beans .rl-brew-what {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px; color: var(--ink2); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#ct-beans .rl-brew-row.key .rl-brew-what { color: var(--ink); font-weight: 500; }
#ct-beans .rl-brew-tag { font-size: 7.5px; letter-spacing: .08em; color: var(--rule2); flex-shrink: 0; }

#ct-beans .rl-brew-compact { font-size: 9.5px; color: var(--ink3); line-height: 1.7; }
#ct-beans .rl-brew-compact b { color: var(--ink); font-weight: 400; }

/* ---------- loading ---------- */

#ct-beans.is-loading .rl-mod-hot { opacity: .45; }

@media (prefers-reduced-motion: reduce) {
  #ct-beans * { transition-duration: .01ms !important; }
}

@media print { #ct-beans { display: none !important; } }

/* ---------- the spill ---------- */

#ct-beans .rl-spill {
  margin-top: 14px;
  padding-top: 2px;
  pointer-events: none;
}

#ct-beans .rl-spill svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

#ct-beans .rl-bean {
  opacity: 0;
  animation: rlBeanIn .5s ease forwards;
}

/* opacity only — each bean's transform attribute carries its position,
   rotation and scale, and a CSS transform here would wipe all three */
@keyframes rlBeanIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#ct-beans .rl-spill-cap {
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--rule2);
  text-align: center;
  margin-top: 10px;
}

/* the drop-in is a one-shot flourish, not a loop — but still opt-out */
@media (prefers-reduced-motion: reduce) {
  #ct-beans .rl-bean { opacity: 1; animation: none !important; }
}
