/* Shared chart styles for next-charts.js (build spec 79.3a). Every class is prefixed ch- so no
   section's stylesheet can collide with a name here, and the live .tip, .bar and .legend classes
   in next.css are never reused or redefined.

   THE COLOURS ARE COPIED, NOT CHOSEN. They are the values the dashboard mock-up README ("Design
   rules held") records as run through the dataviz palette validator: the four series colours for
   the volunteering mix and for the difference and line charts. The live site has no dark mode,
   so the mock-up's dark set is not brought across. If a colour here is wrong, re-run the
   validator and change it here once. Nothing in the JS names a hex value. */
:root{
  --ch-teal:#13866a;--ch-blue:#2a78d6;--ch-gold:#bf7a0a;--ch-none:#cfd8de;
  --ch-track:#e8edf0;--ch-gap:#eef1f3;
  /* The six steps of the size-of-charity ramp, light to dark, copied from the dashboard mock-up
     (light theme). Used by the Scotland page's donut. */
  --inc-1:#92b2d6;--inc-2:#7099c8;--inc-3:#5083ba;--inc-4:#3a6ca3;--inc-5:#2c5480;--inc-6:#1d3a5c;
}

/* A switch of two to five choices, one pressed. */
.ch-seg{display:inline-flex;flex-wrap:wrap;gap:2px;border:1px solid var(--line);border-radius:9px;padding:3px;background:#f7f9fa}
.ch-seg button{border:0;background:transparent;border-radius:6px;padding:.4rem .75rem;font-size:var(--t-caption);color:var(--muted);min-height:36px;cursor:pointer}
.ch-seg button[aria-pressed="true"]{background:#fff;color:var(--ink);font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,.12)}
.ch-seg button:disabled{opacity:.45;cursor:not-allowed}
/* An unavailable choice looks like a disabled one but stays reachable by keyboard (aria-disabled,
   not disabled), so it carries its own visible focus ring. */
.ch-seg button.ch-unavail{position:relative;opacity:.45;cursor:not-allowed}
.ch-seg button.ch-unavail:focus-visible{opacity:1;outline:3px solid var(--focus);outline-offset:2px}
.ch-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* The table version of a chart. */
.ch-tablewrap{overflow:auto;max-height:340px}
.ch-table{border-collapse:collapse;width:100%;font-size:var(--t-caption)}
.ch-table th,.ch-table td{padding:.4rem .5rem;border-bottom:1px solid #eef2f4;text-align:left;font-weight:400;vertical-align:baseline}
.ch-table thead th{font-weight:600;color:var(--muted);border-bottom:2px solid var(--line);white-space:nowrap}
.ch-table tbody th{font-weight:400}
.ch-table .r{text-align:right;font-family:var(--font-mono);font-variant-numeric:tabular-nums}
.ch-table thead th.r{font-family:var(--font-ui);font-variant-numeric:normal}

/* Donut and its legend. */
.ch-donutwrap{display:grid;grid-template-columns:minmax(150px,200px) 1fr;gap:1.2rem;align-items:center}
.ch-donut svg{width:100%;height:auto;display:block;overflow:visible}
.ch-arc{cursor:pointer;transition:opacity .25s}
.ch-arc:focus{outline:none}
.ch-arc:focus-visible{outline:none;stroke:var(--focus);stroke-width:3}
.ch-donut.dim .ch-arc:not(.on){opacity:.28}
.ch-dc-big{font:500 30px var(--font-mono);fill:var(--ink);letter-spacing:-1px}
.ch-dc-sm{font:500 11.5px var(--font-ui);fill:var(--muted)}
.ch-legend{list-style:none;margin:0;padding:0}
.ch-legend li{margin:0}
.ch-legend button{display:grid;grid-template-columns:12px 1fr auto;gap:.5rem;align-items:center;width:100%;border:0;background:transparent;padding:.4rem .5rem;border-radius:8px;text-align:left;font-size:var(--t-caption);min-height:40px;cursor:pointer}
.ch-legend button:hover{background:#f7f9fa}
.ch-legend button[aria-pressed="true"]{background:var(--teal-soft)}
.ch-legend .sw{width:12px;height:12px;border-radius:3px}
.ch-legend .v{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-weight:500}
/* A legend whose rows also carry a share: a fourth column. */
.ch-legend.sh button{grid-template-columns:12px 1fr auto auto}
.ch-legend .p{font-family:var(--font-mono);font-variant-numeric:tabular-nums;color:var(--muted);font-size:var(--t-chip);min-width:3.4em;text-align:right}

/* Comparison rows: the difference chart and the dots reading of the same rows. */
.ch-key{display:flex;flex-wrap:wrap;gap:1rem;font-size:var(--t-caption);color:var(--muted);margin:0 0 .6rem}
.ch-key i{display:inline-block;vertical-align:-1px;margin-right:.35rem}
.ch-key .k-up{width:14px;height:10px;background:var(--ch-teal);border-radius:0 3px 3px 0}
.ch-key .k-dn{width:14px;height:10px;background:var(--ch-gold);border-radius:3px 0 0 3px}
.ch-key .k-dot{width:10px;height:10px;border-radius:50%;background:var(--ch-teal)}
.ch-key .k-ring{width:10px;height:10px;border-radius:50%;border:2.5px solid var(--ink)}
.ch-rows{list-style:none;margin:0;padding:0}
.ch-row{display:grid;grid-template-columns:minmax(120px,190px) 1fr 8.6em;gap:.7rem;align-items:center;padding:.4rem .3rem;border-bottom:1px solid #f2f5f7;font-size:var(--t-caption)}
.ch-row.hl .ch-lbl{font-weight:700}
.ch-lbl{line-height:1.25}
.ch-lbl small{display:block;color:var(--muted);font-size:var(--t-chip)}
.ch-track{position:relative;height:16px}
.ch-zero{position:absolute;left:0;right:0;top:7.5px;height:1px;background:var(--ch-track)}
.ch-mid{position:absolute;left:50%;top:-5px;bottom:-5px;width:1.5px;margin-left:-.75px;background:var(--ink);opacity:.55}
.ch-bar{position:absolute;top:2px;height:12px}
.ch-bar.up{background:var(--ch-teal);border-radius:0 4px 4px 0}
.ch-bar.dn{background:var(--ch-gold);border-radius:4px 0 0 4px}
.ch-val{text-align:right;line-height:1.15}
.ch-val b{display:block;font:600 var(--t-caption) var(--font-mono);white-space:nowrap}
.ch-val small{display:block;white-space:nowrap;font:400 var(--t-chip) var(--font-mono);color:var(--muted)}
.ch-axisrow{display:grid;grid-template-columns:minmax(120px,190px) 1fr 8.6em;gap:.7rem;font-size:var(--t-chip);color:var(--muted);padding:0 .3rem;margin-bottom:.3rem}
.ch-axisrow div{display:flex;justify-content:space-between}
.ch-dots{display:grid;grid-template-columns:repeat(20,1fr);gap:3px;max-width:330px}
.ch-dots i{aspect-ratio:1;border-radius:50%;background:var(--ch-track)}
.ch-dots i.f{background:var(--ch-teal)}
.ch-dots i.r{box-shadow:0 0 0 2px #fff,0 0 0 3.5px var(--ink)}

.ch-more{border:0;background:none;color:var(--teal-dark);font-weight:600;font-size:var(--t-caption);padding:.6rem 0 0;text-decoration:underline;text-underline-offset:3px;cursor:pointer}

/* A headline tile's bar lives in next.css (.kpi .kbar); the grid of 100 squares is here. */
.ch-actwrap{display:grid;grid-template-columns:minmax(150px,220px) 1fr;gap:1.2rem;align-items:start}
.ch-bigwaf{max-width:240px}
.ch-wg{display:grid;grid-template-columns:repeat(10,1fr);gap:3px}
.ch-wg i{aspect-ratio:1;border-radius:3px;background:var(--ch-track)}
.ch-wg i.f{background:var(--ch-teal)}
.ch-wn{font:600 1.7rem/1 var(--font-mono);margin-top:.7rem;letter-spacing:-.02em}
.ch-wl{font-size:var(--t-caption);margin-top:.3rem;line-height:1.3}
/* Built block by block, once, for the render that follows a change of choice. */
@media (prefers-reduced-motion:no-preference){
  .ch-wg.play i.f,.ch-wg.play i.x,.ch-wg.play i.g{animation:ch-fill .28s both;animation-delay:calc(var(--i) * 9ms)}
}
@keyframes ch-fill{from{background-color:var(--ch-track);transform:scale(.55)}to{transform:scale(1)}}

/* Line chart. */
.ch-linekey{display:flex;flex-wrap:wrap;gap:1.1rem;font-size:var(--t-caption);color:var(--muted);margin:0 0 .5rem}
.ch-linekey i{display:inline-block;width:16px;height:3px;border-radius:2px;vertical-align:3px;margin-right:.35rem}
.ch-line svg{width:100%;height:auto;display:block;overflow:visible}
.ch-gl{stroke:var(--ch-track);stroke-width:1}
.ch-ax{font:400 11px var(--font-mono);fill:var(--muted)}
.ch-end{fill:var(--ink);font-weight:600}
.ch-ln{fill:none;stroke-width:2.2;stroke-linejoin:round;stroke-linecap:round}
.ch-pt{stroke:#fff;stroke-width:2}
.ch-gap{fill:var(--ch-gap)}

@media(max-width:650px){
  .ch-actwrap{grid-template-columns:1fr}
  .ch-donutwrap{grid-template-columns:1fr}
  .ch-donut{max-width:230px;margin:0 auto}
  .ch-row,.ch-axisrow{grid-template-columns:minmax(88px,1fr) 1fr 8em;gap:.4rem}
  .ch-seg button{min-height:44px}
  .ch-legend button{min-height:44px}
}
/* On a phone the label takes its own line, so the bar keeps a readable width (build 79.8: at 320 wide it was a sliver). */
@media(max-width:480px){
  .ch-row,.ch-axisrow{grid-template-columns:minmax(0,1fr) 8em}
  .ch-row .ch-lbl{grid-column:1/-1}
  .ch-axisrow>span:first-child,.ch-axisrow div span:nth-child(2){display:none}
}

/* ---------------------------------------------------------------- the Areas page (build spec 79.3c) */

/* The grid drawn against a reference. Squares both have are teal (above); squares only this one
   has are NAVY, not the old second teal, which sat too close to the first to tell apart (A6, R1
   for this grid only); squares only the reference has are an outline. The key names all three, so
   colour is never the only way to read it. */
.ch-wg i.x{background:var(--navy)}
.ch-wg i.g{background:transparent;box-shadow:inset 0 0 0 1.5px var(--ch-gold)}
.ch-ws{font-size:var(--t-caption);color:var(--muted);margin-top:.2rem}
.ch-key .k-sq{width:10px;height:10px;border-radius:2px;background:var(--ch-teal)}
.ch-key .k-x{width:10px;height:10px;border-radius:2px;background:var(--navy)}
.ch-key .k-g{width:10px;height:10px;border-radius:2px;box-shadow:inset 0 0 0 1.5px var(--ch-gold)}

/* A comparison row that can be chosen (compare({ act })): the chosen row is marked. */
.ch-row[role="button"]{cursor:pointer;border-radius:8px}
.ch-row[role="button"]:hover{background:#f7f9fa}
.ch-row[role="button"]:focus-visible{outline:3px solid var(--focus);outline-offset:1px}
.ch-row.on{background:var(--teal-soft)}

/* Ranked amounts. */
.ch-hbars{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.75rem}
.ch-hb{display:grid;grid-template-columns:minmax(120px,240px) 1fr 4.4em;gap:.7rem;align-items:center;font-size:var(--t-caption)}
.ch-hbl{line-height:1.3;min-width:0}
.ch-hbl a{font-weight:600}
.ch-hbl small{display:block;color:var(--muted);font-size:var(--t-chip);margin-top:.1rem}
.ch-hbt{position:relative;height:14px;background:var(--ch-track);border-radius:0 4px 4px 0}
.ch-hbt i{position:absolute;left:0;top:0;bottom:0;background:var(--ch-teal);border-radius:0 4px 4px 0}
.ch-hbv{font-family:var(--font-mono);font-variant-numeric:tabular-nums;text-align:right;font-weight:500}

/* The heatmap: seven steps that diverge from a neutral middle, the mock-up's light values. Councils
   below Scotland run amber, above it green; the neutral step is a pale grey. */
:root{--dv-n3:#a65400;--dv-n2:#d68f3c;--dv-n1:#f1d3a8;--dv-0:#eceff1;--dv-p1:#b3dcc9;--dv-p2:#4fa685;--dv-p3:#0f6b51}
.ch-hm{overflow-x:auto;padding-bottom:4px}
.ch-hm-in{min-width:780px}
.ch-hm-h,.ch-hm-r{display:grid;grid-template-columns:170px repeat(16,minmax(30px,1fr));gap:2px}
.ch-hm-h{align-items:end;margin-bottom:4px}
.ch-hm-h button{writing-mode:vertical-rl;transform:rotate(180deg);border:0;background:none;padding:6px 0;font-size:var(--t-caption);color:var(--ink);text-align:left;height:150px;justify-self:center;border-radius:4px;line-height:1.1;cursor:pointer}
.ch-hm-h button:hover,.ch-hm-h button.hot{color:var(--ink);font-weight:600}
.ch-hm-h button.on{color:var(--teal-dark);font-weight:700}
.ch-hm-r{height:28px;margin-bottom:0}
.ch-hm-r .nm{border:0;background:none;text-align:left;font-size:var(--t-caption);padding:0 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink);border-radius:4px;cursor:pointer}
.ch-hm-r .nm:hover{text-decoration:underline}
.ch-hm-r.on .nm{font-weight:700;background:var(--teal-soft)}
.ch-hm-r.on .c{box-shadow:inset 0 0 0 1.5px var(--ink)}
/* Build 79.8: each square prints its whole-point difference; ink on the light steps, white on the two darkest. */
.ch-hm-r .c{border-radius:3px;cursor:pointer;display:flex;align-items:center;justify-content:center;font:500 .8125rem var(--font-mono);font-variant-numeric:tabular-nums;color:var(--ink)}
.ch-hm-r .c.dk{color:#fff}
.ch-hm-r .c:hover{outline:2px solid var(--ink);outline-offset:-1px}
.ch-hm-r .c.na{background:var(--ch-gap)}
.ch-hm-sc{margin-bottom:6px}
.ch-hm-sc .nm{font-weight:600;color:var(--muted);cursor:default}
.ch-hm-sc .nm:hover{text-decoration:none}
.ch-hm-sc .c{display:flex;align-items:center;justify-content:center;font:600 .8125rem var(--font-mono);color:var(--ink);background:#f7f9fa;cursor:default}
.ch-hm-sc .c:hover{outline:0}
.ch-divkey{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem;font-size:var(--t-caption);color:var(--ink)}
.ch-divkey .sw{display:inline-flex;gap:2px}
.ch-divkey .sw i{width:26px;height:16px;border-radius:3px}
/* The heatmap never moves the page sideways: it scrolls inside its own card on a phone. */
@media(max-width:650px){.ch-hb{grid-template-columns:minmax(96px,1fr) 1fr 4.2em;gap:.4rem}}

/* How often people volunteer (build spec 79.3c, Part 11): a four-step ordinal ramp, darkest for the most
   often, the last step a neutral grey. Text on each step is white or ink, whichever clears 4.5:1: white
   on #0f5640 is 8.7:1 and on #13866a 4.5:1, ink on #8cc7b1 is 8.3:1 and on #cfd8de 11.0:1. */
:root{--fq-1:#0f5640;--fq-2:#13866a;--fq-3:#8cc7b1;--fq-4:#cfd8de}
.vol-col{display:flex;flex-direction:column;gap:1.2rem;min-width:0}
.ch-key .k-sw{width:12px;height:10px;border-radius:2px}
.k-sw.fq1,.ch-sg.fq1{background:var(--fq-1)}
.k-sw.fq2,.ch-sg.fq2{background:var(--fq-2)}
.k-sw.fq3,.ch-sg.fq3{background:var(--fq-3)}
.k-sw.fq4,.ch-sg.fq4{background:var(--fq-4)}
.ch-stack{display:flex;flex-direction:column;gap:.55rem}
.ch-srow{display:grid;grid-template-columns:minmax(110px,170px) 1fr;gap:.7rem;align-items:center;font-size:var(--t-caption)}
.ch-slbl{line-height:1.25}
.ch-slbl small{display:block;color:var(--muted);font-size:var(--t-chip)}
.ch-sbar{display:flex;gap:2px;height:30px}
.ch-sg{display:flex;align-items:center;justify-content:center;min-width:0;overflow:hidden;font:600 var(--t-caption) var(--font-mono);color:var(--ink)}
.ch-sbar .ch-sg:first-child{border-radius:5px 0 0 5px}
.ch-sbar .ch-sg:last-child{border-radius:0 5px 5px 0}
.ch-sg.fq1,.ch-sg.fq2{color:#fff}
.ch-snote{color:var(--muted)}
.ch-sub{font-size:var(--t-caption);font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:.9rem 0 .1rem}
.ch-bighead{font-size:var(--t-ui-sm);margin:.2rem 0 .7rem}
.ch-bighead .n{font:500 1.9rem/1 var(--font-mono);letter-spacing:-.03em;margin-right:.3rem}
@media(max-width:640px){.ch-srow{grid-template-columns:1fr;gap:.2rem}}
