/* p3dp-prices: [p3dp_price_history] stats row, range buttons and the uPlot chart. Colors only from --p-* tokens;
   the chart reads the same tokens through getComputedStyle and redraws when html[data-theme] changes. */

.p3pr { font-family: var(--p-font-body); color: var(--p-text); }
.p3pr-history { container-type: inline-size; container-name: p3pr-history; padding-top: clamp(64px, 8vw, 96px); }
.p3pr-history *, .p3pr-history *::before, .p3pr-history *::after { box-sizing: border-box; }
.p3pr-head { margin-bottom: 24px; }
.p3pr-head .p3-h2 { margin: 0 0 10px; }
.p3pr-head .p3-muted { margin: 0; max-width: 640px; }

/* ---------------------------------------------------------------- controls */
.p3pr-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.p3pr-seg { display: inline-flex; flex-wrap: wrap; padding: 4px; gap: 4px; background: var(--p-surface); border: 1px solid var(--p-line); border-radius: 10px; max-width: 100%; }
.p3pr-seg-btn {
  min-height: 44px; padding: 0 14px; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--p-ink); font: 700 14px var(--p-font-head); white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.p3pr-seg-btn[aria-pressed="true"] { background: var(--p-solid); color: var(--p-on-solid); }
.p3pr-seg-btn[aria-pressed="false"]:hover { background: var(--p-surface-2); }
.p3pr-seg-btn:focus-visible { outline: 3px solid var(--p-accent); outline-offset: 1px; }
.p3pr-range .p3pr-seg-btn { padding: 0 12px; }

/* ---------------------------------------------------------------- stats */
.p3pr-stats[hidden] { display: none; }
.p3pr-stats dl {
  margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius); overflow: hidden;
}
.p3pr-stats dl > div { padding: 14px 18px; border-top: 1px solid var(--p-line-2); min-width: 0; }
.p3pr-stats dl > div:nth-child(-n+2) { border-top: 0; }
.p3pr-stats dl > div:nth-child(even) { border-left: 1px solid var(--p-line-2); }
.p3pr-stats dt { font-size: 12px; line-height: 1.4; color: var(--p-mute); }
.p3pr-stats dd { margin: 2px 0 0; font: 700 22px/1.2 var(--p-font-head); color: var(--p-ink); }
.p3pr-stat-at { display: block; font: 500 12px/1.4 var(--p-font-body); color: var(--p-mute); }
.p3pr-verdict-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 14px 0 0; font-size: 14px; color: var(--p-text-2); }
.p3pr-basis { font-size: 14px; color: var(--p-text-2); }
.p3pr-since { font-size: 13px; color: var(--p-mute); margin: 6px 0 0; }
@container p3pr-history (min-width: 640px) {
  .p3pr-stats dl { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .p3pr-stats dl > div { border-top: 0; }
  .p3pr-stats dl > div + div { border-left: 1px solid var(--p-line-2); }
  .p3pr-stats dd { font-size: 26px; }
}

/* ---------------------------------------------------------------- chart */
.p3pr-chart {
  position: relative; margin-top: 18px; min-height: 300px; padding: 16px 10px 6px;
  background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius); overflow: hidden;
}
.p3pr-chart-msg { margin: 0; padding: 110px 16px; text-align: center; font-size: 14px; color: var(--p-mute); }
.p3pr-chart-msg button { margin-top: 12px; }
.p3pr-chart.is-ready .p3pr-chart-msg { display: none; }
.p3pr-chart-note { font-size: 13px; line-height: 1.5; color: var(--p-mute); margin: 10px 0 0; }
.p3pr-history .p3pr-disclosure { font-size: 12.5px; line-height: 1.5; color: var(--p-mute); margin: 6px 0 0; }
.p3pr-history .p3pr-disclosure a { color: var(--p-link); }

/* uPlot, restyled with tokens (selectors carry .p3pr-chart so they beat uplot.min.css in any load order) */
.p3pr-chart .uplot { font-family: var(--p-font-body); width: 100%; }
.p3pr-chart .u-legend { font: 13px/1.4 var(--p-font-body); color: var(--p-text-2); text-align: left; margin: 6px 0 0; padding: 0 6px; }
.p3pr-chart .u-legend.u-inline tr { margin-right: 14px; }
.p3pr-chart .u-legend th { font-weight: 600; color: var(--p-ink); }
.p3pr-chart .u-legend .u-value { font-family: var(--p-font-head); font-weight: 700; color: var(--p-ink); }
.p3pr-chart .u-legend .u-marker { border-radius: 2px; }
.p3pr-chart .u-series > * { padding: 2px 4px; }
.p3pr-chart .u-hz .u-cursor-x, .p3pr-chart .u-vt .u-cursor-y { border-right-color: var(--p-mute); }
.p3pr-chart .u-hz .u-cursor-y, .p3pr-chart .u-vt .u-cursor-x { border-bottom-color: var(--p-mute); }
.p3pr-chart .u-select { background: var(--p-tint); }

/* the numbers behind the chart, for screen readers and anyone who prefers a table */
.p3pr-datatable { margin-top: 10px; font-size: 14px; }
.p3pr-datatable summary { cursor: pointer; color: var(--p-link); font: 600 14px var(--p-font-head); min-height: 44px; display: flex; align-items: center; }
.p3pr-datatable-scroll { max-height: 320px; overflow: auto; border: 1px solid var(--p-line); border-radius: var(--p-radius-sm); }
.p3pr-datatable table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--p-surface); }
.p3pr-datatable th, .p3pr-datatable td { padding: 8px 12px; text-align: left; border: 0; border-top: 1px solid var(--p-line-2); white-space: nowrap; color: var(--p-text); }
.p3pr-datatable thead th { position: sticky; top: 0; border-top: 0; background: var(--p-surface-2); font: 700 12px var(--p-font-head); letter-spacing: .06em; text-transform: uppercase; color: var(--p-mute); }
.p3pr-datatable td.is-best { font-weight: 700; color: var(--p-ink); }

@media (prefers-reduced-motion: reduce) {
  .p3pr-seg-btn { transition: none; }
}
