// service-shared.jsx: scrapbook pieces shared by the /services/ page and the four service pages.
// Collage (taped reel + polaroid + spinning badge + note), Chips, Storyboard, Finale and
// useSceneEngine (reveal on scroll, parallax, word-by-word lead). Styles live in css/services.css (.ss-*).
// Needs hero-fx.js, engine.js, ui-shared.jsx (Doodle, Tape, ArrowSvg). Exposes everything on window.
const CHIP_BG = ['var(--paper)', 'var(--sun)', 'var(--pop)', 'var(--paper)', 'var(--tint)', 'var(--paper)'];
const CHIP_ROT = ['-2deg', '1.5deg', '-1deg', '2deg', '-1.5deg', '1deg'];
const TAPE_COLORS = ['var(--sun)', 'var(--pop)', 'var(--blue)', 'var(--sun)'];
// Lead sentence whose words light up as it crosses the reading line (driven by useSceneEngine).
function LeadWords({ text }) {
const words = text.split(' ');
return (
{words.map((t, i) => (
= words.length - 2 ? '1' : '0'} className="hx-w">{t}
= words.length - 2 && i < words.length - 1 ? '1' : '0'} className="hx-w hx-w-sp">{' '}
))}
);
}
function Chips({ items, delay = 320 }) {
return (
{items.map(([k, v], i) => (
{k} {v}
))}
);
}
function Collage({ idx, reel, note, img, imgAlt, tag, num }) {
const clip = LL.byId[reel];
let badge = ''; while (badge.length < 46) badge += tag.toUpperCase() + ' ✦ ';
return (
{num}
{tag}
);
}
function Storyboard({ steps, title = 'the storyboard', aside = '(how it works)' }) {
return (
{title} {aside}
{steps.map((s, i) => (
{String(i + 1).padStart(2, '0')}
{s}
))}
);
}
// Brand sticker, same look as the homepage hero: paper rim, tinted face, tilted logo.
// Hover or focus floods the face with the brand colour.
function BrandSticker({ logo: l, i = 0 }) {
const white = l.tone === 'white', rad = i % 3 === 1 ? '28%' : '50%';
const img = { width: white ? '108%' : '74%', maxHeight: white ? 'none' : '62%', transform: 'rotate(' + [-6, 4, -3, 7][i % 4] + 'deg)' };
return (
);
}
// Dark closing band. words = ribbon text, title/em = headline, ctas = [{ href, label, kind: 'sun' | 'line' }].
function Finale({ words, title, em, sub, ctas, fan = ['sculpted', 'jude', 'humantra'] }) {
const run = (k) => (
{[0, 1, 2].flatMap((r) => words.map((w) => {w} ✦ ))}
);
return (
✦ (Your move)
{title} {em}
{sub}
{fan.map((id, k) => (
))}
);
}
// One Engine loop: reveals [data-scene] sections (data-in), parallax (--py), word-by-word lead.
function useSceneEngine(rootRef) {
React.useEffect(() => {
const root = rootRef.current, w = Engine.w, red = LL.REDUCED;
LL.decorate(root); Engine.invalidate(root); LL.observe(root);
return Engine.add(() => {
const vh = innerHeight;
Engine.qa(root, '[data-scene]').forEach((el) => {
const r = el.getBoundingClientRect();
if (r.bottom < -200 || r.top > vh + 200) return;
if (!el._in && (red || r.top < vh * 0.72)) { el._in = 1; el.setAttribute('data-in', '1'); }
if (!red) {
const q = (r.top + r.height / 2 - vh / 2) / vh;
Engine.qa(el, '[data-depth]').forEach((d) => w(d, '--py', (-q * +d.getAttribute('data-depth')).toFixed(1) + 'px'));
}
Engine.qa(el, '[data-para]').forEach((p) => {
const b = p.getBoundingClientRect();
const t = red ? 1 : LL.clamp((vh * 0.86 - b.top) / (vh * 0.22 + b.height), 0, 1);
const ws = p._w || (p._w = [...p.querySelectorAll('[data-w]')]);
const lit = Math.floor(t * ws.length + 0.0001);
if (p._lit === lit) return;
p._lit = lit;
ws.forEach((s, i) => {
const on = i < lit;
if (s.getAttribute('data-lit') !== '0') w(s, 'color', on ? 'var(--ink)' : 'var(--ink-20)');
if (s.getAttribute('data-hl') === '1') w(s, 'backgroundSize', on ? '100% .4em' : '0% .4em');
});
});
});
});
}, []);
}
Object.assign(window, { BrandSticker, LeadWords, Chips, Collage, Storyboard, Finale, useSceneEngine, TAPE_COLORS });