/* A size container has no intrinsic width, so inside a flex row (the
 * actions slots of Hero, Feature and Teaser) it would collapse to zero. */
.button-group {
  flex: 1 1 100%;
  container-type: inline-size;
}

.button-group__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
}

.button-group--align-center > .button-group__items { justify-content: center; }
.button-group--align-end > .button-group__items { justify-content: flex-end; }

.button-group--stack > .button-group__items {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.button-group--stack > .button-group__items > .button:is(.button--default, .button--highlight) {
  align-self: stretch;
}

/* As many columns of at least 18.5rem as fit: two beside a heading, four
 * across a full-width section (dal.ca's list buttons). */
.button-group--grid > .button-group__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
}

/* Stacked and grid buttons fill their cell, chevron pushed to the end.
 * Chevron and text links keep their chevron next to the label. */
:is(.button-group--stack, .button-group--grid) > .button-group__items > .button:is(.button--default, .button--highlight) {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

/* Tiles: equal-width quick links that wrap (dal.ca's home page "list
 * buttons"). They take the surface's own colours, centred, without chevrons. */
.button-group--tiles > .button-group__items > .button {
  display: flex;
  flex: 1 0 19.5rem;
  justify-content: center;
  min-height: 4rem;
  padding: var(--control-padding) var(--space-s);
  /* dal.ca's leaf shape: rounded top-left and bottom-right corners, seen
   * when the hover colour fills the tile. */
  border-radius: 2rem 0;
  line-height: 1.1;
  background-color: var(--surface-bg);
  color: var(--surface-fg);
  text-align: center;
}

.button-group--tiles > .button-group__items > .button .icon {
  display: none;
}

.button-group--tiles > .button-group__items > .button:hover,
.button-group--tiles > .button-group__items > .button:focus-visible {
  background-color: var(--control-hover-bg);
  color: var(--control-hover-fg);
  text-decoration: none;
}
