The design system and engineering conventions behind this site: design tokens, component specs, accessibility baselines and the delivery workflow. Every value on this page is read from global.css at build time, so the documentation cannot drift from the implementation.
Doc version
v2.0
Last updated
2026-09-17
Stack
Astro 7 · Tailwind CSS 4 · TypeScript
Scope
All 78 pages across three locales (Simplified Chinese, Traditional Chinese, English)
Token
94
Maintained by
Token values sync automatically at build time; copy is updated alongside code review
Overview & principles
This interface is built on the vocabulary of neumorphism (soft UI): depth comes from paired same-hue shadows rather than borders or outlines. The five principles below are the tie-breakers for the whole site — when a specific case has no precedent, decide by these rather than by preference.
Depth comes from shadow, not stroke
Raised surfaces use a single bottom-right shadow; recessed surfaces use reversed copy pairs. Within one view, shadow tiers and corner radii must stay in the same class — mixing them immediately breaks the sense of a single material.
One font weight, and only one
Body text uses two self-hosted faces: MonaSans for Latin (English) and MiSans for Chinese, with system defaults as the final fallback. Hierarchy is carried entirely by size and colour, never by weight. Writing 300, 500, 600 or 700 resolves to 400, so such declarations are effectively no-ops.
Light and dark share one source
light-dark() keeps every colour declared once inside :root. Numeric values such as shadow geometry cannot be switched by light-dark(), so they are extracted into custom properties and swapped wholesale in the dark blocks.
Every value comes from a token
Colours, type sizes, radii, shadows, durations and stacking levels may only reference tokens — never literals. A literal is invisible to every refactor, so it quietly survives into the next redesign.
Legibility outranks looks
When contrast fails, the value changes. That is why each brand colour is split into three: primary for decoration, ink for small text, solid for filled surfaces. One value serving two roles is guaranteed to fail one of them.
Design tokens
The namespace prefix is --liu-. The values below are parsed from src/styles/global.css at build time — var() chains are resolved and light-dark() is split into a light and a dark column. What you read is what the implementation actually computes, not a transcription that may already be stale.
Brand colour trio
Every scheme splits its brand colour into three roles. Sharing one value is guaranteed to fail one of them: "dark enough to read as small text" and "heavy enough to carry white text" are opposing requirements.
Teal Stream
Token
Soft light
Deep dark
Used for
--liu-primary
#0d9488
same
Decorative fills, large headings, icons, swatches — never small text
--liu-primary-ink
#0f766e
#2dd4bf
The substitute that carries small text (≤18px); resolves differently per theme
--liu-primary-solid
#0f766e
same
Background for filled buttons and badges; pair with white text
Azure Eye
Token
Soft light
Deep dark
Used for
--liu-primary
#0ea5e9
same
Decorative fills, large headings, icons, swatches — never small text
--liu-primary-ink
#0369a1
#38bdf8
The substitute that carries small text (≤18px); resolves differently per theme
--liu-primary-solid
#0369a1
same
Background for filled buttons and badges; pair with white text
Violet Galaxy
Token
Soft light
Deep dark
Used for
--liu-primary
#8b5cf6
same
Decorative fills, large headings, icons, swatches — never small text
--liu-primary-ink
#6d28d9
#a78bfa
The substitute that carries small text (≤18px); resolves differently per theme
--liu-primary-solid
#6d28d9
same
Background for filled buttons and badges; pair with white text
Accent colours
Fixed across schemes and used for multi-colour contexts: category tabs, badges, status dots, icon plates. Each scheme ships its own non-overlapping set so two near-identical hues never appear in one view.
Four greys, ordered from the deepest page base to the brightest panel. Neumorphism only reads when the base is not pure white, so the page sits on a slightly cool grey rather than #FFFFFF.
Token
Soft light
Deep dark
Used for
--liu-page
#ecf0f3
#1a1c1f
Page base — rarely visible directly, covered by banner and cards
--liu-surface
#eef1f4
#212428
Control and panel base, one step away from the page
--liu-panel
#fdfefe
#2a2e33
Card and overlay base, the brightest tier
--liu-hover
#e2e8ec
#2c3036
Hover fill and recess lining
Text levels
Four text colours ordered by lightness: heading, card body, body, muted. Each level must clear contrast on four different backgrounds, so judgements use the worst pairing rather than the page base alone.
Token
Soft light
Deep dark
Used for
--liu-heading
#1e2125
#ffffff
Headings and emphasised text
--liu-body
#626771
#878e99
Muted text and metadata
--liu-card
#3c3e41
#c4cfde
Body copy inside cards and list items
--liu-line
#dce1e4
#121415
Dividers and outlines
Comment area interface
This is the colour interface for Artalk, a third-party component. Every value derives from the site tokens above, so the comment area follows both theme and scheme automatically. Change this group to restyle it — never override Artalk’s own classes.
Token
Soft light
Deep dark
--liu-atk-main
#0f766e
#2dd4bf
--liu-atk-main-solid
#0f766e
same
--liu-atk-bg
#eef1f4
#212428
--liu-atk-bg-alt
#e2e8ec
#2c3036
--liu-atk-font
#1e2125
#ffffff
--liu-atk-meta
#626771
#878e99
--liu-atk-border
#dce1e4
#343a41
Type scale
Two floors define the whole scale: body text never drops below 14px and headings never below 18px. Chinese glyphs occupy more space than Latin letters at the same size, so the entire scale sits one step above a typical Latin layout.
Token
Soft light
Deep dark
Used for
--text-2xs
0.875rem
same
Body floor: eyebrows, metadata, tags
--text-xs
0.9375rem
same
Supporting text
--text-sm
1rem
same
Default body copy
--text-base
1.0625rem
same
Slightly larger body copy
--text-lg
1.125rem
same
Heading floor: h4–h6, emphasised lede
--text-xl
1.25rem
same
h3
--text-2xl
1.5rem
same
h2 and section titles
--text-3xl
1.875rem
same
h1
--text-4xl
2.375rem
same
Large figures and display titles
--text-5xl
3rem
same
Display tier
--text-display
clamp(1.875rem, 1rem + 2vw, 3.25rem)
same
Home hero title: fluid clamp, ceiling set by the current copy length
Font stacks
Fonts are self-hosted subsets rather than a third-party CDN — first paint should not hand control to someone else’s server.
Code labels: Mona Sans Mono, CJK falling through to MiSans
Radius scale
Six steps, chosen by the size of the element rather than the page. Before consolidating, ten different values were in use and equivalent controls disagreed with each other — the kind of drift that looks fine on any single screen and only shows up when you see them together. The only exception is 50% (a true circle): dots and avatars have no step of their own and keep a raw value.
Token
Soft light
Deep dark
Used for
--liu-radius-2xs
4px
same
Inline code, focus rings and other micro elements
--liu-radius-xs
6px
same
Navigation items and indicator blocks
--liu-radius-sm
10px
same
Buttons, inputs, code blocks — the workhorse for small controls
--liu-radius-md
14px
same
Cards, panels, images — the workhorse for large surfaces
--liu-radius-lg
18px
same
Large cards, drawers, overlays
--liu-radius-full
999px
same
Pills, capsules, rounded tracks
Depth shadows
Light always comes from the top-left: outer shadows fall to the bottom-right, inner shadows are reversed. The same offsets barely register on a dark substrate, so the dark geometry is scaled up a tier — implemented by swapping custom properties, while colours still come from light-dark().
Three durations, chosen by what is moving rather than by how long it should feel. Two easings: one that decelerates at both ends for hover round-trips, one that eases out only for one-shot entrances. Keyframe animations run on their own clock and do not use these tiers. One raw value survives — the cubic-bezier(0.33, 1, 0.4, 1) that drives the nav indicator’s width and height. That curve is the indicator’s own motion signature and matches neither easing above.
Token
Soft light
Deep dark
Used for
--liu-dur-fast
0.2s
same
Micro feedback: colour, icons, opacity
--liu-dur-panel
0.3s
same
Panel tier: mask fade, drawer slide, tooltips
--liu-dur-base
0.4s
same
Default: shadow depth, translation, hover lift
--liu-ease
cubic-bezier(0.22, 0.61, 0.36, 1)
same
Eases at both ends; for round-trip shape changes
--liu-ease-out
cubic-bezier(0.16, 1, 0.3, 1)
same
Eases out only; for one-shot entrances
Stacking order
Six semantic levels instead of raw z-index values. Gaps are left between them so future layers can be inserted without renumbering. Three hard constraints: the drawer sits above the mask, secondary panels sit between the two, and the sticky nav yields to every overlay. The exception is local sub-stacking inside a component (-1 / 0 / 1 / 2): that is the order of layers within a single element, such as an icon sitting on its own background, so it does not take a global step.
Token
Soft light
Deep dark
Used for
--liu-z-sticky
30
same
Sticky navigation
--liu-z-fab
35
same
Back-to-top button
--liu-z-bottomnav
40
same
Mobile bottom bar
--liu-z-mask
45
same
Shared scrim
--liu-z-panel
50
same
Panels above the scrim
--liu-z-overlay
60
same
Drawers and dropdown menus
Layout shell
A two-column shell: a fixed-width left column for the card and a fluid right column for navigation plus content. Centring happens in two layers — the shell centres the whole pair, then the content column centres itself. With only the first layer, the two sides never show symmetric whitespace.
Token
Soft light
Deep dark
Used for
--liu-container-max
1360px
same
Shell width: card and content centred as a pair
--liu-container-pad
16px
same
Minimum side padding of the shell
--liu-shell-side
300px
same
Width of the left card slot
--liu-shell-gap
32px
same
Gap between columns and vertical page padding
--liu-content-max
880px
same
Reading width of the content column
--liu-sticky-gap
20px
same
Sticky offset shared by both pinned elements
--liu-mobile-nav-h
50px
same
Mobile bottom bar height (excluding safe area)
--liu-banner-h
400px
same
Desktop banner height — the card offset and collapse trigger key off it
--liu-banner-h-mobile
250px
same
Banner height on narrow viewports (hidden there by design)
Tailwind utility mapping
This group is the outbound edge of the tokens above: @theme inline exposes them as utility classes whose values point at the upstream tokens. Written as constants instead, the utilities would stop following a scheme switch. Prefer utilities inside components and reserve the semantic classes for styles that appear as a group.
Token
Soft light
Deep dark
--color-page
#ecf0f3
#1a1c1f
--color-surface
#eef1f4
#212428
--color-panel
#fdfefe
#2a2e33
--color-hover
#e2e8ec
#2c3036
--color-ink
#1e2125
#ffffff
--color-body
#3c3e41
#c4cfde
--color-muted
#626771
#878e99
--color-line
#dce1e4
#121415
--color-brand
#0d9488
same
--color-brandink
#0f766e
#2dd4bf
--color-secondary
#f59e0b
same
--color-accent-1
#84cc16
same
--color-accent-2
#14b8a6
same
--color-accent-3
#06b6d4
same
--color-accent-4
#f97316
same
Measured contrast
Ratios are computed from the site tokens rather than copied from a reference. Three judging standards apply and must not be mixed: large text has a lower bar than body copy, and non-text graphics only need 3:1. Because this site ships a single 400 weight, the WCAG clause for "≥18.66px and bold" never applies — only ≥24px counts as large text here.
Colour scheme
Foreground / background
Soft light
Deep dark
Result
Teal Stream
Brand primary · icons and fills
3.27:1Pass
4.56:1Pass
Brand primary · icons and fills
Azure Eye
Brand primary · icons and fills
2.42:1Fail
6.16:1Pass
Brand primary · icons and fills
Violet Galaxy
Brand primary · icons and fills
3.69:1Pass
4.03:1Pass
Brand primary · icons and fills
Teal Stream
Brand primary · large headings (≥24px)
3.27:1AA
4.56:1AAA
Brand primary · large headings (≥24px)
Azure Eye
Brand primary · large headings (≥24px)
2.42:1Fail
6.16:1AAA
Brand primary · large headings (≥24px)
Violet Galaxy
Brand primary · large headings (≥24px)
3.69:1AA
4.03:1AA
Brand primary · large headings (≥24px)
Teal Stream
Brand small-text tier · body copy
4.78:1AA
9.17:1AAA
Brand small-text tier · body copy
Azure Eye
Brand small-text tier · body copy
5.18:1AA
7.97:1AAA
Brand small-text tier · body copy
Violet Galaxy
Brand small-text tier · body copy
6.20:1AA
6.27:1AA
Brand small-text tier · body copy
Teal Stream
Filled button · white text
5.47:1AA
5.47:1AA
Filled button · white text
Azure Eye
Filled button · white text
5.93:1AA
5.93:1AA
Filled button · white text
Violet Galaxy
Filled button · white text
7.10:1AAA
7.10:1AAA
Filled button · white text
Foreground / background
Soft light
Deep dark
Result
Heading colour
14.10:1AAA
17.08:1AAA
Heading colour
Muted text colour
4.96:1AA
5.17:1AA
Muted text colour
Card body colour (on card surface)
10.62:1AAA
8.67:1AAA
Card body colour (on card surface)
Components
Each component documents three things: the classes you call, the variants and states it has, and the rules for when not to use it. The examples are the real components rather than screenshots, so what you interact with here matches the build exactly.
Typography
Page text is built from headings, section titles, ledes, eyebrows and body copy. All body text runs through .liu-prose, which owns the reader font scaling and the inline element styles; heading levels differ only by size and colour.
One per page. The home hero switches to text-display for fluid sizing
h2 section title
Pair with .liu-section-title; add .liu-section-lead below for a lede
.liu-eyebrow
14px eyebrow with widened tracking, for the category word above a title
.liu-prose body
Carries paragraphs, lists, quotes, code and tables; its size can be scaled globally through an external variable
Rules
Body text stays at or above 14px and headings at or above 18px — neither floor is negotiable
Express hierarchy with size and colour only; never bold
One h1 per page, and never skip a level (no h4 straight after an h2)
Heading 1 / 主标题
Heading 2 / 区块标题
Heading 3 / 子标题
Eyebrow · 眉标
This interface is built on the vocabulary of neumorphism (so…
text-2xstext-xstext-smtext-basetext-lgtext-xl
brandsecondaryaccent-1accent-2accent-3accent-4
Buttons
A filled button carries the page’s primary action; an outlined button carries the secondary action next to it. Both share the geometry and motion of .liu-btn and differ only in colour, so tiers and radii cannot drift apart.
Classesliu-btnliu-btn--primaryliu-btn--ghost
Variants & states
Default
Raised shadow, sitting above the base
Hover
Lifts one tier; filled buttons gain a brand glow
Pressed
Shadow flips to recessed, as if pushed in
Disabled
Translucent and flattened; cursor becomes not-allowed
Rules
Never place more than one primary button in a single view
Label buttons with the action itself, not with generic words like OK or Submit
A disabled state must also explain why; greying out alone is not enough
Icon buttons
Round icon buttons drive the appearance, scheme and language switches in the top bar. The glyph itself takes the brand colour while the control only lays down a faint brand wash beneath it — the site-wide icon convention, expressing state through colour rather than through background swaps.
Classesliu-iconbtn
Variants & states
Default
Neutral glyph, no plate
Hover / focus
Glyph turns brand colour; a faint brand wash appears under it
Active
Marked with aria-pressed="true"; the plate becomes solid
Disabled
Same construction as buttons: translucent and flattened
Rules
aria-label is mandatory — a glyph carries no readable text of its own
Add aria-hidden to purely decorative icons so screen readers do not announce gibberish
The hit area stays at least 44×44px and is never adjusted per instance
Pill tags
Capsule-shaped tags label affiliations, categories and statuses. Selection is expressed through aria-pressed and the styling follows the attribute, keeping state in the semantics rather than in a swapped class name.
Classesliu-pill
Variants & states
Default
Outlined capsule sharing the page base
Hover
Fill switches to the hover tier
Active
Brand outline plus a faint brand wash
Rules
Keep tag labels to six characters or fewer
Display or single-select only; never carry multi-select logic
标签Label
Form controls
Inputs, textareas, switches and sliders. Every control is recessed by default: a recess reads as "you can type here", a raised surface reads as "you can click this". On focus the recess stays and a brand outline is layered on top, rather than flattening the recess away.
Every control needs an associated <label>; placeholder text is not a label
Mark required fields on the label instead of stacking asterisks
Place validation messages in the .liu-field__hint slot so the form height does not jump
Cards
The basic neumorphic container: a raised shadow over the panel base. When the whole card is clickable it is an <a> rather than a div with a click handler — the anchor is focusable, opens in a new tab from the context menu, and is announced as a link.
The top bar floats and sticks to the top of the content column: five primary destinations on the left, three switches (appearance, scheme, language) on the right. The current page is marked with aria-current="true", and the sliding indicator follows it.
Text turns brand colour; a faint wash appears beneath
Current page
Brand-coloured text with the indicator parked underneath
Narrow viewport
Collapses into the mobile bottom bar, reusing the same data
Rules
Navigation data lives only in site.*.ts; each locale writes its own labels while sharing one icon set
Adding a menu item requires adding its code point to icons.css, otherwise the icon silently renders blank
Mark the current page with aria-current only; do not invent an active class
Category tabs
Category switching for works and projects, implemented in pure CSS: a set of hidden radio inputs plus :has(:checked) matching the corresponding panel. No JavaScript is involved, so it still works with JS disabled or after a reload.
The share entry point on detail pages, sitting after the article body and before the previous/next navigation, centred across the column. Weibo, QQ and X use their own share protocols; WeChat and Instagram have no web share protocol, so those two copy the link instead — deliberately styled identically so the difference is invisible.
A confirmation strip appears below and fades after two seconds
Rules
Detail pages only. A list page has no single item to share, so the bar is omitted there
Any new channel must work without a login and without an SDK
Share with friends
Page banner
A full-width banner image caps each page — a forest in light mode, a planet in dark mode, both self-hosted. Every page has one on desktop; it is hidden on narrow viewports by design so the first screen is not pushed down by a large image.
Classesliu-bannerliu-banner__bg
Variants & states
Soft light
The forest image, open and airy
Deep dark
The planet image with one tier of brightness suppression
Narrow viewport
The whole banner is hidden
Rules
Set the height only through --liu-banner-h: the sidebar card offset and collapse trigger both key off it
Replacing the image means updating the preload and preserving the aspect ratio, or the first paint will jump
Soft LightDeep Dark
Sidebar card & outline
On desktop the left column is permanent: a card on top (portrait, name, role, bio, social and sibling-site links) and the article outline below. Once you scroll past the banner the whole card collapses into frosted glass showing only the outline — the card answers "who is this" first, then makes way for navigation.
Derive the collapse threshold from the measured banner height; never hard-code a number
Every outline entry must map to a heading on the page, and anchor ids must stay unique
Comments
An Artalk-powered comment area whose colours are wired into the token system through a set of --liu-atk-* tokens, with the neumorphic shadows fed into it as well. Both script and stylesheet are lazy: they are injected only within 400px of the comment area, keeping it off the critical path.
Classesliu-artalkliu-artalk-placeholderatk-*
Variants & states
Not in viewport
A placeholder card shows an explanatory message
Within 400px
Assets are injected and the comment area renders
Load failure
The placeholder stays; reading is never blocked
Rules
Restyle the comment area only through --liu-atk-* tokens; never override Artalk’s own class names
Scope pageKey by content: all three languages of one article share one key (a single merged thread), and different content must never collide
Pass pageKey as a site-root-relative path (e.g. /projects/reverse-clock), never a bare slug — Artalk derives the admin jump URL from that key, and a bare slug yields a 404 path
Footer
The left side is the copyright and stack in one sentence; the right side is the ICP filing number. That number is an official registration, so it is reproduced verbatim in every locale without conversion, and it must remain clickable because the regulator requires a verifiable link.
Never translate, reword, or reduce the filing number to non-clickable text
The copyright year is fixed content rather than a translation; all locales share one value
Accessibility
Accessibility is not a finishing step — it constrains the design tokens themselves. The brand colour is split into three roles precisely because measurement showed a single value failing. Each item below maps to a concrete implementation rather than a statement of intent.
Contrast judged by role
Body copy and labels need 4.5:1; large text (≥24px) and non-text graphics need 3:1. The three standards must not be mixed: judging the brand colour as body text concludes it is unusable, while judging it as a graphic reflects how it is actually applied. Every ratio is computed from the tokens, so changing a colour re-runs the verdict.
Keyboard reachable throughout
Every interactive element is a native <button>, <a> or <input>; nothing is faked with a div. Fully clickable cards wrap an <a> instead of attaching a click handler, so they are focusable, activatable with Enter, and openable in a new tab.
Focus visible and never clipped
:focus-visible consistently paints a brand-coloured outer ring. Inside containers that clip with overflow, the ring is drawn on the inside instead so half of it cannot be cut away.
System motion preference respected
When the system asks for reduced motion, decorative animation such as the keyword carousel and scan line stops while necessary transitions remain. A separate first-paint guard disables all transitions for the initial frame so drawers cannot flash in from their default position.
Language and semantics declared
<html lang> follows the active locale and each of the three is labelled. Decorative icons are always aria-hidden, while graphics that carry meaning are replaced by text with a supporting description rather than being left to speak for themselves. Switching locale is remembered: the next visit to a prefix-less address returns to the locale you last picked — but only once you have explicitly picked one. Default-language pages are never negotiated from the browser language, so everyone (crawlers included) gets the same content.
Engineering conventions
The fixed routine when a new request arrives. These steps are not ceremony — each one exists because something went wrong in a specific way: styles vanishing site-wide, locales drifting apart, old paths 404ing, and structural checks passing while the site was broken.
Adding a page
The shell and the content are separate: content lives in src/components/pages/, route files only forward to it, and each locale gets its own thin shell.
01
Write the content component
Create the component under src/components/pages/ taking a locale prop. The sidebar, top bar and footer are assembled by BaseLayout.
02
Add three shells
src/pages/docs.astro, tw/docs.astro and en/docs.astro each forward with one line, so three implementations cannot drift apart.
03
Register the navigation entry
Add the item to site.zh, site.tw and site.en, and confirm the code point for nav[].icon is declared in icons.css.
04
Add a legacy redirect
If a path is renamed, add a rule to redirects in astro.config.mjs. It catches inbound external links only; internal links always use the new path.
Keeping locales in sync
The only thing allowed to differ between locales is the copy. Structure, order and class names are shared, and the type system enforces it.
01
Copy goes into locale files
Page copy belongs in docs.zh / tw / en or i18n/ui.ts; structure belongs in the skeleton file. Miss one entry and the Record type fails the build.
02
Traditional Chinese follows local usage
It is not a character-by-character conversion: 軟件 becomes 軟體 and 數字化 becomes 數位化. Check existing translations for terminology before coining anything new.
03
English uses full sentences
Do not translate Chinese noun phrases word for word; rewriting them as complete sentences is what keeps the English page readable.
Styles and tokens
Before adding a value, ask: is this the third place the same number appears? If so, it should become a token.
01
No literal values
Colours, type sizes, radii, shadows, durations and stacking levels must reference tokens. If a genuinely new value is needed, add the token first and reference it from the component.
02
Know which layer a style belongs to
Site-wide semantic classes live in @layer components in global.css; styles used by a single component live in that component’s <style>, which is scoped automatically.
03
Mind the cascade
An Astro component <style> is unlayered and therefore always beats a same-specificity rule inside @layer components. Anything meant to be overridable must not live in a component.
Checks before committing
These commands cover the three ways a build can succeed while the deployed site is broken. Skipping any one of them risks shipping the problem.
01
Type and structure check
npm run check covers content collections, component props, i18n fields and the token parser.
02
Build
npm run build runs two extra build-time assertions: the output must carry styles (guarding against an unstyled deploy), and the token parser must return a plausible number of tokens.
03
Output assertions
node .workbuddy/check.mjs runs all assertions over routes, class names, copy and geometry in the built output plus two pure-logic suites, catching "changed it, broke it, no error" locally.
04
Verify in a real browser
For layout or interaction changes, re-check geometry and state in a headless browser. Static assertions cannot detect overlapping text, misalignment, or a panel that never shows.
Routes and legacy paths
The new path is the single source of truth. The redirects table only ever shrinks; once inbound links disappear it can be deleted wholesale.
01
Renaming a path
Three things together: change the route file, update every internal link, and add redirects for all three locales.
02
Never add new pages to the redirect table
New pages get their route directly at the new path and stay out of redirects.
03
Redirect stubs stay out of the sitemap
Astro generates stubs with noindex and a canonical pointing at the new path, and the sitemap only lists real routes.