/*
 * Infrastructure Sentinel site styles.
 * Colours come from /static/brand/tokens.css (approved palette, light + dark);
 * the aliases below map them onto this stylesheet. No inline styles anywhere
 * (CSP style-src 'self'). Mobile-first; no animation.
 */
:root {
  --fg: var(--text);
  --muted: var(--text-muted);
  --card: var(--surface);
  --line: var(--border);
  --bad: var(--danger);
  --ok: var(--band-stable);
  --warn: var(--band-guarded);
  --act-bg: #fbe9eb;
  --elev-bg: #fbf3e4;
  --rout-bg: #e8f2ec;
  --header-bg: var(--is-midnight);
  --header-fg: var(--is-platinum);
  --header-muted: var(--is-silver);
  --cta-bg: var(--is-red);
  --cta-fg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --act-bg: #3a1419;
    --elev-bg: #33290f;
    --rout-bg: #11301f;
    --ok: #6cc59a;
    --warn: #d9b673;
    --header-bg: #040f1c;
  }
}
:root[data-theme='dark'] {
  --act-bg: #3a1419;
  --elev-bg: #33290f;
  --rout-bg: #11301f;
  --ok: #6cc59a;
  --warn: #d9b673;
  --header-bg: #040f1c;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--font-sans);
  overflow-wrap: anywhere;
}
img {
  max-width: 100%;
  height: auto;
}
a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.wrap {
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 16px;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--card);
  padding: 0.5rem;
  z-index: 10;
}

/* Header: emblem icon + live-text wordmark on midnight navy, in both themes. */
header.site {
  background: var(--header-bg);
  color: var(--header-fg);
}
header.site .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--header-fg);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand-icon {
  width: 32px;
  height: 32px;
  flex: none;
}
.wordmark {
  font-size: 1.02rem;
}
.admin-tag {
  font-size: 0.75rem;
  border: 1px solid var(--header-muted);
  border-radius: 4px;
  padding: 0 0.35rem;
  color: var(--header-muted);
}
header.site nav {
  order: 3;
  flex-basis: 100%;
}
header.site nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
}
header.site nav a {
  color: var(--header-muted);
  text-decoration: none;
  font-size: 0.92rem;
}
header.site nav a:hover {
  color: var(--header-fg);
}
header.site nav a[aria-current='page'] {
  color: var(--header-fg);
  text-decoration: underline;
  text-decoration-color: var(--is-gold);
  text-underline-offset: 0.35em;
}
.cta-header {
  margin-left: auto;
}
.signout {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
  color: var(--header-muted);
  font-size: 0.88rem;
}
.signout .muted {
  color: var(--header-muted);
}
@media (min-width: 60rem) {
  .brand-icon {
    width: 38px;
    height: 38px;
  }
  header.site nav {
    order: 0;
    flex-basis: auto;
  }
}

.cta {
  display: inline-block;
  padding: 0.55rem 1.05rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.2;
  background: var(--cta-bg);
  color: var(--cta-fg);
  border: 1px solid var(--cta-bg);
}
.cta:hover {
  filter: brightness(1.08);
}
.cta-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.cta-header {
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
}

main {
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
}
h1 {
  font-size: 1.65rem;
  line-height: 1.2;
  margin: 0.5rem 0 0.75rem;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.6rem;
  letter-spacing: -0.005em;
}
h3 {
  font-size: 1.05rem;
  margin: 1rem 0 0.4rem;
}
section > h2:first-child {
  margin-top: 0;
}
.lede {
  font-size: 1.05rem;
  color: var(--muted);
}
.muted,
.meta {
  color: var(--muted);
  font-size: 0.92rem;
}
.plain {
  color: var(--fg);
}
.empty {
  color: var(--muted);
  font-style: italic;
}

/* Homepage hero: the full emblem appears only here and in the footer. */
.hero {
  display: grid;
  gap: 1rem;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding: 1.25rem 0 1.5rem;
}
.hero-emblem {
  width: 168px;
}
.hero h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
.hero-sub {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 40rem;
  margin: 0 auto 1rem;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin: 0;
}
@media (min-width: 60rem) {
  .hero {
    grid-template-columns: 300px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
    padding: 2rem 0 2.25rem;
  }
  .hero-emblem {
    width: 280px;
  }
  .hero h1 {
    font-size: 2.6rem;
  }
  .hero-sub {
    margin-left: 0;
  }
  .hero-ctas {
    justify-content: flex-start;
  }
}

footer.site {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem 0 2.5rem;
  background: var(--card);
}
.footer-emblem {
  width: 112px;
  display: block;
  margin-bottom: 0.75rem;
}

/* Badges and levels */
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--card);
}
.level-line .badge {
  font-size: 1.35rem;
  padding: 0.2rem 0.65rem;
}
.badge.level-actionable {
  background: var(--act-bg);
  border-color: var(--bad);
  color: var(--bad);
}
.badge.level-elevated {
  background: var(--elev-bg);
  border-color: var(--warn);
  color: var(--warn);
}
.badge.level-routine {
  background: var(--rout-bg);
  border-color: var(--ok);
  color: var(--ok);
}
.conf-low,
.sev-extreme,
.sev-severe,
.status-retracted {
  color: var(--bad);
  border-color: var(--bad);
}
.conf-medium,
.sev-moderate,
.disputed {
  color: var(--warn);
  border-color: var(--warn);
}
.conf-high {
  color: var(--ok);
  border-color: var(--ok);
}
.badge.research {
  color: var(--warn);
  border-color: var(--warn);
  font-weight: 600;
}
.instruction blockquote {
  margin: 0.75rem 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--bad);
  background: var(--act-bg);
  border-radius: 0 8px 8px 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.instruction blockquote p {
  margin: 0 0 0.5rem;
  white-space: pre-line;
}
.instruction footer {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--fg);
}
.notice {
  border: 1px solid var(--line);
  border-left-width: 4px;
  padding: 0.65rem 0.85rem;
  margin: 0.75rem 0;
  background: var(--card);
  border-radius: 8px;
}
.notice-warn {
  border-left-color: var(--warn);
}
.notice-error {
  border-left-color: var(--bad);
}
.notice-ok {
  border-left-color: var(--ok);
}
.banner-historical {
  background: #3b3f45;
  color: #fff;
  font-weight: 700;
  padding: 0.5rem 0;
  letter-spacing: 0.04em;
}

/* Cards, lists, tiles */
.tiles {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 40rem) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 60rem) {
  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.tile,
.source,
.relation,
.incident,
.cta-block,
.explainer,
section.assessment,
.regional {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
section.assessment,
.cta-block,
.explainer,
.regional {
  box-shadow: var(--shadow);
  margin: 1.25rem 0;
}
.regional .isti {
  box-shadow: none;
  margin-bottom: 0;
}
.tile h3 {
  margin-top: 0;
}
.tile p {
  margin: 0.3rem 0;
}
.tile.not-monitored,
.source.not-monitored {
  border-style: dashed;
}
.tile-note,
.coverage {
  font-size: 0.88rem;
  color: var(--muted);
}
.count strong {
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}
.incidents,
.relations,
.reports,
.source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}
.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  font-size: 0.85rem;
  background: var(--card);
}
.chip-ok strong {
  color: var(--ok);
}
.chip-stale strong,
.chip-failing strong {
  color: var(--bad);
}
.source-failing,
.source-stale {
  border-left: 4px solid var(--bad);
}
.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem 0.75rem;
  margin: 0.5rem 0;
}
.facts dt {
  font-weight: 600;
}
.facts dd {
  margin: 0 0 0.4rem;
}
@media (min-width: 40rem) {
  .facts {
    grid-template-columns: 12rem minmax(0, 1fr);
  }
  .facts dd {
    margin: 0;
  }
}
.feedtext {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--muted);
}
.timeline {
  padding-left: 1.25rem;
}
.timeline li {
  margin-bottom: 0.3rem;
}
details {
  margin: 0.75rem 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
.tier {
  font-size: 0.88rem;
  color: var(--muted);
}
.cta-block {
  border-left: 4px solid var(--is-red);
}
.explainer-grid {
  display: grid;
  gap: 0.5rem 1.5rem;
}
@media (min-width: 50rem) {
  .explainer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.components-list {
  padding-left: 1.25rem;
}
.components-list li {
  margin-bottom: 0.45rem;
}

/* ISTI: the centrepiece, styled like a market index display. */
.isti {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin: 1rem 0 1.5rem;
}
.isti.isti-hero {
  border-top: 3px solid var(--is-gold);
}
.isti-head h2 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.isti-region {
  display: block;
  color: var(--fg);
  font-size: 1.25rem;
  letter-spacing: 0;
  text-transform: none;
}
.isti-main {
  display: grid;
  gap: 0.75rem 1.5rem;
}
@media (min-width: 50rem) {
  .isti-main {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
}
.isti-figure p {
  margin: 0;
}
.isti-score {
  font-variant-numeric: tabular-nums;
}
.isti-score strong {
  font-size: 3.6rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.isti-unpublished .isti-score strong {
  color: var(--muted);
}
.isti-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
}
@media (min-width: 50rem) {
  .isti-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.isti-stats dt {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.isti-stats dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.isti-headline {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.75rem 0 0.25rem;
}
.isti-interpretation {
  margin: 0.6rem 0;
}
.chg {
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.chg-na {
  color: var(--muted);
  font-weight: 400;
}
.band-severe .chg-up {
  color: var(--band-severe);
}
.badge.band {
  font-size: 0.95rem;
  padding: 0.1rem 0.55rem;
}
.band-stable .badge.band {
  color: var(--band-stable);
  border-color: var(--band-stable);
}
.band-normal .badge.band {
  color: var(--band-normal);
  border-color: var(--band-normal);
}
.band-guarded .badge.band {
  color: var(--band-guarded);
  border-color: var(--band-guarded);
}
.band-elevated .badge.band {
  color: var(--band-elevated);
  border-color: var(--band-elevated);
}
.band-severe .badge.band {
  color: var(--band-severe);
  border-color: var(--band-severe);
}
.isti-unpublished .badge.band {
  color: var(--muted);
}
.isti-changes {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.25rem 0;
  font-variant-numeric: tabular-nums;
}
.isti-components {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.isti-components li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: center;
}
.isti-components meter {
  width: 8rem;
  max-width: 30vw;
}
.num {
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}
.isti-footnote {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0;
}
.isti-chart {
  margin: 0.75rem 0 0.25rem;
}
svg.chart {
  width: 100%;
  height: auto;
  display: block;
}
svg.spark {
  width: 120px;
  height: 27px;
  display: block;
  max-width: 100%;
}
.isti .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.isti .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}
svg.spark .line {
  stroke-width: 1.5;
}
.isti .pt {
  fill: var(--accent);
}
.isti .unpub {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
}
.isti .axis {
  fill: var(--muted);
  font-size: 10px;
}

/* Map and forms */
.map {
  height: 22rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.leaflet-container {
  max-width: 100%;
}
form.stack {
  display: grid;
  gap: 0.5rem;
  max-width: 36rem;
  margin: 0.5rem 0;
}
form.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
label {
  display: grid;
  gap: 0.2rem;
  font-weight: 600;
  font-size: 0.95rem;
}
input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
  max-width: 100%;
}
input,
select,
textarea {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
}
button {
  background: var(--accent);
  color: var(--accent-contrast);
  border: 0;
  border-radius: 6px;
  padding: 0.45rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  justify-self: start;
}
.signout button {
  background: transparent;
  color: var(--header-fg);
  border: 1px solid var(--header-muted);
  padding: 0.25rem 0.6rem;
}

/* Public Beta and incomplete-data labels; ZIP lookup */
.beta-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--is-gold);
  border: 1px solid var(--is-gold);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  text-decoration: none;
}
.chip-beta {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  border: 1px dashed var(--muted);
  border-radius: 999px;
  padding: 0 0.5rem;
  text-decoration: none;
  vertical-align: middle;
  text-transform: none;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.zip-form {
  display: grid;
  gap: 0.3rem;
  margin: 0.75rem 0;
}
.zip-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.zip-form input {
  width: 9rem;
  font-variant-numeric: tabular-nums;
}
.zip-header {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
}
.zip-header input {
  width: 7.5rem;
  padding: 0.25rem 0.45rem;
  background: #0c2238;
  color: var(--is-platinum);
  border-color: #2b4a6b;
}
.zip-header input::placeholder {
  color: var(--is-silver);
}
.zip-header button {
  padding: 0.25rem 0.6rem;
  background: transparent;
  color: var(--is-platinum);
  border: 1px solid var(--is-silver);
}
.zip-hero {
  justify-items: center;
}
@media (min-width: 60rem) {
  .zip-hero {
    justify-items: start;
  }
}
.zip-cta {
  margin: 0.5rem 0 1rem;
}
header.site .zip-header {
  order: 4;
  flex-basis: 100%;
}
@media (min-width: 60rem) {
  header.site .zip-header {
    order: 0;
    flex-basis: auto;
  }
}
