/* Public UK threat dashboard: the private dashboard's "Field Almanac" layout, styled from the Field manual tokens
   (public spec section 9; design-tokens.css).
   Paper and ink, colour only on level chips and the 4px card edge. No inline styles anywhere (CSP style-src 'self'). */

:root {
  /* Mapped onto the Field manual tokens (design-tokens.css, linked first). */
  --paper: var(--color-paper); --card: var(--color-card); --ink: var(--color-ink); --muted: var(--color-muted); --rule: var(--color-rule); --contour: var(--color-contour);
  --normal: var(--level-normal); --watch: var(--level-watch); --act: var(--level-act); --severe: var(--level-severe); --nodata: var(--level-nodata); --chip-ink: #FFFFFF;
  --olive: var(--color-olive); --khaki: var(--color-khaki);
  --focus: #1F5FA8; --shadow: 0 1px 0 rgba(31, 42, 48, .06), 0 6px 18px -12px rgba(31, 42, 48, .35);
  --serif: var(--font-display);
  --sans: var(--font-body);
  --stencil: var(--font-stencil);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gap: 16px; --radius: 6px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.5 var(--sans); overflow-wrap: normal; word-break: normal; hyphens: manual;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.mono { font-family: var(--mono); font-size: .875em; letter-spacing: 0; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; border-radius: 4px; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* Masthead */
.masthead {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px;
  max-width: 1600px; margin: 0 auto; padding: 14px var(--gap) 10px; border-bottom: 1px solid var(--rule);
}
.brand { margin: 0; font: 400 .875rem/1.2 var(--stencil); letter-spacing: .14em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 4px; background: currentColor; border-radius: 50%; }
.where { margin: 0; color: var(--muted); font-size: .875rem; min-width: 0; max-width: 100%; }
.place { overflow-wrap: anywhere; }
.sep { padding: 0 4px; }

/* Banners */
.banners { max-width: 1600px; margin: 0 auto; padding: 0 var(--gap); }
.banner { margin: 12px 0 0; padding: 10px 14px; border: 1px solid var(--rule); border-left: 4px solid var(--ink); background: var(--card); border-radius: var(--radius); font-size: .9375rem; }
.banner strong { font-weight: 600; }
.banner-example { border-left-style: dashed; }
.banner-paused { border-left-color: var(--act); }

/* Hero */
main { max-width: 1600px; margin: 0 auto; padding: 0 var(--gap) 24px; }
.hero { position: relative; padding: 20px 0 18px; }
.hero-kicker { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .875rem; }
.headline { margin: 0; font: 600 clamp(1.75rem, 1.15rem + 2.6vw, 3.25rem)/1.12 var(--serif); letter-spacing: -.01em; max-width: 30ch; text-wrap: balance; }
.hero-kicker .health { font-weight: 600; color: var(--ink); }
.subline { margin: 8px 0 0; max-width: 62ch; font-size: 1.0625rem; color: var(--ink); }
.subline:empty { display: none; }
body.quiet .hero { padding: 40px 0 34px; }
/* The private build's contour-map backdrop is not carried over (its source is unconfirmed). */

/* Chips: the only place level colour fills a shape */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--lvl, var(--nodata)); color: var(--chip-ink); font: 600 .8125rem/1.3 var(--sans); letter-spacing: .02em; white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; flex: none; fill: currentColor; }
.chip-lg { padding: 6px 14px 6px 12px; font-size: 1rem; }
.chip-lg svg { width: 16px; height: 16px; }
.lvl-normal { --lvl: var(--normal); } .lvl-watch { --lvl: var(--watch); } .lvl-act { --lvl: var(--act); } .lvl-severe { --lvl: var(--severe); } .lvl-nodata { --lvl: var(--nodata); }
.chip.is-greyed { background: var(--nodata); }

/* Glance strip: six cards in one line */
.glance { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 760px; }
.glance a {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--card); text-decoration: none; font-size: .8125rem; line-height: 1.2; min-height: 44px;
}
.glance .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--lvl, var(--nodata)); color: var(--chip-ink); display: grid; place-items: center; flex: none; }
.glance .dot svg { width: 11px; height: 11px; fill: currentColor; }
.glance .dot.is-greyed { background: var(--nodata); }
@media (min-width: 720px) { .glance { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1100px) {
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); column-gap: 40px; align-items: end; }
  .hero-kicker, .headline, .subline { grid-column: 1; }
  .glance { grid-column: 2; grid-row: 1 / span 3; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; align-self: end; }
}

/* Cards */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--lvl, var(--nodata)); border-radius: var(--radius);
  padding: 14px 16px 12px 16px; box-shadow: var(--shadow); scroll-margin-top: 12px;
}
.card-scope { margin: 0; font-size: .875rem; color: var(--muted); }
.card.is-link { --lvl: var(--rule); } /* link-only gas card: neutral edge, no status colour */
.card-link { margin: 0; }
.card.is-greyed { border-left-color: var(--nodata); border-left-style: dashed; }
.card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-icon { width: 30px; height: 30px; flex: none; color: var(--ink); }
.card-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.card-title { margin: 0; font: 600 1.0625rem/1.25 var(--sans); flex: 1 1 auto; min-width: 0; }
.card-head .chip { flex: none; }
.trend { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.trend svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card-line { margin: 0; font: 600 1.125rem/1.35 var(--serif); }
.sides { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; font-size: .9375rem; }
.sides dt { color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; padding-top: 3px; }
.sides dd { margin: 0; display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: baseline; gap: 6px; }
.side-glyph { width: 10px; height: 10px; flex: none; fill: var(--ink); transform: translateY(1px); }
.actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.actions li { display: flex; gap: 8px; align-items: baseline; font-size: .9375rem; }
.actions li::before { content: "→"; color: var(--muted); flex: none; }
.actions .act-src { color: var(--muted); font-size: .8125rem; }
.stress { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px; padding: 8px 10px; border: 1px dashed var(--rule); border-radius: var(--radius); }
.stress-bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.stress-bars span { width: 7px; border: 1.5px solid var(--ink); border-radius: 1px; }
.stress-bars span:nth-child(1) { height: 8px; } .stress-bars span:nth-child(2) { height: 14px; } .stress-bars span:nth-child(3) { height: 20px; }
.stress-bars span.on { background: var(--ink); }
.stress-text { font-size: .875rem; line-height: 1.3; }
.stress-text small { display: block; color: var(--muted); font-size: .75rem; }
.hf-note { margin: 0; font-size: .875rem; color: var(--muted); }
.card-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; justify-content: space-between; color: var(--muted); font-size: .8125rem; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 1.5px dashed var(--ink); border-radius: 999px; color: var(--ink); font: 600 .75rem/1.3 var(--sans); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.badge-down { border-style: solid; }
.down-note { margin: 0; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: .9375rem; }
.more {
  font: 600 .875rem/1 var(--sans); color: var(--ink); background: transparent; border: 1px solid var(--ink); border-radius: 999px;
  padding: 8px 14px; min-height: 36px; cursor: pointer;
}
.more:hover { background: var(--ink); color: var(--paper); }

/* Normal cards on a busy day (spec 6.1, decision 17 keeps the fixed order): quieter and more compact, so the
   active cards stand out. Muted text keeps AA contrast (5.6:1 light). */
body:not(.quiet) .card.lvl-normal:not(.is-greyed) { gap: 6px; padding-top: 10px; padding-bottom: 8px; box-shadow: none; background: transparent; }
body:not(.quiet) .card.lvl-normal:not(.is-greyed) .card-line { font: 400 .9375rem/1.35 var(--sans); color: var(--muted); }
body:not(.quiet) .card.lvl-normal:not(.is-greyed) .actions { display: none; }
body:not(.quiet) .card.lvl-normal:not(.is-greyed) .card-title { font-weight: 400; }

/* Quiet state: cards collapse to one line */
body.quiet .card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; }
body.quiet .card-head { flex: 1 1 220px; }
body.quiet .card-line { flex: 1 1 100%; font: 400 .9375rem/1.35 var(--sans); color: var(--muted); }
body.quiet .sides, body.quiet .actions, body.quiet .stress, body.quiet .hf-note { display: none; }
body.quiet .card-foot { flex: 1 1 100%; border-top: 0; padding-top: 0; }

/* Footer */
.foot { max-width: 1600px; margin: 0 auto; padding: 18px var(--gap) 32px; border-top: 1px solid var(--rule); color: var(--muted); font-size: .8125rem; }
.sources summary { cursor: pointer; color: var(--ink); font-weight: 600; font-size: .875rem; min-height: 32px; display: list-item; }
.sourcelist { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .sourcelist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sourcelist li { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.attributions { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.notes { margin: 10px 0 0; }

/* Drill-down: the only place tables appear */
.drill { width: min(780px, calc(100vw - 24px)); max-height: min(88vh, 900px); padding: 0; border: 1px solid var(--rule); border-radius: 10px; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .45); }
.drill::backdrop { background: rgba(20, 24, 28, .55); }
.drill-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--card); border-bottom: 1px solid var(--rule); z-index: 1; }
.drill-head h2 { margin: 0; font: 600 1.375rem/1.2 var(--serif); }
.drill-close { font: 600 .875rem/1 var(--sans); background: var(--ink); color: var(--paper); border: 0; border-radius: 999px; padding: 10px 16px; cursor: pointer; }
.drill-body { padding: 6px 18px 18px; }
.block { margin: 14px 0 0; }
.block h3 { margin: 0 0 6px; font: 600 .8125rem/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.block ul { margin: 0; padding-left: 18px; }
.block li { margin: 2px 0; }
.block dl { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.block dt { color: var(--muted); }
.block dd { margin: 0; font-family: var(--mono); font-size: .875rem; }
.tablewrap { overflow-x: auto; }
.block table { border-collapse: collapse; width: 100%; font-size: .875rem; }
.block th, .block td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.block th { font-weight: 600; color: var(--muted); }
.spark { width: 100%; height: 64px; display: block; }
.spark polyline { fill: none; stroke: var(--ink); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark line { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark-cap { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; }
.block-note { margin: 0; padding: 8px 10px; border-left: 3px solid var(--rule); color: var(--ink); }
.bars { display: grid; gap: 4px; }
.bars div { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: .875rem; }
.bars i { display: block; height: 8px; background: var(--ink); border-radius: 2px; min-width: 2px; }
.bars .w0 { width: 2%; } .bars .w1 { width: 10%; } .bars .w2 { width: 20%; } .bars .w3 { width: 30%; } .bars .w4 { width: 40%; } .bars .w5 { width: 50%; }
.bars .w6 { width: 60%; } .bars .w7 { width: 70%; } .bars .w8 { width: 80%; } .bars .w9 { width: 90%; } .bars .w10 { width: 100%; }


/* Motion: one 200 ms fade on a level change and a slow trend nudge. Nothing blinks. */
@keyframes fadein { from { opacity: .35; } to { opacity: 1; } }
@keyframes nudge-up { from { transform: translateY(3px); } to { transform: none; } }
@keyframes nudge-down { from { transform: translateY(-3px); } to { transform: none; } }
.changed { animation: fadein 200ms ease-out 1; }
.trend-up svg { animation: nudge-up 1.6s ease-out 1; }
.trend-down svg { animation: nudge-down 1.6s ease-out 1; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.noscript { max-width: 60ch; margin: 24px auto; padding: 0 16px; }
@media print { .more, .skip, .glance { display: none; } body { background: #fff; } }

/* View switcher (public spec P4): the UK overview and the 12 ITL1 regions in official order, as plain links. */
.views { margin: 0 0 12px; }
.views-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.views-list a { display: inline-block; min-height: 24px; padding: 3px 10px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .9375rem; }
.views-list a:hover, .views-list a:focus-visible { border-color: var(--ink); text-decoration: underline; }
.views-list a[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
