/* Payer Pulse: research-desk aesthetic. Light-only, matching the sitewide
   convention (see repo NOTES.md). Palette validated with the dataviz
   six-checks validator against the #fbfcfd chart surface. */

:root {
  --plane: #eef1f5;
  --surface: #fbfcfd;
  --ink: #12202e;
  --ink-secondary: #4a5b6d;
  --ink-muted: #7d8b99;
  --rule: #dbe2ea;
  --hairline: rgba(18, 32, 46, 0.09);
  --accent: #b45309;

  --series-centene: #27548c;
  --series-humana: #c46414;
  --series-uhg: #0e8f63;

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* display:grid on .small-multiples would otherwise beat the hidden attribute */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.back {
  display: inline-block;
  padding: 20px 0 0 clamp(20px, 5vw, 56px);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  text-decoration: none;
}
.back:hover { color: var(--ink); }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px clamp(20px, 5vw, 56px) 96px;
}

.masthead {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 34px;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -0.022em;
}

.tagline {
  margin: 10px 0 0;
  max-width: 60ch;
  color: var(--ink-secondary);
  font-size: 15px;
}

.sources {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 24px clamp(18px, 3vw, 28px) 28px;
  margin-bottom: 26px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.panel h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.012em;
}

.panel-index {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.note {
  margin: 0 0 18px;
  max-width: 74ch;
  color: var(--ink-secondary);
  font-size: 13.5px;
  line-height: 1.5;
}

/* A caveat sits next to the chart it qualifies, because a warning only works
   at the moment someone would otherwise misread the number. */
.caveat {
  margin: 0 0 18px;
  max-width: 74ch;
  padding: 10px 14px;
  border-left: 2px solid var(--accent);
  background: rgba(180, 83, 9, 0.045);
  border-radius: 0 6px 6px 0;
  color: var(--ink-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.notes-panel .note { margin-bottom: 22px; }

.analyst-note {
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  margin-top: 18px;
}
.analyst-note:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.analyst-note h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.008em;
}

.analyst-note .note-date {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.analyst-note p {
  margin: 0;
  max-width: 78ch;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.analyst-note .note-sources {
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.analyst-note .note-sources a {
  font-size: 12px;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.analyst-note .note-sources a:hover { color: var(--accent); border-bottom-color: var(--accent); }

label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-secondary);
  margin-bottom: 18px;
}

select {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.chart-wrap { position: relative; }

/* Charts that set maintainAspectRatio:false need the parent to carry the height. */
.chart-wrap.fixed-200 { height: 200px; }
.chart-wrap.fixed-190 { height: 190px; }

/* Two product charts side by side. Kept as separate plots on purpose: see the
   comment on renderProductChart. */
.split-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
@media (min-width: 760px) {
  .split-charts { grid-template-columns: 1fr 1fr; gap: 26px; }
}

.split-chart { margin: 0; }
.split-chart figcaption {
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* The star histogram is the densest plot on the page (8 rating buckets x 3
   companies) and carries both axis titles plus a legend, so its chrome eats
   far more vertical space than the line charts. It needs the extra height. */
.chart-wrap.fixed-300 { height: 300px; }
/* Narrow screens need MORE height here, not less: the three-company legend
   wraps onto extra lines, so chrome grows from ~97px to ~150px and would
   otherwise crush the plot area. */
@media (max-width: 620px) {
  .chart-wrap.fixed-300 { height: 350px; }
}

.small-multiples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.small-multiple h3 {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.small-multiple .sm-meta {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* maintainAspectRatio:false means the canvas fills its parent, so the parent
   must be the thing with a height. */
.sm-canvas {
  position: relative;
  height: 170px;
}

/* Explicit columns, not auto-fit: with four companies auto-fit drops to 3+1 at
   intermediate widths, orphaning the last tile beside a block of dead space.
   Step 4 -> 2 -> 1 so the row is always full. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 22px;
}

@media (min-width: 880px) {
  .stat-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 430px) {
  .stat-row { grid-template-columns: 1fr; }
}

.stat {
  background: var(--surface);
  padding: 14px 16px 16px;
}

.stat .stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-secondary);
  margin-bottom: 4px;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}

.stat .stat-value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.stat .stat-delta {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.stat .stat-delta.is-down { color: var(--accent); }

/* The finding: the page's argument, stated before the evidence. Deliberately
   not a .panel -- it reads as the thesis, not another exhibit. */
.finding {
  max-width: 1080px;
  margin: 0 auto 26px;
  padding: 30px 34px 26px;
  background: var(--ink);
  border-radius: 14px;
  color: #eef2f6;
}

.finding-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7f93a6;
  margin-bottom: 12px;
}

.finding-lede {
  margin: 0 0 22px;
  max-width: 30ch;
  font-size: clamp(21px, 2.6vw, 30px);
  line-height: 1.24;
  font-weight: 640;
  letter-spacing: -0.018em;
  color: #ffffff;
}

/* Explicit columns rather than auto-fit: with exactly four companies, auto-fit
   drops to 3+1 at intermediate widths and orphans the last one. Step 4 -> 2 -> 1
   so the row always stays balanced. */
.finding-share {
  margin: 0 0 20px;
  max-width: 68ch;
  font-size: 14.5px;
  line-height: 1.6;
  color: #c3d0dc;
}
.finding-share strong { color: #ffffff; font-weight: 650; }

/* Labels all four figures at once. Needed because the share sentence above
   quotes market share, which primes the reader to misread these as the same
   kind of percentage. Set as a column header in the same mono idiom as the
   chart captions elsewhere, so it reads as labelling the grid rather than as
   one more sentence of prose. */
.finding-gridlabel {
  margin: 0 0 4px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #7f93a6;
}

.finding-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 26px;
  padding: 14px 0 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  margin-bottom: 22px;
}

.finding-co {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: #c3d0dc;
  margin-bottom: 6px;
}

.finding-num {
  display: block;
  font-size: 38px;
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #ffffff;
}
.finding-pct { font-size: 20px; font-weight: 560; margin-left: 1px; }

.finding-sub {
  display: block;
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #8fa1b2;
}

.finding-body {
  margin: 0 0 12px;
  max-width: 76ch;
  font-size: 14.5px;
  line-height: 1.62;
  color: #c3d0dc;
}
.finding-body:last-child { margin-bottom: 0; }

/* The scope limit belongs with the claim, not in a footnote. Set apart so it
   reads as a boundary on the finding rather than more of the argument. */
.finding-scope {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  max-width: 76ch;
  font-size: 13px;
  line-height: 1.58;
  color: #8fa1b2;
}
.finding-body a { color: #ffffff; text-decoration-color: rgba(255,255,255,0.4); text-underline-offset: 3px; }
.finding-body a:hover { text-decoration-color: #ffffff; }

@media (min-width: 840px) {
  .finding-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 620px) {
  .finding { padding: 24px 20px 22px; border-radius: 12px; }
  .finding-num { font-size: 32px; }
  .finding-grid { gap: 18px; }
}

.nb { white-space: nowrap; }

/* Explains a company missing from the chart, so an absent series never reads
   as an accidental omission. */
.scope-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-style: italic;
}
.scope-note[hidden] { display: none; }

.error {
  font-size: 13.5px;
  color: var(--accent);
}

footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 56px) 56px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
