/* The Movers panel (showcase/chapters/stocks/_movers.html, sd-movers.js), the Movers tab of the Stocks Data
   chapter on /how-it-works/.
   One app window with three real pages behind a switch: intrinio_stock/templates/stock_data/top_gainer.html
   (+ top_looser.html), gap_up.html (+ gap_down.html) and highest_range.html (+ lowest_range.html). Colours
   inside the window are the pages' own: the pill tabs (.mr-nav-btn, top_gainer.html:26-38), the header card
   (.dp-header-card :41-50, second word #a78bfa :224), the checkbox labels (#c4b5fd, :53-58), the table card with
   its violet top rule (.dp-table-card :61-70), the #6759d1 table head and the row stripes (:73-92), the Info
   button (highest_range.html:62-68). Symbols and DarkVol ratio are the pages' text-info blue, changes are
   green at 0 or more and red below.
   The panel around the window uses landing.css tokens. Everything is sd-mv-* and scoped under .sd-mv.
   JS state classes (all is-*): on the root .sd-mv is-ready (data loaded and drawn), is-nodata, is-paused,
   is-still (reduced motion); on rows is-wait (not streamed in yet), is-out (leaving), is-new (just changed);
   on a view is-new (just opened); on the sorted head is-asc; on pressed controls is-press; on the auto
   label is-idle / is-stopped.
   Only transform and opacity animate. Reduced motion (landing.css section 13, plus .is-still) and the paused
   state (.is-paused) stop it all. */

.sd-mv {
  --sd-mv-accent: #6759d1; --sd-mv-violet: #a78bfa; --sd-mv-lilac: #c4b5fd;
  --sd-mv-bg: #1f2238; --sd-mv-text: #e0e0ff; --sd-mv-muted: rgba(255, 255, 255, .65);
  --sd-mv-line: rgba(103, 89, 209, .2); --sd-mv-stripe: #26264a; --sd-mv-row: #222240; --sd-mv-rowhi: #33335e;
  --sd-mv-up: #4cd68f; --sd-mv-dn: #f0616d; --sd-mv-info: #5fd3f3;
  --sd-mv-c0w: 84px;
  position: relative; min-width: 0;
}
.sd-mv [hidden] { display: none !important; }
html:not(.js) .sd-mv-js, .sd-mv.is-nodata .sd-mv-js { display: none !important; }
html.js .sd-mv:not(.is-nodata) .sd-mv-nojs { display: none; }

/* ---- panel head ---- */
.sd-mv-head { max-width: 72ch; margin: 0 auto var(--lp-sp-5); text-align: center; }
.sd-mv .sd-mv-title { margin: 0; color: var(--lp-text); font: 700 var(--lp-fs-lg)/1.25 var(--lp-font-title); letter-spacing: -.01em; }
.sd-mv .sd-mv-lead { margin: var(--lp-sp-2) 0 0; color: var(--lp-muted); font-size: var(--lp-fs-base); line-height: 1.6; }

/* ---- the window ---- */
.sd-mv-window {
  position: relative; overflow: hidden; min-width: 0;
  border: 1px solid var(--lp-border-strong); border-radius: 16px; background: var(--sd-mv-bg);
  box-shadow: var(--lp-shadow), 0 0 80px color-mix(in srgb, var(--lp-primary) 10%, transparent);
}
.sd-mv-chrome {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px;
  background: #0c0a17; border-bottom: 1px solid rgba(255, 255, 255, .07); white-space: nowrap; overflow: hidden;
}
.sd-mv-lights { display: inline-flex; gap: 6px; flex: none; }
.sd-mv-lights i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.sd-mv-lights i + i { background: #febc2e; }
.sd-mv-lights i + i + i { background: #28c840; }
.sd-mv-chrome-tab { overflow: hidden; text-overflow: ellipsis; padding: 4px 12px; border-radius: 8px 8px 0 0; background: var(--sd-mv-bg); color: #a7a3c9; font-size: 12px; }
.sd-mv-chrome-tab b { color: #f4f2ff; font-weight: 800; letter-spacing: -.01em; }
.sd-mv-chrome-url { overflow: hidden; text-overflow: ellipsis; color: #8e8ab4; font: 11.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.sd-mv-app {
  min-width: 0; color: var(--sd-mv-text); font-size: 13px; line-height: 1.45;
  background: radial-gradient(900px 420px at 92% -10%, rgba(103, 89, 209, .16), transparent 60%), var(--sd-mv-bg);
}
.sd-mv .sd-mv-app p { margin: 0; }

/* green page header, as the other panels */
.sd-mv-pghead {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 18px;
  background: linear-gradient(90deg, #5aae8c, #6dbf9d); color: #fff;
}
.sd-mv .sd-mv-pgname { color: #fff; font: 700 18px/1.2 var(--lp-font-title); letter-spacing: .01em; }
.sd-mv-pghead .lp-tier { --lp-tier-c: #fff; }
.sd-mv-pghead-end { margin-left: auto; }
.sd-mv-pghead .lp-sample { border-color: rgba(255, 255, 255, .7); color: #fff; background: rgba(12, 10, 23, .25); }

/* the three pages, as tabs inside the window */
.sd-mv-switch {
  display: flex; gap: 4px; padding: 8px 18px 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid rgba(139, 125, 232, .16); background: rgba(255, 255, 255, .02);
}
.sd-mv-switch::-webkit-scrollbar { display: none; }
.sd-mv .sd-mv-swbtn {
  flex: none; margin: 0 0 -1px; padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0;
  background: transparent; color: var(--sd-mv-muted); font: 600 12.5px/1.2 var(--lp-font); cursor: pointer; white-space: nowrap;
  transition: background-color .2s var(--lp-ease), color .2s var(--lp-ease);
}
.sd-mv .sd-mv-swbtn[aria-selected="true"] { border-color: rgba(139, 125, 232, .16); background: #292d4a; color: #fff; }
.sd-mv .sd-mv-swbtn:hover:not([aria-selected="true"]) { color: #fff; background: rgba(255, 255, 255, .05); }
.sd-mv .sd-mv-swbtn:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: -2px; }
.sd-mv .sd-mv-swbtn.is-press { background: rgba(103, 89, 209, .35); }

/* ---- the stage: the three pages, one at a time once JS runs ---- */
.sd-mv-stage { position: relative; display: flex; flex-direction: column; gap: 22px; min-width: 0; padding: 16px 18px; }
html.js .sd-mv:not(.is-nodata) .sd-mv-stage { height: 640px; overflow: hidden; }
html.js .sd-mv:not(.is-ready):not(.is-nodata) .sd-mv-view + .sd-mv-view { display: none; }
.sd-mv-view { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
html.js .sd-mv:not(.is-nodata) .sd-mv-view { flex: 1 1 auto; }
.sd-mv-view.is-new { animation: sd-mv-in .32s var(--lp-ease) both; }
@keyframes sd-mv-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sd-mv .sd-mv-poster-l { margin: 4px 0 0; color: #fff; font: 700 15px/1.3 var(--lp-font-title); }
html.js .sd-mv:not(.is-nodata) .sd-mv-poster-l { display: none; }

/* pill tabs (.mr-nav-btn) */
.sd-mv-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sd-mv .sd-mv-pill {
  margin: 0; padding: 8px 20px; border: 1px solid rgba(169, 158, 245, .2); border-radius: 10px; background: rgba(255, 255, 255, .03);
  color: #94a3b8; font: 600 13px/1.2 var(--lp-font); cursor: pointer; white-space: nowrap;
  transition: background-color .2s var(--lp-ease), border-color .2s var(--lp-ease), color .2s var(--lp-ease), transform .18s var(--lp-ease);
}
.sd-mv .sd-mv-pill:hover:not([aria-pressed="true"]) { border-color: rgba(169, 158, 245, .45); color: var(--sd-mv-lilac); background: rgba(169, 158, 245, .08); }
.sd-mv .sd-mv-pill[aria-pressed="true"] { background: linear-gradient(135deg, rgba(103, 89, 209, .25), rgba(169, 158, 245, .15)); border-color: rgba(169, 158, 245, .5); color: #e0e7ff; }
.sd-mv .sd-mv-pill:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.sd-mv .sd-mv-pill.is-press { transform: scale(.95); }

/* header card (.dp-header-card / .hr-header-card) */
.sd-mv-hcard {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 14px 20px; border: 2px solid var(--sd-mv-accent); border-radius: 16px;
  background: linear-gradient(135deg, #252540 0%, #2e2e50 100%); box-shadow: 0 0 24px rgba(103, 89, 209, .2);
}
.sd-mv .sd-mv-htitle { color: #fff; font: 700 20px/1.2 var(--lp-font-title); letter-spacing: .5px; }
.sd-mv .sd-mv-htitle span { color: var(--sd-mv-violet); }
.sd-mv-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.sd-mv .sd-mv-check {
  display: inline-flex; align-items: center; gap: 7px; margin: 0; color: var(--sd-mv-lilac);
  font: 600 12.5px/1.3 var(--lp-font); letter-spacing: .5px; cursor: pointer; white-space: nowrap;
}
.sd-mv .sd-mv-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--sd-mv-accent); cursor: pointer; }
.sd-mv .sd-mv-check input:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.sd-mv .sd-mv-check.is-press { transform: scale(.96); transition: transform .18s var(--lp-ease); }
.sd-mv .sd-mv-nojs { color: var(--sd-mv-lilac); font-size: 12.5px; font-weight: 600; }
.sd-mv .sd-mv-infobtn {
  margin: 0; padding: 6px 16px; border: 1px solid var(--sd-mv-violet); border-radius: 8px; background: rgba(103, 89, 209, .35);
  color: #fff; font: 600 12.5px/1.3 var(--lp-font); cursor: pointer;
  transition: background-color .2s var(--lp-ease), box-shadow .2s var(--lp-ease), transform .18s var(--lp-ease);
}
.sd-mv .sd-mv-infobtn:hover, .sd-mv .sd-mv-infobtn[aria-expanded="true"] { background: var(--sd-mv-accent); box-shadow: 0 0 12px rgba(103, 89, 209, .5); }
.sd-mv .sd-mv-infobtn:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.sd-mv .sd-mv-infobtn.is-press { transform: scale(.95); }

/* the Info note: inline under the filter card, the real page opens a modal */
.sd-mv-info {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border: 1px solid rgba(167, 139, 250, .55); border-radius: 12px;
  background: rgba(20, 18, 40, .9); color: var(--sd-mv-text); font-size: 12.5px; line-height: 1.5;
}
html.js .sd-mv:not(.is-nodata) .sd-mv-info:not([hidden]) { animation: sd-mv-in .26s var(--lp-ease) both; }
.sd-mv .sd-mv-info-h { color: #fff; font-weight: 700; font-size: 13.5px; }
.sd-mv .sd-mv-info-h span { color: var(--sd-mv-violet); }
html:not(.js) .sd-mv .sd-mv-info, .sd-mv.is-nodata .sd-mv-info { display: none !important; }

/* table card (.dp-table-card) and table (#volumeLeaderboard) */
.sd-mv-tcard {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px; overflow: hidden;
  border: 1px solid var(--sd-mv-accent); border-radius: 16px;
  background: linear-gradient(145deg, #1e1e38 0%, #252545 100%); box-shadow: 0 0 20px rgba(103, 89, 209, .15);
}
.sd-mv-tcard::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #6759d1, #c4b5fd, #6759d1); }
html.js .sd-mv:not(.is-nodata) .sd-mv-tcard { flex: 1 1 auto; }
.sd-mv-tablewrap {
  position: relative; min-width: 0; overflow-x: auto; border-radius: 8px;
  scrollbar-width: thin; scrollbar-color: rgba(103, 89, 209, .7) transparent;
}
html.js .sd-mv:not(.is-nodata) .sd-mv-tablewrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
.sd-mv-tablewrap:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.sd-mv .sd-mv-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.sd-mv .sd-mv-table th {
  position: sticky; top: 0; z-index: 2; padding: 10px 12px; border: 0; background: var(--sd-mv-accent); color: #fff;
  font: 700 11.5px/1.2 var(--lp-font); letter-spacing: .6px; text-align: left; text-transform: uppercase; white-space: nowrap;
}
.sd-mv .sd-mv-table td {
  position: relative; height: 36px; padding: 4px 12px; border: 0; border-bottom: 1px solid var(--sd-mv-line); color: var(--sd-mv-text);
  white-space: nowrap; background: var(--sd-mv-row); transition: opacity .28s var(--lp-ease);
}
.sd-mv .sd-mv-row:nth-child(even) > td { background: var(--sd-mv-stripe); }
.sd-mv .sd-mv-row:hover > td { background: var(--sd-mv-rowhi); }
/* Symbol stays put while the table scrolls sideways */
.sd-mv .sd-mv-table .sd-mv-c0 { position: sticky; left: 0; z-index: 1; width: var(--sd-mv-c0w); min-width: var(--sd-mv-c0w); box-sizing: border-box; box-shadow: 1px 0 0 var(--sd-mv-line); }
.sd-mv .sd-mv-table th.sd-mv-c0 { z-index: 3; }
.sd-mv .sd-mv-table td.sd-mv-empty { height: 120px; color: var(--sd-mv-muted); text-align: center; white-space: normal; }
.sd-mv-sorti { margin-left: 6px; vertical-align: -2px; }
.sd-mv-sorted.is-asc .sd-mv-sorti { transform: scaleY(-1); }

.sd-mv-sym { color: var(--sd-mv-info); font-weight: 700; letter-spacing: .04em; }
.sd-mv-ratio { color: var(--sd-mv-info); }
.sd-mv-up { color: var(--sd-mv-up); }
.sd-mv-dn { color: var(--sd-mv-dn); }

/* rows: stream in, leave, re-sort (sd-movers.js moves them with transform only) */
.sd-mv .sd-mv-row.is-wait > td { opacity: 0; }
.sd-mv .sd-mv-row.is-out > td { opacity: 0; }
.sd-mv .sd-mv-row.is-new > td::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; background: rgba(139, 125, 232, .32);
  animation: sd-mv-flash 1.2s ease-out both;
}
@keyframes sd-mv-flash { from { opacity: 1; } to { opacity: 0; } }

/* ---- the readout: what the demo shows now ---- */
.sd-mv .sd-mv-readout {
  display: flex; align-items: flex-start; gap: 10px; min-height: 60px; margin: 0; padding: 11px 18px 13px;
  border-top: 1px solid rgba(139, 125, 232, .16); background: rgba(103, 89, 209, .1); color: #fff; font-size: 13px; line-height: 1.5;
}
.sd-mv-readout-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--lp-accent); }

/* ---- controls under the window (as the other panels) ---- */
.sd-mv-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--lp-sp-3) var(--lp-sp-5); margin-top: var(--lp-sp-4); }
.sd-mv-play { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lp-sp-2); }
.sd-mv-auto {
  position: relative; display: inline-flex; align-items: center; gap: var(--lp-sp-2); min-height: 38px; padding: 0 var(--lp-sp-3);
  border: 1px solid var(--lp-border); border-radius: var(--lp-r-sm); background: var(--lp-surface-2);
  color: var(--lp-muted); font-size: var(--lp-fs-xs); font-weight: 600;
}
.sd-mv-auto-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lp-green); }
.sd-mv-auto.is-idle .sd-mv-auto-dot, .sd-mv-auto.is-stopped .sd-mv-auto-dot { background: var(--lp-amber); }
.sd-mv-auto-bar { position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px; overflow: hidden; border-radius: 2px; background: color-mix(in srgb, var(--lp-text) 10%, transparent); }
.sd-mv-auto-bar i { display: block; height: 100%; background: var(--lp-primary); transform-origin: 0 50%; transform: scaleX(0); }
.sd-mv-auto.is-idle .sd-mv-auto-bar i, .sd-mv-auto.is-stopped .sd-mv-auto-bar i { background: var(--lp-amber); }
.sd-mv-ico-play, .sd-mv.is-paused .sd-mv-ico-pause { display: none; }
.sd-mv.is-paused .sd-mv-ico-play { display: inline; }
.sd-mv .sd-mv-sample-note { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--lp-sp-2); margin: 0; color: var(--lp-muted); font-size: var(--lp-fs-xs); }
.sd-mv.is-still .sd-mv-play { display: none; }

/* ---- motion off ---- */
.sd-mv.is-paused *, .sd-mv.is-paused *::before, .sd-mv.is-paused *::after { animation-play-state: paused !important; }
.sd-mv.is-still *, .sd-mv.is-still *::before, .sd-mv.is-still *::after { animation: none !important; transition: none !important; }
.sd-mv.is-still .sd-mv-row > td::after { display: none; }

/* ---- smaller screens ---- */
@media (max-width: 640px) {
  .sd-mv { --sd-mv-c0w: 72px; }
  .sd-mv-chrome-url { display: none; }
  .sd-mv-pghead { padding: 10px 12px; }
  .sd-mv .sd-mv-pgname { font-size: 16px; }
  .sd-mv-switch { padding: 6px 10px 0; }
  .sd-mv .sd-mv-swbtn { padding: 8px 11px; font-size: 12px; }
  .sd-mv-stage { padding: 12px; gap: 16px; }
  html.js .sd-mv:not(.is-nodata) .sd-mv-stage { height: 700px; }
  .sd-mv-view { gap: 10px; }
  .sd-mv .sd-mv-pill { padding: 7px 14px; font-size: 12.5px; }
  .sd-mv-hcard { padding: 12px 14px; }
  .sd-mv .sd-mv-htitle { font-size: 18px; }
  .sd-mv-checks { gap: 6px 14px; }
  .sd-mv-tcard { padding: 10px; }
  .sd-mv .sd-mv-table { font-size: 12px; }
  .sd-mv .sd-mv-table td { height: 34px; padding: 3px 9px; }
  .sd-mv .sd-mv-table th { padding: 9px 9px; }
  .sd-mv .sd-mv-readout { min-height: 84px; padding: 10px 12px 12px; font-size: 12.5px; }
  .sd-mv-controls { justify-content: center; }
  .sd-mv .sd-mv-sample-note { justify-content: center; text-align: center; }
}
