/* Propium, Stats page (how each model has done, in depth).
   Adds only what site.css lacks. Every colour is a site.css token and every
   class here starts with st- (states are is-*), so nothing shared is restyled.

   1. bar          2. headline     3. tiles        4. chart
   5. panels       6. rows         7. single picks 8. form
   9. narrow       10. motion */

/* ---------- 1. bar: which model, which stretch of time ---------- */
.st-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 16px; }
.st-switch { position: relative; flex: 1 1 420px; max-width: 540px; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.st-switch button { position: relative; z-index: 1; display: grid; align-content: center; justify-items: center; gap: 3px; min-height: 56px; padding: 8px 8px 9px; border-radius: 9px; text-align: center; color: var(--muted); transition: color .2s; }
.st-switch b { font: 700 15px/1.15 var(--f-label); letter-spacing: .08em; text-transform: uppercase; }
.st-switch button > span { min-height: 16px; font: 600 13px/16px var(--f-label); letter-spacing: .03em; font-variant-numeric: tabular-nums; color: var(--dim); transition: color .2s; }
.st-switch button[aria-pressed="true"], .st-switch button[aria-pressed="true"] > span { color: var(--ink); }
.st-switch .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: linear-gradient(180deg, var(--win), var(--accent-deep)); transition: transform .28s var(--ease); }
.st-bar[data-show="expert"] .st-switch .thumb { transform: translateX(100%); }
.st-bar .st-ranges { margin: 0; }
.st-ranges button { padding: 9px 14px; }

#st-body { min-height: 320px; }
.st-thin { margin-top: 2px; }
.st-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- 2. headline: the four numbers ---------- */
.st-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 12px; }
.st-h { position: relative; min-width: 0; padding: 16px 18px 15px; border-radius: 14px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(var(--text-a), .05); }
.st-h::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, rgba(var(--win-a), .75), rgba(var(--info-a), 0) 78%); }
.st-h dt { font: 700 12px/1.2 var(--f-label); letter-spacing: .13em; text-transform: uppercase; color: var(--dim); }
.st-h dd { margin: 9px 0 0; }
.st-hv { display: block; font: 800 56px/.92 var(--f-display); letter-spacing: .012em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.st-hv.pos { color: var(--win); }
.st-hv.neg { color: var(--text); }
.st-hv.is-long { font-size: 44px; }
.st-h small { display: block; margin-top: 9px; font: 500 14px/1.25 var(--f-label); letter-spacing: .02em; color: var(--muted); }

/* ---------- 3. tiles ---------- */
.st-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
.st-tiles > div { min-width: 0; padding: 10px 12px 11px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.st-tiles dt { font: 600 11px/1.2 var(--f-label); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.st-tiles dd { margin: 5px 0 0; }
.st-tiles b { display: block; font: 800 26px/1 var(--f-display); letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.st-tiles b.pos { color: var(--win); }
.st-tiles small { display: block; margin-top: 4px; font: 500 12.5px/1.25 var(--f-label); letter-spacing: .02em; color: var(--muted); }

/* ---------- 4. chart: units over time, and each day under it ---------- */
.st-chart > h3, .st-panel > h3 { margin-bottom: 14px; }
.st-plotgrid { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 8px 10px; }
.st-axis { position: relative; font: 600 12px/1 var(--f-label); letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--dim); }
.st-axis span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.st-axis-d { display: grid; align-items: center; justify-items: end; }
.st-axis-d span { position: static; transform: none; letter-spacing: .1em; text-transform: uppercase; font-size: 10.5px; }
.st-plot { position: relative; height: 250px; }
.st-plot svg, .st-days svg { position: relative; z-index: 1; display: block; width: 100%; height: 100%; overflow: visible; }
.st-line { stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.st-up { stop-color: var(--win); }
.st-dn { stop-color: var(--loss); }
.st-f1 { stop-opacity: .3; }
.st-f0 { stop-opacity: 0; }
.st-zero { position: absolute; z-index: 0; left: 0; right: 0; height: 0; border-top: 1px dashed var(--line-2); }
.st-dot { position: absolute; z-index: 2; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px var(--card); }
.st-dot.is-up { background: var(--win); }
.st-dot.is-dn { background: var(--loss); }
.st-dot.is-now { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; box-shadow: 0 0 0 2px var(--card), 0 0 0 5px rgba(var(--text-a), .14); }
.st-days { position: relative; height: 54px; }
.st-days::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.st-days rect { transform-box: fill-box; }
.st-days rect.is-up { fill: var(--win); transform-origin: 50% 100%; }
.st-days rect.is-dn { fill: var(--loss); transform-origin: 50% 0; }
.st-dates { display: flex; justify-content: space-between; gap: 12px; font: 600 12px/1.2 var(--f-label); letter-spacing: .04em; color: var(--dim); }
.st-legend { margin: 12px 0 0; font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- 5. panels: two columns, each as tall as its own list ---------- */
.st-grid { columns: 2; column-gap: 16px; margin-top: 16px; }
.st-grid > .st-panel { break-inside: avoid; margin: 0 0 16px; container-type: inline-size; }
.st-panel .fine { margin-top: 14px; }

/* ---------- 6. rows: label, picks, record, win rate, units, bar, ROI ---------- */
.st-rows { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.st-rows li { position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) 30px 66px 46px 60px minmax(56px, 1fr) 58px; align-items: center; column-gap: 10px; font: 600 14px/1.2 var(--f-label); letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--muted); }
.st-rows li.st-cal { grid-template-columns: minmax(0, 1.5fr) 30px 66px 60px minmax(56px, 1fr) 58px; }
.st-rows li.st-rh { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.st-rh span { text-align: right; white-space: nowrap; }
.st-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--text); }
.st-n, .st-rec, .st-w, .st-u, .st-roi { text-align: right; white-space: nowrap; }
.st-roi { font-weight: 800; color: var(--text); }
.st-u.pos, .st-roi.pos { color: var(--win); }
.st-u.neg, .st-roi.neg { color: var(--muted); }
.st-rows .dv i.p { transform-origin: 0 50%; }
.st-rows .dv i.n { transform-origin: 100% 50%; }
.st-r.is-thin .st-l, .st-r.is-thin .st-roi { font-weight: 600; color: var(--muted); }
.st-r.is-thin .dv i { background: var(--line-2); }
.st-rows li.is-total { margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.st-r.is-total .st-l { font-weight: 800; }

/* a narrow panel: the bar drops to its own line and two columns step aside */
@container (max-width: 499px) {
  .st-rows { gap: 11px; }
  .st-rows li { grid-template-columns: minmax(0, 1fr) 58px 58px 54px; column-gap: 8px; row-gap: 6px; font-size: 13.5px; }
  .st-rows li.st-cal { grid-template-columns: minmax(0, 1fr) 62px 54px 50px; }
  .st-rows li.st-rh { font-size: 10px; }
  .st-rh:not(.st-cal) span:nth-child(2), .st-rh:not(.st-cal) span:nth-child(4), .st-rh:not(.st-cal) span:nth-child(6),
  .st-rh.st-cal span:nth-child(2), .st-rh.st-cal span:nth-child(5) { display: none; }
  /* still read out, no longer drawn */
  .st-r .st-n, .st-r:not(.st-cal) .st-w { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .st-r .st-l { grid-column: 1; grid-row: 1; }
  .st-r .st-rec { grid-column: 2; grid-row: 1; }
  .st-r .st-u { grid-column: 3; grid-row: 1; }
  .st-r.st-cal .st-w { grid-row: 1; }
  .st-r .st-roi { grid-column: 4; grid-row: 1; }
  .st-r .dv { grid-column: 1 / -1; grid-row: 2; height: 6px; border-radius: 3px; }
  .st-r .dv::before { top: -2px; bottom: -2px; }
  .st-r .dv i.p { border-radius: 0 3px 3px 0; }
  .st-r .dv i.n { border-radius: 3px 0 0 3px; }
}

/* ---------- 7. single picks: highs and lows ---------- */
.st-x { display: grid; margin: 0; padding: 0; list-style: none; }
.st-x li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; row-gap: 2px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); }
.st-x li:first-child { padding-top: 0; border-top: 0; }
.st-x li:last-child { padding-bottom: 0; }
.st-xh { grid-column: 1 / -1; grid-row: 1; margin-bottom: 2px; font: 700 11.5px/1.2 var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.st-x b { grid-column: 1; grid-row: 2; min-width: 0; overflow-wrap: anywhere; font: 700 17px/1.25 var(--f-label); letter-spacing: .02em; color: var(--text); }
.st-xb { grid-column: 1; grid-row: 3; min-width: 0; font-size: 14px; line-height: 1.35; color: var(--muted); }
.st-xm { grid-column: 1; grid-row: 4; font: 500 13px/1.3 var(--f-label); letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--dim); }
.st-xu { grid-column: 2; grid-row: 2 / 5; align-self: center; font: 800 26px/1 var(--f-display); letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.st-xu.pos { color: var(--win); }
.st-xu.neg { color: var(--muted); }

/* ---------- 8. form: the last settled picks, oldest on the left ---------- */
.st-form { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 4px; }
.st-form i { display: grid; place-items: center; height: 30px; border-radius: 6px; font: 800 13px/1 var(--f-label); font-style: normal; }
.st-form .is-win { background: rgba(var(--win-a), .16); color: var(--win); box-shadow: inset 0 0 0 1px rgba(var(--win-a), .42); }
.st-form .is-loss { background: rgba(var(--loss-a), .13); color: var(--loss); box-shadow: inset 0 0 0 1px rgba(var(--loss-a), .36); }
.st-form .is-push { background: rgba(var(--text-a), .06); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
@container (max-width: 499px) { .st-form { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; } }

/* ---------- 9. narrow ---------- */
@media (max-width: 1099px) { .st-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  .st-grid { columns: 1; }
  .st-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 719px) {
  .st-switch { flex-basis: 100%; max-width: none; }
  .st-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-plot { height: 190px; }
}
@media (max-width: 519px) {
  .st-hero { gap: 8px; margin-bottom: 8px; }
  .st-h { padding: 12px 14px 13px; }
  .st-hv { font-size: 42px; }
  .st-hv.is-long { font-size: 33px; }
  .st-h small { margin-top: 7px; font-size: 13px; }
  .st-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-plotgrid { grid-template-columns: 42px minmax(0, 1fr); column-gap: 8px; }
  .st-axis { font-size: 11px; }
  .st-days { height: 46px; }
  .st-grid { margin-top: 12px; }
  .st-grid > .st-panel { margin-bottom: 12px; }
}

/* ---------- 10. motion: only with html.anim, which the page sets itself ---------- */
html.anim .st-view { animation: st-in .4s var(--ease); }
@keyframes st-in { from { opacity: 0; transform: translateY(8px); } }

html.anim .st-plot:not(.run):not(.done) svg { clip-path: inset(-8px 100% -8px -8px); }
html.anim .st-plot:not(.run):not(.done) .st-dot { opacity: 0; }
html.anim .st-plot.run svg { animation: st-wipe 1.15s var(--ease); }
html.anim .st-plot.run .st-dot { animation: st-pop .35s var(--ease) .85s backwards; }
@keyframes st-wipe { from { clip-path: inset(-8px 100% -8px -8px); } to { clip-path: inset(-8px -8px -8px -8px); } }
@keyframes st-pop { from { opacity: 0; transform: scale(.2); } }

html.anim .st-days:not(.run):not(.done) rect { transform: scaleY(0); }
html.anim .st-days.run rect { animation: st-rise .55s var(--ease) backwards; }
@keyframes st-rise { from { transform: scaleY(0); } }

html.anim .st-rows:not(.run):not(.done) .dv i { transform: scaleX(0); }
html.anim .st-rows.run .dv i { animation: st-grow .7s var(--ease) backwards; }
@keyframes st-grow { from { transform: scaleX(0); } }
