summaryrefslogtreecommitdiffstats
path: root/src/objects/_card.scss
blob: f56a96c5d260b8cb351079275afa2f94efe1b07f (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('card') {
    @include iro.props-store((
        --dims: (
            --border:   fn.global-dim(--border --thin),
            --divider:  fn.global-dim(--border --thin),
            --pad-i:    fn.global-dim(--size --300),
            --pad-b:    fn.global-dim(--size --250),
            --spacing:  fn.global-dim(--size --200),
            --rounding: fn.global-dim(--rounding),

            --key-focus: (
                --border:        fn.global-dim(--key-focus --border),
                --border-offset: fn.global-dim(--key-focus --border-offset),
                --outline:       fn.global-dim(--key-focus --outline),
            ),
        ),
        --colors: (
            --bg:       fn.global-color(--bg-l2),
            --border:   fn.global-color(--border-mute),
            --divider:  fn.global-color(--border-mute),

            --hover: (
                --border: fn.global-color(--border),
            ),

            --key-focus: (
                --label:   fn.global-color(--focus --text),
                --border:  fn.global-color(--focus --border),
                --outline: fn.global-color(--focus --outline),
            ),

            --quiet: (
                --image: fn.global-color(--bg-base),

                --hover: (
                    --image: fn.global-color(--border),
                ),
            )
        ),
    ));

    @include iro.bem-object(iro.props-namespace()) {
        display:          block;
        border:           fn.dim(--border) solid fn.color(--border);
        border-radius:    fn.dim(--rounding);
        background-color: fn.color(--bg);

        @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') {
            &:hover,
            &:focus-visible,
            &:active {
                border-color: fn.color(--hover --border);
            }

            &:focus-visible {
                border-color: fn.color(--key-focus --border);
                outline:      fn.color(--key-focus --border) solid calc(fn.dim(--key-focus --border) - fn.dim(--border));
                box-shadow:   0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline);
            }
        }

        @include iro.bem-elem('avatar') {
            margin-block-start:  fn.dim(--pad-b);
            margin-inline-start: fn.dim(--pad-i);
        }

        @include iro.bem-elem('image') {
            display:          block;
            inline-size:      100%;
            object-fit:       cover;

            &:first-child {
                border-start-start-radius: calc(fn.dim(--rounding) - fn.dim(--border));
                border-start-end-radius:   calc(fn.dim(--rounding) - fn.dim(--border));
            }

            &:last-child {
                border-end-start-radius: calc(fn.dim(--rounding) - fn.dim(--border));
                border-end-end-radius:   calc(fn.dim(--rounding) - fn.dim(--border));
            }

            @include iro.bem-next-elem('avatar') {
                margin-block-start: calc(-.7 * fn.foreign-dim(--avatar, --xl --size));
            }
        }

        @include iro.bem-elem('body') {
            padding-block:  fn.dim(--pad-b);
            padding-inline: fn.dim(--pad-i);

            &::before {
                content:       '';
                display:       block;
                margin-block:  -100em 100em;
            }
        }

        @include iro.bem-elem('content') {
            margin-block-start: fn.dim(--spacing);
        }

        @include iro.bem-elem('footer') {
            padding-block:      0 fn.dim(--pad-b);
            padding-inline:     fn.dim(--pad-i);
            margin-block-start: calc(-1 * fn.dim(--pad-b));

            &::before {
                content:          '';
                display:          block;
                block-size:       fn.dim(--divider);
                margin-block:     fn.dim(--spacing);
                background-color: fn.color(--divider);
            }
        }

        @include iro.bem-modifier('quiet') {
            position:         relative;
            border:           0;
            background-color: transparent;

            @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') {
                &:hover,
                &:active {
                    @include iro.bem-elem('image') {
                        opacity:          .75;
                        background-color: fn.color(--quiet --hover --image);
                    }
                }

                &:focus-visible {
                    outline:    none;
                    box-shadow: none;

                    @include iro.bem-elem('image') {
                        outline:          fn.color(--key-focus --border) solid fn.dim(--key-focus --border);
                        opacity:          1;
                        background-color: fn.color(--quiet --hover --image);
                        box-shadow:       0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline);
                    }
                }
            }

            @include iro.bem-elem('image') {
                position:         relative;
                margin:           calc(-1 * fn.dim(--key-focus --border));
                border:           fn.dim(--key-focus --border-offset) solid transparent;
                border-radius:    calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset));
                background-color: fn.color(--quiet --image);
                background-clip:  padding-box;
            }

            @include iro.bem-elem('body') {
                padding:             0;
                padding-block-start: fn.dim(--spacing);
            }

            @include iro.bem-elem('footer') {
                padding-inline: 0;
            }
        }
    }
}