clairity.css 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,264 @@
1
+ /******************************************************************************\
2
+ CLASSES - Here is where we first deviate from the classless CSS directive. We'll
3
+ add alternate styles for many elements and groups of elements here,
4
+ but none of these will rise to the level of full-on components. Those
5
+ will be the next layer of the CSS hierarchy.
6
+
7
+ We'll generally aim for [0010] specificity here, as that's the default
8
+ specificity of a single class, which can be overridden in later styles
9
+ using just a single class. Exceptions will be marked with their
10
+ specificity, as usual.
11
+
12
+ Note that class names can start with a number in HTML5, but css
13
+ selectors can't. For a workaround (used with the .100vw class), see
14
+ https://benfrain.com/when-and-where-you-can-use-numbers-in-id-and-class-names/
15
+
16
+ \******************************************************************************/
17
+
18
+
19
+ /* -----------------------------------------------------------------------------
20
+ // #containers -
21
+ // -------------------------------------------------------------------------- */
22
+
23
+ /* this doesn't work because some items aren't full width, like asides
24
+ body > *:not(.fluid) {
25
+ margin-inline: var(--m);
26
+ }
27
+ */
28
+
29
+ /* for constraining width to a reasonable line length - keep in sync
30
+ with sectioning children of the body element in components.css */
31
+ .readable {
32
+ width: 100%;
33
+ max-width: var(--line-length); /* for horizontal centering */
34
+ margin-inline: auto; /* centers if width is set */
35
+ }
36
+
37
+ /* #100vw - take up the full width of the viewport */
38
+ ._100vw, [class~="100vw"] {
39
+ width: 100vw;
40
+ max-width: 100vw; /* still has horizontal scrollbar issues */
41
+ margin-inline: calc(50% - 50vw - var(--xs));/*neg. margin if needed*/
42
+ }
43
+
44
+ /* #100dvi - dynamic full width of the viewport */
45
+ ._100dvi, [class~="100dvi"] {
46
+ /*width: 100dvi;*/
47
+ max-width: 100dvi; /* still has horizontal scrollbar issues */
48
+ /*margin-inline: calc(50% - 50dvi - var(--xs));neg margin if needed*/
49
+ }
50
+
51
+
52
+ /* -----------------------------------------------------------------------------
53
+ // #grid helpters -
54
+ // -------------------------------------------------------------------------- */
55
+
56
+ /* .subgrid extends grid into descendents - firefox 71+ & safari 16+ only, no
57
+ chrome/edge yet - EXPERIMENTAL
58
+ ...........................................................................*/
59
+ .subgrid {
60
+ grid-column: padded; /* place subgrid on the parent grid */
61
+ display: inherit; /* inherits grid, otherwise no subgrid */
62
+ grid-template-columns: subgrid; /* only subgrid columns */
63
+ gap: inherit; /* inherit parent grid gap */
64
+ max-width: unset; /* let parent grid dictate width */
65
+ }
66
+
67
+ /* HACK: chrome & edge do not yet support subgrid as of 20221001 */
68
+ @supports not (grid-template-columns: subgrid) {
69
+ .subgrid { display: contents; }
70
+ .subgrid :first-child { /* TODO: this breaks some layouts, like banner images */
71
+ /*grid-column-start: 2;*/ /* TODO: fix right side guttering too */
72
+ }}
73
+
74
+ /* span the full width of the grid
75
+ .......................................................................... */
76
+ .full {
77
+ /*grid-column: full;*/
78
+ grid-column: 1 / -1;
79
+ max-width: none; /* remove other width restrictions */
80
+ }
81
+
82
+ /* span all but the 1st & last grid columns
83
+ .......................................................................... */
84
+ .padded {
85
+ grid-column: 2 / -2;
86
+ }
87
+
88
+
89
+ /* -----------------------------------------------------------------------------
90
+ // #headings -
91
+ // -------------------------------------------------------------------------- */
92
+
93
+ /* #h1 #h2 #h3 #h4 #h5 #h6 - allows changing visual heading hierarchy
94
+ independent of document outline. keep values in sync with those in base.css
95
+ .......................................................................... */
96
+ .h1 { --min-font: 1.75; --max-font: 2.5; }
97
+ .h2 { --min-font: 1.5; --max-font: 2; }
98
+ .h3 { --min-font: 1.375; --max-font: 1.667; }
99
+ .h4 { --min-font: 1.25; --max-font: 1.5; }
100
+ .h5 { --min-font: 1.125; --max-font: 1.25; }
101
+ .h6 { --min-font: 1; --max-font: 1.125; }
102
+ .h5, .h6 { font-weight: var(--bold); }
103
+
104
+ /* text providing extra detail to a heading. p-subtitle is a microformat
105
+ (plaintext) alternative class name for .subtitle
106
+ // .......................................................................... */
107
+ .subtitle, .p-subtitle {
108
+ color: var(--neutral);
109
+ font-size: 1rem;
110
+ font-variant: small-caps;
111
+ margin: 0;
112
+ }
113
+
114
+ /* remove decorations, typically from hgroup - [0010] / [0020] specificity
115
+ // .......................................................................... */
116
+ .plain, .plain:hover { /* [0020] specificity needed to overcome hgroup:hover */
117
+ border: none;
118
+ padding-left: unset;
119
+ }
120
+ /* HACK: normalize spacing between headings, typically within hgroups - [0010]*/
121
+ .plain :where(h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6) +
122
+ :where(h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6) {
123
+ margin-top: var(--medium); /* em relative spacing */
124
+ }
125
+
126
+
127
+ /* -----------------------------------------------------------------------------
128
+ // #colors - provide a set of utility color classes where the --color variable
129
+ // is employed - EXPERIMENTAL
130
+ // -------------------------------------------------------------------------- */
131
+
132
+ /* semantic colors for states */
133
+ .valid { --color: var(--valid); }
134
+ .invalid { --color: var(--invalid); }
135
+ .unknown { --color: var(--unknown); }
136
+
137
+ .red { --color: var(--error); }
138
+ .orange { --color: var(--error); }
139
+ .yellow { --color: var(--warning); }
140
+ .lime { --color: var(--error); }
141
+ .green { --color: var(--success); }
142
+ .aqua { --color: var(--error); }
143
+ .blue { --color: var(--info); }
144
+ .indigo { --color: var(--error); }
145
+ .purple { --color: var(--error); }
146
+ .violet { --color: var(--error); }
147
+ .magenta { --color: var(--error); }
148
+
149
+
150
+ /* -----------------------------------------------------------------------------
151
+ // #backgrounds -
152
+ // -------------------------------------------------------------------------- */
153
+
154
+ /* https://css-tricks.com/background-patterns-simplified-by-conic-gradients/ */
155
+ .checkerboard {
156
+ background: repeating-conic-gradient(var(--neutral) 0% 25%,
157
+ transparent 0% 50%) 50% / 20px 20px;
158
+ }
159
+
160
+ /* -----------------------------------------------------------------------------
161
+ // #spacing -
162
+ // -------------------------------------------------------------------------- */
163
+
164
+ /* for inserting an icon using the background-blend-mode technique */
165
+ .icon {
166
+ display: inline-block;
167
+ padding-right: var(--inline-padding);
168
+ background-size: var(--text-icon);
169
+ background-position: var(--center-right);
170
+ background-blend-mode: lighten, normal;
171
+ }
172
+
173
+ /* leading space for inline ::before elements, typically icons */
174
+ .leading {
175
+ padding-left: var(--inline-padding);
176
+ }
177
+
178
+ /* trailing space for inline ::after elements, typically icons */
179
+ .trailing {
180
+ padding-right: var(--inline-padding);
181
+ }
182
+
183
+ /* -----------------------------------------------------------------------------
184
+ // #layout -
185
+ // -------------------------------------------------------------------------- */
186
+
187
+ /* a grid with columns of width var(--column)
188
+ // .......................................................................... */
189
+ .grid {
190
+ display: grid;
191
+ grid-template-columns: [full-start] repeat(auto-fit,
192
+ minmax(var(--column), 1fr)) [full-end];
193
+ column-gap: var(--m);
194
+ container-type: none; /* containment clashes with grid on safari */
195
+ }
196
+
197
+ /* main content placement in the holy grail 3-column grid
198
+ // .......................................................................... */
199
+ /* firefox is not forgiving with :has() rules, so this must be separated out */
200
+ .dual-aside { grid-column: 2 / -2; }
201
+
202
+
203
+ /* a basic flex container
204
+ ............................................................................ */
205
+ .flex {
206
+ --flex-break: 100rem; /* TODO/TEMP - a bit of a magical number */
207
+ display: flex;
208
+ flex-wrap: wrap;
209
+ gap: var(--m);
210
+ }
211
+
212
+ /* flex all the children of .flex to single column below --flex-break */
213
+ :where(.flex) > * { /* [0000] specificity */
214
+ flex-grow: 1;
215
+ flex-basis: calc((var(--flex-break) - 100%) * 999);
216
+ }
217
+
218
+ .flex > :where(.column, .main) {
219
+ /*flex: 1 1 auto;*/
220
+ }
221
+
222
+
223
+ /* -----------------------------------------------------------------------------
224
+ // #breaks - #br #wbr #hr - line breaks and the horizontal rule
225
+ // -------------------------------------------------------------------------- */
226
+
227
+ /* #hr #section - the sectioning horizontal rule - [0011] specificity */
228
+ hr.section {
229
+ height: 3rem;
230
+ margin: auto;
231
+ width: unset;
232
+ max-width: unset;
233
+ background-color: var(--transparent);
234
+ border: var(--solid) var(--transparent);
235
+ box-shadow: var(--inset) var(--transparent),
236
+ var(--inset) var(--transparent);
237
+ /*inset 0 .5em 1.5em rgba(0, 0, 0, .1),
238
+ inset 0 .125em .5em rgba(0, 0, 0, .15);*/
239
+ }
240
+
241
+
242
+ /* -----------------------------------------------------------------------------
243
+ // #icons - convenience classes for icons defined in icons.css - EXPERIMENTAL
244
+ // -------------------------------------------------------------------------- */
245
+
246
+ .i-burger { --icon: var(--i-burger); }
247
+ .i-check { --icon: var(--i-check); }
248
+ .i-chevron { --icon: var(--i-chevron); }
249
+ .i-dash { --icon: var(--i-dash); }
250
+ .i-edit { --icon: var(--i-edit); }
251
+ .i-home-edit { --icon: var(--i-home-edit); }
252
+ .i-mail { --icon: var(--i-mail); }
253
+ .i-mail-check { --icon: var(--i-mail-check); }
254
+ .i-mail-x { --icon: var(--i-mail-x); }
255
+ .i-send { --icon: var(--i-send); }
256
+ .i-server-cog { --icon: var(--i-server-cog); }
257
+ .i-trash { --icon: var(--i-trash); }
258
+ .i-user-circle { --icon: var(--i-user-circle); }
259
+ .i-user-off { --icon: var(--i-user-off); }
260
+
261
+ /* #unadorned removes a ::before or ::after icon - [0011] specificity */
262
+ .unadorned::before, .unadorned::after {
263
+ content: unset;
264
+ }