/* =========================================================
   Points Value Compare (points-values.php)
   Loaded on that page only. Every rule is scoped under .pv so
   nothing here touches the rest of the site. Colors reuse the
   --pa-* tokens from style.css where they exist.
   ========================================================= */

.pv {
  --pv-blue: var(--pa-blue, #2D7DD2);
  --pv-gold: #F5A623; /* Reward Gold */
  --pv-surface: var(--pa-card, #fff);
  --pv-ink: var(--text-dark, #1f2937);
  --pv-muted: var(--text-light, #6b7280);
  --pv-line: var(--pa-blue-100, #d6e7f6);
  --pv-head: var(--pa-blue-50, #eaf3fb);
  --pv-heat: var(--pa-blue, #2D7DD2);
  --pv-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pv-display: "Nunito", "DM Sans", system-ui, sans-serif;

  color: var(--pv-ink);
  font-family: var(--pv-sans);
  font-size: 16px;
  line-height: 1.5;
}
.pv p, .pv ul, .pv li, .pv button, .pv select { font-family: var(--pv-sans); }

.pv-title {
  font-family: var(--pv-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1.1;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  color: var(--pv-ink);
}
.pv-updated { color: var(--pv-muted); font-size: 0.9rem; font-weight: 500; margin: 0 0 12px; }
.pv-lede { color: var(--pv-muted); max-width: 62ch; margin: 0 0 20px; }
.pv-error {
  background: var(--pv-head);
  border-left: 4px solid var(--pv-blue);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 0 0 20px;
}

/* ── Controls ── */
.pv-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.pv-chips, .pv-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-chip {
  border: 1.5px solid var(--pv-line);
  background: var(--pv-surface);
  color: var(--pv-ink);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  min-height: 40px;
}
.pv-chip[aria-pressed="true"] {
  background: var(--pv-blue);
  border-color: var(--pv-blue);
  color: #fff;
}
.pv-sortlabel { display: flex; align-items: center; gap: 8px; color: var(--pv-muted); font-size: 0.95rem; }
.pv select {
  font: inherit;
  color: var(--pv-ink);
  border: 1.5px solid var(--pv-line);
  background: var(--pv-surface);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 40px;
}
.pv .pv-chip:focus-visible, .pv select:focus-visible, .pv a:focus-visible {
  outline: 3px solid var(--pv-gold);
  outline-offset: 2px;
}

/* ── Table ──
   The box scrolls both ways on its own, so the page body never scrolls
   sideways, and the header row and program column stay pinned. */
.pv-tablebox {
  background: var(--pv-surface);
  border: 1px solid var(--pv-line);
  border-radius: 14px;
  overflow: auto;
  max-height: min(78vh, 1100px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.pv table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 680px; }
.pv th, .pv td { padding: 10px; text-align: center; border-bottom: 1px solid var(--pv-line); }
.pv thead th {
  background: var(--pv-head);
  color: var(--pv-ink);
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.25;
  vertical-align: bottom;
  position: sticky;
  top: 0;
  z-index: 2;
}
.pv .prog {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--pv-surface);
  min-width: 168px;
  max-width: 200px;
  font-weight: 500;
  border-right: 1px solid var(--pv-line);
}
.pv thead th.prog { background: var(--pv-head); z-index: 3; }
.pv .srcname { display: block; }
.pv .srcdate { display: block; font-weight: 400; color: var(--pv-muted); font-size: 0.78rem; }
.pv th a {
  color: var(--pv-ink);
  text-decoration: underline;
  text-decoration-color: var(--pv-gold);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.pv tr.group td {
  text-align: left;
  background: var(--pv-head);
  font-family: var(--pv-display);
  font-weight: 800;
  font-size: 1.02rem;
  padding: 10px 12px;
}
.pv tr.group td span { position: sticky; left: 12px; }
.pv td.val { font-variant-numeric: tabular-nums; font-weight: 500; position: relative; }
.pv td.val.top::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pv-gold);
}
.pv td.empty { color: var(--pv-muted); }
.pv td.avg { font-weight: 700; font-variant-numeric: tabular-nums; }
.pv td.range { color: var(--pv-muted); font-size: 0.88rem; white-space: nowrap; }
.pv .note { color: var(--pv-muted); font-size: 0.72rem; vertical-align: super; margin-left: 2px; cursor: help; }

/* ── Legend and notes ── */
.pv-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--pv-muted); font-size: 0.88rem; margin: 12px 2px 0; align-items: center; }
.pv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pv-gold); margin-right: 6px; }
.pv-swatch {
  display: inline-block;
  width: 28px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pv-heat) 12%, transparent), color-mix(in srgb, var(--pv-heat) 60%, transparent));
  margin-right: 6px;
  vertical-align: middle;
}

.pv-about { margin-top: 28px; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.pv-about section { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 14px; padding: 16px 18px; }
.pv-about h2 { font-family: var(--pv-display); font-weight: 800; font-size: 1.15rem; color: var(--pv-ink); margin: 0 0 8px; }
.pv-about li { color: var(--pv-muted); font-size: 0.95rem; line-height: 1.5; margin: 0 0 8px; }
.pv-about ul { margin: 0; padding-left: 18px; }
.pv-about strong { color: var(--pv-ink); }

/* Without JavaScript the table still shows every published value, the
   averages, and the ranges. The controls need JS, so they stay hidden
   until it runs. */
.pv-nojs .pv-controls { display: none; }

@media (max-width: 600px) {
  .pv th, .pv td { padding: 9px 8px; }
  .pv .prog { min-width: 138px; }
}
@media (prefers-reduced-motion: reduce) {
  .pv *, .pv *::before, .pv *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
