/* Components: the header, the dashboard cards, charts, table, Info drawer and footer.
   Consumes the tokens in tokens.css; nothing here should hard-code a value a token
   already covers. See docs/DESIGN.md. */

/* The header (top bar, brand, theme/Info controls) is shared: shared/styles/header.css. */

/* ---- region tabs -------------------------------------------------------- */
/* Plain anchors styled as a tab bar (the RRG tool's cut-tab treatment); the active
   region carries aria-current and the accent underline. Hidden on the overview. */
.region-nav {
  display: flex;
  gap: 2px;
  margin-bottom: var(--gap);
  border-bottom: 1px solid var(--line);
}
.region-tab {
  padding: 8px 14px 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.region-tab:hover {
  color: var(--ink);
}
.region-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.region-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---- overview ----------------------------------------------------------- */
.overview-lede {
  margin: 0 0 14px;
  max-width: 64ch;
  color: var(--muted);
  font-size: 13.5px;
}
/* One region per row at every width, unlike the indicator grids. There are only three
   economies and each card carries a stress history worth reading across, so the width
   goes to the sparkline rather than to a third column.
   Both classes are needed: `.cards` sets the auto-fill columns further down this file, so
   a single-class selector here loses the cascade to it on source order alone. */
.cards.overview-cards {
  grid-template-columns: 1fr;
}
.overview-cards .region-card .card-chart {
  min-height: 90px;
}
.region-card .big .of {
  color: var(--muted);
  font-size: 0.55em;
  font-weight: 400;
}

/* ---- data credits ------------------------------------------------------- */
/* The visible per-source attribution the non-US licences require. Muted, after the
   content it credits. */
.credits {
  margin: 18px 0 0;
  font-size: 11.5px;
  color: var(--faint);
}
.credits a {
  color: var(--faint);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.credits a:hover {
  color: var(--muted);
}

/* ---- page shell -------------------------------------------------------- */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 22px 18px 40px;
}
.empty {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
}
.section-head {
  margin: 28px 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- headline ---------------------------------------------------------- */
.headline {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 22px;
  align-items: center;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.headline-count {
  font: 700 clamp(38px, 7vw, 56px) / 1 var(--font-mono);
  letter-spacing: -0.02em;
}
.headline-count .of {
  color: var(--muted);
  font-size: 0.5em;
  font-weight: 400;
}
.headline-lede {
  margin: 8px 0 0;
  font-size: 15px;
}
.headline-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.headline-tallies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  font-size: 13px;
}
.tally {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.tally b {
  color: var(--ink);
  font-family: var(--font-mono);
}
.headline-chart {
  min-width: 0;
}
.chart-caption {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--faint);
}

/* ---- market group ------------------------------------------------------ */
/* A second set with its own count, set apart from the macro sections above by a rule
   and its own count line, so the two are never read as one list of fourteen. */
.markets {
  margin-top: 34px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.markets-head {
  margin-bottom: 14px;
}
.markets .section-head {
  margin-bottom: 4px;
}
.markets-count {
  margin: 0;
  font-size: 15px;
}
.markets-count b {
  font-family: var(--font-mono);
}
.markets-sub {
  margin: 6px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 13px;
}

/* ---- status glyphs ----------------------------------------------------- */
/* Meaning is never colour-only: each status has its own glyph shape as well as its own
   hue, and the written label always accompanies both. */
.glyph {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
}
.glyph-normal {
  border-radius: 50%;
  background: var(--ok);
}
.glyph-watch {
  width: 0;
  height: 0;
  background: none;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid var(--warn);
}
.glyph-stress {
  background: var(--bad);
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-normal {
  color: var(--ok);
  background: var(--ok-bg);
}
.status-watch {
  color: var(--warn);
  background: var(--warn-bg);
}
.status-stress {
  color: var(--bad);
  background: var(--bad-bg);
}
/* An indicator that has gone quiet is not scored at all, so it gets a deliberately neutral
   treatment rather than borrowing any of the three status colours. */
.status-stale {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.card.is-stale .big,
.card.is-stale .card-chart {
  opacity: 0.55;
}

/* ---- indicator cards --------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
}
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}
.card:hover {
  border-color: var(--muted);
}
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.card-name {
  font-size: 15px;
  font-weight: 600;
}
.card-sum {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.card-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.big {
  font: 600 26px / 1.05 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.unit {
  color: var(--muted);
  font-size: 13px;
}
.card-note {
  font-size: 12.5px;
  color: var(--muted);
}
.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--faint);
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: auto;
}

/* ---- charts ------------------------------------------------------------ */
.chart {
  width: 100%;
  display: block;
}
.chart .band {
  fill: var(--recession);
}
.chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .area {
  fill: var(--accent);
  opacity: 0.12;
}
.chart .thr-stress {
  stroke: var(--bad);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.chart .thr-watch {
  stroke: var(--warn);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.chart .axis {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .tick {
  fill: var(--faint);
  font: 10px / 1 var(--font-mono);
}
.chart .now {
  fill: var(--accent);
  stroke: var(--halo);
  stroke-width: 1.5;
}
.chart .thr-label {
  font: 10px / 1 var(--font-mono);
}
.chart .thr-label.stress {
  fill: var(--bad);
}
.chart .thr-label.watch {
  fill: var(--warn);
}

/* ---- detail page ------------------------------------------------------- */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.crumb:hover {
  color: var(--ink);
}
.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}
.detail-head h2 {
  font-size: 22px;
}
.detail-lede {
  margin: 6px 0 0;
  color: var(--muted);
}
.panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: var(--gap);
}
.readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  align-items: flex-end;
}
.readout .item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.readout .lab {
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}
.prose p {
  margin: 0 0 10px;
}
.prose p:last-child {
  margin-bottom: 0;
}
.prose ul {
  margin: 0;
  padding-left: 18px;
}
.prose li {
  margin-bottom: 6px;
}
.meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}
.meta-list dt {
  color: var(--muted);
}
.meta-list dd {
  margin: 0;
}
.rule-basis {
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.other-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--gap);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
}
.pill:hover {
  border-color: var(--muted);
}

/* ---- table ------------------------------------------------------------- */
.table-wrap {
  margin-top: var(--gap);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
table.readings {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.readings caption {
  text-align: left;
  padding: 14px 16px 0;
  font-weight: 600;
}
table.readings th,
table.readings td {
  padding: 9px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.readings thead th {
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
table.readings tbody tr:last-child td {
  border-bottom: 0;
}
table.readings td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
table.readings .rowname {
  white-space: normal;
}

/* ---- glossary trigger + popover ---------------------------------------- */
.hint-trigger {
  border-bottom: 1px dotted var(--muted);
  cursor: help;
}
.hintpop {
  position: fixed;
  margin: 0;
  max-width: 300px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
}
.hintpop .formula {
  font-family: var(--font-mono);
  color: var(--accent);
  display: block;
  margin-bottom: 5px;
}

/* ---- affiliate slot ---------------------------------------------------- */
.ad-slot {
  margin-top: var(--gap);
  padding: 14px 16px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.ad-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.ad-cta {
  display: inline-block;
  margin-top: 4px;
  font-weight: 600;
  color: var(--accent);
}
.ad-risk {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* The disclaimer footer is shared: shared/styles/footer.css. */
