Light: --color-code-block through --color-code-dot-green, --radius-code
Dark: code-block, code-block-hover, code-gutter, code-gutter-border,
code-title-bg, code-title-text, code-line-highlight,
code-line-highlight-border, code-mark-bg, code-copy, code-copy-hover
298 lines
7.6 KiB
CSS
298 lines
7.6 KiB
CSS
@import "tailwindcss";
|
|
|
|
/* Dark mode: class-based (for @wrksz/themes) */
|
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
|
|
/* === Design Tokens === */
|
|
@theme {
|
|
/* Colors — Light mode defaults */
|
|
--color-canvas: oklch(1 0 0);
|
|
--color-surface: oklch(0.98 0 0);
|
|
--color-ink: oklch(0.08 0 0);
|
|
--color-ink-soft: oklch(0.40 0 0);
|
|
--color-border: oklch(0.92 0 0);
|
|
--color-accent: oklch(0.45 0.18 250);
|
|
|
|
/* Code blocks — Light mode */
|
|
--color-code-block: oklch(0.97 0 0);
|
|
--color-code-block-hover: oklch(0.95 0 0);
|
|
--color-code-gutter: oklch(0.50 0 0);
|
|
--color-code-gutter-border: oklch(0.90 0 0);
|
|
--color-code-title-bg: oklch(0.95 0 0);
|
|
--color-code-title-text: oklch(0.40 0 0);
|
|
--color-code-line-highlight: oklch(0.92 0.02 250 / 0.3);
|
|
--color-code-line-highlight-border: oklch(0.45 0.20 250);
|
|
--color-code-mark-bg: oklch(0.90 0.03 250 / 0.4);
|
|
--color-code-copy: oklch(0.40 0 0);
|
|
--color-code-copy-hover: oklch(0.25 0 0);
|
|
--color-code-dot-red: oklch(0.60 0.22 15);
|
|
--color-code-dot-yellow: oklch(0.75 0.18 65);
|
|
--color-code-dot-green: oklch(0.65 0.18 140);
|
|
--radius-code: 0.75rem;
|
|
|
|
/* Fonts — override defaults */
|
|
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
--font-serif: 'Inter', -apple-system, system-ui, sans-serif;
|
|
--font-mono: "JetBrains Mono", ui-monospace, monospace;
|
|
|
|
/* Typography scale */
|
|
--text-xs: 0.75rem; --text-xs--line-height: 1.2;
|
|
--text-sm: 0.875rem; --text-sm--line-height: 1.4;
|
|
--text-base: 1rem; --text-base--line-height: 1.5;
|
|
--text-lg: 1.125rem; --text-lg--line-height: 1.6;
|
|
--text-xl: 1.25rem; --text-xl--line-height: 1.6;
|
|
--text-2xl: 1.5rem; --text-2xl--line-height: 2rem;
|
|
--text-3xl: 1.875rem; --text-3xl--line-height: 2.25rem;
|
|
--text-4xl: 2.25rem; --text-4xl--line-height: 2.5rem;
|
|
--text-5xl: 3rem; --text-5xl--line-height: 1.1;
|
|
|
|
/* Shadows */
|
|
--shadow-card: 0 1px 3px oklch(0 0 0 / 0.08);
|
|
|
|
/* Animations */
|
|
--animate-fade-in: fade-in 0.3s ease-out;
|
|
--animate-fade-in-up: fade-in-up 0.4s ease-out;
|
|
--animate-slide-up: slide-up 0.5s ease-out;
|
|
|
|
@keyframes fade-in {
|
|
from { opacity: 0; }
|
|
to { opacity: 1; }
|
|
}
|
|
@keyframes fade-in-up {
|
|
from { opacity: 0; transform: translateY(12px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
@keyframes slide-up {
|
|
from { opacity: 0; transform: translateY(24px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
}
|
|
|
|
@layer base {
|
|
body {
|
|
font-family: var(--font-serif);
|
|
font-weight: 400;
|
|
line-height: 1.6;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
}
|
|
h1, h2, h3, h4, h5, h6 {
|
|
font-family: var(--font-sans);
|
|
font-weight: 700;
|
|
line-height: 1.25;
|
|
letter-spacing: -0.015em;
|
|
}
|
|
h1 { line-height: 1.15; letter-spacing: -0.025em; }
|
|
h2 { line-height: 1.2; letter-spacing: -0.02em; }
|
|
code, pre, kbd, samp {
|
|
font-family: var(--font-mono);
|
|
font-feature-settings: 'liga' 1, 'calt' 1;
|
|
}
|
|
a {
|
|
text-underline-offset: 3px;
|
|
text-decoration-thickness: 1px;
|
|
transition: text-decoration-thickness 0.15s ease;
|
|
}
|
|
a:hover {
|
|
text-decoration-thickness: 3px;
|
|
}
|
|
}
|
|
|
|
/* === Dark mode token overrides === */
|
|
.dark {
|
|
--color-canvas: oklch(0 0 0);
|
|
--color-surface: oklch(0.07 0 0);
|
|
--color-ink: oklch(1 0 0);
|
|
--color-ink-soft: oklch(0.72 0 0);
|
|
--color-border: oklch(0.17 0 0);
|
|
--color-accent: oklch(0.68 0.20 250);
|
|
|
|
/* Code blocks — Dark mode */
|
|
--color-code-block: oklch(0.04 0 0);
|
|
--color-code-block-hover: oklch(0.06 0 0);
|
|
--color-code-gutter: oklch(0.30 0 0);
|
|
--color-code-gutter-border: oklch(0.14 0 0);
|
|
--color-code-title-bg: oklch(0.03 0 0);
|
|
--color-code-title-text: oklch(0.55 0 0);
|
|
--color-code-line-highlight: oklch(0.12 0.02 250 / 0.3);
|
|
--color-code-line-highlight-border: oklch(0.68 0.20 250);
|
|
--color-code-mark-bg: oklch(0.10 0.03 250 / 0.4);
|
|
--color-code-copy: oklch(0.60 0 0);
|
|
--color-code-copy-hover: oklch(0.85 0 0);
|
|
|
|
--shadow-card: 0 1px 4px oklch(1 0 0 / 0.06);
|
|
}
|
|
|
|
/* === Blog typography === */
|
|
@plugin "@tailwindcss/typography";
|
|
|
|
@utility prose {
|
|
--tw-prose-body: var(--color-ink-soft);
|
|
--tw-prose-headings: var(--color-ink);
|
|
--tw-prose-links: var(--color-accent);
|
|
--tw-prose-bold: var(--color-ink);
|
|
--tw-prose-quote-borders: var(--color-border);
|
|
--tw-prose-code: var(--color-accent);
|
|
--tw-prose-pre-bg: var(--color-surface);
|
|
}
|
|
|
|
/* === KaTeX dark mode overrides === */
|
|
.dark .katex,
|
|
.dark .katex * {
|
|
color: currentColor !important;
|
|
}
|
|
.prose .katex-display {
|
|
color: currentColor !important;
|
|
}
|
|
.prose .katex-display .katex .base {
|
|
color: currentColor !important;
|
|
}
|
|
.katex .mfrac .frac-line,
|
|
.katex .sqrt .sqrt-line,
|
|
.katex .overline .overline-line,
|
|
.katex .underline .underline-line {
|
|
border-color: currentColor !important;
|
|
}
|
|
.katex {
|
|
font-size: 1.1em !important;
|
|
}
|
|
.katex-display {
|
|
margin: 1.5rem 0;
|
|
overflow-x: auto;
|
|
}
|
|
.katex .katex-mathml {
|
|
position: absolute;
|
|
clip: rect(1px, 1px, 1px, 1px);
|
|
padding: 0;
|
|
border: 0;
|
|
}
|
|
|
|
/* === Heading utilities === */
|
|
@utility heading-xl {
|
|
font-size: 2.25rem;
|
|
font-weight: 800;
|
|
letter-spacing: -0.025em;
|
|
line-height: 1.1;
|
|
}
|
|
|
|
@utility heading-lg {
|
|
font-size: 1.875rem;
|
|
font-weight: 600;
|
|
letter-spacing: -0.025em;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
@utility heading-md {
|
|
font-size: 1.5rem;
|
|
font-weight: 600;
|
|
letter-spacing: -0.025em;
|
|
line-height: 1.3;
|
|
}
|
|
|
|
@utility heading-sm {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
letter-spacing: -0.01em;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
/* === Scroll progress bar (CSS animation-timeline + JS fallback) === */
|
|
.scroll-progress {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
height: 2px;
|
|
width: 0%;
|
|
background: var(--color-ink);
|
|
z-index: 9999;
|
|
will-change: width;
|
|
}
|
|
|
|
@supports (animation-timeline: scroll()) {
|
|
.scroll-progress {
|
|
width: 0%;
|
|
animation: scroll-progress linear forwards;
|
|
animation-timeline: scroll(root block);
|
|
}
|
|
@keyframes scroll-progress {
|
|
from { width: 0%; }
|
|
to { width: 100%; }
|
|
}
|
|
}
|
|
|
|
/* === Scroll-to-top button === */
|
|
.scroll-to-top {
|
|
position: fixed;
|
|
bottom: 24px;
|
|
right: 24px;
|
|
width: 40px;
|
|
height: 40px;
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 50%;
|
|
background: var(--color-canvas);
|
|
color: var(--color-ink);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
opacity: 0;
|
|
transform: translateY(10px);
|
|
pointer-events: none;
|
|
transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.2s ease;
|
|
z-index: 9997;
|
|
will-change: opacity, transform;
|
|
}
|
|
.scroll-to-top.visible {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
pointer-events: auto;
|
|
}
|
|
.scroll-to-top:hover {
|
|
border-color: var(--color-ink);
|
|
}
|
|
|
|
/* === Reading progress vertical bar === */
|
|
.reading-progress {
|
|
position: fixed;
|
|
right: 12px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
width: 3px;
|
|
height: 60px;
|
|
background: rgba(0, 0, 0, 0.08);
|
|
border-radius: 2px;
|
|
z-index: 9998;
|
|
overflow: hidden;
|
|
}
|
|
.reading-progress-fill {
|
|
width: 100%;
|
|
height: 0%;
|
|
background: var(--color-ink);
|
|
border-radius: 2px;
|
|
}
|
|
@supports (animation-timeline: scroll()) {
|
|
.reading-progress-fill {
|
|
animation: reading-progress linear forwards;
|
|
animation-timeline: scroll(root block);
|
|
}
|
|
@keyframes reading-progress {
|
|
from { height: 0%; }
|
|
to { height: 100%; }
|
|
}
|
|
}
|
|
|
|
/* === Global transition for theme switch === */
|
|
* {
|
|
transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
|
|
}
|
|
|
|
/* === Reduced motion === */
|
|
@media (prefers-reduced-motion: reduce) {
|
|
*, *::before, *::after {
|
|
animation-duration: 0.01ms !important;
|
|
animation-iteration-count: 1 !important;
|
|
transition-duration: 0.01ms !important;
|
|
scroll-behavior: auto !important;
|
|
}
|
|
.scroll-progress { display: none; }
|
|
}
|