cabotia / cabotia.dev/ assets/main.scss00a028b0e43dfda3a88112dbbf0c14dc538b363d
3.4 KB | 227 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
.fine-line {
182
	color: var(--color-faint);
183
}
184

185
footer {
186
	text-align: center;
187
	margin-top: 2rem;
188
	color: var(--color-muted);
189

190
	display: flex;
191
	flex-direction: column;
192
	justify-content: center;
193

194
	.links {
195
		display: flex;
196
		justify-content: center;
197
	}
198

199
	a {
200
		color: var(--color-muted);
201
	}
202
}
203

204
.landing p {
205
	font-style: normal;
206
	font-size: calc(calc(#{$landing-size-value} - 1) * calc(.012 * min(100vh, 900px)) + 1rem);
207
	font-weight: 400;
208
	line-height: calc(#{$landing-line-height} * (1 + (1 - #{$landing-size-value})/25));
209
	text-align: justify;
210
}
211

212
@media (max-width: 640px) {
213
	header {
214
		flex-wrap: wrap;
215
	}
216

217
	header nav {
218
		order: 3;
219
		width: 100%;
220
		margin-top: 0.75rem;
221
		padding-left: 0;
222
	}
223

224
	header .theme-toggle {
225
		margin-left: auto;
226
	}
227
}