core
Background
Add background images, video, and overlays to any section rune
Source
import Markdoc from '@markdoc/markdoc';
import type { Node, Schema, RenderableTreeNodes, RenderableTreeNode } from '@markdoc/markdoc';
import { declareUniversalPosture } from '../lib/index.js';
const { Tag } = Markdoc;
const CHROMED_GUESTS = new Set(['video', 'audio', 'figure']);
function findGuest(nodes: RenderableTreeNode[]): InstanceType<typeof Tag> | undefined {
for (const node of nodes) {
if (!Markdoc.Tag.isTag(node)) continue;
const rune = node.attributes?.['data-rune'];
if (node.name === 'rf-sandbox' || rune) return node;
if (CHROMED_GUESTS.has(node.name)) return node;
const nested = findGuest(node.children as RenderableTreeNode[]);
if (nested) return nested;
}
return undefined;
}
function guestName(guest: InstanceType<typeof Tag>): string {
if (guest.name === 'rf-sandbox') return 'sandbox';
return String(guest.attributes?.['data-rune'] ?? guest.name);
}
export const bg: Schema = {
attributes: {
preset: {
type: String,
required: false,
description: 'Named background preset from the theme',
},
src: { type: String, required: false, description: 'URL of the background image' },
video: { type: String, required: false, description: 'URL of a background video' },
overlay: {
type: String,
required: false,
description:
'Flat wash over the background: none | dark | light | a token name. Raw CSS is deprecated; use `scrim` for a gradient',
},
'overlay-opacity': {
type: String,
required: false,
description: 'Opacity of a token-coloured overlay wash (0 to 1)',
},
gradient: {
type: String,
required: false,
matches: ['to-t', 'to-b', 'to-l', 'to-r', 'to-tr', 'to-br', 'to-bl', 'to-tl'],
description: 'Gradient direction (token-driven fill)',
},
from: {
type: String,
required: false,
description: 'Gradient start colour — semantic token name',
},
to: { type: String, required: false, description: 'Gradient end colour — semantic token name' },
via: {
type: String,
required: false,
description: 'Optional middle gradient stop — semantic token name',
},
'gradient-type': {
type: String,
required: false,
matches: ['linear', 'radial', 'conic'],
description: 'Gradient type: linear (default), radial, conic',
},
blur: {
type: String,
required: false,
matches: ['none', 'sm', 'md', 'lg'],
description: 'Blur intensity applied to the background',
},
position: { type: String, required: false, description: 'CSS background-position value' },
fit: {
type: String,
required: false,
matches: ['cover', 'contain'],
description: 'How the background image fills its container',
},
opacity: {
type: String,
required: false,
description: 'Opacity of the background layer (0 to 1)',
},
fixed: {
type: Boolean,
required: false,
description: 'Fix the background so it stays in place while scrolling',
},
},
transform(node: Node, config): RenderableTreeNodes {
const attrs = node.transformAttributes(config);
const metas: any[] = [];
if (attrs.preset) {
metas.push(new Tag('meta', { 'data-field': 'bg-preset', content: attrs.preset }));
}
if (attrs.src) {
metas.push(new Tag('meta', { 'data-field': 'bg-src', content: attrs.src }));
}
if (attrs.video) {
metas.push(new Tag('meta', { 'data-field': 'bg-video', content: attrs.video }));
}
if (attrs.overlay && attrs.overlay !== 'none') {
metas.push(new Tag('meta', { 'data-field': 'bg-overlay', content: attrs.overlay }));
}
if (attrs['overlay-opacity']) {
metas.push(
new Tag('meta', { 'data-field': 'bg-overlay-opacity', content: attrs['overlay-opacity'] }),
);
}
if (attrs.gradient)
metas.push(new Tag('meta', { 'data-field': 'bg-gradient', content: attrs.gradient }));
if (attrs.from) metas.push(new Tag('meta', { 'data-field': 'bg-from', content: attrs.from }));
if (attrs.to) metas.push(new Tag('meta', { 'data-field': 'bg-to', content: attrs.to }));
if (attrs.via) metas.push(new Tag('meta', { 'data-field': 'bg-via', content: attrs.via }));
if (attrs['gradient-type'])
metas.push(
new Tag('meta', { 'data-field': 'bg-gradient-type', content: attrs['gradient-type'] }),
);
if (attrs.blur && attrs.blur !== 'none') {
metas.push(new Tag('meta', { 'data-field': 'bg-blur', content: attrs.blur }));
}
if (attrs.position && attrs.position !== 'center') {
metas.push(new Tag('meta', { 'data-field': 'bg-position', content: attrs.position }));
}
if (attrs.fit && attrs.fit !== 'cover') {
metas.push(new Tag('meta', { 'data-field': 'bg-fit', content: attrs.fit }));
}
if (attrs.opacity && attrs.opacity !== '1') {
metas.push(new Tag('meta', { 'data-field': 'bg-opacity', content: attrs.opacity }));
}
if (attrs.fixed) {
metas.push(new Tag('meta', { 'data-field': 'bg-fixed', content: 'true' }));
}
const guestNodes: RenderableTreeNode[] = [];
if (node.children?.length) {
const rendered = node.children.map((child) => Markdoc.transform(child, config));
const flat = rendered.flat().filter(Boolean) as RenderableTreeNode[];
const guest = findGuest(flat);
if (guest) {
const name = guestName(guest);
if (name !== 'sandbox') {
console.warn(
`[refrakt] bg backdrop guest must be presentational (a sandbox); "${name}" carries content chrome — ` +
`place it in the media zone as a positioned guest, or use \`bg video="…"\` for a bare video backdrop.`,
);
} else {
guest.attributes = {
...guest.attributes,
'data-bg-guest': '',
'data-guest-posture': 'backdrop',
'data-height': 'fill',
'data-activation': 'eager',
};
guestNodes.push(guest);
}
}
}
return new Tag('div', { 'data-bg-source': true }, [...metas, ...guestNodes]);
},
};
declareUniversalPosture(bg, 'configurator');
Put an image, a video, a gradient or an animation behind a hero, a section or any other block rune. {% bg %} shows nothing itself: place it first inside the rune whose background it sets.
Basic usage
{% hero %}
{% bg src="https://assets.refrakt.md/media-text-valley.jpg" overlay="dark" /%}
# The valley trail
Eleven miles along the river, from the trailhead to the falls.
{% /hero %}<div data-rune="hero" data-rune-fields="{"align":"center","media-position":"bottom"}">
<section data-rune="section" data-rune-fields="{"align":"center","media-position":"bottom","guest-fit":"bleed"}" elevation="flush" prominence="marquee">
<div data-name="content">
<header>
<h1 data-slot="headline" id="the-valley-trail" data-name="headline">The valley trail</h1>
<p data-slot="blurb" data-name="blurb">Eleven miles along the river, from the trailhead to the falls.</p>
</header>
<div data-name="body">
<div data-rune="actions"></div>
</div>
</div>
<meta data-field="bg-src" content="https://assets.refrakt.md/media-text-valley.jpg">
<meta data-field="bg-overlay" content="dark">
</section>
</div>The valley trail
Eleven miles along the river, from the trailhead to the falls.
<div data-width="full" data-rune="hero" data-density="full">
<section class="rf-section rf-section--center rf-section--has-bg" data-align="center" data-media-position="bottom" data-elevation="flush" data-prominence="marquee" data-color-scheme="dark" data-bg="" data-rune="section" data-density="full">
<div data-name="bg" style="--bg-image: url(https://assets.refrakt.md/media-text-valley.jpg)" class="rf-section__bg">
<div data-name="bg-overlay" data-bg-overlay="dark" class="rf-section__bg-overlay"></div>
</div>
<div data-name="content" class="rf-section__content">
<header data-name="preamble" class="rf-section__preamble" data-section="preamble">
<h1 data-slot="headline" id="the-valley-trail" data-name="headline" class="rf-section__headline" data-section="title">The valley trail</h1>
<p data-slot="blurb" data-name="blurb" class="rf-section__blurb" data-section="description">Eleven miles along the river, from the trailhead to the falls.</p>
</header>
<div data-name="body" class="rf-section__body" data-section="body">
<div class="rf-actions" data-rune="actions" data-density="full"></div>
</div>
</div>
</section>
</div>Over a photo, add overlay="dark" (or light) or a scrim so the text stays readable; either one also switches the text to the matching color.
Play a video or animation
video takes the URL of a looping video and plays it, muted, behind the content: {% bg video="/media/surf.mp4" /%}. For a generated, animated backdrop, put a {% sandbox %} inside the bg instead:
{% hero %}
{% bg overlay="dark" overlay-opacity="0.4" %}
{% sandbox src="wireframe-waves" /%}
{% /bg %}
# Tide tables
High and low water for every harbor on the coast, updated daily.
{% /hero %}<div data-rune="hero" data-rune-fields="{"align":"center","media-position":"bottom"}">
<section data-rune="section" data-rune-fields="{"align":"center","media-position":"bottom","guest-fit":"bleed"}" elevation="flush" prominence="marquee">
<div data-name="content">
<header>
<h1 data-slot="headline" id="tide-tables" data-name="headline">Tide tables</h1>
<p data-slot="blurb" data-name="blurb">High and low water for every harbor on the coast, updated daily.</p>
</header>
<div data-name="body">
<div data-rune="actions"></div>
</div>
</div>
<meta data-field="bg-overlay" content="dark">
<meta data-field="bg-overlay-opacity" content="0.4">
<rf-sandbox data-rune="sandbox" data-source-content="<div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div>" data-height="fill" data-source-origins="HTML wireframe-waves/index.html" data-security-mode="trusted" data-allow-js="true" data-bg-guest="" data-guest-posture="backdrop" data-activation="eager">
<template data-content="fallback">
<pre data-language="html">
<code data-language="html"><div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div></code>
</pre>
</template>
<template data-content="source"><div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div></template>
</rf-sandbox>
</section>
</div><div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div><div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div>Tide tables
High and low water for every harbor on the coast, updated daily.
<div data-width="full" data-rune="hero" data-density="full">
<section class="rf-section rf-section--center rf-section--has-bg" data-align="center" data-media-position="bottom" data-elevation="flush" data-prominence="marquee" data-color-scheme="dark" data-bg="" data-rune="section" data-density="full">
<div data-name="bg" class="rf-section__bg">
<rf-sandbox class="rf-sandbox" data-source-content="<div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div>" data-height="fill" data-source-origins="HTML wireframe-waves/index.html" data-security-mode="trusted" data-allow-js="true" data-bg-guest="" data-guest-posture="backdrop" data-activation="eager" data-rune="sandbox" data-density="compact">
<template data-content="fallback">
<pre data-language="html"><code data-language="html"><div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div></code></pre>
</template>
<template data-content="source"><div data-source="HTML">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Boot backdrop — the scene fades in over this, so the first paint looks
designed even before three.js arrives (and remains if it never does). */
body { background: linear-gradient(rgb(247 246 242) 0%, rgb(236 234 227) 100%); }
html.dark body, body.dark { background: linear-gradient(rgb(20 20 23) 0%, rgb(13 13 16) 100%); }
/* Pinned to the iframe viewport, NOT height: 100% — directory-mode sandbox
content ships inside a plain wrapper div (auto height), which breaks a
percentage-height chain: the canvas would collapse to its attribute
height and render as a fixed-size strip at the top of the band. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
#scene.on { opacity: 1; }
/* No-JS / no-WebGL / blocked-CDN fallback: a few soft horizon lines keep
the wave suggestion without competing with overlaid hero content. */
#fallback { display: none; position: fixed; inset: 0; overflow: hidden; }
#fallback.on { display: block; }
#fallback i {
position: absolute; left: -5%; right: -5%; height: 2px; display: block;
background: linear-gradient(90deg, transparent, var(--c), transparent);
border-radius: 2px;
}
</style>
<canvas id="scene"></canvas>
<div id="fallback" aria-hidden="true">
<i style="--c:rgb(138 133 125 / 0.30); top: 58%"></i>
<i style="--c:rgb(138 133 125 / 0.22); top: 66%; transform: scaleX(0.92)"></i>
<i style="--c:rgb(61 107 61 / 0.20); top: 74%; transform: scaleX(0.96)"></i>
<i style="--c:rgb(138 133 125 / 0.16); top: 82%"></i>
</div>
<script type="module">
// ── Wireframe waves (SPEC-101 / WORK-401) ──────────────────────────────
// The hero backdrop: a vertex-displaced wireframe plane rolling in slow
// swells — karesansui by way of a vector terrain. Crests pick up a niwaki
// accent over the stone base. Ambient by contract: the cover posture
// demotion blocks pointer events, so the scene carries itself with no
// interaction.
// Palette of record: packages/lumina/src/presets/niwaki.ts (light/dark pairs).
// Base = ishi (stone); crest accent = matsu (light) / wakaba (dark).
const NIWAKI = {
light: { base: 0x8a857d, crest: 0x3d6b3d, fog: 0xeceae3, opacity: 0.5 },
dark: { base: 0x7d7062, crest: 0xb3d475, fog: 0x101013, opacity: 0.55 },
};
const dark =
document.documentElement.classList.contains('dark') ||
document.body.classList.contains('dark');
const P = dark ? NIWAKI.dark : NIWAKI.light;
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('scene');
const showFallback = () => {
canvas.style.display = 'none';
document.getElementById('fallback').classList.add('on');
};
try {
// Version-pinned for reproducibility.
const THREE = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
// Backdrop budget: cap the pixel ratio — the scrim sits over us anyway.
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
const scene = new THREE.Scene();
// Fog fades the far edge into the CSS backdrop, so the grid has a horizon
// instead of a hard geometric edge.
scene.fog = new THREE.Fog(P.fog, 9, 26);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 2.4, 9.5);
camera.lookAt(0, 0.2, 0);
// ── The displaced plane ──
const SEG_X = 88, SEG_Y = 46;
const geo = new THREE.PlaneGeometry(38, 22, SEG_X, SEG_Y);
geo.rotateX(-Math.PI / 2);
const count = geo.attributes.position.count;
const colors = new Float32Array(count * 3);
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const base = new THREE.Color(P.base);
const crest = new THREE.Color(P.crest);
const tmp = new THREE.Color();
const mat = new THREE.MeshBasicMaterial({
wireframe: true, vertexColors: true,
transparent: true, opacity: P.opacity,
fog: true, depthWrite: false,
});
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = -0.6;
scene.add(mesh);
// Swell: a few travelling sines at different scales — cheap, organic, no
// noise library. Amplitude stays modest; this is a ground, not a storm.
const AMP = 0.9;
function heightAt(x, z, t) {
return AMP * (
0.45 * Math.sin(x * 0.32 + t * 0.50) * Math.cos(z * 0.28 + t * 0.32)
+ 0.30 * Math.sin((x + z) * 0.18 - t * 0.40)
+ 0.15 * Math.sin(x * 0.85 + t * 0.90) * Math.sin(z * 0.55 - t * 0.55)
);
}
function displace(t) {
const pos = geo.attributes.position;
for (let i = 0; i < count; i++) {
const x = pos.getX(i), z = pos.getZ(i);
const h = heightAt(x, z, t);
pos.setY(i, h);
// Crest tint: 0 at the troughs, accent at the peaks.
const k = Math.min(Math.max((h / AMP + 1) / 2, 0), 1);
tmp.copy(base).lerp(crest, k * k); // square biases the accent to true crests
colors[i * 3] = tmp.r;
colors[i * 3 + 1] = tmp.g;
colors[i * 3 + 2] = tmp.b;
}
pos.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
}
function resize() {
const w = canvas.clientWidth, h = canvas.clientHeight;
if (!w || !h) return;
renderer.setSize(w, h, false);
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
resize();
window.addEventListener('resize', resize);
canvas.classList.add('on');
if (reduce) {
// Reduced motion: one composed static frame — a mid-swell moment.
displace(2.4);
renderer.render(scene, camera);
} else {
// The RAF loop pauses with the tab — a backdrop must not drain a
// backgrounded battery.
let raf = 0;
let t = 0;
let last = performance.now();
function loop(now) {
const dt = Math.min((now - last) / 1000, 0.05);
last = now;
t += dt;
displace(t);
renderer.render(scene, camera);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cancelAnimationFrame(raf);
raf = 0;
} else if (!raf) {
last = performance.now();
raf = requestAnimationFrame(loop);
}
});
}
} catch (err) {
// CDN unreachable / WebGL unavailable → the quiet CSS horizon.
showFallback();
}
</script>
</div></template>
</rf-sandbox>
<div data-name="bg-overlay" data-bg-overlay="dark" style="opacity: 0.4" class="rf-section__bg-overlay"></div>
</div>
<div data-name="content" class="rf-section__content">
<header data-name="preamble" class="rf-section__preamble" data-section="preamble">
<h1 data-slot="headline" id="tide-tables" data-name="headline" class="rf-section__headline" data-section="title">Tide tables</h1>
<p data-slot="blurb" data-name="blurb" class="rf-section__blurb" data-section="description">High and low water for every harbor on the coast, updated daily.</p>
</header>
<div data-name="body" class="rf-section__body" data-section="body">
<div class="rf-actions" data-rune="actions" data-density="full"></div>
</div>
</div>
</section>
</div>Fill with a gradient
gradient sets the direction, and from and to (with an optional via) the colors. The colors are theme color names such as primary and surface, so the gradient follows the theme and any tint.
{% hero %}
{% bg gradient="to-b" from="primary" to="surface" /%}
# Spring workshop
Two days of hands-on sessions, April 12–13, in Lisbon.
{% /hero %}<div data-rune="hero" data-rune-fields="{"align":"center","media-position":"bottom"}">
<section data-rune="section" data-rune-fields="{"align":"center","media-position":"bottom","guest-fit":"bleed"}" elevation="flush" prominence="marquee">
<div data-name="content">
<header>
<h1 data-slot="headline" id="spring-workshop" data-name="headline">Spring workshop</h1>
<p data-slot="blurb" data-name="blurb">Two days of hands-on sessions, April 12–13, in Lisbon.</p>
</header>
<div data-name="body">
<div data-rune="actions"></div>
</div>
</div>
<meta data-field="bg-gradient" content="to-b">
<meta data-field="bg-from" content="primary">
<meta data-field="bg-to" content="surface">
</section>
</div>Spring workshop
Two days of hands-on sessions, April 12–13, in Lisbon.
<div data-width="full" data-rune="hero" data-density="full">
<section class="rf-section rf-section--center rf-section--has-bg" data-align="center" data-media-position="bottom" data-elevation="flush" data-prominence="marquee" data-bg="" data-rune="section" data-density="full">
<div data-name="bg" style="--bg-image: linear-gradient(to bottom, var(--rf-color-primary), var(--rf-color-surface))" class="rf-section__bg"></div>
<div data-name="content" class="rf-section__content">
<header data-name="preamble" class="rf-section__preamble" data-section="preamble">
<h1 data-slot="headline" id="spring-workshop" data-name="headline" class="rf-section__headline" data-section="title">Spring workshop</h1>
<p data-slot="blurb" data-name="blurb" class="rf-section__blurb" data-section="description">Two days of hands-on sessions, April 12–13, in Lisbon.</p>
</header>
<div data-name="body" class="rf-section__body" data-section="body">
<div class="rf-actions" data-rune="actions" data-density="full"></div>
</div>
</div>
</section>
</div>A color can also be transparent, or a theme color at partial opacity: to="primary/0.3" or to="primary/30". gradient-type switches to a radial or conic gradient. The same settings work on the rune itself, without a {% bg %}, as bg-gradient, bg-from, bg-to, bg-via and bg-gradient-type.
Darken or lighten the image
overlay lays a flat wash over the background so the text stays readable: dark, light, or a theme color name such as primary. dark and light also switch the text to light or dark to match. overlay-opacity sets the wash's strength.
{% hero %}
{% bg src="https://assets.refrakt.md/media-text-old-growth.jpg" overlay="dark" /%}
# Old-growth forest walk
A two-hour loop under trees that were standing before the town was founded.
{% /hero %}<div data-rune="hero" data-rune-fields="{"align":"center","media-position":"bottom"}">
<section data-rune="section" data-rune-fields="{"align":"center","media-position":"bottom","guest-fit":"bleed"}" elevation="flush" prominence="marquee">
<div data-name="content">
<header>
<h1 data-slot="headline" id="old-growth-forest-walk" data-name="headline">Old-growth forest walk</h1>
<p data-slot="blurb" data-name="blurb">A two-hour loop under trees that were standing before the town was founded.</p>
</header>
<div data-name="body">
<div data-rune="actions"></div>
</div>
</div>
<meta data-field="bg-src" content="https://assets.refrakt.md/media-text-old-growth.jpg">
<meta data-field="bg-overlay" content="dark">
</section>
</div>Old-growth forest walk
A two-hour loop under trees that were standing before the town was founded.
<div data-width="full" data-rune="hero" data-density="full">
<section class="rf-section rf-section--center rf-section--has-bg" data-align="center" data-media-position="bottom" data-elevation="flush" data-prominence="marquee" data-color-scheme="dark" data-bg="" data-rune="section" data-density="full">
<div data-name="bg" style="--bg-image: url(https://assets.refrakt.md/media-text-old-growth.jpg)" class="rf-section__bg">
<div data-name="bg-overlay" data-bg-overlay="dark" class="rf-section__bg-overlay"></div>
</div>
<div data-name="content" class="rf-section__content">
<header data-name="preamble" class="rf-section__preamble" data-section="preamble">
<h1 data-slot="headline" id="old-growth-forest-walk" data-name="headline" class="rf-section__headline" data-section="title">Old-growth forest walk</h1>
<p data-slot="blurb" data-name="blurb" class="rf-section__blurb" data-section="description">A two-hour loop under trees that were standing before the town was founded.</p>
</header>
<div data-name="body" class="rf-section__body" data-section="body">
<div class="rf-actions" data-rune="actions" data-density="full"></div>
</div>
</div>
</section>
</div>Scrim
A scrim shades the background only where the text sits, and switches the text to light or dark to match. It is set on the rune in front of the background, not on {% bg %}:
{% hero scrim="bottom" scrim-strength="lg" %}
{% bg src="https://assets.refrakt.md/figure-hot-springs.jpg" /%}
# The hot springs
Open year-round. The upper pools close at dusk.
{% /hero %}<div data-rune="hero" data-rune-fields="{"align":"center","media-position":"bottom"}">
<section data-rune="section" data-rune-fields="{"align":"center","media-position":"bottom","guest-fit":"bleed"}" elevation="flush" prominence="marquee">
<div data-name="content">
<header>
<h1 data-slot="headline" id="the-hot-springs" data-name="headline">The hot springs</h1>
<p data-slot="blurb" data-name="blurb">Open year-round. The upper pools close at dusk.</p>
</header>
<div data-name="body">
<div data-rune="actions"></div>
</div>
</div>
<meta data-field="bg-src" content="https://assets.refrakt.md/figure-hot-springs.jpg">
<meta data-field="scrim" content="bottom">
<meta data-field="scrim-strength" content="lg">
</section>
</div>The hot springs
Open year-round. The upper pools close at dusk.
<div data-width="full" data-rune="hero" data-density="full">
<section class="rf-section rf-section--center rf-section--has-bg" data-align="center" data-media-position="bottom" data-elevation="flush" data-prominence="marquee" data-color-scheme="dark" data-bg="" data-rune="section" data-density="full">
<div data-name="bg" style="--bg-image: url(https://assets.refrakt.md/figure-hot-springs.jpg)" class="rf-section__bg">
<div data-name="scrim" data-scrim="gradient" data-scrim-tone="dark" data-scrim-dir="bottom" style="--scrim-strength: 0.8" class="rf-section__scrim"></div>
</div>
<div data-name="content" class="rf-section__content">
<header data-name="preamble" class="rf-section__preamble" data-section="preamble">
<h1 data-slot="headline" id="the-hot-springs" data-name="headline" class="rf-section__headline" data-section="title">The hot springs</h1>
<p data-slot="blurb" data-name="blurb" class="rf-section__blurb" data-section="description">Open year-round. The upper pools close at dusk.</p>
</header>
<div data-name="body" class="rf-section__body" data-section="body">
<div class="rf-actions" data-rune="actions" data-density="full"></div>
</div>
</div>
</section>
</div>scrim names the edge it is heaviest at (top, bottom, left, right) and scrim-strength how heavy it is. scrim-tone="light" lightens instead of darkening. scrim-type="frost" blurs and tints the background behind the text instead, with scrim-blur setting the amount. On a card with a cover image, the scrim shades the image.
Position and soften the image
This image is softened and anchored to its top edge:
{% hero %}
{% bg src="https://assets.refrakt.md/figure-coral-reef.jpg" blur="sm" position="top" overlay="dark" /%}
# Reef survey 2026
Forty volunteers, twelve dive sites, one count of every coral colony.
{% /hero %}<div data-rune="hero" data-rune-fields="{"align":"center","media-position":"bottom"}">
<section data-rune="section" data-rune-fields="{"align":"center","media-position":"bottom","guest-fit":"bleed"}" elevation="flush" prominence="marquee">
<div data-name="content">
<header>
<h1 data-slot="headline" id="reef-survey-2026" data-name="headline">Reef survey 2026</h1>
<p data-slot="blurb" data-name="blurb">Forty volunteers, twelve dive sites, one count of every coral colony.</p>
</header>
<div data-name="body">
<div data-rune="actions"></div>
</div>
</div>
<meta data-field="bg-src" content="https://assets.refrakt.md/figure-coral-reef.jpg">
<meta data-field="bg-overlay" content="dark">
<meta data-field="bg-blur" content="sm">
<meta data-field="bg-position" content="top">
</section>
</div>Reef survey 2026
Forty volunteers, twelve dive sites, one count of every coral colony.
<div data-width="full" data-rune="hero" data-density="full">
<section class="rf-section rf-section--center rf-section--has-bg" data-align="center" data-media-position="bottom" data-elevation="flush" data-prominence="marquee" data-color-scheme="dark" data-bg="" data-rune="section" data-density="full">
<div data-name="bg" style="--bg-image: url(https://assets.refrakt.md/figure-coral-reef.jpg); --bg-position: top; --bg-blur: 4px" class="rf-section__bg">
<div data-name="bg-overlay" data-bg-overlay="dark" class="rf-section__bg-overlay"></div>
</div>
<div data-name="content" class="rf-section__content">
<header data-name="preamble" class="rf-section__preamble" data-section="preamble">
<h1 data-slot="headline" id="reef-survey-2026" data-name="headline" class="rf-section__headline" data-section="title">Reef survey 2026</h1>
<p data-slot="blurb" data-name="blurb" class="rf-section__blurb" data-section="description">Forty volunteers, twelve dive sites, one count of every coral colony.</p>
</header>
<div data-name="body" class="rf-section__body" data-section="body">
<div class="rf-actions" data-rune="actions" data-density="full"></div>
</div>
</div>
</section>
</div>| Set | To | Effect |
|---|---|---|
blur | sm, md, lg | Softens the image behind the text |
position | A CSS background position, such as top or bottom left | Which part of the image stays in view |
fit | cover (default) or contain | Crop the image to fill, or show all of it |
opacity | 0 to 1 | Fades the image into the background color |
fixed | true | Keeps the image in place while the page scrolls past, a parallax effect |
Reuse a background by name
A background used in many places can be named once in backgrounds in refrakt.config.json, then applied with bg="name" on the rune or preset on {% bg %}. A theme can ship named backgrounds too; the project's win when the names match.
"backgrounds": {
"brand-fade": { "gradient": { "type": "linear", "direction": "to-br", "stops": ["primary", "surface"] } }
}
For an effect the gradient fields can't express, a named background can carry raw CSS in style instead, such as { "style": { "background": "conic-gradient(…)" } }. Raw CSS ignores the theme's colors, so it won't follow a theme change or a tint.
Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
preset | string | — | Named background preset from the theme |
src | string | — | URL of the background image |
video | string | — | URL of a background video |
overlay | string | — | Flat wash over the background: none | dark | light | a token name. Raw CSS is deprecated; use `scrim` for a gradient |
overlay-opacity | string | — | Opacity of a token-coloured overlay wash (0 to 1) |
gradient | "to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl" | — | Gradient direction (token-driven fill) |
from | string | — | Gradient start colour — semantic token name |
to | string | — | Gradient end colour — semantic token name |
via | string | — | Optional middle gradient stop — semantic token name |
gradient-type | "linear" | "radial" | "conic" | — | Gradient type: linear (default), radial, conic |
blur | "none" | "sm" | "md" | "lg" | — | Blur intensity applied to the background |
position | string | — | CSS background-position value |
fit | "cover" | "contain" | — | How the background image fills its container |
opacity | string | — | Opacity of the background layer (0 to 1) |
fixed | boolean | — | Fix the background so it stays in place while scrolling |
| Not available | Why |
|---|---|
| bg, dropcap, elevation, frame, inset, motion (reveal, stagger), prominence, reading, spacing, substrate, tint, width | this rune supplies axis values to its parent rather than carrying its own |