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;
}
}