@use "../mixins/hover.scss" as hover;
@use "../mixins/link.scss";
@use "../variables.scss";

a {
    color: variables.$link-color;
    text-decoration: variables.$link-decoration;
    background-color: transparent; // Remove the gray background on active links in IE 10.
    -webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.
    @include hover.hover-active {
        color: variables.$link-hover-color;
        text-decoration: variables.$link-hover-decoration;
    }
    .thy-icon,
    .wtf {
        display: inline-block;
    }
}

// And undo these styles for placeholder links/named anchors (without href)
// which have not been made explicitly keyboard-focusable (without tabindex).
// It would be more straightforward to just use a[href] in previous block, but that
// causes specificity issues in many other styles that are too complex to fix.
// See https://github.com/twbs/bootstrap/issues/19402
a:not([href]):not([tabindex]) {
    // color: inherit;
    text-decoration: none;
    @include hover.hover-focus {
        // color: inherit;
        text-decoration: none;
    }
    &:focus {
        outline: 0;
    }
}

// 带有图标的链接
a.link-has-icon {
    .thy-icon,
    .wtf {
        padding-right: variables.$link-icon-padding-x;
    }

    // 新的 SVG 图标字体16px偏大, 所以改成14px, 之前的字体不变
    .thy-icon {
        font-size: variables.$font-size-base;
        svg {
            // 字体变为 14px 后图标和文字不对齐，需要单独设置一下 vertical-align
            vertical-align: -0.12em;
        }
    }
}

a {
    &.link-primary {
        @include link.link-variant(variables.$primary, variables.$link-decoration, variables.$primary, variables.$link-hover-decoration);
    }
    &.link-info {
        @include link.link-variant(variables.$info, variables.$link-decoration, variables.$info, variables.$link-hover-decoration);
    }
    &.link-secondary {
        @include link.link-variant(variables.$gray-500, none, variables.$primary, none);
    }
    &.link-danger-weak {
        @include link.link-variant(variables.$gray-500, none, variables.$danger, none);
    }
    &.link-danger {
        @include link.link-variant(variables.$danger, variables.$link-decoration, variables.$danger, variables.$link-hover-decoration);
    }
    &.link-success {
        @include link.link-variant(variables.$success, variables.$link-decoration, variables.$success, variables.$link-hover-decoration);
    }
    &.link-major {
        @include link.link-variant(variables.$gray-800, none, variables.$primary, none);
    }
    &.link-muted {
        @include link.link-variant(variables.$gray-600, none, variables.$primary, none);
    }
    &.link-sm {
        @include link.link-size(variables.$font-size-sm, variables.$font-size-sm);
    }
    &.link-body {
        @include link.link-variant(variables.$gray-800, none, variables.$primary, none);
    }
    &.link-warning {
        @include link.link-variant(variables.$warning, variables.$link-decoration, variables.$warning, variables.$link-hover-decoration);
    }
    &.link-warning-weak {
        @include link.link-variant(variables.$gray-500, none, variables.$warning, none);
    }

    &.disabled {
        opacity: variables.$link-disabled-opacity;
        pointer-events: none;
        @include link.link-variant(null, none, null, none);
    }
}
