"use client"; import { useState, useEffect, useRef } from "react"; interface Step { title: string; sub: string; } const STEPS: Step[] = [ { title: "Klare Wunschkunden-Persona", sub: "+ vollst\u00e4ndiger Marketing-Audit" }, { title: "Was verkaufst du?", sub: "EIN klares Startangebot \u2014 konkret und buchbar" }, { title: "Angebot ausgebaut + Positionierung", sub: "Positionierungsformel in einem Satz" }, { title: "Verkaufsseite + 90-Tage-Plan", sub: "2 fokussierte Kan\u00e4le entschieden" }, { title: "Content-Plan 4 Wochen", sub: "Was, wann und warum du postest" }, { title: "Social Media Verkauf", sub: "+ professionelles Video-Setup mit dem Handy" }, { title: "Dein Verkaufsskript", sub: "F\u00fcr Direktansprache und Netzwerkveranstaltungen" }, { title: "Google Business optimiert", sub: "+ SEO-Grundlagen f\u00fcr deine Website" }, ]; // Waypoints along the mountain ridge (SVG user units, viewBox 940 × 580) const WP = [ { x: 65, y: 520, lean: 8 }, { x: 195, y: 488, lean: 12 }, { x: 325, y: 450, lean: 15 }, { x: 450, y: 407, lean: 17 }, { x: 565, y: 358, lean: 20 }, { x: 670, y: 303, lean: 22 }, { x: 757, y: 248, lean: 24 }, { x: 840, y: 192, lean: 0 }, ] as const; const VW = 940; const VH = 580; // Smooth quadratic-bezier path through all waypoints (midpoint technique) const RIDGE = "M 65 520" + " Q 130 504 195 488" + " Q 260 469 325 450" + " Q 387.5 428.5 450 407" + " Q 507.5 382.5 565 358" + " Q 617.5 330.5 670 303" + " Q 713.5 275.5 757 248" + " Q 798.5 220 840 192"; // Filled mountain silhouette (ridge + right slope + base) const FILL = `M 0 ${VH} L 0 540 L ` + RIDGE.slice(2) + ` L 940 265 L 940 ${VH} Z`; const CARD_W = 234; const CARD_H = 110; const SUMMIT_W = 294; const SUMMIT_H = 80; export default function MountainClimb() { const [step, setStep] = useState(-1); const [paused, setPaused] = useState(false); const sectionRef = useRef(null); const started = useRef(false); // Auto-start when section scrolls into view useEffect(() => { const el = sectionRef.current; if (!el) return; const obs = new IntersectionObserver( ([e]) => { if (e.isIntersecting && !started.current) { started.current = true; setStep(0); } }, { threshold: 0.25 } ); obs.observe(el); return () => obs.disconnect(); }, []); // Advance one step every 1.6 s — paused when user clicked useEffect(() => { if (step < 0 || step >= STEPS.length - 1 || paused) return; const t = setTimeout(() => setStep((s) => s + 1), 1600); return () => clearTimeout(t); }, [step, paused]); const atSummit = step === STEPS.length - 1; const wp = step >= 0 ? WP[step] : WP[0]; // Regular card positioning const rawCX = wp.x - CARD_W / 2; const cardX = Math.min(Math.max(rawCX, 8), VW - CARD_W - 8); const cardY = Math.max(wp.y - CARD_H - 110, 4); // Summit card positioning const summitRawCX = wp.x - SUMMIT_W / 2; const summitCardX = Math.min(Math.max(summitRawCX, 8), VW - SUMMIT_W - 8); const summitCardY = Math.max(wp.y - SUMMIT_H - 120, 4); // Mobile pan: viewport 380×440 follows the person const MOB_W = 380, MOB_H = 440; const mobPanX = Math.min(0, Math.max(-(VW - MOB_W), -(wp.x - MOB_W / 2))); const mobPanY = Math.min(0, Math.max(-(VH - MOB_H), -(wp.y - Math.round(MOB_H * 0.68)))); const replay = () => { started.current = true; setStep(0); }; return (
{/* Header */}
Deine Ergebnisse

Nach 8 Wochen nimmst du mit:

{/* ── Mountain animation (desktop only) ── */}
!atSummit && setPaused((p) => !p)} style={{ cursor: atSummit ? "default" : "pointer" }} title={paused ? "Klicken um fortzusetzen" : "Klicken zum Pausieren"} > {/* Pause hint */} {step >= 0 && !atSummit && (

{paused ? "\u25B6 Klicken zum Fortsetzen" : "\u23F8 Klicken zum Pausieren"}

)} {/* Replay button */} {atSummit && (
)}
{/* ── Mobile: same SVG, viewport follows the person ── */}
!atSummit && setPaused((p) => !p)} style={{ cursor: atSummit ? "default" : "pointer" }} > {/* Hints */} {step >= 0 && !atSummit && (

{paused ? "▶ Tippen zum Fortsetzen" : "⏸ Tippen zum Pausieren"}

)} {atSummit && (
)}
); }