1/**
2 * Terra, regenerative agriculture & climate-farming collective.
3 *
4 * The page itself grows. The hero is a pinned vertical cross-section from sky
5 * to root zone: as you scroll, root systems branch downward through five soil
6 * horizons, carbon particles fall from the sky and are banked as green flecks
7 * in the earth, and a live per-hectare counter climbs. A season slider (always
8 * on screen) re-tints the whole site spring -> summer -> autumn -> winter,
9 * moving the sun, shifting the sky and laying snow on the ground.
10 *
11 * Below: topographic contour lines that draw across the field, a live carbon
12 * ledger with growing bars and a drawn trend line, an interactive field map
13 * (hover / focus / tap a plot and its crop rows are drawn in and its soil
14 * data appears), a mycelium network with travelling signals, grower voices
15 * that grow in, and a calm sign-up form.
16 *
17 * Everything is procedural SVG + CSS custom properties driven from a single
18 * rAF scroll loop (no React state per frame). No images, no web fonts, no
19 * network. prefers-reduced-motion renders the fully grown, static scene.
20 * SSR-safe: window/document are only touched inside effects.
21 */
22import { useEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from "react";
23
24/* ------------------------------------------------------------------ */
25/* Procedural generation (deterministic) */
26/* ------------------------------------------------------------------ */
27function rng(seed: number) {
28 let a = seed >>> 0;
29 return () => {
30 a = (a + 0x6d2b79f5) >>> 0;
31 let t = a;
32 t = Math.imul(t ^ (t >>> 15), t | 1);
33 t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
34 return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
35 };
36}
37const f1 = (n: number) => Math.round(n * 10) / 10;
38const HZ = 458; // horizon y in the 1200x1000 scene
39
40type Stroke = { d: string; delay: number; w: number; o?: number };
41type Leaf = { x: number; y: number; rx: number; ry: number; rot: number; delay: number; c: 1 | 2 };
42
43function buildScene() {
44 const r = rng(11);
45 const stems: Stroke[] = [];
46 const blades: Stroke[] = [];
47 const ears: { x: number; y: number; delay: number; rot: number }[] = [];
48 const leaves: Leaf[] = [];
49 const flowers: { x: number; y: number; delay: number }[] = [];
50 const roots: Stroke[] = [];
51 const bases: { x: number; delay: number }[] = [];
52
53 const addRoot = (x: number, y: number, ang: number, len: number, depth: number, maxD: number, d0: number, w: number) => {
54 const ex = x + Math.sin(ang) * len;
55 const ey = y + Math.cos(ang) * len;
56 const cx = x + Math.sin(ang + (r() - 0.5) * 0.9) * len * 0.5;
57 const cy = y + Math.cos(ang) * len * 0.45;
58 roots.push({ d: `M${f1(x)} ${f1(y)}Q${f1(cx)} ${f1(cy)} ${f1(ex)} ${f1(ey)}`, delay: d0, w, o: 0.95 - depth * 0.12 });
59 if (depth < maxD) {
60 const n = depth === 0 ? 2 : 2;
61 for (let i = 0; i < n; i++) {
62 const t = 0.35 + r() * 0.45;
63 const px = x + (ex - x) * t;
64 const py = y + (ey - y) * t;
65 const side = i % 2 ? 1 : -1;
66 addRoot(px, py, ang + side * (0.55 + r() * 0.6), len * (0.42 + r() * 0.18), depth + 1, maxD, d0 + 0.1 + depth * 0.04, Math.max(0.8, w * 0.6));
67 }
68 }
69 };
70
71 // wheat
72 for (let i = 0; i < 11; i++) {
73 const x = 110 + i * 92 + r() * 26;
74 const h = 130 + r() * 90;
75 const lean = (r() - 0.5) * 46;
76 const d = r() * 0.28;
77 const qx = x + lean * 0.15;
78 const qy = HZ - h * 0.55;
79 const tx = x + lean;
80 const ty = HZ - h;
81 stems.push({ d: `M${f1(x)} ${HZ}Q${f1(qx)} ${f1(qy)} ${f1(tx)} ${f1(ty)}`, delay: d, w: 3 });
82 [0.28, 0.46, 0.64].forEach((t, k) => {
83 const px = (1 - t) * (1 - t) * x + 2 * (1 - t) * t * qx + t * t * tx;
84 const py = (1 - t) * (1 - t) * HZ + 2 * (1 - t) * t * qy + t * t * ty;
85 const side = k % 2 ? 1 : -1;
86 blades.push({ d: `M${f1(px)} ${f1(py)}q${side * 20} ${-26 - k * 3} ${side * 42} ${-12 - k * 5}`, delay: d + 0.2 + k * 0.07, w: 3.4 });
87 });
88 ears.push({ x: tx, y: ty, delay: d + 0.45, rot: lean * 0.5 });
89 bases.push({ x, delay: d });
90 // fibrous roots
91 for (let k = 0; k < 4; k++) addRoot(x, HZ + 4, (k - 1.5) * 0.42 + (r() - 0.5) * 0.15, 150 + r() * 110, 0, 1, 0.02 + r() * 0.1, 2.6);
92 }
93 // broadleaf cover crop / clover
94 for (let i = 0; i < 6; i++) {
95 const x = 160 + i * 168 + r() * 40;
96 const h = 60 + r() * 55;
97 const d = 0.05 + r() * 0.25;
98 const lean = (r() - 0.5) * 20;
99 stems.push({ d: `M${f1(x)} ${HZ}Q${f1(x + lean)} ${f1(HZ - h * 0.6)} ${f1(x + lean * 1.4)} ${f1(HZ - h)}`, delay: d, w: 2.6 });
100 for (let k = 0; k < 5; k++) {
101 const t = 0.25 + k * 0.17;
102 const side = k % 2 ? 1 : -1;
103 leaves.push({ x: x + lean * t * 1.3 + side * 9, y: HZ - h * t, rx: 13, ry: 7, rot: side * 28 - 90 + 90, delay: d + 0.2 + k * 0.05, c: k % 2 ? 1 : 2 });
104 }
105 flowers.push({ x: x + lean * 1.4, y: HZ - h - 4, delay: d + 0.55 });
106 addRoot(x, HZ + 4, (r() - 0.5) * 0.2, 210 + r() * 40, 0, 2, 0.05, 3);
107 }
108 // hedge on the left + tree on the right
109 for (let k = 0; k < 6; k++) leaves.push({ x: 40 + (k % 3) * 26 + r() * 8, y: HZ - 28 - Math.floor(k / 3) * 26, rx: 28, ry: 22, rot: 0, delay: 0.3 + k * 0.04, c: k % 2 ? 1 : 2 });
110 stems.push({ d: `M1096 ${HZ}Q1092 ${HZ - 70} 1100 ${HZ - 170}`, delay: 0.1, w: 11 });
111 stems.push({ d: `M1098 ${HZ - 100}Q1070 ${HZ - 130} 1052 ${HZ - 168}`, delay: 0.32, w: 5 });
112 stems.push({ d: `M1099 ${HZ - 130}Q1130 ${HZ - 160} 1150 ${HZ - 190}`, delay: 0.36, w: 5 });
113 const canopy: [number, number, number][] = [[1100, 100, 54], [1056, 130, 42], [1150, 128, 44], [1100, 150, 50], [1070, 88, 36], [1138, 90, 36]];
114 canopy.forEach(([x, y, rr], k) => leaves.push({ x, y, rx: rr, ry: rr * 0.82, rot: 0, delay: 0.42 + k * 0.05, c: k % 2 ? 1 : 2 }));
115 for (let k = 0; k < 7; k++) addRoot(1096, HZ + 6, (k - 3) * 0.34 + (r() - 0.5) * 0.1, 280 + r() * 190, 0, 2, 0.05 + r() * 0.1, 5.2);
116
117 // soil
118 const specks: { x: number; y: number; r: number; c: string }[] = [];
119 const cols = ["#8a6a45", "#2b1c12", "#a8855a", "#3b2616", "#c4a572"];
120 for (let i = 0; i < 260; i++) {
121 const y = HZ + 10 + r() * 530;
122 specks.push({ x: r() * 1200, y, r: 0.8 + r() * (y > 780 ? 5 : 2.2), c: cols[Math.floor(r() * cols.length)] });
123 }
124 const store: { x: number; y: number; delay: number }[] = [];
125 for (let i = 0; i < 70; i++) store.push({ x: 40 + r() * 1120, y: HZ + 24 + r() * 330, delay: r() * 0.6 });
126 const falling: { x: number; dx: number; dy: number; dur: number; del: number }[] = [];
127 for (let i = 0; i < 22; i++) falling.push({ x: 60 + r() * 1080, dx: (r() - 0.5) * 80, dy: 300 + r() * 230, dur: 7 + r() * 6, del: -r() * 12 });
128 const worms = [
129 `M180 ${HZ + 70}q30 -16 60 0t60 0t60 0`,
130 `M820 ${HZ + 150}q-30 14 -60 0t-60 0t-60 0t-40 6`,
131 `M420 ${HZ + 230}q26 -14 52 0t52 0`,
132 ];
133 return { stems, blades, ears, leaves, flowers, roots, bases, specks, store, falling, worms };
134}
135const SCENE = buildScene();
136
137const wave = (y: number, amp: number, ph: number) => {
138 let d = `M0 ${y}`;
139 for (let x = 0; x <= 1200; x += 40) d += `L${x} ${f1(y + Math.sin(x * 0.011 + ph) * amp + Math.sin(x * 0.027 + ph * 2) * amp * 0.5)}`;
140 return d + "L1200 1000L0 1000Z";
141};
142const STRATA = [
143 { y: 920, fill: "#4d4a46", amp: 5, ph: 3 },
144 { y: 790, fill: "#8a6a45", amp: 7, ph: 2 },
145 { y: 640, fill: "#6b4a2e", amp: 6, ph: 1 },
146 { y: 500, fill: "#4a3020", amp: 4, ph: 0.4 },
147 { y: HZ + 2, fill: "#2b1c12", amp: 2.5, ph: 5 },
148];
149const STRATA_PATHS = STRATA.map((s) => ({ ...s, d: wave(s.y, s.amp, s.ph) }));
150
151/* Contours */
152function buildContours() {
153 const hills = [
154 { cx: 300, cy: 280, n: 13, step: 24, ax: 1.5, ay: 1, ph: 0.4 },
155 { cx: 820, cy: 430, n: 15, step: 22, ax: 1.2, ay: 1, ph: 2.1 },
156 { cx: 1050, cy: 150, n: 8, step: 20, ax: 1.1, ay: 0.9, ph: 4.2 },
157 ];
158 const out: { d: string; idx: boolean; delay: number; label?: { x: number; y: number; t: string } }[] = [];
159 hills.forEach((h, hi) => {
160 for (let i = 1; i <= h.n; i++) {
161 const base = i * h.step;
162 let d = "";
163 for (let a = 0; a <= 6.2832 + 0.01; a += 0.1) {
164 const k = 1 + 0.16 * Math.sin(2 * a + h.ph + i * 0.08) + 0.1 * Math.sin(3 * a + h.ph * 2) + 0.05 * Math.sin(5 * a + i * 0.3);
165 const x = h.cx + Math.cos(a) * base * h.ax * k;
166 const y = h.cy + Math.sin(a) * base * h.ay * k;
167 d += (a === 0 ? "M" : "L") + f1(x) + " " + f1(y);
168 }
169 const idx = i % 4 === 0;
170 out.push({
171 d: d + "Z",
172 idx,
173 delay: ((h.n - i) / h.n) * 0.7 + hi * 0.06,
174 label: idx ? { x: h.cx + base * h.ax * 1.0 + 4, y: h.cy + 4, t: `${380 + (h.n - i) * 10} m` } : undefined,
175 });
176 }
177 });
178 return out;
179}
180const CONTOURS = buildContours();
181
182/* Plots (field map) */
183type Plot = { id: string; name: string; crop: string; practice: string; since: number; ha: number; som: number; carbon: number; kind: "wheat" | "clover" | "pasture" | "orchard" | "fallow"; poly: string; clip: string; cx: number; cy: number; ang: number };
184const PLOT_DATA: Omit<Plot, "poly" | "clip" | "cx" | "cy" | "ang">[] = [
185 { id: "p1", name: "North Meadow", crop: "Perennial pasture", practice: "Rotational grazing", since: 2019, ha: 14.2, som: 6.8, carbon: 1.9, kind: "pasture" },
186 { id: "p2", name: "Hedge Row", crop: "Spelt + hedgerow", practice: "Alley cropping", since: 2020, ha: 8.6, som: 5.4, carbon: 2.7, kind: "wheat" },
187 { id: "p3", name: "Long Acre", crop: "Winter rye", practice: "No-till, cover crop", since: 2021, ha: 18.0, som: 4.9, carbon: 1.2, kind: "wheat" },
188 { id: "p4", name: "Alder Brook", crop: "Riparian buffer", practice: "Native planting", since: 2018, ha: 5.1, som: 8.2, carbon: 3.4, kind: "orchard" },
189 { id: "p5", name: "Clover Flat", crop: "Red clover ley", practice: "Nitrogen-fixing ley", since: 2022, ha: 11.7, som: 4.1, carbon: 1.1, kind: "clover" },
190 { id: "p6", name: "Stone Wall", crop: "Heritage wheat", practice: "Minimum till, compost", since: 2020, ha: 16.4, som: 5.2, carbon: 1.5, kind: "wheat" },
191 { id: "p7", name: "The Orchard", crop: "Apple + clover", practice: "Silvopasture", since: 2017, ha: 6.9, som: 7.1, carbon: 3.1, kind: "orchard" },
192 { id: "p8", name: "Pond Field", crop: "Mixed vegetables", practice: "Compost, living mulch", since: 2023, ha: 3.4, som: 3.8, carbon: 0.9, kind: "clover" },
193 { id: "p9", name: "South Fallow", crop: "Fallow / rewilding", practice: "Natural succession", since: 2016, ha: 9.8, som: 7.6, carbon: 2.2, kind: "fallow" },
194 { id: "p10", name: "Wind Hill", crop: "Barley + vetch", practice: "Relay intercrop", since: 2021, ha: 20.3, som: 4.6, carbon: 1.4, kind: "wheat" },
195 { id: "p11", name: "Mill Pasture", crop: "Herbal ley", practice: "Mob grazing", since: 2019, ha: 13.5, som: 6.2, carbon: 2.0, kind: "pasture" },
196 { id: "p12", name: "East Terrace", crop: "Oats + peas", practice: "Contour strips", since: 2022, ha: 10.2, som: 4.3, carbon: 1.3, kind: "clover" },
197];
198function buildPlots(): Plot[] {
199 const r = rng(5);
200 const V: [number, number][][] = [];
201 for (let j = 0; j <= 3; j++) {
202 V.push([]);
203 for (let i = 0; i <= 4; i++) {
204 const edgeX = i === 0 || i === 4;
205 const edgeY = j === 0 || j === 3;
206 V[j].push([60 + i * 170 + (edgeX ? (r() - 0.5) * 10 : (r() - 0.5) * 44), 40 + j * 145 + (edgeY ? (r() - 0.5) * 10 : (r() - 0.5) * 40)]);
207 }
208 }
209 return PLOT_DATA.map((p, k) => {
210 const i = k % 4;
211 const j = Math.floor(k / 4);
212 const pts = [V[j][i], V[j][i + 1], V[j + 1][i + 1], V[j + 1][i]];
213 const cx = pts.reduce((s, q) => s + q[0], 0) / 4;
214 const cy = pts.reduce((s, q) => s + q[1], 0) / 4;
215 const poly = pts.map((q) => `${f1(q[0])},${f1(q[1])}`).join(" ");
216 const ang = (r() - 0.5) * 50 + (p.kind === "pasture" ? 90 : 0);
217 return { ...p, poly, clip: poly, cx, cy, ang };
218 });
219}
220const PLOTS = buildPlots();
221
222/* Mycelium */
223function buildMyc() {
224 const r = rng(23);
225 const nodes: { x: number; y: number }[] = [{ x: 300, y: 40 }];
226 for (let i = 0; i < 44; i++) nodes.push({ x: 20 + r() * 560, y: 40 + r() * 330 });
227 const edges: { a: number; b: number; d: string; delay: number }[] = [];
228 nodes.forEach((n, i) => {
229 if (i === 0) return;
230 const near = nodes
231 .map((m, j) => ({ j, dist: Math.hypot(m.x - n.x, m.y - n.y) }))
232 .filter((o) => o.j < i)
233 .sort((a, b) => a.dist - b.dist)
234 .slice(0, i < 3 ? 1 : 2);
235 near.forEach((o) => {
236 const m = nodes[o.j];
237 const mx = (n.x + m.x) / 2 + (r() - 0.5) * 30;
238 const my = (n.y + m.y) / 2 + (r() - 0.5) * 30;
239 edges.push({ a: i, b: o.j, d: `M${f1(m.x)} ${f1(m.y)}Q${f1(mx)} ${f1(my)} ${f1(n.x)} ${f1(n.y)}`, delay: Math.min(0.75, (n.y - 40) / 420 + r() * 0.1) });
240 });
241 });
242 return { nodes, edges };
243}
244const MYC = buildMyc();
245
246/* ------------------------------------------------------------------ */
247/* Seasons */
248/* ------------------------------------------------------------------ */
249const SEASONS = ["Spring", "Summer", "Autumn", "Winter"];
250const STOPS = [
251 { sky1: "#cfe8d8", sky2: "#f6f0d6", leaf: "#6fae3b", leaf2: "#9ccf4a", wheat: "#b8c46a", bg: "#f3ecda", sun: "#ffe08a", bloom: 0.9, snow: 0, sy: 0, hill: "#7fae5a" },
252 { sky1: "#8cc8e8", sky2: "#fbe9b0", leaf: "#3e8f2d", leaf2: "#5fb540", wheat: "#e2b94a", bg: "#f5ecd0", sun: "#ffd24a", bloom: 1, snow: 0, sy: -40, hill: "#5f9b3c" },
253 { sky1: "#e8b98a", sky2: "#f7dcae", leaf: "#b86a2a", leaf2: "#d89a35", wheat: "#c98a3a", bg: "#f1e2c6", sun: "#ff9a4a", bloom: 0.72, snow: 0, sy: 40, hill: "#b9803a" },
254 { sky1: "#b9c6cf", sky2: "#e9ecec", leaf: "#7d8a6a", leaf2: "#a3ad92", wheat: "#b9a98a", bg: "#ebe9e2", sun: "#f1f5f7", bloom: 0.3, snow: 1, sy: 80, hill: "#9aa58f" },
255];
256const hex2 = (h: string) => [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16));
257const mixHex = (a: string, b: string, t: number) => {
258 const A = hex2(a);
259 const B = hex2(b);
260 return "#" + A.map((v, i) => Math.round(v + (B[i] - v) * t).toString(16).padStart(2, "0")).join("");
261};
262function applySeason(el: HTMLElement, s: number) {
263 const i = Math.min(2, Math.floor(s));
264 const t = s - i;
265 const a = STOPS[i];
266 const b = STOPS[i + 1];
267 const set = (k: string, v: string) => el.style.setProperty(k, v);
268 (["sky1", "sky2", "leaf", "leaf2", "wheat", "bg", "sun", "hill"] as const).forEach((k) => set(`--${k}`, mixHex(a[k], b[k], t)));
269 set("--bloom", String(a.bloom + (b.bloom - a.bloom) * t));
270 set("--snow", String(a.snow + (b.snow - a.snow) * t));
271 set("--sy", `${a.sy + (b.sy - a.sy) * t}px`);
272}
273
274/* ------------------------------------------------------------------ */
275/* Hooks */
276/* ------------------------------------------------------------------ */
277function useInView<T extends HTMLElement>(threshold = 0.25): [React.RefObject<T | null>, boolean] {
278 const ref = useRef<T | null>(null);
279 const [seen, setSeen] = useState(false);
280 useEffect(() => {
281 const el = ref.current;
282 if (!el) return;
283 if (typeof IntersectionObserver === "undefined") {
284 setSeen(true);
285 return;
286 }
287 const io = new IntersectionObserver(
288 (es) => {
289 if (es.some((e) => e.isIntersecting)) {
290 setSeen(true);
291 io.disconnect();
292 }
293 },
294 { threshold },
295 );
296 io.observe(el);
297 return () => io.disconnect();
298 }, [threshold]);
299 return [ref, seen];
300}
301const v = (o: Record<string, string | number>) => o as unknown as CSSProperties;
302
303/* ------------------------------------------------------------------ */
304/* Hero scene */
305/* ------------------------------------------------------------------ */
306function Scene() {
307 const S = SCENE;
308 const ticks = [0, 30, 60, 120, 200];
309 const tickY = [HZ, 500, 640, 790, 920];
310 const labels = [
311 ["O", "Litter layer", HZ + 22],
312 ["A", "Topsoil, 6% organic matter", 570],
313 ["B", "Subsoil", 715],
314 ["C", "Parent material", 860],
315 ["R", "Bedrock", 965],
316 ] as const;
317 return (
318 <svg className="tr-scene" viewBox="0 0 1200 1000" preserveAspectRatio="xMidYMid slice" role="img" aria-label="Cross-section from sky to root zone: crops, a tree and their roots growing through five soil layers while carbon is stored in the soil">
319 <defs>
320 <linearGradient id="tr-sky" x1="0" y1="0" x2="0" y2="1">
321 <stop offset="0" stopColor="var(--sky1)" />
322 <stop offset="1" stopColor="var(--sky2)" />
323 </linearGradient>
324 <linearGradient id="tr-fade" x1="0" y1="0" x2="0" y2="1">
325 <stop offset="0" stopColor="#000" stopOpacity="0" />
326 <stop offset="1" stopColor="#000" stopOpacity=".28" />
327 </linearGradient>
328 </defs>
329 <rect width="1200" height={HZ + 4} fill="url(#tr-sky)" />
330 <g transform={`translate(0 ${HZ - 330})`}>
331 <circle className="tr-sun" cx="860" cy="120" r="46" fill="var(--sun)" />
332 <circle className="tr-sun tr-halo" cx="860" cy="120" r="78" fill="var(--sun)" />
333 <g className="tr-clouds" fill="#fff" opacity=".7">
334 <g className="tr-cl a"><ellipse cx="200" cy="90" rx="70" ry="16" /><ellipse cx="240" cy="76" rx="40" ry="14" /></g>
335 <g className="tr-cl b"><ellipse cx="620" cy="150" rx="90" ry="14" /><ellipse cx="660" cy="136" rx="46" ry="13" /></g>
336 <g className="tr-cl c"><ellipse cx="1000" cy="60" rx="60" ry="12" /></g>
337 </g>
338 <path d="M0 300Q150 240 300 280T620 270T900 285T1200 250V340H0Z" fill="var(--hill)" opacity=".28" />
339 <path d="M0 320Q200 280 420 308T800 300T1200 296V340H0Z" fill="var(--hill)" opacity=".5" />
340 </g>
341
342 {/* soil horizons */}
343 {STRATA_PATHS.map((s) => <path key={s.y} d={s.d} fill={s.fill} />)}
344 <rect y={HZ} width="1200" height="542" fill="url(#tr-fade)" />
345 {S.specks.map((p, i) => <circle key={i} cx={f1(p.x)} cy={f1(p.y)} r={f1(p.r)} fill={p.c} opacity=".55" />)}
346
347 {/* snow */}
348 <path className="tr-snow" d={`M0 ${HZ - 4}Q60 ${HZ - 12} 120 ${HZ - 4}T240 ${HZ - 4}T360 ${HZ - 4}T480 ${HZ - 4}T600 ${HZ - 4}T720 ${HZ - 4}T840 ${HZ - 4}T960 ${HZ - 4}T1080 ${HZ - 4}T1200 ${HZ - 4}V${HZ + 6}H0Z`} fill="#f7fbfc" />
349
350 {/* roots */}
351 <g fill="none" strokeLinecap="round" stroke="#efdcb4">
352 {S.roots.map((p, i) => <path key={i} className="tr-dr" pathLength={1} d={p.d} strokeWidth={p.w} style={v({ "--d": p.delay, opacity: p.o ?? 1 })} />)}
353 </g>
354
355 {/* stored carbon */}
356 <g className="tr-store">
357 {S.store.map((c, i) => <rect key={i} className="tr-fleck" x={f1(c.x)} y={f1(c.y)} width="5" height="5" style={v({ "--d": c.delay })} />)}
358 </g>
359
360 {/* falling carbon */}
361 <g className="tr-fall" fill="var(--sun)">
362 {S.falling.map((c, i) => (
363 <g key={i} className="tr-co" style={v({ "--dx": `${f1(c.dx)}px`, "--dy": `${f1(c.dy)}px`, animationDuration: `${f1(c.dur)}s`, animationDelay: `${f1(c.del)}s` })}>
364 <circle cx={f1(c.x)} cy="150" r="5" fill="#fff" stroke="#2a1d14" strokeWidth="1.2" />
365 <text x={f1(c.x)} y="153" fontSize="7" textAnchor="middle" fill="#2a1d14" fontFamily="ui-monospace,monospace" fontWeight="700">C</text>
366 </g>
367 ))}
368 </g>
369
370 {/* labels */}
371 <g className="tr-lab" fontFamily="ui-monospace,SFMono-Regular,Menlo,monospace" fontSize="13">
372 {labels.map(([k, t, y]) => (
373 <g key={k}>
374 <text x="22" y={y} fill="#f3ecda" opacity=".9"><tspan fontWeight="700" fill="#3be34f">{k}</tspan> {t}</text>
375 </g>
376 ))}
377 {ticks.map((t, i) => (
378 <g key={t} opacity=".7">
379 <path d={`M1140 ${tickY[i]}h38`} stroke="#f3ecda" strokeWidth="1" />
380 <text x="1176" y={tickY[i] - 5} textAnchor="end" fill="#f3ecda">{t} cm</text>
381 </g>
382 ))}
383 </g>
384 </svg>
385 );
386}
387
388/* ------------------------------------------------------------------ */
389/* Sections */
390/* ------------------------------------------------------------------ */
391const STEPS = [
392 ["01", "Seed", "Living roots feed soil life from day one."],
393 ["02", "Shoot", "Cover crops and wheat turn sunlight into sugar."],
394 ["03", "Root", "Roots push carbon down through every horizon."],
395 ["04", "Store", "Fungi lock it into stable humus for decades."],
396];
397
398function Hero({ reduced }: { reduced: boolean }) {
399 return (
400 <header className={`tr-hero${reduced ? " is-static" : ""}`} id="top">
401 <div className="tr-stage" data-hero style={v({ "--p": reduced ? 1 : 0, "--gs": reduced ? 1 : 0, "--gr": reduced ? 1 : 0, "--gc": reduced ? 1 : 0, "--tp": 0 })}>
402 <Scene />
403 <div className="tr-hero-t">
404 <p className="tr-eyebrow">Terra / regenerative farming collective</p>
405 <h1>Grow the <br className="tr-br" /><em>ground</em> back.</h1>
406 <p className="tr-lede">We help farms rebuild living soil, and we pay for the carbon it keeps. Scroll to plant a season.</p>
407 </div>
408 <div className="tr-hint" aria-hidden="true"><span>scroll to grow</span><i /></div>
409 <div className="tr-counter" aria-live="off">
410 <small>carbon banked in this hectare</small>
411 <b><span data-counter>{reduced ? "+3.80" : "+0.00"}</span> <i>t CO₂e / yr</i></b>
412 </div>
413 <ol className="tr-steps" data-steps>
414 {STEPS.map(([n, t, d], i) => (
415 <li key={n} data-i={i}>
416 <span>{n}</span>
417 <b>{t}</b>
418 <em>{d}</em>
419 </li>
420 ))}
421 </ol>
422 </div>
423 </header>
424 );
425}
426
427function Contours() {
428 return (
429 <section className="tr-sec tr-contour" id="land" data-prog>
430 <svg className="tr-contour-svg" viewBox="0 0 1200 560" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
431 {CONTOURS.map((c, i) => (
432 <g key={i}>
433 <path className={`tr-dc${c.idx ? " idx" : ""}`} pathLength={1} d={c.d} fill="none" style={v({ "--d": c.delay })} />
434 {c.label && <text className="tr-dc-l" x={f1(c.label.x)} y={f1(c.label.y)} style={v({ "--d": c.delay + 0.2 })}>{c.label.t}</text>}
435 </g>
436 ))}
437 <path className="tr-dc fence" pathLength={1} d="M120 80L520 60L560 320L180 360Z" fill="none" style={v({ "--d": 0.85 })} />
438 </svg>
439 <div className="tr-wrap tr-contour-in">
440 <div className="tr-card">
441 <p className="tr-eyebrow dark">01 / Read the land</p>
442 <h2>Plant the water <em>before</em> the crop.</h2>
443 <p>
444 Every Terra farm begins with a contour survey. We map slope, flow and
445 infiltration, then place keylines, swales and cover so rain walks
446 slowly through the field instead of running off it.
447 </p>
448 <dl className="tr-stats">
449 <div><dt>-38%</dt><dd>runoff after two seasons</dd></div>
450 <div><dt>2.1x</dt><dd>faster water infiltration</dd></div>
451 <div><dt>0</dt><dd>days of bare soil</dd></div>
452 </dl>
453 </div>
454 </div>
455 </section>
456 );
457}
458
459const PRACTICES = [
460 { n: "Agroforestry", v: 3.1 },
461 { n: "Rotational grazing", v: 1.6 },
462 { n: "Cover crops", v: 1.2 },
463 { n: "Compost & biochar", v: 1.0 },
464 { n: "No-till", v: 0.6 },
465];
466const TREND = [4.1, 12.8, 31, 58, 96, 141, 184.2];
467
468function Ledger() {
469 const [ref, seen] = useInView<HTMLDivElement>(0.2);
470 const [tons, setTons] = useState(184206.4);
471 useEffect(() => {
472 const t0 = Date.now();
473 const id = window.setInterval(() => setTons(184206.4 + ((Date.now() - t0) / 1000) * 0.38), 100);
474 return () => window.clearInterval(id);
475 }, []);
476 const pts = TREND.map((val, i) => `${40 + i * 90},${210 - (val / 190) * 180}`);
477 const line = "M" + pts.join("L");
478 return (
479 <section className="tr-sec tr-ledger" id="carbon">
480 <div className="tr-wrap" ref={ref}>
481 <p className="tr-eyebrow">02 / The ledger</p>
482 <h2>Every tonne, <em>counted in soil.</em></h2>
483 <div className="tr-big" aria-live="off">
484 <b>{tons.toLocaleString("en-US", { minimumFractionDigits: 1, maximumFractionDigits: 1 })}</b>
485 <span>tonnes CO₂e verified in Terra soils since 2019</span>
486 </div>
487 <div className={`tr-ledger-grid${seen ? " in" : ""}`}>
488 <div className="tr-panel">
489 <h3>Per hectare, per year</h3>
490 {PRACTICES.map((p, i) => (
491 <div className="tr-bar" key={p.n}>
492 <span>{p.n}</span>
493 <div><i style={v({ "--w": p.v / 3.2, "--i": i })} /></div>
494 <b>{p.v.toFixed(1)} t</b>
495 </div>
496 ))}
497 </div>
498 <div className="tr-panel">
499 <h3>Cumulative, thousand tonnes</h3>
500 <svg viewBox="0 0 640 240" role="img" aria-label="Carbon banked per year rising from 4 thousand tonnes in 2019 to 184 thousand in 2026">
501 {[0, 1, 2, 3].map((k) => <path key={k} d={`M40 ${30 + k * 60}H620`} stroke="rgba(243,236,218,.14)" />)}
502 <path className="tr-line" pathLength={1} d={line} fill="none" />
503 <path className="tr-area" d={`${line}L${40 + 6 * 90} 210L40 210Z`} />
504 {pts.map((p, i) => {
505 const [x, y] = p.split(",");
506 return (
507 <g key={i}>
508 <circle className="tr-dot" cx={x} cy={y} r="4.5" style={v({ "--i": i })} />
509 <text x={x} y="232" textAnchor="middle" className="tr-ax">{2019 + i}</text>
510 </g>
511 );
512 })}
513 </svg>
514 <p className="tr-note">Verified by deep-core sampling every five years. Credits retire only after verification.</p>
515 </div>
516 </div>
517 </div>
518 </section>
519 );
520}
521
522function FieldMap() {
523 const [active, setActive] = useState<string | null>(null);
524 const [pinned, setPinned] = useState<string | null>(null);
525 const cur = PLOTS.find((p) => p.id === (active ?? pinned)) ?? null;
526 const [ref, seen] = useInView<HTMLDivElement>(0.15);
527 const fillFor = (k: Plot["kind"]) =>
528 ({ wheat: "var(--wheat)", clover: "var(--leaf2)", pasture: "var(--leaf)", orchard: "#5a6b33", fallow: "#a58b63" })[k];
529 return (
530 <section className="tr-sec tr-plots" id="plots">
531 <div className="tr-wrap">
532 <p className="tr-eyebrow dark">03 / The farm map</p>
533 <h2>Twelve plots, <em>each with a story.</em></h2>
534 <div className={`tr-map-grid${seen ? " in" : ""}`} ref={ref}>
535 <div className="tr-map">
536 <svg viewBox="0 0 800 520" role="group" aria-label="Field map of Hollin Farm with twelve plots. Hover, focus or tap a plot for details.">
537 <defs>
538 {PLOTS.map((p) => <clipPath key={p.id} id={`tr-c-${p.id}`}><polygon points={p.clip} /></clipPath>)}
539 </defs>
540 <rect width="800" height="520" fill="rgba(42,29,20,.06)" />
541 {PLOTS.map((p) => {
542 const on = cur?.id === p.id;
543 const lines = Array.from({ length: 16 }, (_, k) => k);
544 return (
545 <g
546 key={p.id}
547 className={`tr-plot${on ? " on" : ""}`}
548 tabIndex={0}
549 role="button"
550 aria-label={`${p.name}, ${p.crop}`}
551 aria-pressed={pinned === p.id}
552 onMouseEnter={() => setActive(p.id)}
553 onMouseLeave={() => setActive(null)}
554 onFocus={() => setActive(p.id)}
555 onBlur={() => setActive(null)}
556 onClick={() => setPinned((s) => (s === p.id ? null : p.id))}
557 onKeyDown={(e) => {
558 if (e.key === "Enter" || e.key === " ") {
559 e.preventDefault();
560 setPinned((s) => (s === p.id ? null : p.id));
561 }
562 }}
563 >
564 <polygon points={p.poly} className="tr-plot-f" fill={fillFor(p.kind)} />
565 <g clipPath={`url(#tr-c-${p.id})`}>
566 <g transform={`rotate(${f1(p.ang)} ${f1(p.cx)} ${f1(p.cy)})`}>
567 {lines.map((k) => (
568 <path key={k} className="tr-row" pathLength={1} d={`M${f1(p.cx - 130)} ${f1(p.cy - 90 + k * 12)}H${f1(p.cx + 130)}`} style={v({ "--i": k })} />
569 ))}
570 </g>
571 </g>
572 <polygon points={p.poly} className="tr-plot-o" fill="none" />
573 <text x={f1(p.cx)} y={f1(p.cy + 4)} textAnchor="middle" className="tr-plot-t">{p.name}</text>
574 </g>
575 );
576 })}
577 <path className="tr-river" d="M-10 262C120 240 190 300 330 270S560 230 650 275 760 300 810 285" fill="none" />
578 <text x="700" y="304" className="tr-river-t" transform="rotate(8 700 304)">Alder Brook</text>
579 </svg>
580 <div className="tr-legend" aria-hidden="true">
581 <span><i style={{ background: "var(--wheat)" }} />Grain</span>
582 <span><i style={{ background: "var(--leaf2)" }} />Ley / veg</span>
583 <span><i style={{ background: "var(--leaf)" }} />Pasture</span>
584 <span><i style={{ background: "#5a6b33" }} />Trees</span>
585 <span><i style={{ background: "#a58b63" }} />Rewilding</span>
586 </div>
587 </div>
588 <aside className="tr-info" aria-live="polite">
589 {cur ? (
590 <>
591 <p className="tr-eyebrow dark">{cur.crop}</p>
592 <h3>{cur.name}</h3>
593 <p className="tr-info-p">{cur.practice}, regenerative since {cur.since}.</p>
594 <dl>
595 <div><dt>Area</dt><dd>{cur.ha} ha</dd></div>
596 <div><dt>Organic matter</dt><dd>{cur.som}%</dd></div>
597 <div><dt>Carbon</dt><dd>{cur.carbon} t/ha/yr</dd></div>
598 </dl>
599 <div className="tr-som"><i style={v({ "--w": Math.min(1, cur.som / 9) })} /></div>
600 <small>Soil organic matter vs. a 9% native-prairie benchmark.</small>
601 </>
602 ) : (
603 <>
604 <p className="tr-eyebrow dark">Hollin Farm / 128 ha</p>
605 <h3>Hover a plot.</h3>
606 <p className="tr-info-p">Crop rows grow into the field and its soil numbers appear here. Tap or press Enter to pin one.</p>
607 </>
608 )}
609 </aside>
610 </div>
611 </div>
612 </section>
613 );
614}
615
616function Mycelium() {
617 const [ref, seen] = useInView<HTMLDivElement>(0.25);
618 const signals = MYC.edges.filter((_, i) => i % 9 === 0).slice(0, 6);
619 return (
620 <section className="tr-sec tr-myc" id="soil">
621 <div className="tr-wrap tr-myc-grid" ref={ref}>
622 <div className={`tr-myc-svg${seen ? " in" : ""}`}>
623 <svg viewBox="0 0 600 400" role="img" aria-label="A procedurally drawn fungal network linking plant roots, with signals travelling along it">
624 {MYC.edges.map((e, i) => <path key={i} className="tr-hy" pathLength={1} d={e.d} fill="none" style={v({ "--d": e.delay })} />)}
625 {MYC.nodes.map((n, i) => <circle key={i} className="tr-nd" cx={f1(n.x)} cy={f1(n.y)} r={i === 0 ? 8 : 3} style={v({ "--d": i === 0 ? 0 : Math.min(0.8, (n.y - 40) / 420) })} />)}
626 {signals.map((e, i) => <circle key={i} className="tr-sig" r="3.4" style={v({ offsetPath: `path("${e.d}")`, animationDelay: `${i * 0.9}s` })} />)}
627 </svg>
628 </div>
629 <div>
630 <p className="tr-eyebrow">04 / Under one footstep</p>
631 <h2>The <em>wood-wide</em> web does the heavy lifting.</h2>
632 <p className="tr-lead">
633 Mycorrhizal fungi trade minerals for sugar and bind carbon into
634 aggregates that outlast any single crop. Tillage tears the web;
635 living cover rebuilds it. We measure both.
636 </p>
637 <div className="tr-count-row">
638 <Count to={1000} suffix="M" label="bacteria in a teaspoon" go={seen} />
639 <Count to={48} suffix=" m" label="fungal hyphae per gram" go={seen} />
640 <Count to={19} suffix="%" label="more water held per point of organic matter" go={seen} />
641 </div>
642 </div>
643 </div>
644 </section>
645 );
646}
647
648function Count({ to, suffix, label, go }: { to: number; suffix: string; label: string; go: boolean }) {
649 const [val, setVal] = useState(to);
650 const mounted = useRef(false);
651 useEffect(() => {
652 if (!mounted.current) {
653 mounted.current = true;
654 if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) setVal(0);
655 return;
656 }
657 if (!go) return;
658 if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
659 setVal(to);
660 return;
661 }
662 let raf = 0;
663 const t0 = performance.now();
664 const tick = (now: number) => {
665 const p = Math.min(1, (now - t0) / 1600);
666 setVal(Math.round(to * (1 - Math.pow(1 - p, 3))));
667 if (p < 1) raf = requestAnimationFrame(tick);
668 };
669 raf = requestAnimationFrame(tick);
670 return () => cancelAnimationFrame(raf);
671 }, [go, to]);
672 return (
673 <div className="tr-count">
674 <b>{val.toLocaleString("en-US")}{suffix}</b>
675 <span>{label}</span>
676 </div>
677 );
678}
679
680const LOOK: Record<string, string> = { p1: "a woman with a gray bob", p2: "a bearded man with dark hair", p3: "a woman with braided hair", p4: "a man with short curly hair", p5: "a smiling man with a short beard", p6: "a woman with long wavy dark hair", p7: "a bearded man in round glasses", p8: "a smiling man with swept-back hair", p9: "a woman with natural curly hair" };
681const portraitAlt = (n: string, r: string, src: string) => `${n}, ${r}: portrait of ${LOOK[src.match(/p\d/)?.[0] ?? ""] ?? "a person"} in a black sweater`;
682
683const VOICES = [
684 { q: "We stopped fighting the field and started feeding it. Year four, the wheat stands in a drought and the earthworms are back in the headlands.", n: "Maren Holt", img: "/img/people/p1.webp", r: "Long Acre, 62 ha, Lower Saxony" },
685 { q: "Terra paid for the hedgerows before the first harvest from them. That is the only reason my bank said yes.", n: "Joaquin Ferrer", img: "/img/people/p2.webp", r: "Vall Seca orchards, Catalonia" },
686 { q: "The map showed me my worst corner was my best carbon. I would never have guessed. Now I plan around it.", n: "Aoife Brennan", img: "/img/people/p6.webp", r: "Mill Pasture, 40 ha, County Meath" },
687];
688
689function Voices() {
690 const [ref, seen] = useInView<HTMLDivElement>(0.2);
691 return (
692 <section className="tr-sec tr-voices" id="growers">
693 <div className="tr-wrap" ref={ref}>
694 <p className="tr-eyebrow dark">05 / Growers</p>
695 <h2>Farmers who <em>left the soil better.</em></h2>
696 <div className={`tr-vgrid${seen ? " in" : ""}`}>
697 {VOICES.map((x, i) => (
698 <figure key={x.n} className="tr-voice" style={v({ "--i": i })}>
699 <svg viewBox="0 0 40 40" width="34" height="34" aria-hidden="true"><path d="M20 38V16" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" /><path d="M20 22C8 22 6 12 6 6c8 0 14 4 14 16ZM20 18c0-9 5-12 14-12 0 7-4 12-14 12Z" fill="var(--leaf)" /></svg>
700 <blockquote>{x.q}</blockquote>
701 <figcaption><img src={x.img} alt={portraitAlt(x.n, `farmer at ${x.r}`, x.img)} width={52} height={52} loading="lazy" decoding="async" /><b>{x.n}</b><span>{x.r}</span></figcaption>
702 </figure>
703 ))}
704 </div>
705 </div>
706 </section>
707 );
708}
709
710function Join() {
711 const [done, setDone] = useState(false);
712 const [ha, setHa] = useState("50-200");
713 const [mail, setMail] = useState("");
714 const [err, setErr] = useState("");
715 return (
716 <section className="tr-sec tr-join" id="join" data-prog>
717 <div className="tr-wrap tr-join-in">
718 <p className="tr-eyebrow">06 / Begin</p>
719 <h2>Start with a <em>soil test.</em></h2>
720 <p className="tr-lead">We core, map and model your land for free. If the numbers work, we co-fund the first three years of transition.</p>
721 {done ? (
722 <div className="tr-done" role="status"><b>Seed planted.</b> A Terra agronomist will write to {mail} within two working days.</div>
723 ) : (
724 <form
725 className="tr-form"
726 noValidate
727 onSubmit={(e) => {
728 e.preventDefault();
729 if (!/.+@.+\..+/.test(mail)) return setErr("Please enter a valid e-mail.");
730 setErr("");
731 setDone(true);
732 }}
733 >
734 <label>Farm size
735 <select value={ha} onChange={(e) => setHa(e.target.value)}>
736 {["under 20", "20-50", "50-200", "200-1000", "over 1000"].map((x) => <option key={x} value={x}>{x} ha</option>)}
737 </select>
738 </label>
739 <label>E-mail
740 <input type="email" value={mail} onChange={(e) => setMail(e.target.value)} placeholder="you@farm.example" autoComplete="email" />
741 </label>
742 <button type="submit">Request a soil test</button>
743 {err && <p className="tr-err" role="alert">{err}</p>}
744 </form>
745 )}
746 </div>
747 <footer className="tr-foot">
748 <span>Terra Regenerative Collective, 2026</span>
749 <span>Soil is the largest living carbon store we can rebuild.</span>
750 </footer>
751 </section>
752 );
753}
754
755/* ------------------------------------------------------------------ */
756/* Page */
757/* ------------------------------------------------------------------ */
758function Nav({ children }: { children?: ReactNode }) {
759 return (
760 <nav className="tr-nav" aria-label="Main">
761 <a href="#top" className="tr-logo">
762 <svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M12 22V9" stroke="currentColor" strokeWidth="2" strokeLinecap="round" /><path d="M12 14C5 14 3 8 3 3c6 0 9 3 9 11ZM12 11c0-6 3-8 9-8 0 5-3 8-9 8Z" fill="#3be34f" stroke="currentColor" strokeWidth="1.2" /></svg>
763 Terra
764 </a>
765 <div className="tr-links">
766 <a href="#land">Land</a><a href="#carbon">Carbon</a><a href="#plots">Plots</a><a href="#soil">Soil</a><a href="#growers">Growers</a>
767 </div>
768 <a className="tr-cta" href="#join">Soil test</a>
769 {children}
770 </nav>
771 );
772}
773
774export function Page() {
775 const root = useRef<HTMLDivElement | null>(null);
776 const [season, setSeason] = useState(0.35);
777 const [reduced, setReduced] = useState(false);
778
779 useEffect(() => {
780 if (root.current) applySeason(root.current, season);
781 }, [season]);
782
783 useEffect(() => {
784 const el = root.current;
785 if (!el) return;
786 const rm = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
787 setReduced(rm);
788 if (rm) return;
789 const stage = el.querySelector<HTMLElement>("[data-hero]");
790 const track = stage?.parentElement ?? null;
791 const counter = el.querySelector<HTMLElement>("[data-counter]");
792 const steps = el.querySelector<HTMLElement>("[data-steps]");
793 const progs = Array.from(el.querySelectorAll<HTMLElement>("[data-prog]"));
794 const clamp = (x: number) => Math.max(0, Math.min(1, x));
795 let raf = 0;
796 let lastP = -1;
797 let lastStep = -1;
798 const update = () => {
799 raf = 0;
800 const vh = window.innerHeight;
801 if (stage && track) {
802 const rect = track.getBoundingClientRect();
803 const p = clamp(-rect.top / Math.max(1, rect.height - vh));
804 if (Math.abs(p - lastP) > 0.0004) {
805 lastP = p;
806 const gs = clamp(p / 0.42);
807 const gr = clamp((p - 0.28) / 0.5);
808 const gc = clamp((p - 0.5) / 0.45);
809 stage.style.setProperty("--p", p.toFixed(4));
810 stage.style.setProperty("--gs", gs.toFixed(4));
811 stage.style.setProperty("--gr", gr.toFixed(4));
812 stage.style.setProperty("--gc", gc.toFixed(4));
813 if (counter) counter.textContent = "+" + (gc * 3.8).toFixed(2);
814 const step = p < 0.1 ? 0 : p < 0.38 ? 1 : p < 0.7 ? 2 : 3;
815 if (step !== lastStep && steps) {
816 lastStep = step;
817 steps.dataset.step = String(step);
818 }
819 }
820 }
821 progs.forEach((s) => {
822 const r = s.getBoundingClientRect();
823 if (r.bottom < -100 || r.top > vh + 100) return;
824 s.style.setProperty("--sp", clamp((vh - r.top) / (vh * 0.85 + r.height * 0.5)).toFixed(4));
825 });
826 };
827 const onScroll = () => {
828 if (!raf) raf = requestAnimationFrame(update);
829 };
830 update();
831 window.addEventListener("scroll", onScroll, { passive: true });
832 window.addEventListener("resize", onScroll);
833 return () => {
834 window.removeEventListener("scroll", onScroll);
835 window.removeEventListener("resize", onScroll);
836 if (raf) cancelAnimationFrame(raf);
837 };
838 }, []);
839
840 const sIdx = Math.min(3, Math.round(season));
841 return (
842 <div className={`tr${reduced ? " reduced" : ""}`} ref={root}>
843 <style>{CSS}</style>
844 <Nav />
845 <Hero reduced={reduced} />
846 <div className="tr-edge" aria-hidden="true">
847 <svg aria-hidden="true" focusable="false" viewBox="0 0 1200 60" preserveAspectRatio="none"><path d="M0 0H1200V30Q1100 55 1000 34T800 34T600 26T400 38T200 26T0 36Z" fill="#2b1c12" /></svg>
848 </div>
849 <main>
850 <Contours />
851 <Ledger />
852 <FieldMap />
853 <Mycelium />
854 <Voices />
855 <Join />
856 </main>
857 <div className="tr-season" role="group" aria-label="Season">
858 <span className="tr-season-n">{SEASONS[sIdx]}</span>
859 <input
860 type="range"
861 min={0}
862 max={3}
863 step={0.01}
864 value={season}
865 aria-label="Season, spring to winter"
866 aria-valuetext={SEASONS[sIdx]}
867 onChange={(e) => setSeason(Number(e.target.value))}
868 />
869 <div className="tr-season-t" aria-hidden="true">{SEASONS.map((s) => <span key={s}>{s.slice(0, 3)}</span>)}</div>
870 </div>
871 </div>
872 );
873}
874
875export default Page;
876
877/* ------------------------------------------------------------------ */
878/* Styles */
879/* ------------------------------------------------------------------ */
880const CSS = `
881.tr{--soil:#2b1c12;--soil2:#5b3d26;--moss:#5a6b33;--ink:#2a1d14;--cream:#f3ecda;--chl:#3be34f;
882 --sky1:#cfe8d8;--sky2:#f6f0d6;--leaf:#6fae3b;--leaf2:#9ccf4a;--wheat:#b8c46a;--bg:#f3ecda;--sun:#ffe08a;--bloom:.9;--snow:0;--sy:0px;--hill:#7fae5a;
883 --serif:"Fraunces","Iowan Old Style","Palatino Linotype",Palatino,"Book Antiqua",Georgia,serif;
884 --sans:"Instrument Sans",ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
885 --mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
886 box-sizing:border-box;position:relative;font-family:var(--sans);font-size:16px;line-height:1.55;color:var(--ink);background:var(--bg);transition:background-color .3s;overflow-x:clip}
887.tr *,.tr *::before,.tr *::after{box-sizing:border-box}
888.tr h1,.tr h2,.tr h3{font-family:var(--serif);font-weight:500;line-height:1.02;letter-spacing:-.02em;margin:0}
889.tr h2{font-size:clamp(34px,5.4vw,70px);margin-bottom:22px}
890.tr h3{font-size:22px;letter-spacing:-.01em}
891.tr em{font-style:italic;color:var(--moss)}
892.tr p{margin:0 0 1em}
893.tr a{color:inherit}
894.tr-wrap{max-width:1160px;margin:0 auto;padding:0 28px;position:relative}
895.tr-eyebrow{font-family:var(--mono);font-size:12px;letter-spacing:.14em;text-transform:uppercase;margin:0 0 16px;color:var(--cream);opacity:.85}
896.tr-eyebrow.dark{color:var(--moss);opacity:1}
897.tr-sec{position:relative;padding:120px 0}
898.tr-lead{font-size:19px;max-width:52ch}
899
900/* nav */
901.tr-nav{position:fixed;top:0;left:0;right:0;z-index:40;display:flex;align-items:center;gap:24px;padding:14px 28px;color:var(--cream);mix-blend-mode:normal}
902.tr .tr-logo{display:flex;align-items:center;gap:8px;font-family:var(--serif);font-size:24px;text-decoration:none;font-weight:600;color:var(--ink);background:rgba(243,236,218,.85);padding:4px 12px 4px 8px;border-radius:99px}
903.tr-links{display:flex;gap:4px;margin-left:auto;background:rgba(243,236,218,.85);padding:4px;border-radius:99px;color:var(--ink)}
904.tr-links a{padding:6px 12px;border-radius:99px;font-size:14px;text-decoration:none}
905.tr-links a:hover{background:var(--ink);color:var(--cream)}
906.tr-cta{background:var(--chl);color:#0c2a10!important;padding:9px 16px;border-radius:99px;font-weight:700;font-size:14px;text-decoration:none}
907.tr a:focus-visible,.tr button:focus-visible,.tr select:focus-visible,.tr input:focus-visible,.tr .tr-plot:focus-visible{outline:3px solid var(--chl);outline-offset:3px}
908
909/* hero */
910.tr-hero{position:relative;height:480vh;background:var(--soil)}
911.tr-hero.is-static{height:100vh;min-height:680px}
912.tr-stage{position:sticky;top:0;height:100vh;min-height:620px;overflow:hidden;background:var(--soil)}
913.tr-scene{position:absolute;inset:0;width:100%;height:100%;display:block}
914.tr-sun{transform:translateY(var(--sy));transition:transform .2s}
915.tr-halo{opacity:.25}
916.tr-cl{animation:tr-cloud 60s linear infinite alternate}
917.tr-cl.b{animation-duration:80s}.tr-cl.c{animation-duration:50s}
918@keyframes tr-cloud{from{transform:translateX(-60px)}to{transform:translateX(80px)}}
919.tr-snow{opacity:var(--snow)}
920.tr-ds,.tr-dr{--q:clamp(0,calc((var(--gs) * 1.4 - var(--d,0)) * 3),1);stroke-dasharray:1;stroke-dashoffset:calc(1 - var(--q))}
921.tr-dr{--q:clamp(0,calc((var(--gr) * 1.4 - var(--d,0)) * 3),1)}
922.tr-ds,.tr-dr{opacity:clamp(0,calc(var(--q) * 60),1)}
923.tr-dr{opacity:clamp(0,calc(var(--q) * 60),1)}
924.tr-sc{--q:clamp(0,calc((var(--gs) * 1.4 - var(--d,0)) * 3),1);transform-box:fill-box;transform-origin:50% 100%}
925ellipse.tr-sc{transform-origin:50% 50%}
926.tr-sc{opacity:clamp(0,calc(var(--q) * 60),1);scale:calc(var(--q) * var(--bloom,1))}
927.tr-fleck{--q:clamp(0,calc((var(--gc) * 1.5 - var(--d,0)) * 3),1);fill:var(--chl);opacity:clamp(0,calc(var(--q) * .95),.95)}
928.tr-fall{opacity:clamp(0,calc(var(--p) * 6 - .1),.95)}
929.tr-co{animation:tr-fall 9s linear infinite}
930@keyframes tr-fall{0%{transform:translate(0,0);opacity:0}10%{opacity:1}60%{opacity:1}100%{transform:translate(var(--dx),var(--dy));opacity:0}}
931.tr-lab{opacity:clamp(0,calc(var(--gr) * 3 - .3),1)}
932.tr-hero-t{position:absolute;left:0;right:0;top:10vh;text-align:center;padding:0 24px;opacity:clamp(0,calc(1 - var(--p) * 5.5),1);transform:translateY(calc(var(--p) * -90px));pointer-events:none;color:var(--ink)}
933.tr-hero.is-static .tr-hero-t{opacity:1;transform:none}
934.tr-hero-t .tr-eyebrow{color:var(--ink);opacity:.75}
935.tr-br{display:none}
936.tr-hero h1{font-size:clamp(46px,7.8vw,118px);white-space:nowrap;font-weight:400;line-height:.92;letter-spacing:-.035em}
937.tr-hero h1 em{color:#2f6b1b;font-weight:300}
938.tr .tr-lede{font-size:clamp(16px,1.7vw,21px);max-width:44ch;margin:20px auto 0}
939.tr-hint{position:absolute;left:50%;bottom:92px;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:6px;font-family:var(--mono);font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:var(--cream);opacity:clamp(0,calc(1 - var(--p) * 14),1)}
940.tr-hint i{width:2px;height:34px;background:var(--chl);animation:tr-hint 1.6s ease-in-out infinite;transform-origin:top}
941@keyframes tr-hint{0%{transform:scaleY(0)}60%{transform:scaleY(1)}100%{transform:scaleY(1);opacity:0}}
942.tr-counter{position:absolute;left:28px;bottom:96px;background:rgba(27,16,9,.84);padding:14px 20px 12px;border-radius:4px;color:var(--cream);opacity:clamp(0,calc(var(--p) * 5),1);pointer-events:none}
943.tr-counter small{display:block;font-family:var(--mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;opacity:.8}
944.tr-counter b{font-family:var(--serif);font-weight:400;font-size:clamp(40px,6vw,76px);line-height:1;color:var(--chl);font-variant-numeric:tabular-nums}
945.tr-counter i{font-family:var(--mono);font-style:normal;font-size:13px;color:var(--cream)}
946.tr-steps{position:absolute;right:28px;bottom:96px;list-style:none;margin:0;padding:16px 20px;width:min(320px,42vw);height:122px;background:rgba(27,16,9,.84);border-radius:4px;color:var(--cream);opacity:clamp(0,calc(var(--p) * 8),1)}
947.tr-steps li{position:absolute;inset:16px 20px;opacity:0;transform:translateY(14px);transition:opacity .4s,transform .4s;display:flex;flex-direction:column;gap:2px}
948.tr-steps li span{font-family:var(--mono);font-size:12px;color:var(--chl)}
949.tr-steps li b{font-family:var(--serif);font-weight:500;font-size:34px;line-height:1}
950.tr-steps li em{font-style:normal;font-size:14px;color:var(--cream);opacity:.85}
951.tr-steps[data-step="0"] li[data-i="0"],.tr-steps[data-step="1"] li[data-i="1"],.tr-steps[data-step="2"] li[data-i="2"],.tr-steps[data-step="3"] li[data-i="3"]{opacity:1;transform:none}
952.tr-hero.is-static .tr-steps li[data-i="3"]{opacity:1;transform:none}
953.tr-hero.is-static .tr-hint{display:none}
954.tr-edge{height:48px;margin-top:-1px;background:var(--bg);line-height:0;transition:background-color .3s}
955.tr-edge svg{width:100%;height:48px;display:block}
956
957/* contours */
958.tr-contour{overflow:hidden;--sp:0;padding:140px 0 120px}
959.tr-contour-svg{position:absolute;inset:0;width:100%;height:100%}
960.tr-dc{--q:clamp(0,calc((var(--sp) * 1.5 - var(--d,0)) * 3),1);stroke:var(--moss);stroke-width:1.2;opacity:.55;stroke-dasharray:1;stroke-dashoffset:calc(1 - var(--q))}
961.tr-dc.idx{stroke-width:2.4;opacity:.9}
962.tr-dc.fence{stroke:var(--chl);stroke-width:3;stroke-dasharray:1;opacity:1;filter:drop-shadow(0 0 4px rgba(59,227,79,.5))}
963.tr-dc-l{--q:clamp(0,calc((var(--sp) * 1.5 - var(--d,0)) * 3),1);font-family:var(--mono);font-size:11px;fill:var(--ink);opacity:var(--q)}
964.reduced .tr-contour,.reduced .tr-join{--sp:1}
965.tr-contour-in{display:flex;justify-content:flex-end}
966.tr-card{width:min(540px,100%);background:rgba(243,236,218,.92);padding:40px;border:1.5px solid var(--ink);border-radius:4px;box-shadow:10px 10px 0 var(--soil2)}
967.tr-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:26px 0 0;border-top:1.5px solid var(--ink);padding-top:18px}
968.tr-stats div{display:flex;flex-direction:column-reverse}
969.tr-stats dt{font-family:var(--serif);font-size:38px;line-height:1;font-weight:500}
970.tr-stats dd{margin:0;font-size:12.5px;line-height:1.3;opacity:.8}
971
972/* ledger */
973.tr-ledger{background:var(--soil);color:var(--cream)}
974.tr-ledger em{color:var(--chl)}
975.tr-big{display:flex;flex-direction:column;gap:4px;margin:0 0 56px}
976.tr-big b{font-family:var(--serif);font-weight:400;font-size:clamp(46px,9.5vw,132px);line-height:1;letter-spacing:-.03em;color:var(--chl);font-variant-numeric:tabular-nums;text-shadow:0 0 40px rgba(59,227,79,.25)}
977.tr-big span{font-family:var(--mono);font-size:13px;letter-spacing:.1em;text-transform:uppercase;opacity:.8}
978.tr-ledger-grid{display:grid;grid-template-columns:1fr 1.15fr;gap:24px}
979.tr-panel{border:1px solid rgba(243,236,218,.25);padding:28px;border-radius:4px;background:rgba(243,236,218,.04)}
980.tr-panel h3{margin-bottom:20px;font-size:20px}
981.tr-bar{display:grid;grid-template-columns:130px 1fr 52px;gap:12px;align-items:center;margin:0 0 14px;font-size:14px}
982.tr-bar div{height:14px;background:rgba(243,236,218,.1);overflow:hidden}
983.tr-bar i{display:block;height:100%;background:var(--chl);transform-origin:left;transform:scaleX(0);transition:transform 1.2s cubic-bezier(.2,.7,.2,1);transition-delay:calc(var(--i) * .12s)}
984.in .tr-bar i{transform:scaleX(var(--w))}
985.tr-bar b{font-family:var(--mono);font-weight:500;text-align:right;font-size:13px}
986.tr-ledger svg{width:100%;height:auto;display:block}
987.tr-line{stroke:var(--chl);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 2s ease .2s}
988.in .tr-line{stroke-dashoffset:0}
989.tr-area{fill:rgba(59,227,79,.12);opacity:0;transition:opacity 1s 1.6s}
990.in .tr-area{opacity:1}
991.tr-dot{fill:var(--soil);stroke:var(--chl);stroke-width:2.5;opacity:0;transition:opacity .3s calc(.3s + var(--i) * .26s)}
992.in .tr-dot{opacity:1}
993.tr-ax{font-family:var(--mono);font-size:11px;fill:var(--cream);opacity:.7}
994.tr-note{font-size:13px;opacity:.7;margin:14px 0 0}
995
996/* plots */
997.tr-plots{background:var(--bg);transition:background-color .3s}
998.tr-map-grid{display:grid;grid-template-columns:1.7fr 1fr;gap:28px;align-items:start}
999.tr-map{border:1.5px solid var(--ink);background:rgba(255,255,255,.35);padding:12px;border-radius:4px}
1000.tr-map svg{width:100%;height:auto;display:block}
1001.tr-plot{cursor:pointer;outline:none}
1002.tr-plot-f{opacity:.38;transition:opacity .3s}
1003.tr-plot-o{stroke:var(--ink);stroke-width:1.5;stroke-linejoin:round}
1004.tr-plot.on .tr-plot-f{opacity:.85}
1005.tr-plot.on .tr-plot-o{stroke-width:3;stroke:var(--ink)}
1006.tr-row{stroke:#2a1d14;stroke-width:1.6;opacity:.7;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset .8s ease;transition-delay:calc(var(--i) * 30ms)}
1007.tr-plot.on .tr-row{stroke-dashoffset:0}
1008.tr-plot-t{font-family:var(--mono);font-size:11px;font-weight:700;fill:var(--ink);paint-order:stroke;stroke:rgba(243,236,218,.85);stroke-width:3px;pointer-events:none}
1009.tr-river{stroke:#7fb8c4;stroke-width:12;stroke-linecap:round;opacity:.85;pointer-events:none}
1010.tr-river-t{font-family:var(--serif);font-style:italic;font-size:12px;fill:#2c5a66;pointer-events:none}
1011.tr-legend{display:flex;flex-wrap:wrap;gap:6px 16px;font-family:var(--mono);font-size:11px;padding:10px 4px 2px}
1012.tr-legend span{display:flex;align-items:center;gap:6px}.tr-legend i{width:12px;height:12px;border:1px solid var(--ink)}
1013.tr-info{position:sticky;top:90px;border:1.5px solid var(--ink);padding:28px;background:var(--cream);border-radius:4px;box-shadow:8px 8px 0 var(--soil2);min-height:300px}
1014.tr-info h3{font-size:36px;margin-bottom:10px}
1015.tr-info-p{font-size:15px}
1016.tr-info dl{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:18px 0;border-top:1.5px solid var(--ink);padding-top:14px}
1017.tr-info dl div{display:flex;flex-direction:column-reverse}
1018.tr-info dt{font-family:var(--mono);font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;opacity:.7}
1019.tr-info dd{margin:0;font-family:var(--serif);font-size:24px;line-height:1.1}
1020.tr-som{height:10px;background:rgba(42,29,20,.12);overflow:hidden}
1021.tr-som i{display:block;height:100%;background:var(--chl);transform-origin:left;transform:scaleX(var(--w));transition:transform .6s cubic-bezier(.2,.7,.2,1)}
1022.tr-info small{display:block;margin-top:8px;font-size:12px;opacity:.7}
1023
1024/* mycelium */
1025.tr-myc{background:#1f150d;color:var(--cream)}
1026.tr-myc em{color:var(--chl)}
1027.tr-myc-grid{display:grid;grid-template-columns:1.1fr 1fr;gap:56px;align-items:center}
1028.tr-myc-svg svg{width:100%;height:auto;display:block}
1029.tr-hy{stroke:rgba(243,236,218,.7);stroke-width:1.2;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 1.4s ease;transition-delay:calc(var(--d) * 2.2s)}
1030.in .tr-hy{stroke-dashoffset:0}
1031.tr-nd{fill:var(--chl);opacity:0;transition:opacity .4s calc(var(--d) * 2.2s + .8s)}
1032.in .tr-nd{opacity:1}
1033.tr-sig{fill:#fff;offset-distance:0%;opacity:0;filter:drop-shadow(0 0 4px var(--chl))}
1034.in .tr-sig{animation:tr-sig 3.4s linear 2.6s infinite}
1035@keyframes tr-sig{0%{offset-distance:0%;opacity:0}10%{opacity:1}90%{opacity:1}100%{offset-distance:100%;opacity:0}}
1036.tr-count-row{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:34px;border-top:1px solid rgba(243,236,218,.3);padding-top:22px}
1037.tr-count b{display:block;font-family:var(--serif);font-weight:400;font-size:clamp(28px,3.4vw,44px);color:var(--chl);line-height:1;font-variant-numeric:tabular-nums}
1038.tr-count span{font-size:12.5px;line-height:1.3;display:block;margin-top:6px;opacity:.8}
1039
1040/* voices */
1041.tr-voices{background:var(--bg);transition:background-color .3s;padding-bottom:140px}
1042.tr-vgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:24px}
1043.tr-voice{margin:0;padding:30px;background:var(--cream);border:1.5px solid var(--ink);border-radius:4px;display:flex;flex-direction:column;gap:16px;clip-path:inset(100% 0 0 0);transition:clip-path 1s cubic-bezier(.2,.7,.2,1);transition-delay:calc(var(--i) * .18s);color:var(--ink)}
1044.in .tr-voice{clip-path:inset(0 0 0 0)}
1045.tr-voice:nth-child(2){margin-top:32px}
1046.tr-voice blockquote{margin:0;font-family:var(--serif);font-size:21px;line-height:1.3;flex:1}
1047.tr-voice figcaption{display:grid;grid-template-columns:52px minmax(0,1fr);column-gap:14px;align-items:center;font-size:13px}
1048.tr-voice figcaption img{grid-row:1 / span 2;width:52px;height:52px;border-radius:50%;object-fit:cover;object-position:center top;border:1.5px solid var(--ink)}
1049.tr-voice figcaption span{opacity:.7}
1050
1051/* join */
1052.tr-join{background:var(--soil);color:var(--cream);overflow:hidden;--sp:0;padding-bottom:0}
1053.tr-join em{color:var(--chl)}
1054.tr-join-in{padding-bottom:120px;z-index:2}
1055.tr-form{display:grid;grid-template-columns:200px 1fr auto;gap:12px;align-items:end;max-width:760px;margin-top:28px}
1056.tr-form label{display:flex;flex-direction:column;gap:6px;font-family:var(--mono);font-size:11px;letter-spacing:.1em;text-transform:uppercase}
1057.tr-form input,.tr-form select{font:inherit;font-family:var(--sans);font-size:16px;letter-spacing:0;text-transform:none;padding:13px 14px;border:1.5px solid var(--cream);background:transparent;color:var(--cream);border-radius:4px;width:100%}
1058.tr-form select option{color:var(--ink)}
1059.tr-form input::placeholder{color:rgba(243,236,218,.5)}
1060.tr-form button{font:inherit;font-weight:700;padding:14px 22px;background:var(--chl);color:#0c2a10;border:0;border-radius:4px;cursor:pointer;transition:transform .15s}
1061.tr-form button:hover{transform:translateY(-2px)}
1062.tr-err{grid-column:1/-1;color:#ff9d8a;margin:0;font-size:14px}
1063.tr-done{margin-top:28px;padding:20px;border:1.5px solid var(--chl);max-width:560px;border-radius:4px}
1064.tr-foot{position:relative;z-index:2;display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:14px 28px;font-family:var(--mono);font-size:12px;background:#1a110a;margin-top:140px;color:var(--cream)}
1065.tr-join{padding-bottom:0}
1066
1067/* season slider */
1068.tr-season{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:60;width:min(420px,calc(100vw - 32px));background:rgba(243,236,218,.94);border:1.5px solid var(--ink);border-radius:14px;padding:8px 16px 8px;box-shadow:5px 5px 0 var(--soil2);display:grid;grid-template-columns:auto 1fr;gap:2px 14px;align-items:center}
1069.tr-season-n{font-family:var(--serif);font-size:20px;min-width:76px;color:var(--ink)}
1070.tr-season input{width:100%;accent-color:#1fa33a;margin:0;height:24px}
1071.tr-season-t{grid-column:2;display:flex;justify-content:space-between;font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink);opacity:.7}
1072
1073@media (max-width:960px){
1074 .tr-ledger-grid,.tr-map-grid,.tr-myc-grid{grid-template-columns:1fr}
1075 .tr-info{position:static;min-height:0}
1076 .tr-vgrid{grid-template-columns:1fr}.tr-voice:nth-child(2){margin-top:0}
1077 .tr-links{display:none}.tr-nav{padding:12px 16px}.tr-cta{margin-left:auto}
1078 .tr-sec{padding:84px 0}
1079}
1080@media (max-width:900px){.tr-br{display:inline}.tr-hero h1{font-size:clamp(46px,15vw,92px);white-space:normal}}
1081@media (max-width:640px){
1082 .tr-wrap{padding:0 16px}
1083 .tr-lab{display:none}
1084 .tr-counter{left:16px;bottom:100px;padding:10px 14px}
1085 .tr-steps{right:16px;left:16px;width:auto;bottom:206px;height:84px}
1086 .tr-steps li b{font-size:24px}
1087 .tr-steps li em{font-size:13px}
1088 .tr-hero-t{top:11vh}
1089 .tr-card{padding:26px}
1090 .tr-stats{grid-template-columns:1fr 1fr 1fr}.tr-stats dt{font-size:28px}
1091 .tr-bar{grid-template-columns:96px 1fr 44px;font-size:12.5px}
1092 .tr-panel{padding:18px}
1093 .tr-count-row{grid-template-columns:1fr}
1094 .tr-form{grid-template-columns:1fr}
1095 .tr-info h3{font-size:30px}
1096 .tr-foot{margin-top:100px}
1097}
1098@media (prefers-reduced-motion:reduce){
1099 .tr *,.tr *::before,.tr *::after{animation:none!important;transition:none!important}
1100 .tr-hint{display:none}
1101 .tr-voice{clip-path:none}
1102 .tr-bar i{transform:scaleX(var(--w))}
1103 .tr-line{stroke-dashoffset:0}.tr-area,.tr-dot,.tr-nd{opacity:1}
1104 .tr-hy{stroke-dashoffset:0}
1105 .tr-row{stroke-dashoffset:0}
1106
1107}
1108`;