/* ═══════════════════════════════════════════════════════════
   RISK / RETURN — SVG bubble scatter (graphs module).
   All classes are rr- prefixed; cc-section* are global + styled
   elsewhere. Colours are token vars only (auto light/dark): the
   bubble gradient stops and stroke are set inline in the JS (via
   var()) so the chart recolours with the theme. Direction never
   rides on colour alone — big bubbles carry a signed %, and every
   bubble's side of the zero line encodes sign (colourblind-safe).
   The SVG fills its card (viewBox aspect matches the measured
   box, so there is no letterbox), and the whole card is the plot.
═══════════════════════════════════════════════════════════ */

.rr-body { display: block; }

/* Body card recipe (shared house style). The card IS the plot — the SVG fills
   it edge to edge; internal margins live in the chart's own padding (PAD_* in
   the JS). position:relative anchors the hover tooltip. */
.rr-card {
  position: relative;
  display: flex;
  min-height: 15rem;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-tertiary) 90%, transparent);
  box-shadow: inset 0 0 0 1px var(--border-default), var(--shadow-pop);
  overflow: hidden;
}

/* Fills the card in both axes; the JS matches the viewBox aspect to THIS box.
   Deliberately NO min-height here: the card is measured before the SVG lands,
   so a min-height that grew the card afterwards would desync the viewBox aspect
   and reintroduce letterboxing. The row height (shared with Today's movers via
   the grid's stretch) is the height authority; the card min-height below is the
   only floor, and it guards the standalone/degenerate case. */
.rr-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Chart frame: faint grid + numeric ticks (main-chart language) ── */
.rr-grid {
  stroke: var(--border-default);
  stroke-width: 1;
  opacity: 0.55;
}
.rr-tick {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
/* Zero-return reference line — slightly stronger than the grid. */
.rr-zero {
  stroke: var(--border-strong);
  stroke-width: 1.25;
}

/* ── Bubbles ───────────────────────────────────────────────── */
/* transform-box:fill-box + centre origin so the hover/entrance scale grows
   from the bubble's own centre, not the SVG origin. */
.rr-bub {
  cursor: pointer;
  outline: none;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 140ms var(--ease-out, ease);
}
/* FLAT solid dots (fill = green/red token, set inline). The hairline
   panel-colored ring separates overlapping dots crisply — same trick as the
   treemap's tile ring. No gradients (owner-rejected as mushy AI-slop). */
/* The invisible pointer target under each bubble (see HIT_MIN_PX in
   riskreturn.js). fill:none paints nothing at any width — the reference
   rendering is untouched — and pointer-events:all hit-tests it anyway, which
   is the only way to floor an SVG circle to 24 CSS px. */
.rr-hit {
  fill: none;
  pointer-events: all;
}
.rr-dot {
  stroke: color-mix(in srgb, var(--bg-tertiary) 85%, transparent);
  stroke-width: 1.5;
  transition: filter 140ms var(--ease-out, ease);
}
/* Page-consistent hover language: a small lift (scale) + brighten (glow). */
.rr-bub:hover,
.rr-bub.rr-hot,
.rr-bub:focus-visible {
  transform: scale(1.06);
}
.rr-bub:hover .rr-dot,
.rr-bub.rr-hot .rr-dot,
.rr-bub:focus-visible .rr-dot {
  filter: brightness(1.16);
}
.rr-bub:focus-visible .rr-dot {
  stroke-opacity: 1 !important;
  stroke-width: 1.75;
}

/* Labels — the heatmap tiles' grammar verbatim: mono ticker (text-primary)
   over a signed % (green/red for outside stacks, muted inside big dots). The
   halo stroke keeps them readable over any fill or crossing the zero line. */
.rr-lbl {
  fill: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
  stroke-width: 2.25px;
  stroke-linejoin: round;
  pointer-events: none;
}
.rr-lbl-sym {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* NO hover tooltip panel — owner-rejected. Hover detail is the native <title>
   only, exactly like the heatmap tiles. Do not re-add one. */

/* ── Entrance: fade + scale-in, staggered left→right (once per load) ──
   backwards fill ONLY — a forwards fill would pin the transform and kill the
   hover/focus scale (this bug bit the treemap and the watchlist rows). All
   entrance rules are gated on prefers-reduced-motion so motion-averse users
   see the final state instantly (WCAG C39). */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rr-bub-in {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
  }
  .rr-bub.rr-in {
    animation: rr-bub-in 300ms var(--ease-out, ease) var(--rr-delay, 0ms) backwards;
  }
}
