/* Links in editorial text, outside navigation and commerce controls. */
body.site_s3 :is(
    :is(.detail .content-text, .ordered-block__text, .am-editorial, .am-pdp,
        .text_before_items, .text_after_items, .amh-opt, .amh-term, .amc-sec) :where(p, li, td, dd),
    .am-verify__text
) a[href]:not(:where(
        [role="button"], [data-event], [data-action], [data-fancybox], [data-toggle],
        [class*="btn"], [class*="button"], [class*="__buy"], [class*="cta"], [class*="__card"],
        [class*="print"], [style*="background" i], [style*="display" i],
        [href^="javascript:" i], [href="#"], .am-backref, .load-more, .in-cart,
        :is(nav, [role="navigation"], sup, .article-toc, .am-toc, .nav, .social-icons) *,
        :has(img, picture, svg, button, input)
    )) {
    text-decoration: none !important;
    background-image: linear-gradient(currentColor, currentColor);
    background-position: left bottom;
    background-repeat: no-repeat;
    background-size: 0 1px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    transition: background-size 180ms ease;

    &:is(:hover, :focus-visible) {
        background-size: 100% 1px;
    }

    &:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 3px;
    }

    @media (prefers-reduced-motion: reduce) {
        transition: none;
    }
}

/* Keep the product photo and stock label still. Emphasize the linked name. */
body.site_s3 :is(.am-editorial, .am-pdp) .am-fmt:has(> .am-fmt__media[href]) {
    & > .am-fmt__media:hover {
        border-color: transparent !important;
        box-shadow: none !important;
    }

    &:has(> .am-fmt__media:hover) > :is(h3, h4) a,
    & > :is(h3, h4) a:is(:hover, :focus-visible) {
        text-decoration: underline !important;
        text-decoration-thickness: 1px !important;
        text-underline-offset: .18em;
    }

    & :is(.am-fmt__media, h3 a, h4 a):focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 3px;
    }
}
