Skip to content

Commit 830e545

Browse files
rdavid1099claude
andauthored
Clean up style.css: drop dead .card/.grid code, merge dupes, add tokens (#5)
- Delete unused .grid and .card rules (planned card layout never landed), including all .card:nth-child color rules, hover transform, box-shadow, and the invalid align-items:left / justify-content:left declarations. - Merge the two html {} blocks, the two body {} blocks, and the two consecutive code {} blocks so each selector is declared once. - Introduce a :root token layer for colors, spacing, typography, and layout values that are repeated or carry semantic weight, and refactor existing rules to consume them via var(). No visible rendering change. Co-authored-by: Ryan Workman <rdavid1099@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 045de79 commit 830e545

1 file changed

Lines changed: 67 additions & 164 deletions

File tree

css/style.css

Lines changed: 67 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,64 @@
11
@import url("https://rsms.me/inter/inter.css");
22

3+
:root {
4+
/* Color tokens */
5+
--color-bg: #edf2f7;
6+
--color-text: #495057;
7+
--color-surface: white;
8+
--color-quote-bg: #f9f9f9;
9+
--color-quote-rule: black;
10+
--color-table-rule: black;
11+
--color-code-bg: #edf2f7;
12+
13+
/* Spacing scale */
14+
--space-1: 0.25rem;
15+
--space-2: 0.5rem;
16+
--space-3: 1rem;
17+
--space-4: 1.5rem;
18+
--space-5: 2rem;
19+
--space-6: 3rem;
20+
21+
/* Typography */
22+
--font-sans: "Inter", "Helvetica", sans-serif;
23+
--font-sans-var: "Inter var", "Helvetica", sans-serif;
24+
--weight-medium: 500;
25+
--line-height-body: 1.5;
26+
27+
/* Layout */
28+
--max-content: 50rem;
29+
--shadow-card: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
30+
31+
/* Misc */
32+
--muted-opacity: 0.6;
33+
}
34+
335
html {
4-
font-family: "Inter", "Helvetica", sans-serif;
36+
font-family: var(--font-sans);
537
font-display: swap;
38+
box-sizing: border-box;
39+
margin: 0;
40+
padding: 0;
641
}
742

843
@supports (font-variation-settings: normal) {
944
html {
10-
font-family: "Inter var", "Helvetica", sans-serif;
45+
font-family: var(--font-sans-var);
1146
}
1247
}
1348

49+
*,
50+
*:before,
51+
*:after {
52+
box-sizing: inherit;
53+
}
54+
1455
body {
1556
font-size: 1rem;
16-
line-height: 1.5;
57+
line-height: var(--line-height-body);
1758
-webkit-font-smoothing: antialiased;
1859
text-rendering: optimizeLegibility;
60+
background-color: var(--color-bg);
61+
color: var(--color-text);
1962
}
2063

2164
a,
@@ -34,15 +77,15 @@ h3,
3477
h4,
3578
h5,
3679
nav a {
37-
font-weight: 500;
80+
font-weight: var(--weight-medium);
3881
}
3982

4083
blockquote {
41-
background: #f9f9f9;
42-
border-left: 5px solid black;
84+
background: var(--color-quote-bg);
85+
border-left: 5px solid var(--color-quote-rule);
4386
font-size: 120%;
44-
margin: 2rem 0;
45-
padding: 1rem;
87+
margin: var(--space-5) 0;
88+
padding: var(--space-3);
4689
}
4790

4891
blockquote p {
@@ -51,29 +94,26 @@ blockquote p {
5194

5295
blockquote footer {
5396
font-size: 80%;
54-
margin: 1rem 0 0 0;
97+
margin: var(--space-3) 0 0 0;
5598
}
5699

57100
dl dt {
58-
margin-bottom: 0.5rem;
101+
margin-bottom: var(--space-2);
59102
}
60103

61104
dl dd {
62105
font-style: italic;
63-
margin-bottom: 2rem;
106+
margin-bottom: var(--space-5);
64107
}
65108

66109
code,
67110
.highlight {
68-
background: #edf2f7;
111+
background: var(--color-code-bg);
69112
overflow: auto;
70113
}
71114

72115
code {
73116
word-break: break-all;
74-
}
75-
76-
code {
77117
padding: 0.1rem 0.3rem;
78118
}
79119

@@ -82,157 +122,20 @@ pre {
82122
}
83123

84124
.date {
85-
opacity: 0.6;
86-
}
87-
88-
html {
89-
box-sizing: border-box;
90-
margin: 0;
91-
padding: 0;
92-
}
93-
94-
*,
95-
*:before,
96-
*:after {
97-
box-sizing: inherit;
98-
}
99-
100-
body {
101-
background-color: #edf2f7;
102-
color: #495057;
125+
opacity: var(--muted-opacity);
103126
}
104127

105128
header,
106129
main {
107130
margin: 0 auto;
108-
max-width: 50rem;
109-
}
110-
111-
.grid {
112-
display: flex;
113-
flex-wrap: wrap;
114-
display: grid;
115-
grid-template-columns: 1fr;
116-
grid-auto-rows: minmax(10rem, auto);
117-
grid-gap: 1rem;
118-
}
119-
120-
.card {
121-
display: flex;
122-
align-items: left;
123-
justify-content: left;
124-
min-height: 10rem;
125-
position: relative;
126-
margin-left: 1rem;
127-
margin-right: 1rem;
128-
flex: 1 1 10rem;
129-
}
130-
131-
@supports (display: grid) {
132-
.card {
133-
margin: 0;
134-
}
135-
}
136-
137-
.card:nth-child(1n) {
138-
background: #96d0c3;
139-
}
140-
141-
.card:nth-child(2n) {
142-
background: #ef7d4d;
143-
}
144-
145-
.card:nth-child(3n) {
146-
background: #fbcfb9;
147-
}
148-
149-
.card:nth-child(4n) {
150-
background: #fac14e;
151-
}
152-
153-
.card:nth-child(5n + 1) {
154-
background: #ef7d4d;
155-
}
156-
157-
.card:nth-child(6n + 1) {
158-
background: #ef7d4d;
159-
}
160-
161-
.card:nth-child(7n + 1) {
162-
background: #fac14e;
163-
}
164-
165-
.card:nth-child(4n + 1) {
166-
background: #fac14e;
167-
}
168-
169-
.card:nth-child(4n + 2) {
170-
background: #fbcfb9;
171-
}
172-
173-
.card:nth-child(4n + 3) {
174-
background: #ef7d4d;
175-
}
176-
177-
.card:nth-child(4n + 4) {
178-
background: #96d0c3;
179-
}
180-
181-
.card {
182-
background: white;
183-
-webkit-box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
184-
box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
185-
text-decoration: none;
186-
color: inherit;
187-
}
188-
189-
.card .thumb {
190-
padding-bottom: 60%;
191-
background-size: cover;
192-
background-position: center center;
193-
}
194-
195-
.card a {
196-
text-decoration: none;
197-
}
198-
199-
.card p {
200-
font-size: 0.9rem;
201-
}
202-
203-
.card h2 {
204-
font-size: 1.3rem;
205-
margin: 0;
206-
}
207-
208-
.card time {
209-
font-size: 0.8rem;
210-
font-weight: 500;
211-
text-transform: uppercase;
212-
letter-spacing: 0.05em;
213-
}
214-
215-
.card .meta {
216-
padding: 2rem;
217-
display: flex;
218-
flex: 1;
219-
justify-content: space-between;
220-
flex-direction: column;
131+
max-width: var(--max-content);
221132
}
222133

223134
.post {
224-
background: white;
225-
padding: 2rem 3rem;
226-
-webkit-box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
227-
box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
228-
}
229-
230-
.card {
231-
transition: all 0.3s cubic-bezier(0.25, 0.45, 0.45, 0.95);
232-
}
233-
234-
.card:hover {
235-
transform: scale(1.02);
135+
background: var(--color-surface);
136+
padding: var(--space-5) var(--space-6);
137+
-webkit-box-shadow: var(--shadow-card);
138+
box-shadow: var(--shadow-card);
236139
}
237140

238141
ul,
@@ -248,16 +151,16 @@ table {
248151
}
249152

250153
table tr {
251-
border-bottom: 1px solid black;
154+
border-bottom: 1px solid var(--color-table-rule);
252155
}
253156

254157
table td {
255-
padding: 0.5rem;
158+
padding: var(--space-2);
256159
}
257160

258161
img {
259162
width: 100%;
260-
margin: 0.5rem 0;
163+
margin: var(--space-2) 0;
261164
}
262165

263166
nav ul {
@@ -272,17 +175,17 @@ nav ul li {
272175

273176
nav a,
274177
nav a:visited {
275-
margin: 0.5rem;
178+
margin: var(--space-2);
276179
text-decoration: none;
277180
text-transform: uppercase;
278181
color: inherit;
279182
font-size: 0.8rem;
280-
font-weight: 500;
183+
font-weight: var(--weight-medium);
281184
letter-spacing: 0.05em;
282185
}
283186

284187
footer {
285-
margin: 1rem 0;
188+
margin: var(--space-3) 0;
286189
text-align: center;
287190
}
288191

0 commit comments

Comments
 (0)