const { useState, useEffect, useRef } = React;

// ─── TWEAK DEFAULTS ──────────────────────────────────────────────────────────
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "accentScheme": "yellow-cyan",
  "showMarquee": true,
  "headerStyle": "floating"
}/*EDITMODE-END*/;

// ─── ACCENT SCHEMES ───────────────────────────────────────────────────────────
const SCHEMES = {
  "yellow-cyan": {
    a: "oklch(0.88 0.20 100)",
    b: "oklch(0.72 0.16 195)",
    label: "Yellow + Cyan"
  },
  "amber-cyan": {
    a: "oklch(0.80 0.17 82)",
    b: "oklch(0.75 0.14 200)",
    label: "Amber + Cyan"
  },
  "orange-pink": {
    a: "oklch(0.72 0.18 45)",
    b: "oklch(0.75 0.18 340)",
    label: "Orange + Pink"
  }
};

function applyScheme(scheme) {
  const s = SCHEMES[scheme];
  if (!s) return;
  document.documentElement.style.setProperty("--accent", s.a);
  document.documentElement.style.setProperty("--accent-2", s.b);
}

// ─── NAV LINKS ────────────────────────────────────────────────────────────────
const NAV_LINKS = [
  { label: "My Work",     href: "#work" },
  { label: "Experiments", href: "#experiments" },
  { label: "Contact",     href: "#contact" },
];

// ─── HEADER ───────────────────────────────────────────────────────────────────
function Header({ headerStyle }) {
  const [scrolled, setScrolled] = useState(false);
  const [menuOpen, setMenuOpen] = useState(false);

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

  const isFloating = headerStyle === "floating";

  return (
    <header style={{
      position: "fixed",
      top: isFloating ? "16px" : "0",
      left: isFloating ? "50%" : "0",
      right: isFloating ? "auto" : "0",
      transform: isFloating ? "translateX(-50%)" : "none",
      width: isFloating ? "min(900px, calc(100% - 40px))" : "100%",
      zIndex: 100,
      background: scrolled
        ? "oklch(0.19 0.013 255 / 0.92)"
        : isFloating ? "oklch(0.19 0.013 255 / 0.80)" : "transparent",
      backdropFilter: "blur(16px)",
      WebkitBackdropFilter: "blur(16px)",
      border: `1px solid ${scrolled ? "var(--border)" : "oklch(0.30 0.010 255 / 0.5)"}`,
      borderRadius: isFloating ? "12px" : "0",
      padding: "0 24px",
      transition: "background 0.3s, border-color 0.3s, box-shadow 0.3s",
      boxShadow: scrolled ? "0 4px 40px oklch(0 0 0 / 0.4)" : "none",
    }}>
      <div style={{
        display: "flex",
        alignItems: "center",
        justifyContent: "space-between",
        height: "56px",
        gap: "24px",
      }}>
        <a href="#" style={{ textDecoration: "none", flexShrink: 0 }}>
          <Logo />
        </a>

        <nav style={{ gap: "4px", alignItems: "center" }} className="desktop-nav">
          {NAV_LINKS.map(link => (
            <NavLink key={link.href} href={link.href}>{link.label}</NavLink>
          ))}
        </nav>

        <a
          href="#contact"
          className="desktop-nav cta-btn"
          style={{
            flexShrink: 0,
            fontFamily: "var(--font-mono)",
            fontSize: "12px",
            fontWeight: 500,
            letterSpacing: "0.08em",
            textTransform: "uppercase",
            color: "var(--bg)",
            background: "var(--accent)",
            border: "none",
            borderRadius: "var(--radius-sm)",
            padding: "8px 18px",
            cursor: "pointer",
            textDecoration: "none",
            transition: "opacity 0.15s, transform 0.15s",
          }}
          onMouseEnter={e => { e.currentTarget.style.opacity = "0.85"; e.currentTarget.style.transform = "translateY(-1px)"; }}
          onMouseLeave={e => { e.currentTarget.style.opacity = "1"; e.currentTarget.style.transform = "none"; }}
        >
          Get in touch
        </a>

        <button
          className="mobile-menu-btn"
          onClick={() => setMenuOpen(o => !o)}
          style={{
            background: "none", border: "1px solid var(--border)",
            borderRadius: "var(--radius-sm)",
            color: "var(--text)", cursor: "pointer",
            padding: "6px 10px", fontFamily: "var(--font-mono)", fontSize: "12px",
          }}
        >
          {menuOpen ? "✕" : "☰"}
        </button>
      </div>

      {menuOpen && (
        <div style={{
          borderTop: "1px solid var(--border)",
          paddingBottom: "16px",
          display: "flex", flexDirection: "column", gap: "4px",
        }}>
          {NAV_LINKS.map(link => (
            <a key={link.href} href={link.href}
              onClick={() => setMenuOpen(false)}
              style={{
                fontFamily: "var(--font-mono)", fontSize: "13px",
                color: "var(--text-dim)", textDecoration: "none",
                padding: "10px 4px",
                borderBottom: "1px solid oklch(0.30 0.010 255 / 0.3)",
                transition: "color 0.15s",
              }}
              onMouseEnter={e => e.currentTarget.style.color = "var(--accent)"}
              onMouseLeave={e => e.currentTarget.style.color = "var(--text-dim)"}
            >{link.label}</a>
          ))}
          <a href="#contact" onClick={() => setMenuOpen(false)} style={{
            marginTop: "8px",
            fontFamily: "var(--font-mono)", fontSize: "12px",
            fontWeight: 500, letterSpacing: "0.08em", textTransform: "uppercase",
            color: "var(--bg)", background: "var(--accent)",
            borderRadius: "var(--radius-sm)", padding: "10px 18px",
            textDecoration: "none", textAlign: "center",
          }}>Get in touch</a>
        </div>
      )}
    </header>
  );
}

// ─── LOGO ─────────────────────────────────────────────────────────────────────
function Logo() {
  return (
    <div style={{ display: "flex", alignItems: "center", gap: "10px" }}>
      <svg width="28" height="28" viewBox="0 0 28 28" fill="none">
        <rect width="28" height="28" rx="5" fill="var(--accent)" />
        <text x="4" y="21" fontFamily="'Syne', sans-serif" fontWeight="800" fontSize="16" fill="oklch(0.17 0.015 255)">tip</text>
      </svg>
      <span style={{
        fontFamily: "var(--font-display)",
        fontWeight: 700,
        fontSize: "15px",
        letterSpacing: "-0.01em",
        color: "var(--text)",
        lineHeight: 1,
      }}>
        things<br />
        <span style={{ color: "var(--accent)", fontStyle: "italic" }}>in progress</span>
      </span>
    </div>
  );
}

function NavLink({ href, children }) {
  const [hovered, setHovered] = useState(false);
  return (
    <a
      href={href}
      style={{
        fontFamily: "var(--font-mono)",
        fontSize: "12px",
        letterSpacing: "0.04em",
        color: hovered ? "var(--accent)" : "var(--text-dim)",
        textDecoration: "none",
        padding: "6px 12px",
        borderRadius: "var(--radius-sm)",
        background: hovered ? "oklch(0.30 0.010 255 / 0.4)" : "transparent",
        transition: "color 0.15s, background 0.15s",
      }}
      onMouseEnter={() => setHovered(true)}
      onMouseLeave={() => setHovered(false)}
    >
      {children}
    </a>
  );
}

// ─── MARQUEE ──────────────────────────────────────────────────────────────────
function Marquee() {
  const items = [
    "Landing Pages", "Website Strategy", "Email Automations",
    "Funnel Analytics", "SEO", "Content Direction", "AI Workflows",
  ];
  const repeated = [...items, ...items, ...items];
  return (
    <div style={{
      overflow: "hidden",
      borderTop: "1px solid var(--border)",
      borderBottom: "1px solid var(--border)",
      padding: "12px 0",
      background: "var(--bg-2)",
    }}>
      <div style={{
        display: "flex",
        gap: "48px",
        animation: "marquee 28s linear infinite",
        width: "max-content",
      }}>
        {repeated.map((item, i) => (
          <span key={i} style={{
            fontFamily: "var(--font-mono)",
            fontSize: "11px",
            letterSpacing: "0.12em",
            textTransform: "uppercase",
            color: "var(--text-dim)",
            display: "flex",
            alignItems: "center",
            gap: "48px",
            whiteSpace: "nowrap",
          }}>
            {item}
            <span style={{ color: "var(--accent)", fontSize: "8px" }}>◆</span>
          </span>
        ))}
      </div>
    </div>
  );
}

// ─── HERO ─────────────────────────────────────────────────────────────────────
function Hero() {
  return (
    <section style={{
      minHeight: "100vh",
      display: "flex",
      flexDirection: "column",
      justifyContent: "center",
      padding: "140px 40px 80px",
      maxWidth: "1100px",
      margin: "0 auto",
      width: "100%",
    }}>
      {/* Status pill */}
      <div style={{ marginBottom: "40px" }}>
        <span style={{
          display: "inline-flex",
          alignItems: "center",
          gap: "8px",
          fontFamily: "var(--font-mono)",
          fontSize: "11px",
          letterSpacing: "0.1em",
          textTransform: "uppercase",
          color: "var(--accent-2)",
          border: "1px solid oklch(0.72 0.16 195 / 0.35)",
          borderRadius: "100px",
          padding: "5px 14px",
        }}>
          <span style={{
            width: "6px", height: "6px",
            borderRadius: "50%",
            background: "var(--accent-2)",
            animation: "pulse 2s ease-in-out infinite",
            flexShrink: 0,
          }} />
          Open to new collaborations
        </span>
      </div>

      <h1 style={{
        fontFamily: "var(--font-display)",
        fontWeight: 700,
        fontSize: "clamp(40px, 6.4vw, 84px)",
        lineHeight: 1.02,
        letterSpacing: "-0.03em",
        color: "var(--text)",
        marginBottom: "40px",
        textWrap: "balance",
        maxWidth: "16ch",
      }}>
        Need help setting up your
        <span style={{
          color: "transparent",
          WebkitTextStroke: "1.4px var(--accent)",
          fontStyle: "italic",
        }}> marketing infrastructure</span>?
      </h1>

      <div style={{
        display: "flex",
        alignItems: "flex-start",
        gap: "clamp(24px, 6vw, 80px)",
        flexWrap: "wrap",
        marginBottom: "56px",
      }}>
        <div style={{
          fontFamily: "var(--font-mono)",
          fontSize: "clamp(14px, 1.6vw, 17px)",
          color: "var(--text-dim)",
          lineHeight: 1.65,
          maxWidth: "560px",
          flex: "1 1 320px",
        }}>
          <p>
            <span style={{ color: "var(--text)" }}>Evgeny Nefedov</span> is a digital marketer with hands-on focus on web UX &amp; copy, and tool &amp; platform integrations &amp; automations.
            10+ years building landing pages, directing website development, running web &amp; app funnel analytics,
            email chasing automations, and SEO tactics.
          </p>
          <p style={{ marginTop: "16px" }}>
            Currently at <span style={{ color: "var(--text)" }}>ANNA Money</span>, a UK-based financial and tax tech startup —
            working on website strategy, building landing pages, automating emails, and a lot of other domains adjacent to digital marketing.
          </p>
        </div>

        <div style={{
          display: "flex",
          flexDirection: "column",
          gap: "20px",
          flex: "0 0 auto",
          borderLeft: "1px solid var(--border)",
          paddingLeft: "clamp(24px, 4vw, 48px)",
        }}>
          {[
            { value: "10+", label: "Years in the field", size: 32 },
            { value: "London, UK", label: "Available on-site, but relocation is also possible", size: 24 },
          ].map(({ value, label, size }) => (
            <div key={label}>
              <div style={{
                fontFamily: "var(--font-display)",
                fontWeight: 700,
                fontSize: `${size}px`,
                letterSpacing: "-0.02em",
                color: "var(--accent)",
                lineHeight: 1.05,
                whiteSpace: "nowrap",
              }}>{value}</div>
              <div style={{
                fontFamily: "var(--font-mono)",
                fontSize: "11px",
                letterSpacing: "0.06em",
                color: "var(--text-dim)",
                marginTop: "6px",
              }}>{label}</div>
            </div>
          ))}
        </div>
      </div>

      <div style={{ display: "flex", gap: "12px", flexWrap: "wrap", alignItems: "center" }}>
        <a href="#work" style={{
          fontFamily: "var(--font-mono)",
          fontSize: "13px",
          fontWeight: 500,
          letterSpacing: "0.06em",
          textTransform: "uppercase",
          color: "var(--bg)",
          background: "var(--accent)",
          borderRadius: "var(--radius-sm)",
          padding: "14px 28px",
          textDecoration: "none",
          transition: "opacity 0.15s, transform 0.15s",
        }}
          onMouseEnter={e => { e.currentTarget.style.opacity = "0.85"; e.currentTarget.style.transform = "translateY(-2px)"; }}
          onMouseLeave={e => { e.currentTarget.style.opacity = "1"; e.currentTarget.style.transform = "none"; }}
        >
          See what I do ↓
        </a>
        <a href="#contact" style={{
          fontFamily: "var(--font-mono)",
          fontSize: "13px",
          letterSpacing: "0.06em",
          textTransform: "uppercase",
          color: "var(--text)",
          background: "transparent",
          border: "1px solid var(--border)",
          borderRadius: "var(--radius-sm)",
          padding: "14px 28px",
          textDecoration: "none",
          transition: "border-color 0.15s, color 0.15s, transform 0.15s",
        }}
          onMouseEnter={e => { e.currentTarget.style.borderColor = "var(--accent)"; e.currentTarget.style.color = "var(--accent)"; e.currentTarget.style.transform = "translateY(-2px)"; }}
          onMouseLeave={e => { e.currentTarget.style.borderColor = "var(--border)"; e.currentTarget.style.color = "var(--text)"; e.currentTarget.style.transform = "none"; }}
        >
          Get in touch →
        </a>
      </div>
    </section>
  );
}

// ─── TLDR SECTION ─────────────────────────────────────────────────────────────
function TldrSection() {
  return (
    <section style={{
      padding: "40px 40px 100px",
      maxWidth: "1100px",
      margin: "0 auto",
      width: "100%",
    }}>
      <div style={{
        display: "grid",
        gridTemplateColumns: "auto 1fr",
        gap: "clamp(20px, 4vw, 56px)",
        alignItems: "baseline",
      }} className="tldr-grid">
        <span style={{
          fontFamily: "var(--font-mono)",
          fontSize: "11px",
          letterSpacing: "0.18em",
          textTransform: "uppercase",
          color: "var(--bg)",
          background: "var(--accent)",
          padding: "5px 10px",
          borderRadius: "3px",
          fontWeight: 600,
          justifySelf: "start",
          alignSelf: "start",
          marginTop: "6px",
        }}>tl;dr</span>

        <p style={{
          fontFamily: "var(--font-mono)",
          fontSize: "clamp(16px, 1.7vw, 20px)",
          color: "var(--text)",
          lineHeight: 1.55,
          maxWidth: "68ch",
          textWrap: "pretty",
        }}>
          If you have no marketing team,{" "}
          <span style={{ color: "var(--accent)" }}>I can be a founding member alongside a paid traffic specialist</span>,
          and we'll be able to run growth and experiments for a year or two before any more people need to be hired;
          if there is an already existing team, I'll be happy to either{" "}
          <span style={{ color: "var(--accent-2)" }}>consult you</span> or{" "}
          <span style={{ color: "var(--accent-2)" }}>join your team as a contractor or full-time</span>.
        </p>
      </div>
    </section>
  );
}

// ─── SECTION LABEL ────────────────────────────────────────────────────────────
function SectionLabel({ tag, children }) {
  return (
    <div style={{ display: "flex", alignItems: "center", gap: "16px" }}>
      <span style={{
        fontFamily: "var(--font-mono)",
        fontSize: "10px",
        letterSpacing: "0.15em",
        textTransform: "uppercase",
        color: "var(--accent-2)",
        flexShrink: 0,
      }}>{tag}</span>
      <div style={{ flex: 1, height: "1px", background: "var(--border)" }} />
      <h2 style={{
        fontFamily: "var(--font-display)",
        fontWeight: 700,
        fontSize: "clamp(24px, 3.5vw, 40px)",
        letterSpacing: "-0.02em",
        color: "var(--text)",
        flexShrink: 0,
      }}>{children}</h2>
    </div>
  );
}

// ─── WHAT I DO SECTION ────────────────────────────────────────────────────────
const SKILL_AREAS = [
  {
    no: "01",
    title: "Landing pages",
    body: "I write copy and structure for landing pages, then build them in a landing page builder — making sure experiments are set up so we know when we get significant results, and that we're sure how to interpret them. AI speeds a lot of this up now, but you need to know how to guide it and what to look out for. I do. Some things still go faster without AI, and it helps to know when.",
    tools: ["Unbounce", "Instapage", "Tilda", "Squarespace", "Webflow", "Lovable", "Claude Code"],
  },
  {
    no: "02",
    title: "Website development direction",
    body: "For complex websites, you need to structure information around who your audience is, how you expect them to discover the product, how you want them to use it, and how much you want to charge them for it. At ANNA, I direct a mixed team (design, front end & back end, SEO, copy) building a financial and tax tech product website in the UK. Every product is AI now — we started in 2017, so we mostly have an idea what we're doing.",
    tools: ["Cross-team direction", "Information architecture", "Design system constraints"],
  },
  {
    no: "03",
    title: "AI workflows for web teams",
    body: "We built our own Claude workflow that lets marketers and product owners ship web pages and actual useful online tools — calculators, quizzes, tax-status checkers — without help from designers or developers, while staying inside the company's design system and main website's components. One person with Claude now ships in a day what previously took a designer, copywriter, and developer a full week.",
    tools: ["Claude", "Custom workflows", "Design system constraints"],
  },
  {
    no: "04",
    title: "Blog & content direction",
    body: "We started building a blog in 2019 under my direction. It has grown into a full-blown media — attracting free search traffic, converting leads, and generating new content. Apart from directing development (priorities, CMS, design & tech backlog), I directed content production with in-house designers and copywriters, and established the publishing and distribution process.",
    tools: ["Editorial planning", "CMS strategy", "Distribution"],
  },
  {
    no: "05",
    title: "Email automations",
    body: "In rapidly growing companies it's often required to use more than just one email or CRM system — relying on a single tool is usually not enough and possibly risky. The trick is to know what you actually need, why you set things up the way you do, and how to keep the business from depending too much on data stored in external services. I use these tools to nurture leads and send mass emails, but I integrate them with the actual data source on customers — which in many cases is the core of the business — kept separately.",
    tools: ["Intercom", "Mailchimp", "Hubspot", "Sendgrid", "Twilio", "Klaviyo"],
  },
  {
    no: "06",
    title: "Web & app funnel analytics",
    body: "With everything above, it helps to know how to analyse what you've done: set up experiments, measure results, make sure they're reproducible, come up with more hypotheses, repeat. That takes statistics, critical thinking, and the technical expertise to set experiments up — tracking, conversion goals, the lot. LLMs help here too: Claude and Codex are great for spinning up dashboards to monitor results.",
    tools: ["Google Analytics", "Matomo", "Hotjar", "GTM", "Adjust"],
  },
];

function WhatIDoSection() {
  return (
    <section id="work" style={{
      padding: "120px 40px",
      maxWidth: "1100px",
      margin: "0 auto",
      width: "100%",
    }}>
      <SectionLabel tag="01 — my work">What I do</SectionLabel>

      <div style={{
        marginTop: "56px",
        display: "flex",
        flexDirection: "column",
        gap: "1px",
        background: "var(--border)",
        border: "1px solid var(--border)",
        borderRadius: "var(--radius-md)",
        overflow: "hidden",
      }}>
        {SKILL_AREAS.map(area => (
          <SkillRow key={area.no} {...area} />
        ))}
      </div>
    </section>
  );
}

function SkillRow({ no, title, body, tools }) {
  const [hover, setHover] = useState(false);
  return (
    <div
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      style={{
        display: "grid",
        gridTemplateColumns: "auto 1fr 1fr",
        gap: "clamp(20px, 4vw, 56px)",
        padding: "32px clamp(20px, 3vw, 40px)",
        background: hover ? "var(--bg-3)" : "var(--bg-2)",
        transition: "background 0.2s",
      }}
      className="skill-row"
    >
      <div style={{
        fontFamily: "var(--font-mono)",
        fontSize: "12px",
        color: hover ? "var(--accent)" : "var(--text-dim)",
        letterSpacing: "0.08em",
        transition: "color 0.2s",
        paddingTop: "4px",
      }}>{no}</div>

      <h3 style={{
        fontFamily: "var(--font-display)",
        fontWeight: 600,
        fontSize: "clamp(22px, 2.6vw, 30px)",
        letterSpacing: "-0.015em",
        color: "var(--text)",
        lineHeight: 1.1,
        textWrap: "balance",
      }}>{title}</h3>

      <div style={{ display: "flex", flexDirection: "column", gap: "20px" }}>
        <p style={{
          fontFamily: "var(--font-mono)",
          fontSize: "13px",
          color: "var(--text-dim)",
          lineHeight: 1.65,
        }}>{body}</p>

        <div style={{ display: "flex", flexWrap: "wrap", gap: "6px" }}>
          {tools.map(tool => (
            <span key={tool} style={{
              fontFamily: "var(--font-mono)",
              fontSize: "10px",
              letterSpacing: "0.06em",
              color: "var(--text-dim)",
              border: "1px solid var(--border)",
              borderRadius: "3px",
              padding: "3px 8px",
              background: "var(--bg)",
            }}>{tool}</span>
          ))}
        </div>
      </div>
    </div>
  );
}

// ─── PROJECTS SECTION ─────────────────────────────────────────────────────────
const PROJECTS = [
  {
    title: "Invoice Generator",
    href: "https://anna.money/free-tools/invoice-generator/",
    blurb: "A free tool with all the features competitors offer — only with better design and no ads. Attracts free search traffic that engages well, sending strong signals to search engines and attracting even more traffic. Bonus: people learn about ANNA, and some convert to paid customers.",
    tags: ["Free tools", "SEO", "Conversion"],
  },
  {
    title: "Meeting Cost Calculator",
    href: "https://anna.money/free-tools/meeting-cost-calculator/",
    blurb: "A fun, useful tool that shows businesses how much their meetings cost them. Thanks to Claude, this whole project took about 3 hours of pure work — design to release — with no help from design or dev. Possible thanks to the Claude workflows we built earlier with the front-end team.",
    tags: ["Claude workflow", "3 hours", "Solo build"],
  },
  {
    title: "Income Tax Calculator",
    href: "https://anna.money/free-tools/income-tax-calculator/",
    blurb: "One of the most successful tools SEO-wise — driving relevant, engaged traffic. Free-tools strategy at its purest: be genuinely useful, and the rankings follow.",
    tags: ["SEO", "High-traffic", "Engagement"],
  },
  {
    title: "Work From Home Expenses Calculator",
    href: "https://anna.money/free-tools/work-from-home-expenses-calculator/",
    blurb: "Helps home-based business owners — freelancers, sole traders, smaller LTDs — calculate how much of their home expenses can be categorised as business expenses for tax reporting to HMRC.",
    tags: ["Domain-specific", "HMRC", "Tax tools"],
  },
  {
    title: "ANNA Free Tools — full catalogue",
    href: "https://anna.money/free-tools",
    blurb: "All of them, made with one purpose: attract free search traffic, get people to spend time and engage, and eventually sign up. Even without sign-ups, the engaged traffic helps rank higher on Google for relevant queries.",
    tags: ["Catalogue", "Strategy"],
  },
  {
    title: "Mystic Mog the Business Astrologist",
    href: "https://anna.money/blog/updates/meet-mystic-mog-annas-ai-cat-astrologist/",
    blurb: "Not very successful PR-wise, but fun. A quick internal hackathon project when ChatGPT 3.5 was released — start to public release in 24 hours.",
    tags: ["Hackathon", "24 hours", "GPT-3.5 era"],
  },
];

function ProjectsSection() {
  return (
    <section id="experiments" style={{
      padding: "120px 40px",
      maxWidth: "1100px",
      margin: "0 auto",
      width: "100%",
    }}>
      <SectionLabel tag="02 — experiments">Selected projects</SectionLabel>

      <p style={{
        marginTop: "32px",
        fontFamily: "var(--font-mono)",
        fontSize: "14px",
        color: "var(--text-dim)",
        lineHeight: 1.65,
        maxWidth: "640px",
      }}>
        Some favorites from the work catalogue — built mostly under the
        free-tools-for-SEO thesis at ANNA, with a couple of quick experiments thrown in.
      </p>

      <div style={{
        marginTop: "48px",
        display: "grid",
        gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
        gap: "16px",
      }}>
        {PROJECTS.map(p => <ProjectCard key={p.title} {...p} />)}
      </div>
    </section>
  );
}

function ProjectCard({ title, href, blurb, tags }) {
  const [hover, setHover] = useState(false);
  return (
    <a
      href={href}
      target="_blank"
      rel="noopener noreferrer"
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      style={{
        display: "flex",
        flexDirection: "column",
        gap: "16px",
        padding: "28px",
        background: hover ? "var(--bg-3)" : "var(--bg-2)",
        border: `1px solid ${hover ? "var(--accent)" : "var(--border)"}`,
        borderRadius: "var(--radius-md)",
        textDecoration: "none",
        color: "inherit",
        transition: "background 0.2s, border-color 0.2s, transform 0.2s",
        transform: hover ? "translateY(-2px)" : "none",
        position: "relative",
        overflow: "hidden",
      }}
    >
      <div style={{
        display: "flex",
        alignItems: "flex-start",
        justifyContent: "space-between",
        gap: "12px",
      }}>
        <h3 style={{
          fontFamily: "var(--font-display)",
          fontWeight: 600,
          fontSize: "20px",
          letterSpacing: "-0.015em",
          color: hover ? "var(--accent)" : "var(--text)",
          lineHeight: 1.2,
          transition: "color 0.2s",
        }}>{title}</h3>
        <span style={{
          fontFamily: "var(--font-mono)",
          fontSize: "16px",
          color: hover ? "var(--accent)" : "var(--text-dim)",
          flexShrink: 0,
          transition: "color 0.2s, transform 0.2s",
          transform: hover ? "translate(2px, -2px)" : "none",
        }}>↗</span>
      </div>

      <p style={{
        fontFamily: "var(--font-mono)",
        fontSize: "12px",
        color: "var(--text-dim)",
        lineHeight: 1.6,
        flex: 1,
      }}>{blurb}</p>

      <div style={{ display: "flex", flexWrap: "wrap", gap: "6px" }}>
        {tags.map(t => (
          <span key={t} style={{
            fontFamily: "var(--font-mono)",
            fontSize: "10px",
            letterSpacing: "0.06em",
            color: "var(--accent-2)",
            border: "1px solid oklch(0.72 0.16 195 / 0.3)",
            borderRadius: "3px",
            padding: "2px 8px",
          }}>{t}</span>
        ))}
      </div>
    </a>
  );
}

// ─── WHAT I DON'T DO SECTION ──────────────────────────────────────────────────
const DONTS = [
  {
    title: "Drive paid traffic",
    body: "Let's get a CPC specialist alongside me, and you'll have a full in-house marketing team for at least a year — depending on how fast you want to grow.",
  },
  {
    title: "Detailed web design and design systems",
    body: "I have enough experience to start without a dedicated designer, but in the long run I work best in a small team that usually involves one. That said, even a basic version of brand guidelines is enough for a quick start.",
  },
  {
    title: "Web development",
    body: "I know and regularly use basic HTML and CSS, but I've never been trained as a full-time developer. Any complex website will eventually need a dedicated developer. LLMs make things a bit easier and this can be postponed for a while — temporary workarounds exist.",
  },
];

function DontsSection() {
  return (
    <section style={{
      padding: "120px 40px",
      maxWidth: "1100px",
      margin: "0 auto",
      width: "100%",
    }}>
      <SectionLabel tag="aside">What I don't do</SectionLabel>

      <p style={{
        marginTop: "32px",
        fontFamily: "var(--font-mono)",
        fontSize: "14px",
        color: "var(--text-dim)",
        lineHeight: 1.65,
        maxWidth: "640px",
      }}>
        Honesty first — these are the things you should hire someone else for.
      </p>

      <div style={{
        marginTop: "40px",
        display: "grid",
        gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))",
        gap: "16px",
      }}>
        {DONTS.map(d => (
          <div key={d.title} style={{
            padding: "28px",
            border: "1px solid var(--border)",
            borderRadius: "var(--radius-md)",
            background: "var(--bg-2)",
            position: "relative",
          }}>
            <span style={{
              fontFamily: "var(--font-mono)",
              fontSize: "20px",
              color: "oklch(0.72 0.18 30 / 0.7)",
              lineHeight: 1,
              marginBottom: "12px",
              display: "inline-block",
            }}>×</span>
            <h3 style={{
              fontFamily: "var(--font-display)",
              fontWeight: 600,
              fontSize: "18px",
              color: "var(--text)",
              marginBottom: "12px",
              letterSpacing: "-0.01em",
              lineHeight: 1.25,
            }}>{d.title}</h3>
            <p style={{
              fontFamily: "var(--font-mono)",
              fontSize: "12px",
              color: "var(--text-dim)",
              lineHeight: 1.6,
            }}>{d.body}</p>
          </div>
        ))}
      </div>
    </section>
  );
}

// ─── CONTACT SECTION ──────────────────────────────────────────────────────────
function ContactSection() {
  const [sent, setSent] = useState(false);
  const [val, setVal] = useState({ email: "", msg: "" });

  const inputStyle = {
    width: "100%",
    background: "var(--bg-3)",
    border: "1px solid var(--border)",
    borderRadius: "var(--radius-sm)",
    color: "var(--text)",
    fontFamily: "var(--font-mono)",
    fontSize: "13px",
    padding: "12px 16px",
    outline: "none",
    transition: "border-color 0.15s",
  };

  return (
    <section id="contact" style={{
      padding: "120px 40px 80px",
      maxWidth: "1100px",
      margin: "0 auto",
      width: "100%",
    }}>
      <SectionLabel tag="03 — contact">Want to talk?</SectionLabel>

      <div style={{
        marginTop: "48px",
        display: "grid",
        gridTemplateColumns: "1fr 1fr",
        gap: "clamp(32px, 6vw, 80px)",
        alignItems: "start",
      }} className="contact-grid">
        <div>
          <p style={{
            fontFamily: "var(--font-mono)", fontSize: "15px",
            color: "var(--text)", lineHeight: 1.7, marginBottom: "24px",
          }}>
            Get in touch — describe what you need help with, share your existing website,
            or just say anything you'd like to provide details about.
          </p>
          <p style={{
            fontFamily: "var(--font-mono)", fontSize: "13px",
            color: "var(--text-dim)", lineHeight: 1.65, marginBottom: "32px",
          }}>
            Or connect and message me on{" "}
            <a href="https://www.linkedin.com/in/evgeny-nefedov-08b03915/"
               target="_blank" rel="noopener noreferrer"
               style={{
                 color: "var(--accent)", textDecoration: "underline",
                 textDecorationStyle: "dotted", textUnderlineOffset: "3px",
               }}>
              LinkedIn ↗
            </a>.
          </p>
        </div>

        {!sent ? (
          <form onSubmit={e => { e.preventDefault(); setSent(true); }} style={{
            display: "flex", flexDirection: "column", gap: "16px",
          }}>
            <div>
              <label style={{
                display: "block",
                fontFamily: "var(--font-mono)", fontSize: "10px",
                letterSpacing: "0.12em", textTransform: "uppercase",
                color: "var(--accent-2)", marginBottom: "6px",
              }}>Your email</label>
              <input
                type="email"
                placeholder="you@somewhere.com"
                value={val.email}
                onChange={e => setVal(v => ({ ...v, email: e.target.value }))}
                required
                style={inputStyle}
                onFocus={e => e.target.style.borderColor = "var(--accent)"}
                onBlur={e => e.target.style.borderColor = "var(--border)"}
              />
            </div>
            <div>
              <label style={{
                display: "block",
                fontFamily: "var(--font-mono)", fontSize: "10px",
                letterSpacing: "0.12em", textTransform: "uppercase",
                color: "var(--accent-2)", marginBottom: "6px",
              }}>Your message</label>
              <textarea
                placeholder="What you need help with, your existing website, or anything else you'd like to mention…"
                value={val.msg}
                onChange={e => setVal(v => ({ ...v, msg: e.target.value }))}
                required
                rows={6}
                style={{ ...inputStyle, resize: "vertical", lineHeight: 1.55 }}
                onFocus={e => e.target.style.borderColor = "var(--accent)"}
                onBlur={e => e.target.style.borderColor = "var(--border)"}
              />
            </div>
            <button type="submit" style={{
              fontFamily: "var(--font-mono)", fontSize: "12px",
              fontWeight: 500, letterSpacing: "0.08em", textTransform: "uppercase",
              color: "var(--bg)", background: "var(--accent)",
              border: "none", borderRadius: "var(--radius-sm)",
              padding: "14px 28px", cursor: "pointer",
              transition: "opacity 0.15s", alignSelf: "flex-start",
            }}
              onMouseEnter={e => e.currentTarget.style.opacity = "0.85"}
              onMouseLeave={e => e.currentTarget.style.opacity = "1"}
            >Send message →</button>
          </form>
        ) : (
          <div style={{
            border: "1px solid oklch(0.72 0.16 195 / 0.3)",
            borderRadius: "var(--radius-md)",
            padding: "40px",
            display: "flex", flexDirection: "column",
            alignItems: "flex-start", gap: "12px",
            background: "oklch(0.72 0.16 195 / 0.05)",
          }}>
            <span style={{ fontSize: "24px", color: "var(--accent-2)" }}>✓</span>
            <p style={{ fontFamily: "var(--font-mono)", fontSize: "14px", color: "var(--text)", lineHeight: 1.6 }}>
              Message received. I'll get back to you soon.
            </p>
          </div>
        )}
      </div>
    </section>
  );
}

// ─── FOOTER ───────────────────────────────────────────────────────────────────
function Footer() {
  const year = new Date().getFullYear();
  return (
    <footer style={{
      borderTop: "1px solid var(--border)",
      background: "var(--bg-2)",
      padding: "40px",
      marginTop: "auto",
    }}>
      <div style={{
        maxWidth: "1100px",
        margin: "0 auto",
        display: "flex",
        flexWrap: "wrap",
        gap: "24px",
        alignItems: "center",
        justifyContent: "space-between",
      }}>
        <a href="#" style={{ textDecoration: "none", display: "flex", alignItems: "center", gap: "8px" }}>
          <svg width="20" height="20" viewBox="0 0 28 28" fill="none">
            <rect width="28" height="28" rx="5" fill="var(--accent)" />
            <text x="4" y="21" fontFamily="'Syne', sans-serif" fontWeight="800" fontSize="16" fill="oklch(0.17 0.015 255)">tip</text>
          </svg>
          <span style={{
            fontFamily: "var(--font-display)", fontWeight: 700,
            fontSize: "13px", color: "var(--text-dim)",
          }}>things in progress</span>
        </a>

        <nav style={{ display: "flex", gap: "24px", flexWrap: "wrap" }}>
          {NAV_LINKS.map(link => (
            <a key={link.href} href={link.href} style={{
              fontFamily: "var(--font-mono)", fontSize: "11px",
              letterSpacing: "0.06em", textTransform: "uppercase",
              color: "var(--text-dim)", textDecoration: "none",
              transition: "color 0.15s",
            }}
              onMouseEnter={e => e.currentTarget.style.color = "var(--accent)"}
              onMouseLeave={e => e.currentTarget.style.color = "var(--text-dim)"}
            >{link.label}</a>
          ))}
        </nav>

        <div style={{
          fontFamily: "var(--font-mono)", fontSize: "10px",
          letterSpacing: "0.06em", color: "var(--text-dim)",
          width: "100%", paddingTop: "24px",
          borderTop: "1px solid var(--border)",
          display: "flex", flexWrap: "wrap", gap: "16px",
          justifyContent: "space-between", alignItems: "center",
        }}>
          <span>© {year} Things in Progress. All rights reserved.</span>
          <div style={{ display: "flex", gap: "20px" }}>
            <a href="#" style={{ color: "var(--text-dim)", textDecoration: "none" }}>Privacy policy</a>
            <a href="#" style={{ color: "var(--text-dim)", textDecoration: "none" }}>Terms</a>
          </div>
        </div>
      </div>
    </footer>
  );
}

// ─── APP ──────────────────────────────────────────────────────────────────────
function App() {
  const [tweaks, setTweak] = useTweaks(TWEAK_DEFAULTS);

  useEffect(() => {
    applyScheme(tweaks.accentScheme);
  }, [tweaks.accentScheme]);

  return (
    <>
      <style>{`
        @keyframes marquee {
          from { transform: translateX(0); }
          to   { transform: translateX(-33.333%); }
        }
        @keyframes pulse {
          0%, 100% { opacity: 1; transform: scale(1); }
          50%       { opacity: 0.5; transform: scale(0.8); }
        }
        .desktop-nav { display: flex !important; }
        .mobile-menu-btn { display: none !important; }
        @media (max-width: 768px) {
          .skill-row { grid-template-columns: 1fr !important; gap: 12px !important; }
        }
        @media (max-width: 640px) {
          .desktop-nav { display: none !important; }
          .mobile-menu-btn { display: flex !important; }
          .contact-grid { grid-template-columns: 1fr !important; }
          .tldr-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
        }
      `}</style>

      <Header headerStyle={tweaks.headerStyle} />

      <main style={{ flex: 1, display: "flex", flexDirection: "column" }}>
        <Hero />
        <TldrSection />
        {tweaks.showMarquee && <Marquee />}
        <WhatIDoSection />
        <ProjectsSection />
        <DontsSection />
        <ContactSection />
      </main>

      <Footer />

      <TweaksPanel>
        <TweakSection label="Accent color scheme">
          <TweakRadio
            id="accentScheme"
            options={[
              { value: "yellow-cyan", label: "Yellow + Cyan" },
              { value: "amber-cyan", label: "Amber + Cyan" },
              { value: "orange-pink", label: "Orange + Pink" },
            ]}
            value={tweaks.accentScheme}
            onChange={v => setTweak("accentScheme", v)}
          />
        </TweakSection>
        <TweakSection label="Header style">
          <TweakRadio
            id="headerStyle"
            options={[
              { value: "floating", label: "Floating" },
              { value: "full-width", label: "Full-width" },
            ]}
            value={tweaks.headerStyle}
            onChange={v => setTweak("headerStyle", v)}
          />
        </TweakSection>
        <TweakSection label="Extras">
          <TweakToggle
            id="showMarquee"
            label="Scrolling marquee"
            value={tweaks.showMarquee}
            onChange={v => setTweak("showMarquee", v)}
          />
        </TweakSection>
      </TweaksPanel>
    </>
  );
}

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