@layer infine.components {
/* A dashboard's sections: each opens with a bar and the question it answers set tight under it, the two read as one head,
   so that a page several screens long reads as half a dozen parts rather than one run of cards.
   The bar is thick and dark because a light 1px rule is what every card's border already is, and read as one more of them.
   The heading is a step above the cards' own titles in size, weight and room, not in colour,
   as the cards' titles are the same blue. */
.co2-section {
  margin-top: 40px;
  padding-top: 10px;
  border-top: 4px solid var(--infine-blue);
}
.co2-section:first-child {
  margin-top: 0;
}

.co2-section__head {
  margin-bottom: 20px;
}

.co2-section__title {
  margin: 0;
  font-family: var(--mantine-font-family-headings);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--infine-blue);
  text-wrap: balance;
}

/* Under the question rather than beside it: beside a heading this size it read as part of it */
.co2-section__sub {
  margin: 6px 0 0;
  font-size: var(--mantine-font-size-sm);
  color: var(--infine-gray-active);
}

.co2-section__after-head {
  margin-top: 8px;
}

/* A part of a section standing outside any card: between the section's 28px and the cards' 15px titles in size,
   as the cards' titles are bold already and a step in weight alone could not set it apart from them */
.co2-subsection__title {
  margin: 0;
  font-family: var(--mantine-font-family-headings);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--infine-blue);
  text-wrap: balance;
}

/* A store-prepared product's components on its page: carbon intensity on the left and emissions per unit on the right,
   in two equal halves as the product's own two figures above are, in one grid so that each component's row runs across both. */
.co2-components.connect-roster-stats__tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  /* No gaps, so that each row's hairline runs unbroken across both halves; the cells pad themselves apart instead.
     The tile's own gap would also open between every row. */
  gap: 0;
  padding: 16px 20px;
  color: var(--infine-blue);
}
.co2-components__head {
  padding-bottom: 10px;
  font-family: var(--mantine-font-family-headings);
  font-size: 18px;
  font-weight: 600;
}
.co2-components__right {
  align-self: stretch;
  padding-left: 20px;
  border-left: 1px solid var(--infine-blue-light-fade);
}
.co2-components__head.co2-components__right,
.co2-components__bars {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: 16px;
  align-items: center;
}
/* The names have a column and a heading of their own, and "Carbon intensity" heads only the figure and the level,
   a column wide enough for that heading so that no name runs under it. */
.co2-components__left {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  align-items: center;
  padding-right: 8px;
}
.co2-components__intensity-head {
  white-space: nowrap;
}
.co2-components__left:not(.co2-components__head),
.co2-components__bars {
  min-height: 36px;
  border-top: 1px solid var(--infine-blue-light-fade);
}
.co2-components__name {
  padding-right: 12px;
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* The figure and its level pill sit together at the right of the half, the figure just before its pill. */
.co2-components__intensity {
  padding-right: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.co2-components__figure {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.co2-components__bar-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.co2-components__bar {
  flex: none;
  height: 14px;
  min-width: 1px;
  border-radius: 0 3px 3px 0;
  background: var(--infine-blue);
}
.co2-components__bar--amount {
  background: var(--infine-blue-light);
}
/* A row's bars light up under the pointer, from either half of the row, as a chart's bar does (`parts/hover-colour`):
   the dark bar a quarter of the way to white, the light one a quarter of the way to black. */
.co2-components__bars:hover .co2-components__bar,
.co2-components__left:hover + .co2-components__bars .co2-components__bar {
  background: color-mix(in srgb, var(--infine-blue) 75%, white);
}
.co2-components__bars:hover .co2-components__bar--amount,
.co2-components__left:hover + .co2-components__bars .co2-components__bar--amount {
  background: color-mix(in srgb, var(--infine-blue-light) 75%, black);
}
/* A Mantine tooltip set as the charts' own are, so that every hover on the page looks the same:
   the tokens here are the ones the chart theme gives ECharts' tooltip (infine.echarts) */
.co2-chart-tooltip {
  padding: 10px;
  border: 1px solid var(--infine-blue);
  border-radius: 4px;
  background: var(--mantine-color-body);
  box-shadow: var(--mantine-shadow-sm);
  color: var(--infine-text);
  font-size: 14px;
  line-height: 1.5;
}

/* The period's kind and the period, as one pill of two halves rather than two filters side by side,
   so that "Quarter" reads as what "2026 Q3" is, and a line breaking in the bar never parts them.
   The halves share the border between them; the one set or hovered is drawn over the other,
   so that the shared border takes its colour. Buttons by type, as the open list sits between them. */
.co2-period-group {
  display: inline-flex;
}
.co2-period-group > button.connect-filter-dropdown {
  position: relative;
}
.co2-period-group > button.connect-filter-dropdown:first-of-type {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.co2-period-group > button.connect-filter-dropdown:last-of-type {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.co2-period-group > button.connect-filter-dropdown:hover,
.co2-period-group > button.connect-grid-status-chip--active {
  z-index: 1;
}
}
