/*
 * THE fixed-blue destination. The run inside is an ordinary `Text`, so the blue
 * is set as the DEFAULT INK for this subtree rather than as a colour on the run:
 * a run addresses ink only through the `--lotics-ink-*` roles, and "inside a
 * link, the default ink is the link ink" is what that sentence means in CSS. It
 * also means a caller's own `Text` inside the link inherits the destination
 * colour instead of turning black halfway through the phrase.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-link {
    /* Block-level: a destination is its own line or a flex item, never a run
       inside a sentence — that is `TextLink`. */
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    border: 0 solid var(--border);
    border-radius: 0;
    background-color: transparent;
    padding: 0;
    /* §5 rule 1. `children` is any node, and the UA's button font reaches
       whatever the inner `Text` does not wrap. */
    font-family: var(--font-sans);
    font-size: var(--lotics-text-sm);
    line-height: var(--lotics-leading-sm);
    letter-spacing: var(--lotics-tracking-sm);
    appearance: none;
    cursor: pointer;
    --lotics-ink-default: var(--lotics-accent);
    color: var(--lotics-ink-default);
    --lotics-icon-color: currentColor;
  }

  /* THE UNDERLINE IS DRAWN ON REACH, and it is drawn by the LINK rather than by
     the run inside it. A decoration propagates from an in-flow ancestor and a
     descendant cannot switch it off (CSS Text Decoration 3 §2.4), so this
     reaches the `Text` without the sheet naming another component's class —
     which is also the only way the two rules stay one component's business. */
  .lotics-link:hover,
  .lotics-link:focus-visible {
    text-decoration-line: underline;
  }

  .lotics-link:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }
}
