/* Trends band and chart cards (DESIGN.md §7 stat tile, chart card, skeletons).
   Every async region reserves its final size: skeleton heights are the same line-height calcs the loaded text uses,
   and charts have a fixed aspect ratio, so nothing shifts when data arrives. */

.trends {
  display: grid;
  gap: var(--space-grid);
}

.trends__through,
.trends__source {
  min-height: calc(var(--type-caption) * var(--lh-caption));
}

.trends__tiles {
  display: grid;
  gap: var(--space-md);
}

/* --- skeleton line sizes (match the text they stand in for) ------------- */
.skeleton--caption,
.skeleton--label,
.skeleton--stat,
.skeleton--body {
  display: block;
  border-radius: var(--radius-sm);
}

.skeleton--caption {
  height: calc(var(--type-caption) * var(--lh-caption));
}

.skeleton--label {
  width: 60%;
  height: calc(var(--type-body-sm) * var(--lh-body-sm));
}

.skeleton--stat {
  width: 45%;
  height: calc(var(--type-stat) * var(--lh-stat));
}

.skeleton--body {
  width: min(100%, 32rem);
  height: calc(var(--type-body-md) * var(--lh-body));
}

/* --- stat tile parts ---------------------------------------------------- */
.stat-tile {
  position: relative;
}

.stat-tile__label {
  min-height: calc(var(--type-body-sm) * var(--lh-body-sm));
  padding-right: var(--space-3xl);
}

.stat-tile__value {
  display: flex;
  align-items: flex-end;
  min-height: calc(var(--type-stat) * var(--lh-stat));
}

/* station names: a stat-size word wouldn't fit a 4-up tile (DESIGN_BACKLOG 2026-10-08) */
.stat-tile__value--text {
  font-size: var(--type-display-md);
  line-height: var(--lh-display-md);
  letter-spacing: var(--tracking-display-sm);
}

.stat-tile__delta {
  min-height: calc(var(--type-body-sm) * var(--lh-body-sm));
  font-size: var(--type-body-sm);
  line-height: var(--lh-body-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.stat-tile__def {
  font-size: var(--type-body-sm);
  line-height: var(--lh-body-sm);
  color: var(--color-body);
}

/* ⓘ: a 20 px icon with a 44 px hit area in the tile's top-right corner */
.stat-tile__info {
  position: absolute;
  top: calc(var(--space-xl) - 0.75rem);
  right: calc(var(--space-xl) - 0.75rem);
  display: grid;
  place-items: center;
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-body);
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.stat-tile__info:hover,
.stat-tile__info[aria-expanded="true"] {
  background: var(--color-pressed);
  color: var(--color-ink);
}

/* --- chart card --------------------------------------------------------- */
.chart-card .card__takeaway {
  min-height: calc(var(--type-body-md) * var(--lh-body));
}

.chart {
  position: relative;
  aspect-ratio: 5 / 2;
  margin-bottom: var(--space-md);
}

@container (max-width: 599px) {
  .chart {
    aspect-ratio: 4 / 3;
  }
}

.chart__skeleton {
  position: absolute;
  inset: 0;
}

.chart__svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.chart__grid {
  stroke: var(--gridline);
  stroke-width: 1px;
  shape-rendering: crispEdges;
}

.chart__tick {
  font-size: var(--type-caption);
  fill: var(--color-mute);
  font-variant-numeric: tabular-nums;
}

.chart__line {
  fill: none;
  stroke: var(--series-primary);
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* comparisons: BART solid, Bay Wheels dashed (DESIGN.md §2) */
.chart__line--primary {
  stroke: var(--series-primary);
}

.chart__line--secondary {
  stroke: var(--series-secondary);
  stroke-dasharray: 4 3;
  stroke-linecap: butt;
}

/* legend above the chart on wide cards, under it below 600 px (DESIGN.md §7 chart card) */
.chart-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.chart-legend {
  margin-bottom: var(--space-md);
}

.chart-key {
  width: 1.5rem;
  height: 0.5rem;
  overflow: visible;
}

@container (max-width: 599px) {
  .chart-legend {
    order: 1;
    margin-bottom: var(--space-md);
  }
  .chart-card__source {
    order: 2;
  }
}

/* --- forecast explorer (DESIGN.md §7 combobox, chart card; §2 forecasts) --- */
.forecast {
  display: grid;
  gap: var(--space-grid);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 768px) {
  .forecast {
    grid-template-columns: minmax(13.75rem, 18.75rem) minmax(0, 1fr);
  }
}

.forecast > .message {
  grid-column: 1 / -1;
}

.forecast__picker {
  display: grid;
  gap: var(--space-md);
}

.forecast__label {
  font-size: var(--type-body-sm);
  font-weight: 500;
  color: var(--color-body);
}

.combobox {
  position: relative;
}

.combobox__list {
  position: absolute;
  z-index: 10;
  top: calc(100% + var(--space-xs));
  left: 0;
  right: 0;
  max-height: calc(6 * 2.75rem + 2 * var(--space-xs)); /* 6 visible rows */
  margin: 0;
  padding: var(--space-xs);
  overflow-y: auto;
  list-style: none;
  border-radius: var(--radius-md);
  background: var(--color-canvas);
  box-shadow: var(--shadow-1);
}

.combobox__option,
.combobox__empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 2.75rem;
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--type-body-md);
}

.combobox__option {
  cursor: pointer;
}

.combobox__option:hover,
.combobox__option[aria-selected="true"] {
  background: var(--color-canvas-soft);
}

.combobox__code {
  font-size: var(--type-body-sm);
  color: var(--color-body);
  font-variant-numeric: tabular-nums;
}

.combobox__empty {
  color: var(--color-body);
}

/* the selected station chip uses the pressed grey, like a pressed subtle pill (no selected-chip token yet) */
.chip[aria-pressed="true"] {
  background: var(--color-pressed);
  box-shadow: inset 0 0 0 1px var(--color-ink);
}

.skeleton--title {
  display: block;
  width: min(100%, 12rem);
  height: calc(var(--type-display-md) * var(--lh-display-md));
  border-radius: var(--radius-sm);
}

.chart--forecast {
  aspect-ratio: 16 / 9;
}

@container (max-width: 599px) {
  .chart--forecast {
    aspect-ratio: 4 / 3;
  }
}

.chart__line--actual {
  stroke: var(--series-primary);
}

.chart__line--forecast {
  stroke: var(--series-primary);
  stroke-dasharray: 4 3;
  stroke-linecap: butt;
}

.chart__band {
  fill: var(--interval-fill);
  stroke: none;
}

/* --- findings ink band (IMPLEMENTATION_PLAN M4; DESIGN.md §7 ink band, chart card) ---
   Text on the ink band; the event-study charts sit in white cards, side by side from 768 px. */
.findings {
  display: grid;
  gap: var(--space-2xl);
}

.findings__verdict {
  display: grid;
  gap: var(--space-xs);
  min-height: calc(2 * var(--type-body-md) * var(--lh-body));
  font-size: var(--type-body-md);
  line-height: var(--lh-body);
}

.findings__figures,
.findings__charts {
  display: grid;
  gap: var(--space-grid);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .findings__figures,
  .findings__charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.findings__figure {
  display: grid;
  gap: var(--space-xs);
  align-content: start;
  min-width: 0;
}

.findings__figure-label,
.findings__figure-detail,
.findings__method,
.findings__caution,
.findings__note {
  color: var(--color-mute-on-ink);
}

/* the "new" verdict's hedge note: secondary text at the caption size */
.findings__note {
  font-size: var(--type-body-sm);
  line-height: var(--lh-body-sm);
}

.findings__figure-label,
.findings__figure-detail {
  min-height: calc(var(--type-body-sm) * var(--lh-body-sm));
  font-size: var(--type-body-sm);
  line-height: var(--lh-body-sm);
}

.findings__figure-value {
  font-size: var(--type-stat);
  line-height: var(--lh-stat);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.findings__figure .skeleton,
.findings__verdict .skeleton,
.findings-chart > .skeleton {
  background-color: var(--color-ink-elevated);
}

.findings-chart > .skeleton {
  margin-bottom: var(--space-md);
}

.findings-chart {
  color: var(--color-ink); /* a white card inside the ink band */
  min-width: 0;
}

.findings-chart__title {
  margin-bottom: var(--space-md);
  font-size: var(--type-body-md);
  line-height: var(--lh-body);
  font-weight: 500;
}

.findings-chart .chart {
  aspect-ratio: 4 / 3;
}

/* the same box as .chart__svg; its own class so page-wide chart counts elsewhere stay the Trends band's */
.findings-chart__svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.findings-chart__zero {
  stroke: var(--color-mute);
}

/* the opening: no event-marker token yet (DESIGN_BACKLOG 2026-10-10) */
.findings-chart__event {
  stroke: var(--color-mute);
  stroke-width: 1px;
  stroke-dasharray: 2 3;
}

.findings-chart__point {
  fill: var(--series-primary);
}

.findings .message {
  color: var(--color-ink); /* the light message box keeps ink text on the ink band */
}

.findings__method a {
  color: var(--color-on-ink);
}

/* --- dashboard card (F7): the Looker Studio embed, only when <meta name="tp-looker-url"> is set ---
   The embed on cards at least 768 px wide (space reserved with aspect-ratio), an "Open dashboard" pill below that. */
.dashboard {
  margin-top: var(--space-grid);
}

.dashboard__frame {
  aspect-ratio: 4 / 3;
  margin-bottom: var(--space-md);
}

.dashboard__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius-md);
}

.dashboard__open {
  justify-self: start;
  margin-bottom: var(--space-md);
}

@container (max-width: 767px) {
  .dashboard__frame {
    display: none;
  }
}

@container (min-width: 768px) {
  .dashboard__open {
    display: none;
  }
}
