// Lykta v2 — dark, luminous, glass.
// Inspired by: x.ai (luminous hero object), authkit (liquid glass cards),
// fey.com (precise data grids), linear (ambient washes + crisp type),
// offficestud (editorial scale).

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "heroStyle": "orb",
  "ambientIntensity": 0.85,
  "showNoise": true,
  "cardTilt": true,
  "wordmarkInHero": true
}/*EDITMODE-END*/;

// ─────────────────────────────────────────────────────────────────────
// Luminous lantern — the hero object
// A big stylized lantern rendered via SVG with layered glow.
// Inspired by x.ai's central orb — it's the one luminous object on the page.

const HeroLantern = ({ size = 520, intensity = 0.85 }) => {
  const pulseRef = React.useRef(null);
  return (
    <div className="lk-hero-lantern" style={{ width: size, height: size * 1.2 }}>
      <div className="lk-hero-halo-outer" style={{ opacity: intensity }} />
      <div className="lk-hero-halo-mid" style={{ opacity: intensity }} />
      <div className="lk-hero-halo-core" style={{ opacity: intensity }} />
      <svg className="lk-hero-svg" viewBox="0 0 300 360" xmlns="http://www.w3.org/2000/svg">
        <defs>
          <linearGradient id="lk-body-grad" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0%" stopColor="#8A3BE8" />
            <stop offset="55%" stopColor="#5B1AB8" />
            <stop offset="100%" stopColor="#3A0A85" />
          </linearGradient>
          <linearGradient id="lk-body-shine" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="rgba(255,255,255,0.35)" />
            <stop offset="60%" stopColor="rgba(255,255,255,0.02)" />
            <stop offset="100%" stopColor="rgba(255,255,255,0)" />
          </linearGradient>
          <radialGradient id="lk-glass-grad" cx="50%" cy="50%" r="60%">
            <stop offset="0%" stopColor="#FFF2B0" />
            <stop offset="40%" stopColor="#FFC854" />
            <stop offset="80%" stopColor="#F68020" />
            <stop offset="100%" stopColor="#D65410" />
          </radialGradient>
          <linearGradient id="lk-flame-grad" x1="0.5" y1="0" x2="0.5" y2="1">
            <stop offset="0%" stopColor="#FFEFA0" />
            <stop offset="30%" stopColor="#FFB040" />
            <stop offset="70%" stopColor="#F06414" />
            <stop offset="100%" stopColor="#C03808" />
          </linearGradient>
          <filter id="lk-soft">
            <feGaussianBlur stdDeviation="1.2" />
          </filter>
          <filter id="lk-flame-glow">
            <feGaussianBlur stdDeviation="3" result="b" />
            <feMerge>
              <feMergeNode in="b" />
              <feMergeNode in="SourceGraphic" />
            </feMerge>
          </filter>
        </defs>

        {/* hook */}
        <path d="M150 12 a12 12 0 1 1 -0.01 0" fill="none" stroke="url(#lk-body-grad)" strokeWidth="7" />
        <rect x="146" y="24" width="8" height="14" fill="url(#lk-body-grad)" />
        {/* top cap */}
        <rect x="96" y="38" width="108" height="22" rx="5" fill="url(#lk-body-grad)" />
        <rect x="82" y="60" width="136" height="16" rx="3" fill="url(#lk-body-grad)" />
        {/* body frame outer */}
        <rect x="86" y="76" width="128" height="188" rx="3" fill="url(#lk-body-grad)" />
        {/* body shine overlay */}
        <rect x="86" y="76" width="128" height="188" rx="3" fill="url(#lk-body-shine)" />
        {/* glass window */}
        <rect x="106" y="98" width="88" height="148" rx="2" fill="url(#lk-glass-grad)" />
        {/* glass highlight */}
        <rect x="110" y="102" width="14" height="140" rx="1" fill="rgba(255,255,255,0.35)" />
        {/* flame */}
        <g filter="url(#lk-flame-glow)" className="lk-flame-g">
          <path d="M150 120
                   C 125 150, 122 180, 140 200
                   C 152 214, 150 224, 138 232
                   C 165 232, 182 214, 180 188
                   C 178 166, 168 150, 150 120 Z"
            fill="url(#lk-flame-grad)" />
          <path d="M150 152 C 142 170, 144 188, 154 198 C 162 206, 158 212, 152 216 C 170 214, 174 198, 168 182 C 164 172, 158 162, 150 152 Z"
            fill="rgba(255,245,200,0.75)" filter="url(#lk-soft)" />
        </g>
        {/* base */}
        <rect x="82" y="264" width="136" height="14" rx="3" fill="url(#lk-body-grad)" />
        <path d="M96 278 h108 l-16 40 h-76 z" fill="url(#lk-body-grad)" />
        <rect x="110" y="318" width="80" height="8" rx="2" fill="url(#lk-body-grad)" />
        {/* side struts */}
        <rect x="86" y="76" width="4" height="188" fill="rgba(255,255,255,0.18)" />
        <rect x="210" y="76" width="4" height="188" fill="rgba(0,0,0,0.25)" />
      </svg>
    </div>
  );
};

// ─────────────────────────────────────────────────────────────────────
// NAV
const Nav = () => (
  <nav className="lk-nav">
    <div className="lk-nav-inner">
      <a href="#" className="lk-nav-brand">
        <img src="assets/lykta-wordmark-dark.png" alt="Lykta" className="lk-nav-logo" />
      </a>
      <div className="lk-nav-links">
        <a href="#work">How we work</a>
        <a href="#fit">Who we fit</a>
        <a href="#progress">In progress</a>
        <a href="#faq">FAQ</a>
      </div>
      <a href="#contact" className="lk-nav-cta">
        <span>Let's talk</span>
        <span className="lk-nav-cta-arrow">→</span>
      </a>
    </div>
  </nav>
);

// ─────────────────────────────────────────────────────────────────────
// HERO
const Hero = ({ t }) => {
  const rootRef = React.useRef(null);
  const [mouse, setMouse] = React.useState({ x: 0, y: 0 });

  React.useEffect(() => {
    const el = rootRef.current;
    if (!el) return;
    const handler = (e) => {
      const r = el.getBoundingClientRect();
      setMouse({
        x: (e.clientX - r.left - r.width / 2) / r.width,
        y: (e.clientY - r.top - r.height / 2) / r.height,
      });
    };
    el.addEventListener('mousemove', handler);
    return () => el.removeEventListener('mousemove', handler);
  }, []);

  return (
    <section ref={rootRef} className="lk-hero">
      <div className="lk-hero-bg">
        <div className="lk-hero-aurora lk-aurora-1" style={{ transform: `translate(${mouse.x * 40}px, ${mouse.y * 40}px)` }} />
        <div className="lk-hero-aurora lk-aurora-2" style={{ transform: `translate(${mouse.x * -30}px, ${mouse.y * -30}px)` }} />
        <div className="lk-hero-aurora lk-aurora-3" />
      </div>

      {t.showNoise && <div className="lk-noise" />}

      <div className="lk-hero-grid">
        <div className="lk-hero-content">
          <div className="lk-hero-pill">
            <span className="lk-pill-dot" />
            <span>AI tools & training for residential trades</span>
          </div>

          <h1 className="lk-hero-h1">
            <span className="lk-h1-line">The lantern</span>
            <span className="lk-h1-line lk-h1-muted">for the AI era.</span>
          </h1>

          <p className="lk-hero-sub">
            We build the AI tools your business actually needs — then train your team
            to own them. No SaaS lock-in. No PowerPoints. Just the work.
          </p>

          <div className="lk-hero-cta">
            <a href="#contact" className="lk-btn lk-btn-primary">
              <span>Let's talk</span>
              <span className="lk-btn-arrow">→</span>
            </a>
            <a href="#work" className="lk-btn lk-btn-ghost">
              <span>How we work</span>
            </a>
          </div>

          <div className="lk-hero-trades">
            <span className="lk-mono lk-trades-label">Currently partnering with</span>
            <div className="lk-trades-row">
              {['Solar', 'Basement', 'EV Charging', 'HVAC', 'Electrical'].map((t, i) => (
                <React.Fragment key={t}>
                  {i > 0 && <span className="lk-trade-sep">·</span>}
                  <span className="lk-trade-item">{t}</span>
                </React.Fragment>
              ))}
            </div>
          </div>
        </div>

        <div className="lk-hero-lantern-col">
          <div className="lk-hero-lantern-wrap" style={{
            transform: `translate(${mouse.x * -14}px, ${mouse.y * -10}px)`
          }}>
            <HeroLantern size={420} intensity={t.ambientIntensity} />
          </div>
        </div>
      </div>

      <div className="lk-hero-scroll">
        <span className="lk-mono">Scroll</span>
        <div className="lk-scroll-line" />
      </div>
    </section>
  );
};

// ─────────────────────────────────────────────────────────────────────
// PROBLEM — big editorial moment
const Problem = () => (
  <section className="lk-section lk-problem" data-reveal>
    <div className="lk-container">
      <span className="lk-eyebrow">01 / The problem</span>
      <h2 className="lk-h2">
        <span>Trades businesses are being</span>
        <span className="lk-h2-accent">left behind in the AI era.</span>
        <span className="lk-h2-dim">Not for lack of ambition — for lack of a guide.</span>
      </h2>
      <div className="lk-problem-body">
        <p>
          Most trades businesses know AI matters. They've heard the buzzwords.
          They've seen a competitor save time with ChatGPT. They have a dozen ideas
          for what AI could do for their business.
        </p>
        <p>
          What they don't have is someone who understands both the AI and the
          work. Someone who's actually run a business, not just talked about one.
          Someone who'll <em>build the thing</em>, not just give a PowerPoint.
        </p>
        <p className="lk-problem-pull">That's where Lykta comes in.</p>
      </div>
    </div>
  </section>
);

// ─────────────────────────────────────────────────────────────────────
// WORK — liquid glass cards
const WorkCard = ({ num, title, tag, body, icon, tilt }) => {
  const ref = React.useRef(null);
  const [t2, setT2] = React.useState({ x: 0, y: 0, active: false });

  const onMove = (e) => {
    if (!tilt) return;
    const r = ref.current.getBoundingClientRect();
    const x = (e.clientX - r.left) / r.width - 0.5;
    const y = (e.clientY - r.top) / r.height - 0.5;
    setT2({ x, y, active: true });
  };
  const onLeave = () => setT2({ x: 0, y: 0, active: false });

  return (
    <div
      ref={ref}
      className="lk-work-card"
      onMouseMove={onMove}
      onMouseLeave={onLeave}
      style={{
        transform: t2.active ? `perspective(1200px) rotateY(${t2.x * 5}deg) rotateX(${-t2.y * 5}deg)` : undefined,
      }}
    >
      <div className="lk-work-card-sheen" style={{
        background: t2.active
          ? `radial-gradient(circle at ${(t2.x + 0.5) * 100}% ${(t2.y + 0.5) * 100}%, rgba(255,180,80,0.18), transparent 55%)`
          : 'radial-gradient(circle at 30% 20%, rgba(255,180,80,0.07), transparent 55%)'
      }} />
      <div className="lk-work-card-inner">
        <div className="lk-work-card-top">
          <span className="lk-work-num">{num}</span>
          <div className="lk-work-icon">{icon}</div>
        </div>
        <div className="lk-work-card-title">
          <h3>{title}</h3>
          <span className="lk-work-tag">{tag}</span>
        </div>
        <p>{body}</p>
      </div>
    </div>
  );
};

const Work = ({ t }) => (
  <section id="work" className="lk-section lk-work" data-reveal>
    <div className="lk-container">
      <div className="lk-section-head">
        <span className="lk-eyebrow">02 / How we work</span>
        <h2 className="lk-h2 lk-h2-wide">
          <span>Build.</span> <span>Train.</span> <span className="lk-h2-accent">Guide.</span>
        </h2>
        <p className="lk-section-lede">
          A three-act engagement. You get shipped software, a team that can extend
          it, and a partner who stays in your corner as the landscape shifts.
        </p>
      </div>

      <div className="lk-work-grid">
        <WorkCard
          num="01"
          title="Build"
          tag="First 90 days"
          tilt={t.cardTilt}
          body="We build the first one or two AI-powered tools your business needs most. Plan generators. Equipment allocators. Customer support automations. Custom estimators. We build it properly, deploy it on your infrastructure, and hand it over clean."
          icon={
            <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" strokeWidth="1.5">
              <path d="M3 20 h18 M5 20 V9 l7-5 7 5 v11 M9 20 v-6 h6 v6" />
            </svg>
          }
        />
        <WorkCard
          num="02"
          title="Train"
          tag="Your team takes the keys"
          tilt={t.cardTilt}
          body="Then we teach your team to build the rest. By the time our engagement is over, you have internal people who can extend what we built, spot new opportunities, and actually own your AI future. No permanent dependency. No black box."
          icon={
            <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" strokeWidth="1.5">
              <circle cx="12" cy="8" r="3.5" />
              <path d="M5 20 v-1 a7 7 0 0 1 14 0 v1" />
            </svg>
          }
        />
        <WorkCard
          num="03"
          title="Guide"
          tag="The long arc"
          tilt={t.cardTilt}
          body="As the AI landscape evolves — and it evolves weekly — we stay in your corner. Monthly strategy sessions. Priority access. A sounding board that knows your business. Your fractional AI department, without the overhead."
          icon={
            <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" strokeWidth="1.5">
              <circle cx="12" cy="12" r="9" />
              <path d="M12 3 v3 M12 18 v3 M3 12 h3 M18 12 h3" />
              <circle cx="12" cy="12" r="2" fill="currentColor" stroke="none" />
            </svg>
          }
        />
      </div>

      {/* Principles strip */}
      <div className="lk-principles">
        {[
          { k: 'You own the code', v: 'Deployed on your infra, your accounts, your codebase.' },
          { k: 'No permanent dependency', v: 'Your team can extend it without us.' },
          { k: 'Monthly strategy', v: 'We stay in your corner as the landscape shifts.' },
          { k: 'Scoped per engagement', v: 'Every build is sized to what actually matters.' },
        ].map((p) => (
          <div key={p.k} className="lk-principle">
            <span className="lk-principle-k">{p.k}</span>
            <span className="lk-principle-v">{p.v}</span>
          </div>
        ))}
      </div>
    </div>
  </section>
);

// ─────────────────────────────────────────────────────────────────────
// FIT — revenue badge + trades grid
const Fit = () => {
  const trades = [
    'Solar', 'Basement finishing', 'EV charging',
    'HVAC', 'Electrical', 'Foundations',
    'Decks', 'Additions', 'Remodeling',
  ];
  return (
    <section id="fit" className="lk-section lk-fit" data-reveal>
      <div className="lk-fit-glow" />
      <div className="lk-container">
        <div className="lk-fit-grid">
          <div className="lk-fit-copy">
            <span className="lk-eyebrow">03 / Who we fit</span>
            <h2 className="lk-h2">
              <span>A small number</span>
              <span className="lk-h2-dim">of partners each year.</span>
              <span className="lk-h2-accent">On purpose.</span>
            </h2>
            <p>
              Our ideal partner is a business doing <strong>$5M to $30M</strong> in
              annual revenue, in a vertical where projects are complex enough that
              AI can make a real dent.
            </p>
            <p>
              We're selective by design. We'd rather go deep with a handful of
              companies we genuinely like working with than spread thin across a
              hundred.
            </p>
            <a href="#contact" className="lk-fit-link">
              If that sounds like you, we'd love to talk
              <span className="lk-btn-arrow">→</span>
            </a>
          </div>

          <div className="lk-fit-panel">
            <div className="lk-fit-stat">
              <span className="lk-mono">Revenue sweet spot</span>
              <div className="lk-fit-stat-big">
                <span className="lk-fit-range">$5M</span>
                <span className="lk-fit-dash" />
                <span className="lk-fit-range">$30M</span>
              </div>
              <span className="lk-mono lk-fit-stat-sub">Annual, residential trades</span>
            </div>
            <div className="lk-fit-divider" />
            <div>
              <span className="lk-mono">Verticals we know well</span>
              <div className="lk-fit-trades">
                {trades.map((t) => (
                  <span key={t} className="lk-fit-trade">{t}</span>
                ))}
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
};

// ─────────────────────────────────────────────────────────────────────
// ETYMOLOGY — with glowing lantern
const EtyLantern = () => (
  <div className="lk-ety-lantern">
    <div className="lk-ety-lantern-halo lk-ety-halo-1" />
    <div className="lk-ety-lantern-halo lk-ety-halo-2" />
    <div className="lk-ety-lantern-halo lk-ety-halo-3" />
    <svg className="lk-ety-lantern-svg" viewBox="0 0 300 360" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id="lk-ety-body" x1="0" y1="0" x2="1" y2="1">
          <stop offset="0%" stopColor="#8A3BE8" />
          <stop offset="55%" stopColor="#5B1AB8" />
          <stop offset="100%" stopColor="#3A0A85" />
        </linearGradient>
        <linearGradient id="lk-ety-shine" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stopColor="rgba(255,255,255,0.40)" />
          <stop offset="60%" stopColor="rgba(255,255,255,0.02)" />
          <stop offset="100%" stopColor="rgba(255,255,255,0)" />
        </linearGradient>
        <radialGradient id="lk-ety-glass" cx="50%" cy="50%" r="60%">
          <stop offset="0%" stopColor="#FFF8C8" />
          <stop offset="40%" stopColor="#FFC854" />
          <stop offset="80%" stopColor="#F68020" />
          <stop offset="100%" stopColor="#B8460C" />
        </radialGradient>
        <linearGradient id="lk-ety-flame" x1="0.5" y1="0" x2="0.5" y2="1">
          <stop offset="0%" stopColor="#FFF4B0" />
          <stop offset="30%" stopColor="#FFB040" />
          <stop offset="70%" stopColor="#F06414" />
          <stop offset="100%" stopColor="#C03808" />
        </linearGradient>
        <filter id="lk-ety-soft"><feGaussianBlur stdDeviation="1.2" /></filter>
        <filter id="lk-ety-glow">
          <feGaussianBlur stdDeviation="4" result="b" />
          <feMerge><feMergeNode in="b" /><feMergeNode in="SourceGraphic" /></feMerge>
        </filter>
      </defs>
      <path d="M150 12 a12 12 0 1 1 -0.01 0" fill="none" stroke="url(#lk-ety-body)" strokeWidth="7" />
      <rect x="146" y="24" width="8" height="14" fill="url(#lk-ety-body)" />
      <rect x="96" y="38" width="108" height="22" rx="5" fill="url(#lk-ety-body)" />
      <rect x="82" y="60" width="136" height="16" rx="3" fill="url(#lk-ety-body)" />
      <rect x="86" y="76" width="128" height="188" rx="3" fill="url(#lk-ety-body)" />
      <rect x="86" y="76" width="128" height="188" rx="3" fill="url(#lk-ety-shine)" />
      <rect x="106" y="98" width="88" height="148" rx="2" fill="url(#lk-ety-glass)" />
      <rect x="110" y="102" width="14" height="140" rx="1" fill="rgba(255,255,255,0.40)" />
      <g filter="url(#lk-ety-glow)" className="lk-ety-flame-g">
        <path d="M150 120 C 125 150, 122 180, 140 200 C 152 214, 150 224, 138 232 C 165 232, 182 214, 180 188 C 178 166, 168 150, 150 120 Z" fill="url(#lk-ety-flame)" />
        <path d="M150 152 C 142 170, 144 188, 154 198 C 162 206, 158 212, 152 216 C 170 214, 174 198, 168 182 C 164 172, 158 162, 150 152 Z" fill="rgba(255,248,210,0.82)" filter="url(#lk-ety-soft)" />
      </g>
      <rect x="82" y="264" width="136" height="14" rx="3" fill="url(#lk-ety-body)" />
      <path d="M96 278 h108 l-16 40 h-76 z" fill="url(#lk-ety-body)" />
      <rect x="110" y="318" width="80" height="8" rx="2" fill="url(#lk-ety-body)" />
      <rect x="86" y="76" width="4" height="188" fill="rgba(255,255,255,0.22)" />
      <rect x="210" y="76" width="4" height="188" fill="rgba(0,0,0,0.28)" />
      {/* ember sparks */}
      <g className="lk-ety-embers">
        <circle cx="150" cy="110" r="1.8" fill="#FFD98A" />
        <circle cx="170" cy="95" r="1.2" fill="#FFB060" />
        <circle cx="130" cy="100" r="1.4" fill="#FFC870" />
        <circle cx="160" cy="80" r="1" fill="#FFE0A0" />
      </g>
    </svg>
  </div>
);

const Etymology = () => (
  <section className="lk-section lk-ety" data-reveal>
    <div className="lk-ety-backdrop">
      <div className="lk-ety-ring lk-ety-ring-1" />
      <div className="lk-ety-ring lk-ety-ring-2" />
      <div className="lk-ety-ring lk-ety-ring-3" />
    </div>
    <div className="lk-container lk-ety-container">
      <span className="lk-eyebrow">04 / The name</span>
      <EtyLantern />
      <h2 className="lk-h2 lk-ety-h">
        <em>Lykta</em> is Swedish for
        <span className="lk-h2-accent">"the lantern."</span>
      </h2>
      <p className="lk-ety-p">
        A tool that guides people through dark, unfamiliar terrain. That's what
        we do. The AI landscape is moving fast and it's easy to feel lost in it.
        We bring the light.
      </p>
    </div>
  </section>
);

// ─────────────────────────────────────────────────────────────────────
// PROGRESS — fey-style data panel
const Progress = () => (
  <section id="progress" className="lk-section lk-progress" data-reveal>
    <div className="lk-container">
      <div className="lk-progress-head">
        <span className="lk-eyebrow">05 / In progress</span>
        <h2 className="lk-h2">
          <span>Currently building</span>
          <span className="lk-h2-accent">with.</span>
        </h2>
      </div>

      <div className="lk-progress-card">
        <div className="lk-progress-meta">
          <span className="lk-live">
            <span className="lk-live-dot" />
            <span>Live engagement</span>
          </span>
          <div className="lk-progress-tags">
            <span className="lk-mono-tag">2026</span>
            <span className="lk-mono-tag">Residential solar</span>
            <span className="lk-mono-tag">DIY enablement</span>
          </div>
        </div>

        <div className="lk-progress-body">
          <h3>DIY Solar Provider</h3>
          <p>
            Lykta is currently partnered with a national DIY solar provider to
            build AI tools that streamline plan generation and equipment
            allocation for their customers.
          </p>
        </div>

        <div className="lk-progress-foot">
          <div className="lk-progress-scope">
            <div>
              <span className="lk-mono">Build scope</span>
              <span>Plan generator · Equipment allocator</span>
            </div>
            <div>
              <span className="lk-mono">Status</span>
              <span className="lk-status-active">
                <span className="lk-status-dot" /> Shipping Q2 2026
              </span>
            </div>
            <div>
              <span className="lk-mono">Case study</span>
              <span>Coming soon</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
);

// ─────────────────────────────────────────────────────────────────────
// FAQ
const FAQ = () => {
  const [open, setOpen] = React.useState(0);
  const items = [
    { q: 'Do you build software we have to keep paying for?', a: "No. The tools we build are deployed on your own infrastructure — your hosting, your accounts, your codebase. You own it. We're not a SaaS company; we're a partner." },
    { q: 'What does a typical engagement cost?', a: "Every engagement is scoped individually. Flagship builds are fixed-scope, and ongoing advisory runs on a monthly retainer. We'll walk you through the options after a first conversation — reach out and we'll put real numbers in front of you." },
    { q: 'Do we have to be technical to work with you?', a: "No. But you do need at least one person on your team who's curious about AI and willing to learn. We'll teach them what they need to know." },
    { q: 'How long is a typical engagement?', a: 'Most of our partnerships run 12 to 24 months. Initial tool builds happen in the first 90 days; advisory relationships often continue well beyond that.' },
    { q: "We're outside residential trades. Can you still help?", a: "Maybe. Our sweet spot is trades and trades-adjacent businesses, but we'll occasionally take on work outside that if it's a great fit. Reach out and let's talk." },
  ];
  return (
    <section id="faq" className="lk-section lk-faq" data-reveal>
      <div className="lk-container">
        <div className="lk-faq-grid">
          <div>
            <span className="lk-eyebrow">06 / Common questions</span>
            <h2 className="lk-h2">
              <span>Before</span>
              <span className="lk-h2-accent">you ask.</span>
            </h2>
          </div>
          <div className="lk-faq-list">
            {items.map((f, i) => (
              <div key={i} className={`lk-faq-item ${open === i ? 'open' : ''}`}>
                <button onClick={() => setOpen(open === i ? -1 : i)}>
                  <span className="lk-mono lk-faq-n">0{i + 1}</span>
                  <span className="lk-faq-q">{f.q}</span>
                  <span className="lk-faq-plus">{open === i ? '–' : '+'}</span>
                </button>
                <div className="lk-faq-a-wrap">
                  <div className="lk-faq-a"><p>{f.a}</p></div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
};

// ─────────────────────────────────────────────────────────────────────
// CONTACT — glass form
const Contact = () => {
  const [form, setForm] = React.useState({ name: '', email: '', msg: '', website: '' });
  const [sent, setSent] = React.useState(false);
  const [sending, setSending] = React.useState(false);
  const [error, setError] = React.useState(null);
  const [focus, setFocus] = React.useState(null);

  const submit = async (e) => {
    e.preventDefault();
    if (sending) return;
    setError(null);
    setSending(true);
    try {
      const res = await fetch('/api/contact', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(form),
      });
      const data = await res.json().catch(() => ({}));
      if (!res.ok || !data.ok) {
        throw new Error(data.error || 'send_failed');
      }
      setSent(true);
    } catch (err) {
      setError("Something went wrong sending that. Email us at info@lykta.ai instead and we'll pick it up from there.");
    } finally {
      setSending(false);
    }
  };

  return (
    <section id="contact" className="lk-section lk-contact" data-reveal>
      <div className="lk-contact-bg">
        <div className="lk-contact-aurora" />
      </div>
      <div className="lk-container lk-contact-container">
        <div className="lk-contact-copy">
          <span className="lk-eyebrow">07 / Let's talk</span>
          <h2 className="lk-h2 lk-h2-large">
            <span>Ready to bring AI</span>
            <span>into your business</span>
            <span className="lk-h2-accent">the right way?</span>
          </h2>
          <p>Let's see if we're a fit.</p>
          <a href="mailto:info@lykta.ai" className="lk-contact-email">
            <span className="lk-mono">info@lykta.ai</span>
            <span className="lk-btn-arrow">→</span>
          </a>
        </div>

        <form className="lk-form" onSubmit={submit}>
          {sent ? (
            <div className="lk-form-sent">
              <div className="lk-sent-mark">
                <svg viewBox="0 0 48 48" width="40" height="40">
                  <circle cx="24" cy="24" r="22" fill="none" stroke="#F06414" strokeWidth="1.5" />
                  <path d="M14 24 l7 7 l13 -14" fill="none" stroke="#F06414" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
                </svg>
              </div>
              <h4>Sent it over.</h4>
              <p>We'll be in touch within a couple days.</p>
            </div>
          ) : (
            <>
              <div className={`lk-form-field ${focus === 'name' ? 'focus' : ''}`}>
                <label>
                  <span className="lk-mono">01 / What should we call you?</span>
                  <input
                    value={form.name}
                    onChange={(e) => setForm({ ...form, name: e.target.value })}
                    onFocus={() => setFocus('name')}
                    onBlur={() => setFocus(null)}
                    placeholder="Your name"
                  />
                </label>
              </div>
              <div className={`lk-form-field ${focus === 'email' ? 'focus' : ''}`}>
                <label>
                  <span className="lk-mono">02 / Where can we reach you?</span>
                  <input
                    type="email"
                    value={form.email}
                    onChange={(e) => setForm({ ...form, email: e.target.value })}
                    onFocus={() => setFocus('email')}
                    onBlur={() => setFocus(null)}
                    placeholder="you@company.com"
                  />
                </label>
              </div>
              <div className={`lk-form-field ${focus === 'msg' ? 'focus' : ''}`}>
                <label>
                  <span className="lk-mono">03 / Tell us a bit</span>
                  <textarea
                    rows={4}
                    value={form.msg}
                    onChange={(e) => setForm({ ...form, msg: e.target.value })}
                    onFocus={() => setFocus('msg')}
                    onBlur={() => setFocus(null)}
                    placeholder="A bit about your business and what you're thinking about."
                  />
                </label>
              </div>
              {/* honeypot — real users won't fill this; bots will */}
              <div style={{ position: 'absolute', left: '-9999px', top: 'auto', width: 1, height: 1, overflow: 'hidden' }} aria-hidden="true">
                <label>
                  Website
                  <input
                    type="text"
                    tabIndex={-1}
                    autoComplete="off"
                    value={form.website}
                    onChange={(e) => setForm({ ...form, website: e.target.value })}
                  />
                </label>
              </div>
              {error && <div className="lk-form-error">{error}</div>}
              <button type="submit" className="lk-btn lk-btn-primary lk-form-btn" disabled={sending}>
                <span>{sending ? 'Sending…' : 'Send it over'}</span>
                <span className="lk-btn-arrow">→</span>
              </button>
            </>
          )}
        </form>
      </div>
    </section>
  );
};

// ─────────────────────────────────────────────────────────────────────
// FOOTER
const Footer = () => (
  <footer className="lk-foot">
    <div className="lk-container lk-foot-inner">
      <div className="lk-foot-top">
        <img src="assets/lykta-wordmark-dark.png" alt="Lykta" className="lk-foot-logo" />
        <p className="lk-foot-tag">The lantern for the AI era.</p>
      </div>
      <div className="lk-foot-bottom">
        <div className="lk-foot-links">
          <a href="#">About</a>
          <a href="#contact">Contact</a>
          <a href="#">Privacy</a>
        </div>
        <p className="lk-foot-meta lk-mono">© 2026 Lykta LLC · info@lykta.ai</p>
      </div>
    </div>
  </footer>
);

// ─────────────────────────────────────────────────────────────────────
// APP
const LyktaApp = () => {
  const [t, setTweak] = window.useTweaks(TWEAK_DEFAULTS);

  // Reveal on scroll
  React.useEffect(() => {
    const els = document.querySelectorAll('[data-reveal]');
    const io = new IntersectionObserver((entries) => {
      entries.forEach((e) => {
        if (e.isIntersecting) e.target.setAttribute('data-revealed', 'true');
      });
    }, { threshold: 0.12 });
    els.forEach((el) => io.observe(el));
    return () => io.disconnect();
  }, []);

  return (
    <div className="lk-root">
      <Nav />
      <main>
        <Hero t={t} />
        <Problem />
        <Work t={t} />
        <Fit />
        <Etymology />
        <Progress />
        <FAQ />
        <Contact />
      </main>
      <Footer />

      <window.TweaksPanel title="Tweaks">
        <window.TweakSection label="Hero" />
        <window.TweakSlider
          label="Ambient intensity"
          value={t.ambientIntensity}
          min={0} max={1.2} step={0.05}
          onChange={(v) => setTweak('ambientIntensity', v)}
        />
        <window.TweakToggle
          label="Film grain overlay"
          value={t.showNoise}
          onChange={(v) => setTweak('showNoise', v)}
        />
        <window.TweakSection label="Cards" />
        <window.TweakToggle
          label="3D tilt on hover"
          value={t.cardTilt}
          onChange={(v) => setTweak('cardTilt', v)}
        />
      </window.TweaksPanel>
    </div>
  );
};

window.LyktaApp = LyktaApp;
