/* ==================================================================
 * BFF data visuals: shared styles, version 1
 * Sizes, fonts and colours come from CSS variables that core.js sets
 * from shared/brand.js and each graphic's SETTINGS block.
 * ================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--dv-bg, #fff); }
body { font-family: var(--dv-font); color: var(--dv-text); }

.dv { margin: 0 auto; padding: 16px 16px 12px; }
.dv-title {
  font-family: var(--dv-title-font);
  font-size: var(--dv-title-size);
  font-weight: var(--dv-title-weight);
  text-align: var(--dv-title-align);
  color: var(--dv-text);
  line-height: 1.1;
  margin: 0 0 var(--dv-title-gap);
  letter-spacing: -0.01em;
}
.dv-footer { font-size: var(--dv-footer-size); margin: var(--dv-footer-gap, var(--dv-gap, 14px)) 0 0; color: var(--dv-text); }
/* notes folded away on phones (S.notesPhone), always shown in images and PDFs */
.dv-notes-folded { display: none !important; }
html.dv-exporting .dv-notes-folded, html.dv-print .dv-notes-folded { display: block !important; }
.dv-notes-btn { display: block; font: inherit; font-size: var(--dv-footer-size); color: var(--dv-text); background: none; border: 0;
  padding: 2px 0; margin: 2px 0 0; text-decoration: underline; cursor: pointer; }
/* the footer's second line (notes, methodology) follows it directly */
.dv-footer + .dv-footer, .dv-footer + .dvc-notes { margin-top: 2px; }
.dv-footer:empty { display: none; }

/* Two columns side by side; one column when the graphic is narrow */
.dv-row { position: relative; display: grid; grid-template-columns: 1fr 1fr; }
.dv-stacked .dv-row { grid-template-columns: 1fr; }

.dv-chart { position: relative; min-width: 0; }
.dv-head { display: flex; flex-direction: column; justify-content: space-between; }
.dv-head h2 {
  font-size: var(--dv-heading-size);
  font-weight: var(--dv-heading-weight);
  color: var(--dv-heading);
  margin: 0 0 var(--dv-heading-gap, 10px);   /* space under chart headings (setting spaceHeading) */
  line-height: 1.2;
}
.dv-legend {
  display: flex; flex-wrap: wrap; justify-content: var(--dv-legend-align);
  gap: 2px 12px; font-size: var(--dv-legend-size); color: var(--dv-heading);
  margin: 0 0 var(--dv-chart-gap, 6px); min-height: 20px;
  padding-right: 14px;  /* = the chart's right margin, so right-aligned legends end where the grid lines end */
}
.dv-stacked .dv-legend { justify-content: flex-start; }
.dv-legend span { display: inline-flex; align-items: center; gap: 0.35em; white-space: nowrap; }
.dv-legend i { width: 0.82em; height: 0.82em; border-radius: 50%; display: inline-block; }
.dv-chart svg { display: block; width: 100%; overflow: visible; }
.dv svg text { font-family: var(--dv-font); }
.dv-hit { touch-action: pan-y; cursor: crosshair; }

/* Arrows: an overlay across the whole row (wide), or a small arrow between stacked charts */
.dv-arrow { position: absolute; left: 0; top: 0; z-index: 1; overflow: visible; pointer-events: none; }
.dv-arrow-down { display: none; justify-content: center; margin: 6px 0 10px; }
.dv-arrow-down svg { overflow: visible; }
.dv-stacked .dv-arrow { display: none; }
.dv-stacked .dv-arrow-down { display: flex; }
.dv-no-arrow .dv-arrow-down { display: none; }

.dv-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--dv-popup-bg, #fff); color: #000;
  border: 1px solid var(--dv-popup-border, #d0d0d0); border-radius: 4px; box-shadow: var(--dv-popup-shadow, 0 2px 8px rgba(0,0,0,.15));
  padding: 8px 10px; font-size: var(--dv-tooltip-size); line-height: 1.35; min-width: 170px;
  opacity: 0; transition: opacity .12s;
}
.dv-tooltip.on { opacity: 1; }
.dv-tooltip b { display: block; font-size: 1.08em; margin-bottom: 4px; }
.dv-tooltip .r { display: flex; align-items: center; gap: 6px; }
.dv-tooltip .r i { width: 9px; height: 9px; border-radius: var(--dv-key-radius, 50%); flex: none; }
.dv-tooltip .r span { flex: 1; }
.dv-tooltip .r em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.dv-tooltip .t { border-top: 1px solid #e3e3e3; margin-top: 5px; padding-top: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- design mode (only when a graphic is opened with ?design) ---------- */
html.gd-html, html.gd-html body { background: #e9ebef; }
body.gd-on { padding-right: 360px; }
.gd-frame { background: var(--dv-bg); margin: 24px auto; box-shadow: 0 1px 6px rgba(0,0,0,.15); max-width: calc(100% - 32px); }
.gd-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px; z-index: 100;
  overflow-y: auto; background: #fff; border-left: 1px solid #d6d9de;
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: #1f2328;
}
.gd-head { position: sticky; top: 0; z-index: 2; background: #fff; border-bottom: 1px solid #e3e5e8; padding: 12px 14px; }
.gd-head h3 { margin: 0 0 2px; font-size: 15px; }
.gd-head p { margin: 0 0 10px; color: #59636e; font-size: 12px; }
.gd-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.gd-btns b { font-size: 11px; color: #59636e; width: 58px; font-weight: 600; }
.gd-panel button {
  font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid #c9ced4; background: #f6f8fa; color: #1f2328;
}
.gd-panel button.gd-primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.gd-panel button:hover { filter: brightness(0.96); }
.gd-msg { margin-top: 8px; font-size: 12px; color: #1a7f37; min-height: 1em; }
.gd-msg.err { color: #cf222e; }
.gd-out { width: 100%; height: 110px; margin-top: 8px; font: 11px/1.4 ui-monospace, Menlo, monospace; display: none; }
.gd-width { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.gd-width input[type=range] { flex: 1; }
.gd-section { padding: 14px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #59636e; background: #f6f8fa; border-bottom: 1px solid #eceef1; }
.gd-section small { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; margin-top: 2px; }
.gd-panel details { border-bottom: 1px solid #eceef1; }
.gd-panel summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 13px; }
.gd-row { padding: 5px 14px 8px; }
.gd-row label { display: block; font-weight: 500; margin-bottom: 3px; }
.gd-row small { display: block; color: #6e7781; font-size: 11px; margin-top: 2px; }
.gd-row small.gd-warn { color: #9a6700; }
/* "Text sizes" heading inside the Text section, and the text-size rows: label and number box on one line */
.gd-sub { padding: 10px 14px 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #59636e; border-top: 1px solid #eceef1; margin-top: 6px; }
.gd-row:has(.gd-num) { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 3px; padding-bottom: 3px; }
.gd-row:has(.gd-num) label { margin: 0; }
.gd-row:has(.gd-num) small { display: none; }
.gd-ctl input.gd-num { width: 72px; }
.gd-panel { padding-bottom: 40vh; }
.gd-panel .gd-img { background: #fbfbfc; }
.gd-area { flex: 1; min-width: 0; font: 12px/1.45 ui-monospace, Menlo, monospace; padding: 5px 6px; border: 1px solid #c9ced4; border-radius: 5px; resize: vertical; }
.gd-panel button:disabled { opacity: .5; cursor: wait; }
.dv-footer a { color: inherit; }
.gd-ctl { display: flex; align-items: center; gap: 6px; }
.gd-ctl input[type=text], .gd-ctl select { flex: 1; font: inherit; padding: 4px 6px; border: 1px solid #c9ced4; border-radius: 5px; min-width: 0; }
.gd-ctl input[type=range] { flex: 1; min-width: 0; }
.gd-ctl input[type=number] { width: 64px; font: inherit; padding: 3px 4px; border: 1px solid #c9ced4; border-radius: 5px; }
.gd-ctl input[type=color] { width: 34px; height: 26px; padding: 0 2px; border: 1px solid #c9ced4; border-radius: 5px; background: #fff; }
@media (max-width: 820px) {
  body.gd-on { padding-right: 0; }
  .gd-panel { position: static; width: auto; border-left: 0; border-top: 1px solid #d6d9de; }
}

/* ---------- print to PDF (design mode's PDF download: ?design&print) ---------- */
html.dv-print, html.dv-print body { margin: 0; padding: 0; overflow: hidden; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
html.dv-print-nocontrols .dv-control, html.dv-print .dv-tooltip, html.dv-print .sr-only { display: none !important; }

/* ---------- vector export (design mode's PDF / SVG download): lay titles out in the embedded font ---------- */
html.dv-exporting { --dv-title-font: "Inter", Helvetica, Arial, sans-serif !important; }
html.dv-exporting .dv-title { font-family: "Inter", Helvetica, Arial, sans-serif; }
