@layer infine.components {
/* The supplier's CO₂ readouts: a title, a card and a note, each readout a subgrid of three rows of the grid it
   sits in, so that side by side their cards and notes start level however long a title wraps. */
.co2-readout {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  /* Not the implicit auto column, which grows no narrower than its content:
     a gauge's canvas keeps the width it was last drawn at, and would hold the readout as wide as that. */
  grid-template-columns: minmax(0, 1fr);
}

/* The assortment's intensity tiles, the average and the share of low-carbon products half and half,
   as the product pages set their carbon intensity and emissions cards.
   Laid out by the room the tiles have rather than the window's, which the module's own padding and the sudo bar already take from. */
.co2-tiles-holder {
  container-type: inline-size;
}
.co2-tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 16px;
}
/* Below this the average's figure runs into its rule: one tile a row. */
@container (max-width: 1000px) {
  .co2-tiles {
    grid-template-columns: minmax(0, 1fr);
  }
  .co2-tiles > .co2-readout {
    margin-bottom: var(--mantine-spacing-xl);
  }
}
}

@layer infine.components {
/* What a heading's figures are counted per, read as one phrase: Per, the measure's icon on a blue disc, then kg or unit,
   in small capitals apart from the words of the heading itself. */
.co2-measure-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  color: var(--infine-blue);
  font-family: var(--mantine-font-family);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.co2-measure-tag__disc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--infine-blue);
  color: var(--mantine-color-white);
}
}

@layer infine.components {
/* The CO₂ retailer cards' figure: Connect's At a glance figure, larger and at the weight of the cards' titles,
   so that the figure carries a card that reads a single number. Connect's own cards keep the light figure. */
.connect-roster-stats__usage-headline.co2-card-figure {
  font-size: 48px;
  font-weight: 600;
  line-height: 1.05;
}

/* A count and its share side by side, the share smaller with its unit under it, its last line on the count's baseline,
   so that the card is no taller than its neighbours of one figure. A hairline parts them, as side by side the two numbers
   otherwise read as one ("15 33,0" as 15,33).
   The space either side of the hairline narrows from lg to sm with the card.
   The count shrinks from 48px to leave the share its width (56px, set by "100 %") and the hairline's room in a narrower card,
   the share with it, and below 22px the share drops under it instead. --count-ems is the count's width in ems, which the markup sets.
   The space is the figures' margin and padding rather than the row's gap, as cqi in the gap would measure the card's ancestors. */
.co2-figure-pair {
  container-type: inline-size;
  /* lg in a card of 234px and more (a 1440px window), sm at 166px (1100px), where a four-digit count needs the room */
  --pair-space: clamp(var(--mantine-spacing-sm), calc(11.76cqi - 7.5px), var(--mantine-spacing-lg));
  --count-size: calc((100cqi - 2 * var(--pair-space) - 1px - 56px) / var(--count-ems, 2.5));
  display: flex;
  flex-wrap: wrap;
  align-items: last baseline;
  row-gap: 4px;
}
.co2-figure-pair .co2-card-figure {
  font-size: clamp(22px, var(--count-size), 48px);
  white-space: nowrap;
  margin-right: var(--pair-space);
}
.co2-figure-pair .co2-card-figure--secondary {
  font-size: clamp(16px, var(--count-size) * 0.6, 24px);
  margin-right: 0;
  padding-left: var(--pair-space);
  border-left: 1px solid var(--infine-blue-light-fade);
}

/* The % is part of the figure, so it is set in the figure's colour and weight, smaller, rather than as a unit. */
.co2-card-figure__percent {
  font-size: max(15px, 0.5em);
  letter-spacing: 0;
}

/* A unit of words goes on its own line under the figure; a bare % stays beside its number. */
.co2-card-figure__unit {
  display: block;
  margin-top: 4px;
  line-height: 1.3;
}

/* A value on the product page with where it came from on its line, in Connect's source line,
   which Connect sets on a line of its own under a field's input */
.co2-value-with-source .connect-source-line {
  display: inline-flex;
  margin: 0 0 0 8px;
}

/* How to read a chart or a row of figures, for a reader who is no expert: a pale box of its own,
   set apart from the charts' captions and notes, which say what a chart counts rather than how to read it. */
.co2-reading-guide {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--infine-blue-light-fade);
  color: var(--infine-text);
  font-size: 13px;
  line-height: 1.45;
}
.co2-reading-guide__icon {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--infine-blue-bg-dark);
}
.co2-reading-guide__lead {
  color: var(--infine-blue);
  font-weight: 700;
}
/* A guide of several notes, under a head row of its own rather than beside the icon */
.co2-reading-guide--box {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 0;
  /* As tall as its column, where the column is a flex one stretched to what it sits beside */
  flex-grow: 1;
}
.co2-reading-guide__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Inset as far as the notes under it pad theirs (10px), so that the 18px bulb is centred over their 16px markers
   and the lead starts where their text does */
.co2-reading-guide--box .co2-reading-guide__head {
  padding-left: 9px;
  gap: 9px;
  /* With the box's 10px above it, "How to read it" sits on the baseline of the title of the chart tile beside it,
     whose 1px border, 14px padding and 15px Raleway put that baseline about 30px down */
  margin-top: 6px;
  margin-bottom: 4px;
}
/* A guide under a row of tiles, with a note under each: the head on a line of its own,
   no padding at the sides, which the notes' row keeps for itself as the tiles' row does,
   and no margin above, which the gap of the column it shares with the row stands for */
.co2-reading-guide--row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 0;
  padding-left: 0;
  padding-right: 0;
}
.co2-reading-guide--row .co2-reading-guide__head {
  padding: 0 14px;
}
/* A faint hairline between the notes, in the middle of the gap the tiles above keep,
   so that each note reads as the column of its own tile. `__split` is a tile's notes side by side. */
.co2-reading-guide--row .connect-roster-stats__tile,
.co2-reading-guide__split > * {
  position: relative;
}
.co2-reading-guide__split {
  flex: 1;
}
/* A note after the hairline inside a tile starts a little past it, as only half the tiles' gap lies between them */
.co2-reading-guide__split > * + * {
  padding-left: var(--mantine-spacing-xs);
}
.co2-reading-guide--row .connect-roster-stats__tile + .connect-roster-stats__tile::before,
.co2-reading-guide__split > * + *::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--mantine-spacing-md) / -2);
  /* Thinned out, as at full strength the line reads as a border of the notes rather than a hint between them */
  border-left: 1px solid color-mix(in srgb, var(--infine-blue-light) 45%, transparent);
}
/* A tile's own hairline, transparent here, lies between its padding box, which `left` counts from, and the gap */
.co2-reading-guide--row .connect-roster-stats__tile + .connect-roster-stats__tile::before {
  left: calc(var(--mantine-spacing-md) / -2 - 1px);
}
}
