# Single Div Lab

Illustrations drawn in pure CSS, in the spirit of [a.singlediv.com](https://a.singlediv.com/). They use no SVG, images or JavaScript. The Orange Slice is a true single div; the Ocean Wave needs one element per depth layer so each layer can move on its own; the Autumn Lake, the Lighthouse at Dusk, the Brass Skyport and Colony Dawn use one element per shape; the Paper Sun uses one element per paper sheet so each sheet can drift at its own depth; the Turning Tiles use one element per square tile, with its two semicircles as pseudo-elements; the Pixel Bug uses one element per bug, with every pixel row as a gradient layer, with the second bug repeated under four dither masks; the Pirate Skull uses one element per flat tone of each part, and its crafted twin mixes measured tone layers with hand-written shapes.

Examples:
1. Orange Slice
2. Ocean Wave
3. Autumn Lake
4. Lighthouse at Dusk
5. Brass Skyport
6. Colony Dawn
7. Paper Sun
8. Turning Tiles
9. Pixel Bug
10. Pirate Skull
11. Pirate Skull, Crafted (Chrome only)

## How the Orange Slice is drawn

Every measurement is a fraction of `--slice-size`, the slice's diameter, so the whole drawing scales as one piece.

The div and its pseudo-elements stack three layers:

- **`.orange`** paints the rind ring, then the segment yellow with its juice texture. The cells come from two sets of sparse spokes, from two nearby centers, crossed by rings from two other centers, so no two cells share a shape.
- **`::before`** is a black-and-white map of the pith: black keeps a segment, white wipes it. It is screened on top, so black leaves the segment showing and white turns it white.
- **`::after`** is a flat pith color multiplied over everything inside the rind, which turns that white into pith.

### Rounded segments from a blur

The pith map is drawn with hard edges: an outer pith ring, a center hole, five bands through the center that cut the disc into ten segments, and ten thin conic wedges (`--gap-flare`) that widen the gaps outward so the tips come out blunt. Then `filter: blur() contrast(20)` blurs it and pushes every pixel back to black or white. Convex corners fall under the midpoint and come back rounded, so every segment gets soft corners without a single `border-radius`.

Two details keep that clean:

- **Bleed.** The map spills past the rind by `--bleed`, so the blur samples solid white at the rim instead of the transparent page. `clip-path` runs after `filter`, so it trims the map back to the rind's inner edge afterwards.
- **Map colors.** `--keep` and `--wipe` are plain `black` and `white`, inputs for the threshold, not design colors.

### Exact colors through the multiply

Because the pith layer multiplies over the segments, `--color-segment` is the sampled segment yellow divided by the pith color. After the multiply it lands on the sampled yellow, `oklch(83.8% 0.171 83.4)`.

### Rough rind

The mask is a solid disc plus fine teeth from an irregular `repeating-conic-gradient`, intersected with the outer rim (`mask-composite: add, intersect`), so the edge reads as cut peel rather than a perfect circle.

## How the Ocean Wave is drawn

The scene is a 1160 by 1160 grid, the size of the reference artwork, and `--u: calc(100cqi / 1160)` turns grid units into real lengths, so the drawing scales as one piece.

### Shapes

- **Wave bands** are full-size boxes cut with `clip-path: polygon()`. Each polygon traces a band's top edge and then drops straight to the bottom, so the bands are simply painted back to front and each one covers the lower part of the one behind it. The edges are dense point lists in percentages, which keeps them smooth and lets them scale.
- **Haze streaks** are `conic-gradient()` wedges: the apex is where a streak tapers to a point, and a sliver of angle gives it its thickness. Streaks that taper off the canvas just have their apex outside it.
- **Sun, foam and bubbles** are stacks of `radial-gradient(circle ...)` layers, one per disc, so a whole cloud of foam is one element.

### Parallax

The scene is split into ten depth layers, from the sun at the back to the front sea at the bottom. All of them run the same `sway` keyframes, an eased left-right drift with a small rise and fall, but each layer sets its own `--depth` (how far it travels), `--bob` (how far it rises) and `--period` (how long one swing takes). Near layers travel further and faster than far ones, which is what reads as depth. The periods differ, so the layers never fall into step, and a negative `animation-delay` starts each one mid-swing.

Every layer is larger than the canvas (116 units to each side, 40 above and below) and the scene clips it, so no edge is ever revealed at the far end of a swing.

Under `prefers-reduced-motion: reduce` the animation is removed and the scene holds still.

## How the Autumn Lake is drawn

A static low-poly landscape, built one layer at a time from the back of the scene to the front. The scene keeps a 1296 by 1081 aspect ratio, and `--u: calc(100cqi / 1296)` turns grid units into real lengths, so the drawing scales as one piece. Every shape was measured from zoomed, gridded crops of a reference picture, and every color was sampled from it and stored as an OKLCH token.

### Sky and sun

The sky is one vertical `linear-gradient` with seven stops. The reference's gradient is not evenly spaced, so the stops sit at measured heights, and the gradient blends `in srgb` so the pale sage in the middle stays clean instead of drifting grey. The sun is a disc with its own vertical gradient, from pale cream at the crown to warm peach.

### Clouds, dots and lines

Each cloud is one element whose background stacks a few `radial-gradient` circles for the puffs and half-ellipses for the long tapered base. The element clips its own bottom edge, which is what gives every cloud a flat underside. The thin lines beside the clouds, on the water and below the lake are small pills with rounded ends.

The floating dots are one layer of `radial-gradient` circles; the large orange dot is a pseudo-element with a diagonal gradient. That layer sits on top of everything, so dots in front of the lake and the trees stay visible.

### Mountains and shoreline

The mountains are low-poly facets: each facet is its own element cut with `clip-path: polygon()` and filled with one flat color, so any facet can be tuned on its own. A few faces use a gradient fill instead, from teal to deep teal or from rose to crimson, to suggest light falling across them. Back peaks are painted first, the orange and red front range over them, and the shoreline band (a teal dome, a plum ridge, a teal wave and a dusky strip that fades from teal-grey to plum-grey) covers all of their bottom edges.

The two small pines are notched polygons placed behind the big teal peak, so its slope cuts across them.

### Lake

The lake outline, drips included, was traced column by column from the reference, then smoothed into a curve before being turned into a `clip-path: polygon()`. A cream layer fills the whole lake, and an orange reflection layer on top covers the left side, bounded by a separately traced curve. The island is one more polygon with the same teal-to-plum gradient as the shoreline strip.

### Trees

The big tree and the small pale tree each have a crown made from one gradient element masked by a stack of overlapping `radial-gradient` circles, which produces the lobed outline. The trunk and its spiky branches are a single polygon that walks up one side of the trunk, out to each branch tip and back, then down the other side.

The dark tree on the right is built from rounded pads (pill-shaped boxes), a tall trunk whose gradient switches from mauve to plum partway down, and curved branches. Each curved branch is a box with two borders and one large rounded corner, which draws an L-shaped bend.

The scene has no animation, so there is nothing for `prefers-reduced-motion` to change.

## How the Lighthouse at Dusk is drawn

An original scene with no reference picture: a striped lighthouse and a keeper's cottage on a sea cliff at blue hour, with the beam sweeping over the water. It was still built one layer at a time, back to front, with each layer checked in a screenshot before the next. The scene is 1600 by 1000 grid units, `--u: calc(100cqi / 1600)` turns them into real lengths, and every color is an OKLCH token.

### Sky, moon and stars

The sky is one vertical gradient from deep indigo through violet and rose to peach at the horizon, plus a flattened radial glow where the sun has just set. The crescent moon is a disc masked by an offset circle, so the bite is transparent, and it sits on a soft halo. The stars are two layers of tiny `radial-gradient` dots, a faint far layer and a brighter near one, placed by a seeded script that keeps them clear of the moon and the lantern.

### Clouds

Each cloud bank is two or three stacked pills (boxes with `border-radius` equal to their height). Each pill's background is a hard-stop gradient: the body color on top and a lit stripe along the bottom, which reads as sunset light catching the underside. The high banks are darker than the sky so they show as silhouettes.

### Sea, islands and boat

The distant islands and the sailboat are small `clip-path: polygon()` silhouettes on the horizon. The sea is a gradient from a peach band that mirrors the horizon down to deep indigo. The glints are rows of thin ellipses: warm ones in a widening column under the glow (dimmer the deeper they sit) and cool lavender ones under the moon.

### Cliff, lighthouse and cottage

The cliff is low-poly, like the Autumn Lake mountains: one dark body polygon with facets laid over it. Faces turned toward the glow are rose and amber, faces turned away are indigo, and the gaps left between facets read as crevices. A teal grass cap runs along the top.

The tower is a box clipped to a trapezoid. Its stripes are a `repeating-linear-gradient`, and a second gradient darkens its right side. The lantern room is a warm box with iron mullions drawn by a repeating gradient. The railing is a top border plus repeating bars, and the dome is a box with elliptical top corners. The cottage uses the same parts: a gable polygon for the roof and gradient crossbars for the window panes.

### Beam and motion

The beam is a soft `conic-gradient` wedge whose apex is the lantern, faded along its length by a linear mask and blended with `screen` so it brightens what it crosses. To sweep it, the animation runs `scale` on the x axis from 1 to -1 and back, with the lantern as the transform origin. That is a 2D projection of a turning light: the beam shortens as it swings toward the viewer, and a flare at the lamp, on the same timing, peaks at that moment. The other motion is small: the stars twinkle, the glints shimmer, the surf at the cliff foot laps in and out, and the gulls flap. Everything animates only `scale`, `translate` or `opacity`, and `prefers-reduced-motion: reduce` turns all of it off. The beam then rests pointing out to sea.

## How the Brass Skyport is drawn

An original steampunk scene: a clockwork city at amber dusk, with an airship drifting past a verdigris clock tower, gears turning, chimneys steaming and a pressure gauge twitching on the pipes in front. Like the Lighthouse, it was built one layer at a time on a 1600 by 1000 grid, with `--u: calc(100cqi / 1600)` and OKLCH tokens throughout.

### Sky and city

The sky runs from deep verdigris teal through olive to amber, a palette borrowed from aged copper and brass. A low sun sits behind soft smog bands: thin, wide radial ellipses whose amber haze reads darker where it crosses the sun. The two skylines are single polygons generated from a list of buildings (blocks, gables, domes, spires and chimneys). The far one is hazy and pale, and the near one is dark sepia. The near city's lit windows are one background stack of small `linear-gradient(color 0 0)` rectangles, each placed with its own position and size.

### Clock tower

The tower is a stack of boxes. The shaft's brass pilasters and cornice bands are hard-stop gradients. The clock has a brass bezel, an ivory face and a tick ring: two `repeating-conic-gradient`s (hour marks and minute marks) masked to a thin annulus. The dials use `circle closest-side`, so their percentages are measured to the edge of the disc, not to the box corner. Each hand is a box centered on the clock with only its top half painted, so rotating the box turns the hand about the center. The minute hand goes round once a minute and the hour hand once every twelve minutes, starting at ten past ten.

### Gears

Every gear is one element. The teeth come from a mask: a solid root disc plus a `repeating-conic-gradient` of teeth (half a pitch on, half off), with `clip-path: circle()` trimming them to the outer radius. The spokes, rim and hub are painted in the background, and the recess between the spokes is a dark tone on the near gears and transparent on the far ones, so the city shows through. The three front gears share one tooth size and really mesh: they sit at a center distance equal to the sum of their pitch radii, the driven gears turn the other way at a speed set by the tooth ratio, and each starting angle is calculated so that a tooth meets a gap at every contact point. An iron girder with brass rivets ties the drive gear to the tower.

### Airship

The airship is the one wrapper in the scene, so all its parts bob together. The canvas envelope is an ellipse with seams from a repeating gradient, a brass belt and lighter paint underneath, because the low sun lights it from below. The fins are polygons. The gondola is clipped to a hull shape, and its portholes are a row of radial gradients with brass rims. Each propeller is a thin blade that flips with `scale: 1 -1`, over a faint blur disc, which reads as spinning.

### Steam, ships and pipes

Each puff of steam is a soft radial disc that rises, drifts with the wind, grows and fades. Three puffs per chimney, offset by a third of the cycle each, make a continuous plume. The distant airships are single elements whose backgrounds stack an ellipse, a conic tail fin and two small rectangles. In front, a copper main pipe shaded as a cylinder carries brass collars: one element masked into evenly spaced bands. There is also a riser with a steam whistle and a valve wheel, and a pressure gauge with a red zone arc and tick marks limited to 272 degrees by intersecting two masks. Its needle twitches through an uneven keyframe track and kicks into the red now and then.

### Motion

Everything animates only `rotate`, `scale`, `translate` or `opacity`. Under `prefers-reduced-motion: reduce` every animation stops (the guard matches the specificity of the `[data-part]` rules that start them), and each chimney shows one still puff instead.

## How Colony Dawn is drawn

An original sci-fi scene: dawn on a frontier moon, with a ringed gas giant filling the sky, a biodome colony, a monorail and a rocket that launches on a loop. Same grid as the last two pieces (1600 by 1000, `--u: calc(100cqi / 1600)`), same OKLCH tokens.

### Space

The sky fades from near-black violet through magenta to a cyan horizon. Five soft nebula ellipses in rose, cyan and violet are blended with `mix-blend-mode: screen`, so they brighten the sky instead of covering it. The stars are two layers of seeded radial dots that keep clear of the planet and twinkle out of step. A satellite crosses slowly, and every nine seconds a meteor streaks past: a short gradient pill that is invisible for most of its cycle.

### Gas giant and rings

The planet is a disc tilted by -14 degrees. Its bands are one vertical gradient with soft stops in cream, apricot, coral and plum, plus an oval storm. A radial overlay anchored near the lower-left limb (the dawn side) darkens the rest of the disc into night, and an inset `box-shadow` adds a thin cyan rim of atmosphere. The ring is a `closest-side` radial gradient of translucent bands on an ellipse with the same tilt. It is drawn twice: once before the planet, clipped to its top half with `clip-path: inset(0 0 50% 0)`, and once after, clipped to its bottom half. Because `clip-path` works in the element's own coordinates, the halves split along the tilted axis, so the ring passes behind the planet at the top and in front of it at the bottom. The two moons use the same shading idea, with a few radial craters.

### Ground

The mesas, the plain and the ridge are polygons. A dawn sun peeks over a gap in the mesa line, as a bright core inside two layers of glow. Each crystal cluster is two polygons: one walks along the baseline through every spire's lit face, and the other through every dark face. Points that share the baseline join the spires into a single shape without any visible connection. The foreground magenta shards work the same way, over a soft glow, and two layers of spores drift up from them, offset by half a cycle.

### Colony

The biodome is a half-ellipse box. Its glass ribs are a repeating linear gradient for the meridians and a repeating radial gradient anchored at the bottom center for the rings, laid over a glowing garden of radial "trees". The habitats are pills with window strips cut from repeating gradients. The radar dish scans by flipping `scale` on the x axis, the beacons blink with a stepped opacity animation, and the launch tower's lattice is two crossed repeating diagonal gradients.

### Launch and monorail

The rocket's parts and its flame share a wrapper, so they rise together, and four animations share one 16 second duration so they stay in sync. The rocket fades in on the pad, the flame ignites short and is hidden behind the pad, smoke billows around the base, and then the wrapper accelerates upward with a custom cubic bezier until it leaves the frame. The flame grows as it climbs, and its `::after` core flickers with a stepped opacity. The monorail is a track with running lights on repeating pylons, and the train glides across in front of the colony for part of each cycle.

### Motion

Everything animates only `translate`, `scale`, `rotate` or `opacity`. Under `prefers-reduced-motion: reduce` every animation stops. The guard matches the specificity of the `[data-*]` rules that start some of them. In the still frame the rocket waits on its pad, the train is parked in view, and the spores hang in the air.

## How the Paper Sun is drawn

A paper-cut sunrise: waves of cyan, orange and red paper stack toward a deep blue gap, where a yellow paper sun floats. It follows a stock illustration's composition and palette, then adds a slow parallax drift, a two-ply sun and two small floating discs. The grid is the reference size, 689 by 1028 (`--u: calc(100cqi / 689)`). Every color was sampled from the reference and stored as an OKLCH token.

### The deep sheet

The blue gap is the scene background, the farthest sheet of paper. It is a radial gradient centered on the sun, slightly lighter around the sun and slightly deeper at the edges. The reference is flat blue there.

### Paper sheets

Each sheet is one empty element. Its `::before` holds the paper color and is cut to shape with `clip-path: polygon()`. The element itself casts the shadow with `filter: drop-shadow()`. The shadow needs two boxes because `clip-path` runs after `filter` on the same element and would cut the shadow off. Here the clip is on the child, so the parent's shadow follows the clipped outline.

The wave edges were traced by scanning the reference column by column for color changes, smoothed with Catmull-Rom curves, and written as percentages of the sheet. Where a sheet's edge disappears under a sheet in front of it, the hidden part of the curve was chosen to stay under that front sheet. Every sheet is 40 grid units larger than the scene on all sides (`--sheet-bleed`), so its edges never show while it drifts.

The three upper sheets (dark red, orange, cyan) close to the top of the scene and cast their shadows downward. The three lower sheets (cyan, orange, red) close to the bottom and cast theirs upward, so every shadow falls toward the gap. Each sheet sets `--cast-y`, `--cast-blur` and `--cast-alpha`, fitted to the shadow falloff measured in the reference. The cyan sheet's shadow is tight and dark, and the teal's shadow on the blue is long and faint. The dark red sheet adds a soft radial pocket of shade under the cyan, where the cyan and orange shadows overlap in the reference.

### Sun and floating discs

The sun is a disc fitted to the reference's sun outline (least squares) with a tight `box-shadow` below it. Its `::before` is a second, slightly smaller and lighter disc lifted a few units, so the sun reads as two plies of paper. The pale cyan and orange dots in the gap are the same kind of disc at a smaller size. Their position and radius come from `--x`, `--y` and `--r`.

### Motion

One `drift` keyframe moves every layer around a slow loop with `translate`. Each layer scales the motion by its `--depth`: 1 for the sheets next to the gap, 3 for the front sheets, 4 for the sun. Nearer layers travel farther, which gives the parallax. Only `translate` animates; the shadows move with their sheets. Under `prefers-reduced-motion: reduce` the animation stops and every layer rests at its measured position.

## How the Turning Tiles are drawn

A paper relief of diamond tiles, after a stock 3D render (treated as a style guide, not traced), recolored with the Paper Sun palette: marigold, sky, flame, deep blue and sun yellow, reused as the same OKLCH tokens. The grid is the reference size, 1482 by 975 (`--u: calc(100cqi / 1482)`). The tiles are squares turned 45deg, each 127 units from its center to a corner, measured from the points where the reference's tiles meet.

### The board

`.board` is a 10 by 10 CSS grid of `.tile` squares, rotated 45deg (`--board-turn`) about the scene center so the squares become diamonds. Ten tiles span 1796 units, enough to cover the whole scene once turned. Nothing is positioned by hand: the grid places every tile. The markup was generated once with a seeded random pick per tile, so the pattern is fixed. Each tile carries its choices as data attributes: `data-ground` for its own color, `data-half-a` and `data-half-b` for its two semicircles, and `data-axis` for which pair of opposite sides they sit on. Attribute rules turn each name into a color custom property.

### Tiles

Every tile holds two semicircles. Each one sits flat on a side of the square, with a diameter equal to the side, so it bulges in exactly to the center, where it meets the other. The two remaining sides show the tile's ground, mixed 14% toward black (`--ground-shade`) so it reads as the lower layer. Halves from neighboring tiles that sit back to back across a shared side read as one full circle, and the ground gaps read as triangles, which is how the reference looks.

Each half is a `::before` or `::after` box covering half the tile, with the two corners on the tile's center line rounded to `side / 2`, which makes a semicircle. Its `transform-origin` is the tile center, so one `rotate` value (`--axis`, 0deg or 90deg) moves the pair onto either pair of sides. Each tile clips its own content (`overflow: clip`), so nothing ever spills into a neighbor. Two inset shadows on the tile give every diamond a lit and a shaded edge, like separate pieces of card.

### Light that does not turn

Each half casts a soft `box-shadow` down and to the right, and two inset shadows give the paper edge a lit top-left rim and a shaded bottom-right rim. A box shadow rotates with its element, so the offsets are counter-rotated. With the half's total screen angle (its own `--angle` plus the board's 45deg) as θ, the offset is `(x cos θ + y sin θ, y cos θ - x sin θ)`, computed with `cos()` and `sin()`. Once the board and the half rotate it back, the shadow always lands at the same screen offset, so the light stays put while the paper spins. The tile edges use the same formula with the board angle alone.

### Motion

`--turn` is registered with `@property` as an `<angle>`, so the `turn` keyframe can animate it. Every eight seconds a pair turns four quarter steps (one second of easing, one second of rest per step), ending on 360deg, so the loop is seamless. The pair turns about its tile's center, and the tile's clip trims the corners that swing past its edges, so each pair spins inside its own square like a dial in a window.

The delay is `--col * --turn-stagger`, where `--col` comes from nine `:nth-child(10n + k)` rules. The board's columns run from the top left to the bottom right of the screen, so each step travels as a diagonal wave, one column every 0.2s. Tiles on alternate squares of a checkerboard (`:nth-child(20n + k)`) set `--dir: -1`, so neighboring pairs turn in opposite directions like meshed gears. Under `prefers-reduced-motion: reduce` the animation is removed and every pair rests on its starting sides.

## How the Pixel Bug is drawn

Two bugs as pixel art on graph paper: a cicada and a shield bug. The cicada shows first, and a pixel switch under the picture morphs it into the shield bug, square by square, with no JavaScript. The grid is 128 columns by 179 rows, so the pixels stay small while the antennae, claws and wing veins still read.

### Pixels as row gradients

Each bug is one `.pixels` element. Every pixel row is one `linear-gradient(to right, ...)` layer with a hard stop at each color change, so a whole row of runs costs one layer. Stops are exact percentages of the width (one column is 0.78125%). The layers are `100%` wide and one `--cell` tall, with `no-repeat`, and each one is moved to its row with `background-position: 0 calc(row * var(--cell))`. Blank rows are skipped. `--cell` is `100cqi / 128`, so the picture scales with the scene.

Row positions land on fractional pixels, so rounding can leave a hairline of paper between two rows. Each layer is one pixel taller than a cell (`--seam`). Earlier layers paint on top, so each row covers the top pixel of the row below it, and the next grid line hides the overlap.

The gradient directions and positions are physical (`to right`, `0 y`) on purpose: they are picture coordinates and must not flip with the writing direction.

### Where the pixels came from

The shield bug was downsampled from its reference: each source pixel was matched to the nearest of eight sampled colors, and each cell took the most common one. Any cell where the dark outline color covered more than a fifth of the area became an outline pixel, so the thin ink lines survive. Lone single cells were smoothed away, and every background cell touching the bug became ink, which gives the closed one-cell outline of the graph paper style. A light blue pixel on the lit (top and left) edges of the blue parts adds the highlight that pixel art uses.

The cicada reference was a watermarked stock image, so it was a style guide only. Its shapes were redrawn from measured ellipses, polygons and lines (one half, then mirrored), and that drawing went through the same pixel pass.

### Graph paper

`.graph` sits on top and draws the rules: two gradients, one vertical and one horizontal line per cell, tiled at `var(--cell)`. The line width is a fraction of the cell with a 1px floor, and the color is the rule tone at 55%, so the art shows through. Under `prefers-contrast: more` the lines use the full rule color.

### The morph

The cicada is one plain `.pixels` element. The shield bug sits above it four times, each copy inside a `.veil` whose mask shows one cell of every 2 by 2 block: top left, then bottom right, then top right, and finally the whole picture. Each mask is a vertical band and a horizontal band in a tile two cells wide, joined with `mask-composite: intersect`, and `--mx` and `--my` pick which cell. The shield bug's empty cells are filled with its kraft paper, so a cell that turns on hides the cicada under it completely.

Flipping the switch (`:has(:checked)`) fades every veil to full opacity, 0.45s each, with each one starting 0.25s after the last. The cicada breaks up into a checkerboard dither and the shield bug fills it in, the way old games dissolve between sprites. The last veil has no mask, so the finished picture has no seams between cells. Flipping it back runs the same fades in reverse order, and the stage paper changes between sky blue and kraft brown at the same time.

### Keeping it smooth

The only thing that animates on the bugs is `opacity`, with static masks. Browsers run opacity transitions on the compositor thread, away from the page's main thread, so the morph stays smooth even when the page is busy. Each veil has `will-change: opacity`, so its 140-odd rows of gradients are painted once, before the first click, and never again.

An earlier version grew a square inside every cell by transitioning a registered custom property into the masks. It worked, but every frame repainted the masks and restyled the rows (about 280 gradient layers), and each cell only grew by a few pixels, so the growth looked stepped. Switching to staggered opacity cut main-thread work during the morph by about 70% on a 2x display.

Under `prefers-reduced-motion: reduce` the transitions are removed and the switch swaps the bugs at once.

### The switch

The control is a real `<input type="checkbox" role="switch">`, named "Show the shield bug", inside a label with the two bug names on either side, so clicking either name flips it too. The names are hidden from screen readers because the switch already carries the name. The name of the bug on screen is full ink and the other one is 65% ink, which still passes 4.5:1 contrast.

The switch is drawn on the input itself with `appearance: none`, in 0.25rem dots. Four `box-shadow`s, each one dot out from one side, draw an outline whose corners stay empty, which is the classic stepped pixel corner, and a fifth shadow two dots down gives it depth. The knob is three background layers: a 5 by 5 face, a darker bottom row and a one-dot highlight. They move together with `background-position` in `steps(7)`, so the knob hops one dot at a time. Flipping the switch also changes the knob from cicada green to shield blue. The shield bug's page is kraft brown, like a sketchbook, so it reads as a real paper and contrasts with the cicada's sky blue.

## How the Pirate Skull is drawn

A grinning grey skull in a gold striped bandana, with a black eye patch, one gold tooth and coins tumbling around it, on pure black. The reference is 3840 by 2400 and the scene keeps that ratio, growing to fill the window up to 120rem wide. Every shape sits on a full-scene layer, so its polygon coordinates are simply x / 3840 and y / 2400 as percentages, and the drawing scales as one piece.

### Flat tones

The artwork is cel shaded: apart from a few soft blends, every pixel belongs to one of nine greys or three golds. Each tone was measured from a histogram of the reference and stored as an OKLCH token (`--color-bone-1` to `--color-bone-9`, `--color-gold-deep`, `--color-gold-mid`, `--color-gold-bright`). The background was sampled at pure black everywhere, so it is one flat `--color-page`.

### Stacked tone layers

Each part is a `.part` with one `.tone` child per tone, painted dark to light. A tone layer covers every pixel at least that light, not just the pixels of that exact tone, so the layers nest: the darkest grey is the whole skull silhouette, the next one sits inside it, and so on up to the white of the teeth. Each layer only has to be right at its own edge, and there is never a gap between two neighboring tones. Black needs no layer at all: the eye socket, nose, cracks and gaps between teeth are holes in every layer, so the page shows through.

The parts are the skull (nine greys, which also carry the eye patch, its strap and the tiny skull and crossbones on it), then the bandana, the coin pinned to it, the gold tooth and the four loose coins (three golds each). The gold parts never touch each other, so they split cleanly along black.

### Tracing

Each tone mask was traced from the reference with marching squares, after a light blur on the big grey shapes so their edges come out smooth. The coins, the pin and the bandana skip the blur, because their engraving and texture lines are only one to three pixels wide. The outlines were then simplified to within about a pixel. The darkest gold layer starts at a higher threshold than the antialiased dark lines, so the lines between a coin's rim and its face stay dark.

### One path per layer

A `clip-path: polygon()` has a single path, so all the outlines of one tone layer are joined into it by bridges, each walked once out and once back so it adds no area. Two details keep the bridges invisible:

- **Winding, not even-odd.** Holes run the opposite way around from the shapes that contain them, and the default `nonzero` rule fills the result. With `evenodd`, the browser's antialiasing does not cancel a bridge exactly, and it showed up as a faint hairline.
- **Bridges through solid fill.** The outlines of a layer are linked by a minimum spanning tree whose cost is the length of the bridge that crosses empty pixels. A hole joins the shape around it through the solid tone, where a seam cannot show, and separate pieces, such as neighboring teeth, join across the narrowest gap.

### Glowing eye

The open eye socket holds a glow that is not in the reference. `.eye-glow` is a square centered in the dark of the socket, sized on the reference grid with `--u: calc(100cqi / 3840)`. Its `::before` is a wide halo, a `closest-side` radial gradient from deep gold to a faint spill. Its `::after` is the eye itself: a near-white core, then a mid-gold iris fading out through deep gold. Both use `mix-blend-mode: screen`, so on the black socket they show at full strength, and where the halo reaches the bone around it, the grey brightens toward gold as if lit from inside. The glow colors are mixes of the coin golds, not the bandana's brightest yellow, which leans green.

The two layers pulse together with `opacity` and `scale`, the halo more than the core, over 2.8 seconds each way. That is slow enough to read as breathing, far from any flashing. Under `prefers-reduced-motion: reduce` the animation is removed and the eye holds at full glow.

### Forced colors

The scene sets `forced-color-adjust: none`. Otherwise forced-colors mode replaces every background with the system canvas color and the skull disappears. The colors are the content here, as in a photograph.

## How the Pirate Skull, Crafted is drawn

A second take on the Pirate Skull that leans on hand-written shapes where the picture allows it. It uses `clip-path: shape()`, which became Baseline only in February 2026, so it has no fallback and its title says Chrome only. Every element is placed with four custom properties, `--x`, `--y`, `--w` and `--h`, in reference pixels, plus an optional `--turn`, so each rule reads like a measurement.

### Why `shape()`

`shape()` is a path in CSS units: `move to`, `line to`, `curve to ... with ...` and `close`, with percentages of the element's box. Unlike `polygon()`, it can hold several outlines at once, each starting with `move to`, and `evenodd` turns the inner ones into holes. So one element can carry every piece of one tone without the zero-width bridges the first Pirate Skull needs, and without their seams.

### Measured layers

The brushwork (the skull's shading, the patch, strap and emblem, the chin and gum, and the bandana's woven strokes) is too irregular for primitives without losing the picture, so those outlines were measured from the reference. Each tone was traced, simplified to within 2.5 reference pixels (about one screen pixel at full size), and written as straight `line to` segments: seven grey tones for the skull and three golds for the bandana. They nest light over dark, as in the first version. The mouth area is left as flat bone, because the hand-written mouth covers it. The pinned coin is cut out of the bandana, so its hand-written version sits in a clean hole.

### Teeth

All 19 teeth share one hand-written outline: a pointed root, straight sides and a rounded crown, in seven commands. Each tooth only sets its box and `--tip`, which slides the root point left or right so the teeth lean toward the middle of the mouth. The outline is written on `.tooth` itself rather than in a root token, so `var(--tip)` resolves per tooth. The lower row is the same shape flipped with `scale: 1 -1`. A radial gradient gives each tooth a curved grey side, and the teeth at the ends of the rows use darker tokens. The slots were measured by scanning the reference for the thin black lines between teeth. The black lines between teeth are the `.mouth` shape behind them. The gold tooth is its own short `shape()` with a slanted gradient and a white glint.

### Coins

Each coin is one rounded octagon (`--coin-shape`) used three times. The element itself is the dark outline. `::before` is the same shape scaled to 88% for the rim, shaded across with a gradient. `::after` is the face, scaled down further and shifted away from the rim with `translate: calc(var(--rim) * -7%) 0`, which leaves a bright crescent on the rim side. `--rim` is 1 or -1, so it also flips the bevel line and the highlight. The rune on the face is three gradient tiles: a straight bar and two diagonal strokes made by hard stops in a small angled `linear-gradient`. The pinned coin swaps in a thick black outline and an eight-point star from a `repeating-conic-gradient`.

### Glowing eye

The same glow as the first Pirate Skull: a halo and a hot core on `::before` and `::after`, both screen-blended, pulsing with `opacity` and `scale`, and held still under `prefers-reduced-motion: reduce`.
