/* Transition Security Project charts: Unica 77 for headings, Unica 77 Mono for text, Source Serif for the description
   and notes, and Roboto for everything in the charts themselves. Each chart sits on a white card that fills the width
   it is given, up to 800px. */
@font-face { font-family: "Roboto"; src: url("../fonts/Roboto-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("../fonts/Roboto-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("../fonts/Roboto-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Unica 77"; src: url("../fonts/Unica77LL-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Unica 77 Mono"; src: url("../fonts/Unica77MonoLL-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("../fonts/SourceSerif4-VariableFont_opsz\,wght.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --blue: #388dff; --blue-ink: #0b57c2; --blue-wash: #eaf3ff; --ink: #181818; --title: #000000;
  --grid: #d9d9d9; --rule: #d9d9d9; --tile: #f5f5f5; --note: #666666; --footer: #666666;
  --sans: "Unica 77", "Helvetica Neue", Arial, sans-serif;
  --mono: "Unica 77 Mono", ui-monospace, Menlo, Consolas, monospace;
  --serif: "Source Serif", Georgia, serif;
  --chart: Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
/* Transparent, so the embedding page shows round the card. */
html, body { background: transparent; }
body { margin: 0; color: var(--ink); font-family: var(--mono); font-size: 14px; line-height: 1.35; }
.dw { width: 100%; max-width: 800px; margin: 0 auto; padding: 10px 14px 18px; }

.card { position: relative; background: #ffffff; border: 1px solid #e2e2e2; border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.08); padding: 24px 24px 16px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The options sit below the chart, ruled off from it and from the caption. */
.options { border-top: 1px solid var(--grid); border-bottom: 1px solid var(--grid); margin: 0 0 16px; padding: 16px 0; }
.chart-title { font-family: var(--sans); font-size: 20px; color: var(--title); line-height: 1.2; margin: 0 0 12px; }
.description { font-family: var(--serif); font-size: 12px; line-height: 1.35; margin: 0 0 16px; }

.controls { margin: 0 0 4px; }
.group { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 12px; align-items: start; margin: 0 0 12px; }
.group[hidden] { display: none; }
.group-label { font-family: var(--sans); font-size: 14px; padding-top: 4px; }
.group-note { grid-column: 2; font-size: 12px; color: var(--note); margin: 0; }
.group-note:empty { display: none; }
.seg { display: flex; position: relative; flex-wrap: wrap; gap: 4px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { font-size: 12px; padding: 5px 10px; border: 1px solid var(--tile); border-radius: 4px; cursor: pointer; background: var(--tile); color: var(--ink); }
.seg label:hover { border-color: var(--blue); }
.seg input:checked + label { background: var(--blue-wash); border-color: var(--blue); color: var(--blue-ink); font-weight: 700; }
.seg input:focus-visible + label { outline: 2px solid var(--blue); outline-offset: 2px; }

.chart { height: 400px; margin: 16px 0 16px; }
.chart.bars { height: 230px; }
.chart.pie { height: 360px; }
/* The pie fills the chart space, with the breakdown of the larger slice boxed in its bottom right corner; the script
   moves the pie left of centre only as far as it must to keep clear of it, and places the boxed total so that it
   overlaps the pie's top right edge. The breakdown's total is in bold, ruled off from the parts below it. */
.pie-space { position: relative; margin: 16px 0; }
.pie-space .chart { margin: 0; }
.pie-total { position: absolute; top: 0; left: 0; margin: 0; border: 1px solid var(--rule); background: #ffffff; padding: 6px 10px; font-family: var(--chart); font-size: 12px; line-height: 1.3; color: var(--note); }
.pie-total b { display: block; font-size: 16px; color: var(--title); }
.inset { position: absolute; right: 0; bottom: 0; border: 1px solid var(--rule); background: #ffffff; padding: 8px 10px; font-family: var(--chart); font-size: 12px; line-height: 1.3; color: var(--ink); }
.inset dl { margin: 0; display: grid; grid-template-columns: auto auto; row-gap: 2px; }
.inset dt, .inset dd { margin: 0; }
.inset dd { text-align: right; padding-left: 14px; }
.inset .total { font-weight: 700; color: var(--title); padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid var(--rule); }
/* Shown only if the data or Highcharts fail to load. */
.load-error { font-size: 14px; color: var(--ink); background: var(--tile); border-left: 3px solid var(--blue); padding: 8px 12px; margin: 0 0 16px; }

.chart-list { margin: 0 0 16px; padding-left: 18px; }
.chart-list li { margin: 0 0 8px; }
.chart-list a { color: var(--blue-ink); }

.notes { font-family: var(--serif); font-size: 12px; font-style: italic; color: var(--note); line-height: 1.35; margin: 0 0 12px; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; font-size: 11px; color: var(--footer); }

/* Narrow frames, such as a phone's. */
@media (max-width: 499px) {
  .dw { padding: 6px 8px 12px; }
  .card { padding: 18px 14px 14px; }
  .chart-title { font-size: 16px; }
  .group { display: block; }
  .group-label { display: block; font-size: 12px; margin: 0 0 4px; }
  .group-note { font-size: 10px; margin-top: 4px; }
  .description { font-size: 12px; }
  .chart { height: 360px; }
  .chart.bars { height: 300px; }
  .chart.pie { height: 300px; }
}
/* Too narrow for the breakdown in the corner beside a full-sized pie: it goes below it, centred. */
@media (max-width: 599px) {
  .pie-space { display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .pie-space .chart { align-self: stretch; }
  .inset { position: static; }
}
