// variant-forest.jsx — Forest & Lime. Dark green bg with neon lime accent.
// Bold sans-serif headlines (Space Grotesk), modular grid, mono labels.

(function injectForestStyles() {
  if (typeof document === "undefined") return;
  if (document.getElementById("lp-forest-styles")) return;
  const s = document.createElement("style");
  s.id = "lp-forest-styles";
  s.textContent = `
    .lp-forest {
      --bg: #0b1a12;
      --bg-2: #0f2519;
      --surf: #143020;
      --surf-2: #1a3a28;
      --ink: #eaf3ec;
      --ink-2: #b9cebf;
      --muted: #6c8775;
      --line: rgba(234,243,236,.10);
      --line-strong: rgba(234,243,236,.18);
      --accent: #b6ff3d;
      --accent-2: #d0ff77;
      --accent-ink: #0b1a12;
      --rose: #ff8a6b;

      background: var(--bg);
      color: var(--ink);
      font-family: "Geist", system-ui, sans-serif;
      letter-spacing: -0.005em;
      overflow: hidden;
    }
    .lp-forest h1, .lp-forest h2, .lp-forest h3, .lp-forest .lp-sans {
      font-family: "Space Grotesk", "Geist", sans-serif;
      font-weight: 500;
      letter-spacing: -0.025em;
    }
    .lp-forest .lp-mono {
      font-family: "Geist Mono", ui-monospace, monospace;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    /* Nav */
    .lp-forest .nav { display: flex; align-items: center; justify-content: space-between; }
    .lp-forest .nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
    .lp-forest .nav a:hover { color: var(--accent); }
    .lp-forest .nav-links { display: flex; gap: 32px; }

    /* Pill */
    .lp-forest .pill {
      display: inline-flex; align-items: center; gap: 10px;
      padding: 8px 16px; border-radius: 999px;
      font-family: "Geist Mono", monospace; font-size: 12px;
      color: var(--accent); border: 1px solid rgba(182,255,61,.3);
      background: rgba(182,255,61,.06); text-transform: uppercase; letter-spacing: 0.08em;
    }
    .lp-forest .pill .blip {
      width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
      box-shadow: 0 0 0 4px rgba(182,255,61,.18);
    }

    /* Buttons */
    .lp-forest .btn {
      display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
      border-radius: 999px; font-weight: 500; border: none; text-decoration: none;
      transition: transform .15s, background .15s;
    }
    .lp-forest .btn-primary {
      background: var(--accent); color: var(--accent-ink);
    }
    .lp-forest .btn-primary:hover { background: var(--accent-2); }
    .lp-forest .btn-ghost {
      background: rgba(234,243,236,.05); color: var(--ink); border: 1px solid var(--line-strong);
    }
    .lp-forest .btn-ghost:hover { background: rgba(234,243,236,.08); }
    .lp-forest .btn-arrow {
      display: inline-flex; align-items: center; justify-content: center;
      width: 1.6em; height: 1.6em; border-radius: 50%;
      background: var(--accent-ink); color: var(--accent);
    }

    /* Eyebrow */
    .lp-forest .eyebrow {
      font-family: "Geist Mono", monospace; font-size: 12px;
      text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent);
      display: inline-flex; align-items: center; gap: 12px;
    }
    .lp-forest .eyebrow::before {
      content: ""; width: 28px; height: 1px; background: currentColor; opacity: .6;
    }

    /* Card */
    .lp-forest .card {
      background: var(--bg-2); border: 1px solid var(--line);
      border-radius: 22px; padding: 28px; position: relative;
    }
    .lp-forest .card-tag {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 5px 10px; border-radius: 4px;
      font-family: "Geist Mono", monospace; font-size: 11px;
      text-transform: uppercase; letter-spacing: 0.08em;
      background: var(--surf); color: var(--ink-2);
    }

    /* Versus */
    .lp-forest .vs-row { display: grid; align-items: stretch; border-top: 1px solid var(--line); }
    .lp-forest .vs-row:last-child { border-bottom: 1px solid var(--line); }
    .lp-forest .vs-cell { padding: 22px 24px; font-size: 15.5px; color: var(--ink-2); }
    .lp-forest .vs-cell.lbl { color: var(--muted); font-family: "Geist Mono", monospace; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
    .lp-forest .vs-cell.good { color: var(--ink); background: rgba(182,255,61,.05); }
    .lp-forest .vs-cell.good::before {
      content: "→"; color: var(--accent); margin-right: 10px; font-weight: 700;
    }
    .lp-forest .vs-cell.bad::before {
      content: "×"; color: var(--rose); margin-right: 10px; font-weight: 700;
    }

    /* FAQ */
    .lp-forest .faq-item { border-top: 1px solid var(--line); padding: 22px 0; }
    .lp-forest .faq-item:last-child { border-bottom: 1px solid var(--line); }
    .lp-forest .faq-q {
      display: flex; align-items: baseline; gap: 16px;
      font-size: 20px; font-weight: 500; color: var(--ink);
    }
    .lp-forest .faq-q-num { color: var(--accent); font-family: "Geist Mono", monospace; font-size: 12px; }
    .lp-forest .faq-a {
      color: var(--ink-2); margin-top: 10px; line-height: 1.6; font-size: 15px;
      max-width: 64ch; padding-left: 34px;
    }

    /* Mockups */
    .lp-forest .mock {
      background: var(--surf); border-radius: 18px;
      border: 1px solid var(--line-strong);
      overflow: hidden;
    }
    .lp-forest .mock-bar {
      display: flex; align-items: center; gap: 8px;
      padding: 12px 16px; border-bottom: 1px solid var(--line);
      background: var(--bg-2);
    }
    .lp-forest .mock-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }

    /* Grain overlay */
    .lp-forest .grain {
      position: absolute; inset: 0; pointer-events: none; opacity: 0.4;
      mix-blend-mode: overlay;
      background-image: radial-gradient(circle at 0 0, rgba(255,255,255,.04) 1px, transparent 1px);
      background-size: 3px 3px;
    }

    /* DESKTOP */
    .lp-forest--desktop .gutter { padding-left: 72px; padding-right: 72px; }
    .lp-forest--desktop .nav { padding: 26px 72px; }
    .lp-forest--desktop .hero-title { font-size: 132px; line-height: 0.92; }
    .lp-forest--desktop .section-title { font-size: 64px; line-height: 1.0; }
    .lp-forest--desktop .btn { padding: 18px 26px; font-size: 15.5px; }
    .lp-forest--desktop .features-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
    }
    .lp-forest--desktop .vs-row { grid-template-columns: 1.1fr 1.4fr 1.5fr; }

    /* MOBILE */
    .lp-forest--mobile .gutter { padding-left: 22px; padding-right: 22px; }
    .lp-forest--mobile .nav { padding: 18px 22px; }
    .lp-forest--mobile .nav-links { display: none; }
    .lp-forest--mobile .hero-title { font-size: 56px; line-height: 1; }
    .lp-forest--mobile .section-title { font-size: 38px; line-height: 1.05; }
    .lp-forest--mobile .btn { padding: 15px 20px; font-size: 14.5px; }
    .lp-forest--mobile .features-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .lp-forest--mobile .card { padding: 22px; border-radius: 18px; }
    .lp-forest--mobile .vs-row { grid-template-columns: 1fr; padding: 4px 0; }
    .lp-forest--mobile .vs-cell { padding: 8px 4px; font-size: 14px; }
    .lp-forest--mobile .vs-cell.lbl { padding-top: 14px; }
    .lp-forest--mobile .faq-q { font-size: 16.5px; }
    .lp-forest--mobile .faq-a { font-size: 14.5px; padding-left: 0; }
  `;
  document.head.appendChild(s);
})();

// ─── Nav ───
function ForestNav({ mode }) {
  return (
    <div className="nav">
      <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
        <LpLogoGorilla size={mode === "desktop" ? 36 : 30} color="#b6ff3d" />
        <span className="lp-sans" style={{ fontSize: mode === "desktop" ? 17 : 15, color: "var(--ink)", lineHeight: 1.15, letterSpacing: "-0.01em" }}>
          Gorilla Commerce<br/><span style={{ color: "var(--accent)" }}>& Solutions</span>
        </span>
      </div>
      <div className="nav-links">{LP_COPY.nav.map((n) => (<a key={n} href={"#" + n}>{n}</a>))}</div>
      <a className="btn btn-primary" href="#demo" style={{ padding: "10px 18px", fontSize: 13.5 }}>
        Umów demo
        <span className="btn-arrow" style={{ width: "1.5em", height: "1.5em" }}>
          <svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"><path d="M2 5h6M5.5 2l2.5 3-2.5 3" /></svg>
        </span>
      </a>
    </div>
  );
}

// ─── Hero with chaos → order visualization ───
function ForestChaosOrder({ width, height }) {
  // Left: scattered dots (chaos nodes). Right: dots aligned on a single curve.
  let r = 13;
  const rand = () => { r = (r * 9301 + 49297) % 233280; return r / 233280; };
  const chaosDots = [];
  for (let i = 0; i < 28; i++) {
    chaosDots.push({ x: 20 + rand() * (width * 0.4 - 30), y: 20 + rand() * (height - 40), r: 1.5 + rand() * 1.5 });
  }
  // Some connecting lines between chaos dots
  const chaosLines = [];
  for (let i = 0; i < 18; i++) {
    chaosLines.push({ x1: 20 + rand() * (width * 0.4 - 30), y1: 20 + rand() * (height - 40), x2: 20 + rand() * (width * 0.4 - 30), y2: 20 + rand() * (height - 40) });
  }
  // Aligned dots on the right — following a sweeping curve
  const orderDots = [];
  for (let i = 0; i < 18; i++) {
    const t = i / 17;
    const x = width * 0.55 + t * (width * 0.4);
    const y = height * 0.7 - Math.sin(t * Math.PI) * height * 0.35;
    orderDots.push({ x, y });
  }

  const [ref, inView] = useInView({ threshold: 0.2 });

  return (
    <svg ref={ref} width={width} height={height} viewBox={`0 0 ${width} ${height}`} style={{ display: "block", overflow: "visible" }} aria-hidden="true">
      <defs>
        <linearGradient id="forestArc" x1="0" x2="1">
          <stop offset="0" stopColor="#6c8775" stopOpacity="0.5"/>
          <stop offset="0.5" stopColor="#b6ff3d" stopOpacity="0.4"/>
          <stop offset="1" stopColor="#b6ff3d" stopOpacity="1"/>
        </linearGradient>
      </defs>

      {/* chaos region — lines and dots fade in */}
      <g>
        {chaosLines.map((l, i) => (
          <line key={"l" + i} x1={l.x1} y1={l.y1} x2={l.x2} y2={l.y2}
            stroke="#6c8775" strokeOpacity="0.25" strokeWidth="0.8"
            style={{ opacity: inView ? 1 : 0, transition: `opacity .6s ease ${i * 25}ms` }}/>
        ))}
      </g>
      <g>
        {chaosDots.map((c, i) => (
          <circle key={i} cx={c.x} cy={c.y} r={c.r} fill="#6c8775"
            style={{ opacity: inView ? 1 : 0, transition: `opacity .5s ease ${i * 20}ms` }}/>
        ))}
      </g>

      {/* Big transition curve — strokes itself */}
      <DrawPath
        d={`M${width * 0.25} ${height * 0.5} Q ${width * 0.45} ${height * 0.9}, ${width * 0.55} ${height * 0.7} Q ${width * 0.7} ${height * 0.4}, ${width * 0.95} ${height * 0.35}`}
        stroke="url(#forestArc)" strokeWidth={2.5} delay={400} duration={1800}
      />

      {/* Order side dots — pop in after curve passes */}
      <g>
        {orderDots.map((d, i) => (
          <circle key={"o" + i} cx={d.x} cy={d.y} r={3} fill="#b6ff3d"
            style={{
              opacity: inView ? 1 : 0,
              transform: inView ? "scale(1)" : "scale(0)",
              transformOrigin: `${d.x}px ${d.y}px`,
              transition: `opacity .4s ease ${600 + i * 70}ms, transform .5s cubic-bezier(.3,1.4,.5,1) ${600 + i * 70}ms`,
            }}/>
        ))}
      </g>

      {/* Labels */}
      <g style={{ fontFamily: "Geist Mono, monospace", fontSize: 11, textTransform: "uppercase" }}>
        <text x="22" y={height - 10} fill="#6c8775">[ chaos ]</text>
        <text x={width - 22} y={height - 10} fill="#b6ff3d" textAnchor="end">[ system ]</text>
      </g>
    </svg>
  );
}

function ForestHero({ mode }) {
  const cw = mode === "desktop" ? 1296 : 346;
  const ch = mode === "desktop" ? 200 : 120;
  return (
    <section className="section gutter" style={{ paddingTop: mode === "desktop" ? 60 : 32, paddingBottom: mode === "desktop" ? 80 : 56, position: "relative" }}>
      <Reveal as="span" className="pill lp-float" style={{ display: "inline-flex" }}>
        <span className="blip lp-pulse"></span>{LP_COPY.hero.eyebrow}
      </Reveal>
      <Reveal as="h1" className="hero-title" delay={100} style={{ marginTop: mode === "desktop" ? 32 : 22, marginBottom: 0 }}>
        WhatsApp i Excel<br />
        to nie <span style={{ color: "var(--accent)" }}>system</span>.<br />
        To tylko nawyk.
      </Reveal>

      <div style={{
        display: mode === "desktop" ? "grid" : "block",
        gridTemplateColumns: mode === "desktop" ? "1.2fr 1fr" : "1fr",
        gap: 60, alignItems: "end",
        marginTop: mode === "desktop" ? 44 : 28,
      }}>
        <Reveal as="p" delay={300} style={{ fontSize: mode === "desktop" ? 19 : 16, lineHeight: 1.55, color: "var(--ink-2)", maxWidth: "52ch", margin: 0 }}>
          {LP_COPY.hero.sub}
        </Reveal>
        <Reveal delay={500} style={{ display: "flex", gap: 10, flexWrap: "wrap" }}>
          <a className="btn btn-primary" href="#demo">
            {LP_COPY.hero.cta}
            <span className="btn-arrow"><svg width="11" height="11" viewBox="0 0 10 10" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"><path d="M2 5h6M5.5 2l2.5 3-2.5 3" /></svg></span>
          </a>
          <a className="btn btn-ghost" href="#screens">{LP_COPY.hero.cta_alt}</a>
        </Reveal>
      </div>

      <Reveal delay={700} style={{ display: "flex", alignItems: "center", gap: 10, marginTop: 22, color: "var(--muted)", fontSize: 13 }}>
        <span className="lp-mono" style={{ color: "var(--accent)" }}>// </span>
        {LP_COPY.hero.note}
      </Reveal>

      <div style={{ marginTop: mode === "desktop" ? 64 : 40 }}>
        <ForestChaosOrder width={cw} height={ch}/>
      </div>
    </section>
  );
}

// ─── Problem ───
function ForestProblem({ mode }) {
  return (
    <section className="section gutter" style={{ paddingTop: mode === "desktop" ? 80 : 44, paddingBottom: mode === "desktop" ? 100 : 60 }}>
      <Reveal as="span" className="eyebrow">{LP_COPY.problem.eyebrow}</Reveal>
      <Reveal as="h2" delay={100} className="section-title" style={{ marginTop: 20, marginBottom: mode === "desktop" ? 56 : 32, maxWidth: "18ch" }}>
        {LP_COPY.problem.title}
      </Reveal>

      <div style={{
        display: "grid",
        gridTemplateColumns: mode === "desktop" ? "repeat(3, 1fr)" : "1fr",
        gap: mode === "desktop" ? 16 : 12,
      }}>
        {LP_COPY.problem.cards.map((c, i) => (
          <Reveal key={i} direction="up-strong" delay={i * 120} className="card" style={{ display: "flex", flexDirection: "column", gap: 16, minHeight: mode === "desktop" ? 280 : 0 }}>
            <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
              <span className="card-tag">{c.tag}</span>
              <span className="lp-mono" style={{ fontSize: 11, color: "var(--muted)" }}>{String(i + 1).padStart(2, "0")} / 03</span>
            </div>
            <h3 className="lp-sans" style={{ fontSize: mode === "desktop" ? 24 : 20, margin: 0, color: "var(--ink)" }}>
              {c.title}
            </h3>
            <p style={{ color: "var(--ink-2)", fontSize: mode === "desktop" ? 15 : 14.5, lineHeight: 1.55, margin: 0 }}>{c.body}</p>
            {/* decorative line */}
            <svg viewBox="0 0 100 16" style={{ width: "100%", height: 14, marginTop: "auto" }}>
              <path d={i === 0
                ? "M0 8 L20 4 L25 12 L40 6 L55 10 L70 4 L85 11 L100 7"
                : i === 1
                ? "M0 8 L10 8 L10 4 L25 4 L25 12 L50 12 L50 8 L70 8 L70 4 L100 4"
                : "M0 8 L30 8 M40 8 L70 8 M80 8 L100 8"
              } stroke={i === 2 ? "#6c8775" : "#ff8a6b"} strokeWidth="1.2" fill="none" opacity="0.7"/>
            </svg>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

// ─── Features ───
function ForestFeatures({ mode }) {
  return (
    <section id="Funkcje" className="section gutter" style={{ paddingTop: mode === "desktop" ? 100 : 56, paddingBottom: mode === "desktop" ? 100 : 56 }}>
      <Reveal as="span" className="eyebrow">{LP_COPY.features.eyebrow}</Reveal>
      <Reveal as="h2" delay={100} className="section-title" style={{ marginTop: 20, marginBottom: mode === "desktop" ? 56 : 32, maxWidth: "16ch" }}>
        {LP_COPY.features.title}
      </Reveal>

      <div className="features-grid">
        {LP_COPY.features.items.map((f, i) => (
          <Reveal key={f.n} direction="up-strong" delay={(i % 3) * 100 + Math.floor(i / 3) * 60} className="card" style={{ display: "flex", flexDirection: "column", gap: 14, minHeight: mode === "desktop" ? 280 : 0 }}>
            <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
              <span className="lp-mono" style={{ fontSize: 12, color: "var(--accent)" }}>[{f.n}]</span>
              <ForestFeatureIcon n={f.n} />
            </div>
            <h3 className="lp-sans" style={{ fontSize: mode === "desktop" ? 24 : 20, margin: 0, color: "var(--ink)" }}>{f.title}</h3>
            <p style={{ color: "var(--ink-2)", fontSize: mode === "desktop" ? 14.5 : 14, lineHeight: 1.55, margin: 0 }}>{f.body}</p>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

function ForestFeatureIcon({ n }) {
  const common = { width: 28, height: 28, viewBox: "0 0 28 28", fill: "none", stroke: "#b6ff3d", strokeWidth: 1.6, strokeLinecap: "round", strokeLinejoin: "round" };
  switch (n) {
    case "01": return (<svg {...common}><rect x="3" y="6" width="22" height="19" rx="2.5"/><path d="M3 11h22M9 3v5M19 3v5"/><rect x="7" y="14" width="6" height="3" rx="0.5" fill="#b6ff3d" stroke="none"/></svg>);
    case "02": return (<svg {...common}><path d="M14 24a10 10 0 1 0-10-10"/><path d="M4 14l3-3 3 3" /><circle cx="14" cy="14" r="2.5" fill="#b6ff3d" stroke="none"/></svg>);
    case "03": return (<svg {...common}><path d="M6 4h12l4 4v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z"/><path d="M18 4v5h5M9 18l2 2 5-5"/></svg>);
    case "04": return (<svg {...common}><rect x="3" y="7" width="22" height="14" rx="2"/><path d="M3 12h22"/><circle cx="9" cy="17" r="1.4" fill="#b6ff3d" stroke="none"/><path d="M14 17h5"/></svg>);
    case "05": return (<svg {...common}><circle cx="14" cy="14" r="10"/><path d="M4 14h20M14 4a18 18 0 0 1 0 20M14 4a18 18 0 0 0 0 20"/></svg>);
    case "06": default: return (<svg {...common}><path d="M4 22h20"/><path d="M7 18l4-7 4 4 6-10" /><circle cx="21" cy="7" r="1.5" fill="#b6ff3d" stroke="none"/></svg>);
  }
}

// ─── Screens ───
function ForestScreens({ mode }) {
  return (
    <section id="screens" className="section gutter" style={{ paddingTop: mode === "desktop" ? 100 : 60, paddingBottom: mode === "desktop" ? 100 : 60, background: "var(--bg-2)", borderTop: "1px solid var(--line)", borderBottom: "1px solid var(--line)" }}>
      <Reveal as="span" className="eyebrow">{LP_COPY.screens.eyebrow}</Reveal>
      <Reveal as="h2" delay={100} className="section-title" style={{ marginTop: 20, marginBottom: mode === "desktop" ? 56 : 32, maxWidth: "20ch" }}>
        {LP_COPY.screens.title}
      </Reveal>

      {mode === "desktop" ? (
        <div style={{ display: "grid", gridTemplateColumns: "1.5fr 1fr", gap: 20 }}>
          <Reveal direction="scale"><ForestMockDashboard /></Reveal>
          <div style={{ display: "grid", gridTemplateRows: "1fr 1fr", gap: 20 }}>
            <Reveal direction="scale" delay={150}><ForestMockCalendar /></Reveal>
            <Reveal direction="scale" delay={300}><ForestMockContract /></Reveal>
          </div>
        </div>
      ) : (
        <div style={{ display: "grid", gap: 12 }}>
          <Reveal direction="scale"><ForestMockDashboard mobile /></Reveal>
          <Reveal direction="scale" delay={120}><ForestMockCalendar mobile /></Reveal>
          <Reveal direction="scale" delay={240}><ForestMockContract mobile /></Reveal>
        </div>
      )}

      <div style={{
        display: "grid",
        gridTemplateColumns: mode === "desktop" ? "repeat(3, 1fr)" : "1fr",
        gap: mode === "desktop" ? 24 : 18, marginTop: mode === "desktop" ? 40 : 28,
      }}>
        {LP_COPY.screens.items.map((s, i) => (
          <Reveal key={i} delay={i * 120}>
            <span className="lp-mono" style={{ fontSize: 11, color: "var(--accent)" }}>[ {String(i + 1).padStart(2, "0")} ]</span>
            <div className="lp-sans" style={{ fontSize: mode === "desktop" ? 19 : 17, marginTop: 6, color: "var(--ink)" }}>{s.label}</div>
            <p style={{ color: "var(--ink-2)", fontSize: mode === "desktop" ? 14 : 13.5, lineHeight: 1.55, marginTop: 6 }}>{s.caption}</p>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

function ForestMockDashboard({ mobile }) {
  const [chartRef, chartIn] = useInView({ threshold: 0.4 });
  return (
    <div className="mock" style={{ minHeight: mobile ? 260 : 420 }}>
      <div className="mock-bar"><span className="dot"></span><span className="dot"></span><span className="dot"></span>
        <span className="lp-mono" style={{ marginLeft: 12, fontSize: 11, color: "var(--muted)" }}>rentstack.app — dashboard</span>
      </div>
      <div style={{ padding: mobile ? 14 : 22, display: "grid", gap: mobile ? 12 : 16 }}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start" }}>
          <div>
            <span className="lp-mono" style={{ fontSize: 11, color: "var(--muted)" }}>23.05 / wt</span>
            <div className="lp-sans" style={{ fontSize: mobile ? 20 : 28, marginTop: 4 }}>Operacje dziś</div>
          </div>
          <div style={{ display: "flex", gap: 6 }}>
            <span className="card-tag" style={{ background: "rgba(182,255,61,.15)", color: "var(--accent)" }}>● live</span>
            <span className="card-tag">Málaga</span>
          </div>
        </div>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: mobile ? 6 : 10 }}>
          {[
            { l: "Wykorzystanie", v: "87%", a: true },
            { l: "Przychód", v: "€4 218" },
            { l: "Wolne", v: "6" },
            { l: "Konflikty", v: "0", a: true },
          ].map((k) => (
            <div key={k.l} style={{ padding: mobile ? "10px 10px" : "14px 14px", background: "var(--bg)", borderRadius: 10, border: "1px solid var(--line)" }}>
              <div className="lp-mono" style={{ fontSize: 10, color: "var(--muted)" }}>{k.l}</div>
              <div className="lp-sans" style={{ fontSize: mobile ? 17 : 22, marginTop: 4, color: k.a ? "var(--accent)" : "var(--ink)" }}>{k.v}</div>
            </div>
          ))}
        </div>
        {/* Sparkline-style bar chart */}
        <div ref={chartRef} style={{ background: "var(--bg)", border: "1px solid var(--line)", borderRadius: 10, padding: mobile ? 10 : 14 }}>
          <div style={{ display: "flex", justifyContent: "space-between", marginBottom: 10 }}>
            <span className="lp-mono" style={{ fontSize: 10, color: "var(--muted)" }}>wykorzystanie / 14 dni</span>
            <span className="lp-mono" style={{ fontSize: 10, color: "var(--accent)" }}>+12%</span>
          </div>
          <div style={{ display: "flex", alignItems: "flex-end", gap: 4, height: mobile ? 40 : 56 }}>
            {[40, 55, 48, 62, 60, 75, 70, 82, 78, 85, 80, 90, 86, 92].map((h, i) => (
              <div key={i}
                className={chartIn ? "lp-bar lp-bar--in" : "lp-bar"}
                style={{
                  flex: 1, height: `${h}%`,
                  background: i >= 10 ? "var(--accent)" : "rgba(182,255,61,.3)",
                  borderRadius: 1.5,
                  animationDelay: chartIn ? `${i * 50}ms` : undefined,
                  transform: chartIn ? undefined : "scaleY(0)",
                }}/>
            ))}
          </div>
        </div>
        {!mobile && (
          <div style={{ display: "grid", gap: 4 }}>
            {[
              { t: "14:30", c: "VW Polo · 4321-KZA", k: "Sánchez, M.", s: "wyd." },
              { t: "16:45", c: "Fiat 500 · 7702-MFG", k: "Müller, K.", s: "zwr." },
            ].map((r, i) => (
              <div key={i} style={{ display: "grid", gridTemplateColumns: "60px 1fr auto auto", gap: 12, padding: "10px 12px", background: "var(--bg)", borderRadius: 8, alignItems: "center", border: "1px solid var(--line)" }}>
                <span className="lp-mono" style={{ fontSize: 11.5, color: "var(--accent)" }}>{r.t}</span>
                <span style={{ fontSize: 13 }}>{r.c}</span>
                <span style={{ fontSize: 12, color: "var(--muted)" }}>{r.k}</span>
                <span className="lp-mono" style={{ fontSize: 10, color: "var(--ink-2)", padding: "3px 6px", background: "var(--surf)", borderRadius: 3 }}>{r.s}</span>
              </div>
            ))}
          </div>
        )}
      </div>
    </div>
  );
}

function ForestMockCalendar({ mobile }) {
  const cars = ["Polo 4321", "Clio 3389", "Fiat 7702", "BMW 5511"];
  const days = ["pn", "wt", "śr", "cz", "pt", "so", "nd"];
  const bookings = [
    { car: 0, start: 0, len: 3, c: "var(--accent)" },
    { car: 1, start: 1, len: 2, c: "var(--rose)" },
    { car: 1, start: 4, len: 3, c: "var(--accent)" },
    { car: 2, start: 0, len: 5, c: "var(--rose)" },
    { car: 3, start: 2, len: 2, c: "var(--accent)" },
    { car: 3, start: 5, len: 2, c: "#7ad6a5" },
  ];
  const [calRef, calIn] = useInView({ threshold: 0.25 });
  return (
    <div ref={calRef} className="mock">
      <div className="mock-bar"><span className="dot"></span><span className="dot"></span><span className="dot"></span>
        <span className="lp-mono" style={{ marginLeft: 12, fontSize: 11, color: "var(--muted)" }}>kalendarz — tydz. 21</span>
      </div>
      <div style={{ padding: mobile ? 12 : 14 }}>
        <div style={{ display: "grid", gridTemplateColumns: `${mobile ? "62px" : "80px"} repeat(7, 1fr)`, fontFamily: "Geist Mono, monospace", fontSize: 10, color: "var(--muted)", textTransform: "uppercase", gap: 2, marginBottom: 4 }}>
          <span></span>
          {days.map((d, i) => (<span key={i} style={{ textAlign: "center" }}>{d}</span>))}
        </div>
        {cars.map((c, ci) => (
          <div key={ci} style={{ display: "grid", gridTemplateColumns: `${mobile ? "62px" : "80px"} repeat(7, 1fr)`, gap: 2, marginBottom: 3 }}>
            <span className="lp-mono" style={{ fontSize: 10.5, color: "var(--ink-2)", alignSelf: "center" }}>{c}</span>
            {[0,1,2,3,4,5,6].map((d) => {
              const b = bookings.find((b) => b.car === ci && d >= b.start && d < b.start + b.len);
              const animDelay = b ? (ci * 80 + b.start * 50) : 0;
              return (
                <div key={d}
                  className={b && calIn ? "lp-cell lp-cell--in" : undefined}
                  style={{
                    height: mobile ? 18 : 22, borderRadius: 3,
                    background: b ? b.c : "var(--bg)",
                    border: b ? "none" : "1px dashed var(--line)",
                    animationDelay: b && calIn ? `${animDelay}ms` : undefined,
                  }}/>
              );
            })}
          </div>
        ))}
      </div>
    </div>
  );
}

function ForestMockContract({ mobile }) {
  return (
    <div className="mock">
      <div className="mock-bar"><span className="dot"></span><span className="dot"></span><span className="dot"></span>
        <span className="lp-mono" style={{ marginLeft: 12, fontSize: 11, color: "var(--muted)" }}>umowa — pdf</span>
      </div>
      <div style={{ padding: mobile ? 14 : 18 }}>
        <div className="lp-mono" style={{ fontSize: 10, color: "var(--accent)" }}>// 2025/0142</div>
        <div className="lp-sans" style={{ fontSize: mobile ? 17 : 20, marginTop: 4, marginBottom: 12 }}>Umowa najmu</div>
        <div style={{ display: "grid", gap: 6, fontFamily: "Geist Mono, monospace", fontSize: 11.5 }}>
          {[
            ["KLIENT", "Mateusz Sánchez"],
            ["AUTO", "VW Polo · 4321-KZA"],
            ["OD", "23.05 14:30 · MLG"],
            ["DO", "28.05 11:00 · MLG"],
            ["DEPOZYT", "€350 (auth.)"],
          ].slice(0, mobile ? 4 : 5).map(([k, v]) => (
            <div key={k} style={{ display: "grid", gridTemplateColumns: "80px 1fr", color: "var(--ink-2)" }}>
              <span style={{ color: "var(--muted)" }}>{k}</span>
              <span style={{ color: "var(--ink)" }}>{v}</span>
            </div>
          ))}
        </div>
        <div style={{ marginTop: 16, paddingTop: 12, borderTop: "1px dashed var(--line-strong)", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
          <span className="lp-mono" style={{ fontSize: 10, color: "var(--muted)" }}>✦ podpis</span>
          <span className="card-tag" style={{ background: "rgba(182,255,61,.15)", color: "var(--accent)" }}>● signed</span>
        </div>
      </div>
    </div>
  );
}

// ─── Stats ───
function ForestStats({ mode }) {
  return (
    <section className="section gutter" style={{ paddingTop: mode === "desktop" ? 100 : 60, paddingBottom: mode === "desktop" ? 100 : 60 }}>
      <Reveal as="span" className="eyebrow">{LP_COPY.stats.eyebrow}</Reveal>
      <div style={{
        marginTop: mode === "desktop" ? 32 : 22,
        display: "grid",
        gridTemplateColumns: mode === "desktop" ? "repeat(4, 1fr)" : "repeat(2, 1fr)",
        gap: mode === "desktop" ? 0 : 22,
      }}>
        {LP_COPY.stats.items.map((s, i) => (
          <Reveal key={i} delay={i * 120} direction="up-strong" style={{
            padding: mode === "desktop" ? "20px 28px 20px 0" : "8px 0",
            borderLeft: mode === "desktop" && i ? "1px solid var(--line)" : "none",
            paddingLeft: mode === "desktop" && i ? 28 : 0,
          }}>
            <div className="lp-sans" style={{ fontSize: mode === "desktop" ? 88 : 52, lineHeight: 0.95, letterSpacing: "-0.04em", color: "var(--accent)", fontVariantNumeric: "tabular-nums" }}>
              <CountUp value={s.v} duration={1600}/>
            </div>
            <div style={{ marginTop: mode === "desktop" ? 14 : 8, fontSize: mode === "desktop" ? 14 : 12.5, color: "var(--ink-2)", maxWidth: "22ch", lineHeight: 1.4 }}>{s.l}</div>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

// ─── Versus ───
function ForestVersus({ mode }) {
  return (
    <section className="section gutter" style={{ paddingTop: mode === "desktop" ? 100 : 60, paddingBottom: mode === "desktop" ? 100 : 60, background: "var(--bg-2)", borderTop: "1px solid var(--line)", borderBottom: "1px solid var(--line)" }}>
      <Reveal as="span" className="eyebrow">{LP_COPY.versus.eyebrow}</Reveal>
      <Reveal as="h2" delay={100} className="section-title" style={{ marginTop: 20, marginBottom: mode === "desktop" ? 48 : 28, maxWidth: "18ch" }}>
        {LP_COPY.versus.title}
      </Reveal>

      {mode === "desktop" ? (
        <>
          <Reveal as="div" delay={200} className="vs-row" style={{ borderTop: "none" }}>
            <div className="vs-cell lbl" style={{ borderBottom: "1px solid var(--line)" }}></div>
            <div className="vs-cell lbl" style={{ borderBottom: "1px solid var(--line)" }}>Excel + WhatsApp</div>
            <div className="vs-cell lbl" style={{ borderBottom: "1px solid var(--line)", color: "var(--accent)" }}>rentstack</div>
          </Reveal>
          {LP_COPY.versus.rows.map(([k, a, b], i) => (
            <Reveal key={i} delay={250 + i * 70} className="vs-row">
              <div className="vs-cell lbl">{k}</div>
              <div className="vs-cell bad">{a}</div>
              <div className="vs-cell good">{b}</div>
            </Reveal>
          ))}
        </>
      ) : (
        LP_COPY.versus.rows.map(([k, a, b], i) => (
          <div key={i} style={{ borderTop: "1px solid var(--line)", padding: "14px 0" }}>
            <div className="vs-cell lbl">{k}</div>
            <div className="vs-cell bad">{a}</div>
            <div className="vs-cell good">{b}</div>
          </div>
        ))
      )}
    </section>
  );
}

// ─── Integrations ───
function ForestIntegrations({ mode }) {
  return (
    <section id="Integracje" className="section gutter" style={{ paddingTop: mode === "desktop" ? 100 : 60, paddingBottom: mode === "desktop" ? 100 : 60 }}>
      <div style={{
        display: mode === "desktop" ? "grid" : "block",
        gridTemplateColumns: "1fr 1.4fr", gap: 56, alignItems: "center",
      }}>
        <div>
          <Reveal as="span" direction="left" className="eyebrow">{LP_COPY.integrations.eyebrow}</Reveal>
          <Reveal as="h2" direction="left" delay={100} className="section-title" style={{ marginTop: 20, marginBottom: 0, maxWidth: "12ch", fontSize: mode === "desktop" ? 52 : 34 }}>
            {LP_COPY.integrations.title}
          </Reveal>
          <Reveal as="p" direction="left" delay={200} style={{ color: "var(--ink-2)", marginTop: 18, fontSize: mode === "desktop" ? 15.5 : 14.5, lineHeight: 1.55, maxWidth: "42ch" }}>
            Synchronizacja kalendarzy, automatyczne potwierdzenia, faktury i tracking floty — bez przepisywania danych między systemami.
          </Reveal>
        </div>
        <div style={{
          display: "grid",
          gridTemplateColumns: mode === "desktop" ? "repeat(4, 1fr)" : "repeat(2, 1fr)",
          gap: mode === "desktop" ? 10 : 8,
          marginTop: mode === "desktop" ? 0 : 28,
        }}>
          {LP_COPY.integrations.items.map((it, i) => (
            <Reveal key={it} direction="scale" delay={i * 50} style={{
              background: "var(--bg-2)", borderRadius: 12, border: "1px solid var(--line)",
              padding: mode === "desktop" ? "16px 14px" : "12px 10px",
              display: "flex", alignItems: "center", gap: 10,
              fontSize: mode === "desktop" ? 13.5 : 12.5, fontWeight: 500,
              color: "var(--ink)",
            }}>
              <span style={{ width: 6, height: 6, borderRadius: 3, background: "var(--accent)", flexShrink: 0 }}/>
              {it}
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

// ─── FAQ ───
function ForestFaq({ mode }) {
  return (
    <section id="FAQ" className="section gutter" style={{ paddingTop: mode === "desktop" ? 100 : 60, paddingBottom: mode === "desktop" ? 100 : 60, background: "var(--bg-2)", borderTop: "1px solid var(--line)", borderBottom: "1px solid var(--line)" }}>
      <div style={{ display: mode === "desktop" ? "grid" : "block", gridTemplateColumns: "1fr 1.6fr", gap: 56 }}>
        <div>
          <Reveal as="span" direction="left" className="eyebrow">{LP_COPY.faq.eyebrow}</Reveal>
          <Reveal as="h2" direction="left" delay={100} className="section-title" style={{ marginTop: 20, fontSize: mode === "desktop" ? 52 : 34, marginBottom: mode === "desktop" ? 0 : 28 }}>{LP_COPY.faq.title}</Reveal>
        </div>
        <div>
          {LP_COPY.faq.items.map((it, i) => (
            <Reveal key={i} delay={i * 80} className="faq-item">
              <div className="faq-q">
                <span className="faq-q-num">[{String(i + 1).padStart(2, "0")}]</span>
                <span>{it.q}</span>
              </div>
              <div className="faq-a">{it.a}</div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

// ─── Final CTA ───
function ForestCta({ mode }) {
  return (
    <section id="demo" className="section" style={{
      padding: mode === "desktop" ? "120px 72px" : "70px 22px",
      background: "var(--accent)", color: "var(--accent-ink)", position: "relative", overflow: "hidden",
    }}>
      <svg viewBox="0 0 1440 500" preserveAspectRatio="none" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", opacity: 0.18 }}>
        <DrawPath d="M-100 360 C 200 100, 500 440, 800 280 S 1200 140, 1500 280" stroke="#0b1a12" strokeWidth={2} duration={2400}/>
        <DrawPath d="M-100 400 C 200 160, 500 480, 800 320 S 1200 180, 1500 320" stroke="#0b1a12" strokeWidth={1} strokeOpacity={0.7} delay={200} duration={2400}/>
      </svg>

      <div style={{ position: "relative" }}>
        <Reveal as="span" className="lp-mono" style={{ display: "inline-block", fontSize: 12, color: "var(--accent-ink)", opacity: 0.7 }}>// final step</Reveal>
        <Reveal as="h2" delay={100} className="section-title lp-sans" style={{ marginTop: 16, maxWidth: "16ch", fontSize: mode === "desktop" ? 96 : 44, color: "var(--accent-ink)" }}>
          {LP_COPY.finalCta.title}
        </Reveal>
        <Reveal as="p" delay={250} style={{ marginTop: 22, maxWidth: "50ch", fontSize: mode === "desktop" ? 18 : 15.5, color: "rgba(11,26,18,.8)", lineHeight: 1.55 }}>
          {LP_COPY.finalCta.sub}
        </Reveal>

        {/* Contact details */}
        <Reveal delay={350} style={{
          marginTop: mode === "desktop" ? 36 : 28,
          display: "flex", flexWrap: "wrap",
          gap: mode === "desktop" ? 36 : 18,
        }}>
          <a href="mailto:contact@softgorillas.com" style={{
            display: "inline-flex", alignItems: "center", gap: 12,
            color: "var(--accent-ink)", textDecoration: "none",
            fontFamily: "'Space Grotesk', sans-serif",
            fontSize: mode === "desktop" ? 22 : 17, fontWeight: 500,
            letterSpacing: "-0.01em",
          }}>
            <span style={{
              width: mode === "desktop" ? 40 : 34, height: mode === "desktop" ? 40 : 34,
              borderRadius: 999, background: "var(--accent-ink)",
              display: "inline-flex", alignItems: "center", justifyContent: "center",
              color: "var(--accent)", flexShrink: 0,
            }}>
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
                <rect x="3" y="5" width="18" height="14" rx="2"/>
                <path d="M3 7l9 6 9-6"/>
              </svg>
            </span>
            contact@softgorillas.com
          </a>
          <a href="tel:+48789022921" style={{
            display: "inline-flex", alignItems: "center", gap: 12,
            color: "var(--accent-ink)", textDecoration: "none",
            fontFamily: "'Space Grotesk', sans-serif",
            fontSize: mode === "desktop" ? 22 : 17, fontWeight: 500,
            letterSpacing: "-0.01em",
          }}>
            <span style={{
              width: mode === "desktop" ? 40 : 34, height: mode === "desktop" ? 40 : 34,
              borderRadius: 999, background: "var(--accent-ink)",
              display: "inline-flex", alignItems: "center", justifyContent: "center",
              color: "var(--accent)", flexShrink: 0,
            }}>
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
                <path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2z"/>
              </svg>
            </span>
            +48 789 022 921
          </a>
        </Reveal>

        <Reveal delay={500} style={{ display: "flex", gap: 10, flexWrap: "wrap", marginTop: mode === "desktop" ? 40 : 32 }}>
          <a className="btn" href="#demo" style={{ background: "var(--accent-ink)", color: "var(--accent)", padding: mode === "desktop" ? "20px 28px" : "16px 22px", fontSize: mode === "desktop" ? 15.5 : 14.5 }}>
            {LP_COPY.finalCta.cta}
            <span className="btn-arrow" style={{ background: "var(--accent)", color: "var(--accent-ink)" }}>
              <svg width="11" height="11" viewBox="0 0 10 10" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"><path d="M2 5h6M5.5 2l2.5 3-2.5 3" /></svg>
            </span>
          </a>
        </Reveal>
      </div>
    </section>
  );
}

// ─── Footer ───
function ForestFooter({ mode }) {
  return (
    <footer className="section gutter" style={{ paddingTop: mode === "desktop" ? 64 : 40, paddingBottom: mode === "desktop" ? 36 : 24, background: "var(--bg)", color: "var(--ink-2)" }}>
      <div style={{ display: mode === "desktop" ? "grid" : "block", gridTemplateColumns: "1.6fr 1fr 1fr 1fr", gap: 36 }}>
        <div>
          <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
            <LpLogoGorilla size={36} color="#b6ff3d"/>
            <span className="lp-sans" style={{ fontSize: 17, color: "var(--ink)", lineHeight: 1.15, letterSpacing: "-0.01em" }}>
              Gorilla Commerce<br/><span style={{ color: "var(--accent)" }}>& Solutions</span>
            </span>
          </div>
          <p style={{ marginTop: 16, fontSize: 13.5, lineHeight: 1.55, maxWidth: "38ch" }}>{LP_COPY.footer.tagline}</p>
          <p className="lp-mono" style={{ marginTop: 14, fontSize: 11, color: "var(--muted)" }}>contact@softgorillas.com · +48 789 022 921</p>
        </div>
        {LP_COPY.footer.cols.map((c) => (
          <div key={c.title} style={{ marginTop: mode === "desktop" ? 0 : 24 }}>
            <div className="lp-mono" style={{ fontSize: 11, color: "var(--muted)", marginBottom: 12 }}>{c.title}</div>
            {c.items.map((i) => (<div key={i} style={{ marginBottom: 9, fontSize: 13.5, color: "var(--ink-2)" }}>{i}</div>))}
          </div>
        ))}
      </div>
      <div style={{ marginTop: mode === "desktop" ? 44 : 28, paddingTop: 18, borderTop: "1px solid var(--line)", display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5, color: "var(--muted)", fontFamily: "Geist Mono, monospace" }}>
        <span>// © 2026 GORILLA COMMERCE & SOLUTIONS</span>
        <span>MLG · WAW</span>
      </div>
    </footer>
  );
}

function VariantForest({ mode = "desktop" }) {
  return (
    <div className={`lp-root lp-forest lp-forest--${mode}`}>
      <ForestNav mode={mode} />
      <ForestHero mode={mode} />
      <ForestProblem mode={mode} />
      <ForestFeatures mode={mode} />
      <ForestScreens mode={mode} />
      <ForestStats mode={mode} />
      <ForestVersus mode={mode} />
      <ForestIntegrations mode={mode} />
      <ForestFaq mode={mode} />
      <ForestCta mode={mode} />
      <ForestFooter mode={mode} />
    </div>
  );
}

window.VariantForest = VariantForest;
