@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); } /* === Code Blocks: Borderless, VS Code Style, Line Numbers === */ [data-rehype-pretty-code-figure] { @apply relative overflow-hidden rounded-[var(--radius-code)]; background-color: var(--color-code-block); border: none; box-shadow: 0 0 0 1px var(--color-border), 0 2px 8px oklch(0 0 0 / 0.06); } .dark [data-rehype-pretty-code-figure] { box-shadow: 0 0 0 1px var(--color-border), 0 2px 8px oklch(1 0 0 / 0.04); } [data-rehype-pretty-code-title] { @apply relative flex items-center gap-2.5 px-4 py-2 text-xs; background-color: var(--color-code-title-bg); border-bottom: 1px solid var(--color-border); border-radius: var(--radius-code) var(--radius-code) 0 0; } .dark [data-rehype-pretty-code-title] { background-color: var(--color-code-title-bg); } [data-rehype-pretty-code-title] + pre { @apply m-0 rounded-b-[var(--radius-code)] rounded-t-none; } [data-rehype-pretty-code-title] .vscode-dots { @apply inline-flex gap-[6px] mr-2; } [data-rehype-pretty-code-title] .vscode-dots span { @apply block h-2.5 w-2.5 rounded-full; } [data-rehype-pretty-code-title] .dot-red { background-color: var(--color-code-dot-red); box-shadow: inset 0 0 0 0.5px oklch(0 0 0 / 0.15); } [data-rehype-pretty-code-title] .dot-yellow { background-color: var(--color-code-dot-yellow); box-shadow: inset 0 0 0 0.5px oklch(0 0 0 / 0.15); } [data-rehype-pretty-code-title] .dot-green { background-color: var(--color-code-dot-green); box-shadow: inset 0 0 0 0.5px oklch(0 0 0 / 0.15); } [data-rehype-pretty-code-figure] pre { @apply relative overflow-auto p-4; } [data-rehype-pretty-code-figure] pre code { @apply !bg-transparent font-mono text-[13px] leading-[1.6]; display: grid; } [data-rehype-pretty-code-figure] code[data-line-numbers] { counter-reset: line; } [data-rehype-pretty-code-figure] code[data-line-numbers] > [data-line]::before { counter-increment: line; content: counter(line); @apply mr-5 inline-block w-4 text-right select-none; color: var(--color-code-gutter); @apply text-[11px] font-mono; } .dark [data-rehype-pretty-code-figure] code[data-line-numbers] > [data-line]::before { color: var(--color-code-gutter); } [data-rehype-pretty-code-figure] [data-line] { @apply relative px-2; border-left: 2px solid transparent; } [data-rehype-pretty-code-figure] [data-highlighted-line] { @apply rounded-r-sm; background-color: var(--color-code-line-highlight); border-left-color: var(--color-code-line-highlight-border); } [data-rehype-pretty-code-figure] [data-highlighted-chars] { @apply rounded py-0.5 px-1; background-color: var(--color-code-mark-bg); } [data-rehype-pretty-code-figure] .rehype-pretty-copy { @apply absolute right-3 top-3 z-10 flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium; background-color: oklch(0.97 0 0 / 0.85); color: var(--color-code-copy); opacity: 0; transition: opacity 0.15s ease; } .dark [data-rehype-pretty-code-figure] .rehype-pretty-copy { background-color: oklch(0.10 0 0 / 0.85); color: var(--color-code-copy); } [data-rehype-pretty-code-figure]:hover .rehype-pretty-copy { opacity: 1; } [data-rehype-pretty-code-figure] .rehype-pretty-copy:hover { @apply border-current; background-color: oklch(0.95 0 0 / 0.95); color: var(--color-code-copy-hover); } .dark [data-rehype-pretty-code-figure] .rehype-pretty-copy:hover { background-color: oklch(0.15 0 0 / 0.95); } [data-rehype-pretty-code-figure] .rehype-pretty-copy.rehype-pretty-copied { @apply border-green-500/50; color: oklch(0.55 0.18 140); } .dark [data-rehype-pretty-code-figure] .rehype-pretty-copy.rehype-pretty-copied { color: oklch(0.70 0.15 140); } /* Shiki dual theme token color switching */ code[data-theme*=" "], code[data-theme*=" "] span { color: var(--shiki-light); } html.dark code[data-theme*=" "], html.dark code[data-theme*=" "] span { color: var(--shiki-dark); } /* === 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; } }