/* global React, ReactDOM, useTweaks, TweaksPanel, TweakSection, TweakRadio, TweakColor, TweakSlider, CustomCursor, Reveal, Marquee, Placeholder, SplitLines, LiveClock, CornerTicks */
const { useState, useEffect, useRef, useMemo } = React;

/* ---------------------------------------- SECTION NAV / CURTAIN TRANSITION
   Fires a CustomEvent that <SectionTransition /> listens for. The panel
   sweeps in from the top, we jump-scroll while it covers the viewport, then
   it sweeps out the bottom revealing the new section. */
function gotoSection(id, label) {
  if (typeof window === "undefined") return;
  window.dispatchEvent(new CustomEvent("goto-section", { detail: { id, label } }));
}

function SectionTransition() {
  // phase: "idle" | "in" | "out"
  const [state, setState] = useState({ phase: "idle", target: null });

  useEffect(() => {
    const handler = (e) => {
      // Respect reduced motion: jump straight to the section, no curtain.
      const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
      if (reduced) {
        const { id } = e.detail;
        const el = id === "top" ? null : document.getElementById(id);
        const y = el ? el.getBoundingClientRect().top + window.scrollY - 70 : 0;
        window.scrollTo(0, y);
        return;
      }
      setState({ phase: "in", target: e.detail });
    };
    window.addEventListener("goto-section", handler);
    return () => window.removeEventListener("goto-section", handler);
  }, []);

  useEffect(() => {
    if (state.phase === "in") {
      // After the in-animation (420ms) the panel fully covers the viewport.
      // Now we instant-scroll behind it, hold a beat, then slide it out.
      const t1 = setTimeout(() => {
        const { id } = state.target;
        const el = id === "top" ? null : document.getElementById(id);
        const y = el ? el.getBoundingClientRect().top + window.scrollY - 70 : 0;
        window.scrollTo(0, y);
        const t2 = setTimeout(() => {
          setState((s) => ({ ...s, phase: "out" }));
        }, 180);
        return () => clearTimeout(t2);
      }, 430);
      return () => clearTimeout(t1);
    }
    if (state.phase === "out") {
      const t = setTimeout(() => setState({ phase: "idle", target: null }), 480);
      return () => clearTimeout(t);
    }
  }, [state.phase, state.target]);

  if (state.phase === "idle") return null;

  return (
    <div style={{
      position: "fixed",
      inset: 0,
      zIndex: 10000,
      pointerEvents: "none",
      overflow: "hidden",
    }}>
      <div style={{
        position: "absolute",
        inset: 0,
        background: "var(--bg)",
        borderTop: "1px solid var(--line-soft, rgba(245,241,234,0.05))",
        borderBottom: "1px solid var(--line-soft, rgba(245,241,234,0.05))",
        animation: state.phase === "in"
          ? "curtainIn 0.42s cubic-bezier(0.76, 0, 0.24, 1) forwards"
          : "curtainOut 0.46s cubic-bezier(0.76, 0, 0.24, 1) forwards",
        display: "flex",
        flexDirection: "column",
        alignItems: "center",
        justifyContent: "center",
        gap: 24,
      }}>
        {/* Top eyebrow line: small mono caption */}
        <div style={{
          fontFamily: "var(--font-mono)",
          fontSize: 10,
          letterSpacing: "0.28em",
          textTransform: "uppercase",
          color: "var(--fg-dim)",
          opacity: 0,
          animation: state.phase === "in"
            ? "curtainLabelIn 0.35s ease 0.15s forwards"
            : "curtainLabelOut 0.18s ease forwards",
        }}>
          → Going to
        </div>

        {/* Section name, big italic display */}
        <div style={{
          fontFamily: "var(--font-display)",
          fontStyle: "italic",
          fontSize: "clamp(56px, 14vw, 180px)",
          color: "var(--fg)",
          letterSpacing: "-0.02em",
          lineHeight: 1,
          opacity: 0,
          animation: state.phase === "in"
            ? "curtainLabelIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.18s forwards"
            : "curtainLabelOut 0.2s ease forwards",
        }}>
          {state.target?.label}
        </div>

        {/* Thin accent bar that stretches in */}
        <div style={{
          width: 120,
          height: 1,
          background: "var(--accent)",
          transformOrigin: "left center",
          transform: "scaleX(0)",
          animation: state.phase === "in"
            ? "curtainBarIn 0.4s cubic-bezier(0.76, 0, 0.24, 1) 0.22s forwards"
            : "curtainLabelOut 0.18s ease forwards",
        }} />
      </div>
    </div>
  );
}

/* Viewport hook: drives every "stack on mobile" switch in this file.
   Breakpoint 768 = standard tablet split. Use isMobile for phones,
   isCompact for phone + small tablet portrait. */
function useViewport() {
  const get = () => (typeof window === "undefined" ? 1200 : window.innerWidth);
  const [w, setW] = useState(get);
  useEffect(() => {
    const onResize = () => setW(get());
    window.addEventListener("resize", onResize);
    window.addEventListener("orientationchange", onResize);
    return () => {
      window.removeEventListener("resize", onResize);
      window.removeEventListener("orientationchange", onResize);
    };
  }, []);
  return { width: w, isMobile: w < 720, isCompact: w < 960 };
}

/* ------------------------------------------------------------------ DATA */
const WORK = [
  { idx: "01", year: "2024", title: "Dabur Tea",            client: "Dabur · FMCG",            scope: "2,000-creator network, 300 onboarded directly",     tags: ["Influencer", "Scale"],   metric: "2,000",  unit: "Creator network · 300 direct", brand: "#2E7D32", note: "Pan-India activation for Dabur Tea. Worked across a 2,000-creator program, of which 300 were onboarded by me directly. Contracts, briefs, content checks; the ops nobody puts on a slide." },
  { idx: "02", year: "2024", title: "Swiggy Valentine's",   client: "Swiggy · Food Delivery",  scope: "Valentine's Day repost campaign, 70+ creators in 24 hours", tags: ["Influencer", "Repost"], metric: "70+",   unit: "Creators in 24 hours",          brand: "#FC8019", note: "Valentine's Day repost push for Swiggy. Seventy-plus creators briefed, contracted, and posting inside a single 24-hour window. Logistics-heavy work, on the day it actually mattered." },
  { idx: "03", year: "2023", title: "Netflix Web Series",   client: "Netflix · Streaming",     scope: "Web series activation and parallel ORM",            tags: ["Talent", "ORM"],         metric: "ORM",   unit: "+ web series activation",        brand: "#E50914", note: "Influencer activation for a Netflix India web series with an ORM track running in parallel. Front-end buzz, back-end sentiment work, both kept in sync from week one." },
  { idx: "04", year: "2023", title: "Hero Motors",          client: "Hero Motors · Mobility",  scope: "Lifestyle creator program, 20 talent activations",  tags: ["Influencer", "Launch"],  metric: "20",    unit: "Lifestyle creators",              brand: "#E60012", note: "Twenty creators picked for vibe over specs. Read more like editorial than advert, which was the whole point." },
  { idx: "05", year: "2024", title: "MTR Campaigns",        client: "MTR · Eastern Condiments",scope: "Multiple campaigns across breakfast and masala ranges", tags: ["Influencer", "Food"], metric: "Multi", unit: "Breakfast + Masala drops",        brand: "#B8860B", note: "Creator campaigns for MTR Foods across the breakfast range and the masala range. Food creators in the right kitchens, recipes that don't read as sponsored." },
  { idx: "06", year: "2025", title: "Founder PR",           client: "Independent Founders",    scope: "Magazine features and online editorial coverage",   tags: ["PR", "Editorial"],       metric: "Press", unit: "Magazine + online features",      brand: "#C8A87A", note: "Public relations for indie founders. Drafted the angle, pitched the writers, landed magazine features and online editorial. Editors replied because the story had teeth." },
];

const SERVICES = [
  { n: "(A)", title: "Influencer Marketing",
    body: "Casting, briefing, contracting, and quietly preventing your campaign from becoming a meme. Nano to celebrity. Yes, I'll handle the WhatsApp follow-ups so you don't have to.",
    deliverables: ["Creator strategy", "Casting & negotiation", "Content briefing", "Post-campaign reports"] },
  { n: "(B)", title: "Public Relations & Launch Ops",
    body: "Press outreach, media coordination, and being awake at 2am because an embargo lifted in another time zone. Bonus: reputation work for when something inevitably goes sideways.",
    deliverables: ["Launch campaigns", "Press lists", "Story development", "Crisis support"] },
  { n: "(C)", title: "Ongoing Creator Programs",
    body: "The same creators posting for your brand month after month, instead of disappearing after one campaign. Slow, steady, less Instagrammable than a viral push, but the work that actually moves a brand. Not the pop that trends on Wednesday and gets forgotten by Friday.",
    deliverables: ["Monthly creator collabs", "Content calendars", "UGC playbooks", "Monthly reporting"] },
  { n: "(D)", title: "Freelance / Fractional",
    body: "Embedded with founders and in-house teams who need a marketing brain without hiring a head. Fractional strategy, audits, talent ops, or a steady hand on a hairy launch week.",
    deliverables: ["Channel audits", "Sprint leadership", "Talent ops", "Fractional lead"] },
];

/* ====================================================================== */
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "palette": "obsidian",
  "fontPair": "instrument",
  "motion": 1,
  "intro": "greeting"
}/*EDITMODE-END*/;

function App() {
  // Allow ?intro=X (and ?palette=X, ?fontPair=X) URL overrides so each
  // variant can be tested on the live site without the Tweaks panel.
  const initialTweaks = useMemo(() => {
    if (typeof window === "undefined") return TWEAK_DEFAULTS;
    const q = new URLSearchParams(window.location.search);
    const validIntros = ["greeting","typewriter","preloader","monogram","scramble","none"];
    const validPalettes = ["obsidian","ash","ink","forest"];
    const validFonts = ["instrument","fraunces","cormorant"];
    const overrides = {};
    const introQ = q.get("intro");
    const paletteQ = q.get("palette");
    const fontQ = q.get("fontPair") || q.get("font");
    if (introQ && validIntros.includes(introQ)) overrides.intro = introQ;
    if (paletteQ && validPalettes.includes(paletteQ)) overrides.palette = paletteQ;
    if (fontQ && validFonts.includes(fontQ)) overrides.fontPair = fontQ;
    return { ...TWEAK_DEFAULTS, ...overrides };
  }, []);

  const [tweaks, setTweak] = useTweaks(initialTweaks);

  // Apply tweaks to CSS variables
  useEffect(() => {
    const root = document.documentElement;
    const palettes = {
      obsidian:  { bg: "#0a0a0a", bg2: "#111111", fg: "#f5f1ea", fgDim: "#9a948a", accent: "#c8a87a" },
      ash:       { bg: "#13110f", bg2: "#1a1714", fg: "#f0ebe1", fgDim: "#a89e8e", accent: "#d4a574" },
      ink:       { bg: "#08080a", bg2: "#101015", fg: "#ecebe8", fgDim: "#8a8a90", accent: "#b8b4a8" },
      forest:    { bg: "#0d130f", bg2: "#131c16", fg: "#ebe9df", fgDim: "#8c9a8e", accent: "#a8b89a" },
    };
    const p = palettes[tweaks.palette] || palettes.obsidian;
    root.style.setProperty("--bg", p.bg);
    root.style.setProperty("--bg-2", p.bg2);
    root.style.setProperty("--fg", p.fg);
    root.style.setProperty("--fg-dim", p.fgDim);
    root.style.setProperty("--accent", p.accent);

    const pairs = {
      instrument: { display: '"Instrument Serif", serif',   body: '"Geist", system-ui, sans-serif',           mono: '"Geist Mono", monospace' },
      fraunces:   { display: '"Fraunces", serif',           body: '"Space Grotesk", system-ui, sans-serif',   mono: '"JetBrains Mono", monospace' },
      cormorant:  { display: '"Cormorant Garamond", serif', body: '"Geist", system-ui, sans-serif',           mono: '"Geist Mono", monospace' },
    };
    const f = pairs[tweaks.fontPair] || pairs.instrument;
    root.style.setProperty("--font-display", f.display);
    root.style.setProperty("--font-body", f.body);
    root.style.setProperty("--font-mono", f.mono);
  }, [tweaks.palette, tweaks.fontPair]);

  const motion = tweaks.motion;

  return (
    <div>
      <Intro key={tweaks.intro} variant={tweaks.intro} motion={motion} />
      <CustomCursor />
      <SectionTransition />
      <Nav motion={motion} />
      <Hero motion={motion} />
      <Ticker motion={motion} />
      <Work motion={motion} />
      <Capabilities motion={motion} />
      <About motion={motion} />
      <Contact motion={motion} />
      <Footer />

      <TweaksPanel title="Tweaks">
        <TweakSection label="Palette">
          <TweakRadio
            label="Mood"
            value={tweaks.palette}
            onChange={(v) => setTweak("palette", v)}
            options={[
              { value: "obsidian", label: "Obsidian" },
              { value: "ash",      label: "Ash" },
              { value: "ink",      label: "Ink" },
              { value: "forest",   label: "Forest" },
            ]}
          />
        </TweakSection>

        <TweakSection label="Typography">
          <TweakRadio
            label="Pairing"
            value={tweaks.fontPair}
            onChange={(v) => setTweak("fontPair", v)}
            options={[
              { value: "instrument", label: "Instrument" },
              { value: "fraunces",   label: "Fraunces" },
              { value: "cormorant",  label: "Cormorant" },
            ]}
          />
        </TweakSection>

        <TweakSection label="Motion">
          <TweakSlider
            label="Intensity"
            min={0} max={2} step={0.1}
            value={tweaks.motion}
            onChange={(v) => setTweak("motion", v)}
          />
        </TweakSection>

        <TweakSection label="Intro">
          <TweakRadio
            label="Effect"
            value={tweaks.intro}
            onChange={(v) => setTweak("intro", v)}
            options={[
              { value: "greeting",   label: "Greeting" },
              { value: "typewriter", label: "Typed Name" },
              { value: "preloader",  label: "Preloader" },
              { value: "monogram",   label: "Monogram" },
              { value: "scramble",   label: "Scramble" },
              { value: "none",       label: "Off" },
            ]}
          />
        </TweakSection>
      </TweaksPanel>
    </div>
  );
}

/* =========================================================== INTRO DISPATCHER
   Picks an intro variant. `none` skips. Each variant is self-contained,
   mounts as a full-screen overlay, plays once, then unmounts. */
function Intro({ variant = "greeting", motion = 1 }) {
  if (motion === 0 || variant === "none") return null;
  if (variant === "typewriter") return <TypewriterIntro />;
  if (variant === "preloader")  return <PreloaderIntro />;
  if (variant === "monogram")   return <MonogramIntro />;
  if (variant === "scramble")   return <ScrambleIntro />;
  return <GreetingIntro />;
}

/* Shared helper: lock body scroll for the duration of an intro overlay. */
function useBodyLock(active = true) {
  useEffect(() => {
    if (!active) return;
    const prev = document.body.style.overflow;
    document.body.style.overflow = "hidden";
    return () => { document.body.style.overflow = prev; };
  }, [active]);
}

/* =========================================================== GREETING INTRO
   Full-screen black overlay. Cycles through five Indian-script greetings
   (Hindi, Tamil, Punjabi, Gujarati, Kannada) and lands on "Hello." Then
   the curtain slides up off-screen revealing the page. Total ~1.8s. */
function GreetingIntro() {
  return <Greeting />;
}

function Greeting({ motion = 1 }) {
  const greetings = [
    { text: "नमस्ते", lang: "Hindi" },
    { text: "வணக்கம்", lang: "Tamil" },
    { text: "ਸਤ ਸ੍ਰੀ ਅਕਾਲ", lang: "Punjabi" },
    { text: "નમસ્તે", lang: "Gujarati" },
    { text: "ನಮಸ್ಕಾರ", lang: "Kannada" },
    { text: "Hello.", lang: "English" },
  ];

  const reduced = typeof window !== "undefined"
    && window.matchMedia
    && window.matchMedia("(prefers-reduced-motion: reduce)").matches;

  const [idx, setIdx] = useState(0);
  const [wipe, setWipe] = useState(false);
  const [done, setDone] = useState(false);

  useEffect(() => {
    if (motion === 0 || reduced) {
      // Skip the show entirely for users who asked for reduced motion.
      setDone(true);
      return;
    }
    document.body.style.overflow = "hidden";

    const stepDurations = [180, 180, 200, 180, 200, 420];
    let i = 0;
    let timeoutId;
    const step = () => {
      i += 1;
      if (i < greetings.length) {
        setIdx(i);
        timeoutId = setTimeout(step, stepDurations[i]);
      } else {
        // Hold then wipe
        timeoutId = setTimeout(() => setWipe(true), 60);
      }
    };
    timeoutId = setTimeout(step, stepDurations[0]);

    return () => {
      clearTimeout(timeoutId);
      document.body.style.overflow = "";
    };
  }, [motion, reduced]);

  useEffect(() => {
    if (!wipe) return;
    const t = setTimeout(() => {
      setDone(true);
      document.body.style.overflow = "";
    }, 850);
    return () => clearTimeout(t);
  }, [wipe]);

  if (done) return null;

  const current = greetings[idx];
  const isFinal = idx === greetings.length - 1;

  return (
    <div
      aria-hidden="true"
      style={{
        position: "fixed",
        inset: 0,
        zIndex: 99999,
        background: "var(--bg)",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        transform: wipe ? "translateY(-100%)" : "translateY(0)",
        transition: "transform 0.85s cubic-bezier(0.85, 0, 0.15, 1)",
        pointerEvents: wipe ? "none" : "auto",
        willChange: "transform",
      }}
    >
      {/* Subtle grain to match site texture */}
      <div style={{
        position: "absolute", inset: 0, pointerEvents: "none", opacity: 0.05,
        backgroundImage: "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>\")",
      }} />

      {/* Top-left index marker */}
      <div style={{
        position: "absolute",
        top: 22, left: 40,
        fontFamily: "var(--font-mono)",
        fontSize: 11,
        letterSpacing: "0.2em",
        textTransform: "uppercase",
        color: "var(--fg-mute)",
      }}>
        § 00 · Welcome
      </div>

      {/* The greeting itself */}
      <div style={{
        position: "relative",
        display: "flex",
        alignItems: "baseline",
        gap: 20,
      }}>
        <span style={{
          width: 10, height: 10, borderRadius: "50%",
          background: "var(--accent)",
          boxShadow: "0 0 14px var(--accent)",
          display: "inline-block",
          alignSelf: "center",
          animation: "greet-pulse 1.2s ease-in-out infinite",
        }} />
        <span
          key={idx}
          style={{
            fontFamily: "var(--font-display)",
            fontStyle: isFinal ? "italic" : "normal",
            fontSize: "clamp(56px, 12vw, 180px)",
            lineHeight: 1,
            letterSpacing: "-0.02em",
            color: "var(--fg)",
            display: "inline-block",
            animation: "greet-in 0.32s cubic-bezier(0.22, 1, 0.36, 1)",
          }}
        >
          {current.text}
        </span>
      </div>

      {/* Bottom-right lang tag */}
      <div style={{
        position: "absolute",
        bottom: 22, right: 40,
        fontFamily: "var(--font-mono)",
        fontSize: 10,
        letterSpacing: "0.3em",
        textTransform: "uppercase",
        color: "var(--fg-mute)",
        textAlign: "right",
      }}>
        <div style={{ color: "var(--accent)" }}>{current.lang}</div>
        <div style={{ marginTop: 4 }}>{String(idx + 1).padStart(2, "0")} / {String(greetings.length).padStart(2, "0")}</div>
      </div>

      <style>{`
        @keyframes greet-in {
          from { opacity: 0; transform: translateY(14px); }
          to { opacity: 1; transform: translateY(0); }
        }
        @keyframes greet-pulse {
          0%, 100% { opacity: 1; transform: scale(1); }
          50%      { opacity: 0.45; transform: scale(0.8); }
        }
      `}</style>
    </div>
  );
}

/* =========================================================== TYPEWRITER INTRO
   Letters of "Abhishek Khandelwal" type out, hold, underline animates in,
   then the overlay dissolves. ~1.5s. */
function TypewriterIntro() {
  const FULL = "Abhishek Khandelwal";
  const [chars, setChars] = useState(0);
  const [held, setHeld] = useState(false);
  const [wipe, setWipe] = useState(false);
  const [done, setDone] = useState(false);
  useBodyLock(!done);

  useEffect(() => {
    let i = 0;
    const ts = [];
    const tick = () => {
      i += 1;
      setChars(i);
      if (i < FULL.length) {
        ts.push(setTimeout(tick, 55));
      } else {
        ts.push(setTimeout(() => setHeld(true), 200));
        ts.push(setTimeout(() => setWipe(true), 900));
        ts.push(setTimeout(() => setDone(true), 1600));
      }
    };
    ts.push(setTimeout(tick, 120));
    return () => ts.forEach(clearTimeout);
  }, []);

  if (done) return null;
  return (
    <div aria-hidden style={{
      position: "fixed", inset: 0, zIndex: 99999, background: "var(--bg)",
      display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center",
      opacity: wipe ? 0 : 1, transition: "opacity 0.7s ease",
      pointerEvents: wipe ? "none" : "auto",
    }}>
      <div style={{ position: "absolute", top: 22, left: 40, fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: "0.2em", textTransform: "uppercase", color: "var(--fg-mute)" }}>
        § 00 · Frontispiece
      </div>
      <h1 style={{
        fontFamily: "var(--font-display)",
        fontSize: "clamp(48px, 9vw, 140px)",
        letterSpacing: "-0.025em",
        lineHeight: 1, margin: 0, color: "var(--fg)",
        whiteSpace: "nowrap",
      }}>
        {FULL.slice(0, chars)}
        <span style={{
          color: "var(--accent)",
          opacity: chars < FULL.length ? 1 : 0,
          marginLeft: 4,
          animation: "blink 0.6s steps(2) infinite",
        }}>|</span>
      </h1>
      <div style={{
        marginTop: 18,
        width: held ? "min(58%, 560px)" : 0,
        height: 1, background: "var(--accent)",
        transition: "width 0.7s cubic-bezier(0.22, 1, 0.36, 1)",
      }} />
      <style>{`@keyframes blink { 50% { opacity: 0; } }`}</style>
    </div>
  );
}

/* =========================================================== PRELOADER INTRO
   Bottom progress bar 0 to 100 with rotating witty Indian-context messages.
   ~2s. */
function PreloaderIntro() {
  const msgs = [
    "Brewing chai…",
    "Briefing creators…",
    "Chasing editor for quote…",
    "Reading WhatsApp at midnight…",
    "Finalising deck nobody will read…",
    "Almost there…",
  ];
  const [pct, setPct] = useState(0);
  const [msg, setMsg] = useState(0);
  const [wipe, setWipe] = useState(false);
  const [done, setDone] = useState(false);
  useBodyLock(!done);

  useEffect(() => {
    let p = 0;
    let raf;
    const t0 = Date.now();
    const tick = () => {
      const elapsed = Date.now() - t0;
      p = Math.min(100, (elapsed / 1700) * 100);
      setPct(Math.round(p));
      setMsg(Math.min(msgs.length - 1, Math.floor((p / 100) * msgs.length)));
      if (p < 100) {
        raf = requestAnimationFrame(tick);
      } else {
        setTimeout(() => setWipe(true), 300);
        setTimeout(() => setDone(true), 1000);
      }
    };
    raf = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(raf);
  }, []);

  if (done) return null;
  return (
    <div aria-hidden style={{
      position: "fixed", inset: 0, zIndex: 99999, background: "var(--bg)",
      display: "flex", alignItems: "center", justifyContent: "center",
      opacity: wipe ? 0 : 1, transition: "opacity 0.7s ease",
      pointerEvents: wipe ? "none" : "auto",
    }}>
      <div style={{ position: "absolute", top: 22, left: 40, fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: "0.2em", textTransform: "uppercase", color: "var(--fg-mute)" }}>
        § 00 · Loading
      </div>
      <div style={{ textAlign: "center", padding: "0 24px" }}>
        <div
          key={msg}
          style={{
            fontFamily: "var(--font-display)",
            fontStyle: "italic",
            fontSize: "clamp(32px, 5vw, 64px)",
            letterSpacing: "-0.01em",
            color: "var(--fg)",
            animation: "msg-in 0.35s cubic-bezier(0.22, 1, 0.36, 1)",
          }}
        >
          {msgs[msg]}
        </div>
      </div>
      <div style={{
        position: "absolute", bottom: 40, left: 40, right: 40,
        fontFamily: "var(--font-mono)", fontSize: 11,
        letterSpacing: "0.2em", textTransform: "uppercase",
        color: "var(--fg-dim)",
      }}>
        <div style={{ display: "flex", justifyContent: "space-between", marginBottom: 10 }}>
          <span>Loading</span>
          <span style={{ color: "var(--accent)" }}>{String(pct).padStart(3, "0")}%</span>
        </div>
        <div style={{ height: 1, background: "var(--line)", overflow: "hidden" }}>
          <div style={{
            height: "100%", width: pct + "%",
            background: "var(--accent)",
            transition: "width 0.08s linear",
          }} />
        </div>
      </div>
      <style>{`@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }`}</style>
    </div>
  );
}

/* =========================================================== MONOGRAM INTRO
   Huge italic "AK" centred, holds, then scales + slides into the top-left
   nav corner while the backdrop fades. The monogram itself fades out at the
   end so the real Nav logo takes over. ~2s. */
function MonogramIntro() {
  const [shrunk, setShrunk] = useState(false);
  const [fadeAK, setFadeAK] = useState(false);
  const [done, setDone] = useState(false);
  useBodyLock(!done);

  useEffect(() => {
    const ts = [];
    ts.push(setTimeout(() => setShrunk(true), 750));
    ts.push(setTimeout(() => setFadeAK(true), 1500));
    ts.push(setTimeout(() => setDone(true), 2050));
    return () => ts.forEach(clearTimeout);
  }, []);

  if (done) return null;
  return (
    <>
      <div aria-hidden style={{
        position: "fixed", inset: 0, zIndex: 99998, background: "var(--bg)",
        opacity: shrunk ? 0 : 1,
        transition: "opacity 0.9s ease 0.1s",
        pointerEvents: shrunk ? "none" : "auto",
      }} />
      <div aria-hidden style={{
        position: "fixed", zIndex: 99999,
        top: shrunk ? 22 : "50%",
        left: shrunk ? 40 : "50%",
        transform: shrunk ? "translate(0, 0)" : "translate(-50%, -50%)",
        fontFamily: "var(--font-display)",
        fontStyle: "italic",
        fontSize: shrunk ? 22 : "clamp(180px, 26vw, 340px)",
        color: "var(--fg)",
        letterSpacing: "-0.04em",
        lineHeight: 1,
        opacity: fadeAK ? 0 : 1,
        transition: "top 1s cubic-bezier(0.85, 0, 0.15, 1), left 1s cubic-bezier(0.85, 0, 0.15, 1), transform 1s cubic-bezier(0.85, 0, 0.15, 1), font-size 1s cubic-bezier(0.85, 0, 0.15, 1), opacity 0.45s ease",
      }}>
        AK
      </div>
    </>
  );
}

/* =========================================================== SCRAMBLE INTRO
   Hero headline shown scrambled (each char rapidly cycling), resolves
   line by line, then the overlay dissolves. ~1.4s. */
function ScrambleIntro() {
  const LINES = ["Stories that", "travel far. And", "brands that stick."];
  const CHARS = "!<>-_\\/[]{}—=+*^?#________ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  const [out, setOut] = useState(LINES.map((l) => " ".repeat(l.length)));
  const [wipe, setWipe] = useState(false);
  const [done, setDone] = useState(false);
  useBodyLock(!done);

  useEffect(() => {
    const totalMs = 900;
    const t0 = Date.now();
    let raf;
    const tick = () => {
      const t = Math.min(1, (Date.now() - t0) / totalMs);
      const next = LINES.map((line, li) => {
        const lineStart = li * 0.12;
        const lp = Math.max(0, Math.min(1, (t - lineStart) / (1 - lineStart)));
        return line.split("").map((ch, i) => {
          if (ch === " ") return " ";
          const cp = lp * (1 + (line.length - i) / line.length);
          if (cp >= 1) return ch;
          return CHARS[Math.floor(Math.random() * CHARS.length)];
        }).join("");
      });
      setOut(next);
      if (t < 1) {
        raf = requestAnimationFrame(tick);
      } else {
        setTimeout(() => setWipe(true), 320);
        setTimeout(() => setDone(true), 1100);
      }
    };
    raf = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(raf);
  }, []);

  if (done) return null;
  return (
    <div aria-hidden style={{
      position: "fixed", inset: 0, zIndex: 99999, background: "var(--bg)",
      display: "flex", alignItems: "center", justifyContent: "center",
      padding: 40,
      opacity: wipe ? 0 : 1, transition: "opacity 0.7s ease",
      pointerEvents: wipe ? "none" : "auto",
    }}>
      <div style={{ position: "absolute", top: 22, left: 40, fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: "0.2em", textTransform: "uppercase", color: "var(--fg-mute)" }}>
        § 00 · Resolving
      </div>
      <h1 style={{
        fontFamily: "var(--font-display)",
        fontSize: "clamp(48px, 10vw, 160px)",
        letterSpacing: "-0.035em",
        lineHeight: 0.95,
        color: "var(--fg)",
        margin: 0,
        textAlign: "center",
      }}>
        {out.map((line, i) => (
          <div key={i} style={{ fontStyle: i === 1 ? "italic" : "normal" }}>
            {line}
          </div>
        ))}
      </h1>
    </div>
  );
}

/* =========================================================== NAVIGATION */
function Nav({ motion }) {
  const [open, setOpen] = useState(false);
  const [scrolled, setScrolled] = useState(false);
  const { isMobile, isCompact } = useViewport();

  useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 40);
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);

  return (
    <>
      <header style={{
        position: "fixed",
        top: 0, left: 0, right: 0,
        zIndex: 100,
        padding: isMobile ? "16px 20px" : "22px 40px",
        display: "flex",
        alignItems: "center",
        justifyContent: "space-between",
        background: scrolled ? "rgba(10,10,10,0.6)" : "transparent",
        backdropFilter: scrolled ? "blur(12px)" : "none",
        WebkitBackdropFilter: scrolled ? "blur(12px)" : "none",
        borderBottom: scrolled ? "1px solid var(--line)" : "1px solid transparent",
        transition: "all .4s ease",
      }}>
        <a
          href="#top"
          onClick={(e) => { e.preventDefault(); gotoSection("top", "Home"); }}
          data-cursor="hover"
          style={{
            fontFamily: "var(--font-display)",
            fontSize: isMobile ? 18 : 22,
            color: "var(--fg)",
            textDecoration: "none",
            letterSpacing: "-0.01em",
            display: "flex",
            alignItems: "baseline",
            gap: 10,
          }}>
          <span style={{ fontStyle: "italic" }}>Abhishek</span>
          {!isMobile && (
            <span style={{
              fontFamily: "var(--font-mono)",
              fontSize: 10,
              letterSpacing: "0.2em",
              textTransform: "uppercase",
              color: "var(--fg-dim)",
            }}>
              Khandelwal
            </span>
          )}
        </a>

        <nav style={{
          display: "flex",
          alignItems: "center",
          gap: isCompact ? 12 : 36,
          fontFamily: "var(--font-mono)",
          fontSize: 11,
          letterSpacing: "0.18em",
          textTransform: "uppercase",
        }}>
          {!isCompact && [
            ["Work", "work"],
            ["Services", "services"],
            ["About", "about"],
            ["Contact", "contact"],
          ].map(([label, id]) => (
            <a
              key={id}
              href={`#${id}`}
              onClick={(e) => { e.preventDefault(); gotoSection(id, label); }}
              data-cursor="hover"
              style={{
                color: "var(--fg-dim)",
                textDecoration: "none",
                position: "relative",
                transition: "color .3s",
              }}
              onMouseEnter={(e) => e.currentTarget.style.color = "var(--fg)"}
              onMouseLeave={(e) => e.currentTarget.style.color = "var(--fg-dim)"}
            >
              {label}
            </a>
          ))}
          <a
            href="https://cal.com/abhishek-work/15Min"
            target="_blank"
            rel="noopener noreferrer"
            data-cursor="hover"
            style={{
              background: "transparent",
              border: "1px solid var(--accent)",
              color: "var(--accent)",
              padding: isMobile ? "8px 14px" : "10px 18px",
              borderRadius: 999,
              fontFamily: "inherit",
              fontSize: isMobile ? 10 : 11,
              letterSpacing: "0.18em",
              textTransform: "uppercase",
              cursor: "none",
              textDecoration: "none",
            }}
          >
            Book ↗
          </a>
          {!isMobile && (
            <button
              onClick={() => setOpen(true)}
              data-cursor="hover"
              style={{
                background: "transparent",
                border: "1px solid var(--line)",
                color: "var(--fg)",
                padding: "10px 18px",
                borderRadius: 999,
                fontFamily: "inherit",
                fontSize: "inherit",
                letterSpacing: "inherit",
                textTransform: "inherit",
                cursor: "none",
              }}
            >
              Index ↗
            </button>
          )}
        </nav>
      </header>

      {open && <IndexOverlay onClose={() => setOpen(false)} />}
    </>
  );
}

function IndexOverlay({ onClose }) {
  useEffect(() => {
    const onKey = (e) => e.key === "Escape" && onClose();
    window.addEventListener("keydown", onKey);
    return () => window.removeEventListener("keydown", onKey);
  }, [onClose]);

  return (
    <div style={{
      position: "fixed", inset: 0, zIndex: 200,
      background: "rgba(10,10,10,0.96)",
      backdropFilter: "blur(20px)",
      animation: "fadein .4s ease",
      display: "flex",
      flexDirection: "column",
    }}>
      <style>{`@keyframes fadein { from {opacity:0} to {opacity:1} }`}</style>
      <div style={{
        padding: "22px 40px",
        display: "flex",
        justifyContent: "space-between",
        alignItems: "center",
        borderBottom: "1px solid var(--line)",
      }}>
        <span style={{
          fontFamily: "var(--font-mono)",
          fontSize: 11, letterSpacing: "0.2em",
          textTransform: "uppercase", color: "var(--fg-dim)",
        }}>Index · Selected Work</span>
        <button onClick={onClose} data-cursor="hover" style={{
          background: "transparent",
          border: "1px solid var(--line)",
          color: "var(--fg)",
          padding: "10px 18px",
          borderRadius: 999,
          fontFamily: "var(--font-mono)",
          fontSize: 11,
          letterSpacing: "0.2em",
          textTransform: "uppercase",
          cursor: "none",
        }}>Close ✕</button>
      </div>

      <div style={{ flex: 1, overflowY: "auto", padding: "40px 40px 80px" }}>
        {WORK.map((w, i) => (
          <a
            key={w.idx}
            href={`#work`}
            onClick={(e) => { e.preventDefault(); onClose(); gotoSection("work", "Work"); }}
            data-cursor="view"
            data-cursor-label="View"
            style={{
              display: "grid",
              gridTemplateColumns: "60px 1fr 220px 80px",
              alignItems: "baseline",
              padding: "28px 0",
              borderBottom: "1px solid var(--line)",
              color: "var(--fg)",
              textDecoration: "none",
              gap: 24,
            }}
            onMouseEnter={(e) => e.currentTarget.style.paddingLeft = "16px"}
            onMouseLeave={(e) => e.currentTarget.style.paddingLeft = "0"}
          >
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, color: "var(--fg-dim)" }}>{w.idx}</span>
            <span style={{ fontFamily: "var(--font-display)", fontSize: 56, lineHeight: 1, letterSpacing: "-0.02em" }}>
              {w.title}
            </span>
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: "0.15em", textTransform: "uppercase", color: "var(--fg-dim)" }}>
              {w.client}
            </span>
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, color: "var(--fg-dim)" }}>{w.year}</span>
          </a>
        ))}
      </div>
    </div>
  );
}

/* ====================================================================== HERO */
function Hero({ motion }) {
  const [mouse, setMouse] = useState({ x: 0, y: 0 });
  const { isMobile, isCompact } = useViewport();
  useEffect(() => {
    if (motion === 0 || isMobile) return;
    const onMove = (e) => {
      const x = (e.clientX / window.innerWidth - 0.5) * 2;
      const y = (e.clientY / window.innerHeight - 0.5) * 2;
      setMouse({ x, y });
    };
    window.addEventListener("mousemove", onMove);
    return () => window.removeEventListener("mousemove", onMove);
  }, [motion, isMobile]);

  const parallax = (depth) => ({
    transform: `translate3d(${mouse.x * depth}px, ${mouse.y * depth}px, 0)`,
    transition: "transform .8s cubic-bezier(.2,.7,.2,1)",
  });

  return (
    <section id="top" style={{
      minHeight: "100vh",
      position: "relative",
      padding: isMobile ? "100px 20px 40px" : "140px 40px 80px",
      display: "flex",
      flexDirection: "column",
      justifyContent: "space-between",
      overflow: "hidden",
    }}>
      {/* Floating tag, top-right (hidden on mobile to free up nav space) */}
      {!isMobile && <div style={{
        position: "absolute",
        top: 100, right: 40,
        textAlign: "right",
        fontFamily: "var(--font-mono)",
        fontSize: 11,
        letterSpacing: "0.18em",
        textTransform: "uppercase",
        color: "var(--fg-dim)",
        ...parallax(-15),
      }}>
        <Reveal motion={motion} delay={0.2}>
          <div>Independent Practice</div>
          <div style={{ color: "var(--accent)", marginTop: 4 }}>Est. 2022 · Gwalior, M.P</div>
        </Reveal>
      </div>}

      {/* Top-left meta */}
      <div style={{
        fontFamily: "var(--font-mono)",
        fontSize: 11,
        letterSpacing: "0.18em",
        textTransform: "uppercase",
        color: "var(--fg-dim)",
      }}>
        <Reveal motion={motion}>
          <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
            <span style={{
              width: 8, height: 8, borderRadius: "50%",
              background: "var(--accent)",
              boxShadow: "0 0 12px var(--accent)",
              animation: motion > 0 ? "pulse 2s ease-in-out infinite" : "none",
            }} />
            Open for briefs that aren't "make it viral"
          </div>
          <style>{`@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }`}</style>
        </Reveal>
      </div>

      {/* The big type */}
      <div style={{ position: "relative", padding: isMobile ? "30px 0" : "60px 0" }}>
        <h1 style={{
          fontFamily: "var(--font-display)",
          fontWeight: 400,
          fontSize: "clamp(44px, 13vw, 240px)",
          lineHeight: 0.92,
          letterSpacing: "-0.035em",
          margin: 0,
          ...parallax(10),
        }}>
          <SplitLines
            motion={motion}
            lines={[
              <>Stories that</>,
              <><span style={{ fontStyle: "italic", color: "var(--accent)" }}>travel</span> far. And</>,
              <>brands that stick.</>,
            ]}
          />
        </h1>

        {/* Decorative line + index (hidden on mobile, no room) */}
        {!isMobile && <div style={{
          position: "absolute",
          right: 0, top: "50%",
          transform: "translateY(-50%) rotate(-90deg)",
          transformOrigin: "right center",
          fontFamily: "var(--font-mono)",
          fontSize: 10,
          letterSpacing: "0.3em",
          textTransform: "uppercase",
          color: "var(--fg-mute)",
          whiteSpace: "nowrap",
        }}>
          ◇  Index · 01 / Hero
        </div>}
      </div>

      {/* Bottom row */}
      <div style={{
        display: "grid",
        gridTemplateColumns: isMobile ? "1fr" : (isCompact ? "1fr 1fr" : "1.4fr 1fr 1fr"),
        gap: isMobile ? 28 : 60,
        alignItems: "end",
        paddingTop: isMobile ? 24 : 40,
        borderTop: "1px solid var(--line)",
      }}>
        <Reveal motion={motion} delay={0.4}>
          <p style={{
            fontFamily: "var(--font-body)",
            fontSize: 17,
            lineHeight: 1.5,
            maxWidth: 480,
            color: "var(--fg)",
            textWrap: "pretty",
          }}>
            I'm <em style={{ fontFamily: "var(--font-display)", fontStyle: "italic", fontSize: 20 }}>Abhishek Khandelwal</em>. Three years of finding creators for brands and PR opportunities for founders. Worked with Dabur, Swiggy, Netflix, Hero Motors, MTR, and a steady roster of indie founders.
          </p>
        </Reveal>

        <Reveal motion={motion} delay={0.5}>
          <div style={{
            fontFamily: "var(--font-mono)",
            fontSize: 11,
            letterSpacing: "0.15em",
            textTransform: "uppercase",
            color: "var(--fg-dim)",
            lineHeight: 1.8,
          }}>
            <div style={{ color: "var(--fg)" }}>Currently</div>
            <div>Probably briefing a creator</div>
            <div>on a call. Or doing PR</div>
            <div>for a brand. Often both.</div>
          </div>
        </Reveal>

        <Reveal motion={motion} delay={0.6}>
          <div style={{
            fontFamily: "var(--font-mono)",
            fontSize: 11,
            letterSpacing: "0.15em",
            textTransform: "uppercase",
            color: "var(--fg-dim)",
            textAlign: "right",
            lineHeight: 1.8,
          }}>
            <div style={{ color: "var(--fg)" }}><LiveClock /></div>
            <div>Scroll to begin ↓</div>
          </div>
        </Reveal>
      </div>
    </section>
  );
}

/* ============================================================ TICKER */
function Ticker({ motion }) {
  return (
    <Marquee
      motion={motion}
      speed={30}
      items={[
        "Influencer Strategy",
        "Public Relations",
        "Talent Casting",
        "Launch Campaigns",
        "Creator Programs",
        "Press Development",
        "UGC Strategy",
        "Brand Partnerships",
      ]}
    />
  );
}

/* ============================================================ WORK */
function Work({ motion }) {
  const { isMobile, isCompact } = useViewport();
  return (
    <section id="work" style={{
      padding: isMobile ? "80px 20px 60px" : "140px 40px 100px",
      position: "relative",
    }}>
      <SectionHeader number="02" eyebrow="Selected Work" caption="2023 to 2025" motion={motion} />

      <Reveal motion={motion} delay={0.1}>
        <h2 style={{
          fontFamily: "var(--font-display)",
          fontWeight: 400,
          fontSize: "clamp(48px, 8vw, 120px)",
          lineHeight: 0.95,
          letterSpacing: "-0.03em",
          maxWidth: "16ch",
          margin: "20px 0 100px",
        }}>
          A small, considered <span style={{ fontStyle: "italic", color: "var(--accent)" }}>portfolio</span>. Chosen over a Notion page of everything.
        </h2>
      </Reveal>

      <div style={{
        display: "grid",
        gridTemplateColumns: isMobile ? "1fr" : (isCompact ? "1fr 1fr" : "repeat(12, 1fr)"),
        gap: isMobile ? 24 : 32,
        rowGap: isMobile ? 40 : 56,
      }}>
        {WORK.map((w, i) => {
          const layouts = [
            { col: "1 / span 5",  off: 0 },
            { col: "7 / span 6",  off: 36 },
            { col: "2 / span 5",  off: 0 },
            { col: "8 / span 4",  off: 28 },
            { col: "1 / span 5",  off: 48 },
            { col: "7 / span 5",  off: 0 },
          ];
          const L = layouts[i % layouts.length];
          const gridStyle = isMobile || isCompact
            ? { marginTop: 0 }
            : { gridColumn: L.col, marginTop: L.off };
          return (
            <div key={w.idx} style={gridStyle}>
              <WorkTile work={w} index={i} motion={motion} />
            </div>
          );
        })}
      </div>

      <Reveal motion={motion} delay={0.2}>
        <div style={{
          marginTop: 120,
          paddingTop: 40,
          borderTop: "1px solid var(--line)",
          display: "flex",
          justifyContent: "space-between",
          alignItems: "center",
          flexWrap: "wrap",
          gap: 20,
        }}>
          <div style={{
            fontFamily: "var(--font-mono)",
            fontSize: 11,
            letterSpacing: "0.18em",
            textTransform: "uppercase",
            color: "var(--fg-dim)",
          }}>
            Showing {WORK.length} of many. The rest is on request, or a Drive link
          </div>
          <a
            href="#contact"
            onClick={(e) => { e.preventDefault(); gotoSection("contact", "Contact"); }}
            data-cursor="hover"
            style={{
              fontFamily: "var(--font-display)",
              fontStyle: "italic",
              fontSize: 28,
              color: "var(--fg)",
              textDecoration: "none",
              display: "inline-flex",
              alignItems: "center",
              gap: 12,
            }}
          >
            Ask for the full archive
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 16, color: "var(--accent)" }}>→</span>
          </a>
        </div>
      </Reveal>
    </section>
  );
}

function WorkTile({ work, index, motion }) {
  const [hover, setHover] = useState(false);
  const brand = work.brand || "var(--accent)";
  return (
    <Reveal motion={motion} delay={0.05}>
      <div
        onMouseEnter={() => setHover(true)}
        onMouseLeave={() => setHover(false)}
        style={{
          position: "relative",
          transition: "transform .8s cubic-bezier(.2,.7,.2,1)",
          transform: hover ? "translateY(-6px)" : "translateY(0)",
        }}
      >
        {/* Meta row */}
        <div style={{
          display: "flex",
          justifyContent: "space-between",
          alignItems: "baseline",
          marginBottom: 14,
          fontFamily: "var(--font-mono)",
          fontSize: 10,
          letterSpacing: "0.2em",
          textTransform: "uppercase",
          color: "var(--fg-dim)",
        }}>
          <span>{work.idx} / {work.tags.join(" · ")}</span>
          <span>{work.year}</span>
        </div>

        {/* Card body: brand-tinted, sized to content (no aspect lock) */}
        <div style={{
          position: "relative",
          background: `linear-gradient(155deg, ${brand}22 0%, var(--bg-2) 70%, var(--bg) 100%)`,
          border: "1px solid var(--line)",
          padding: "22px 24px 26px",
          display: "flex",
          flexDirection: "column",
          gap: 28,
          overflow: "hidden",
          borderRadius: 2,
          transition: "border-color .4s ease, transform .4s ease",
          borderColor: hover ? `${brand}80` : "var(--line)",
        }}>
          {/* Top: brand wordmark + dot */}
          <div style={{
            display: "flex",
            justifyContent: "space-between",
            alignItems: "flex-start",
          }}>
            <div style={{
              fontFamily: "var(--font-display)",
              fontStyle: "italic",
              fontSize: 18,
              color: "var(--fg)",
              opacity: 0.9,
              letterSpacing: "-0.01em",
              lineHeight: 1,
            }}>
              {work.client.split("·")[0].trim()}
            </div>
            <span style={{
              width: 8, height: 8, borderRadius: "50%",
              background: brand,
              boxShadow: `0 0 14px ${brand}80`,
              marginTop: 4,
            }} />
          </div>

          {/* Big metric block */}
          <div>
            <div style={{
              fontFamily: "var(--font-display)",
              fontSize: "clamp(44px, 4.6vw, 72px)",
              lineHeight: 0.9,
              letterSpacing: "-0.035em",
              color: "var(--fg)",
            }}>
              {work.metric}
            </div>
            <div style={{
              marginTop: 10,
              fontFamily: "var(--font-mono)",
              fontSize: 10,
              letterSpacing: "0.22em",
              textTransform: "uppercase",
              color: brand,
              lineHeight: 1.3,
            }}>
              {work.unit}
            </div>
          </div>

          {/* Subtle corner ticks */}
          <CornerTicks color={brand} />
        </div>

        {/* Below card: title + note */}
        <div style={{
          marginTop: 18,
          display: "flex",
          gap: 18,
          alignItems: "flex-start",
        }}>
          <h3 style={{
            fontFamily: "var(--font-display)",
            fontWeight: 400,
            fontSize: "clamp(22px, 2vw, 30px)",
            lineHeight: 1.05,
            letterSpacing: "-0.015em",
            flex: "0 0 auto",
            minWidth: 0,
          }}>
            <span style={{ display: "inline-block", position: "relative" }}>
              {work.title}
              <span style={{
                position: "absolute",
                bottom: 1, left: 0,
                width: hover ? "100%" : "0%",
                height: 1,
                background: brand,
                transition: "width .5s cubic-bezier(.2,.7,.2,1)",
              }} />
            </span>
          </h3>
          <p style={{
            fontSize: 13,
            lineHeight: 1.55,
            color: "var(--fg-dim)",
            margin: 0,
            flex: 1,
            textWrap: "pretty",
          }}>
            {work.note}
          </p>
        </div>
      </div>
    </Reveal>
  );
}

/* ============================================================ CAPABILITIES */
function Capabilities({ motion }) {
  const [openIdx, setOpenIdx] = useState(0);
  const { isMobile } = useViewport();

  return (
    <section id="services" style={{
      padding: isMobile ? "80px 20px 60px" : "160px 40px 120px",
      background: "var(--bg-2)",
      borderTop: "1px solid var(--line)",
      borderBottom: "1px solid var(--line)",
      position: "relative",
    }}>
      <SectionHeader number="03" eyebrow="Capabilities" caption="What I do" motion={motion} />

      <div style={{
        display: "grid",
        gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
        gap: isMobile ? 40 : 80,
        marginTop: 40,
        alignItems: "start",
      }}>
        <Reveal motion={motion}>
          <h2 style={{
            fontFamily: "var(--font-display)",
            fontWeight: 400,
            fontSize: "clamp(48px, 7vw, 110px)",
            lineHeight: 0.95,
            letterSpacing: "-0.03em",
          }}>
            Four <span style={{ fontStyle: "italic", color: "var(--accent)" }}>practices</span>, one studio of one.
          </h2>
          <p style={{
            marginTop: 32,
            maxWidth: 460,
            fontSize: 17,
            lineHeight: 1.55,
            color: "var(--fg-dim)",
            textWrap: "pretty",
          }}>
            Most months I'm running creator campaigns and a press push in parallel. The rest of the time, I'm explaining to founders that "going viral" is not a strategy. It's an outcome that mostly belongs to cats.
          </p>
        </Reveal>

        <div>
          {SERVICES.map((s, i) => (
            <Reveal key={s.n} motion={motion} delay={i * 0.08}>
              <div
                onMouseEnter={() => setOpenIdx(i)}
                data-cursor="hover"
                style={{
                  borderTop: "1px solid var(--line)",
                  borderBottom: i === SERVICES.length - 1 ? "1px solid var(--line)" : "none",
                  padding: "32px 0",
                  cursor: "none",
                  position: "relative",
                }}
              >
                <div style={{
                  display: "flex",
                  alignItems: "baseline",
                  gap: 24,
                }}>
                  <span style={{
                    fontFamily: "var(--font-mono)",
                    fontSize: 12,
                    color: "var(--fg-mute)",
                    minWidth: 30,
                  }}>{s.n}</span>
                  <h3 style={{
                    fontFamily: "var(--font-display)",
                    fontWeight: 400,
                    fontSize: "clamp(28px, 3.4vw, 48px)",
                    letterSpacing: "-0.02em",
                    lineHeight: 1,
                    flex: 1,
                    color: openIdx === i ? "var(--fg)" : "var(--fg-dim)",
                    transition: "color .4s",
                  }}>
                    {openIdx === i && <span style={{ fontStyle: "italic", color: "var(--accent)", marginRight: 12 }}>◇</span>}
                    {s.title}
                  </h3>
                </div>

                <div style={{
                  maxHeight: openIdx === i ? 300 : 0,
                  opacity: openIdx === i ? 1 : 0,
                  overflow: "hidden",
                  transition: "max-height .6s cubic-bezier(.2,.7,.2,1), opacity .5s ease, margin-top .4s",
                  marginTop: openIdx === i ? 20 : 0,
                  paddingLeft: 54,
                }}>
                  <p style={{
                    fontSize: 15,
                    lineHeight: 1.6,
                    color: "var(--fg)",
                    textWrap: "pretty",
                    maxWidth: 480,
                  }}>
                    {s.body}
                  </p>
                  <div style={{
                    marginTop: 18,
                    display: "flex",
                    flexWrap: "wrap",
                    gap: 8,
                  }}>
                    {s.deliverables.map((d) => (
                      <span key={d} style={{
                        fontFamily: "var(--font-mono)",
                        fontSize: 10,
                        letterSpacing: "0.15em",
                        textTransform: "uppercase",
                        padding: "6px 12px",
                        border: "1px solid var(--line)",
                        borderRadius: 999,
                        color: "var(--fg-dim)",
                      }}>
                        {d}
                      </span>
                    ))}
                  </div>
                </div>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ============================================================ ABOUT */
function About({ motion }) {
  const { isMobile } = useViewport();
  return (
    <section id="about" style={{
      padding: isMobile ? "80px 20px 60px" : "160px 40px 120px",
      position: "relative",
    }}>
      <SectionHeader number="04" eyebrow="About" caption="The short version" motion={motion} />

      <div style={{
        display: "grid",
        gridTemplateColumns: isMobile ? "1fr" : "5fr 7fr",
        gap: isMobile ? 40 : 80,
        marginTop: 40,
      }}>
        <Reveal motion={motion}>
          <div style={{ position: "sticky", top: 100 }}>
            <div style={{
              fontFamily: "var(--font-mono)",
              fontSize: 10,
              letterSpacing: "0.3em",
              textTransform: "uppercase",
              color: "var(--accent)",
              marginBottom: 24,
            }}>
              § 04A · Timeline
            </div>

            {[
              {
                year: "Now",
                items: ["Freelance practice", "Founder PR + ongoing retainers"],
              },
              {
                year: "2025",
                items: ["Fashion brands and real estate clients", "Founder PR engagements"],
              },
              {
                year: "2024",
                items: ["Swiggy Valentine's repost (70+ creators in a day)", "Eastern Condiments campaigns"],
              },
              {
                year: "2023",
                items: ["MTR breakfast + masala drops", "Eastern Condiments and early FMCG work"],
              },
              {
                year: "2022",
                items: ["Raised my hand on a creator campaign", "(still a UI/UX person back then)"],
              },
            ].map((row, i, arr) => (
              <div key={row.year} style={{
                display: "grid",
                gridTemplateColumns: "70px 1fr",
                gap: 16,
                padding: "18px 0",
                borderTop: "1px solid var(--line)",
                borderBottom: i === arr.length - 1 ? "1px solid var(--line)" : "none",
              }}>
                <div style={{
                  fontFamily: "var(--font-mono)",
                  fontSize: 11,
                  letterSpacing: "0.2em",
                  textTransform: "uppercase",
                  color: i === 0 ? "var(--accent)" : "var(--fg-dim)",
                  paddingTop: 2,
                }}>
                  {row.year}
                </div>
                <div style={{
                  fontFamily: "var(--font-body)",
                  fontSize: 14,
                  lineHeight: 1.55,
                  color: "var(--fg)",
                }}>
                  {row.items.map((line, j) => (
                    <div key={j} style={{
                      color: j === 0 ? "var(--fg)" : "var(--fg-dim)",
                      fontSize: j === 0 ? 15 : 13,
                      fontStyle: j > 0 && line.startsWith("(") ? "italic" : "normal",
                    }}>
                      {line}
                    </div>
                  ))}
                </div>
              </div>
            ))}

            <div style={{
              marginTop: 18,
              fontFamily: "var(--font-mono)",
              fontSize: 10,
              letterSpacing: "0.2em",
              textTransform: "uppercase",
              color: "var(--fg-mute)",
              display: "flex",
              justifyContent: "space-between",
            }}>
              <span>Plate 04A</span>
              <span><LiveClock /></span>
            </div>
          </div>
        </Reveal>

        <div>
          <Reveal motion={motion} delay={0.1}>
            <p style={{
              fontFamily: "var(--font-display)",
              fontSize: "clamp(28px, 3.4vw, 48px)",
              lineHeight: 1.15,
              letterSpacing: "-0.015em",
              textWrap: "balance",
            }}>
              Honestly, I started as a UI/UX designer. One day a campaign needed someone to find creators for a brand push, I raised my hand, and I haven't really stopped since. Three years later, I run a small practice for brands that want their story
              <span style={{ fontStyle: "italic", color: "var(--accent)" }}> told well</span>, by the right creators, on the right platforms, ideally before Instagram changes its algorithm again next Tuesday.
            </p>
          </Reveal>

          <Reveal motion={motion} delay={0.2}>
            <p style={{
              marginTop: 40,
              fontSize: 17,
              lineHeight: 1.6,
              color: "var(--fg-dim)",
              maxWidth: 620,
              textWrap: "pretty",
            }}>
              The truth is, this job has no fixed hours and no clean deadlines. The press call lands at 8pm because the editor wants the quote "by morning, urgent". The creator goes quiet on Sunday and the WhatsApp follow-ups happen anyway. Reports nobody on the brand side will actually read still have to get written. And every brief that starts with "we want it premium but also young but also viral" has to be turned into something a real creator will post without ghosting me. Bonus points if the founder doesn't WhatsApp at midnight to add one more thing.
            </p>
          </Reveal>

          {/* Stats */}
          <div style={{
            marginTop: isMobile ? 48 : 80,
            display: "grid",
            gridTemplateColumns: isMobile ? "1fr 1fr" : "repeat(4, 1fr)",
            borderTop: "1px solid var(--line)",
            borderBottom: "1px solid var(--line)",
          }}>
            {[
              ["2,000+", "Creators activated at scale"],
              ["300+",   "Onboarded directly by me"],
              ["20+",    "Brand campaigns shipped"],
              ["3+",     "Years doing this"],
            ].map(([n, l], i) => (
              <Reveal key={l} motion={motion} delay={0.2 + i * 0.06}>
                <div style={{
                  padding: isMobile ? "22px 16px" : "32px 24px",
                  borderRight: !isMobile && i < 3 ? "1px solid var(--line)" : (isMobile && i % 2 === 0 ? "1px solid var(--line)" : "none"),
                  borderBottom: isMobile && i < 2 ? "1px solid var(--line)" : "none",
                }}>
                  <div style={{
                    fontFamily: "var(--font-display)",
                    fontSize: 56,
                    lineHeight: 1,
                    letterSpacing: "-0.02em",
                    color: "var(--fg)",
                  }}>
                    {n}
                  </div>
                  <div style={{
                    marginTop: 12,
                    fontFamily: "var(--font-mono)",
                    fontSize: 10,
                    letterSpacing: "0.18em",
                    textTransform: "uppercase",
                    color: "var(--fg-dim)",
                  }}>
                    {l}
                  </div>
                </div>
              </Reveal>
            ))}
          </div>

          {/* Tools / clients strip */}
          <Reveal motion={motion} delay={0.3}>
            <div style={{ marginTop: 48 }}>
              <div style={{
                fontFamily: "var(--font-mono)",
                fontSize: 10,
                letterSpacing: "0.2em",
                textTransform: "uppercase",
                color: "var(--fg-mute)",
                marginBottom: 16,
              }}>
                Tools I've been forced into liking
              </div>
              <div style={{
                display: "flex",
                flexWrap: "wrap",
                gap: 16,
                fontFamily: "var(--font-display)",
                fontStyle: "italic",
                fontSize: 22,
                color: "var(--fg-dim)",
                lineHeight: 1.6,
              }}>
                <span>Instagram</span><span style={{color:"var(--fg-mute)"}}>·</span>
                <span>YouTube</span><span style={{color:"var(--fg-mute)"}}>·</span>
                <span>Twitter</span><span style={{color:"var(--fg-mute)"}}>·</span>
                <span>Notion</span><span style={{color:"var(--fg-mute)"}}>·</span>
                <span>Google Analytics</span><span style={{color:"var(--fg-mute)"}}>·</span>
                <span>ChatGPT</span><span style={{color:"var(--fg-mute)"}}>·</span>
                <span>Claude</span><span style={{color:"var(--fg-mute)"}}>·</span>
                <span>Google Sheets</span>
              </div>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

/* ============================================================ CONTACT */
function Contact({ motion }) {
  const { isMobile } = useViewport();
  return (
    <section id="contact" style={{
      padding: isMobile ? "80px 20px 60px" : "160px 40px 100px",
      borderTop: "1px solid var(--line)",
      position: "relative",
    }}>
      <SectionHeader number="05" eyebrow="Contact" caption="Begin a conversation" motion={motion} />

      <div style={{ marginTop: 40 }}>
        <Reveal motion={motion}>
          <h2 style={{
            fontFamily: "var(--font-display)",
            fontWeight: 400,
            fontSize: "clamp(64px, 13vw, 220px)",
            lineHeight: 0.92,
            letterSpacing: "-0.035em",
            marginBottom: 48,
          }}>
            Have a <span style={{ fontStyle: "italic", color: "var(--accent)" }}>brief</span>?
            <br />
            Let's talk.
          </h2>
        </Reveal>

        <Reveal motion={motion} delay={0.05}>
          <div style={{
            padding: isMobile ? "28px 0 36px" : "40px 0 56px",
            borderTop: "1px solid var(--line)",
            borderBottom: "1px solid var(--line)",
            marginBottom: isMobile ? 40 : 64,
            display: "grid",
            gridTemplateColumns: isMobile ? "1fr" : "1fr auto",
            gap: isMobile ? 24 : 40,
            alignItems: "center",
          }}>
            <div>
              <div style={{
                fontFamily: "var(--font-mono)",
                fontSize: 11,
                letterSpacing: "0.2em",
                textTransform: "uppercase",
                color: "var(--accent)",
                marginBottom: 12,
              }}>§ Pick a slot</div>
              <h3 style={{
                fontFamily: "var(--font-display)",
                fontSize: "clamp(28px, 3.4vw, 44px)",
                lineHeight: 1.1,
                letterSpacing: "-0.015em",
                color: "var(--fg)",
                maxWidth: 620,
              }}>
                Skip the back and forth. Grab a <span style={{ fontStyle: "italic", color: "var(--accent)" }}>15 minutes</span> on my calendar.
              </h3>
              <p style={{
                marginTop: 14,
                fontSize: 14,
                lineHeight: 1.55,
                color: "var(--fg-dim)",
                maxWidth: 520,
              }}>
                Google Meet link arrives in your inbox the moment you book. I get a calendar invite. We talk. No deck required.
              </p>
            </div>
            <a
              href="https://cal.com/abhishek-work/15Min"
              target="_blank"
              rel="noopener noreferrer"
              data-cursor="hover"
              style={{
                display: "inline-flex",
                alignItems: "center",
                gap: 12,
                background: "var(--accent)",
                color: "var(--bg)",
                padding: "20px 36px",
                borderRadius: 999,
                fontFamily: "var(--font-mono)",
                fontSize: 12,
                letterSpacing: "0.22em",
                textTransform: "uppercase",
                fontWeight: 600,
                textDecoration: "none",
                cursor: "none",
                whiteSpace: "nowrap",
              }}
            >
              Book 15 min ↗
            </a>
          </div>
        </Reveal>

        <BookBriefForm motion={motion} />

        <div style={{
          display: "grid",
          gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
          gap: isMobile ? 40 : 60,
          paddingTop: isMobile ? 24 : 40,
          borderTop: "1px solid var(--line)",
        }}>
          <Reveal motion={motion} delay={0.1}>
            <div>
              <div style={{
                fontFamily: "var(--font-mono)",
                fontSize: 10,
                letterSpacing: "0.2em",
                textTransform: "uppercase",
                color: "var(--fg-mute)",
                marginBottom: 14,
              }}>Direct</div>
              <a href="mailto:abhishekuseitforwork@gmail.com" data-cursor="hover" style={{
                fontFamily: "var(--font-display)",
                fontStyle: "italic",
                fontSize: "clamp(28px, 3.6vw, 56px)",
                color: "var(--fg)",
                textDecoration: "none",
                lineHeight: 1.1,
                display: "inline-block",
                borderBottom: "1px solid var(--fg-mute)",
                paddingBottom: 6,
              }}>
                abhishekuseitforwork@gmail.com
              </a>
              <div style={{
                marginTop: 32,
                fontSize: 15,
                lineHeight: 1.6,
                color: "var(--fg-dim)",
                maxWidth: 420,
              }}>
                Send a brief. What you're launching, who it's for, what "viral" means to you (this is a trick question). I write back within two working days, sometimes with too many questions.
              </div>
            </div>
          </Reveal>

          <Reveal motion={motion} delay={0.2}>
            <div style={{
              fontFamily: "var(--font-mono)",
              fontSize: 12,
              letterSpacing: "0.15em",
              textTransform: "uppercase",
              color: "var(--fg-dim)",
              lineHeight: 2.2,
            }}>
              {[
                ["LinkedIn", "/in/abhishek-khandelwal-marketing", "https://linkedin.com/in/abhishek-khandelwal-marketing"],
                ["Phone",    "+91 78984 05490",                   "tel:+917898405490"],
                ["Email",    "abhishekuseitforwork@gmail.com",             "mailto:abhishekuseitforwork@gmail.com"],
                ["Located",  "Gwalior, M.P · remote-first",       "#"],
              ].map(([k, v, href]) => (
                <div key={k} style={{
                  display: "grid",
                  gridTemplateColumns: "120px 1fr",
                  borderBottom: "1px solid var(--line)",
                  padding: "14px 0",
                }}>
                  <span style={{ color: "var(--fg-mute)" }}>{k}</span>
                  <a href={href} data-cursor="hover" style={{ color: "var(--fg)", textDecoration: "none" }}>{v} {href !== '#' ? '↗' : ''}</a>
                </div>
              ))}
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

/* ============================================================ BRIEF FORM */
function BookBriefForm({ motion }) {
  const [name, setName] = useState("");
  const [email, setEmail] = useState("");
  const [project, setProject] = useState("");
  const [timeline, setTimeline] = useState("");
  const [brief, setBrief] = useState("");
  const [sent, setSent] = useState(false);
  const { isMobile } = useViewport();

  const onSubmit = (e) => {
    e.preventDefault();
    const subject = `Brief from ${name || "someone"}: ${project || "a project"}`;
    const body = [
      `Name: ${name}`,
      `Email: ${email}`,
      `Project type: ${project}`,
      `Timeline: ${timeline}`,
      ``,
      `Brief:`,
      brief,
      ``,
      `(sent from abhishek's portfolio)`,
    ].join("\n");
    window.location.href = `mailto:abhishekuseitforwork@gmail.com?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
    setSent(true);
  };

  const label = {
    fontFamily: "var(--font-mono)",
    fontSize: 10,
    letterSpacing: "0.2em",
    textTransform: "uppercase",
    color: "var(--fg-mute)",
    marginBottom: 8,
    display: "block",
  };
  const field = {
    width: "100%",
    background: "transparent",
    border: "none",
    borderBottom: "1px solid var(--line)",
    color: "var(--fg)",
    fontFamily: "var(--font-body)",
    fontSize: 16,
    padding: "10px 0",
    outline: "none",
    cursor: "none",
  };
  const selectField = {
    ...field,
    appearance: "none",
    WebkitAppearance: "none",
    backgroundImage:
      "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%239a948a' d='M0 0h10L5 6z'/></svg>\")",
    backgroundRepeat: "no-repeat",
    backgroundPosition: "right 8px center",
    paddingRight: 24,
  };
  const wrap = { display: "flex", flexDirection: "column" };

  return (
    <Reveal motion={motion} delay={0.05}>
      <form
        onSubmit={onSubmit}
        style={{
          padding: isMobile ? "28px 0 40px" : "40px 0 56px",
          borderTop: "1px solid var(--line)",
          borderBottom: "1px solid var(--line)",
          display: "grid",
          gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
          gap: isMobile ? "24px" : "36px 32px",
          marginBottom: isMobile ? 48 : 80,
        }}
      >
        <div style={{ gridColumn: "1 / -1" }}>
          <div style={{
            fontFamily: "var(--font-mono)",
            fontSize: 11,
            letterSpacing: "0.2em",
            textTransform: "uppercase",
            color: "var(--accent)",
            marginBottom: 8,
          }}>§ Or send a brief</div>
          <p style={{
            fontFamily: "var(--font-display)",
            fontSize: "clamp(22px, 2.4vw, 32px)",
            lineHeight: 1.2,
            color: "var(--fg)",
            maxWidth: 640,
            letterSpacing: "-0.01em",
          }}>
            Rather write it out? Use this and I'll reply within two working days, usually with a calendar link.
          </p>
        </div>

        <div style={wrap}>
          <label htmlFor="bf-name" style={label}>Name (your real one)</label>
          <input id="bf-name" type="text" value={name} onChange={(e) => setName(e.target.value)}
                 required placeholder="Who's asking" style={field} data-cursor="hover" />
        </div>
        <div style={wrap}>
          <label htmlFor="bf-email" style={label}>Email (where I'll reply)</label>
          <input id="bf-email" type="email" value={email} onChange={(e) => setEmail(e.target.value)}
                 required placeholder="you@brand.com" style={field} data-cursor="hover" />
        </div>

        <div style={wrap}>
          <label htmlFor="bf-project" style={label}>What we're getting into</label>
          <select id="bf-project" value={project} onChange={(e) => setProject(e.target.value)}
                  required style={selectField} data-cursor="hover">
            <option value="" disabled style={{ background: "var(--bg)" }}>Pick one</option>
            <option style={{ background: "var(--bg)" }}>Influencer campaign</option>
            <option style={{ background: "var(--bg)" }}>PR / press launch</option>
            <option style={{ background: "var(--bg)" }}>Always-on creator program</option>
            <option style={{ background: "var(--bg)" }}>Fractional / consulting</option>
            <option style={{ background: "var(--bg)" }}>Honestly not sure yet</option>
          </select>
        </div>
        <div style={wrap}>
          <label htmlFor="bf-timeline" style={label}>Timeline</label>
          <select id="bf-timeline" value={timeline} onChange={(e) => setTimeline(e.target.value)}
                  required style={selectField} data-cursor="hover">
            <option value="" disabled style={{ background: "var(--bg)" }}>Pick one</option>
            <option style={{ background: "var(--bg)" }}>This week (good luck to us both)</option>
            <option style={{ background: "var(--bg)" }}>This month</option>
            <option style={{ background: "var(--bg)" }}>Next quarter</option>
            <option style={{ background: "var(--bg)" }}>Just exploring</option>
          </select>
        </div>

        <div style={{ ...wrap, gridColumn: "1 / -1" }}>
          <label htmlFor="bf-brief" style={label}>The brief</label>
          <textarea id="bf-brief" value={brief} onChange={(e) => setBrief(e.target.value)}
                    required rows={5} placeholder="What you're launching, who it's for, and what 'viral' means to you (trick question)."
                    style={{ ...field, resize: "vertical", minHeight: 130, lineHeight: 1.5 }}
                    data-cursor="hover" />
        </div>

        <div style={{
          gridColumn: "1 / -1",
          display: "flex",
          justifyContent: "space-between",
          alignItems: "center",
          flexWrap: "wrap",
          gap: 16,
          marginTop: 8,
        }}>
          <span style={{
            fontFamily: "var(--font-mono)",
            fontSize: 10,
            letterSpacing: "0.18em",
            textTransform: "uppercase",
            color: sent ? "var(--accent)" : "var(--fg-mute)",
            maxWidth: 420,
          }}>
            {sent
              ? "Opened your email client. Hit send and we're talking."
              : "Submit opens your email client. Old school, but it never bounces."}
          </span>
          <button type="submit" data-cursor="hover" style={{
            background: "transparent",
            border: "1px solid var(--fg)",
            color: "var(--fg)",
            padding: "16px 28px",
            borderRadius: 999,
            fontFamily: "var(--font-mono)",
            fontSize: 12,
            letterSpacing: "0.22em",
            textTransform: "uppercase",
            cursor: "none",
            fontWeight: 500,
          }}>
            Send brief ↗
          </button>
        </div>
      </form>
    </Reveal>
  );
}

/* ============================================================ FOOTER */
function Footer() {
  return (
    <footer style={{
      padding: "60px 40px 40px",
      borderTop: "1px solid var(--line)",
      display: "flex",
      justifyContent: "space-between",
      alignItems: "flex-end",
      flexWrap: "wrap",
      gap: 24,
      fontFamily: "var(--font-mono)",
      fontSize: 10,
      letterSpacing: "0.2em",
      textTransform: "uppercase",
      color: "var(--fg-mute)",
    }}>
      <div>
        <div style={{
          fontFamily: "var(--font-display)",
          fontSize: 110,
          fontStyle: "italic",
          letterSpacing: "-0.03em",
          color: "var(--fg)",
          lineHeight: 0.9,
          textTransform: "none",
        }}>
          A.K.
        </div>
        <div style={{ marginTop: 12 }}>
          © 2026 · Abhishek Khandelwal · Independent
        </div>
      </div>
      <div style={{ textAlign: "right", lineHeight: 2 }}>
        <div>Crafted slowly · Gwalior → Anywhere with wifi</div>
        <div style={{ color: "var(--fg-dim)" }}>v1.0 · Last tended {new Date().toLocaleString('en-US', { month: 'short' })} ’26</div>
      </div>
    </footer>
  );
}

/* ============================================================ SECTION HEADER */
function SectionHeader({ number, eyebrow, caption, motion }) {
  return (
    <Reveal motion={motion}>
      <div style={{
        display: "flex",
        alignItems: "baseline",
        gap: 24,
        borderTop: "1px solid var(--line)",
        paddingTop: 24,
        fontFamily: "var(--font-mono)",
        fontSize: 11,
        letterSpacing: "0.2em",
        textTransform: "uppercase",
        color: "var(--fg-dim)",
      }}>
        <span style={{ color: "var(--accent)" }}>§ {number}</span>
        <span style={{ color: "var(--fg)" }}>{eyebrow}</span>
        <span style={{ marginLeft: "auto" }}>{caption}</span>
      </div>
    </Reveal>
  );
}

/* ------------------------------------------------------------- MOUNT */
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
