/* NFL Futures Tracker — dark broadcast-desk aesthetic.
   Data colors follow the validated dataviz reference palette (dark mode). */

:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --ring: rgba(255, 255, 255, 0.1);
  --accent: #e8c15a;            /* scoreboard amber — UI only, never a data mark */
  --up: #3987e5;                /* diverging cool pole: probability gained */
  --down: #e66767;              /* diverging warm pole: probability lost */
  --up-text: #74aef0;
  --down-text: #ef8f8f;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  background-image:
    radial-gradient(1200px 400px at 50% -100px, rgba(232, 193, 90, 0.06), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 119px, rgba(255, 255, 255, 0.015) 119px 120px);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- masthead ---------- */

.masthead { border-bottom: 1px solid var(--ring); }
.masthead-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 34px 20px 10px;
}
.masthead h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 0.95;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.masthead h1 span { color: var(--accent); }
.tagline {
  color: var(--ink-2);
  max-width: 62ch;
  margin: 10px 0 18px;
}

.tabs {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
}
.tab {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 14px 10px;
  cursor: pointer;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- layout ---------- */

main { max-width: 1060px; margin: 0 auto; padding: 22px 20px 40px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- controls ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  position: relative;
}
.control { display: flex; flex-direction: column; gap: 4px; position: relative; }
.control.grow { flex: 1 1 220px; }
.control label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}
.control.arrow {
  color: var(--accent);
  font-size: 1.2rem;
  padding-bottom: 7px;
  justify-content: flex-end;
}
select, input[type="search"] {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ring);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--body);
  font-size: 0.9rem;
  min-width: 150px;
}
select:focus-visible, input:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- movers list ---------- */

.movers-summary { color: var(--ink-muted); font-size: 0.8rem; margin: 0 0 8px 2px; }

.movers-header, .mover-row {
  display: grid;
  grid-template-columns: 34px minmax(200px, 1.15fr) 52px 52px 2fr 58px;
  gap: 10px;
  align-items: center;
}
.movers-header {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  padding: 0 12px 6px;
  border-bottom: 1px solid var(--baseline);
}
.col-delta, .col-from, .col-to { text-align: right; }
.col-bar { text-align: center; }
.col-sort {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink-muted);
  cursor: pointer;
}
.col-sort:hover { color: var(--ink-2); }
.col-sort.active { color: var(--accent); }
.col-sort.active::after { content: " ▾"; }
.col-sort.active.asc::after { content: " ▴"; }

.movers-list { border-radius: 0 0 8px 8px; overflow: hidden; }
.mover-row {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--grid);
  color: var(--ink);
  padding: 7px 12px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 0.88rem;
}
.mover-row:nth-child(odd) { background: rgba(255, 255, 255, 0.018); }
.mover-row:hover { background: var(--surface-2); }
.mover-row .rank { color: var(--ink-muted); font-family: var(--mono); font-size: 0.75rem; }
.mover-row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mover-row .stag {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  border: 1px solid var(--ring);
  border-radius: 4px;
  padding: 0 5px;
  vertical-align: 1px;
}
.mover-row .price {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  text-align: right;
  white-space: nowrap;
}
.mover-row .delta {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.delta.pos { color: var(--up-text); }
.delta.neg { color: var(--down-text); }
.delta.zero { color: var(--ink-muted); }

/* diverging bar: fixed center axis, thin marks, rounded data end */
.barcell { position: relative; height: 14px; }
.barcell .axis {
  position: absolute;
  left: 50%; top: -4px; bottom: -4px;
  width: 1px;
  background: var(--baseline);
}
.barcell .bar {
  position: absolute;
  top: 2px;
  height: 10px;
  min-width: 2px;
}
.barcell .bar.pos { left: 50%; background: var(--up); border-radius: 0 4px 4px 0; }
.barcell .bar.neg { right: 50%; background: var(--down); border-radius: 4px 0 0 4px; }

.empty-note { color: var(--ink-muted); padding: 26px 4px; }

/* ---------- time-series view ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 999px;
  padding: 5px 8px 5px 12px;
  font-size: 0.82rem;
  color: var(--ink);
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip .chip-series { color: var(--ink-muted); font-size: 0.72rem; }
.chip button {
  background: none; border: none; color: var(--ink-muted);
  font-size: 0.95rem; cursor: pointer; padding: 0 4px; line-height: 1;
}
.chip button:hover { color: var(--ink); }

.suggestions {
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 30;
  margin-top: 4px;
  background: var(--surface-2);
  border: 1px solid var(--ring);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.suggestions button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--grid);
  color: var(--ink);
  padding: 8px 12px;
  font-family: var(--body);
  font-size: 0.85rem;
  cursor: pointer;
}
.suggestions button:last-child { border-bottom: none; }
.suggestions button:hover, .suggestions button.hi { background: rgba(255, 255, 255, 0.06); }
.suggestions .sser { color: var(--ink-muted); font-size: 0.75rem; white-space: nowrap; }

.chart-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 10px;
  padding: 6px 4px 2px;
}
#ts-chart { display: block; width: 100%; height: 420px; }

.tooltip {
  position: absolute;
  z-index: 40;
  pointer-events: none;
  background: #262624;
  border: 1px solid var(--ring);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.8rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  max-width: 300px;
}
.tooltip .tt-date { color: var(--ink-muted); font-size: 0.72rem; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tooltip .tt-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tooltip .tt-row .v { font-family: var(--mono); margin-left: auto; padding-left: 14px; }

.ts-table-wrap { margin-top: 18px; overflow-x: auto; }
.ts-table-wrap table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.ts-table-wrap th, .ts-table-wrap td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--grid);
  text-align: right;
  font-family: var(--mono);
  font-weight: 400;
  white-space: nowrap;
}
.ts-table-wrap th { color: var(--ink-muted); font-family: var(--body); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.ts-table-wrap th:first-child, .ts-table-wrap td:first-child { text-align: left; font-family: var(--body); }
.ts-table-wrap td:first-child { color: var(--ink-2); }

/* ---------- svg chart bits ---------- */

.gridline { stroke: var(--grid); stroke-width: 1; }
.axisline { stroke: var(--baseline); stroke-width: 1; }
.ticktext { fill: var(--ink-muted); font-size: 11px; font-family: var(--body); }
.series-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.series-pt { stroke: var(--surface); stroke-width: 2; }
.end-label { font-size: 11px; font-family: var(--body); font-weight: 600; }
.crosshair { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }

/* ---------- footer ---------- */

footer {
  max-width: 1060px;
  margin: 0 auto;
  padding: 14px 20px 34px;
  color: var(--ink-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--ring);
}
footer .sep { margin: 0 8px; }

@media (max-width: 720px) {
  .movers-header, .mover-row { grid-template-columns: 26px minmax(130px, 1.3fr) 1.4fr 54px; }
  .col-from, .col-to, .mover-row .price { display: none; }
}
