Build the design system: typography, color tokens, real Base layout

References: pixperk.tech (dark, warm off-white text, serif-italic +
mono mixed typography, personal dashboard modules) and mcyoung.xyz
(meta line with reading time, subtle accent underline on titles).

- src/styles/tokens.css: dark-first color palette with a warm-paper
  light mode (data-theme override + prefers-color-scheme, toggle wins
  either direction), fluid clamp() type scale, spacing/radius scale.
- Fonts: Fraunces (display/headings, italic), Newsreader (body,
  long-form readability), JetBrains Mono (nav/meta/code) — all
  self-hosted via @fontsource, continuing the mono choice already
  used in the legacy OG-image pipeline.
- Base.astro rewritten: real header/nav with active-link state, a
  theme toggle (persisted to localStorage, no-flash inline script),
  footer with social links (ported from zola.toml), replacing the
  scaffold placeholder.
- Reading time: toml-content-loader.ts computes wordCount/
  readingMinutes from the raw body at load time, surfaced in the
  writings list and detail meta line.
- Bug fix: the marked heading renderer was using raw token.text for
  both the visible heading and the TOC, so a heading like
  "**Registers**" rendered literal asterisks instead of bold — now
  renders inline tokens properly and strips markdown for the
  plain-text TOC label/slug.

Verified in-browser (light + dark) across home, a migrated writing
with TOC/headings, bookshelf, and 404.
This commit is contained in:
2026-08-31 08:03:50 +03:00
parent 3d4b2fcd64
commit 9392d45f53
10 changed files with 478 additions and 44 deletions
+177
View File
@@ -0,0 +1,177 @@
@import "./tokens.css";
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: var(--font-body);
font-size: var(--font-size-base);
line-height: 1.65;
transition:
background-color 0.3s var(--ease-out),
color 0.3s var(--ease-out);
}
::selection {
background: var(--accent-muted);
color: var(--text);
}
a {
color: inherit;
}
img,
svg {
max-width: 100%;
display: block;
}
h1,
h2,
h3 {
font-family: var(--font-display);
font-weight: 600;
font-style: italic;
line-height: 1.15;
letter-spacing: -0.01em;
margin: 0 0 var(--space-4);
}
h1 {
font-size: var(--font-size-3xl);
display: inline-block;
position: relative;
}
h1::after {
content: "";
position: absolute;
left: 0.05em;
right: 0.4em;
bottom: 0.08em;
height: 0.09em;
background: var(--accent);
opacity: 0.55;
z-index: -1;
border-radius: 1px;
}
h2 {
font-size: var(--font-size-2xl);
}
h3 {
font-size: var(--font-size-xl);
}
p {
margin: 0 0 var(--space-5);
}
code,
pre {
font-family: var(--font-mono);
font-size: 0.9em;
}
pre {
padding: var(--space-4);
overflow-x: auto;
background: var(--bg-elevated);
border-radius: var(--radius-md);
border: 1px solid var(--border);
}
.container {
max-width: 42rem;
margin-inline: auto;
padding-inline: var(--space-5);
}
.eyebrow {
font-family: var(--font-mono);
font-size: var(--font-size-sm);
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--text-muted);
}
.meta {
font-family: var(--font-mono);
font-size: var(--font-size-sm);
color: var(--text-muted);
}
.tag {
display: inline-block;
font-family: var(--font-mono);
font-size: var(--font-size-sm);
color: var(--text-muted);
margin-right: var(--space-3);
text-decoration: none;
}
.tag:hover {
color: var(--accent);
}
.card {
padding-block: var(--space-5);
border-bottom: 1px solid var(--border);
}
.card h3 {
margin-bottom: var(--space-1);
}
.card h3 a {
text-decoration: none;
}
.card h3 a:hover {
color: var(--accent);
}
.button {
display: inline-flex;
align-items: center;
gap: var(--space-2);
font-family: var(--font-mono);
font-size: var(--font-size-sm);
letter-spacing: 0.04em;
text-decoration: none;
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: var(--space-2) var(--space-4);
transition:
border-color 0.2s var(--ease-out),
color 0.2s var(--ease-out);
}
.button:hover {
border-color: var(--accent);
color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}
+66
View File
@@ -0,0 +1,66 @@
/**
* Design tokens. Dark-first (matches the reflective, slightly technical
* tone of the content), with a warm paper-toned light mode — not pure
* black/white either way, so the palette reads considered rather than
* default browser colors.
*/
:root {
--bg: #faf7f1;
--bg-elevated: #f1ece0;
--text: #1c1a15;
--text-muted: #6f6a5c;
--border: rgba(28, 26, 21, 0.12);
--accent: #d1502f;
--accent-muted: rgba(209, 80, 47, 0.12);
--font-display: "Fraunces Variable", ui-serif, Georgia, serif;
--font-body: "Newsreader Variable", ui-serif, Georgia, serif;
--font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
--font-size-sm: clamp(0.8rem, 0.77rem + 0.15vw, 0.875rem);
--font-size-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
--font-size-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
--font-size-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
--font-size-2xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
--font-size-3xl: clamp(2.25rem, 1.7rem + 2.6vw, 3.5rem);
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-3: 0.75rem;
--space-4: 1rem;
--space-5: 1.5rem;
--space-6: 2rem;
--space-7: 3rem;
--space-8: 4.5rem;
--radius-sm: 4px;
--radius-md: 10px;
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #0d0d0b;
--bg-elevated: #171613;
--text: #ece7db;
--text-muted: #8e897b;
--border: rgba(236, 231, 219, 0.12);
--accent: #ff6b45;
--accent-muted: rgba(255, 107, 69, 0.15);
color-scheme: dark;
}
}
:root[data-theme="dark"] {
--bg: #0d0d0b;
--bg-elevated: #171613;
--text: #ece7db;
--text-muted: #8e897b;
--border: rgba(236, 231, 219, 0.12);
--accent: #ff6b45;
--accent-muted: rgba(255, 107, 69, 0.15);
color-scheme: dark;
}