Docs

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

TokenSoft lightDeep darkUsed for
--liu-primary#0d9488sameDecorative fills, large headings, icons, swatches — never small text
--liu-primary-ink#0f766e#2dd4bfThe substitute that carries small text (≤18px); resolves differently per theme
--liu-primary-solid#0f766esameBackground for filled buttons and badges; pair with white text

Azure Eye

TokenSoft lightDeep darkUsed for
--liu-primary#0ea5e9sameDecorative fills, large headings, icons, swatches — never small text
--liu-primary-ink#0369a1#38bdf8The substitute that carries small text (≤18px); resolves differently per theme
--liu-primary-solid#0369a1sameBackground for filled buttons and badges; pair with white text

Violet Galaxy

TokenSoft lightDeep darkUsed for
--liu-primary#8b5cf6sameDecorative fills, large headings, icons, swatches — never small text
--liu-primary-ink#6d28d9#a78bfaThe substitute that carries small text (≤18px); resolves differently per theme
--liu-primary-solid#6d28d9sameBackground 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.

Teal Stream

TokenSoft lightDeep darkUsed for
--liu-secondary#f59e0bsameSecondary emphasis: callouts, secondary comparisons
--liu-accent-c1#84cc16sameFirst colour in multi-colour contexts
--liu-accent-c2#14b8a6sameSecond colour in multi-colour contexts
--liu-accent-c3#06b6d4sameThird colour in multi-colour contexts
--liu-accent-c4#f97316sameFourth colour in multi-colour contexts

Azure Eye

TokenSoft lightDeep darkUsed for
--liu-secondary#6366f1sameSecondary emphasis: callouts, secondary comparisons
--liu-accent-c1#3b82f6sameFirst colour in multi-colour contexts
--liu-accent-c2#06b6d4sameSecond colour in multi-colour contexts
--liu-accent-c3#8b5cf6sameThird colour in multi-colour contexts
--liu-accent-c4#d946efsameFourth colour in multi-colour contexts

Violet Galaxy

TokenSoft lightDeep darkUsed for
--liu-secondary#d946efsameSecondary emphasis: callouts, secondary comparisons
--liu-accent-c1#a855f7sameFirst colour in multi-colour contexts
--liu-accent-c2#ec4899sameSecond colour in multi-colour contexts
--liu-accent-c3#f43f5esameThird colour in multi-colour contexts
--liu-accent-c4#6366f1sameFourth colour in multi-colour contexts

Surface levels

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.

TokenSoft lightDeep darkUsed for
--liu-page#ecf0f3#1a1c1fPage base — rarely visible directly, covered by banner and cards
--liu-surface#eef1f4#212428Control and panel base, one step away from the page
--liu-panel#fdfefe#2a2e33Card and overlay base, the brightest tier
--liu-hover#e2e8ec#2c3036Hover 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.

TokenSoft lightDeep darkUsed for
--liu-heading#1e2125#ffffffHeadings and emphasised text
--liu-body#626771#878e99Muted text and metadata
--liu-card#3c3e41#c4cfdeBody copy inside cards and list items
--liu-line#dce1e4#121415Dividers 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.

TokenSoft lightDeep dark
--liu-atk-main#0f766e#2dd4bf
--liu-atk-main-solid#0f766esame
--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.

TokenSoft lightDeep darkUsed for
--text-2xs0.875remsameBody floor: eyebrows, metadata, tags
--text-xs0.9375remsameSupporting text
--text-sm1remsameDefault body copy
--text-base1.0625remsameSlightly larger body copy
--text-lg1.125remsameHeading floor: h4–h6, emphasised lede
--text-xl1.25remsameh3
--text-2xl1.5remsameh2 and section titles
--text-3xl1.875remsameh1
--text-4xl2.375remsameLarge figures and display titles
--text-5xl3remsameDisplay tier
--text-displayclamp(1.875rem, 1rem + 2vw, 3.25rem)sameHome 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.

TokenSoft lightDeep darkUsed for
--font-sans'MonaSans', 'MiSans', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serifsameLatin MonaSans + Chinese MiSans: MonaSans covers Latin only, Chinese falls through to MiSans, then system fallback
--font-mono'MonaSans Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'MiSans', monospacesameCode 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.

TokenSoft lightDeep darkUsed for
--liu-radius-2xs4pxsameInline code, focus rings and other micro elements
--liu-radius-xs6pxsameNavigation items and indicator blocks
--liu-radius-sm10pxsameButtons, inputs, code blocks — the workhorse for small controls
--liu-radius-md14pxsameCards, panels, images — the workhorse for large surfaces
--liu-radius-lg18pxsameLarge cards, drawers, overlays
--liu-radius-full999pxsamePills, 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().

TokenSoft lightDeep darkUsed for
--liu-shadow-out5px 5px 15px #d1d9e65px 5px 15px #1c1e22Raised: cards and panels
--liu-shadow-out-sm3px 3px 9px #d1d9e63px 3px 9px #1c1e22Slightly raised: small elements
--liu-shadow-in1px 4px 2px -3px rgb(0 0 0 / 0.12) inset, -1px -3px 3px -2px rgb(255 255 255 / 0.9) inset1px 4px 2px -3px rgb(0 0 0 / 0.7) inset, -1px -3px 3px -2px rgb(255 255 255 / 0.2) insetFine recess: inputs, switch tracks
--liu-shadow-in-lginset 5px 5px 12px #d1d9e6, inset -5px -5px 12px #ffffffinset 5px 5px 12px #181a1d, inset -5px -5px 12px #202225Deep recess: pressed states
--liu-shadow-float0 12px 32px rgb(31 45 61 / 0.13)0 12px 32px rgb(0 0 0 / 0.45)One-directional shadow for hover lift
--liu-shadow-accent0 6px 14px -8px color-mix(in srgb, #0d9488 90%, transparent)sameBrand glow for small elements
--liu-shadow-accent-lg0 14px 26px -12px color-mix(in srgb, #0d9488 75%, transparent)sameBrand glow for round buttons on hover

Motion

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.

TokenSoft lightDeep darkUsed for
--liu-dur-fast0.2ssameMicro feedback: colour, icons, opacity
--liu-dur-panel0.3ssamePanel tier: mask fade, drawer slide, tooltips
--liu-dur-base0.4ssameDefault: shadow depth, translation, hover lift
--liu-easecubic-bezier(0.22, 0.61, 0.36, 1)sameEases at both ends; for round-trip shape changes
--liu-ease-outcubic-bezier(0.16, 1, 0.3, 1)sameEases 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.

TokenSoft lightDeep darkUsed for
--liu-z-sticky30sameSticky navigation
--liu-z-fab35sameBack-to-top button
--liu-z-bottomnav40sameMobile bottom bar
--liu-z-mask45sameShared scrim
--liu-z-panel50samePanels above the scrim
--liu-z-overlay60sameDrawers 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.

TokenSoft lightDeep darkUsed for
--liu-container-max1360pxsameShell width: card and content centred as a pair
--liu-container-pad16pxsameMinimum side padding of the shell
--liu-shell-side300pxsameWidth of the left card slot
--liu-shell-gap32pxsameGap between columns and vertical page padding
--liu-content-max880pxsameReading width of the content column
--liu-sticky-gap20pxsameSticky offset shared by both pinned elements
--liu-mobile-nav-h50pxsameMobile bottom bar height (excluding safe area)
--liu-banner-h400pxsameDesktop banner height — the card offset and collapse trigger key off it
--liu-banner-h-mobile250pxsameBanner 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.

TokenSoft lightDeep 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#0d9488same
--color-brandink#0f766e#2dd4bf
--color-secondary#f59e0bsame
--color-accent-1#84cc16same
--color-accent-2#14b8a6same
--color-accent-3#06b6d4same
--color-accent-4#f97316same

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 schemeForeground / backgroundSoft lightDeep darkResult
Teal StreamBrand primary · icons and fills3.27:1Pass4.56:1PassBrand primary · icons and fills
Azure EyeBrand primary · icons and fills2.42:1Fail6.16:1PassBrand primary · icons and fills
Violet GalaxyBrand primary · icons and fills3.69:1Pass4.03:1PassBrand primary · icons and fills
Teal StreamBrand primary · large headings (≥24px)3.27:1AA4.56:1AAABrand primary · large headings (≥24px)
Azure EyeBrand primary · large headings (≥24px)2.42:1Fail6.16:1AAABrand primary · large headings (≥24px)
Violet GalaxyBrand primary · large headings (≥24px)3.69:1AA4.03:1AABrand primary · large headings (≥24px)
Teal StreamBrand small-text tier · body copy4.78:1AA9.17:1AAABrand small-text tier · body copy
Azure EyeBrand small-text tier · body copy5.18:1AA7.97:1AAABrand small-text tier · body copy
Violet GalaxyBrand small-text tier · body copy6.20:1AA6.27:1AABrand small-text tier · body copy
Teal StreamFilled button · white text5.47:1AA5.47:1AAFilled button · white text
Azure EyeFilled button · white text5.93:1AA5.93:1AAFilled button · white text
Violet GalaxyFilled button · white text7.10:1AAA7.10:1AAAFilled button · white text
Foreground / backgroundSoft lightDeep darkResult
Heading colour14.10:1AAA17.08:1AAAHeading colour
Muted text colour4.96:1AA5.17:1AAMuted text colour
Card body colour (on card surface)10.62:1AAA8.67:1AAACard 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.

Classesliu-proseliu-section-titleliu-section-leadliu-eyebrowtext-display

Variants & states

h1 title
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.

Classesliu-fieldliu-field__labelliu-field__hintliu-inputliu-textarealiu-switchliu-slider

Variants & states

Default
Recessed, as if pressed into the panel
Focus
Recess kept, brand outline layered on top
Pressed
Recess deepens one tier
Disabled
Barely-there recess, translucent text

Rules

  • 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.

Classesliu-cardliu-card--linkliu-card__titleliu-card__bodyliu-icon-box

Variants & states

.liu-card
Base card carrying content
.liu-card--link
Fully clickable, lifts on hover
.liu-icon-box
Square icon plate inside a card

Rules

  • Use an <a> for fully clickable cards so keyboard access and "open in new tab" keep working
  • Never nest a card inside a card; use a divider when you need grouping
  • Cards visible together must share the same radius and shadow tier

普通卡片

外凸阴影加面板底色,新拟物的基础承载体。

可点击卡片

整卡是 <a>,所以键盘可达、可右键新窗口打开。

Navigation

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.

Classesliu-contentnavliu-navliu-nav-linkliu-nav-link__icon

Variants & states

Default
Text plus icon in a neutral colour
Hover
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.

Classesliu-worksliu-works__tabliu-works__panelliu-works__card

Variants & states

Default
Tabs laid out on one line
Selected
The matching panel is shown and the rest hidden
Narrow viewport
Tabs scroll horizontally instead of wrapping

Rules

  • Each radio must be paired with its panel explicitly — :has() cannot express "the Nth pairs with the Nth"
  • A new category needs both a :has() rule and a matching data-panel; miss either and that category stays permanently blank
Work categories

Documentaries, brand films, web series and short films — as director, episode director, cinematographer and sound designer.

Independent photography documenting cities, people and the play of light.

AI artwork generation and multimodal interactive digital humans, exploring where algorithms meet aesthetics.

Self-designed, self-operated online platforms, plus two software copyrights.

Digital products

A grid of digital products, each card carrying an app icon, name, description and an arrow. The whole card is an external link and opens in a new tab.

Classesliu-product-gridliu-product-cardliu-product-card__logo

Variants & states

Default
Raised card with a brand-washed icon plate
Hover
The card lifts and the arrow shifts

Rules

  • External links always carry rel="noopener noreferrer"
  • App icons sit in a fixed-size container so differing aspect ratios cannot break the card

Share bar

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.

Classesliu-shareliu-share__titleliu-share__listliu-share__tip

Variants & states

Default
Five round icon buttons, centred
Copied
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 Light
Deep 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.

Classesliu-side__cardliu-side__bioliu-side__tocliu-side__toc-titleliu-side__link

Variants & states

Desktop · top
Card expanded, floating over the banner
Desktop · past threshold
Collapsed to frosted glass showing the outline
Narrow viewport
Moves into a drawer opened from the bottom bar

Rules

  • 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

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  1. 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.

  2. 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.

  3. 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.

  1. 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.

  2. 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.

  3. 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.

  1. Type and structure check

    npm run check covers content collections, component props, i18n fields and the token parser.

  2. 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.

  3. 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.

  4. 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.

  1. Renaming a path

    Three things together: change the route file, update every internal link, and add redirects for all three locales.

  2. Never add new pages to the redirect table

    New pages get their route directly at the new path and stay out of redirects.

  3. 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.