# Liquid Glass (`liquid-glass`)

> A Changbai Mountains spring water bottled in glass: a water-filled bottle stands in front of the snowy spring and flips the scene behind it; the headline is the brand name, the buttons are basalt, and clear glass sits only over the photographs and the dark water.

This is a worked example: one concept, built for one fictional client. Study how its concept turned into decisions and borrow the craft. Do not ship its surface (palette, motifs, component looks) for a different client unless your own concept, drawn from that client's world, leads to the same place.

- Chinese name: 液态玻璃. 长白山一家玻璃瓶矿泉水的网站：泉口雪景前立着一只装满泉水的瓶子，隔着瓶身看，景物左右颠倒；标题就是品牌名，按钮用玄武岩黑，清玻璃只放在照片和深色水面上。
- Category: Modern. Tags: Glass, Premium, Calm, Light, Photography, WebGL, Sans-serif.
- Live page: [English](/en/sites/liquid-glass/full/) · [Chinese](/sites/liquid-glass/full/) · [viewer with desktop and mobile views](/en/sites/liquid-glass/)
- Built with Astro, React, TypeScript and Tailwind CSS 4, plus Paper Shaders, Motion, Motion Primitives.

## Where the concept came from

From the bottler's own world: the spring outlet, the glass bottle it fills, the borehole log from the geological survey and each batch's lab report. Hold a filled bottle up to the spring and the snow and rocks behind it flip, squeeze and fringe with colour; the signature and the glass on the page follow those optics, and everything else is laid out the way a good brand site is.

## When it fits

Good for:
- Brands whose product is clear or catches the light (bottled water, spirits, perfume, glassware, eyewear), so the interface can follow the product's optics.
- Clients with one strong place and one object to hold up to it (a spring, a lake, a glacier, a hot spring hotel), so the lens shows their own landscape.
- Consumer goods makers selling to homes, trade accounts and importers at once: one page splits into three paths, each a working tool.

Avoid when:
- Clients without strong photographs: glass needs something behind it to bend, and over a flat colour or gradient it is only a white film.
- Dense dashboards or comparison pages: glass layers and refraction compete with the data, which reads better in flat tables.
- Projects whose visitors are mostly on low-end Android phones, on a tight budget: live refraction needs WebGL, and the fallbacks have to be built as well.

Industry fit (1-5): Creative brand 5, Export factory 3, Attraction 3, Hotel & homestay 3, Artisan 3, Farm produce 3, Tour guide 2, Restaurant 2, Education 1.

## Adapting it to another client

Keep:
- Base the signature on how one real object of the client's handles light: here a filled bottle acting as a cylindrical lens; elsewhere a wine glass, a spectacle lens, an aquarium or a window pane. The lens explains itself, with no 'drag the bottle' hint.
- Put glass only where there is something behind it to bend: the hero photo, the tabs over the window photo, the dark water behind the analysis and the scrolling page. On flat grounds, buttons are solid basalt or outlined.
- Set the brand name and its category as the headline and the navigation's nouns as large section headings (source, water quality, order, hotels and export, contact); give the practical content plain tables: source facts, lab results, delivery days, export spec.
- Keep the colour in the photographs and large grounds: snow and basalt carry the page, every button is basalt, and pool green only marks data.

Change:
- Replace the spring photo, the bottle silhouette and water's refractive index with the client's own scene and object: a winery uses a glass and its vineyard, an optician a lens and the street.
- Snow white, basalt black and pool green come from Changbai's snow, volcanic rock and spring pool; another client takes its colours from its own place.
- Fill in metasilicate, tritium dating, the borehole layers and the source facts from the client's real lab reports and survey data instead of copying these.

## Essentials

- **Color.** Snow #eef2f1 ground, and basalt #13181a for text, for buttons and as the ground of the two dark sections, analysis and contact. Secondary text and table labels #56625f, table rules #d3dcda. Every primary button is basalt with snow text, flipped to snow with basalt text on dark; secondary actions are clear glass capsules over photographs, or outlines on a flat dark ground. Pool green #0c6a61 only marks data (the aquifer, the water path, delivery dots) and draws focus rings, and becomes ice #c4e4df on dark. The rest of the colour comes from the photographs: snow, mist, black basalt and the teal of the spring pool. The glass itself has no colour: a white rim on the lit edge and the faint green of thick glass on the shadow edge.
- **Type.** Chinese in Noto Sans SC Variable: the two characters 玄泉 at 250, 92px on phones and 200px on desktop, with the category line under them at 300; section headings are single nouns (水源, 水质, 订水, 酒店与出口, 联系) at 300 and 44–96px. Body 17px with 1.85 line height. Latin display in Onest Variable at 250 with −0.045em tracking; body in Figtree Variable at 17px and 1.55, with tabular lining figures. Short facts break only at punctuation, and numbers are joined to their units with no-break spaces.
- **Layout.** Designed at 390px first: the first screen is a full-bleed photo of the spring, with the two large characters 玄泉, the category line and two short sentences in the mist at top left, the order and trade-enquiry buttons below, and the bottle standing lower right, clear of the buttons; on an upright tablet the bottle stands beside the copy. Then the source (heading, intro and a five-line fact table on the left, a widened borehole log on the right), the full-width dark water analysis (a clear glass pane over a photo of water on basalt, metasilicate enlarged beside the table), ordering (the three bottles with prices beside the scheduled-delivery builder), hotels and export (opening on a full-bleed photo of a window onto birches, the heading in the mist and the two tabs as a glass capsule on the photo, then terms, delivery days and the export spec), and a full-screen phone number to close. The delivery builder and the enquiry form sit on pale panels with the glass rim but no refraction, since there is nothing behind them to bend. On phones, past the hero, a glass bar with two actions, order and call, appears at the bottom. 12 columns, 4 on phones. No small labels, numbering or live status; hairlines only inside tables.
- **Imagery.** One light: a cold, misty winter morning, natural-light photography graded cool and low in saturation. The snowy spring outlet (landscape and portrait crops) fills the first screen, water over black basalt fills the back of the analysis, a bottle on a stone table by a window opens hotels and export full-bleed, and three bottle sizes stand side by side as the size chart. No text or people; the bottles are plain glass with black caps and no labels.
- **Motion.** One signature moment: the bottle on the first screen is a WebGL cylindrical lens that flips and squeezes the photo behind it with a refractive index per colour channel, its water sloshing as it moves, with specular streaks and a dark rim from total internal reflection. It follows the mouse; on touch it is dragged sideways or drifts with the scroll, with no hint text, and it rests as a still frame with reduced motion. Everything else is short: a 380ms segmented-control slider, sliding price digits and a 400ms fade when a tab changes, all on cubic-bezier(0.32, 0.72, 0, 1).

## Common mistakes

- Turning liquid glass into frosted cards: heavy blur on a white fill is just frosted glass. Clear glass stays transparent in the middle and only its rim bends what is behind, with the three colour channels barely apart; push them and every pill gets a yellow-green fringe.
- Glass over a flat colour: with nothing behind it to bend, it is only a white or black capsule. On flat grounds use solid basalt or an outline, as the copy-WeChat button in the footer does.
- Expecting the SVG displacement backdrop to work everywhere: backdrop-filter: url() only works in Chromium, so Safari and Firefox fall back to clear glass with a 2px soften, and text must stay legible in both.
- Leaving the WebGL loop running: the bottle renders only while it moves and stops once it settles, scrolls out of view or reduced motion is on. Keep every texture sample in uniform control flow, or the refraction sparkles.
- Letting a polished glass page talk too much: a two-beat slogan, sentence headings, a hint telling visitors to drag the bottle, an 'online now' status, and pool-green buttons. The headline is the brand and its category, headings are nouns, the lens needs no instructions and the buttons are basalt.

## Design tokens

| Token | Value | Role |
| --- | --- | --- |
| `--color-snow` | `#eef2f1` | Snow ground |
| `--color-frost` | `#f8faf9` | Supporting |
| `--color-basalt` | `#13181a` | Basalt: text, buttons and dark sections |
| `--color-slate` | `#56625f` | Secondary text and table labels |
| `--color-pool` | `#0c6a61` | Pool green: only data marks (the aquifer, the water path, delivery dots) and focus rings |
| `--color-ice` | `#c4e4df` | Ice: data marks on dark, text selection |
| `--color-line` | `#d3dcda` | Table rules |

Semantic colors with shadcn/ui names, ready for `globals.css`:

```css
:root {
  --background: #eef2f1;
  --foreground: #13181a;
  --primary: #13181a;
  --primary-foreground: #f8faf9;
  --muted: #f8faf9;
  --muted-foreground: #56625f;
  --border: #d3dcda;
  --ring: #0c6a61;
}
```

Fonts. The stacks use Fontsource family names; with Google Fonts or `next/font`, drop the " Variable" suffix. Each npm package holds the CSS and its unicode-range sliced font files. The jsDelivr links are for prototypes only: Google Fonts is blocked in mainland China and jsDelivr is unreliable there, so a production site for mainland visitors bundles the packages, or copies each CSS file with its `files/` folder to its own server or object storage and links that. A Chinese family costs about 100 KB of render-blocking CSS per weight (31 KB gzipped, about 100 slices); browsers then download only the slices for the characters on the page, so link only the weights you use.

- `--font-display`: "Onest Variable", "Noto Sans SC Variable", "PingFang SC", "Microsoft YaHei", ui-sans-serif, sans-serif
- `--font-sans`: "Figtree Variable", "Noto Sans SC Variable", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif
- Onest Variable: `npm install @fontsource-variable/onest`, then `import '@fontsource-variable/onest/wght.css'`. Plain-HTML prototype: `<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/onest@5.3.1/wght.css">`
- Figtree Variable: `npm install @fontsource-variable/figtree`, then `import '@fontsource-variable/figtree/wght.css'`. Plain-HTML prototype: `<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/figtree@5.3.0/wght.css">`
- Noto Sans SC Variable: `npm install @fontsource-variable/noto-sans-sc`, then `import '@fontsource-variable/noto-sans-sc/wght.css'`. Plain-HTML prototype: `<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/noto-sans-sc@5.3.1/wght.css">`

Easing:

- `--ease-glass`: `cubic-bezier(0.32, 0.72, 0, 1)`
- `--ease-settle`: `cubic-bezier(0.22, 1, 0.36, 1)`

Shadows:

- `--shadow-rim`: `inset 0 1px 0 rgb(255 255 255 / 0.7), inset 0 -1px 0 rgb(12 106 97 / 0.22), 0 10px 30px -14px rgb(19 24 26 / 0.45)`

All tokens: [tokens.css](/styles/liquid-glass/tokens.css) · [tokens.json](/styles/liquid-glass/tokens.json)

## Page structure

Screenshots are 1440 × 900 (desktop) and 390 × 844 (mobile) viewports, on the Chinese page unless marked English. Sections taller than the screen, such as pinned scroll chapters, are captured part-way through.

1. **Header** (`:is(body, main) > header`): [components/Header.astro](/sources/liquid-glass/components/Header.astro.txt). Visible in the Hero screenshots
2. **Hero** (`#top`): [components/Hero.astro](/sources/liquid-glass/components/Hero.astro.txt). Screenshots: [desktop](/shots/liquid-glass/top-desktop.jpg) · [mobile](/shots/liquid-glass/top-mobile.jpg) · [desktop, English](/shots/liquid-glass/top-desktop-en.jpg) · [mobile, English](/shots/liquid-glass/top-mobile-en.jpg)
3. **Source** (`#source`): [components/Source.astro](/sources/liquid-glass/components/Source.astro.txt). Screenshots: [desktop](/shots/liquid-glass/source-desktop.jpg) · [mobile](/shots/liquid-glass/source-mobile.jpg) · [desktop, English](/shots/liquid-glass/source-desktop-en.jpg) · [mobile, English](/shots/liquid-glass/source-mobile-en.jpg)
4. **Analysis** (`#analysis`): [components/Analysis.astro](/sources/liquid-glass/components/Analysis.astro.txt). Screenshots: [desktop](/shots/liquid-glass/analysis-desktop.jpg) · [mobile](/shots/liquid-glass/analysis-mobile.jpg) · [desktop, English](/shots/liquid-glass/analysis-desktop-en.jpg) · [mobile, English](/shots/liquid-glass/analysis-mobile-en.jpg)
5. **Order** (`#order`): [components/Order.astro](/sources/liquid-glass/components/Order.astro.txt). Screenshots: [desktop](/shots/liquid-glass/order-desktop.jpg) · [mobile](/shots/liquid-glass/order-mobile.jpg) · [desktop, English](/shots/liquid-glass/order-desktop-en.jpg) · [mobile, English](/shots/liquid-glass/order-mobile-en.jpg)
6. **Trade** (`#trade`): [components/Trade.astro](/sources/liquid-glass/components/Trade.astro.txt). Screenshots: [desktop](/shots/liquid-glass/trade-desktop.jpg) · [mobile](/shots/liquid-glass/trade-mobile.jpg) · [desktop, English](/shots/liquid-glass/trade-desktop-en.jpg) · [mobile, English](/shots/liquid-glass/trade-mobile-en.jpg)
7. **Footer** (`#contact`): [components/Footer.astro](/sources/liquid-glass/components/Footer.astro.txt). Screenshots: [desktop](/shots/liquid-glass/contact-desktop.jpg) · [mobile](/shots/liquid-glass/contact-mobile.jpg) · [desktop, English](/shots/liquid-glass/contact-desktop-en.jpg) · [mobile, English](/shots/liquid-glass/contact-mobile-en.jpg)

## Key components

### BottleLens

The signature: a water-filled glass bottle in front of the spring photo, drawn by Paper Shaders' ShaderMount over just the bottle's box. Below the waterline it is a cylindrical lens with refractive indices of 1.330, 1.333 and 1.337 per channel, and the water sloshes on a spring simulation. It follows the mouse, is dragged or drifts with the scroll on touch, and stands beside the copy on an upright tablet; there is no hint text, and it rests as a still frame with reduced motion.

- Source: [components/BottleLens.tsx](/sources/liquid-glass/components/BottleLens.tsx.txt) (Paper Shaders)
- Also needs: [components/bottle-shader.ts](/sources/liquid-glass/components/bottle-shader.ts.txt), [components/Hero.astro](/sources/liquid-glass/components/Hero.astro.txt)
- Appears in: Hero (`top`)

### Clear glass material

Edge refraction for .glass: three displacement maps stretched per shape (pill, round button, large pane), red and blue carrying the horizontal and vertical shift, a neutral core keeping the middle of each pane clear, and the three colour channels offset slightly for dispersion. Used on the header, the hero trade-enquiry button, the tabs over the window photo, the analysis pane and the phone action bar; enabled only in Chromium, with clear glass and a 2px soften elsewhere.

- Source: [components/GlassDefs.astro](/sources/liquid-glass/components/GlassDefs.astro.txt)
- Also needs: [styles.css](/sources/liquid-glass/styles.css.txt), [components/Header.astro](/sources/liquid-glass/components/Header.astro.txt), [components/Trade.astro](/sources/liquid-glass/components/Trade.astro.txt)
- Appears in: Header (`header`)

### Water quality

A clear glass pane over a photo of water on black basalt: one line with the standard, the laboratory and the sampling month; metasilicate enlarged as the qualifying indicator with the national 30 mg/L minimum drawn on its bar; beside it a table of pH, TDS, calcium, magnesium, sodium and potassium, and a button to request the lab report.

- Source: [components/Analysis.astro](/sources/liquid-glass/components/Analysis.astro.txt)
- Appears in: Analysis (`analysis`)

### Borehole log

The source: on the left the heading, a short intro and a five-line fact table (altitude, temperature, water age, flow, pipeline); on the right the survey's borehole log, each layer's lithology drawn in SVG at its thickness in a widened column, the aquifer tinted ice and a dashed line tracing the water from the snow down to the aquifer.

- Source: [components/Source.astro](/sources/liquid-glass/components/Source.astro.txt)
- Appears in: Source (`source`)

### DeliveryBuilder

Scheduled delivery: size, cases per delivery and frequency, with SlidingNumber rolling the per-delivery and monthly price (5% off for scheduled delivery), then copy the order for WeChat service or order by phone. Beside it, the three bottles with a centimetre ruler and the price per case.

- Source: [components/DeliveryBuilder.tsx](/sources/liquid-glass/components/DeliveryBuilder.tsx.txt) (Motion Primitives)
- Also needs: [components/Order.astro](/sources/liquid-glass/components/Order.astro.txt), [components/ui/sliding-number.tsx](/sources/liquid-glass/components/ui/sliding-number.tsx.txt)
- Built on Motion Primitives `sliding-number` ([components/ui/sliding-number.tsx](/sources/liquid-glass/components/ui/sliding-number.tsx.txt), restyled): `npx shadcn@latest add https://motion-primitives.com/c/sliding-number.json`
- Appears in: Order (`order`)

### Hotels and export

Opens on a full-bleed photo of a window onto snowy birches, the heading in the mist and the hotel and export tabs as a glass capsule on the photo, switched by radio inputs and :has() without JavaScript. Hotels get a terms table, a delivery-day table and a price-list request; export gets a spec table and an enquiry form that composes a subject and body and opens the mail app instead of pretending to submit.

- Source: [components/Trade.astro](/sources/liquid-glass/components/Trade.astro.txt)
- Appears in: Trade (`trade`)

## Dependencies

`npm install @paper-design/shaders motion react-use-measure`

## Source files

Read only what you need:

- [Site.astro](/sources/liquid-glass/Site.astro.txt): the whole page, with fonts, sections and scripts
- [styles.css](/sources/liquid-glass/styles.css.txt): tokens and component classes
- [i18n.ts](/sources/liquid-glass/i18n.ts.txt): all copy, in Chinese and English
- [meta.ts](/sources/liquid-glass/meta.ts.txt): this guide as data
- [components/Header.astro](/sources/liquid-glass/components/Header.astro.txt): section
- [components/Hero.astro](/sources/liquid-glass/components/Hero.astro.txt): section
- [components/Source.astro](/sources/liquid-glass/components/Source.astro.txt): section
- [components/Analysis.astro](/sources/liquid-glass/components/Analysis.astro.txt): section
- [components/Order.astro](/sources/liquid-glass/components/Order.astro.txt): section
- [components/Trade.astro](/sources/liquid-glass/components/Trade.astro.txt): section
- [components/Footer.astro](/sources/liquid-glass/components/Footer.astro.txt): section
- [components/bottle-shader.ts](/sources/liquid-glass/components/bottle-shader.ts.txt)
- [components/BottleLens.tsx](/sources/liquid-glass/components/BottleLens.tsx.txt)
- [components/DeliveryBuilder.tsx](/sources/liquid-glass/components/DeliveryBuilder.tsx.txt)
- [components/GlassDefs.astro](/sources/liquid-glass/components/GlassDefs.astro.txt)
- [type.ts](/sources/liquid-glass/type.ts.txt)
- [components/ui/sliding-number.tsx](/sources/liquid-glass/components/ui/sliding-number.tsx.txt): Motion Primitives `sliding-number`, restyled

Everything in one file: [/sources/liquid-glass.txt](/sources/liquid-glass.txt) (about 29K tokens).

Before building, read the [design guide](/guide.md): the process and rules that apply to every site.
