﻿/* UK Banking Monitor â€” investor-grade presentation layer.
   Palette: dataviz reference instance, validated for CVD in both modes. */

:root {
  color-scheme: light;
  --page:            #f9f9f7;
  --surface:         #fcfcfb;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --text-muted:      #898781;
  --grid:            #e1e0d9;
  --axis:            #c3c2b7;
  --border:          rgba(11, 11, 11, 0.10);
  --band:            rgba(11, 11, 11, 0.022);
  --series-1:        #2a78d6;   /* house purchase */
  --series-2:        #eb6834;   /* remortgaging   */
  --series-3:        #1baf7a;   /* other          */
  /* Slots 4-5 of the same categorical order, added for the banking page's
     interest-received stack once it grew from three sources to five. Yellow
     and magenta both sit under 3:1 on this surface, so the relief rule
     applies: they only ever appear on a stack that carries a legend, value
     labels and the same figures in the table above. */
  --series-4:        #eda100;   /* central bank balances */
  --series-5:        #e87ba4;   /* securities book       */
  --diverge-neg:     #e34948;   /* below-zero arm; pairs with series-1 */
  /* Ordinal ramp for the LTV ladder: one hue, light to dark as LTV rises.
     An LTV band is an ordered magnitude, not an identity, so it takes a ramp
     rather than five unrelated hues. */
  --ltv-1:           #86b6ef;
  --ltv-2:           #5598e7;
  --ltv-3:           #2a78d6;
  --ltv-4:           #1c5cab;
  --ltv-5:           #104281;
  --est-band:        rgba(42, 120, 214, 0.055);
  --est-band-hover:  rgba(42, 120, 214, 0.10);
  --good:            #006300;
  --critical:        #d03b3b;
  --accent:          #2a78d6;
  --shadow:          0 1px 2px rgba(11, 11, 11, .04), 0 8px 24px rgba(11, 11, 11, .05);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface:        #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --axis:           #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --band:           rgba(255, 255, 255, 0.028);
    --series-1:       #3987e5;
    --series-2:       #d95926;
    --series-3:       #199e70;
    --series-4:       #c98500;
    --series-5:       #d55181;
    --diverge-neg:    #e66767;
    --ltv-1:          #184f95;
    --ltv-2:          #256abf;
    --ltv-3:          #3987e5;
    --ltv-4:          #6da7ec;
    --ltv-5:          #9ec5f4;
    --est-band:          rgba(57, 135, 229, 0.10);
    --est-band-hover:          rgba(57, 135, 229, 0.16);
    --good:           #0ca30c;
    --critical:       #e34948;
    --accent:         #3987e5;
    --shadow:         0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface:        #1a1a19;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --grid:           #2c2c2a;
  --axis:           #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --band:           rgba(255, 255, 255, 0.028);
  --series-1:       #3987e5;
  --series-2:       #d95926;
  --series-3:       #199e70;
  --series-4:       #c98500;
  --series-5:       #d55181;
  --diverge-neg:    #e66767;
  --ltv-1:          #184f95;
  --ltv-2:          #256abf;
  --ltv-3:          #3987e5;
  --ltv-4:          #6da7ec;
  --ltv-5:          #9ec5f4;
  --est-band:          rgba(57, 135, 229, 0.10);
  --est-band-hover:          rgba(57, 135, 229, 0.16);
  --good:           #0ca30c;
  --critical:       #e34948;
  --accent:         #3987e5;
  --shadow:         0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1560px; margin: 0 auto; padding: 28px 28px 72px; }

/* ---------- site nav ---------- */
.sitenav {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 4px;
}
.sitenav a {
  font-size: 13.5px; font-weight: 550; text-decoration: none;
  color: var(--text-secondary); padding: 7px 14px; border-radius: 8px;
  border: 1px solid transparent; transition: background .12s ease, color .12s ease;
}
.sitenav a:hover { background: var(--band); color: var(--text-primary); }
.sitenav a.on {
  background: var(--surface); color: var(--text-primary);
  border-color: var(--border); box-shadow: var(--shadow);
}

/* ---------- masthead ---------- */
.masthead {
  display: flex; flex-wrap: wrap; gap: 20px;
  align-items: flex-end; justify-content: space-between;
  padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.masthead h1 { margin: 0; font-size: 25px; font-weight: 640; letter-spacing: -.017em; }
.masthead .sub { margin: 5px 0 0; color: var(--text-secondary); font-size: 13.5px; }
.masthead .basis { margin: 3px 0 0; color: var(--text-muted); font-size: 12.5px; }

.controls { display: flex; align-items: center; gap: 10px; }

.btn {
  font: inherit; font-weight: 560; font-size: 13.5px;
  border-radius: 8px; padding: 9px 17px; cursor: pointer;
  border: 1px solid transparent; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; gap: 8px;
  transition: opacity .12s ease, transform .06s ease;
}
.btn:hover { opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.ghost {
  background: var(--surface); color: var(--text-secondary);
  border-color: var(--border);
}
.btn .spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: none;
}
.btn.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.vintage { text-align: right; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.vintage strong { color: var(--text-primary); font-weight: 600; }

/* ---------- status strip ---------- */
.status {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; margin-bottom: 18px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); font-size: 13px; color: var(--text-secondary);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.status.warn .dot { background: var(--critical); }
.status.warn { color: var(--critical); }
.status .spacer { flex: 1; }
.status a { color: var(--accent); text-decoration: none; }
.status a:hover { text-decoration: underline; }

/* Still used by the table's year-over-year rows and the column charts. */
.delta-up   { color: var(--good); font-weight: 600; }
.delta-down { color: var(--critical); font-weight: 600; }

/* ---------- table ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
  margin-bottom: 22px;
}
.panel-head {
  padding: 15px 18px 13px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
}
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 620; letter-spacing: -.008em; }
.panel-head .hint { font-size: 12.5px; color: var(--text-muted); }

/* The qualification that belongs under a table rather than over it: what the
   dagger on a provisional meeting date means, and what the curve says past
   the last of them. A reader wants it once they have started reading the
   rows, which is where the foot of the table is. */
.panel-foot {
  margin: 0; padding: 11px 18px 14px; border-top: 1px solid var(--border);
  font-size: 12px; line-height: 1.5; color: var(--text-muted);
}

.scroller { overflow-x: auto; }

table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }

table.data thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface);
  font-size: 11.5px; font-weight: 600; color: var(--text-secondary);
  text-align: right; padding: 9px 13px; white-space: nowrap;
  border-bottom: 1px solid var(--axis);
}
table.data thead th.group {
  text-align: center; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 620; padding-top: 11px; padding-bottom: 5px;
  border-bottom: 1px solid var(--grid);
}
table.data thead th.rowhead {
  text-align: left; left: 0; z-index: 4; min-width: 320px;
}
table.data thead tr.groups th.rowhead { border-bottom-color: var(--grid); }

/* Specificity must beat `table.data td`, which right-aligns every data cell. */
table.data th.rowhead, table.data td.rowhead {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  text-align: left; padding: 7px 13px; white-space: nowrap;
}
td.rowhead::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0;
  width: 1px; background: var(--border);
}
th.rowhead::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0;
  width: 1px; background: var(--border);
}

table.data td {
  text-align: right; padding: 7px 13px; white-space: nowrap;
  border-bottom: 1px solid var(--grid); font-size: 13px;
}
table.data tbody tr:hover td { background: var(--band); }
table.data tbody tr:hover td.rowhead { background: var(--band); }

/* boundary between annual | quarterly | monthly */
.sep-left { border-left: 1px solid var(--axis) !important; }

/* row roles */
table.data tr.r-block td {
  background: var(--band); font-size: 11px; font-weight: 640;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-secondary);
  padding: 9px 13px 7px; border-bottom: 1px solid var(--axis);
  text-align: left; position: sticky; left: 0;
}
tr.r-block td .blk-sub {
  text-transform: none; letter-spacing: 0; font-weight: 450;
  color: var(--text-muted); margin-left: 9px; font-size: 11.5px;
}
tr.r-component td.rowhead { padding-left: 30px; color: var(--text-secondary); }
tr.r-component td.rowhead::before {
  content: ""; position: absolute; left: 15px; top: 50%;
  width: 7px; height: 1px; background: var(--axis);
}
tr.r-total td { font-weight: 640; border-top: 1px solid var(--axis); border-bottom: 1px solid var(--axis); }
tr.r-level td { font-weight: 600; }
tr.r-emph td { font-weight: 660; }
tr.r-derived td, tr.r-memo td { color: var(--text-secondary); }
tr.r-memo td.rowhead { font-style: italic; }
/* A rate is a level but not a composition, so it gets no total rule and no
   component tick -- nothing on these rows claims to add up to anything. */
tr.r-rate td { font-weight: 450; }

/* Nowcast columns: modelled, not published. Marked at the header and shaded
   down the column so a reader never mistakes an estimate for a printed figure. */
table.data th.est, table.data td.est { background: var(--est-band); }
table.data td.est { font-style: italic; }
table.data tbody tr:hover td.est { background: var(--est-band-hover); }
.est-tag {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  border-radius: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent); opacity: .75; vertical-align: 1px;
}

.unit { color: var(--text-muted); font-weight: 450; font-size: 11.5px; margin-left: 6px; }
.na { color: var(--text-muted); }

.rownote {
  display: block; font-size: 11px; font-weight: 400; font-style: normal;
  color: var(--text-muted); white-space: normal; max-width: 420px; margin-top: 1px;
}

/* ---------- range control ---------- */
.range-bar {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  margin: 4px 0 16px;
}
.range-label { font-size: 12.5px; color: var(--text-muted); }
.range {
  display: inline-flex; background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px;
}
.range button {
  font: inherit; font-size: 12.5px; font-weight: 560; font-variant-numeric: tabular-nums;
  color: var(--text-secondary); background: transparent; border: 0;
  padding: 5px 13px; border-radius: 6px; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.range button:hover { background: var(--band); color: var(--text-primary); }
.range button.on { background: var(--accent); color: #fff; }
.range-note { font-size: 12.5px; color: var(--text-muted); }

/* ---------- section rule ---------- */
.section-rule {
  margin: 34px 0 18px; padding-top: 20px; border-top: 1px solid var(--border);
}
.section-rule h2 { margin: 0; font-size: 17px; font-weight: 640; letter-spacing: -.011em; }
.section-rule p {
  margin: 6px 0 0; font-size: 13px; color: var(--text-secondary);
  max-width: 100ch; line-height: 1.6;
}

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 22px; }
/* Four charts read better as a 2x2 block than as a row of three plus an orphan. */
.charts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .charts.two { grid-template-columns: minmax(0, 1fr); } }
.chart-body { padding: 6px 14px 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 0 18px 12px; }
.legend .item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.tick { fill: var(--text-muted); font-size: 10.5px; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--axis); stroke-width: 1; }
.hover-band { fill: transparent; cursor: crosshair; }
.crosshair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

.tooltip {
  position: fixed; z-index: 40; pointer-events: none; opacity: 0;
  transition: opacity .1s ease;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; box-shadow: var(--shadow);
  padding: 9px 11px; font-size: 12.5px; min-width: 190px;
  font-variant-numeric: tabular-nums;
}
.tooltip.on { opacity: 1; }
.tooltip .tt-title { font-weight: 640; margin-bottom: 6px; font-size: 12px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tooltip .tt-row .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tooltip .tt-row .tt-label { color: var(--text-secondary); }
.tooltip .tt-row .tt-val { margin-left: auto; font-weight: 600; }
.tooltip .tt-total {
  display: flex; gap: 10px; margin-top: 6px; padding-top: 5px;
  border-top: 1px solid var(--border); font-weight: 640;
}
.tooltip .tt-total span:last-child { margin-left: auto; }

/* ---------- provenance ---------- */
details.prov { margin-top: 8px; }
details.prov summary {
  cursor: pointer; font-size: 13px; color: var(--accent);
  padding: 11px 18px; list-style: none; font-weight: 550;
}
details.prov summary::-webkit-details-marker { display: none; }
details.prov summary::before { content: "â–¸ "; display: inline-block; transition: transform .15s; }
details.prov[open] summary::before { transform: rotate(90deg); }
.prov-body { padding: 4px 18px 18px; }
table.meta { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.meta th, table.meta td {
  text-align: left; padding: 6px 11px; border-bottom: 1px solid var(--grid);
  vertical-align: top;
}
table.meta th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; }
table.meta td.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: nowrap; }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 620; border: 1px solid var(--border);
}
.pill.pass { color: var(--good); }
.pill.fail { color: var(--critical); }

footer.notes {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-muted); line-height: 1.65;
}
footer.notes p { margin: 0 0 8px; max-width: 105ch; }
footer.notes a { color: var(--accent); }

@media (max-width: 720px) {
  .wrap { padding: 18px 14px 56px; }
  .masthead { align-items: flex-start; }
  table.data thead th.rowhead { min-width: 220px; }
}

