"use client";

import { m, useReducedMotion } from "motion/react";

import { manifesto } from "@/lib/portfolio";

export function Manifesto() {
  const shouldReduceMotion = useReducedMotion();
  const [beforeSurvive, afterSurvive = ""] = manifesto.split("survive contact");
  const [betweenAccents, afterProof = ""] = afterSurvive.split("proof");

  return (
    <m.section
      aria-labelledby="manifesto-heading"
      className="mx-auto max-w-7xl px-4 py-20 text-blacksite-muted sm:px-6 sm:py-28 lg:px-8"
      initial={shouldReduceMotion ? false : { opacity: 0, y: 18 }}
      whileInView={{ opacity: 1, y: 0 }}
      viewport={{ once: true, margin: "-15%" }}
      transition={{ duration: shouldReduceMotion ? 0 : 0.6, ease: "easeOut" }}
    >
      <p className="section-label mb-6">OPERATING PRINCIPLE</p>
      <h2
        id="manifesto-heading"
        className="max-w-5xl font-display text-[clamp(28px,4vw,56px)] font-semibold leading-[0.98] tracking-[-0.06em] text-blacksite-muted"
      >
        {beforeSurvive}
        <span className="text-signal-cyan">survive contact</span>
        {betweenAccents}
        <span className="text-signal-orange">proof</span>
        {afterProof}
      </h2>
    </m.section>
  );
}
