Magazine cover ring 3D hero
Twelve magazine covers, each drawn in code, hang on a turning ring. Drag to spin it and it snaps a cover to the front; hover lifts one out, click brings it forward.
"use client";
import { useEffect, useRef, useState, type CSSProperties } from "react";
import * as THREE from "three";
import "./covers-hero.css";
type Motif =
| "wave"
| "blocks"
| "sun"
| "petals"
| "rings"
| "grid"
| "lines"
| "stack"
| "arch"
| "rays"
| "moon"
| "dots";
export type Issue = {
word: string;
season: string;
blurb: string;
bg: string;
ink: string;
accent: string;
motif: Motif;
};
type CoversHeroProps = {
name?: string;
title?: string;
issues?: Issue[];
cta?: { label: string; href: string };
};
const ISSUES: Issue[] = [
{
word: "Tide",
season: "Spring 2024",
blurb:
"The sea issue: fishermen, cold-water swimmers and a lighthouse keeper's notebook.",
bg: "#1f45c9",
ink: "#f3eee3",
accent: "#8fb4ff",
motif: "wave",
},
{
word: "Form",
season: "Summer 2024",
blurb:
"Concrete, chairs and the stubborn beauty of buildings nobody asked for.",
bg: "#e8e6e1",
ink: "#111111",
accent: "#d7ff3a",
motif: "blocks",
},
{
word: "Ember",
season: "Autumn 2024",
blurb:
"Fire as a tool: bakers, glassblowers and a family that still smokes its own fish.",
bg: "#c43f1b",
ink: "#f7e9d7",
accent: "#ffb27a",
motif: "sun",
},
{
word: "Bloom",
season: "Winter 2024",
blurb:
"Flowers grown under glass in the darkest months, and the people who wait for them.",
bg: "#f0c4d1",
ink: "#2a1420",
accent: "#e04a7a",
motif: "petals",
},
{
word: "Orbit",
season: "Spring 2025",
blurb:
"Amateur astronomers, a retired satellite and the longest night of the year.",
bg: "#12123a",
ink: "#f3eee3",
accent: "#ff8a3d",
motif: "rings",
},
{
word: "Salt",
season: "Summer 2025",
blurb:
"The pans, the harvest and the quiet chemistry of the oldest seasoning.",
bg: "#e9e4da",
ink: "#24303a",
accent: "#6f8ea3",
motif: "grid",
},
{
word: "Drift",
season: "Autumn 2025",
blurb: "Slow travel by barge, ferry and one very patient postal boat.",
bg: "#9cc3c9",
ink: "#10282c",
accent: "#f3eee3",
motif: "lines",
},
{
word: "Quarry",
season: "Winter 2025",
blurb:
"Stone: who cuts it, who carves it and who walks on it without noticing.",
bg: "#b9a48b",
ink: "#2a2018",
accent: "#efe4d2",
motif: "stack",
},
{
word: "Hymn",
season: "Spring 2026",
blurb: "Choirs, bell ringers and the acoustics of empty churches.",
bg: "#2c2a26",
ink: "#e8d9b5",
accent: "#b08a4a",
motif: "arch",
},
{
word: "Lumen",
season: "Summer 2026",
blurb:
"Light at work: lamp makers, lighthouse lenses and the colour of noon.",
bg: "#f4dd6d",
ink: "#1d1a12",
accent: "#ffffff",
motif: "rays",
},
{
word: "Fable",
season: "Autumn 2026",
blurb: "Stories told at night, from bedtime to the last bus home.",
bg: "#3d6b45",
ink: "#f1ead6",
accent: "#e9c46a",
motif: "moon",
},
{
word: "Grain",
season: "Winter 2026",
blurb: "Bread, wood and film: three crafts that live in the grain.",
bg: "#d9c7a5",
ink: "#3a2a1a",
accent: "#8a5a2b",
motif: "dots",
},
];
const SERIF =
'"Bodoni 72", "Bodoni MT", Didot, "Playfair Display", Georgia, serif';
const CONDENSED =
'"Haettenschweiler", "Impact", "Arial Narrow Bold", sans-serif';
/** Draws one printed cover onto a canvas: a colour field, a motif, the masthead and the big word. */
function drawCover(issue: Issue, n: number, name: string) {
const W = 600;
const H = 800;
const c = document.createElement("canvas");
c.width = W;
c.height = H;
const g = c.getContext("2d")!;
g.fillStyle = issue.bg;
g.fillRect(0, 0, W, H);
g.save();
g.strokeStyle = issue.accent;
g.fillStyle = issue.accent;
g.lineWidth = 6;
const cx = W / 2;
const cy = H * 0.6;
switch (issue.motif) {
case "wave":
for (let k = 0; k < 9; k++) {
g.beginPath();
for (let x = 0; x <= W; x += 10) {
const y = H * 0.5 + k * 34 + Math.sin(x / 48 + k * 0.7) * 18;
if (x === 0) g.moveTo(x, y);
else g.lineTo(x, y);
}
g.globalAlpha = 0.25 + k * 0.08;
g.stroke();
}
break;
case "blocks":
g.fillRect(W * 0.12, H * 0.42, W * 0.32, H * 0.46);
g.fillStyle = issue.ink;
g.fillRect(W * 0.5, H * 0.56, W * 0.38, H * 0.32);
g.globalAlpha = 0.15;
g.fillRect(W * 0.3, H * 0.3, W * 0.4, H * 0.2);
break;
case "sun":
for (let k = 6; k > 0; k--) {
g.globalAlpha = 0.18 + (6 - k) * 0.12;
g.beginPath();
g.arc(cx, cy, k * 38, 0, Math.PI * 2);
g.fill();
}
break;
case "petals":
g.translate(cx, cy);
for (let k = 0; k < 8; k++) {
g.rotate(Math.PI / 4);
g.beginPath();
g.ellipse(0, -90, 40, 95, 0, 0, Math.PI * 2);
g.globalAlpha = 0.6;
g.fill();
}
g.globalAlpha = 1;
g.fillStyle = issue.ink;
g.beginPath();
g.arc(0, 0, 30, 0, Math.PI * 2);
g.fill();
break;
case "rings":
g.beginPath();
g.arc(cx, cy, 70, 0, Math.PI * 2);
g.fill();
g.lineWidth = 3;
for (let k = 1; k < 5; k++) {
g.globalAlpha = 0.9 - k * 0.15;
g.beginPath();
g.ellipse(cx, cy, 70 + k * 46, 22 + k * 14, -0.25, 0, Math.PI * 2);
g.stroke();
}
g.fillStyle = issue.ink;
for (let k = 0; k < 60; k++) {
g.globalAlpha = Math.random() * 0.8;
g.fillRect(Math.random() * W, Math.random() * H * 0.9, 2, 2);
}
break;
case "grid":
g.lineWidth = 2;
for (let x = 60; x < W; x += 60)
for (let y = H * 0.38; y < H - 30; y += 60) {
g.globalAlpha = 0.25 + ((x + y) % 120 === 0 ? 0.5 : 0);
g.strokeRect(x - 20, y - 20, 40, 40);
}
break;
case "lines":
for (let k = 0; k < 22; k++) {
g.globalAlpha = 0.5;
g.fillRect(
W * 0.1 + ((k * 37) % 200),
H * 0.4 + k * 18,
W * 0.3 + ((k * 53) % 180),
4,
);
}
break;
case "stack":
for (let k = 0; k < 6; k++) {
g.globalAlpha = 0.45 + k * 0.1;
const w = W * (0.7 - k * 0.08);
g.fillRect(
cx - w / 2 + ((k % 2) * 2 - 1) * 14,
H * 0.88 - (k + 1) * 62,
w,
54,
);
}
break;
case "arch":
g.lineWidth = 8;
for (let k = 0; k < 4; k++) {
g.globalAlpha = 1 - k * 0.22;
const r = 150 - k * 34;
g.beginPath();
g.moveTo(cx - r, H * 0.92);
g.lineTo(cx - r, cy);
g.arc(cx, cy, r, Math.PI, 0);
g.lineTo(cx + r, H * 0.92);
g.stroke();
}
break;
case "rays":
g.translate(cx, H);
for (let k = 0; k < 13; k++) {
g.globalAlpha = 0.55;
g.beginPath();
g.moveTo(0, 0);
const a = Math.PI + (k / 12) * Math.PI;
g.lineTo(Math.cos(a - 0.04) * 700, Math.sin(a - 0.04) * 700);
g.lineTo(Math.cos(a + 0.04) * 700, Math.sin(a + 0.04) * 700);
g.fill();
}
break;
case "moon":
g.beginPath();
g.arc(cx + 40, cy - 20, 110, 0, Math.PI * 2);
g.fill();
g.fillStyle = issue.bg;
g.beginPath();
g.arc(cx + 90, cy - 50, 100, 0, Math.PI * 2);
g.fill();
g.fillStyle = issue.accent;
for (let k = 0; k < 12; k++) {
g.globalAlpha = 0.7;
g.beginPath();
g.arc((k * 97) % W, H * 0.42 + ((k * 61) % 300), 3, 0, Math.PI * 2);
g.fill();
}
break;
case "dots":
for (let y = H * 0.42; y < H - 20; y += 26)
for (let x = 26; x < W; x += 26) {
const r = 2 + 8 * Math.abs(Math.sin(x / 90 + y / 120));
g.globalAlpha = 0.6;
g.beginPath();
g.arc(x, y, r, 0, Math.PI * 2);
g.fill();
}
break;
}
g.restore();
// Masthead, number and the big word: every other cover swaps serif for condensed.
g.fillStyle = issue.ink;
g.font = `600 22px ${SERIF}`;
g.textBaseline = "top";
g.fillText(name.toUpperCase().split("").join(" "), 36, 34);
g.textAlign = "right";
g.font = `500 18px system-ui, sans-serif`;
g.fillText(`No. ${String(n).padStart(2, "0")}`, W - 36, 36);
g.fillText(issue.season, W - 36, 60);
g.textAlign = "left";
g.fillRect(36, 92, W - 72, 2);
const serif = n % 2 === 1;
let size = serif ? 200 : 260;
g.font = serif
? `italic 400 ${size}px ${SERIF}`
: `400 ${size}px ${CONDENSED}`;
const word = serif ? issue.word : issue.word.toUpperCase();
const m = g.measureText(word).width;
size = Math.min(size, (size * (W - 72)) / m);
g.font = serif
? `italic 400 ${size}px ${SERIF}`
: `400 ${size}px ${CONDENSED}`;
g.textBaseline = "alphabetic";
g.fillText(word, 34, 110 + size * 0.82);
// A little print grain.
const img = g.getImageData(0, 0, W, H);
for (let i = 0; i < img.data.length; i += 4) {
const d = (Math.random() - 0.5) * 22;
img.data[i] += d;
img.data[i + 1] += d;
img.data[i + 2] += d;
}
g.putImageData(img, 0, 0);
return c;
}
/**
* CoversHero
* - Twelve magazine covers, each drawn in code on a canvas, hang on a slowly turning ring.
* - Drag to spin it with inertia; it snaps the nearest cover to the front. Hover lifts a
* cover out of the ring; click brings it forward. Arrow keys and the buttons step through.
* - The front cover's number, season and story sit below in real text.
*/
export function CoversHero({
name = "Folio",
title = "Twelve issues. One shelf.",
issues = ISSUES,
cta = { label: "Subscribe, 4 issues a year", href: "#folio-subscribe" },
}: CoversHeroProps) {
const rootRef = useRef<HTMLElement>(null);
const stageRef = useRef<HTMLDivElement>(null);
const stepRef = useRef<(by: number) => void>(() => {});
const [front, setFront] = useState(0);
const [failed, setFailed] = useState(false);
const count = issues.length;
useEffect(() => {
const root = rootRef.current;
const stage = stageRef.current;
if (!root || !stage) return;
const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
let renderer: THREE.WebGLRenderer;
try {
renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
} catch {
const id = requestAnimationFrame(() => setFailed(true));
return () => cancelAnimationFrame(id);
}
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setClearColor(0x000000, 0);
stage.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(32, 1, 0.1, 60);
const R = Math.max(4.2, (count * 2.65) / (Math.PI * 2));
const STEP = (Math.PI * 2) / count;
const ring = new THREE.Group();
scene.add(ring);
/* ---- Curved cover panels, baked straight into ring space ---- */
const PW = 2.2;
const PH = 2.93;
const panels = issues.map((issue, i) => {
const geo = new THREE.PlaneGeometry(PW, PH, 24, 1);
const p = geo.attributes.position;
const base = i * STEP;
for (let k = 0; k < p.count; k++) {
const a = base + p.getX(k) / R;
p.setXYZ(k, Math.sin(a) * R, p.getY(k), Math.cos(a) * R);
}
geo.computeVertexNormals();
const tex = new THREE.CanvasTexture(drawCover(issue, i + 1, name));
tex.colorSpace = THREE.SRGBColorSpace;
tex.anisotropy = renderer.capabilities.getMaxAnisotropy();
const mesh = new THREE.Mesh(
geo,
new THREE.MeshBasicMaterial({ map: tex }),
);
mesh.userData = {
i,
out: new THREE.Vector3(Math.sin(base), 0, Math.cos(base)),
lift: 0,
};
ring.add(mesh);
return mesh;
});
const resize = (w: number, h: number) => {
if (w < 2 || h < 2) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
const narrow = camera.aspect < 0.9;
camera.fov = narrow ? 40 : 30;
camera.position.set(0, 1.6, R + (narrow ? 14 : 12.5));
camera.lookAt(0, -0.5, 0);
camera.updateProjectionMatrix();
};
const ro = new ResizeObserver(([e]) =>
resize(e.contentRect.width, e.contentRect.height),
);
ro.observe(stage);
/* ---- Spin, drag and snap ---- */
let rot = 0;
let vel = 0;
let target: number | null = 0;
let dragging = false;
let moved = 0;
let lastX = 0;
let touched = -1e9;
let hovered = -1;
const nearest = (r: number) => Math.round(-r / STEP);
stepRef.current = (by: number) => {
target = -(nearest(target ?? rot) + by) * STEP;
vel = 0;
touched = performance.now();
};
const ray = new THREE.Raycaster();
const ndc = new THREE.Vector2();
const pick = (e: PointerEvent) => {
const r = stage.getBoundingClientRect();
ndc.set(
((e.clientX - r.left) / r.width) * 2 - 1,
-((e.clientY - r.top) / r.height) * 2 + 1,
);
ray.setFromCamera(ndc, camera);
const hit = ray.intersectObjects(panels, false)[0];
return hit ? (hit.object.userData.i as number) : -1;
};
const onDown = (e: PointerEvent) => {
dragging = true;
moved = 0;
lastX = e.clientX;
target = null;
stage.setPointerCapture?.(e.pointerId);
};
const onMove = (e: PointerEvent) => {
if (!dragging) {
hovered = e.pointerType === "mouse" ? pick(e) : -1;
stage.dataset.hover = hovered >= 0 ? "true" : "false";
return;
}
const r = stage.getBoundingClientRect();
const dx = e.clientX - lastX;
lastX = e.clientX;
moved += Math.abs(dx);
vel = (dx / r.width) * 3.2;
rot += vel;
touched = performance.now();
if (moved > 6) stage.dataset.dragging = "true";
};
const onUp = (e: PointerEvent) => {
if (!dragging) return;
dragging = false;
delete stage.dataset.dragging;
if (moved <= 6) {
// A click: bring that cover to the front along the short way round.
const i = pick(e);
if (i >= 0) {
const cur = nearest(rot);
let d = (((i - cur) % count) + count) % count;
if (d > count / 2) d -= count;
target = -(cur + d) * STEP;
}
}
touched = performance.now();
};
const onLeave = () => {
hovered = -1;
};
const onKey = (e: KeyboardEvent) => {
if (e.key === "ArrowLeft") stepRef.current(-1);
else if (e.key === "ArrowRight") stepRef.current(1);
else return;
e.preventDefault();
};
stage.addEventListener("pointerdown", onDown);
stage.addEventListener("pointermove", onMove);
stage.addEventListener("pointerup", onUp);
stage.addEventListener("pointercancel", onUp);
stage.addEventListener("pointerleave", onLeave);
stage.addEventListener("keydown", onKey);
/* ---- Loop ---- */
let raf = 0;
let visible = true;
let shown = 0;
let last = performance.now();
let mx = 0;
const onHover = (e: PointerEvent) => {
const r = root.getBoundingClientRect();
mx = ((e.clientX - r.left) / r.width) * 2 - 1;
};
root.addEventListener("pointermove", onHover);
const loop = (now: number) => {
raf = 0;
if (!visible || document.hidden) return;
const dt = Math.min(0.05, (now - last) / 1000);
last = now;
if (!dragging) {
if (target === null) {
rot += vel;
vel *= 0.92;
if (Math.abs(vel) < 0.002) target = -nearest(rot) * STEP;
} else {
rot += (target - rot) * (reduce ? 1 : 1 - Math.pow(0.004, dt));
}
// Idle: step to the next issue every few seconds.
if (!reduce && now - touched > 4200) {
stepRef.current(1);
touched = now - 200;
}
}
ring.rotation.y = rot;
ring.rotation.x = reduce ? 0.04 : 0.04 + Math.sin(now / 2400) * 0.015;
ring.rotation.z = reduce ? 0 : mx * -0.03;
for (const p of panels) {
const want = p.userData.i === hovered ? 0.45 : 0;
p.userData.lift += (want - p.userData.lift) * (reduce ? 1 : 0.12);
p.position.copy(p.userData.out).multiplyScalar(p.userData.lift);
}
const f = ((nearest(rot) % count) + count) % count;
if (f !== shown) {
shown = f;
setFront(f);
}
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
};
const wake = () => {
if (!raf && visible && !document.hidden) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
};
const io = new IntersectionObserver(([e]) => {
visible = e.isIntersecting;
wake();
});
io.observe(stage);
document.addEventListener("visibilitychange", wake);
wake();
return () => {
cancelAnimationFrame(raf);
ro.disconnect();
io.disconnect();
document.removeEventListener("visibilitychange", wake);
root.removeEventListener("pointermove", onHover);
stage.removeEventListener("pointerdown", onDown);
stage.removeEventListener("pointermove", onMove);
stage.removeEventListener("pointerup", onUp);
stage.removeEventListener("pointercancel", onUp);
stage.removeEventListener("pointerleave", onLeave);
stage.removeEventListener("keydown", onKey);
for (const p of panels) {
p.geometry.dispose();
const mat = p.material as THREE.MeshBasicMaterial;
mat.map?.dispose();
mat.dispose();
}
renderer.dispose();
renderer.forceContextLoss();
renderer.domElement.remove();
};
}, [issues, name, count]);
const issue = issues[front];
return (
<section
ref={rootRef}
className="gu-folio"
data-failed={failed || undefined}
style={{ "--accent": issue.bg } as CSSProperties}
aria-labelledby="gu-folio-title"
>
<header className="gu-folio__bar">
<a className="gu-folio__mark" href="#">
{name}
</a>
<p>A quarterly about the things people make by hand.</p>
<a className="gu-folio__cta" href={cta.href}>
{cta.label}
</a>
</header>
<h1 id="gu-folio-title" className="gu-folio__title">
{title}
</h1>
<div
ref={stageRef}
className="gu-folio__stage"
tabIndex={0}
role="group"
aria-roledescription="carousel"
aria-label={`Back issues. Showing No. ${front + 1}, ${issue.word}. Use the arrow keys to turn the shelf.`}
/>
{failed && (
<div className="gu-folio__fallback" aria-hidden="true">
{issues.slice(0, 5).map((it) => (
<span key={it.word} style={{ background: it.bg, color: it.ink }}>
{it.word}
</span>
))}
</div>
)}
<div className="gu-folio__info">
<button
type="button"
onClick={() => stepRef.current(-1)}
aria-label="Previous issue"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M15 5l-7 7 7 7" />
</svg>
</button>
<div aria-live="polite">
<div className="gu-folio__now" key={front}>
<p className="gu-folio__no">
No. {String(front + 1).padStart(2, "0")} <span>of {count}</span>{" "}
<span>{issue.season}</span>
</p>
<h2>{issue.word}</h2>
<p>{issue.blurb}</p>
<a href={`#folio-${issue.word.toLowerCase()}`}>Read this issue</a>
</div>
</div>
<button
type="button"
onClick={() => stepRef.current(1)}
aria-label="Next issue"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M9 5l7 7-7 7" />
</svg>
</button>
</div>
</section>
);
}
Paste this into ChatGPT, Claude, Cursor, v0, Lovable or Bolt. It describes the layout, motion, colors and accessibility and includes the code, so the AI can rebuild it in any framework.
# Build this UI piece: Magazine cover ring 3D hero
You are a senior front-end engineer. Recreate the piece below in my project. If I don't say which framework I use, ask once, then build it in that framework (React, Vue, Svelte, Angular, Astro, plain HTML/CSS/JS or anything else). Keep the behavior, motion, colors, spacing and accessibility exactly as described. Keep the code clean and commented for beginners.
## What it is
A hero for a print quarterly ("Folio"). Twelve back-issue covers hang on a 3D ring (three.js) that turns in front of the visitor. Each cover is drawn in code on a canvas, so the piece needs no images: a colour field, a simple motif, a masthead and a giant word.
## Layout and look
- Section min-height 780px, paper #f1ece2 with a lighter glow and a soft shadow ellipse under the ring. Ink #1b1915, muted #6b645a.
- Top bar in three columns: an italic serif wordmark, a one-line description, and a dark "Subscribe" pill.
- A centred serif h1 under the bar ("Twelve issues. One shelf.").
- Bottom centre: round prev and next buttons either side of the front issue's details, which swap with a soft blur-in each time:
- "No. 05 of 12" with a dot in the cover's colour, plus the season;
- the italic word;
- one sentence about the issue;
- a "Read this issue" link.
## The covers
600 × 800 canvases:
- a background colour and one of 12 motifs (wave lines, blocks, sun rings, petals, planet rings, a crystal grid, drift lines, a stone stack, arches, rays, a crescent moon, a halftone);
- a spaced-out masthead, the number and the season, and a rule;
- the word fitted to the width, alternating between italic serif and condensed uppercase;
- a fine random grain over the whole cover.
## The 3D scene
1. Ring radius = max(4.2, n × 2.65 / 2π). Each cover is a 24-segment plane whose vertices are bent straight onto the ring at angle i × step. They are front-face only, so the back of the ring disappears.
2. The camera sits slightly above and looks down a touch; the ring sways gently and leans with the cursor.
3. Drag spins it with inertia. Once slow, it eases the nearest cover to the front. A click (under 6px of movement) brings the clicked cover forward along the short way round. Hover lifts a cover 0.45 out along its outward normal.
4. Arrow keys and the buttons step one cover. When idle, it steps every 4.2s.
5. Rendering pauses off screen. On unmount, dispose every texture and call `forceContextLoss()`.
## Accessibility
The stage is a focusable group (aria-roledescription "carousel") whose label names the front issue. The details are real text in an aria-live region, and the buttons have labels. Without WebGL, a fan of flat CSS covers stands in.
## Props
name, title, cta ({ label, href }), issues ({ word, season, blurb, bg, ink, accent, motif }[]).
## Reference implementation
The original is written in React with one plain CSS file. Dependencies: three. Translate it faithfully; do not add new libraries unless my framework needs them.
### CoversHero.tsx
```tsx
"use client";
import { useEffect, useRef, useState, type CSSProperties } from "react";
import * as THREE from "three";
import "./covers-hero.css";
type Motif =
| "wave"
| "blocks"
| "sun"
| "petals"
| "rings"
| "grid"
| "lines"
| "stack"
| "arch"
| "rays"
| "moon"
| "dots";
export type Issue = {
word: string;
season: string;
blurb: string;
bg: string;
ink: string;
accent: string;
motif: Motif;
};
type CoversHeroProps = {
name?: string;
title?: string;
issues?: Issue[];
cta?: { label: string; href: string };
};
const ISSUES: Issue[] = [
{
word: "Tide",
season: "Spring 2024",
blurb:
"The sea issue: fishermen, cold-water swimmers and a lighthouse keeper's notebook.",
bg: "#1f45c9",
ink: "#f3eee3",
accent: "#8fb4ff",
motif: "wave",
},
{
word: "Form",
season: "Summer 2024",
blurb:
"Concrete, chairs and the stubborn beauty of buildings nobody asked for.",
bg: "#e8e6e1",
ink: "#111111",
accent: "#d7ff3a",
motif: "blocks",
},
{
word: "Ember",
season: "Autumn 2024",
blurb:
"Fire as a tool: bakers, glassblowers and a family that still smokes its own fish.",
bg: "#c43f1b",
ink: "#f7e9d7",
accent: "#ffb27a",
motif: "sun",
},
{
word: "Bloom",
season: "Winter 2024",
blurb:
"Flowers grown under glass in the darkest months, and the people who wait for them.",
bg: "#f0c4d1",
ink: "#2a1420",
accent: "#e04a7a",
motif: "petals",
},
{
word: "Orbit",
season: "Spring 2025",
blurb:
"Amateur astronomers, a retired satellite and the longest night of the year.",
bg: "#12123a",
ink: "#f3eee3",
accent: "#ff8a3d",
motif: "rings",
},
{
word: "Salt",
season: "Summer 2025",
blurb:
"The pans, the harvest and the quiet chemistry of the oldest seasoning.",
bg: "#e9e4da",
ink: "#24303a",
accent: "#6f8ea3",
motif: "grid",
},
{
word: "Drift",
season: "Autumn 2025",
blurb: "Slow travel by barge, ferry and one very patient postal boat.",
bg: "#9cc3c9",
ink: "#10282c",
accent: "#f3eee3",
motif: "lines",
},
{
word: "Quarry",
season: "Winter 2025",
blurb:
"Stone: who cuts it, who carves it and who walks on it without noticing.",
bg: "#b9a48b",
ink: "#2a2018",
accent: "#efe4d2",
motif: "stack",
},
{
word: "Hymn",
season: "Spring 2026",
blurb: "Choirs, bell ringers and the acoustics of empty churches.",
bg: "#2c2a26",
ink: "#e8d9b5",
accent: "#b08a4a",
motif: "arch",
},
{
word: "Lumen",
season: "Summer 2026",
blurb:
"Light at work: lamp makers, lighthouse lenses and the colour of noon.",
bg: "#f4dd6d",
ink: "#1d1a12",
accent: "#ffffff",
motif: "rays",
},
{
word: "Fable",
season: "Autumn 2026",
blurb: "Stories told at night, from bedtime to the last bus home.",
bg: "#3d6b45",
ink: "#f1ead6",
accent: "#e9c46a",
motif: "moon",
},
{
word: "Grain",
season: "Winter 2026",
blurb: "Bread, wood and film: three crafts that live in the grain.",
bg: "#d9c7a5",
ink: "#3a2a1a",
accent: "#8a5a2b",
motif: "dots",
},
];
const SERIF =
'"Bodoni 72", "Bodoni MT", Didot, "Playfair Display", Georgia, serif';
const CONDENSED =
'"Haettenschweiler", "Impact", "Arial Narrow Bold", sans-serif';
/** Draws one printed cover onto a canvas: a colour field, a motif, the masthead and the big word. */
function drawCover(issue: Issue, n: number, name: string) {
const W = 600;
const H = 800;
const c = document.createElement("canvas");
c.width = W;
c.height = H;
const g = c.getContext("2d")!;
g.fillStyle = issue.bg;
g.fillRect(0, 0, W, H);
g.save();
g.strokeStyle = issue.accent;
g.fillStyle = issue.accent;
g.lineWidth = 6;
const cx = W / 2;
const cy = H * 0.6;
switch (issue.motif) {
case "wave":
for (let k = 0; k < 9; k++) {
g.beginPath();
for (let x = 0; x <= W; x += 10) {
const y = H * 0.5 + k * 34 + Math.sin(x / 48 + k * 0.7) * 18;
if (x === 0) g.moveTo(x, y);
else g.lineTo(x, y);
}
g.globalAlpha = 0.25 + k * 0.08;
g.stroke();
}
break;
case "blocks":
g.fillRect(W * 0.12, H * 0.42, W * 0.32, H * 0.46);
g.fillStyle = issue.ink;
g.fillRect(W * 0.5, H * 0.56, W * 0.38, H * 0.32);
g.globalAlpha = 0.15;
g.fillRect(W * 0.3, H * 0.3, W * 0.4, H * 0.2);
break;
case "sun":
for (let k = 6; k > 0; k--) {
g.globalAlpha = 0.18 + (6 - k) * 0.12;
g.beginPath();
g.arc(cx, cy, k * 38, 0, Math.PI * 2);
g.fill();
}
break;
case "petals":
g.translate(cx, cy);
for (let k = 0; k < 8; k++) {
g.rotate(Math.PI / 4);
g.beginPath();
g.ellipse(0, -90, 40, 95, 0, 0, Math.PI * 2);
g.globalAlpha = 0.6;
g.fill();
}
g.globalAlpha = 1;
g.fillStyle = issue.ink;
g.beginPath();
g.arc(0, 0, 30, 0, Math.PI * 2);
g.fill();
break;
case "rings":
g.beginPath();
g.arc(cx, cy, 70, 0, Math.PI * 2);
g.fill();
g.lineWidth = 3;
for (let k = 1; k < 5; k++) {
g.globalAlpha = 0.9 - k * 0.15;
g.beginPath();
g.ellipse(cx, cy, 70 + k * 46, 22 + k * 14, -0.25, 0, Math.PI * 2);
g.stroke();
}
g.fillStyle = issue.ink;
for (let k = 0; k < 60; k++) {
g.globalAlpha = Math.random() * 0.8;
g.fillRect(Math.random() * W, Math.random() * H * 0.9, 2, 2);
}
break;
case "grid":
g.lineWidth = 2;
for (let x = 60; x < W; x += 60)
for (let y = H * 0.38; y < H - 30; y += 60) {
g.globalAlpha = 0.25 + ((x + y) % 120 === 0 ? 0.5 : 0);
g.strokeRect(x - 20, y - 20, 40, 40);
}
break;
case "lines":
for (let k = 0; k < 22; k++) {
g.globalAlpha = 0.5;
g.fillRect(
W * 0.1 + ((k * 37) % 200),
H * 0.4 + k * 18,
W * 0.3 + ((k * 53) % 180),
4,
);
}
break;
case "stack":
for (let k = 0; k < 6; k++) {
g.globalAlpha = 0.45 + k * 0.1;
const w = W * (0.7 - k * 0.08);
g.fillRect(
cx - w / 2 + ((k % 2) * 2 - 1) * 14,
H * 0.88 - (k + 1) * 62,
w,
54,
);
}
break;
case "arch":
g.lineWidth = 8;
for (let k = 0; k < 4; k++) {
g.globalAlpha = 1 - k * 0.22;
const r = 150 - k * 34;
g.beginPath();
g.moveTo(cx - r, H * 0.92);
g.lineTo(cx - r, cy);
g.arc(cx, cy, r, Math.PI, 0);
g.lineTo(cx + r, H * 0.92);
g.stroke();
}
break;
case "rays":
g.translate(cx, H);
for (let k = 0; k < 13; k++) {
g.globalAlpha = 0.55;
g.beginPath();
g.moveTo(0, 0);
const a = Math.PI + (k / 12) * Math.PI;
g.lineTo(Math.cos(a - 0.04) * 700, Math.sin(a - 0.04) * 700);
g.lineTo(Math.cos(a + 0.04) * 700, Math.sin(a + 0.04) * 700);
g.fill();
}
break;
case "moon":
g.beginPath();
g.arc(cx + 40, cy - 20, 110, 0, Math.PI * 2);
g.fill();
g.fillStyle = issue.bg;
g.beginPath();
g.arc(cx + 90, cy - 50, 100, 0, Math.PI * 2);
g.fill();
g.fillStyle = issue.accent;
for (let k = 0; k < 12; k++) {
g.globalAlpha = 0.7;
g.beginPath();
g.arc((k * 97) % W, H * 0.42 + ((k * 61) % 300), 3, 0, Math.PI * 2);
g.fill();
}
break;
case "dots":
for (let y = H * 0.42; y < H - 20; y += 26)
for (let x = 26; x < W; x += 26) {
const r = 2 + 8 * Math.abs(Math.sin(x / 90 + y / 120));
g.globalAlpha = 0.6;
g.beginPath();
g.arc(x, y, r, 0, Math.PI * 2);
g.fill();
}
break;
}
g.restore();
// Masthead, number and the big word: every other cover swaps serif for condensed.
g.fillStyle = issue.ink;
g.font = `600 22px ${SERIF}`;
g.textBaseline = "top";
g.fillText(name.toUpperCase().split("").join(" "), 36, 34);
g.textAlign = "right";
g.font = `500 18px system-ui, sans-serif`;
g.fillText(`No. ${String(n).padStart(2, "0")}`, W - 36, 36);
g.fillText(issue.season, W - 36, 60);
g.textAlign = "left";
g.fillRect(36, 92, W - 72, 2);
const serif = n % 2 === 1;
let size = serif ? 200 : 260;
g.font = serif
? `italic 400 ${size}px ${SERIF}`
: `400 ${size}px ${CONDENSED}`;
const word = serif ? issue.word : issue.word.toUpperCase();
const m = g.measureText(word).width;
size = Math.min(size, (size * (W - 72)) / m);
g.font = serif
? `italic 400 ${size}px ${SERIF}`
: `400 ${size}px ${CONDENSED}`;
g.textBaseline = "alphabetic";
g.fillText(word, 34, 110 + size * 0.82);
// A little print grain.
const img = g.getImageData(0, 0, W, H);
for (let i = 0; i < img.data.length; i += 4) {
const d = (Math.random() - 0.5) * 22;
img.data[i] += d;
img.data[i + 1] += d;
img.data[i + 2] += d;
}
g.putImageData(img, 0, 0);
return c;
}
/**
* CoversHero
* - Twelve magazine covers, each drawn in code on a canvas, hang on a slowly turning ring.
* - Drag to spin it with inertia; it snaps the nearest cover to the front. Hover lifts a
* cover out of the ring; click brings it forward. Arrow keys and the buttons step through.
* - The front cover's number, season and story sit below in real text.
*/
export function CoversHero({
name = "Folio",
title = "Twelve issues. One shelf.",
issues = ISSUES,
cta = { label: "Subscribe, 4 issues a year", href: "#folio-subscribe" },
}: CoversHeroProps) {
const rootRef = useRef<HTMLElement>(null);
const stageRef = useRef<HTMLDivElement>(null);
const stepRef = useRef<(by: number) => void>(() => {});
const [front, setFront] = useState(0);
const [failed, setFailed] = useState(false);
const count = issues.length;
useEffect(() => {
const root = rootRef.current;
const stage = stageRef.current;
if (!root || !stage) return;
const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
let renderer: THREE.WebGLRenderer;
try {
renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
} catch {
const id = requestAnimationFrame(() => setFailed(true));
return () => cancelAnimationFrame(id);
}
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setClearColor(0x000000, 0);
stage.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(32, 1, 0.1, 60);
const R = Math.max(4.2, (count * 2.65) / (Math.PI * 2));
const STEP = (Math.PI * 2) / count;
const ring = new THREE.Group();
scene.add(ring);
/* ---- Curved cover panels, baked straight into ring space ---- */
const PW = 2.2;
const PH = 2.93;
const panels = issues.map((issue, i) => {
const geo = new THREE.PlaneGeometry(PW, PH, 24, 1);
const p = geo.attributes.position;
const base = i * STEP;
for (let k = 0; k < p.count; k++) {
const a = base + p.getX(k) / R;
p.setXYZ(k, Math.sin(a) * R, p.getY(k), Math.cos(a) * R);
}
geo.computeVertexNormals();
const tex = new THREE.CanvasTexture(drawCover(issue, i + 1, name));
tex.colorSpace = THREE.SRGBColorSpace;
tex.anisotropy = renderer.capabilities.getMaxAnisotropy();
const mesh = new THREE.Mesh(
geo,
new THREE.MeshBasicMaterial({ map: tex }),
);
mesh.userData = {
i,
out: new THREE.Vector3(Math.sin(base), 0, Math.cos(base)),
lift: 0,
};
ring.add(mesh);
return mesh;
});
const resize = (w: number, h: number) => {
if (w < 2 || h < 2) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
const narrow = camera.aspect < 0.9;
camera.fov = narrow ? 40 : 30;
camera.position.set(0, 1.6, R + (narrow ? 14 : 12.5));
camera.lookAt(0, -0.5, 0);
camera.updateProjectionMatrix();
};
const ro = new ResizeObserver(([e]) =>
resize(e.contentRect.width, e.contentRect.height),
);
ro.observe(stage);
/* ---- Spin, drag and snap ---- */
let rot = 0;
let vel = 0;
let target: number | null = 0;
let dragging = false;
let moved = 0;
let lastX = 0;
let touched = -1e9;
let hovered = -1;
const nearest = (r: number) => Math.round(-r / STEP);
stepRef.current = (by: number) => {
target = -(nearest(target ?? rot) + by) * STEP;
vel = 0;
touched = performance.now();
};
const ray = new THREE.Raycaster();
const ndc = new THREE.Vector2();
const pick = (e: PointerEvent) => {
const r = stage.getBoundingClientRect();
ndc.set(
((e.clientX - r.left) / r.width) * 2 - 1,
-((e.clientY - r.top) / r.height) * 2 + 1,
);
ray.setFromCamera(ndc, camera);
const hit = ray.intersectObjects(panels, false)[0];
return hit ? (hit.object.userData.i as number) : -1;
};
const onDown = (e: PointerEvent) => {
dragging = true;
moved = 0;
lastX = e.clientX;
target = null;
stage.setPointerCapture?.(e.pointerId);
};
const onMove = (e: PointerEvent) => {
if (!dragging) {
hovered = e.pointerType === "mouse" ? pick(e) : -1;
stage.dataset.hover = hovered >= 0 ? "true" : "false";
return;
}
const r = stage.getBoundingClientRect();
const dx = e.clientX - lastX;
lastX = e.clientX;
moved += Math.abs(dx);
vel = (dx / r.width) * 3.2;
rot += vel;
touched = performance.now();
if (moved > 6) stage.dataset.dragging = "true";
};
const onUp = (e: PointerEvent) => {
if (!dragging) return;
dragging = false;
delete stage.dataset.dragging;
if (moved <= 6) {
// A click: bring that cover to the front along the short way round.
const i = pick(e);
if (i >= 0) {
const cur = nearest(rot);
let d = (((i - cur) % count) + count) % count;
if (d > count / 2) d -= count;
target = -(cur + d) * STEP;
}
}
touched = performance.now();
};
const onLeave = () => {
hovered = -1;
};
const onKey = (e: KeyboardEvent) => {
if (e.key === "ArrowLeft") stepRef.current(-1);
else if (e.key === "ArrowRight") stepRef.current(1);
else return;
e.preventDefault();
};
stage.addEventListener("pointerdown", onDown);
stage.addEventListener("pointermove", onMove);
stage.addEventListener("pointerup", onUp);
stage.addEventListener("pointercancel", onUp);
stage.addEventListener("pointerleave", onLeave);
stage.addEventListener("keydown", onKey);
/* ---- Loop ---- */
let raf = 0;
let visible = true;
let shown = 0;
let last = performance.now();
let mx = 0;
const onHover = (e: PointerEvent) => {
const r = root.getBoundingClientRect();
mx = ((e.clientX - r.left) / r.width) * 2 - 1;
};
root.addEventListener("pointermove", onHover);
const loop = (now: number) => {
raf = 0;
if (!visible || document.hidden) return;
const dt = Math.min(0.05, (now - last) / 1000);
last = now;
if (!dragging) {
if (target === null) {
rot += vel;
vel *= 0.92;
if (Math.abs(vel) < 0.002) target = -nearest(rot) * STEP;
} else {
rot += (target - rot) * (reduce ? 1 : 1 - Math.pow(0.004, dt));
}
// Idle: step to the next issue every few seconds.
if (!reduce && now - touched > 4200) {
stepRef.current(1);
touched = now - 200;
}
}
ring.rotation.y = rot;
ring.rotation.x = reduce ? 0.04 : 0.04 + Math.sin(now / 2400) * 0.015;
ring.rotation.z = reduce ? 0 : mx * -0.03;
for (const p of panels) {
const want = p.userData.i === hovered ? 0.45 : 0;
p.userData.lift += (want - p.userData.lift) * (reduce ? 1 : 0.12);
p.position.copy(p.userData.out).multiplyScalar(p.userData.lift);
}
const f = ((nearest(rot) % count) + count) % count;
if (f !== shown) {
shown = f;
setFront(f);
}
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
};
const wake = () => {
if (!raf && visible && !document.hidden) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
};
const io = new IntersectionObserver(([e]) => {
visible = e.isIntersecting;
wake();
});
io.observe(stage);
document.addEventListener("visibilitychange", wake);
wake();
return () => {
cancelAnimationFrame(raf);
ro.disconnect();
io.disconnect();
document.removeEventListener("visibilitychange", wake);
root.removeEventListener("pointermove", onHover);
stage.removeEventListener("pointerdown", onDown);
stage.removeEventListener("pointermove", onMove);
stage.removeEventListener("pointerup", onUp);
stage.removeEventListener("pointercancel", onUp);
stage.removeEventListener("pointerleave", onLeave);
stage.removeEventListener("keydown", onKey);
for (const p of panels) {
p.geometry.dispose();
const mat = p.material as THREE.MeshBasicMaterial;
mat.map?.dispose();
mat.dispose();
}
renderer.dispose();
renderer.forceContextLoss();
renderer.domElement.remove();
};
}, [issues, name, count]);
const issue = issues[front];
return (
<section
ref={rootRef}
className="gu-folio"
data-failed={failed || undefined}
style={{ "--accent": issue.bg } as CSSProperties}
aria-labelledby="gu-folio-title"
>
<header className="gu-folio__bar">
<a className="gu-folio__mark" href="#">
{name}
</a>
<p>A quarterly about the things people make by hand.</p>
<a className="gu-folio__cta" href={cta.href}>
{cta.label}
</a>
</header>
<h1 id="gu-folio-title" className="gu-folio__title">
{title}
</h1>
<div
ref={stageRef}
className="gu-folio__stage"
tabIndex={0}
role="group"
aria-roledescription="carousel"
aria-label={`Back issues. Showing No. ${front + 1}, ${issue.word}. Use the arrow keys to turn the shelf.`}
/>
{failed && (
<div className="gu-folio__fallback" aria-hidden="true">
{issues.slice(0, 5).map((it) => (
<span key={it.word} style={{ background: it.bg, color: it.ink }}>
{it.word}
</span>
))}
</div>
)}
<div className="gu-folio__info">
<button
type="button"
onClick={() => stepRef.current(-1)}
aria-label="Previous issue"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M15 5l-7 7 7 7" />
</svg>
</button>
<div aria-live="polite">
<div className="gu-folio__now" key={front}>
<p className="gu-folio__no">
No. {String(front + 1).padStart(2, "0")} <span>of {count}</span>{" "}
<span>{issue.season}</span>
</p>
<h2>{issue.word}</h2>
<p>{issue.blurb}</p>
<a href={`#folio-${issue.word.toLowerCase()}`}>Read this issue</a>
</div>
</div>
<button
type="button"
onClick={() => stepRef.current(1)}
aria-label="Next issue"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M9 5l7 7-7 7" />
</svg>
</button>
</div>
</section>
);
}
```
### covers-hero.css
```css
/* Folio: a reading-room shelf; the covers carry the colour, the page stays quiet paper. */
.gu-folio {
--bg: #f1ece2;
--ink: #1b1915;
--muted: #6b645a;
--line: rgb(27 25 21 / 0.15);
--focus: #2b35ff;
--accent: #1f45c9;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--serif: "Bodoni 72", "Bodoni MT", Didot, "Playfair Display", Georgia, serif;
position: relative;
container-type: inline-size;
display: grid;
grid-template-rows: auto auto 1fr auto;
min-height: 780px;
overflow: hidden;
isolation: isolate;
background:
radial-gradient(50% 30% at 50% 78%, rgb(27 25 21 / 0.12), transparent 70%),
radial-gradient(80% 60% at 50% 40%, #faf7f0, var(--bg));
color: var(--ink);
font-family:
system-ui,
-apple-system,
"Segoe UI",
sans-serif;
line-height: 1.5;
}
.gu-folio *,
.gu-folio *::before,
.gu-folio *::after {
box-sizing: border-box;
}
.gu-folio a {
color: inherit;
}
.gu-folio :focus-visible {
outline: 3px solid var(--focus);
outline-offset: 3px;
}
.gu-folio__stage {
position: absolute;
inset: 0;
z-index: 0;
cursor: grab;
touch-action: pan-y;
}
.gu-folio__stage[data-hover="true"] {
cursor: pointer;
}
.gu-folio__stage[data-dragging] {
cursor: grabbing;
}
.gu-folio__stage:focus-visible {
outline-offset: -6px;
}
.gu-folio__stage canvas {
display: block;
width: 100%;
height: 100%;
}
.gu-folio__bar,
.gu-folio__title,
.gu-folio__info {
position: relative;
z-index: 1;
pointer-events: none;
}
.gu-folio__bar a,
.gu-folio__info a,
.gu-folio__info button {
pointer-events: auto;
}
.gu-folio__bar {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 20px;
padding: 22px 5%;
border-bottom: 1px solid var(--line);
}
.gu-folio__mark {
font-family: var(--serif);
font-size: 1.7rem;
font-style: italic;
text-decoration: none;
}
.gu-folio__bar p {
margin: 0;
font-size: 0.85rem;
color: var(--muted);
}
.gu-folio__cta {
justify-self: end;
white-space: nowrap;
padding: 10px 18px;
border-radius: 999px;
background: var(--ink);
color: var(--bg) !important;
font-size: 0.88rem;
font-weight: 650;
text-decoration: none;
transition: transform 0.3s var(--ease);
}
.gu-folio__cta:hover {
transform: translateY(-2px);
}
.gu-folio__title {
margin: 26px 5% 0;
font-family: var(--serif);
font-size: clamp(2rem, 4.4cqi, 3.6rem);
font-weight: 400;
line-height: 1;
letter-spacing: -0.015em;
text-align: center;
animation: gu-folio-rise 1s var(--ease) both;
}
/* The front cover's details, with prev and next on either side. */
.gu-folio__info {
grid-row: 4;
display: grid;
grid-template-columns: auto minmax(0, 460px) auto;
justify-content: center;
align-items: center;
gap: 24px;
padding: 0 5% 34px;
text-align: center;
}
.gu-folio__info button {
display: grid;
place-items: center;
width: 48px;
aspect-ratio: 1;
border: 1px solid var(--line);
border-radius: 50%;
background: rgb(250 247 240 / 0.7);
color: var(--ink);
cursor: pointer;
transition:
background-color 0.3s var(--ease),
color 0.3s var(--ease),
transform 0.3s var(--ease);
}
.gu-folio__info button:hover {
background: var(--ink);
color: var(--bg);
}
.gu-folio__info button:active {
transform: scale(0.94);
}
.gu-folio__info svg {
width: 18px;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.gu-folio__now {
animation: gu-folio-swap 0.6s var(--ease) both;
}
.gu-folio__no {
display: inline-flex;
align-items: center;
gap: 10px;
margin: 0 0 2px;
font-size: 0.82rem;
font-weight: 650;
font-variant-numeric: tabular-nums;
}
.gu-folio__no::before {
content: "";
width: 10px;
aspect-ratio: 1;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 3px rgb(27 25 21 / 0.08);
}
.gu-folio__no span {
color: var(--muted);
font-weight: 400;
}
.gu-folio__now h2 {
margin: 0;
font-family: var(--serif);
font-size: 2rem;
font-weight: 400;
font-style: italic;
line-height: 1.1;
}
.gu-folio__now p:not(.gu-folio__no) {
margin: 4px 0 8px;
color: var(--muted);
font-size: 0.95rem;
}
.gu-folio__now a {
font-size: 0.9rem;
font-weight: 650;
text-underline-offset: 4px;
}
@keyframes gu-folio-rise {
from {
opacity: 0;
transform: translateY(18px);
}
}
@keyframes gu-folio-swap {
from {
opacity: 0;
transform: translateY(10px);
filter: blur(4px);
}
}
/* No WebGL: a fanned stack of flat covers. */
.gu-folio__fallback {
grid-row: 3;
display: flex;
justify-content: center;
align-items: center;
padding: 24px;
}
.gu-folio__fallback span {
display: grid;
place-items: end start;
width: 18cqi;
aspect-ratio: 3 / 4;
margin: 0 -2cqi;
padding: 12px;
font-family: var(--serif);
font-size: 3cqi;
font-style: italic;
box-shadow: 0 20px 40px -20px rgb(0 0 0 / 0.5);
}
.gu-folio__fallback span:nth-child(odd) {
rotate: -4deg;
}
.gu-folio__fallback span:nth-child(even) {
rotate: 3deg;
}
@container (max-width: 720px) {
.gu-folio__bar {
grid-template-columns: 1fr auto;
}
.gu-folio__bar p {
display: none;
}
.gu-folio__info {
gap: 10px;
}
.gu-folio__info button {
width: 42px;
}
}
@media (prefers-reduced-motion: reduce) {
.gu-folio *,
.gu-folio *::before {
animation: none !important;
transition: none !important;
}
}
```
You might also want
Next piece: Music festival page with a timetable plannerGlass prism 3D hero
Components, advanced, needs three
Contour map 3D hero
Components, advanced, needs three
Glossy toys physics 3D hero
Components, advanced, needs three