/* eslint-disable */
// Nav + Hero. Redesigned 2026-09 per direct feedback on the previous version:
// "only matter and images ... small cute animations if needed." Gone: the
// fake live-editing dashboard, drifting gradient blobs, a kanban board of
// named companies. What is here: the headline, one accurate picture of what
// the product actually produces (MiniResume — a real small rendering of the
// Modern template, not a screenshot, not a mockup of a mockup), and a single
// small motion touch (the card straightens 1.5deg on hover).

const { useState, useEffect } = React;

function NavBar() {
  const [scrolled, setScrolled] = useState(false);
  useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 20);
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
  const links = [
    ["Build", "#build"], ["Apply", "#apply"], ["Tools", "#tools"], ["Interview", "#interview"], ["Pricing", "#pricing"],
  ];
  return (
    <div style={{
      position: "fixed", top: 0, left: 0, right: 0, zIndex: 50,
      padding: "14px 0",
      background: scrolled ? "rgba(251,247,238,0.92)" : "transparent",
      backdropFilter: scrolled ? "saturate(1.2) blur(14px)" : "none",
      WebkitBackdropFilter: scrolled ? "saturate(1.2) blur(14px)" : "none",
      borderBottom: scrolled ? "1px solid var(--line)" : "1px solid transparent",
      transition: "background 220ms, border-color 220ms",
    }}>
      <div className="container" style={{ display: "flex", alignItems: "center", gap: 28 }}>
        <a href="#top" style={{ display: "flex", alignItems: "center", gap: 10 }}>
          <StudioMark size={30} />
          <Wordmark />
        </a>
        <nav style={{ display: "flex", gap: 4, marginLeft: 24 }} className="nav-links">
          {links.map(([label, href]) => (
            <a key={label} href={href} style={{
              padding: "8px 14px", fontSize: 14, fontWeight: 500, color: "var(--ink-2)",
              borderRadius: 999, transition: "background 160ms",
            }} onMouseEnter={(e) => e.currentTarget.style.background = "rgba(15,17,21,0.05)"}
               onMouseLeave={(e) => e.currentTarget.style.background = "transparent"}>
              {label}
            </a>
          ))}
        </nav>
        <div style={{ marginLeft: "auto", display: "flex", alignItems: "center", gap: 10 }}>
          <a href="/login" style={{ fontSize: 14, fontWeight: 500, padding: "8px 14px", color: "var(--ink-2)" }}>Sign in</a>
          <button className="btn-primary" onClick={() => { window.location.href = '/login'; }} style={{ padding: "10px 18px", fontSize: 14 }}>
            Start free {LI.arrowRight}
          </button>
        </div>
      </div>
      <style>{`
        @media (max-width: 900px) { .nav-links { display: none; } }
      `}</style>
    </div>
  );
}

// ───────────────────────────────────────────────────────────────────────────────
// MiniResume — a genuine small rendering of what the product outputs, built
// from the same knobs the real template system uses (header style, accent,
// serif vs sans, heading rule). Not a screenshot (nothing to keep in sync,
// scales crisply at any size) and not invented chrome — every proportion and
// color here matches an actual shipped template. Shared by the hero and the
// "19 templates" section below.
function MiniResume({
  name = "Priya Raman",
  headline = "Senior Backend Engineer",
  accent = "#5E5CE6",
  header = "band",          // band | rule | centered | plain
  serif = false,
  bullets = ["Rebuilt the ingestion pipeline; p99 latency down 40%.", "Cut cloud spend 22% by right-sizing workers."],
  skills = ["Go", "Python", "PostgreSQL", "Kubernetes"],
  width = 320,
  scale = 1,
}) {
  const font = serif ? "Georgia, 'Times New Roman', serif" : "Inter, system-ui, sans-serif";
  const centered = header === "centered";
  const headerBand = header === "band";
  return (
    <div style={{
      width, aspectRatio: "8.5 / 11", background: "#fff", borderRadius: 5 * scale,
      boxShadow: "0 1px 2px rgba(15,17,21,0.06), 0 24px 48px rgba(15,17,21,0.14)",
      overflow: "hidden", fontFamily: font, color: "#22272E",
      display: "flex", flexDirection: "column",
    }}>
      <div style={{
        padding: `${(headerBand ? 22 : 20) * scale}px ${24 * scale}px ${(headerBand ? 16 : 12) * scale}px`,
        background: headerBand ? accent : "#fff",
        color: headerBand ? "#fff" : "#0F1216",
        textAlign: centered ? "center" : "left",
        borderBottom: header === "rule" ? `${3 * scale}px solid ${accent}` : centered ? `1px solid #E7E1D2` : "none",
      }}>
        <div style={{ fontSize: 17 * scale, fontWeight: 700, letterSpacing: "-0.01em" }}>{name}</div>
        <div style={{ fontSize: 10.5 * scale, marginTop: 3 * scale, opacity: headerBand ? 0.92 : 1, color: headerBand ? "#fff" : accent, fontWeight: 600 }}>{headline}</div>
        <div style={{ fontSize: 8 * scale, marginTop: 6 * scale, opacity: 0.7 }}>priya@example.com · Seattle, WA · linkedin.com/in/priyaraman</div>
      </div>
      <div style={{ padding: `${16 * scale}px ${24 * scale}px`, flex: 1, display: "flex", flexDirection: "column", gap: 12 * scale }}>
        <div>
          <div style={{ fontSize: 8.5 * scale, fontWeight: 700, letterSpacing: "0.1em", color: accent, borderBottom: `1px solid ${accent}40`, paddingBottom: 3 * scale, marginBottom: 6 * scale }}>SUMMARY</div>
          <div style={{ fontSize: 8 * scale, lineHeight: 1.5, color: "#555" }}>Backend engineer with six years building high-throughput services in Go and Python.</div>
        </div>
        <div>
          <div style={{ fontSize: 8.5 * scale, fontWeight: 700, letterSpacing: "0.1em", color: accent, borderBottom: `1px solid ${accent}40`, paddingBottom: 3 * scale, marginBottom: 6 * scale }}>EXPERIENCE</div>
          <div style={{ display: "flex", justifyContent: "space-between", fontSize: 8.5 * scale, fontWeight: 700 }}>
            <span>Senior Backend Engineer · Northwind Systems</span><span style={{ fontWeight: 400, color: "#888" }}>2022 — Now</span>
          </div>
          <div style={{ display: "flex", flexDirection: "column", gap: 3 * scale, marginTop: 5 * scale }}>
            {bullets.map((b, i) => (
              <div key={i} style={{ display: "flex", gap: 5 * scale, fontSize: 7.6 * scale, lineHeight: 1.45, color: "#555" }}>
                <span style={{ color: accent, flexShrink: 0 }}>•</span><span>{b}</span>
              </div>
            ))}
          </div>
        </div>
        <div>
          <div style={{ fontSize: 8.5 * scale, fontWeight: 700, letterSpacing: "0.1em", color: accent, borderBottom: `1px solid ${accent}40`, paddingBottom: 3 * scale, marginBottom: 6 * scale }}>SKILLS</div>
          <div style={{ fontSize: 7.6 * scale, color: "#555" }}>{skills.join("  ·  ")}</div>
        </div>
      </div>
    </div>
  );
}

// ───────────────────────────────────────────────────────────────────────────────
function Hero() {
  return (
    <section id="top" style={{ padding: "150px 0 60px", position: "relative", overflow: "hidden" }}>
      <div className="container hero-grid" style={{ display: "grid", gridTemplateColumns: "1.05fr 0.95fr", gap: 56, alignItems: "center" }}>
        <div style={{ animation: "fadeUp 700ms cubic-bezier(0.2,0,0,1) both" }}>
          <div className="eye" style={{
            display: "inline-flex", alignItems: "center", gap: 7,
            padding: "6px 12px 6px 10px", borderRadius: 999,
            background: "var(--indigo-soft)", color: "var(--indigo-deep)",
            marginBottom: 22, fontWeight: 700,
          }}>
            {LI.sparkle} CLAUDE-POWERED
          </div>
          <h1 style={{
            margin: 0, marginBottom: 22,
            fontSize: "clamp(38px, 5vw, 60px)",
            lineHeight: 1.06, letterSpacing: "-0.03em", fontWeight: 700,
            textWrap: "balance",
          }}>
            Build the résumé.<br />Find the job.<br /><span className="ed" style={{ fontWeight: 500, color: "var(--indigo)" }}>Rehearse the interview.</span>
          </h1>
          <p style={{
            fontSize: 18, lineHeight: 1.6, color: "var(--ink-2)",
            marginBottom: 32, maxWidth: 520, textWrap: "pretty",
          }}>
            One place for the whole job search: write and tailor your résumé, search ten job boards at once,
            check your fit against a posting, and practice out loud before the real call.
          </p>

          <div style={{ display: "flex", gap: 12, alignItems: "center", flexWrap: "wrap", marginBottom: 36 }}>
            <button className="btn-primary" onClick={() => { window.location.href = '/login'; }}>
              Start free {LI.arrowRight}
            </button>
            <a href="#build" className="btn-ghost">
              See how it works {LI.arrowDown}
            </a>
          </div>

          <div style={{ display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" }}>
            {[
              { t: "Free to start", c: "var(--mint)", bg: "var(--mint-soft)" },
              { t: "No card needed", c: "var(--sky)", bg: "var(--sky-soft)" },
              { t: "19 templates · 15 tools", c: "var(--violet)", bg: "var(--violet-soft)" },
            ].map((p, i) => (
              <span key={p.t} style={{
                display: "inline-flex", alignItems: "center", gap: 7,
                padding: "7px 12px 7px 9px", borderRadius: 999,
                background: p.bg, color: "var(--ink-2)", fontSize: 12.5, fontWeight: 600,
              }}>
                <span style={{ width: 16, height: 16, borderRadius: 999, background: p.c, color: "#fff", display: "grid", placeItems: "center" }}>
                  {LI.check}
                </span>
                {p.t}
              </span>
            ))}
          </div>
        </div>

        {/* One real image: the actual Modern template, at hero size. The
            only motion here is a gentle straighten on hover — the card sits
            at a slight tilt and pulls level, like picking up a printed page. */}
        <div style={{ display: "flex", justifyContent: "center", animation: "fadeUp 800ms cubic-bezier(0.2,0,0,1) 120ms both" }}>
          <div className="hero-card">
            <MiniResume width={360} />
          </div>
        </div>
      </div>

      <style>{`
        .hero-card { transform: rotate(-2.2deg); transition: transform 420ms cubic-bezier(0.2,0,0,1); }
        .hero-card:hover { transform: rotate(0deg); }
        @media (max-width: 900px) {
          .hero-grid { grid-template-columns: 1fr !important; }
          .hero-grid > div:last-child { order: -1; margin-bottom: 12px; }
        }
        @media (prefers-reduced-motion: reduce) { .hero-card { transition: none; } }
      `}</style>
    </section>
  );
}

Object.assign(window, { Hero, NavBar, MiniResume });
