/* Figures for "Which countries have the best public schools?", in the style of the
   "Have AI timelines suddenly moved?" figures. Tokens match lars.yencken.org: dark only,
   eigengrau ground, Source Sans 3 (loaded by the site). Every rule is scoped to .pps-fig. */
.pps-fig {
  --pps-font: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  --pps-surface: rgb(22, 22, 29);
  --pps-ink: #f2f2f4;
  --pps-ink-2: #c3c4cc;
  --pps-ink-3: #8f909b;
  --pps-grid: #2a2a33;
  --pps-axis: #4d4e59;
  --pps-rule: #363742;
  --pps-blue: #3987e5;
  --pps-orange: #d95926;
  --pps-green: #199e70;
  --pps-gold: #c9a227;
  --pps-trend: #c9cad2;
  --pps-band: rgba(255, 255, 255, 0.045);
  --pps-tip-bg: rgb(32, 32, 39);
}

/* Reserve each figure's height until the script draws it, so the post doesn't jump on load. */
.pps-fig[data-pps-chart="ranking"]:not(.pps-ready) { min-height: 1150px; }
.pps-fig[data-pps-chart="gap"]:not(.pps-ready) { min-height: 1125px; }

.pps-fig {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 2rem 0;
  font-family: var(--pps-font);
  color: var(--pps-ink);
  text-align: left;
  line-height: 1.45;
}
.pps-fig .pps-title { font-weight: 600; font-size: 1.25rem; line-height: 1.25; text-wrap: balance; }
.pps-fig .pps-dek { color: var(--pps-ink-2); font-size: 1rem; max-width: 62ch; }
.pps-fig .pps-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.85rem; color: var(--pps-ink-2); }
.pps-fig .pps-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pps-fig .pps-legend svg { flex: none; }
.pps-fig summary:focus-visible { outline: 2px solid var(--pps-blue); outline-offset: 2px; }
.pps-fig .pps-chart { position: relative; width: 100%; }
.pps-fig .pps-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.pps-fig .pps-chart text { font-family: var(--pps-font); fill: var(--pps-ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.pps-fig .pps-chart .pps-lbl { fill: var(--pps-ink-2); font-size: 12.5px; }
.pps-fig .pps-chart .pps-lbl-strong { fill: var(--pps-ink); font-size: 12.5px; font-weight: 600; }
.pps-fig .pps-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--pps-tip-bg); color: var(--pps-ink); border: 1px solid var(--pps-rule); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); padding: 7px 10px; font-size: 0.85rem; line-height: 1.4;
  min-width: 150px; max-width: 250px; font-variant-numeric: tabular-nums;
}
.pps-fig .pps-tip[hidden] { display: none; }
.pps-fig .pps-tip b { font-weight: 600; }
.pps-fig .pps-muted { color: var(--pps-ink-3); }
.pps-fig .pps-source { font-size: 0.82rem; color: var(--pps-ink-3); max-width: 75ch; }
.pps-fig .pps-details { font-size: 0.85rem; color: var(--pps-ink-2); }
.pps-fig summary { cursor: pointer; color: var(--pps-ink-3); }
.pps-fig .pps-tbl { overflow-x: auto; margin-top: 6px; }
.pps-fig .pps-tbl table { border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 100%; margin: 0; border: 0; font-size: 0.85rem; }
.pps-fig .pps-tbl th,
.pps-fig .pps-tbl td { text-align: left; padding: 3px 12px 3px 0; border: 0; border-bottom: 1px solid var(--pps-rule); white-space: nowrap; font-size: 0.85rem; }
.pps-fig .pps-tbl th { font-weight: 600; color: var(--pps-ink); }
.pps-fig .pps-tbl .num { text-align: right; }
@media (max-width: 520px) {
  .pps-fig .pps-title { font-size: 1.1rem; }
  .pps-fig .pps-chart text { font-size: 11px; }
  .pps-fig .pps-chart .pps-lbl,
  .pps-fig .pps-chart .pps-lbl-strong { font-size: 11.5px; }
}
