cabotia / cabotia.dev/ assets/main.scssc127a41a5c98e8fc51bad450b54afda15e4ba6bb
4.9 KB | 334 lines Raw
1
@import 'fonts.scss';
2

3
$font-size-2: 19px;
4

5
$landing-size-value: 2.2;
6
$landing-line-height: 1.4em;
7

8
$font-family-body: 'Castoro', serif;
9

10
@mixin light-theme {
11
	--color-bg: #fff;
12
	--color-text: #111;
13
	--color-accent: #b91c1c;
14
	--color-accent-hover: #df2929;
15
	--color-muted: #60606f;
16
	--color-faint: #afafb9;
17
	--color-rule: #ddd;
18
	--color-code-bg: #f4f4f2;
19
}
20

21
@mixin dark-theme {
22
	--color-bg: #2d3929;
23
	--color-text: #f5f2e9;
24
	--color-accent: #e38a3d;
25
	--color-accent-hover: #e9a56a;
26
	--color-muted: #b0b4a7;
27
	--color-faint: #9b9f93;
28
	--color-rule: #1a1d19;
29
	--color-code-bg: #1a1d19;
30
}
31

32
:root {
33
	@include light-theme;
34
	color-scheme: light;
35
}
36

37
@media (prefers-color-scheme: dark) {
38
	:root {
39
		@include dark-theme;
40
		color-scheme: dark;
41
	}
42
}
43

44
html[data-theme="light"] {
45
	@include light-theme;
46
	color-scheme: light;
47
}
48

49
html[data-theme="dark"] {
50
	@include dark-theme;
51
	color-scheme: dark;
52
}
53

54
* {
55
	box-sizing: border-box;
56
}
57

58
html {
59
	font-family: $font-family-body;
60
	font-weight: 500;
61
	font-size: $font-size-2;
62
	line-height: 1.4;
63
	background: var(--color-bg);
64
}
65

66
body {
67
	max-width: 900px;
68
	margin: 0 auto;
69
	padding: 2rem 1rem;
70
	color: var(--color-text);
71
}
72

73
a {
74
	color: var(--color-accent);
75
	&:hover {
76
		color: var(--color-accent-hover);
77
	}
78
}
79

80
header {
81
	display: flex;
82
	flex-wrap: nowrap;
83
	flex: 1 0 67%;
84
	align-items: center;
85

86
	.logo {
87
		flex-grow: 0;
88
		flex-shrink: 0;
89

90
		img {
91
			width: auto;
92
			height: 100px;
93
			max-width: 100%;
94
		}
95
	}
96

97
	nav {
98
		text-align: right;
99
		margin-left: auto;
100
		padding-left: 2.5vw;
101

102
		flex-grow: 1;
103
		flex-shrink: 1;
104

105
		a {
106
			font-family: sans-serif;
107
			font-weight: 700;
108

109
			&:not(:first-child) {
110
				margin-left: 2.5vw;
111
			}
112
		}
113
	}
114
}
115

116
.theme-toggle {
117
	display: inline-flex;
118
	align-items: center;
119
	justify-content: center;
120
	margin-left: 2.5vw;
121
	padding: 0.25rem;
122
	border: 0;
123
	border-radius: 4px;
124
	background: none;
125
	color: var(--color-accent);
126
	cursor: pointer;
127

128
	svg {
129
		display: block;
130
		width: 1.15em;
131
		height: 1.15em;
132
		fill: none;
133
		stroke: currentColor;
134
		stroke-width: 2;
135
		stroke-linecap: round;
136
		stroke-linejoin: round;
137
	}
138

139
	.icon-sun {
140
		display: none;
141
	}
142

143
	&:hover {
144
		color: var(--color-accent-hover);
145
	}
146

147
	&:focus-visible {
148
		outline: 2px solid var(--color-accent);
149
		outline-offset: 2px;
150
	}
151
}
152

153
html[data-theme="dark"] .theme-toggle .icon-sun {
154
	display: block;
155
}
156

157
html[data-theme="dark"] .theme-toggle .icon-moon {
158
	display: none;
159
}
160

161
@media (prefers-color-scheme: dark) {
162
	html:not([data-theme="light"]) .theme-toggle .icon-sun {
163
		display: block;
164
	}
165

166
	html:not([data-theme="light"]) .theme-toggle .icon-moon {
167
		display: none;
168
	}
169
}
170

171
//html[data-theme="dark"] .logo-type {
172
//	filter: brightness(1.5);
173
//}
174
//
175
//@media (prefers-color-scheme: dark) {
176
//	html:not([data-theme="light"]) .logo-type {
177
//		filter: brightness(1.5);
178
//	}
179
//}
180

181
html[data-theme="dark"] main .highlight pre {
182
	background: var(--color-code-bg) !important;
183
}
184

185
@media (prefers-color-scheme: dark) {
186
	html:not([data-theme="light"]) main .highlight pre {
187
		background: var(--color-code-bg) !important;
188
	}
189
}
190

191
.fine-line {
192
	color: var(--color-faint);
193
}
194

195
footer {
196
	text-align: center;
197
	margin-top: 2rem;
198
	color: var(--color-muted);
199

200
	display: flex;
201
	flex-direction: column;
202
	justify-content: center;
203

204
	.links {
205
		display: flex;
206
		justify-content: center;
207
	}
208

209
	a {
210
		color: var(--color-muted);
211
	}
212
}
213

214
main {
215
	h1,
216
	h2,
217
	h3,
218
	h4 {
219
		line-height: 1.2;
220
	}
221

222
	h1 {
223
		font-size: 2.1rem;
224
	}
225

226
	h2 {
227
		margin-top: 2.5rem;
228
		font-size: 1.4rem;
229
	}
230

231
	h3 {
232
		margin-top: 2rem;
233
		font-size: 1.15rem;
234
	}
235

236
	p,
237
	ul,
238
	ol,
239
	blockquote {
240
		margin: 1rem 0;
241
	}
242

243
	ul,
244
	ol {
245
		padding-left: 1.5rem;
246
	}
247

248
	blockquote {
249
		margin-left: 0;
250
		padding-left: 1rem;
251
		border-left: 3px solid var(--color-accent);
252
		color: var(--color-muted);
253
	}
254

255
	img {
256
		max-width: 100%;
257
		height: auto;
258
	}
259

260
	hr {
261
		margin: 2rem 0;
262
		border: 0;
263
		border-top: 1px solid var(--color-rule);
264
	}
265

266
	code {
267
		padding: 0.1em 0.3em;
268
		border-radius: 3px;
269
		background: var(--color-code-bg);
270
		font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
271
		font-size: 0.85em;
272
	}
273

274
	pre {
275
		padding: 1rem;
276
		overflow-x: auto;
277
		border-radius: 4px;
278
		background: var(--color-code-bg);
279

280
		code {
281
			padding: 0;
282
			background: none;
283
			font-size: 0.8rem;
284
		}
285
	}
286

287
	table {
288
		width: 100%;
289
		margin: 1.5rem 0;
290
		border-collapse: collapse;
291
	}
292

293
	th,
294
	td {
295
		padding: 0.4rem 0.6rem;
296
		border: 1px solid var(--color-rule);
297
		text-align: left;
298
	}
299

300
	th {
301
		background: var(--color-code-bg);
302
	}
303
}
304

305
.post-meta {
306
	color: var(--color-muted);
307
	font-family: sans-serif;
308
	font-size: 0.8rem;
309
}
310

311
.landing p {
312
	font-style: normal;
313
	font-size: calc(calc(#{$landing-size-value} - 1) * calc(.012 * min(100vh, 900px)) + 1rem);
314
	font-weight: 400;
315
	line-height: calc(#{$landing-line-height} * (1 + (1 - #{$landing-size-value})/25));
316
	text-align: justify;
317
}
318

319
@media (max-width: 640px) {
320
	header {
321
		flex-wrap: wrap;
322
	}
323

324
	header nav {
325
		order: 3;
326
		width: 100%;
327
		margin-top: 0.75rem;
328
		padding-left: 0;
329
	}
330

331
	header .theme-toggle {
332
		margin-left: auto;
333
	}
334
}