- weirsoe-theme.js: match asger.weirsoe.dk exactly — localStorage['theme'], prefers-color-scheme default, light<->dark click delegation. - Container tokens + .wt-container(/--wide/--narrow/--bleed); Bulma adapter constrains content to a centred column past tablet (full-bleed on phones). - Site chrome extracted from agw/pw so it can drop its hardcoded CSS: .wt-header /.wt-nav/.wt-brand/.wt-nav-link/.wt-main/.wt-footer, postcard .wt-card(+date/ title/desc, --raised) and .wt-chip. README components table + theme-color note.
236 lines
11 KiB
CSS
236 lines
11 KiB
CSS
/* ============================================================================
|
|
weirsoe-theme — a tiny, framework-agnostic dark/light design system.
|
|
Extracted from asger.weirsøe.dk. Pure CSS, system fonts by default (no
|
|
external requests → great TTFB, no trackers). Three palettes: dark (default),
|
|
light, terminal. Use the CSS variables directly, or the .wt-* components.
|
|
|
|
Switch theme by setting an attribute on <html>:
|
|
<html data-theme="light"> (or "dark" / "terminal"; default is dark)
|
|
Pair with weirsoe-theme.js for a persisted toggle + no-flash on load.
|
|
========================================================================== */
|
|
|
|
:root,
|
|
:root[data-theme="dark"] {
|
|
color-scheme: dark;
|
|
--color-bg: #0b0f17;
|
|
--color-surface: #121a27;
|
|
--color-surface-2: #182232;
|
|
--color-surface-3: #1d293b;
|
|
--color-border: #243044;
|
|
--color-text: #e6e9ef;
|
|
--color-muted: #97a3b6;
|
|
--color-accent: #38bdf8;
|
|
--color-accent-2: #818cf8;
|
|
--color-accent-ink: #06121c;
|
|
--color-good: #7dffa8;
|
|
--color-bad: #ff8ba0;
|
|
|
|
--wt-radius: 0.85rem;
|
|
--wt-radius-sm: 0.55rem;
|
|
--wt-shadow: 0 10px 30px #00000059;
|
|
--wt-shadow-hover: 0 18px 44px #0000006e;
|
|
/* responsive content widths — full-bleed on small screens, a readable,
|
|
centred column on large ones (the asger.weirsøe.dk behaviour). */
|
|
--wt-container: 48rem;
|
|
--wt-container-wide: 72rem;
|
|
--wt-container-narrow: 34rem;
|
|
--wt-gutter: 1.25rem;
|
|
--wt-font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
|
|
Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
|
|
--wt-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
"Liberation Mono", "Courier New", monospace;
|
|
}
|
|
|
|
:root[data-theme="light"] {
|
|
color-scheme: light;
|
|
--color-bg: #f6f8fb;
|
|
--color-surface: #ffffff;
|
|
--color-surface-2: #eef2f8;
|
|
--color-surface-3: #e6ecf5;
|
|
--color-border: #dde4ee;
|
|
--color-text: #0f1729;
|
|
--color-muted: #54617a;
|
|
--color-accent: #0284c7;
|
|
--color-accent-2: #4f46e5;
|
|
--color-accent-ink: #ffffff;
|
|
}
|
|
|
|
:root[data-theme="terminal"] {
|
|
color-scheme: dark;
|
|
--color-bg: #050a06;
|
|
--color-surface: #0a140c;
|
|
--color-surface-2: #102012;
|
|
--color-surface-3: #16331c;
|
|
--color-border: #1d3a22;
|
|
--color-text: #4bff7e;
|
|
--color-muted: #2fae57;
|
|
--color-accent: #7dffa8;
|
|
--color-accent-2: #33cc77;
|
|
--color-accent-ink: #04130a;
|
|
}
|
|
|
|
/* ---------- base ---------- */
|
|
html { scroll-behavior: smooth; }
|
|
body {
|
|
background-color: var(--color-bg);
|
|
color: var(--color-text);
|
|
font-family: var(--wt-font-sans);
|
|
}
|
|
/* smooth cross-fade when toggling theme */
|
|
body, header, a, span, div, p, h1, h2, h3, li, ul, input, button, svg,
|
|
section, article, .wt-card {
|
|
transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
|
|
}
|
|
::selection { background: color-mix(in srgb, var(--color-accent) 35%, transparent); }
|
|
|
|
/* subtle top-glow background (sits behind everything) */
|
|
body::before {
|
|
content: "";
|
|
position: fixed; inset: 0; z-index: -1; pointer-events: none;
|
|
background:
|
|
radial-gradient(60rem 30rem at 70% -10%, color-mix(in srgb, var(--color-accent) 12%, transparent), transparent 70%),
|
|
radial-gradient(50rem 30rem at 10% 0%, color-mix(in srgb, var(--color-accent-2) 10%, transparent), transparent 70%);
|
|
}
|
|
|
|
/* ---------- responsive container ---------- */
|
|
/* Full width (with gutters) on small screens; a centred max-width column on
|
|
larger ones. Use --wt-container / --modifier to control the breakpoint width. */
|
|
.wt-container {
|
|
width: 100%;
|
|
max-width: var(--wt-container);
|
|
margin-inline: auto;
|
|
padding-inline: var(--wt-gutter);
|
|
}
|
|
.wt-container--wide { max-width: var(--wt-container-wide); }
|
|
.wt-container--narrow { max-width: var(--wt-container-narrow); }
|
|
.wt-container--bleed { max-width: none; }
|
|
|
|
/* ---------- site chrome (header / nav / footer) ---------- */
|
|
.wt-header {
|
|
position: sticky; top: 0; z-index: 50;
|
|
border-bottom: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
|
|
-webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
|
|
background: color-mix(in srgb, var(--color-bg) 70%, transparent);
|
|
}
|
|
.wt-nav {
|
|
margin-inline: auto; max-width: var(--wt-container);
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
padding: 0.875rem 1.25rem; gap: 1rem;
|
|
}
|
|
.wt-brand { font-weight: 700; letter-spacing: -0.02em; font-size: 1.125rem; color: var(--color-text); text-decoration: none; }
|
|
.wt-brand-dot { color: var(--color-accent); }
|
|
.wt-nav-links { display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; list-style: none; margin: 0; padding: 0; }
|
|
.wt-nav-link {
|
|
display: inline-block; border-radius: 0.5rem; padding: 0.375rem 0.75rem;
|
|
color: var(--color-muted); text-decoration: none;
|
|
transition: color 0.2s, background-color 0.2s;
|
|
}
|
|
.wt-nav-link:hover { color: var(--color-text); }
|
|
.wt-nav-link.is-active, .wt-nav-link[aria-current="page"] { color: var(--color-text); background: var(--color-surface-2); }
|
|
|
|
.wt-main { margin-inline: auto; width: 100%; max-width: var(--wt-container); padding: 3rem 1.25rem; }
|
|
|
|
.wt-footer { margin-top: 6rem; border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent); }
|
|
.wt-footer-inner {
|
|
margin-inline: auto; max-width: var(--wt-container);
|
|
display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
|
|
padding: 2.5rem 1.25rem; font-size: 0.875rem; color: var(--color-muted);
|
|
}
|
|
.wt-footer a { color: inherit; text-decoration: none; transition: color 0.2s; }
|
|
.wt-footer a:hover { color: var(--color-accent); }
|
|
@media (min-width: 640px) { .wt-footer-inner { flex-direction: row; justify-content: space-between; } }
|
|
|
|
/* ---------- components ---------- */
|
|
/* Faithful to the asger.weirsøe.dk post card: translucent surface, hairline
|
|
border, accent-on-hover, no heavy shadow. Add .wt-card--raised for a shadow. */
|
|
.wt-card {
|
|
background: color-mix(in srgb, var(--color-surface) 60%, transparent);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 1rem;
|
|
padding: 1.25rem;
|
|
transition: border-color 0.2s, transform 0.16s, box-shadow 0.16s;
|
|
}
|
|
.wt-card--hover:hover { border-color: color-mix(in srgb, var(--color-accent) 50%, transparent); }
|
|
.wt-card--raised { background: var(--color-surface); box-shadow: var(--wt-shadow); }
|
|
.wt-card--raised.wt-card--hover:hover { transform: translateY(-2px); box-shadow: var(--wt-shadow-hover); }
|
|
.wt-card-date { font-size: 0.75rem; color: var(--color-muted); }
|
|
.wt-card-title { margin-top: 0.25rem; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
|
|
.wt-card--link:hover .wt-card-title, a.wt-card--hover:hover .wt-card-title { color: var(--color-accent); }
|
|
.wt-card-desc { margin-top: 0.5rem; font-size: 0.875rem; color: var(--color-muted); }
|
|
|
|
/* Pill chip / tag-link (e.g. blog tags) */
|
|
.wt-chip {
|
|
display: inline-flex; align-items: center; border-radius: 999px;
|
|
border: 1px solid var(--color-border); padding: 0.1rem 0.6rem;
|
|
font-size: 0.75rem; color: var(--color-muted); text-decoration: none;
|
|
transition: color 0.2s, border-color 0.2s;
|
|
}
|
|
.wt-chip:hover { color: var(--color-accent); border-color: var(--color-accent); }
|
|
.wt-btn {
|
|
display: inline-flex; align-items: center; gap: 0.5rem;
|
|
border-radius: var(--wt-radius-sm);
|
|
border: 1px solid var(--color-border);
|
|
background: var(--color-surface-2);
|
|
color: var(--color-text);
|
|
padding: 0.5rem 0.9rem; font: inherit; cursor: pointer;
|
|
transition: filter 0.15s, background-color 0.15s, border-color 0.15s;
|
|
}
|
|
.wt-btn:hover { border-color: color-mix(in srgb, var(--color-accent) 50%, var(--color-border)); }
|
|
.wt-btn--primary { background: var(--color-accent); border-color: transparent; color: var(--color-accent-ink); font-weight: 650; }
|
|
.wt-btn--primary:hover { filter: brightness(1.08); }
|
|
.wt-input {
|
|
background: var(--color-surface-2);
|
|
border: 1px solid var(--color-border);
|
|
color: var(--color-text);
|
|
border-radius: var(--wt-radius-sm);
|
|
padding: 0.5rem 0.7rem; font: inherit;
|
|
}
|
|
.wt-input::placeholder { color: color-mix(in srgb, var(--color-muted) 80%, transparent); }
|
|
.wt-input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 25%, transparent); }
|
|
.wt-tag {
|
|
display: inline-flex; align-items: center;
|
|
padding: 0.15rem 0.6rem; border-radius: 999px;
|
|
background: var(--color-surface-2); border: 1px solid var(--color-border);
|
|
color: var(--color-text); font-size: 0.8rem;
|
|
}
|
|
.wt-muted { color: var(--color-muted); }
|
|
|
|
/* ---------- theme toggle (sun ⇄ moon), used by weirsoe-theme.js ---------- */
|
|
.theme-toggle {
|
|
display: inline-grid; place-items: center;
|
|
width: 2.25rem; height: 2.25rem; border-radius: 0.75rem;
|
|
color: var(--color-muted); background: transparent; cursor: pointer;
|
|
border: 1px solid transparent;
|
|
}
|
|
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-2); }
|
|
.theme-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
|
|
.sun-and-moon > :is(.moon, .sun, .sun-beams) { transform-origin: center; }
|
|
.sun-and-moon > :is(.moon, .sun) { fill: currentColor; }
|
|
.sun-and-moon > .sun-beams { stroke: currentColor; stroke-width: 2px; }
|
|
.sun-and-moon > .sun { transition: transform 0.5s cubic-bezier(0.5, 1.25, 0.75, 1.25); }
|
|
.sun-and-moon > .sun-beams { transition: transform 0.5s cubic-bezier(0.5, 1.5, 0.75, 1.25), opacity 0.5s cubic-bezier(0.25, 0, 0.3, 1); }
|
|
.sun-and-moon .moon > circle { transition: transform 0.25s cubic-bezier(0, 0, 0, 1); }
|
|
@supports (cx: 1) { .sun-and-moon .moon > circle { transition: cx 0.25s cubic-bezier(0, 0, 0, 1); } }
|
|
[data-theme="dark"] .sun-and-moon > .sun, [data-theme="terminal"] .sun-and-moon > .sun { transform: scale(1.75); transition-timing-function: cubic-bezier(0.25, 0, 0.3, 1); transition-duration: 0.25s; }
|
|
[data-theme="dark"] .sun-and-moon > .sun-beams, [data-theme="terminal"] .sun-and-moon > .sun-beams { opacity: 0; transform: rotateZ(-25deg); transition-duration: 0.15s; }
|
|
[data-theme="dark"] .sun-and-moon > .moon > circle, [data-theme="terminal"] .sun-and-moon > .moon > circle { transform: translateX(-7px); transition-delay: 0.25s; transition-duration: 0.5s; }
|
|
@supports (cx: 1) { [data-theme="dark"] .sun-and-moon > .moon > circle, [data-theme="terminal"] .sun-and-moon > .moon > circle { cx: 17; transform: translateX(0); } }
|
|
@media (prefers-reduced-motion: reduce) { .sun-and-moon * { transition: none !important; } }
|
|
|
|
/* ---------- markdown prose ---------- */
|
|
.prose { color: var(--color-text); line-height: 1.75; font-size: 1.05rem; }
|
|
.prose > * + * { margin-top: 1.1em; }
|
|
.prose h2 { font-size: 1.6rem; font-weight: 700; margin-top: 2em; letter-spacing: -0.01em; }
|
|
.prose h3 { font-size: 1.25rem; font-weight: 700; margin-top: 1.6em; }
|
|
.prose a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
|
|
.prose code { background: var(--color-surface-2); padding: 0.15em 0.4em; border-radius: 0.35rem; font-size: 0.9em; font-family: var(--wt-font-mono); }
|
|
.prose pre { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: 0.75rem; padding: 1rem 1.1rem; overflow-x: auto; }
|
|
.prose pre code { background: none; padding: 0; }
|
|
.prose blockquote { border-left: 3px solid var(--color-accent); padding-left: 1rem; color: var(--color-muted); font-style: italic; }
|
|
.prose ul { list-style: disc; padding-left: 1.4em; }
|
|
.prose ol { list-style: decimal; padding-left: 1.4em; }
|
|
.prose img { border-radius: 0.75rem; border: 1px solid var(--color-border); }
|
|
.prose hr { border-color: var(--color-border); }
|
|
.prose table { width: 100%; border-collapse: collapse; }
|
|
.prose th, .prose td { border: 1px solid var(--color-border); padding: 0.5rem 0.7rem; text-align: left; }
|