/* 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;
}

/* hover-arrow (25 Nov 2026, from the user's old Aequitas dev site): on any block, its text links show an arrow
   after the text on hover and keyboard focus. Hidden at rest, it fades in and slides 4px to the right. The arrow
   is WordPress's core Arrow Right icon (--swiss-hover-arrow, inc/icons.php) in the link's colour. Links holding an
   icon or image (social icons) are left alone, and devices without hover don't get it. Max Mega Menu hides every
   ::after in its menus with two ID selectors, hence the !important on display. */
@media (hover: hover) {
  .hover-arrow a:not(:has(svg, img))::after {
    content: "";
    display: inline-block !important;
    width: 1.25em;
    height: 1.25em;
    margin-left: 0.1em;
    vertical-align: middle;
    background-color: currentColor;
    -webkit-mask: var(--swiss-hover-arrow) center / contain no-repeat;
    mask: var(--swiss-hover-arrow) center / contain no-repeat;
    opacity: 0;
    transition:
      margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .hover-arrow a:not(:has(svg, img)):is(:hover, :focus-visible)::after {
    margin-left: calc(0.1em + 4px);
    opacity: 1;
  }
}

@media (hover: hover) and (prefers-reduced-motion: reduce) {
  .hover-arrow a:not(:has(svg, img))::after {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* 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;
}
