/* OAIT Design System 2.1.0 · reference/css/link.css
   Text links (unit c-actions).

   Components
   - Inline link (.oa-link): a link inside running text.
   - Standalone link (.oa-link--standalone): a link on its own line, after a short prompt, or in a
     list.
   - Title link (.oa-title-link): the name of a card, row, or table entry; --stretched makes the
     whole card clickable through its ::after.
   The skip link is base.css's .oa-skip-link; navigation links belong to their navigation components.

   Implements canonical §10.3, §10.10 (the stretched title link), §2.7 (links take no state layer;
   hover thickens the underline), §2.8 and §6.3 (the ring, 8px corners on text links), §13
   (links in sentences are underlined; inline links have no minimum height), and D-CAI-08,
   D-CSN-04, D-ARC-16, D-SEM-11, D-LAY-12, D-BCP-21, C-1.

   Tokens read: --color-primary-ink (the default link color), --color-focus-ring;
   --font-weight-semibold; --space-2; --size-touch-target; --size-focus-ring, --size-focus-offset;
   --radius-8px, --radius-full, --radius-card.
   Context property read: --oa-link, the link color that containers re-point (the inverse panel:
   --color-inverse-primary; banners and page strips: currentColor). Its default is
   --color-primary-ink.

   Classes: .oa-link (+ --standalone; __label, __icon), .oa-title-link (+ --stretched). Both also
   style a <button> (section 4): a low-emphasis action that opens something on the same page and sits
   among links ("Report" beside "Never pay to apply"), and a card whose title opens a dialog ("Get
   help"). The element stays a button; only its look is the link's (canonical §10.0). */


/* ---------------------------------------------------------------------------------------------
   1. Inline link: primary-ink (or the container's --oa-link), weight 600, always underlined
   (thickness auto, offset 4px), 2px on hover. No visited color, no minimum height (the WCAG
   2.5.8 inline exception keeps line spacing even), no state layer. The ring follows an 8px corner
   (D-CAI-08, D-COL-05, D-SEM-11).
   --------------------------------------------------------------------------------------------- */

.oa-link {
  border-radius: var(--radius-8px);
  color: var(--oa-link, var(--color-primary-ink)); /* lint-ok: --oa-link is the shared link context property that the inverse panel, banners, and page strips set */
  font-weight: var(--font-weight-semibold);
  text-decoration-line: underline;
  text-decoration-thickness: auto;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .oa-link:hover {
    text-decoration-thickness: 2px;
  }
}

/* A <button> drawn as a link (section 4) drops the browser's button box first; the standalone
   modifier below then gives back its own padding. */
:where(button).oa-link,
:where(button).oa-title-link {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-align: start;
  cursor: pointer;
}

:where(button).oa-link {
  font-weight: var(--font-weight-semibold);
}


/* ---------------------------------------------------------------------------------------------
   2. Standalone link: at least 48px tall, a pill-shaped ring, the size of its context (canonical
   §10.3). It carries a trailing arrow (arrow_forward inside the product, north_east when it leaves
   it) or a leading contact icon (call, mail), never both. The underline sits on __label, so it
   never runs under the icon glyph. The icon follows the text size through base.css's size
   classes: .oa-icon--md (20px) beside 16px text, .oa-icon--sm (18px) beside 14px text (D-CAI-08,
   D-ARC-22). 8px of inline padding keeps the pill ring clear of the first and last glyphs and of
   the underline; an equal negative margin keeps the label on the column's edge.
   --------------------------------------------------------------------------------------------- */

.oa-link--standalone {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: var(--size-touch-target);
  padding-inline: var(--space-2);
  margin-inline: calc(var(--space-2) * -1);
  border-radius: var(--radius-full);
  text-decoration-line: none;
  vertical-align: middle;
}

.oa-link__label {
  text-decoration-line: underline;
  text-decoration-thickness: auto;
  text-underline-offset: 4px;
}

@media (hover: hover) {
  .oa-link--standalone:hover .oa-link__label {
    text-decoration-thickness: 2px;
  }
}

.oa-link__icon {
  flex-shrink: 0;
}


/* ---------------------------------------------------------------------------------------------
   3. Title link: the heading's own color and weight, no underline until hover. --stretched spreads
   its ::after over the card (the card is position: relative), so the whole card is one link;
   other controls on the card sit above it (position: relative; z-index: var(--z-raised)). The ring
   moves to that ::after and takes the card's corner; the card itself never moves (D-CSN-04,
   D-ARC-16).
   --------------------------------------------------------------------------------------------- */

.oa-title-link {
  border-radius: var(--radius-8px);
  color: inherit;
  text-decoration-line: none;
  text-underline-offset: 4px;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .oa-title-link:hover {
    text-decoration-line: underline;
  }
}

/* inline-block: the link's own box keeps the heading's full line height (its target is the card). */
.oa-title-link--stretched {
  display: inline-block;
}

.oa-title-link--stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
}

/* The ring is drawn once, on the card-sized ::after; the link's own outline turns transparent
   (forced colors still draw it). */
.oa-title-link--stretched:focus-visible,
.oa-title-link--stretched[data-demo-focus] {
  outline-color: transparent;
}

.oa-title-link--stretched:focus-visible::after,
.oa-title-link--stretched[data-demo-focus]::after {
  outline: var(--size-focus-ring) solid var(--color-focus-ring);
  outline-offset: var(--size-focus-offset);
}


/* ---------------------------------------------------------------------------------------------
   4. Buttons drawn as links. .oa-link, .oa-link--standalone, .oa-title-link, and
   .oa-title-link--stretched work on <button type="button"> as on <a href>: the rule in section 1
   removes the button's own margin, padding, border, and fill, and keeps the link's color, weight,
   underline, ring, and target. Use it only for an action that stays on the page (it opens a dialog,
   a sheet, or a disclosure) and sits where links sit; anything that goes to another page is an
   <a href> (canonical §10.0, D-CAI-01). A standalone button keeps the 48px target of section 2; a
   stretched title button spreads its ::after over the card like the link. Buttons do not wrap
   inside a sentence, so a button in running text is never an inline link: write the action as its
   own standalone line. */

