/* Coverage (#coverage) + 04 · Papers (#papers); both sections carry .pp-scope: coverage sunburst + detail panel, Raw-vs-RRA small multiples, all-papers table (assets/js/papers.js).
 * Colours: the coverage figure's family colours and gain-bin colours (RB_DATA.papers.families[].color and
 * gain_bins[].color) in light mode; dark mode uses its own steps (rings darkened toward the canvas, gain bins
 * re-stepped so magnitude still reads as contrast). Everything is scoped under .pp-scope. */

.pp-scope {
  /* the figure's palette (light) */
  --pf-general: #4EB4A9;
  --pf-deep: #8590E1;
  --pf-systems: #7A9AD3;
  --pf-prob: #D0A173;
  --pf-rl: #AAD35A;
  --pf-trustworthy: #AB8EC5;
  --pf-evaluation: #E78F76;
  --pf-applications: #E2B353;
  --pp-dec: #D77762;
  --pp-tie: #BFC6CE;
  --pp-b0: #B7DC90;
  --pp-b10: #85C788;
  --pp-b25: #3DA869;
  --pp-b50: #08764B;
  --pp-zero: #5E6BDC;
  /* ring fills: family = its colour, subdomain = a lighter tint (the figure mixes ~30% white) */
  --pp-fam-mix: 100%;
  --pp-sub-mix: 70%;
  --pp-mix-base: var(--bg);
  --pp-fam-ink: #1D2B35;
  --pp-sub-ink: #2B3B46;
  --pp-sep: var(--bg);
  --pp-ref: #C9D3DA;
  --pp-beam: #1D2B35;
  --pp-sel: #1D2B35;
}
:root[data-theme="dark"] .pp-scope {
  --pp-dec: #DA826F;
  --pp-tie: #5D6A75;
  --pp-b0: #3B6A4C;
  --pp-b10: #3F8F60;
  --pp-b25: #4DB57E;
  --pp-b50: #86DDAE;
  --pp-zero: #7180EA;
  --pp-fam-mix: 55%;
  --pp-sub-mix: 38%;
  --pp-mix-base: var(--panel);
  --pp-fam-ink: #FFFFFF;
  --pp-sub-ink: #E8EEF2;
  --pp-ref: #34464F;
  --pp-beam: #E8EEF2;
  --pp-sel: #E8EEF2;
}

.pp-scope .fam-general { --fam: var(--pf-general); }
.pp-scope .fam-deep { --fam: var(--pf-deep); }
.pp-scope .fam-systems { --fam: var(--pf-systems); }
.pp-scope .fam-prob { --fam: var(--pf-prob); }
.pp-scope .fam-rl { --fam: var(--pf-rl); }
.pp-scope .fam-trustworthy { --fam: var(--pf-trustworthy); }
.pp-scope .fam-evaluation { --fam: var(--pf-evaluation); }
.pp-scope .fam-applications { --fam: var(--pf-applications); }
.pp-scope .gb-dec { --gb: var(--pp-dec); }
.pp-scope .gb-tie { --gb: var(--pp-tie); }
.pp-scope .gb-b0 { --gb: var(--pp-b0); }
.pp-scope .gb-b10 { --gb: var(--pp-b10); }
.pp-scope .gb-b25 { --gb: var(--pp-b25); }
.pp-scope .gb-b50 { --gb: var(--pp-b50); }

.pp-scope .gchip { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--gb); }
.pp-scope .pp-fdot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--fam); }
.pp-scope .pp-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; }
.pp-scope .pp-dot.imp { background: var(--rra); }
.pp-scope .pp-dot.tie { background: var(--raw); }
.pp-scope .pp-dot.wor { background: var(--red); }

/* ------------------------------------------------------------------ P1 card: head, jump list, legend */
.pp-scope .pp-card .chart-head .cap { max-width: 700px; }
.pp-scope .pp-card .cap .tag-note { margin-left: 2px; vertical-align: 1px; }
.pp-scope .pp-jump { display: flex; flex-direction: column; gap: 6px; min-width: 250px; }
.pp-scope .pp-jump label { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.pp-scope .pp-select { position: relative; display: block; }
.pp-scope .pp-select::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; margin-top: -6px; pointer-events: none;
  border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3); transform: rotate(45deg);
}
.pp-scope .pp-select select {
  -webkit-appearance: none; appearance: none; width: 100%; margin: 0; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 500; line-height: 1.3; color: var(--ink);
  padding: 9px 40px 9px 15px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg);
  transition: border-color .2s;
}
.pp-scope .pp-select select:hover { border-color: var(--ink-4); }

.pp-scope .pp-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.pp-scope .pp-bin {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); font-size: 13.5px; font-weight: 500; line-height: 1.35;
  transition: border-color .2s, background-color .2s, color .2s;
}
.pp-scope .pp-bin:hover { border-color: var(--line-2); color: var(--ink); }
.pp-scope .pp-bin[aria-pressed="true"] { border-color: var(--ink-3); background: var(--panel); color: var(--ink); }
.pp-scope .pp-bin .gchip { width: 11px; height: 11px; }
.pp-scope .pp-bin-n { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink-3); }
.pp-scope .pp-read { grid-area: read; margin: 0; max-width: 980px; font-size: 13.5px; }

/* ------------------------------------------------------------------ P1 body: sunburst + detail panel */
.pp-scope .pp-body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 372px); grid-template-areas: "sun detail" "read read";
  gap: 18px 28px; align-items: stretch; margin-top: 10px;
}
.pp-scope .pp-sun { grid-area: sun; width: 100%; max-width: 640px; aspect-ratio: 1 / 1; justify-self: center; align-self: center; }
.pp-scope .pp-sun svg { display: block; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ring wedges (fills follow the theme through --pp-*-mix) */
.pp-scope .pp-w { stroke: var(--pp-sep); stroke-width: 1.4; transition: opacity .22s var(--ease); }
.pp-scope .pp-wf { fill: color-mix(in srgb, var(--fam) var(--pp-fam-mix), var(--pp-mix-base)); }
.pp-scope .pp-ws { fill: color-mix(in srgb, var(--fam) var(--pp-sub-mix), var(--pp-mix-base)); }
.pp-scope .pp-w.hov { filter: brightness(1.05) saturate(1.05); }
:root[data-theme="dark"] .pp-scope .pp-w.hov { filter: brightness(1.18); }
.pp-scope .pp-zero { fill: none; stroke: var(--pp-zero); }
.pp-scope .pp-ref { fill: none; stroke: var(--pp-ref); stroke-width: 1; stroke-dasharray: 2 4; }
.pp-scope .pp-mk { fill: var(--gb); transition: opacity .22s var(--ease); }
.pp-scope .chart .pp-lbl { pointer-events: none; transition: opacity .22s var(--ease); }
.pp-scope .chart .pp-lbl-f { fill: var(--pp-fam-ink); font-weight: 650; letter-spacing: -.005em; }
.pp-scope .chart .pp-lbl-s { fill: var(--pp-sub-ink); font-weight: 480; }
.pp-scope .pp-spot { pointer-events: none; }
.pp-scope .pp-beam { stop-color: var(--pp-beam); }
.pp-scope .pp-notch { fill: none; stroke: var(--pp-sel); pointer-events: none; }
.pp-scope .pp-hit { fill: transparent; cursor: pointer; outline: none; }
.pp-scope .pp-hit:focus-visible { stroke: var(--rra); stroke-width: 2; stroke-linejoin: round; }
.pp-scope .pp-wedge-hit { cursor: pointer; }
.pp-scope .chart .pp-cnum { font-size: 20px; font-weight: 600; fill: var(--ink); letter-spacing: -.02em; }
.pp-scope .chart .pp-ctxt { font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; fill: var(--ink-3); }
.pp-scope .pp-scale line { stroke: var(--ink-3); stroke-width: 1; }
.pp-scope .chart .pp-scale text { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-3); }
/* dimming while a family, subdomain or gain bin is highlighted */
.pp-scope .pp-svg.is-dim .pp-w:not(.on) { opacity: .34; }
.pp-scope .pp-svg.is-dim .pp-lbl:not(.on) { opacity: .4; }
.pp-scope .pp-svg.is-dim .pp-mk:not(.on),
.pp-scope .pp-svg.is-bin .pp-mk:not(.on) { opacity: .13; }

/* detail panel */
.pp-scope .pp-detail {
  grid-area: detail; display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--rad); padding: 20px 22px 16px;
}
.pp-scope .pp-d-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pp-scope .pp-d-state {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
.pp-scope .pp-d-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--pp-sel); }
.pp-scope .pp-detail.is-preview .pp-d-state i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.pp-scope .pp-d-pills { display: inline-flex; gap: 6px; }
.pp-scope .pp-d-id, .pp-scope .pp-d-n { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 2px 9px; border: 1px solid var(--line-2); border-radius: 999px; white-space: nowrap; }
.pp-scope .pp-d-n { color: var(--ink-2); background: var(--bg); }
.pp-scope .pp-d-n b { color: var(--ink); font-weight: 700; }
.pp-scope .pp-d-name { font-size: 25px; font-weight: 600; letter-spacing: -.022em; line-height: 1.14; margin: 0 0 8px; overflow-wrap: anywhere; }
.pp-scope .pp-d-title { font-size: 14px; line-height: 1.48; color: var(--ink-2); margin: 0 0 8px; }
.pp-scope .pp-d-author { font-size: 13.5px; color: var(--ink-3); margin: 0 0 10px; }
.pp-scope .pp-d-area { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 0 0 16px; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.pp-scope .pp-d-area .pp-fdot { margin-right: 1px; }
.pp-scope .pp-d-sub::before { content: "›"; content: "›" / ""; margin-right: 8px; color: var(--ink-4); }
.pp-scope .pp-d-data { margin-top: auto; }
.pp-scope .pp-d-rows-head { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.pp-scope .pp-d-rows { list-style: none; margin: 0; padding: 0; }
.pp-scope .pp-d-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); grid-template-areas: "model gain" "count bars";
  align-items: center; column-gap: 14px; row-gap: 6px; padding: 10px 0 11px; border-bottom: 1px solid var(--line);
}
.pp-scope .pp-d-row:last-child { border-bottom: 0; }
.pp-scope .pp-d-model { grid-area: model; font-size: 14px; font-weight: 560; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-scope .pp-d-count { grid-area: count; font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pp-scope .pp-d-gain {
  grid-area: gain; justify-self: end; display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 650; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pp-scope .pp-d-bars { grid-area: bars; display: grid; gap: 3px; }
.pp-scope .b { position: relative; display: block; height: 7px; border-radius: 4px; background: var(--panel-2); }
.pp-scope .b::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%); border-radius: 4px; transition: width .35s var(--ease); }
.pp-scope .b.raw::after { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--raw); }
.pp-scope .b.rra::after { background: var(--rra); }
.pp-scope .b.zero::after { display: none; }
.pp-scope .pp-d-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.pp-scope .pp-d-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; white-space: nowrap; }
.pp-scope .pp-d-key .b { width: 16px; height: 7px; }
.pp-scope .pp-d-key .b::after { width: 100%; }
.pp-scope .pp-d-key .b.rra { margin-left: 6px; }

.pp-scope .chart-foot .pp-hint { margin: 0; font-size: 13px; color: var(--ink-3); max-width: 640px; }
.pp-scope .chart-foot .paper-fig { text-align: left; }
.pp-scope .pp-fallback { margin-top: 8px; }
.pp-scope .pp-cov .pp-fallback .fig-frame { max-width: 680px; }

/* ------------------------------------------------------------------ P2: small multiples */
.pp-scope .pp-sc-legend { align-self: center; }
.pp-scope .pp-size-key { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.pp-scope .pp-size-key svg { overflow: visible; }
.pp-scope .pp-size-key circle { fill: none; stroke: var(--ink-3); stroke-width: 1.2; }
.pp-scope .pp-sc-tabs { display: none; }
.pp-scope .pp-sc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; margin-top: 6px; }
.pp-scope .pp-sc-panel { margin: 0; min-width: 0; }
.pp-scope .pp-sc-head { display: flex; flex-direction: column; gap: 3px; min-height: 44px; margin: 0 0 4px 6px; }
.pp-scope .pp-sc-head b { font-size: 15.5px; font-weight: 620; color: var(--ink); letter-spacing: -.01em; }
.pp-scope .pp-sc-itw { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; line-height: 1.4; color: var(--ink-3); }
.pp-scope .pp-sc-itw > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pp-scope .pp-sc-itw .pp-dot { width: 8px; height: 8px; }
.pp-scope .pp-sc-plot { aspect-ratio: 1 / 1; }
.pp-scope .pp-sc-plot svg { display: block; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pp-scope .pp-pt { stroke: var(--bg); stroke-width: 1; fill-opacity: .86; transition: opacity .2s var(--ease); outline: none; }
.pp-scope .pp-pt.imp { fill: var(--rra); }
.pp-scope .pp-pt.tie { fill: var(--raw); }
.pp-scope .pp-pt.wor { fill: var(--red); }
.pp-scope .pp-sc-svg.has-hl .pp-pt:not(.hl) { opacity: .26; }
.pp-scope .pp-ring { fill: none; stroke: var(--pp-sel); stroke-width: 1.6; pointer-events: none; }
.pp-scope .pp-ring.focus { stroke: var(--rra); stroke-width: 2.2; }
.pp-scope .chart .pp-sc-lbl {
  font-size: 11.5px; font-weight: 600; fill: var(--ink); pointer-events: none;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3.5px; stroke-linejoin: round;
}
.pp-scope .pp-sc-hit { fill: transparent; cursor: crosshair; }
.pp-scope .pp-sc-hit.on-pt { cursor: pointer; }
.pp-scope .chart .pp-sc-svg .axis-title { font-size: 11.5px; }
.pp-scope .pp-sc-svg .ref-line { stroke: var(--ink-3); stroke-dasharray: 3 3.5; opacity: .75; }

/* ------------------------------------------------------------------ P3: all papers (details + table) */
.pp-scope .pp-all { margin-top: 28px; }
.pp-scope .pp-all > summary {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
  padding: 9px 18px 9px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg);
  font-size: 14.5px; font-weight: 550; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.pp-scope .pp-all > summary::-webkit-details-marker { display: none; }
.pp-scope .pp-all > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3);
  transform: rotate(-45deg); transition: transform .2s var(--ease); margin: 0 2px 0 3px;
}
.pp-scope .pp-all[open] > summary::before { transform: rotate(45deg) translate(-2px, -1px); }
.pp-scope .pp-all > summary:hover { border-color: var(--ink-4); box-shadow: var(--shadow-sm); }
.pp-scope .pp-all[open] .pp-all-s, .pp-scope .pp-all:not([open]) .pp-all-h { display: none; }
.pp-scope .pp-all .tbl-scroll { margin-top: 16px; }
.pp-scope .pp-table caption { padding: 14px 16px 12px; line-height: 1.55; white-space: normal; }
.pp-scope .pp-chipkey { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; margin-left: 4px; vertical-align: 0; }
.pp-scope .pp-chipkey > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pp-scope .pp-table td, .pp-scope .pp-table th { vertical-align: top; }
.pp-scope .pp-table thead th { position: relative; }
.pp-scope .pp-table thead th.n { font-family: var(--sans); font-size: 13px; }
.pp-scope .pp-table th, .pp-scope .pp-table td { padding: 11px 12px; }
.pp-scope .pp-table td.pp-t-paper { white-space: normal; min-width: 230px; max-width: 300px; }
.pp-scope .pp-t-name { display: block; font-weight: 600; color: var(--ink); }
.pp-scope .pp-t-title { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.pp-scope .pp-table td.pp-t-area { white-space: normal; min-width: 140px; max-width: 180px; padding-left: 30px; text-indent: -18px; color: var(--ink-2); }
.pp-scope .pp-t-area .pp-fdot { margin-right: 8px; vertical-align: -1px; text-indent: 0; }
.pp-scope .pp-mc { color: var(--ink); }
.pp-scope .pp-mc .gchip { margin-right: 8px; vertical-align: -1px; }
.pp-scope .pp-table tfoot th, .pp-scope .pp-table tfoot td { background: var(--panel-2); color: var(--ink); font-weight: 650; border-bottom: 0; border-top: 1px solid var(--line-2); }
.pp-scope .pp-table tbody tr.hl td { background: var(--rra-row); }
.pp-scope .pp-sort {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: inherit; white-space: nowrap;
}
.pp-scope .pp-sort::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--ink-4); opacity: .7; }
.pp-scope th[aria-sort="ascending"] .pp-sort::after { border-top: 0; border-bottom: 5px solid var(--ink); opacity: 1; }
.pp-scope th[aria-sort="descending"] .pp-sort::after { border-top-color: var(--ink); opacity: 1; }
.pp-scope th.n .pp-sort { flex-direction: row-reverse; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1060px) {
  .pp-scope .pp-sc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 34px; }
}
@media (max-width: 980px) {
  .pp-scope .pp-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "read" "sun" "detail"; gap: 18px; }
  .pp-scope .pp-sun { max-width: 600px; }
  .pp-scope .pp-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 30px; }
  .pp-scope .pp-d-data { margin-top: 0; }
  .pp-scope .pp-d-rows-head { border-top: 0; padding-top: 2px; }
}
@media (min-width: 761px) and (max-width: 980px) {
  .pp-scope .pp-legend { display: grid; grid-template-columns: repeat(3, max-content); }
}
@media (max-width: 760px) {
  .pp-scope .pp-card { padding: 18px 16px 16px; border-radius: var(--rad); }
  .pp-scope .pp-jump { min-width: 0; width: 100%; }
  .pp-scope .pp-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .pp-scope .pp-bin { padding: 6px 10px; font-size: 13px; }
  .pp-scope .pp-bin-n { margin-left: auto; }
  .pp-scope .pp-read { font-size: 13px; }
  .pp-scope .pp-sun { width: calc(100% + 20px); max-width: none; margin: 0 -10px; }
  .pp-scope .pp-detail { display: flex; padding: 18px 16px 14px; }
  .pp-scope .pp-d-data { margin-top: 4px; }
  .pp-scope .pp-d-rows-head { border-top: 1px solid var(--line); padding-top: 12px; }
  .pp-scope .pp-d-name { font-size: 23px; }
  .pp-scope .pp-sc-tabs { display: flex; min-height: 40px; margin: 4px 0 14px; }
  .pp-scope .pp-sc-tabs > .seg { display: flex; flex-wrap: nowrap; width: 100%; }
  .pp-scope .pp-sc-tabs .seg button { flex: 1 1 auto; padding: 6px 4px; font-size: 12.5px; }
  .pp-scope .pp-sc-grid { grid-template-columns: minmax(0, 1fr); }
  .pp-scope .pp-sc-panel:not(.on) { display: none; }
  .pp-scope .chart-foot .pp-hint { font-size: 12.5px; }
}
@media (hover: none) {
  .pp-scope .pp-sc-hit { cursor: default; }
}

/* transition from the coverage chart into the walkthrough */
#coverage .cov-next { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 28px 0 0; font-size: 15px; color: var(--ink-3); }
#coverage .cov-next a { font-weight: 600; text-decoration: none; }
#coverage .cov-next a:hover { text-decoration: underline; }
