/*
 * Stand-alone text button (label/m, trailing arrow): normal text colour, no underline at rest, underline on hover and
 * keyboard focus (the focus ring stays). Without an arrow nothing else marks it as a link, so it keeps its underline.
 * Links inside running text are plain <a> (base.css) and stay underlined and coloured.
 */
@layer components {
  .link {
    display: inline;
    color: inherit;
    font-family: var(--font-family-base), system-ui, sans-serif;
    font-weight: var(--font-weight-semibold);
    font-size: var(--type-label-m-size);
    line-height: var(--type-label-m-line-height);
    text-decoration: none;
  }

  .link__label {
    text-decoration: underline transparent;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
  }

  .link:hover {
    color: inherit;
  }

  .link:hover .link__label,
  .link:focus-visible .link__label {
    text-decoration-color: currentcolor;
  }

  .link:not(:has(.icon)) .link__label {
    text-decoration-color: currentcolor;
  }

  .link:not(:has(.icon)):hover .link__label {
    text-decoration-thickness: 2px;
  }

  /* Trailing icon (every link with an arrow, see kuladu_trailing_icon()): the last word and the icon never break apart. */
  .nowrap-tail {
    white-space: nowrap;
  }

  .nowrap-tail > .icon {
    display: inline-block;
    margin-inline-start: 0.4em;
    vertical-align: -0.2em;
  }
}
