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
|
/* Styles the build emits as files, matching how the rest of the site is built:
external, gzipped, cached across pages.
BLOG_CSS becomes /blog.css and covers post pages only. The shell they share
with the home page — colours, nav, terminal, status bar — already lives in
/style.css, which post pages link first.
INDEX_CSS covers the post list inside the blog tab. It belongs to the home
page, so it is appended to /style.css rather than shipped separately. */
export const BLOG_CSS = `/* Generated by _writing/build.mjs — edit lib/theme.mjs instead. */
/* Body copy sits between --fg and --fg-dim: long-form reading wants more
contrast than a one-line description does. */
:root{--prose:#d5c4a1;}
/* Post pages mark the current tab with aria-current, since they are links to
other documents rather than tabs in a tablist. */
.tab[aria-current="page"]{color:var(--bg); background:var(--yellow); font-weight:500;}
.tab[aria-current="page"] .tab__key{color:var(--bg);}
.tab{display:flex; align-items:center; text-decoration:none;}
/* A long slug in the prompt pushes the input off a phone screen entirely, so
the path collapses to the directory below the desktop breakpoint. */
.term__prompt .loc--short{display:none;}
.main{position:relative;}
/* Reading progress. A 2px rule under the nav rather than a floating bar, so it
reads as part of the chrome instead of an ornament. */
.progress{
position:sticky; top:0; left:0; height:2px; width:100%; z-index:5;
background:var(--yellow); transform-origin:0 50%; transform:scaleX(0);
}
.post{padding:2.2rem 1.2rem 4rem; max-width:70ch; margin:0 auto;}
.crumb{
display:inline-block; color:var(--fg-faint); font-size:.75rem;
text-decoration:none; margin-bottom:1.8rem; border-bottom:0;
}
.crumb:hover,.crumb:focus-visible{color:var(--aqua); outline:none; border-bottom:0;}
.post__title{
font-size:1.55rem; line-height:1.25; font-weight:700; color:var(--fg);
margin:0 0 .5rem; letter-spacing:-.01em;
}
.post__meta{
color:var(--fg-faint); font-size:.75rem; margin:0 0 .3rem;
display:flex; flex-wrap:wrap; gap:.55rem; align-items:baseline;
}
.post__meta .sep{color:var(--bg3);}
.post__tags{display:flex; gap:.45rem; flex-wrap:wrap;}
.post__tag{color:var(--purple); font-size:.7rem;}
.post__rule{border:0; border-top:1px solid var(--bg3); margin:1.5rem 0 2rem;}
.post__draftbanner{color:var(--orange);}
/* Cover banner. The box is fixed at 5:2 and the image fills it, so a picture
of the wrong shape crops from the centre instead of reflowing the page. */
.post__cover{
display:block; width:100%; height:auto; aspect-ratio:5/2; object-fit:cover;
border:1px solid var(--bg3); background:var(--bg1); margin:0 0 1.6rem;
}
/* ---------- prose ---------- */
.prose{color:var(--prose,#d5c4a1); line-height:1.78;}
.prose > :first-child{margin-top:0;}
.prose p{margin:0 0 1.15rem; color:inherit;}
.prose strong{color:var(--fg); font-weight:700;}
.prose em{
color:var(--fg); font-style:normal; text-decoration:underline;
text-decoration-color:var(--bg3); text-underline-offset:.22em;
}
.prose del{color:var(--fg-faint);}
/* Headings keep their markdown sigil. It signals depth at a glance without
shouting, and it belongs in a page built to look like an editor. */
.prose h2,.prose h3,.prose h4{font-weight:700; line-height:1.3; scroll-margin-top:1rem;}
.prose h2{
color:var(--yellow); font-size:1.08rem; margin:2.6rem 0 .8rem;
text-transform:none; letter-spacing:normal;
}
.prose h3{color:var(--fg); font-size:.98rem; margin:2rem 0 .6rem;}
.prose h4{color:var(--fg-dim); font-size:.92rem; margin:1.6rem 0 .5rem;}
.prose h2::before,.prose h3::before,.prose h4::before{color:var(--fg-faint); font-weight:400;}
.prose h2::before{content:"## ";}
.prose h3::before{content:"### ";}
.prose h4::before{content:"#### ";}
.prose a{color:var(--blue); text-decoration:none; border-bottom:1px solid var(--bg3);}
.prose a:hover,.prose a:focus-visible{border-bottom-color:var(--blue); outline:none;}
.prose ul,.prose ol{margin:0 0 1.15rem; padding-left:1.4rem;}
.prose li{color:inherit; margin-bottom:.45rem;}
.prose li::marker{color:var(--fg-faint);}
.prose li > ul,.prose li > ol{margin:.45rem 0 0;}
.prose blockquote{
margin:1.4rem 0; padding:.1rem 0 .1rem 1.1rem;
border-left:2px solid var(--purple); color:var(--fg-dim);
}
.prose blockquote p:last-child{margin-bottom:0;}
.prose code{
background:var(--bg2); color:var(--aqua); font-size:.85em;
padding:.1em .4em; border-radius:2px;
}
.code{position:relative; margin:1.4rem 0; background:var(--bg1); border:1px solid var(--bg3);}
.code__lang{
position:absolute; top:0; right:0; padding:.15rem .55rem;
font-size:.65rem; letter-spacing:.09em; text-transform:uppercase;
color:var(--fg-faint); background:var(--bg2);
border-left:1px solid var(--bg3); border-bottom:1px solid var(--bg3);
}
.code pre{margin:0; padding:.9rem 1rem; overflow-x:auto;}
.code code{background:none; color:var(--fg); padding:0; font-size:.82rem; line-height:1.65;}
.prose figure{margin:1.6rem 0;}
.prose figure img,.prose figure video{max-width:100%; height:auto; display:block; border:1px solid var(--bg3);}
.prose figcaption{color:var(--fg-faint); font-size:.72rem; margin-top:.5rem;}
.prose img{max-width:100%; height:auto;}
.prose hr{border:0; border-top:1px dashed var(--bg3); margin:2.2rem 0;}
.tablewrap{overflow-x:auto; margin:1.4rem 0; border:1px solid var(--bg3);}
.prose table{border-collapse:collapse; width:100%; font-size:.85rem;}
.prose th,.prose td{padding:.45rem .8rem; border-bottom:1px solid var(--bg3);}
.prose th{background:var(--bg2); color:var(--yellow); font-weight:500; text-align:left;}
.prose tbody tr:last-child td{border-bottom:0;}
/* ---------- footer nav ---------- */
.postnav{
display:grid; grid-template-columns:1fr 1fr; gap:1px;
margin-top:3.5rem; background:var(--bg3); border:1px solid var(--bg3);
}
.postnav__link{
background:var(--bg); padding:.85rem 1rem; text-decoration:none; min-width:0;
display:flex; flex-direction:column; gap:.25rem; border-bottom:0;
}
.postnav__link:hover,.postnav__link:focus-visible{background:var(--bg1); outline:none; border-bottom:0;}
.postnav__dir{color:var(--fg-faint); font-size:.7rem;}
.postnav__title{color:var(--green); font-size:.85rem; overflow-wrap:anywhere;}
.postnav__link--next{text-align:right;}
.postnav__empty{background:var(--bg); padding:.85rem 1rem;}
@media (max-width:640px){
.post{padding:1.5rem .95rem 3rem;}
.post__title{font-size:1.3rem;}
.term__prompt .loc--full{display:none;}
.term__prompt .loc--short{display:inline;}
.tab:nth-child(3n+1){border-right:0;}
.postnav{grid-template-columns:1fr;}
.postnav__link--next{text-align:left;}
}
`;
/* Appended to style.css by the build, between markers. */
export const INDEX_CSS = `
/* ---------- blog index ---------- */
.blog__hint {
color: var(--fg-faint);
font-size: 0.75rem;
margin: 0 0 1.5rem;
}
.blog__hint code {
color: var(--aqua);
background: var(--bg1);
padding: 0.05em 0.35em;
}
.blog__empty {
color: var(--fg-faint);
}
.postlist__year {
color: var(--fg-faint);
font-size: 0.7rem;
letter-spacing: 0.12em;
margin: 1.9rem 0 0.5rem;
text-transform: none;
}
.postlist__year:first-child {
margin-top: 0;
}
.postrow {
display: grid;
grid-template-columns: 2rem 4.2rem 1fr auto;
gap: 0.9rem;
align-items: baseline;
padding: 0.62rem 0.5rem 0.62rem 0.6rem;
border-bottom: 1px solid var(--bg3);
border-left: 2px solid transparent;
text-decoration: none;
}
.postrow:hover,
.postrow:focus-visible {
background: var(--bg1);
border-left-color: var(--yellow);
outline: none;
}
.postrow__n {
color: var(--fg-faint);
font-size: 0.7rem;
}
.postrow__date {
color: var(--fg-faint);
font-size: 0.75rem;
}
.postrow__title {
color: var(--green);
min-width: 0;
}
.postrow:hover .postrow__title,
.postrow:focus-visible .postrow__title {
color: var(--aqua);
}
.postrow__time {
color: var(--fg-faint);
font-size: 0.72rem;
}
.post__draft {
color: var(--orange);
font-size: 0.62rem;
margin-left: 0.55rem;
border: 1px solid var(--orange);
padding: 0 0.3rem;
text-transform: uppercase;
letter-spacing: 0.06em;
}
@media (max-width: 640px) {
/* The index number carries no meaning without a keyboard, so it goes and the
read time drops under the title rather than squeezing a fourth column. */
.postrow {
grid-template-columns: 3.6rem 1fr;
gap: 0.2rem 0.8rem;
}
.postrow__n {
display: none;
}
.postrow__time {
grid-column: 2;
font-size: 0.68rem;
}
}
`;
|