/* Market Rotation chart. Colours come from the theme so dark mode follows the site toggle. */
#market_rotation_page {
    --rotation-series: var(--bs-primary);
    --rotation-ghost: var(--bs-gray-400);
    --rotation-grid: var(--bs-gray-200);
    --rotation-axis: var(--bs-gray-500);
    --rotation-text: var(--bs-gray-800);
    --rotation-muted: var(--bs-gray-600);
    --rotation-surface: var(--bs-body-bg);
    /* "By sector" colours: eight categorical hues validated on adjacent pairs in both modes
       (see common/DESIGN.md, Sector rotation). Sectors past the eighth reuse hues 1-3 dashed. */
    --rotation-c1: #2a78d6;
    --rotation-c2: #eb6834;
    --rotation-c3: #1baf7a;
    --rotation-c4: #eda100;
    --rotation-c5: #e87ba4;
    --rotation-c6: #008300;
    --rotation-c7: #6250d6;
    --rotation-c8: #e34948;
}
/* Dark mode uses the same hues stepped for the dark surface, not an automatic flip. */
[data-bs-theme=dark] #market_rotation_page {
    --rotation-c1: #3987e5;
    --rotation-c2: #d95926;
    --rotation-c3: #199e70;
    --rotation-c4: #c98500;
    --rotation-c5: #d55181;
    --rotation-c6: #008300;
    --rotation-c7: #9085e9;
    --rotation-c8: #e66767;
}
/* rotation.js sizes the chart in pixels to fit the window; it is centred in a wider card. */
#rotation_chart svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
#rotation_chart .tick { font-size: 12px; fill: var(--rotation-muted); }
#rotation_chart .qlabel { font-size: 13px; font-weight: 600; fill: var(--rotation-muted); }
#rotation_chart { --rotation-card: var(--bs-card-bg, var(--rotation-surface)); }
/* A halo in the card colour keeps a label readable where a trail passes under it. */
#rotation_chart .lbl {
    font-size: 12px; font-weight: 600; fill: var(--rotation-text);
    stroke: var(--rotation-card); stroke-width: 3px; stroke-linejoin: round; paint-order: stroke;
}
#rotation_chart .trail { transition: opacity .15s; }
#rotation_chart .trail .seg { stroke: var(--rotation-series); }
#rotation_chart .trail .dot { fill: var(--rotation-series); }
#rotation_chart .trail .head { fill: var(--rotation-series); stroke: var(--rotation-card); }
#rotation_chart .focus .trail { opacity: .35; }
#rotation_chart .focus .trail .seg { stroke: var(--rotation-ghost); }
#rotation_chart .focus .trail .dot,
#rotation_chart .focus .trail .head { fill: var(--rotation-ghost); }
#rotation_chart .focus .trail .lbl { fill: var(--rotation-muted); }
#rotation_chart .focus .trail.on { opacity: 1; }
#rotation_chart .focus .trail.on .seg { stroke: var(--rotation-series); }
#rotation_chart .focus .trail.on .dot,
#rotation_chart .focus .trail.on .head { fill: var(--rotation-series); }
#rotation_chart .focus .trail.on .lbl { fill: var(--rotation-text); }
/* "By sector": each trail redefines the series colour as its own hue, so every rule above,
   including ghosting on focus, applies unchanged. */
.rotation-multi #rotation_chart .trail { --rotation-series: var(--c); }
#rotation_chart .trail.dashed .seg { stroke-dasharray: 5 4; }
/* Provisional points are hollow. */
#rotation_chart .trail .dot.provisional,
#rotation_chart .trail .head.provisional,
#rotation_chart .focus .trail.on .dot.provisional,
#rotation_chart .focus .trail.on .head.provisional { fill: var(--rotation-card); stroke: var(--rotation-series); stroke-width: 1.5; }
#rotation_chart .focus .trail .dot.provisional,
#rotation_chart .focus .trail .head.provisional { stroke: var(--rotation-ghost); }
#rotation_chart .hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
#rotation_chart .hitdot { fill: transparent; cursor: pointer; }
.rotation-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rotation-chips .btn[aria-pressed="true"] { background: var(--bs-primary); color: var(--bs-white); }
.rotation-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.rotation-field { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
#rotation_periods { width: 4.5rem; }
#rotation_as_of { width: 9.5rem; }
#rotation_card.is-loading #rotation_chart,
#rotation_card.is-loading #rotation_controls { opacity: .5; pointer-events: none; transition: opacity .15s; }
/* Swatches show only in "By sector" mode, beside chips and table rows. */
.rotation-swatch { display: none; vertical-align: middle; margin-right: 6px; }
.rotation-swatch line { stroke: var(--c); }
.rotation-multi .rotation-swatch { display: inline-block; }
#rotation_table tbody tr.empty { cursor: default; }
.rotation-scrub { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.rotation-scrub input { flex: 1; }
#rotation_table tbody tr { cursor: pointer; }
#rotation_table tbody tr.on td { background: var(--bs-gray-100); }
#rotation_table td.num, #rotation_table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#rotation_table .sub { display: block; font-size: 11px; color: var(--rotation-muted); }
#rotation_table td:nth-child(2) { white-space: nowrap; }
/* The tip sits inside the page's .row, whose "> *" rule sets width: 100%; size it to its content instead. */
#rotation_tip {
    position: fixed; pointer-events: none; display: none; z-index: 110;
    width: max-content; max-width: min(320px, calc(100vw - 16px)); margin: 0;
    background: var(--rotation-surface); color: var(--rotation-text);
    border: 1px solid var(--bs-gray-300); border-radius: 8px; padding: 8px 10px;
    font-size: 12px; line-height: 1.45; font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
#rotation_tip .t { font-weight: 600; }
#rotation_tip .m { color: var(--rotation-muted); }
