/* ══════════════════════════════════════════════════════════════════════════
   MARKET REGIME CHIP  (static/js/graphs/regime.js)

   A compact, full-width band at the foot of the command-center grid. Card
   chrome (opaque fill, hairline inset ring, radius, in-card header) is
   inherited from `.cc-layout .cc-section` in 07-command-center.css — this file
   only styles what is INSIDE the card.

   COLOUR RULE
   -----------
   Blue vs bronze, never green vs red. Green/red collapses under deuteranopia;
   blue/orange does not. Both hues come from the research categorical ramp
   (--rsx-cat-4 / --rsx-cat-2 in tokens.css), which is the only ramp overridden
   for the light theme with measured contrast on cream.

   Colour is REINFORCEMENT. The state is carried by:
     1. the word (.rg-word: RISK-ON / RISK-OFF / NO CLEAR REGIME / ...),
     2. the ribbon LANE (vertical position, three rows),
     3. then the hue.
   Desaturate a screenshot and 1 and 2 both survive intact.

   1px rounded borders bowtie in headless screenshots, so every ring here is an
   inset box-shadow (house rule).
   ═══════════════════════════════════════════════════════════════════════════ */

/* State hues, one place. Referenced by the verdict block, the vote figures and
   the ribbon marks. */
#cc-regime{
  --rg-on:  var(--rsx-cat-4);      /* blue   */
  --rg-off: var(--rsx-cat-2);      /* bronze */
  --rg-mid: var(--text-muted);
}

/* Full-width band. The grid is 2-col; the regime readout is a sentence first,
   and a sentence wants the width. */
.cc-layout > #cc-regime{ grid-column:1 / -1; }

.rg-body{
  display:flex;flex-direction:column;gap:0.75rem;
  padding:0.875rem 1.25rem 1rem;
  min-width:0;
}

/* ── Verdict (spec R1): a WORD, then a sentence. No number competes. ─────── */
.rg-verdict{
  display:flex;flex-direction:column;gap:0.25rem;
  padding-left:0;
}

.rg-word{
  font-family:var(--font-sans);
  font-size:max(1.0625rem, var(--fs-floor));
  font-weight:800;letter-spacing:0.04em;
  color:var(--rg-mid);
  margin:0;line-height:1.15;
}
.rg-s-risk_on  .rg-word{ color:var(--rg-on); }
.rg-s-risk_off .rg-word{ color:var(--rg-off); }

.rg-sentence{
  margin:0;max-width:78ch;
  font-family:var(--font-sans);
  font-size:max(0.8125rem, var(--fs-floor));
  line-height:1.5;color:var(--text-primary);
}

.rg-sub{ font-family:var(--font-mono); }

/* ── The three fact blocks: two ratios + label stability ─────────────────── */
.rg-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(15rem, 1fr));
  gap:0.625rem;
  min-width:0;
}
.rg-ratio{
  display:flex;flex-direction:column;gap:0.1875rem;
  padding:0.625rem 0.75rem;
  border-radius:var(--radius);
  background:var(--bg-secondary);
  box-shadow:inset 0 0 0 1px var(--border-subtle);
  min-width:0;
}
.rg-ratio-off{ opacity:0.82; }

.rg-r-name{
  margin:0;
  font-family:var(--font-mono);
  font-size:max(0.6875rem, var(--fs-floor));
  font-weight:700;letter-spacing:var(--tr-caps);
  text-transform:uppercase;color:var(--text-secondary);
}
.rg-r-fig{
  margin:0.125rem 0 0;
  font-family:var(--font-mono);
  font-size:max(1.125rem, var(--fs-floor));
  font-weight:700;font-variant-numeric:tabular-nums;
  color:var(--text-primary);line-height:1.1;
}
.rg-v-on { color:var(--rg-on); }
.rg-v-off{ color:var(--rg-off); }
/* R5: the figure's own noun, immediately under it. Never a bare number. */
.rg-r-figlbl{
  margin:0;
  font-family:var(--font-mono);
  font-size:max(0.625rem, var(--fs-floor));
  color:var(--text-muted);
}
.rg-r-vote{
  margin:0.1875rem 0 0;
  font-family:var(--font-sans);
  font-size:max(0.6875rem, var(--fs-floor));
  font-weight:600;color:var(--text-secondary);
}
.rg-r-desc{
  margin:0.1875rem 0 0;
  font-family:var(--font-sans);
  font-size:max(0.6875rem, var(--fs-floor));
  line-height:1.45;color:var(--text-muted);
}
/* Inline caveats that change what the number MEANS (spec R3) — never hidden. */
.rg-miss{
  margin:0.25rem 0 0;
  font-family:var(--font-sans);
  font-size:max(0.6875rem, var(--fs-floor));
  line-height:1.45;color:var(--text-secondary);
  padding-left:0;
}

/* ── History ribbon: three lanes, one mark per labelled day ──────────────── */
.rg-ribbon{
  display:grid;
  grid-template-columns:2.25rem minmax(0,1fr);
  align-items:stretch;gap:0.5rem;
  min-width:0;
}
.rg-lanes{
  display:flex;flex-direction:column;justify-content:space-between;
  font-family:var(--font-mono);
  font-size:max(0.5625rem, var(--fs-floor));
  color:var(--text-muted);text-align:right;
  line-height:1;
}
.rg-svg{
  width:100%;height:2.75rem;display:block;
  overflow:visible;
}
.rg-lane{ stroke:var(--border-subtle); stroke-width:0.5; }
.rg-day{ shape-rendering:crispEdges; }
.rg-day.rg-s-risk_on { fill:var(--rg-on); }
.rg-day.rg-s-risk_off{ fill:var(--rg-off); }
.rg-day.rg-s-mixed   { fill:var(--rg-mid); }
.rg-cap{
  margin:0;
  font-family:var(--font-mono);
  font-size:max(0.625rem, var(--fs-floor));
  color:var(--text-muted);
}

/* ── State mix. Every proportion carries n and its interval, attached. ───── */
.rg-dist{
  list-style:none;margin:0;padding:0;
  display:flex;flex-wrap:wrap;gap:0.25rem 1.25rem;
  font-family:var(--font-mono);
  font-size:max(0.6875rem, var(--fs-floor));
  color:var(--text-secondary);
  font-variant-numeric:tabular-nums;
}
.rg-dist b{ color:var(--text-primary);font-weight:700;margin-right:0.375rem; }

/* ── Inline model + coverage notes (spec R3: these stay visible) ─────────── */
.rg-note{
  margin:0;max-width:88ch;
  font-family:var(--font-sans);
  font-size:max(0.6875rem, var(--fs-floor));
  line-height:1.5;color:var(--text-muted);
}

/* ── The one control: a real expander, keyboard operable ─────────────────── */
.rg-toggle{
  align-self:flex-start;
  display:inline-flex;align-items:center;gap:0.4375rem;
  min-height:var(--ctl-floor);
  padding:0 0.625rem;
  font-family:var(--font-mono);
  font-size:max(0.6875rem, var(--fs-floor));font-weight:700;
  letter-spacing:0.02em;
  color:var(--text-secondary);
  background:transparent;border:none;border-radius:var(--radius);
  box-shadow:inset 0 0 0 1px var(--border-default);
  cursor:pointer;
  transition:color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
.rg-toggle:hover{
  color:var(--text-primary);
  box-shadow:inset 0 0 0 1px var(--border-strong);
}
.rg-toggle:focus-visible{
  outline:1px solid var(--accent);outline-offset:-1px;
}
.rg-chev{
  width:0;height:0;flex:none;
  border-left:0.3125rem solid currentColor;
  border-top:0.25rem solid transparent;
  border-bottom:0.25rem solid transparent;
  transition:transform .16s var(--ease-out);
}
.rg-toggle.rg-open .rg-chev{ transform:rotate(90deg); }

.rg-info{
  display:flex;flex-direction:column;gap:0.4375rem;
  margin:0;padding:0.625rem 0.75rem;
  border-radius:var(--radius);
  background:var(--bg-secondary);
  box-shadow:inset 0 0 0 1px var(--border-subtle);
}
.rg-info[hidden]{ display:none; }
.rg-info p{
  margin:0;max-width:92ch;
  font-family:var(--font-sans);
  font-size:max(0.6875rem, var(--fs-floor));
  line-height:1.5;color:var(--text-muted);
}

/* ── Provenance foot line ────────────────────────────────────────────────── */
.rg-foot{
  margin:0;padding-top:0.375rem;
  font-family:var(--font-mono);
  font-size:max(0.625rem, var(--fs-floor));
  color:var(--text-muted);
  box-shadow:inset 0 1px 0 0 var(--border-subtle);
}

@media (max-width:900px){
  .rg-grid{ grid-template-columns:1fr; }
  .rg-svg{ height:2.25rem; }
}
