// Scrolledge landing page — editorial paper, serif headlines, three CTAs.

const L = {
  primary: "#8B5E34",
  primaryHover: "#6F4828",
  accent: "#D4AF37",
  ink: "#0F1114",
  paper: "#FAF8F4",
  surface: "#FFFFFF",
  subtle: "#F3F0EA",
  sunken: "#EFEBE3",
  border: "#E5E1DA",
  borderStrong: "#D8D2C6",
  divider: "#ECE8E1",
  fg2: "#3F3A33",
  fg3: "#7A6F60",
  fg4: "#A89D8C",
  wash: "#F1E9CB",
  fontDisplay: '"Playfair Display", Georgia, serif',
  fontSerif: '"Source Serif 4", Georgia, serif',
  fontSans: '"Inter", -apple-system, system-ui, sans-serif',
  fontMono: '"JetBrains Mono", ui-monospace, monospace',
};

// ---------- Reusable Email + Button Form ----------
function WaitlistForm({ ctaLabel = "Get early access", dark = false }) {
  const [email, setEmail] = React.useState("");
  const [status, setStatus] = React.useState("idle"); // idle | loading | success | error
  const [errorMsg, setErrorMsg] = React.useState("");

  const handleSubmit = async (e) => {
    e.preventDefault();
    if (!email || !email.includes("@")) return;
    setStatus("loading");
    setErrorMsg("");
    try {
      const res = await fetch("/api/subscribe", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ email }),
      });
      if (!res.ok) {
        const body = await res.json().catch(() => ({}));
        throw new Error(body.error || "Something went wrong");
      }
      setStatus("success");
      setEmail("");
    } catch (err) {
      setErrorMsg(err.message || "Something went wrong. Try again.");
      setStatus("error");
    }
  };

  if (status === "success") {
    return (
      <div
        style={{
          display: "flex",
          alignItems: "center",
          gap: 10,
          padding: "14px 18px",
          background: dark ? "rgba(250,248,244,0.08)" : L.wash,
          border: `1px solid ${dark ? "rgba(250,248,244,0.18)" : "rgba(212,175,55,0.4)"}`,
          borderRadius: 6,
          fontFamily: L.fontSerif,
          fontStyle: "italic",
          fontSize: 15,
          color: dark ? L.paper : L.ink,
          maxWidth: 480,
        }}
      >
        <svg
          width="18"
          height="18"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          strokeWidth="2.2"
          strokeLinecap="round"
          strokeLinejoin="round"
          style={{ flexShrink: 0, color: dark ? L.accent : L.primary }}
        >
          <path d="M5 12l5 5L20 7" />
        </svg>
        You're on the list. We'll be in touch.
      </div>
    );
  }

  const loading = status === "loading";

  return (
    <div style={{ maxWidth: 480, width: "100%" }}>
      <form
        onSubmit={handleSubmit}
        style={{
          display: "flex",
          gap: 8,
          width: "100%",
          flexWrap: "wrap",
        }}
      >
        <input
          type="email"
          value={email}
          onChange={(e) => setEmail(e.target.value)}
          placeholder="you@domain.com"
          disabled={loading}
          style={{
            flex: "1 1 240px",
            fontFamily: L.fontSans,
            fontSize: 15,
            padding: "14px 16px",
            background: dark ? "rgba(250,248,244,0.06)" : L.surface,
            color: dark ? L.paper : L.ink,
            border: `1px solid ${dark ? "rgba(250,248,244,0.25)" : L.border}`,
            borderRadius: 6,
            outline: "none",
            opacity: loading ? 0.6 : 1,
            transition: "border-color 180ms, box-shadow 180ms",
          }}
          onFocus={(e) => {
            e.target.style.borderColor = dark ? L.accent : L.primary;
            e.target.style.boxShadow = `0 0 0 3px ${dark ? "rgba(212,175,55,0.18)" : "rgba(139,94,52,0.12)"}`;
          }}
          onBlur={(e) => {
            e.target.style.borderColor = dark
              ? "rgba(250,248,244,0.25)"
              : L.border;
            e.target.style.boxShadow = "none";
          }}
        />
        <button
          type="submit"
          disabled={loading}
          style={{
            fontFamily: L.fontSans,
            fontWeight: 600,
            fontSize: 15,
            padding: "14px 22px",
            background: dark ? L.accent : L.primary,
            color: dark ? L.ink : L.paper,
            border: `1px solid ${dark ? L.accent : L.primary}`,
            borderRadius: 6,
            cursor: loading ? "default" : "pointer",
            opacity: loading ? 0.7 : 1,
            transition: "background 180ms",
            whiteSpace: "nowrap",
          }}
          onMouseEnter={(e) => {
            if (!loading) {
              e.currentTarget.style.background = dark
                ? "#C49E2A"
                : L.primaryHover;
              e.currentTarget.style.borderColor = dark
                ? "#C49E2A"
                : L.primaryHover;
            }
          }}
          onMouseLeave={(e) => {
            e.currentTarget.style.background = dark ? L.accent : L.primary;
            e.currentTarget.style.borderColor = dark ? L.accent : L.primary;
          }}
        >
          {loading ? "Joining..." : `${ctaLabel} →`}
        </button>
      </form>
      {status === "error" && (
        <div
          style={{
            marginTop: 8,
            fontFamily: L.fontSans,
            fontSize: 13,
            color: dark ? "rgba(250,248,244,0.65)" : "rgba(180,60,40,0.85)",
          }}
        >
          {errorMsg}
        </div>
      )}
    </div>
  );
}

// ---------- Top Nav ----------
function TopNav() {
  return (
    <nav
      style={{
        position: "sticky",
        top: 0,
        zIndex: 50,
        background: "rgba(250,248,244,0.92)",
        borderBottom: `1px solid ${L.border}`,
        backdropFilter: "saturate(140%) blur(8px)",
        WebkitBackdropFilter: "saturate(140%) blur(8px)",
      }}
    >
      <div
        style={{
          maxWidth: 1200,
          margin: "0 auto",
          padding: "16px 32px",
          display: "flex",
          alignItems: "center",
          justifyContent: "space-between",
        }}
      >
        <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
          <div
            style={{
              width: 30,
              height: 30,
              borderRadius: 4,
              background: L.paper,
              border: `1.5px solid ${L.ink}`,
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              fontFamily: L.fontDisplay,
              fontWeight: 700,
              fontSize: 22,
              color: L.ink,
              lineHeight: 1,
            }}
          >
            S
          </div>
          <div
            style={{
              fontFamily: L.fontDisplay,
              fontWeight: 700,
              fontSize: 22,
              color: L.ink,
              letterSpacing: "-0.01em",
            }}
          >
            Scrolledge
          </div>
        </div>
        <div style={{ display: "flex", alignItems: "center", gap: 28 }}>
          <a
            href="#problem"
            className="nav-link"
            style={{
              fontFamily: L.fontSans,
              fontSize: 14,
              fontWeight: 500,
              color: L.fg2,
              textDecoration: "none",
            }}
          >
            The problem
          </a>
          <a
            href="#solution"
            className="nav-link"
            style={{
              fontFamily: L.fontSans,
              fontSize: 14,
              fontWeight: 500,
              color: L.fg2,
              textDecoration: "none",
            }}
          >
            How it works
          </a>
          <a
            href="#waitlist"
            className="nav-cta"
            style={{
              fontFamily: L.fontSans,
              fontSize: 14,
              fontWeight: 600,
              color: L.paper,
              background: L.primary,
              padding: "9px 16px",
              borderRadius: 6,
              textDecoration: "none",
            }}
          >
            Get early access
          </a>
        </div>
      </div>
    </nav>
  );
}

// ---------- Hero ----------
function Hero() {
  return (
    <section style={{ position: "relative", overflow: "hidden" }}>
      <div className="edition-mark">Vol. 01 · No. 042 · Spring ’26</div>
      {/* decorative wash */}
      <div
        aria-hidden
        style={{
          position: "absolute",
          top: -120,
          right: -160,
          width: 560,
          height: 560,
          borderRadius: "50%",
          background:
            "radial-gradient(circle, rgba(212,175,55,0.20) 0%, transparent 65%)",
          pointerEvents: "none",
          zIndex: 0,
        }}
      />
      <div
        aria-hidden
        style={{
          position: "absolute",
          bottom: -200,
          left: -120,
          width: 480,
          height: 480,
          borderRadius: "50%",
          background:
            "radial-gradient(circle, rgba(139,94,52,0.10) 0%, transparent 65%)",
          pointerEvents: "none",
          zIndex: 0,
        }}
      />
      {/* hatched corner ornament top-left */}
      <svg
        aria-hidden
        className="ornament-corner"
        style={{ top: 80, left: 24 }}
        viewBox="0 0 56 56"
      >
        <g stroke="#8B5E34" strokeWidth="1" fill="none" strokeLinecap="round">
          <path d="M2 2h20M2 2v20" />
          <path d="M6 6l8 8M10 6l8 8M6 10l8 8" opacity="0.6" />
        </g>
      </svg>
      <svg
        aria-hidden
        className="ornament-corner"
        style={{ bottom: 80, right: 24, transform: "rotate(180deg)" }}
        viewBox="0 0 56 56"
      >
        <g stroke="#8B5E34" strokeWidth="1" fill="none" strokeLinecap="round">
          <path d="M2 2h20M2 2v20" />
          <path d="M6 6l8 8M10 6l8 8M6 10l8 8" opacity="0.6" />
        </g>
      </svg>

      <div
        className="g-stack"
        style={{
          maxWidth: 1200,
          margin: "0 auto",
          padding: "88px 32px 96px",
          display: "grid",
          gridTemplateColumns: "1.15fr 1fr",
          gap: 64,
          alignItems: "center",
          position: "relative",
          zIndex: 1,
        }}
      >
        <div>
          <div
            style={{
              fontFamily: L.fontSans,
              fontWeight: 600,
              fontSize: 12,
              letterSpacing: "0.14em",
              textTransform: "uppercase",
              color: L.primary,
              marginBottom: 28,
              display: "inline-flex",
              alignItems: "center",
              gap: 10,
              padding: "6px 12px",
              background: L.surface,
              border: `1px solid ${L.border}`,
              borderRadius: 999,
            }}
          >
            <span
              style={{
                width: 6,
                height: 6,
                borderRadius: 999,
                background: L.accent,
                display: "inline-block",
              }}
            />
            Coming soon to iOS
          </div>

          <h1
            style={{
              fontFamily: L.fontDisplay,
              fontWeight: 700,
              fontSize: "clamp(48px, 6.4vw, 84px)",
              lineHeight: 1.02,
              letterSpacing: "-0.02em",
              color: L.ink,
              margin: "0 0 22px",
            }}
          >
            Doomscrolling
            <br />
            <span style={{ position: "relative", display: "inline-block" }}>
              <span
                style={{
                  position: "absolute",
                  inset: "0.55em -0.06em -0.05em -0.04em",
                  background: L.wash,
                  zIndex: -1,
                  transform: "skewY(-1deg)",
                }}
              />
              for builders.
            </span>
          </h1>

          <p
            style={{
              fontFamily: L.fontSerif,
              fontWeight: 400,
              fontSize: 21,
              lineHeight: 1.45,
              color: L.fg2,
              margin: "0 0 36px",
              maxWidth: 540,
              textWrap: "pretty",
            }}
          >
            You're drowning in a million new tools and GitHub repos every day.
            Scrolledge finds the ones that serve what you're building.
          </p>

          <WaitlistForm ctaLabel="Get early access" />
          <div
            style={{
              fontFamily: L.fontSerif,
              fontStyle: "italic",
              fontSize: 14,
              color: L.fg3,
              marginTop: 14,
            }}
          >
            No spam. Just a ping when you're in.
          </div>
        </div>

        <div style={{ position: "relative", minHeight: 620 }}>
          <PhoneStack />
        </div>
      </div>
    </section>
  );
}

// ---------- Phone Stack — animated card swipe ----------
function PhoneStack() {
  const [tick, setTick] = React.useState(0);
  React.useEffect(() => {
    const t = setInterval(() => setTick((x) => x + 1), 3200);
    return () => clearInterval(t);
  }, []);

  // Card rotation: front → back; uses 3 cards
  const slot = (i) => (tick + i) % 3;

  return (
    <div
      className="parallax-soft phone-stack"
      data-speed="0.05"
      style={{
        position: "relative",
        width: "100%",
        height: 640,
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
      }}
    >
      {/* phone bezel */}
      <div
        style={{
          position: "relative",
          width: 320,
          height: 640,
          background: L.ink,
          borderRadius: 44,
          padding: 9,
          boxShadow:
            "0 40px 80px -20px rgba(15,17,20,0.35), 0 16px 40px rgba(15,17,20,0.12)",
        }}
      >
        <div
          style={{
            width: "100%",
            height: "100%",
            background: L.paper,
            borderRadius: 36,
            overflow: "hidden",
            position: "relative",
          }}
        >
          {/* status bar */}
          <div
            style={{
              display: "flex",
              justifyContent: "space-between",
              alignItems: "center",
              padding: "14px 24px 0",
              fontFamily: L.fontSans,
              fontSize: 13,
              fontWeight: 600,
              color: L.ink,
            }}
          >
            <span>9:41</span>
            <span
              style={{ display: "inline-flex", gap: 4, alignItems: "center" }}
            >
              <svg
                width="16"
                height="10"
                viewBox="0 0 16 10"
                fill="currentColor"
              >
                <rect x="0" y="6" width="2" height="4" rx="0.5" />
                <rect x="4" y="4" width="2" height="6" rx="0.5" />
                <rect x="8" y="2" width="2" height="8" rx="0.5" />
                <rect x="12" y="0" width="2" height="10" rx="0.5" />
              </svg>
              <svg
                width="22"
                height="11"
                viewBox="0 0 22 11"
                fill="none"
                stroke="currentColor"
                strokeWidth="1"
              >
                <rect x="0.5" y="0.5" width="18" height="10" rx="2" />
                <rect
                  x="2"
                  y="2"
                  width="14"
                  height="7"
                  rx="1"
                  fill="currentColor"
                />
                <rect
                  x="19.5"
                  y="3"
                  width="1.5"
                  height="5"
                  rx="0.5"
                  fill="currentColor"
                />
              </svg>
            </span>
          </div>
          {/* notch */}
          <div
            style={{
              position: "absolute",
              top: 8,
              left: "50%",
              transform: "translateX(-50%)",
              width: 110,
              height: 32,
              background: L.ink,
              borderRadius: 999,
              zIndex: 10,
            }}
          />

          {/* dynamic feed */}
          <div style={{ padding: "24px 16px 8px" }}>
            <div
              style={{
                fontFamily: L.fontSans,
                fontSize: 10,
                fontWeight: 600,
                letterSpacing: "0.14em",
                textTransform: "uppercase",
                color: L.fg3,
                marginBottom: 4,
              }}
            >
              Discover
            </div>
            <div
              style={{
                fontFamily: L.fontDisplay,
                fontWeight: 700,
                fontSize: 24,
                color: L.ink,
                letterSpacing: "-0.01em",
                lineHeight: 1.05,
              }}
            >
              Agentic workflows
            </div>
            <div
              style={{
                fontFamily: L.fontSans,
                fontSize: 11,
                color: L.fg3,
                marginTop: 2,
              }}
            >
              12 artifacts ranked for you
            </div>
          </div>

          {/* card stack */}
          <div
            style={{
              position: "relative",
              height: 410,
              margin: "0 14px",
            }}
          >
            {[0, 1, 2].map((i) => {
              const s = slot(i);
              const styles = [
                {
                  transform: "translateY(0) scale(1)",
                  opacity: 1,
                  zIndex: 30,
                  filter: "none",
                },
                {
                  transform: "translateY(14px) scale(0.96)",
                  opacity: 0.85,
                  zIndex: 20,
                  filter: "blur(0.4px)",
                },
                {
                  transform: "translateY(28px) scale(0.92)",
                  opacity: 0.6,
                  zIndex: 10,
                  filter: "blur(1px)",
                },
              ];
              return (
                <div
                  key={i}
                  style={{
                    position: "absolute",
                    inset: 0,
                    transition:
                      "transform 600ms cubic-bezier(0.2,0,0,1), opacity 600ms cubic-bezier(0.2,0,0,1), filter 600ms",
                    ...styles[s],
                  }}
                >
                  <MiniCard variant={i} />
                </div>
              );
            })}
          </div>

          {/* tab bar — floating pill chrome matching app screenshots */}
          <div
            style={{
              position: "absolute",
              bottom: 14,
              left: 14,
              right: 14,
              background: L.surface,
              borderRadius: 22,
              border: `1px solid ${L.border}`,
              boxShadow: "0 8px 24px rgba(15,17,20,0.08)",
              padding: "8px 6px 10px",
              display: "flex",
              justifyContent: "space-around",
              alignItems: "center",
            }}
          >
            {[
              {
                l: "Discover",
                active: true,
                render: (color) => (
                  <svg
                    width="22"
                    height="22"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke={color}
                    strokeWidth="1.8"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                  >
                    <rect x="4" y="4" width="16" height="16" rx="3" />
                    <path d="M12 8v8M8 12h8" />
                  </svg>
                ),
              },
              {
                l: "Workstreams",
                render: (color) => (
                  <svg
                    width="22"
                    height="22"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke={color}
                    strokeWidth="1.6"
                    strokeLinejoin="round"
                  >
                    <path
                      d="M12 3l8 4-8 4-8-4z"
                      fill={color}
                      fillOpacity="0.15"
                    />
                    <path d="M4 11l8 4 8-4" />
                    <path d="M4 15l8 4 8-4" />
                  </svg>
                ),
              },
              {
                l: "Saved",
                render: (color) => (
                  <svg
                    width="22"
                    height="22"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke={color}
                    strokeWidth="1.8"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                  >
                    <path d="M6 4h12v17l-6-4-6 4z" />
                  </svg>
                ),
              },
              {
                l: "Profile",
                render: (color) => (
                  <svg
                    width="22"
                    height="22"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke={color}
                    strokeWidth="1.6"
                  >
                    <circle cx="12" cy="12" r="9" />
                    <circle cx="12" cy="10" r="3" />
                    <path d="M5.5 19a7 7 0 0113 0" />
                  </svg>
                ),
              },
            ].map((t) => {
              const color = t.active ? L.ink : L.fg3;
              return (
                <div
                  key={t.l}
                  style={{
                    display: "flex",
                    flexDirection: "column",
                    alignItems: "center",
                    gap: 2,
                    padding: t.active ? "6px 14px 4px" : "6px 8px 4px",
                    background: t.active ? L.subtle : "transparent",
                    borderRadius: 14,
                    color,
                  }}
                >
                  {t.render(color)}
                  <span
                    style={{
                      fontFamily: L.fontSans,
                      fontSize: 9,
                      fontWeight: 600,
                    }}
                  >
                    {t.l}
                  </span>
                </div>
              );
            })}
          </div>
        </div>
      </div>

      {/* swipe arrow callout */}
      <div
        style={{
          position: "absolute",
          right: -10,
          top: 220,
          zIndex: 5,
          display: "flex",
          alignItems: "center",
          gap: 8,
          animation: "swipe-pulse 3.2s ease-in-out infinite",
        }}
      >
        <div
          style={{
            fontFamily: L.fontSerif,
            fontStyle: "italic",
            fontSize: 13,
            color: L.fg3,
            background: L.paper,
            padding: "6px 10px",
            borderRadius: 4,
            border: `1px solid ${L.border}`,
          }}
        >
          swipe →
        </div>
      </div>

      <style>{`
        @keyframes swipe-pulse {
          0%, 70%, 100% { transform: translateX(0); opacity: 1; }
          85% { transform: translateX(-22px); opacity: 0.6; }
        }
      `}</style>
    </div>
  );
}

function MiniCard({ variant }) {
  const cards = [
    {
      type: "REPO",
      name: "browserbase/stagehand",
      match: "92%",
      sub: "The SDK For Browser Agents",
      hook: "AI-powered browser automation framework combining natural language and code",
      why: 'For your goal "Automation": Choose code or natural language for browser actions',
      points: [
        "Choose code or natural language for browser actions",
        "AI actions can be previewed and cached",
      ],
      tags: ["#browser-automation", "#ai", "#web-scraping", "#testing"],
      lang: "TypeScript",
      stars: "22K",
      updated: "updated 3 days ago",
    },
    {
      type: "TOOL",
      name: "Cursor · Background Agents",
      match: "88%",
      sub: "Async coding workflows",
      hook: "Cursor agents now run asynchronously in the background",
      why: 'For your goal "Codegen": Queue long-running tasks without blocking your work',
      points: [
        "Git-aware context per task",
        "Webhook → Slack pings on completion",
      ],
      tags: ["#agents", "#dev-tools", "#ide", "#async"],
      lang: "Product",
      stars: "—",
      updated: "launched 1 week ago",
    },
    {
      type: "CONCEPT",
      name: 'The "workstream" pattern',
      match: "76%",
      sub: "Essay · 8 min read",
      hook: "Why more teams are scoping LLM agents to a single workstream",
      why: 'For your goal "Positioning": Constraining context to one goal sharpens recommendations',
      points: [
        "Goal-scoped beats user-scoped",
        "Reduces prompt sprawl and hallucinations",
      ],
      tags: ["#agents", "#product", "#evals"],
      lang: "Essay",
      stars: "—",
      updated: "published 2 days ago",
    },
  ];
  const c = cards[variant];

  const ActionBtn = ({ filled, children }) => (
    <div
      style={{
        width: 28,
        height: 28,
        borderRadius: 999,
        background: filled ? L.primary : L.subtle,
        border: filled ? `1px solid ${L.primary}` : `1px solid ${L.border}`,
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        color: filled ? L.paper : L.fg2,
      }}
    >
      {children}
    </div>
  );

  return (
    <div
      style={{
        background: L.surface,
        border: `1px solid ${L.border}`,
        borderRadius: 14,
        padding: "12px 14px 12px",
        boxShadow: "0 8px 24px rgba(15,17,20,0.06)",
        height: "100%",
        display: "flex",
        flexDirection: "column",
      }}
    >
      {/* Type pill + match */}
      <div
        style={{
          display: "flex",
          justifyContent: "space-between",
          alignItems: "center",
          marginBottom: 8,
        }}
      >
        <span
          style={{
            fontFamily: L.fontSans,
            fontSize: 9,
            fontWeight: 700,
            letterSpacing: "0.12em",
            background: L.ink,
            color: L.paper,
            padding: "3px 9px",
            borderRadius: 999,
            display: "inline-flex",
            alignItems: "center",
            gap: 5,
          }}
        >
          <span
            style={{
              width: 5,
              height: 5,
              borderRadius: 999,
              background: L.accent,
            }}
          />
          {c.type}
        </span>
        <span
          style={{
            fontFamily: L.fontSans,
            fontSize: 10,
            color: L.fg3,
            display: "inline-flex",
            alignItems: "center",
            gap: 4,
          }}
        >
          <svg
            width="11"
            height="11"
            viewBox="0 0 24 24"
            fill="none"
            stroke={L.primary}
            strokeWidth="2"
            strokeLinejoin="round"
          >
            <path
              d="M12 3l2.5 6L21 10l-5 4.5L17.5 21 12 17.5 6.5 21 8 14.5 3 10l6.5-1z"
              fill={L.primary}
              fillOpacity="0.15"
            />
          </svg>
          {c.match} match
        </span>
      </div>

      {/* Mono subtitle */}
      <div
        style={{
          fontFamily: L.fontMono,
          fontSize: 10,
          color: L.fg3,
          marginBottom: 6,
          letterSpacing: "0.02em",
        }}
      >
        {c.sub}
      </div>

      {/* Serif hook */}
      <h3
        style={{
          fontFamily: L.fontSerif,
          fontWeight: 700,
          fontSize: 15,
          lineHeight: 1.18,
          color: L.ink,
          margin: "0 0 8px",
          letterSpacing: "-0.005em",
        }}
      >
        {c.hook}
      </h3>

      {/* Summary line */}
      <div
        style={{
          fontFamily: L.fontSans,
          fontSize: 10,
          color: L.fg2,
          lineHeight: 1.45,
          marginBottom: 8,
        }}
      >
        {c.name} — distilled signal for your active workstream.
      </div>

      {/* Why it matters */}
      <div
        style={{
          background: L.wash,
          padding: "7px 9px",
          borderRadius: 4,
          marginBottom: 8,
        }}
      >
        <div
          style={{
            fontFamily: L.fontSans,
            fontSize: 8,
            fontWeight: 700,
            letterSpacing: "0.12em",
            color: "#7A5A10",
            marginBottom: 2,
            display: "inline-flex",
            alignItems: "center",
            gap: 3,
          }}
        >
          <span style={{ color: L.accent }}>✦</span> WHY IT MATTERS FOR YOU
        </div>
        <div
          style={{
            fontFamily: L.fontSerif,
            fontStyle: "italic",
            fontSize: 10,
            color: L.ink,
            lineHeight: 1.35,
          }}
        >
          {c.why}
        </div>
      </div>

      {/* Bullets */}
      <div
        style={{
          display: "flex",
          flexDirection: "column",
          gap: 3,
          marginBottom: 8,
        }}
      >
        {c.points.map((p, i) => (
          <div
            key={i}
            style={{
              display: "flex",
              gap: 6,
              fontFamily: L.fontSans,
              fontSize: 9.5,
              color: L.fg2,
              lineHeight: 1.35,
            }}
          >
            <span style={{ color: L.fg4, marginTop: 4, flexShrink: 0 }}>▪</span>
            <span>{p}</span>
          </div>
        ))}
      </div>

      {/* Meta row */}
      <div
        style={{
          display: "flex",
          alignItems: "center",
          gap: 6,
          fontFamily: L.fontSans,
          fontSize: 9,
          color: L.fg3,
          paddingTop: 6,
          paddingBottom: 6,
          borderTop: `1px solid ${L.divider}`,
          marginBottom: 6,
        }}
      >
        <svg width="9" height="9" viewBox="0 0 24 24" fill="currentColor">
          <path d="M12 2l3 7h7l-5.5 4 2 7L12 16l-6.5 4 2-7L2 9h7z" />
        </svg>
        <span>{c.stars}</span>
        <span>·</span>
        <span>{c.lang}</span>
        <span>·</span>
        <span style={{ fontStyle: "italic" }}>{c.updated}</span>
      </div>

      {/* Tag chips */}
      <div
        style={{ display: "flex", gap: 3, flexWrap: "wrap", marginBottom: 10 }}
      >
        {c.tags.map((t) => (
          <span
            key={t}
            style={{
              fontFamily: L.fontMono,
              fontSize: 9,
              color: L.fg2,
              background: L.subtle,
              padding: "2px 6px",
              borderRadius: 999,
            }}
          >
            {t}
          </span>
        ))}
      </div>

      {/* Action row — 4 circles + external on right */}
      <div
        style={{
          marginTop: "auto",
          display: "flex",
          gap: 5,
          alignItems: "center",
        }}
      >
        <ActionBtn filled>
          <svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor">
            <path d="M6 4h12v17l-6-4-6 4z" />
          </svg>
        </ActionBtn>
        <ActionBtn>
          <svg
            width="12"
            height="12"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            strokeWidth="2"
          >
            <rect x="5" y="4" width="14" height="16" rx="1" />
            <path d="M8 8h8M8 12h8M8 16h5" />
          </svg>
        </ActionBtn>
        <ActionBtn>
          <svg
            width="12"
            height="12"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            strokeWidth="2"
            strokeLinecap="round"
          >
            <circle cx="11" cy="11" r="6.5" />
            <path d="m20 20-4.2-4.2" />
          </svg>
        </ActionBtn>
        <ActionBtn>
          <svg
            width="12"
            height="12"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            strokeWidth="2"
            strokeLinecap="round"
          >
            <path d="M6 6l12 12M18 6L6 18" />
          </svg>
        </ActionBtn>
        <div style={{ flex: 1 }} />
        <div
          style={{
            width: 28,
            height: 28,
            borderRadius: 999,
            background: L.subtle,
            border: `1px solid ${L.border}`,
            display: "flex",
            alignItems: "center",
            justifyContent: "center",
            color: L.primary,
          }}
        >
          <svg
            width="12"
            height="12"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            strokeWidth="2.2"
            strokeLinecap="round"
            strokeLinejoin="round"
          >
            <path d="M7 17L17 7M9 7h8v8" />
          </svg>
        </div>
      </div>
    </div>
  );
}

// ---------- Problem Section ----------
function Problem() {
  const lines = [
    {
      stat: "23 min",
      label: "Average HackerNews session, builders 25–40",
      text: "You open HackerNews every morning and close it 20 minutes later having learned nothing useful.",
    },
    {
      stat: "5 weeks",
      label: "Median lag between launch and discovery",
      text: "The tool that would've saved you three weeks shipped last month. You never saw it.",
    },
    {
      stat: "Daily",
      label: "Cadence of meaningful releases in your space",
      text: "The ecosystem moves daily. You're catching up weekly.",
    },
  ];
  return (
    <section
      id="problem"
      style={{
        background: L.ink,
        padding: "110px 32px",
        position: "relative",
        overflow: "hidden",
      }}
    >
      <div
        className="tx-hatch-dark"
        aria-hidden
        style={{
          position: "absolute",
          inset: 0,
          pointerEvents: "none",
          opacity: 0.6,
        }}
      />
      <div className="edition-mark dark">§ 02 — Status Quo</div>
      <div className="ruler-ticks dark" style={{ left: 24 }} />
      <div
        aria-hidden
        style={{
          position: "absolute",
          top: "20%",
          left: "-10%",
          width: 520,
          height: 520,
          borderRadius: "50%",
          background:
            "radial-gradient(circle, rgba(212,175,55,0.10) 0%, transparent 65%)",
        }}
      />

      <div style={{ maxWidth: 1100, margin: "0 auto", position: "relative" }}>
        <div
          style={{
            fontFamily: L.fontSans,
            fontWeight: 600,
            fontSize: 12,
            letterSpacing: "0.18em",
            textTransform: "uppercase",
            color: L.accent,
            marginBottom: 18,
          }}
        ></div>
        <h2
          style={{
            fontFamily: L.fontDisplay,
            fontWeight: 700,
            fontSize: "clamp(36px, 4.4vw, 52px)",
            lineHeight: 1.1,
            letterSpacing: "-0.02em",
            color: L.paper,
            margin: "0 0 56px",
            maxWidth: 760,
            textWrap: "balance",
          }}
        >
          Three quiet failures, every morning.
        </h2>

        {lines.map((row, i) => (
          <div
            key={i}
            className="g-stack"
            style={{
              display: "grid",
              gridTemplateColumns: "200px 1fr",
              gap: 56,
              paddingTop: i === 0 ? 0 : 36,
              paddingBottom: 36,
              borderBottom:
                i < lines.length - 1
                  ? `1px solid rgba(250,248,244,0.10)`
                  : "none",
              alignItems: "baseline",
            }}
          >
            {/* stat column */}
            <div>
              <div
                style={{
                  fontFamily: L.fontSans,
                  fontSize: 12,
                  fontWeight: 600,
                  letterSpacing: "0.14em",
                  textTransform: "uppercase",
                  color: L.accent,
                  marginBottom: 10,
                }}
              ></div>
              <div
                style={{
                  fontFamily: L.fontDisplay,
                  fontWeight: 700,
                  fontSize: 44,
                  color: L.accent,
                  lineHeight: 1,
                  letterSpacing: "-0.02em",
                  marginBottom: 8,
                }}
              >
                {row.stat}
              </div>
              <div
                style={{
                  fontFamily: L.fontMono,
                  fontSize: 10,
                  color: "rgba(250,248,244,0.45)",
                  lineHeight: 1.4,
                  letterSpacing: "0.02em",
                }}
              >
                {row.label}
              </div>
            </div>

            {/* main quote */}
            <p
              style={{
                fontFamily: L.fontSerif,
                fontWeight: 400,
                fontSize: "clamp(22px, 2.4vw, 30px)",
                lineHeight: 1.3,
                color: L.paper,
                margin: 0,
                textWrap: "pretty",
              }}
            >
              {row.text}
            </p>
          </div>
        ))}
      </div>
    </section>
  );
}

// ---------- Agitation ----------
function Agitation() {
  return (
    <section
      style={{
        padding: "120px 32px 100px",
        background: L.paper,
        position: "relative",
        overflow: "hidden",
      }}
    >
      <div className="edition-mark">§ 03 — The Diagnosis</div>
      {/* hatched horizontal rule above title */}
      <div
        className="rule-hatch"
        style={{
          position: "absolute",
          top: 70,
          left: "50%",
          transform: "translateX(-50%)",
          width: 120,
        }}
      />
      <div style={{ maxWidth: 920, margin: "0 auto", textAlign: "center" }}>
        <h2
          style={{
            fontFamily: L.fontDisplay,
            fontWeight: 700,
            fontSize: "clamp(36px, 4.6vw, 56px)",
            lineHeight: 1.12,
            letterSpacing: "-0.015em",
            color: L.ink,
            margin: "0 0 40px",
            textWrap: "balance",
          }}
        >
          You're not behind because you're not trying. You're behind because the
          feed wasn't built for you.
        </h2>

        <div
          className="g-stack-2"
          style={{
            display: "grid",
            gridTemplateColumns: "repeat(4, 1fr)",
            gap: 0,
            margin: "60px 0",
            borderTop: `1px solid ${L.border}`,
            borderBottom: `1px solid ${L.border}`,
          }}
        >
          {[
            { source: "HackerNews", flaw: "is for everyone." },
            { source: "GitHub Trending", flaw: "is chronological." },
            { source: "Newsletters", flaw: "are late." },
            {
              source: "Search",
              flaw: "only works if you know what to look for.",
            },
          ].map((x, i) => (
            <div
              key={x.source}
              style={{
                padding: "32px 24px",
                borderRight: i < 3 ? `1px solid ${L.border}` : "none",
                textAlign: "left",
              }}
            >
              <div
                style={{
                  fontFamily: L.fontDisplay,
                  fontWeight: 700,
                  fontSize: 26,
                  color: L.ink,
                  marginBottom: 8,
                  letterSpacing: "-0.01em",
                }}
              >
                {x.source}
              </div>
              <div
                style={{
                  fontFamily: L.fontSerif,
                  fontStyle: "italic",
                  fontSize: 15,
                  color: L.fg2,
                  lineHeight: 1.4,
                }}
              >
                {x.flaw}
              </div>
            </div>
          ))}
        </div>

        <p
          style={{
            fontFamily: L.fontSerif,
            fontSize: 22,
            lineHeight: 1.5,
            color: L.fg2,
            margin: "0 0 14px",
            textWrap: "pretty",
          }}
        >
          The signal layer for builders doesn't exist.
        </p>
        <p
          style={{
            fontFamily: L.fontDisplay,
            fontStyle: "italic",
            fontWeight: 500,
            fontSize: 36,
            color: L.ink,
            margin: 0,
            letterSpacing: "-0.01em",
          }}
        >
          Until now.
        </p>
      </div>
    </section>
  );
}

// ---------- Solution ----------
function Solution() {
  return (
    <section
      id="solution"
      style={{
        padding: "110px 32px",
        background: L.subtle,
        position: "relative",
        overflow: "hidden",
      }}
    >
      <div
        className="tx-crosshatch"
        aria-hidden
        style={{
          position: "absolute",
          inset: 0,
          pointerEvents: "none",
          opacity: 0.55,
        }}
      />
      <div className="edition-mark">§ 04 — The Remedy</div>
      <div className="stamp-seal" style={{ top: 60, right: 80 }}>
        <span className="stamp-seal-text">
          Private
          <br />
          Beta
          <br />— ’26
        </span>
      </div>
      <div
        aria-hidden
        style={{
          position: "absolute",
          top: "20%",
          right: "-10%",
          width: 480,
          height: 480,
          borderRadius: "50%",
          background:
            "radial-gradient(circle, rgba(212,175,55,0.18) 0%, transparent 65%)",
          pointerEvents: "none",
        }}
      />

      <div
        className="g-stack"
        style={{
          maxWidth: 1200,
          margin: "0 auto",
          position: "relative",
          display: "grid",
          gridTemplateColumns: "1fr 1fr",
          gap: 80,
          alignItems: "center",
        }}
      >
        <div>
          <div
            style={{
              fontFamily: L.fontSans,
              fontWeight: 600,
              fontSize: 12,
              letterSpacing: "0.16em",
              textTransform: "uppercase",
              color: L.primary,
              marginBottom: 16,
            }}
          >
            The signal layer
          </div>
          <div
            style={{
              fontFamily: L.fontDisplay,
              fontWeight: 700,
              fontSize: "clamp(56px, 7vw, 96px)",
              lineHeight: 1,
              letterSpacing: "-0.025em",
              color: L.ink,
              marginBottom: 28,
            }}
          >
            Scrolledge.
          </div>
          <p
            style={{
              fontFamily: L.fontSerif,
              fontSize: 20,
              lineHeight: 1.55,
              color: L.fg2,
              margin: "0 0 36px",
              maxWidth: 520,
              textWrap: "pretty",
            }}
          >
            Swipe through what matters — repos, tools, launches, articles —
            distilled into one card, personalized to exactly what you're
            building. <br />
            Save something and the feed gets smarter.{" "}
            <span
              style={{
                background: L.wash,
                padding: "0 4px",
                fontStyle: "italic",
                color: L.ink,
              }}
            >
              No setup. No configuration. Just signal.
            </span>
          </p>

          <div
            className="g-stack"
            style={{
              display: "grid",
              gridTemplateColumns: "repeat(3, 1fr)",
              gap: 16,
              margin: "0 0 40px",
            }}
          >
            {[
              {
                n: "01",
                t: "One card at a time",
                d: "One swipe, one high-signal artifact.",
              },
              {
                n: "02",
                t: "Tied to your goal",
                d: "Workstreams for any project.",
              },
              {
                n: "03",
                t: "Saves teach it",
                d: "Bookmark anything; the rank shifts.",
              },
            ].map((f) => (
              <div
                key={f.n}
                style={{
                  paddingTop: 14,
                  borderTop: `1px solid ${L.borderStrong}`,
                }}
              >
                <div
                  style={{
                    fontFamily: L.fontMono,
                    fontSize: 11,
                    color: L.fg3,
                    marginBottom: 6,
                  }}
                >
                  {f.n}
                </div>
                <div
                  style={{
                    fontFamily: L.fontSerif,
                    fontWeight: 600,
                    fontSize: 15,
                    color: L.ink,
                    marginBottom: 4,
                  }}
                >
                  {f.t}
                </div>
                <div
                  style={{
                    fontFamily: L.fontSans,
                    fontSize: 13,
                    color: L.fg3,
                    lineHeight: 1.45,
                  }}
                >
                  {f.d}
                </div>
              </div>
            ))}
          </div>

          <div id="midwait">
            <WaitlistForm ctaLabel="Join the waitlist" />
            <div
              style={{
                fontFamily: L.fontSerif,
                fontStyle: "italic",
                fontSize: 14,
                color: L.fg3,
                marginTop: 14,
              }}
            >
              Early access is limited. Be first.
            </div>
          </div>
        </div>

        <div
          style={{
            position: "relative",
            height: 640,
            display: "flex",
            alignItems: "center",
            justifyContent: "center",
          }}
        >
          <ScreenshotTrio />
        </div>
      </div>
    </section>
  );
}

// ---------- Screenshot trio (real product images) ----------
function ScreenshotTrio() {
  return (
    <div style={{ position: "relative", width: 480, height: 640 }}>
      {[
        {
          src: "assets/screen-workstreams.png",
          x: -40,
          y: 70,
          rot: -6,
          z: 1,
          w: 230,
        },
        {
          src: "assets/screen-discover-2.png",
          x: 145,
          y: 0,
          rot: 0,
          z: 3,
          w: 250,
        },
        {
          src: "assets/screen-readme.png",
          x: 320,
          y: 80,
          rot: 7,
          z: 2,
          w: 230,
        },
      ].map((s, i) => (
        <div
          key={i}
          style={{
            position: "absolute",
            left: s.x,
            top: s.y,
            width: s.w,
            transform: `rotate(${s.rot}deg)`,
            zIndex: s.z,
            boxShadow:
              "0 30px 60px -12px rgba(15,17,20,0.25), 0 12px 24px rgba(15,17,20,0.10)",
            borderRadius: 28,
            overflow: "hidden",
            border: `1px solid ${L.border}`,
            background: L.paper,
          }}
        >
          <img
            src={s.src}
            alt="Scrolledge screenshot"
            style={{ width: "100%", display: "block" }}
          />
        </div>
      ))}
    </div>
  );
}

// ---------- Who It's For ----------
function WhoItsFor() {
  return (
    <section
      style={{
        padding: "120px 32px",
        background: L.paper,
        borderTop: `1px solid ${L.border}`,
        borderBottom: `1px solid ${L.border}`,
        position: "relative",
        overflow: "hidden",
      }}
    >
      <div className="edition-mark">§ 05 — Audience</div>
      <div
        className="tx-dots"
        aria-hidden
        style={{
          position: "absolute",
          top: 0,
          right: 0,
          width: 220,
          height: 220,
          opacity: 0.4,
          pointerEvents: "none",
        }}
      />
      <div style={{ maxWidth: 880, margin: "0 auto" }}>
        <div
          style={{
            fontFamily: L.fontSans,
            fontWeight: 600,
            fontSize: 12,
            letterSpacing: "0.16em",
            textTransform: "uppercase",
            color: L.primary,
            marginBottom: 24,
          }}
        ></div>
        <div
          className="g-stack"
          style={{
            display: "grid",
            gridTemplateColumns: "1fr auto 1fr",
            gap: 48,
            alignItems: "start",
          }}
        >
          <div
            style={{
              paddingLeft: 20,
              borderLeft: `2px solid ${L.primary}`,
            }}
          >
            <div
              style={{
                fontFamily: L.fontSans,
                fontSize: 13,
                fontWeight: 600,
                color: L.primary,
                letterSpacing: "0.08em",
                textTransform: "uppercase",
                marginBottom: 12,
              }}
            >
              Scrolledge is for you, if
            </div>
            <p
              style={{
                fontFamily: L.fontSerif,
                fontWeight: 500,
                fontSize: 26,
                lineHeight: 1.28,
                color: L.ink,
                margin: 0,
                textWrap: "pretty",
              }}
            >
              You're building, making, or thinking — and you're tired of doing
              archaeology on the internet to stay current.
            </p>
            <p
              style={{
                fontFamily: L.fontSans,
                fontSize: 14,
                color: L.fg3,
                margin: "14px 0 0",
              }}
            >
              Engineers, founders, researchers, designers, visionaries.
            </p>
          </div>

          <div
            style={{
              fontFamily: L.fontDisplay,
              fontStyle: "italic",
              fontSize: 36,
              color: L.fg4,
              alignSelf: "center",
            }}
          >
            —
          </div>

          <div
            style={{
              paddingLeft: 20,
              borderLeft: `2px solid ${L.borderStrong}`,
            }}
          >
            <div
              style={{
                fontFamily: L.fontSans,
                fontSize: 13,
                fontWeight: 600,
                color: L.fg3,
                letterSpacing: "0.08em",
                textTransform: "uppercase",
                marginBottom: 12,
              }}
            >
              Not for you, if
            </div>
            <p
              style={{
                fontFamily: L.fontSerif,
                fontWeight: 400,
                fontSize: 26,
                lineHeight: 1.28,
                color: L.fg3,
                margin: 0,
                fontStyle: "italic",
                textWrap: "pretty",
              }}
            >
              You're not making anything.
            </p>
            <p
              style={{
                fontFamily: L.fontSans,
                fontSize: 14,
                color: L.fg4,
                margin: "14px 0 0",
              }}
            >
              Stick to Instagram.
            </p>
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Social proof ----------
function SocialProof() {
  const quotes = [
    {
      q: "I closed three other tabs. Scrolledge is the only place I check now.",
      a: "Maya R.",
      role: "Founder, browser-agents startup",
    },
    {
      q: "Found two repos that mattered before they hit my Twitter feed.",
      a: "Devon K.",
      role: "AI research engineer",
    },
    {
      q: "It's the first feed that respects what I'm actually working on.",
      a: "Priya S.",
      role: "Solo founder",
    },
  ];

  return (
    <section
      style={{
        padding: "110px 32px",
        background: L.paper,
      }}
    >
      <div style={{ maxWidth: 1200, margin: "0 auto" }}>
        <div
          style={{
            display: "grid",
            gridTemplateColumns: "repeat(4, 1fr)",
            gap: 24,
            marginBottom: 64,
          }}
        >
          {[
            { n: "1,420", l: "builders on the list" },
            { n: "14×", l: "faster than your inbox" },
            { n: "4.8", l: "average rating, TestFlight" },
            { n: "00:00", l: "time spent on configuration" },
          ].map((s) => (
            <div
              key={s.l}
              style={{
                padding: "28px 24px",
                background: L.surface,
                border: `1px solid ${L.border}`,
                borderRadius: 8,
                boxShadow: "0 8px 24px rgba(15,17,20,0.04)",
              }}
            >
              <div
                style={{
                  fontFamily: L.fontDisplay,
                  fontWeight: 700,
                  fontSize: 44,
                  color: L.ink,
                  lineHeight: 1,
                  letterSpacing: "-0.02em",
                  marginBottom: 8,
                }}
              >
                {s.n}
              </div>
              <div
                style={{ fontFamily: L.fontSans, fontSize: 13, color: L.fg3 }}
              >
                {s.l}
              </div>
            </div>
          ))}
        </div>

        <div
          style={{
            display: "grid",
            gridTemplateColumns: "repeat(3, 1fr)",
            gap: 24,
            marginBottom: 56,
          }}
        >
          {quotes.map((q, i) => (
            <div
              key={i}
              style={{
                padding: "32px 28px",
                background: L.surface,
                border: `1px solid ${L.border}`,
                borderRadius: 8,
                display: "flex",
                flexDirection: "column",
                gap: 24,
              }}
            >
              <div
                style={{
                  fontFamily: L.fontDisplay,
                  fontSize: 60,
                  color: L.accent,
                  lineHeight: 0.6,
                  height: 18,
                }}
              >
                "
              </div>
              <p
                style={{
                  fontFamily: L.fontSerif,
                  fontStyle: "italic",
                  fontSize: 19,
                  lineHeight: 1.45,
                  color: L.ink,
                  margin: 0,
                  flex: 1,
                  textWrap: "pretty",
                }}
              >
                {q.q}
              </p>
              <div>
                <div
                  style={{
                    fontFamily: L.fontSans,
                    fontWeight: 600,
                    fontSize: 14,
                    color: L.ink,
                  }}
                >
                  {q.a}
                </div>
                <div
                  style={{
                    fontFamily: L.fontSans,
                    fontSize: 12,
                    color: L.fg3,
                    marginTop: 2,
                  }}
                >
                  {q.role}
                </div>
              </div>
            </div>
          ))}
        </div>

        <div
          style={{
            padding: "40px",
            background: L.subtle,
            border: `1px solid ${L.border}`,
            borderRadius: 8,
            display: "flex",
            justifyContent: "space-between",
            alignItems: "center",
            gap: 32,
            flexWrap: "wrap",
          }}
        >
          <div style={{ flex: 1, minWidth: 280 }}>
            <div
              style={{
                fontFamily: L.fontSerif,
                fontWeight: 600,
                fontSize: 22,
                color: L.ink,
                marginBottom: 6,
              }}
            >
              Join 1,420 builders already on the list.
            </div>
            <div
              style={{
                fontFamily: L.fontSerif,
                fontStyle: "italic",
                fontSize: 14,
                color: L.fg3,
              }}
            >
              Spots open weekly. We notify in waves.
            </div>
          </div>
          <WaitlistForm ctaLabel="I want in" />
        </div>
      </div>
    </section>
  );
}

// ---------- Final CTA ----------
function FinalCTA() {
  return (
    <section
      id="waitlist"
      style={{
        padding: "140px 32px",
        background: L.ink,
        color: L.paper,
        position: "relative",
        overflow: "hidden",
      }}
    >
      <div
        className="tx-hatch-dark"
        aria-hidden
        style={{
          position: "absolute",
          inset: 0,
          pointerEvents: "none",
          opacity: 0.7,
        }}
      />
      <div className="edition-mark dark">§ 06 — The Close</div>
      <div
        aria-hidden
        style={{
          position: "absolute",
          top: "50%",
          left: "50%",
          transform: "translate(-50%,-50%)",
          width: 900,
          height: 900,
          borderRadius: "50%",
          background:
            "radial-gradient(circle, rgba(212,175,55,0.18) 0%, transparent 60%)",
        }}
      />

      <div
        style={{
          maxWidth: 880,
          margin: "0 auto",
          textAlign: "center",
          position: "relative",
        }}
      >
        <h2
          style={{
            fontFamily: L.fontDisplay,
            fontWeight: 700,
            fontSize: "clamp(48px, 6.6vw, 88px)",
            lineHeight: 1.04,
            letterSpacing: "-0.02em",
            color: L.paper,
            margin: "0 0 48px",
            textWrap: "balance",
          }}
        >
          Your mornings are worth more than this.
        </h2>

        <div style={{ display: "flex", justifyContent: "center" }}>
          <WaitlistForm ctaLabel="Get early access" dark />
        </div>
        <div
          style={{
            fontFamily: L.fontSerif,
            fontStyle: "italic",
            fontSize: 15,
            color: "rgba(250,248,244,0.65)",
            marginTop: 18,
          }}
        >
          No spam. No newsletter. Just a ping when your spot opens.
        </div>
      </div>
    </section>
  );
}

// ---------- Footer ----------
function Footer() {
  return (
    <footer
      style={{
        padding: "48px 32px",
        background: L.paper,
        borderTop: `1px solid ${L.border}`,
      }}
    >
      <div
        style={{
          maxWidth: 1200,
          margin: "0 auto",
          display: "flex",
          justifyContent: "space-between",
          alignItems: "center",
          gap: 24,
          flexWrap: "wrap",
        }}
      >
        <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
          <div
            style={{
              width: 26,
              height: 26,
              borderRadius: 4,
              background: L.paper,
              border: `1.5px solid ${L.ink}`,
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              fontFamily: L.fontDisplay,
              fontWeight: 700,
              fontSize: 18,
              color: L.ink,
              lineHeight: 1,
            }}
          >
            S
          </div>
          <div
            style={{
              fontFamily: L.fontDisplay,
              fontWeight: 700,
              fontSize: 18,
              color: L.ink,
            }}
          >
            Scrolledge
          </div>
          <div
            style={{
              fontFamily: L.fontSerif,
              fontStyle: "italic",
              fontSize: 13,
              color: L.fg3,
              marginLeft: 12,
            }}
          >
            Discover what moves ideas forward.
          </div>
        </div>
        <div style={{ display: "flex", gap: 28, alignItems: "center" }}>
          <a
            href="#"
            style={{
              fontFamily: L.fontSans,
              fontSize: 13,
              color: L.fg2,
              textDecoration: "none",
            }}
          >
            Twitter / X
          </a>
          <a
            href="mailto:hello@scrolledge.app"
            style={{
              fontFamily: L.fontSans,
              fontSize: 13,
              color: L.fg2,
              textDecoration: "none",
            }}
          >
            hello@scrolledge.app
          </a>
          <a
            href="#"
            style={{
              fontFamily: L.fontSans,
              fontSize: 13,
              color: L.fg2,
              textDecoration: "none",
            }}
          >
            Privacy
          </a>
          <span style={{ fontFamily: L.fontSans, fontSize: 12, color: L.fg4 }}>
            © 2026 Scrolledge
          </span>
        </div>
      </div>
    </footer>
  );
}

// ---------- App ----------
function useScrollReveal() {
  React.useEffect(() => {
    const reduced = window.matchMedia(
      "(prefers-reduced-motion: reduce)"
    ).matches;

    const sections = Array.from(document.querySelectorAll("section"));
    sections.forEach((sec) => {
      Array.from(sec.children).forEach((el, i) => {
        if (el.classList.contains("no-reveal")) return;
        el.classList.add("reveal");
        el.style.setProperty(
          "--reveal-delay",
          `${Math.min(i * 70, 300)}ms`
        );
      });
    });

    if (reduced) {
      document
        .querySelectorAll(".reveal")
        .forEach((el) => el.classList.add("in"));
      return;
    }

    // Sections already in viewport: mark .in synchronously so no transition runs.
    const vh = window.innerHeight;
    const initial = [];
    const deferred = [];
    sections.forEach((sec) => {
      const top = sec.getBoundingClientRect().top;
      (top < vh * 0.85 ? initial : deferred).push(sec);
    });
    initial.forEach((sec) =>
      Array.from(sec.children).forEach((el) => el.classList.add("in"))
    );

    const io = new IntersectionObserver(
      (entries) => {
        entries.forEach((e) => {
          if (e.isIntersecting) {
            Array.from(e.target.children).forEach((el) =>
              el.classList.add("in")
            );
            io.unobserve(e.target);
          }
        });
      },
      { rootMargin: "0px 0px -8% 0px", threshold: 0.05 }
    );
    deferred.forEach((sec) => io.observe(sec));
    return () => io.disconnect();
  }, []);
}

function useHeroParallax() {
  React.useEffect(() => {
    const reduced = window.matchMedia(
      "(prefers-reduced-motion: reduce)"
    ).matches;
    if (reduced) return;
    const targets = document.querySelectorAll(".parallax-soft");
    if (!targets.length) return;
    let raf = 0;
    const onScroll = () => {
      if (raf) return;
      raf = requestAnimationFrame(() => {
        const y = window.scrollY;
        targets.forEach((el) => {
          const speed = parseFloat(el.dataset.speed || "0.06");
          el.style.transform = `translate3d(0, ${(-y * speed).toFixed(2)}px, 0)`;
        });
        raf = 0;
      });
    };
    window.addEventListener("scroll", onScroll, { passive: true });
    onScroll();
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
}

function App() {
  useScrollReveal();
  useHeroParallax();
  return (
    <React.Fragment>
      <TopNav />
      <Hero />
      <Problem />
      <Agitation />
      <Solution />
      <WhoItsFor />
      {/* <SocialProof /> — VAULTED until we have real test data (per Z). Bring back when quotes/numbers are real. */}
      <FinalCTA />
      <Footer />
    </React.Fragment>
  );
}

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