/**
 * @file
 * Property-map groups (js/propertyMap.js buildRowsElement):
 * the groups of a query result laid out in columns whose heading rows line
 * up. Bootstrap's flex row cannot align the second row of sibling columns;
 * a grid with a subgrid can: every group spans one heading row and one body
 * row of the container grid, so all headings on a line share one height and
 * the rows below start level, whether a heading wraps to one line or three.
 * Columns follow the width (one on phones); the spacing is Bootstrap's scale.
 *
 * A column is at least 17rem because a row's value is right-aligned against
 * its far edge: narrower than that and a label like "Energy demand per
 * school (kWh)" has too little left to break on and splits mid-word. Four such
 * columns fit a full-width tray, which is the width a facility readout was
 * designed at; a fifth wraps to the next line rather than squeezing them all.
 */
.biopama-property-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  column-gap: 2.5rem;
  row-gap: 1rem;
}

.biopama-property-group {
  display: grid;
  grid-template-rows: auto 1fr;
}

@supports (grid-template-rows: subgrid) {
  .biopama-property-group {
    grid-row: span 2;
    grid-template-rows: subgrid;
  }

  /* After the rule above, which it overrides at equal specificity: a banner
     has no heading to line up with its neighbours, so it takes one row of its
     own rather than the heading/body pair. */
  .biopama-property-group-banner {
    grid-row: auto;
    grid-template-rows: auto;
  }
}

/* The summary strip a group asks for with layout: "banner": the full width of
   the grid, above the columns, its rows side by side. It spans every repeated
   track, so no track can collapse while one is present — auto-fit behaves as
   auto-fill, which only shows with fewer groups than tracks. */
.biopama-property-group-banner {
  grid-column: 1 / -1;
  padding-block-end: 0.5rem;
}

/* Laid out by Bootstrap's d-flex flex-wrap; only the gaps are ours, because
   the column gap has to match the one between the columns below. */
.biopama-property-group-banner .biopama-property-group-body {
  column-gap: 2.5rem;
  row-gap: 0.25rem;
}
