summaryrefslogtreecommitdiffstats
path: root/src/scopes/_links.scss
blob: 2e68952b6b66a9fbfe29da8708ad301650628e3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('links') {
    @include iro.props-store((
        --colors: (
            --underline:         fn.global-color(--fg-hi2),

            --idle:              fn.global-color(--accent --link-idle --quiet --fg),
            --visited:           fn.global-color(--accent --link-visited --quiet --fg),
            --idle-underline:    fn.global-color(--accent --link-idle --quiet --fg-hi),
            --visited-underline: fn.global-color(--accent --link-visited --quiet --fg-hi),

            --key-focus: (
                --border: fn.global-color(--focus --fill),
                --shadow: 0 0 0 calc(fn.global-dim(--focus --outline-width) + 2px) fn.global-color(--accent --primary --quiet --obj-lo),
            ),
        )
    ), 'colors');

    @include iro.props-store((
        --colors: (
            --underline: fn.global-color(--fg-hi),
        )
    ), 'colors-dark');

    @include iro.bem-scope(iro.props-namespace()) {
        :link,
        :visited {
            border-radius:         .5px;
            color:                 currentColor;
            text-decoration:       underline;
            text-decoration-color: fn.color(--underline);

            &:hover {
                text-decoration: underline;
            }

            @include iro.bem-at-theme('keyboard') {
                &:focus {
                    box-shadow: 0 0 0 2px fn.color(--key-focus --border), fn.color(--key-focus --shadow);
                }
            }
        }

        @include iro.bem-modifier('invisible') {
            :link,
            :visited {
                text-decoration: none;
            }
        }

        @include iro.bem-modifier('colored') {
            :link {
                color:                 fn.color(--idle);
                text-decoration-color: fn.color(--idle-underline);
            }
    
            :visited {
                color:                 fn.color(--visited);
                text-decoration-color: fn.color(--visited-underline);
            }
        }
    }
}