/* Icon classes, drawn from the Icon block's library (core icons plus the theme's Swiss icons).
   ic-btn-<icon>    on a Button block: the icon follows the button text.
   ic-inline-<icon> on any element: the icon follows its text.
   ic-list-<icon>   on a List block: the icon replaces each item's bullet.
   <icon> is the icon's name, e.g. arrow-right, chevron-right, download, external, swiss-cross.
   inc/icons.php sets --swiss-icon (the SVG's URL) for every class; the icon takes the text colour.
   :where() keeps these rules easy for button styles (e.g. Text) to override. */

:where([class*="ic-btn-"]) .wp-block-button__link {
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: bottom !important;
  gap: 0.4rem;
}

:where([class*="ic-btn-"]) .wp-block-button__link::after,
:where([class*="ic-inline-"])::after {
  content: "";
  flex: none;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask: var(--swiss-icon) center / contain no-repeat;
  mask: var(--swiss-icon) center / contain no-repeat;
}

/* A 24px icon is taller than the button text; negative margins keep it from changing the button's height. */
:where([class*="ic-btn-"]) .wp-block-button__link::after {
  margin-block: calc(0.5em - 12px);
}

:where([class*="ic-inline-"]) {
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: bottom !important;
}

:where([class*="ic-inline-"])::after {
  width: 1.25em;
  height: 1.25em;
}

/* Icon lists: the icon sits before each item's text, in the item's text colour. */
:where([class*="ic-list-"]) {
  list-style: none;
  padding-left: 0;
}

:where([class*="ic-list-"]) > li {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}

:where([class*="ic-list-"]) > li::before {
  content: "";
  flex: none;
  width: 1.25em;
  height: 1.25em;
  margin-top: calc((1lh - 1.25em) / 2);
  background-color: currentColor;
  -webkit-mask: var(--swiss-icon) center / contain no-repeat;
  mask: var(--swiss-icon) center / contain no-repeat;
}
