/* ----- Metrics Summary page ----- */

.stat-cards {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 1em;
  margin: 1.25em 0 0.5em;
}

.stat-card {
  /* flex-basis 0 (not 180px) + shrink together instead of wrapping to a
     new row when the 4 cards don't all fit at their natural width */
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.9em;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1em 1.25em;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.stat-card .stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  font-size: 1.15em;
  line-height: 1;
  flex-shrink: 0;
}

.stat-card .stat-value {
  font-size: 1.65em;
  font-weight: 700;
  line-height: 1.15;
  color: #14325F; /* WVC Blue */
}

.stat-card .stat-label {
  font-size: 0.82em;
  color: #404040; /* WVC Charcoal Grey */
  line-height: 1.25;
  margin-top: 0.1em;
}

/* Icon colors match the table's change colors (see the qmd):
   WVC Blue for totals, dark green for improved, Charcoal Grey for no
   change, WVC Berry for declined. Backgrounds are light tints of each. */
.stat-icon.total    { background: #E5EDF7; color: #14325F; }
.stat-icon.improved { background: #DCFCE7; color: #15803D; }
.stat-icon.nochange { background: #E8E8E8; color: #404040; }
.stat-icon.declined { background: #F8E5EB; color: #C1225A; }

.stat-cards-footnote {
  color: #404040; /* WVC Charcoal Grey */
  font-size: 0.82em;
  margin: 0 0 1.75em;
}

/* Remove Bootstrap's zebra striping from gt tables. Bootstrap 5 doesn't
   stripe with background-color - it paints an inset box-shadow over each
   cell - which is why a background-color override alone never worked.
   This clears the shadow and the variables that feed it, so only gt's own
   colors (category heading tints, change colors) show. Safe to keep even
   with quarto.disable_processing = TRUE; it's a backstop if Quarto still
   adds its table classes. */
.gt_table > tbody > tr > *,
.gt_table.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: transparent;
  --bs-table-bg-type: transparent;
  --bs-table-striped-bg: transparent;
  box-shadow: none !important;
}

/* Metric names link to their detail pages and carry their definition as a
   native `title` hover tooltip (see metric_md in the qmd). Solid underline
   to match the standalone gt look. */
.gt_table a[title] {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* gt always wraps its output table in a div with an inline
   overflow-x:auto; overflow-y:auto - regardless of tab_options() - and its
   randomly-generated id changes every render, so target it structurally:
   "whichever div directly wraps a .gt_table". overflow-y:auto makes it a
   scroll-containing ancestor, which blocks position: sticky below from
   reaching the real page scrollbar, so override it to visible. (This gives
   up that div's horizontal auto-scroll on narrow screens.) */
div:has(> .gt_table),
.cell-output-display:has(.gt_table) {
  overflow: visible !important;
}
/* Quarto also wraps every chunk output in .cell-output-display, which has
   overflow-x:auto in Quarto's own CSS. That made it the sticky header's
   scroll container, so top: 64px was measured from the table's top edge
   instead of the page: the header was pushed 64px down on load, leaving a
   blank gap above it and covering the first category row ("Access").
   Setting it to visible too lets the header stick to the page as intended. */

/* Freeze the column-header row against the main page scrollbar.

   Quarto's navbar is not permanently fixed: it slides out of view when you
   scroll down and slides back in when you scroll up (it adds the classes
   headroom--pinned / headroom--unpinned to #quarto-header). A fixed
   top: 64px therefore left a 64px empty gap above the header whenever the
   navbar was hidden, pushing the header down onto the first category row.

   So the header docks at the very top (top: 0) by default, and only drops
   below the navbar while the navbar is actually showing. If there's a
   small gap or overlap when the navbar is visible, adjust --navbar-height. */
:root {
  --navbar-height: 64px;
}

.gt_table thead > tr.gt_col_headings > th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #F7956B; /* Viking Orange Supporting Tint, matches the qmd */
  /* In a collapsed-border table, real borders stay behind when a cell
     sticks, which left a stray blue line above the header. An inset
     shadow moves with the cell, so the WVC Blue underline stays attached. */
  box-shadow: inset 0 -2px 0 #14325F;
  transition: top 0.2s ease-in-out;
}

body:has(#quarto-header.headroom--pinned:not(.headroom--top))
  .gt_table thead > tr.gt_col_headings > th {
  top: var(--navbar-height);
}
