/* Public-report presentation.
 *
 * Charts, cards and controls keep the shared component styling from
 * `_generated/styles.css`; what lives here is the editorial layer that only a
 * standalone public page wants - a centred masthead, sans-serif body type, and
 * running text measured for reading instead of stretched across the full
 * dashboard width. None of it belongs in `lib/`, where it would leak into the
 * in-app dashboards. */

:root {
  /* The `wide` theme sets --observablehq-max-width to 100vw, which is right for a
     dashboard inside the app's frame but not for a standalone page. Framework
     applies this variable to <body> and derives the fixed header's insets from it,
     so reinstating a bound here keeps header and content aligned. */
  --observablehq-max-width: 1440px;

  /* Matches the .grid gap the card rows use, so anything laid out on the page's
     column grid lines up with the cards below it. */
  --public-gutter: 1rem;

  --public-ink-muted: #4a4a4a;
  --public-ink-faint: #6b6b6b;
  --public-rule: #e3e3e3;
}

body {
  /* Narrower than the shared 5rem: this header carries one centred line. */
  --observablehq-header-height: 3.75rem;

  font: 16px/1.6 var(--sans-serif);
}

/* ---------------------------------------------------------------- masthead */

/* The publisher line is the page's masthead, so it sits in the fixed header
   instead of repeating as a kicker above the lede. */
#observablehq-header {
  align-items: center;
  padding-block: 0;
}

/* On screen the header is fixed to the viewport, so its content is inset by hand
   to sit over the same column as the page body - which is centred within
   --observablehq-max-width, then indented by #observablehq-center's 2rem margin.
   The inset goes on the header rather than the heading inside it because htl
   wraps PageHeader's output in a span, which is not a box worth sizing. Print
   lays the header out in flow, where it needs no inset. */
@media screen {
  #observablehq-header {
    padding-inline: calc(max(0px, (100% - var(--observablehq-max-width)) / 2) + 2rem);
  }
}

.site-title {
  font-family: var(--sans-serif);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

/* ------------------------------------------------------------------ typography */

h1,
h2,
h3,
h4 {
  font-family: var(--sans-serif);
}

/* The page's own section headings, wherever they sit - a section that shares a
   row with another has its heading inside the grid cell. ChartHeader emits an h2
   too, so chart titles are excluded by class and keep the component's sizing. */
#observablehq-main h2:not(.chart-header__title) {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 0.5rem;
}

#observablehq-main h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

/* A paragraph directly under a section heading is that section's deck. */
#observablehq-main h2:not(.chart-header__title) + p {
  color: var(--public-ink-muted);
}

/* ---------------------------------------------------- side-by-side sections */

/* Two page sections sharing one grid row, each cell holding its own heading,
   deck and content. Used where a section is too narrow to earn the full width -
   the destination donut beside the material-group table - and to give the
   methodology notes the page's width back instead of one long left-hugging
   column. Cells are read left through right, as a single column would be. */
.section-columns > div > :first-child {
  margin-top: 0;
}

/* A cell holding a card stretches it to the row height, so cards of unequal
   natural height still line up top and bottom. Only such cells become flex
   containers: in a prose cell it would stop paragraph margins collapsing. */
.section-columns > div:has(> .card) {
  display: flex;
  flex-direction: column;
}

.section-columns > div > .card {
  flex: 1;
  margin-top: 0;
}

/* The cells are unequal widths, so the same-length deck wraps to a different
   number of lines in each and the cards below start at different heights.
   Reserving two lines keeps their top edges level; `flex: 1` above already
   levels the bottom ones. Decks here are written to fit within two lines. */
.section-columns > div:has(> .card) > h2 + p {
  min-height: 2lh;
}

/* ------------------------------------------------------------------- masthead block */

.masthead {
  border-bottom: 1px solid var(--public-rule);
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
}

.masthead p {
  font-size: 1.0625rem;
  margin-block: 0.5rem 0;
}

/* Laid out on the same five columns as the card rows below, so the dateline
   reads as the first row of the page's grid. Deliberately its own rule rather
   than a shared grid class: this is the only place the pairing is wanted, and
   the shared classes stay free of public-report layout decisions. */
.vintage-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem var(--public-gutter);
  margin-top: 1.75rem;
  font-size: 0.8125rem;
  color: var(--public-ink-muted);
}

/* Breakpoints mirror .grid-cols-5 so the columns stay in step with the cards. */
@container (min-width: 640px) {
  .vintage-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (min-width: 1024px) {
  .vintage-bar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.vintage-bar b {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--public-ink-faint);
}

/* ------------------------------------------------------------------ footnotes */

.footnotes {
  /* The framework caps a list at 600px; nothing else on the page is capped, so
     the notes fill their column like every other block of text. */
  max-width: none;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--public-ink-muted);
}

/* Replaces the prototype's flashFootnote script: following a [n] link
   highlights the note it lands on, with no JavaScript. */
.footnotes li:target {
  background: #fff6d6;
  transition: background 1.5s ease-out;
}
