"use client";
import { useEffect, useRef } from "react";
import Link from "next/link";
import { getAllServiceLinks } from "@/data/services";
/**
* Full-screen dark video hero ("Power AI" design).
* - Looping background video with a JS-controlled fade loop (0.5s fade-in at
* start, 0.5s fade-out at end via requestAnimationFrame; on ended → opacity
* 0, 100ms pause, replay).
* - Blurred dark overlay shape centered behind the content (no gradient
* overlays on the video itself).
* - Brand type & color: Google Sans only (headline + body), orange→gold
* gradient "AI", token colors throughout.
* - Liquid-glass logo marquee pinned to the bottom.
*
* Note: the site's global replaces the spec's in-hero navbar.
*/
// Self-hosted copy of the original hero clip (perf: no third-party CDN).
const VIDEO_SRC = "/videos/hero-bg.mp4";
// Services marquee — real internal links (SEO: crawlable, descriptive anchors).
const SERVICES = getAllServiceLinks().slice(0, 12);
const FADE = 0.5; // seconds
export default function HeroVideo() {
const videoRef = useRef(null);
// Custom fade loop: fade in over the first 0.5s, fade out over the last
// 0.5s, then reset → wait 100ms → replay.
useEffect(() => {
const v = videoRef.current;
if (!v) return;
let raf;
let replayTimer;
const tick = () => {
if (v.duration) {
const t = v.currentTime;
let opacity = 1;
if (t < FADE) opacity = t / FADE;
else if (v.duration - t < FADE) opacity = Math.max(0, (v.duration - t) / FADE);
v.style.opacity = opacity;
}
raf = requestAnimationFrame(tick);
};
const onEnded = () => {
v.style.opacity = 0;
replayTimer = setTimeout(() => {
v.currentTime = 0;
v.play();
}, 100);
};
v.addEventListener("ended", onEnded);
raf = requestAnimationFrame(tick);
return () => {
cancelAnimationFrame(raf);
clearTimeout(replayTimer);
v.removeEventListener("ended", onEnded);
};
}, []);
return (
{/* Background video — no gradient overlays */}
{/* Hero */}
{/* Blurred overlay shape behind the content */}
{/* Content — vertically centered */}
Cerkel
AI
We design, build and scale web, mobile
and AI products that perform.
Start a project
{/* Logo marquee — pinned to the bottom */}
Services we deliver
end to end
{[...SERVICES, ...SERVICES].map(({ name, slug }, i) => (
{name[0]}
{name}
))}
);
}