-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructure.css
More file actions
486 lines (418 loc) · 16.1 KB
/
Copy pathstructure.css
File metadata and controls
486 lines (418 loc) · 16.1 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
/* ==========================================================================
brutalist-web-theme / exposure layer
--------------------------------------------------------------------------
The half of this register a token file cannot hold. Tokens can say how
thick a rule is. They cannot say that the grid is drawn instead of implied,
that a table is left looking like a table, that the page carries a ticker,
or that type is set at a size which stops being typography and starts being
architecture. Those are structural decisions, and they live here.
Every value here is a var() reference to tokens.css. There is not one color
literal in this file.
Requires tokens.css. Load it, then components.css, then this:
<link rel="stylesheet" href="tokens/tokens.css" />
<link rel="stylesheet" href="components/components.css" />
<link rel="stylesheet" href="components/structure.css" />
THE ANTI-POLISH RULES.
Stated as rules, because a register defined only by what it looks like gets
copied badly. Each of these is a refusal, and each refusal is a choice with
a cost that was accepted rather than an effort that was skipped. That
distinction is the whole difference between this register and an
unfinished stylesheet.
1. No radius. A rounded corner is a softening gesture aimed at the reader.
The cost is that nothing here looks friendly. The token is zero rather
than absent so the refusal is visible and editable.
2. No shadow, and no elevation model at all. Depth asks the reader to
believe in a room with a light source in it. This page is a surface with
lines on it. The cost is that hierarchy has to be carried by rule
weight, scale and inversion, which is harder and less forgiving.
3. No transition. Duration is zero, declared rather than omitted. An eased
hover is the interface performing responsiveness. The cost is that the
page feels abrupt, and abrupt is the intended reading.
4. No gradient, no tint, no translucency. Every fill is one flat value.
The cost is a palette with nowhere to hide a weak hierarchy.
5. Links keep the browser's colors and their underline. The cost is a blue
that clashes with everything, which is the point: the reader never has
to work out what is clickable.
6. Structure stays visible. Grids are drawn, tables keep their rules, and
seams between bands are lines rather than changes in whitespace.
WHAT IS NOT REFUSED, AND WHY.
Focus rings, 44px touch targets, measured contrast, real headings, and
markup that works without JavaScript all stay. The register is hostile to
the reader's expectations about polish. It is not hostile to readers who
navigate by keyboard, tap with a thumb, or need the contrast to read at
all. Dropping those does not make a page more brutalist; it makes it
broken, and broken is a different thing that merely looks similar in a
screenshot.
========================================================================== */
/* --------------------------------------------------------------------------
DOCUMENT SCOPE
Inside .bw-doc, an anchor carrying no class of its own gets the register's
link treatment. Anchors that carry a class are left alone, so components
keep their own behavior and this rule never has to be undone.
-------------------------------------------------------------------------- */
.bw-doc {
font-family: var(--bw-font-text);
font-size: var(--bw-text-body);
line-height: var(--bw-leading-text);
color: var(--bw-ink);
}
.bw-doc a:not([class]) {
color: var(--bw-link);
text-decoration: underline;
text-decoration-thickness: var(--bw-rule);
text-underline-offset: 2px;
}
.bw-doc a:not([class]):visited {
color: var(--bw-link-visited);
}
.bw-doc a:not([class]):hover {
background: var(--bw-link);
color: var(--bw-ground);
text-decoration-color: var(--bw-ground);
}
.bw-doc a:not([class]):visited:hover {
background: var(--bw-link-visited);
}
.bw-doc a:not([class]):focus-visible {
outline: var(--bw-focus-width) solid var(--bw-focus-color);
outline-offset: var(--bw-focus-offset);
}
/* --------------------------------------------------------------------------
OVERSIZED TYPE
The register's loudness is spent here rather than on color. Set flush, so
the lines of a multi-line heading touch and read as a stacked block instead
of as separate lines of text.
-------------------------------------------------------------------------- */
.bw-mega,
.bw-display,
.bw-h1 {
font-family: var(--bw-font-display);
font-weight: var(--bw-weight-bold);
letter-spacing: var(--bw-tracking-tight);
text-transform: uppercase;
margin: 0;
/* A single unbroken word at 120px is wider than a phone. Breaking it is
less bad than shipping a headline with its last characters offscreen. */
overflow-wrap: break-word;
}
.bw-mega {
font-size: var(--bw-text-mega);
line-height: var(--bw-leading-flush);
}
.bw-display {
font-size: var(--bw-text-display);
line-height: var(--bw-leading-flush);
}
.bw-h1 {
font-size: var(--bw-text-h1);
line-height: var(--bw-leading-tight);
}
.bw-h2 {
font-family: var(--bw-font-display);
font-size: var(--bw-text-h2);
font-weight: var(--bw-weight-bold);
line-height: var(--bw-leading-tight);
letter-spacing: var(--bw-tracking-tight);
text-transform: uppercase;
margin: 0;
overflow-wrap: break-word;
}
/* A label set in mono and tracked out. The register's small voice. */
.bw-label-line {
font-family: var(--bw-font-mono);
font-size: var(--bw-text-xs);
font-weight: var(--bw-weight-bold);
letter-spacing: var(--bw-tracking-wide);
text-transform: uppercase;
color: var(--bw-ink-muted);
margin: 0;
}
.bw-prose {
font-family: var(--bw-font-text);
font-size: var(--bw-text-body);
line-height: var(--bw-leading-text);
max-width: var(--bw-measure);
}
/* --------------------------------------------------------------------------
BANDS, SEAMS AND FRAMES
A band boundary is a rule. Not a change in background, not a gap: a line,
at the heaviest weight, so the page reads as a set of stacked plates.
-------------------------------------------------------------------------- */
.bw-band {
border-top: var(--bw-rule-heavy) solid var(--bw-rule-color);
}
.bw-band-shade {
background: var(--bw-shade);
}
/* The inverted band. Every rule inside it has to change color or it goes
invisible against the ink, so the rule color token is redefined in scope
rather than restated on each descendant. The muted and focus tokens are
swapped for the same reason: on black, muted ink is 2.37:1 and the link
blue used for focus is 2.23:1, and both fail. */
.bw-invert {
background: var(--bw-ink);
color: var(--bw-ground);
--bw-rule-color: var(--bw-ground);
--bw-ink-muted: var(--bw-ink-muted-inverse);
--bw-focus-color: var(--bw-ground);
}
/* Order matters in this block. The base treatments come first and the
variants override them, because every selector here is one class plus one
descendant class and they all tie on specificity: whichever is written
last wins. Put .bw-invert .bw-btn after .bw-invert .bw-btn-solid and the
solid button silently stops inverting. */
.bw-invert .bw-card,
.bw-invert .bw-badge,
.bw-invert .bw-btn {
background: var(--bw-ink);
color: var(--bw-ground);
}
.bw-invert .bw-btn:hover:not(:disabled) {
background: var(--bw-ground);
color: var(--bw-ink);
}
.bw-invert .bw-badge-solid,
.bw-invert .bw-btn-solid {
background: var(--bw-ground);
color: var(--bw-ink);
}
.bw-invert .bw-btn-solid:hover:not(:disabled) {
background: var(--bw-ink);
color: var(--bw-ground);
}
/* The alarm keeps its color on a black band. It is the one loud value in the
theme and the band is exactly where something being wrong still has to
read as wrong. Ground text on the alarm fill is 5.66:1 either way, so the
badge and button stay legible without changing the fill. */
.bw-invert .bw-badge-alarm,
.bw-invert .bw-btn-alarm {
background: var(--bw-alarm);
color: var(--bw-ground);
border-color: var(--bw-alarm);
}
.bw-invert .bw-btn-alarm:hover:not(:disabled) {
background: var(--bw-ground);
color: var(--bw-alarm);
border-color: var(--bw-ground);
}
/* The page frame. A hard border around the whole document, which is the
oldest move in this register: the page announces it is a page. */
.bw-frame {
border: var(--bw-rule-heavy) solid var(--bw-rule-color);
}
/* --------------------------------------------------------------------------
THE EXPOSED GRID
Most layouts imply a grid and hide it. This one draws it. The column lines
are painted as a repeating gradient across the container, so they show
through the empty tracks as well as the filled ones, which is the whole
difference between a drawn grid and a set of bordered boxes.
The stop positions are a twelfth of the container each, computed from the
same token the track list uses, so the painted lines and the real columns
cannot drift apart.
-------------------------------------------------------------------------- */
.bw-grid {
display: grid;
grid-template-columns: repeat(var(--bw-grid-columns), minmax(0, 1fr));
border: var(--bw-rule) solid var(--bw-rule-color);
}
.bw-grid-exposed {
background-image: repeating-linear-gradient(
to right,
var(--bw-rule-color) 0,
var(--bw-rule-color) var(--bw-rule-hair),
transparent var(--bw-rule-hair),
transparent calc(100% / var(--bw-grid-columns))
);
}
.bw-grid > * {
/* Cells carry their own padding rather than the grid carrying a gap. A gap
would put a gutter between the drawn lines and the content sitting in
them, and the alignment is the point of drawing the lines at all. */
padding: var(--bw-space-4);
min-width: 0;
/* Opaque, so the painted ruler stops where content starts. Without this
the twelve lines run behind the text and strike through it, which reads
as a rendering fault rather than as exposed structure. The ruler is
therefore visible exactly in the tracks nothing occupies, which is the
useful half of drawing it: the grid shows you where it has room left. */
background: var(--bw-ground);
}
/* The boundary between two occupied cells is drawn, since the ruler behind
them is covered. */
.bw-grid > * + * {
border-left: var(--bw-rule-hair) solid var(--bw-rule-color);
}
.bw-invert .bw-grid > * {
background: var(--bw-ink);
}
/* Spans. Twelve divides by two, three, four and six, which is the reason the
column count is twelve. */
.bw-span-2 { grid-column: span 2; }
.bw-span-3 { grid-column: span 3; }
.bw-span-4 { grid-column: span 4; }
.bw-span-6 { grid-column: span 6; }
.bw-span-8 { grid-column: span 8; }
.bw-span-12 { grid-column: span 12; }
/* Below the phone breakpoint a twelve-column grid is twelve columns of two
characters each. Every span collapses to full width and the drawn lines
retire with them, because a painted grid the content no longer follows is
the off-grid drift this layer exists to prevent. */
@media (max-width: 767px) {
.bw-grid {
grid-template-columns: 1fr;
}
.bw-grid-exposed {
background-image: none;
}
.bw-grid > * {
grid-column: auto;
}
.bw-grid > * + * {
border-top: var(--bw-rule-hair) solid var(--bw-rule-color);
}
}
/* --------------------------------------------------------------------------
RAW TABLE
A table left looking like a table. Every cell edge is drawn, the header is
inverted, and numbers are tabular so columns of figures line up on the
decimal. Most design systems spend real effort making a table stop looking
like one; this register treats the default as correct and invests in
density instead.
-------------------------------------------------------------------------- */
.bw-table-scroll {
/* A dense table on a phone is wider than the phone. It scrolls inside its
own box so the page never scrolls sideways. */
overflow-x: auto;
border: var(--bw-rule) solid var(--bw-rule-color);
}
.bw-table {
width: 100%;
/* Below this a five column table squeezes its prose column to about 200px,
every such cell wraps to four lines, and the rows grow to 190px of
mostly empty space. Scrolling the table sideways inside its own frame
costs the reader one gesture; squeezing it costs them the shape of the
data. Measured on the demo at 390px, where 640px was still too narrow to
stop it. */
min-width: 900px;
border-collapse: collapse;
font-family: var(--bw-font-mono);
font-size: var(--bw-text-sm);
/* Inherited rather than set to ink, so the same table works inside an
inverted band. Declaring the color here makes the body text black on
black in there, which is invisible and compiles perfectly. */
color: inherit;
}
.bw-table caption {
padding: var(--bw-space-3);
font-family: var(--bw-font-mono);
font-size: var(--bw-text-xs);
font-weight: var(--bw-weight-bold);
letter-spacing: var(--bw-tracking-wide);
text-transform: uppercase;
text-align: left;
border-bottom: var(--bw-rule) solid var(--bw-rule-color);
}
.bw-table th,
.bw-table td {
padding: var(--bw-space-2) var(--bw-space-3);
border: var(--bw-rule-hair) solid var(--bw-rule-color);
text-align: left;
vertical-align: top;
}
.bw-table thead th {
background: var(--bw-ink);
color: var(--bw-ground);
font-size: var(--bw-text-xs);
letter-spacing: var(--bw-tracking-wide);
text-transform: uppercase;
white-space: nowrap;
}
.bw-table tbody tr:nth-child(even) {
background: var(--bw-shade);
}
/* Row headers stay legible as headers without becoming a second inverted
band running down the left of the table. */
.bw-table tbody th {
font-weight: var(--bw-weight-bold);
white-space: nowrap;
}
.bw-num {
text-align: right;
font-variant-numeric: tabular-nums;
}
.bw-invert .bw-table thead th {
background: var(--bw-ground);
color: var(--bw-ink);
}
.bw-invert .bw-table tbody tr:nth-child(even) {
background: transparent;
}
/* --------------------------------------------------------------------------
MARQUEE
The one piece of motion the register owns. It is a ticker rather than an
animation: long duration, constant speed, no easing, no entrance.
The track is duplicated in the markup and the copy is aria-hidden, which is
what makes the loop continuous without the content being announced twice.
-------------------------------------------------------------------------- */
.bw-marquee {
display: flex;
overflow: hidden;
background: var(--bw-ink);
color: var(--bw-ground);
border-top: var(--bw-rule) solid var(--bw-ink);
border-bottom: var(--bw-rule) solid var(--bw-ink);
}
.bw-marquee-track {
display: flex;
flex: none;
align-items: center;
gap: var(--bw-space-8);
padding: var(--bw-space-2) 0;
padding-right: var(--bw-space-8);
min-width: 100%;
font-family: var(--bw-font-mono);
font-size: var(--bw-text-sm);
font-weight: var(--bw-weight-bold);
letter-spacing: var(--bw-tracking-wide);
text-transform: uppercase;
white-space: nowrap;
animation: bw-marquee var(--bw-marquee-duration) linear infinite;
}
@keyframes bw-marquee {
from {
transform: translateX(0);
}
to {
transform: translateX(-100%);
}
}
/* Reduced motion, handled honestly. The animation stops, and the content it
was carrying stays on the page: the strip becomes a scrollable row rather
than disappearing. Hiding the content along with the motion would be the
easy version and it would cost the reader the information. The duplicate
track goes, since its only job was to make the loop continuous. */
@media (prefers-reduced-motion: reduce) {
.bw-marquee {
overflow-x: auto;
}
.bw-marquee-track {
animation: none;
}
.bw-marquee-track[aria-hidden="true"] {
display: none;
}
}
/* --------------------------------------------------------------------------
CODE
Preformatted text keeps its own frame and scrolls inside it.
-------------------------------------------------------------------------- */
.bw-code {
overflow-x: auto;
margin: 0;
padding: var(--bw-space-4);
background: var(--bw-shade);
border: var(--bw-rule) solid var(--bw-rule-color);
font-family: var(--bw-font-mono);
font-size: var(--bw-text-sm);
line-height: var(--bw-leading-text);
}