// Samuel Kwizera — Founder Portfolio
// Components

const { useState, useEffect, useRef } = React;

// ---------- Small primitives ----------

const Pill = ({ children, tone = "ink" }) => {
  const tones = {
    ink: { bg: "rgba(20,22,24,0.06)", color: "var(--ink)", border: "rgba(20,22,24,0.08)" },
    accent: { bg: "color-mix(in oklch, var(--accent) 12%, transparent)", color: "var(--accent-deep)", border: "color-mix(in oklch, var(--accent) 25%, transparent)" },
    ghost: { bg: "transparent", color: "var(--ink-soft)", border: "rgba(20,22,24,0.12)" }
  };
  const s = tones[tone];
  return (
    <span style={{
      display: "inline-flex", alignItems: "center", gap: 6,
      padding: "5px 10px", borderRadius: 999,
      fontSize: 12, fontWeight: 500, letterSpacing: 0.1,
      background: s.bg, color: s.color, border: `1px solid ${s.border}`,
      fontFamily: "var(--ui)"
    }}>{children}</span>
  );
};

const Dot = ({ live }) => (
  <span style={{
    width: 7, height: 7, borderRadius: 999,
    background: live ? "var(--accent)" : "var(--ink-soft)",
    boxShadow: live ? `0 0 0 4px color-mix(in oklch, var(--accent) 25%, transparent)` : "none",
    animation: live ? "pulse 2.4s ease-in-out infinite" : "none",
    flexShrink: 0
  }} />
);

const SectionLabel = ({ num, children }) => (
  <div style={{
    display: "flex", alignItems: "center", gap: 14,
    fontFamily: "var(--ui)", fontSize: 12, fontWeight: 500,
    letterSpacing: 1.6, textTransform: "uppercase",
    color: "var(--ink-soft)", marginBottom: 28
  }}>
    <span style={{ color: "var(--accent-deep)", fontVariantNumeric: "tabular-nums" }}>{num}</span>
    <span style={{ width: 28, height: 1, background: "currentColor", opacity: 0.4 }} />
    <span>{children}</span>
  </div>
);

// ---------- Top nav ----------

function TopNav({ active, onJump }) {
  const items = [
    { id: "work", label: "Work" },
    { id: "courtava", label: "Courtava" },
    { id: "projects", label: "Projects" },
    { id: "skills", label: "Skills" },
    { id: "contact", label: "Contact" }
  ];
  return (
    <nav style={{
      position: "fixed", top: 0, left: 0, right: 0, zIndex: 50,
      backdropFilter: "blur(14px) saturate(140%)",
      WebkitBackdropFilter: "blur(14px) saturate(140%)",
      background: "color-mix(in oklch, var(--bg) 78%, transparent)",
      borderBottom: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
      fontFamily: "var(--ui)"
    }}>
      <div style={{
        maxWidth: 1240, margin: "0 auto", padding: "16px 40px",
        display: "flex", alignItems: "center", justifyContent: "space-between"
      }}>
        <a href="#top" onClick={(e) => { e.preventDefault(); onJump("top"); }} style={{
          display: "flex", alignItems: "center", gap: 10, textDecoration: "none", color: "var(--ink)"
        }}>
          <span style={{
            width: 28, height: 28, borderRadius: 8,
            background: "var(--ink)", color: "var(--bg)",
            display: "grid", placeItems: "center",
            fontFamily: "var(--display)", fontSize: 16, fontStyle: "italic", fontWeight: 500
          }}>S</span>
          <span style={{ fontSize: 14, fontWeight: 500, letterSpacing: -0.1 }}>Samuel Kwizera</span>
          <span style={{ fontSize: 13, color: "var(--ink-soft)", marginLeft: 4 }}>— Founder, Courtava</span>
        </a>
        <div style={{ display: "flex", alignItems: "center", gap: 4 }}>
          {items.map(it => (
            <button key={it.id} onClick={() => onJump(it.id)} style={{
              padding: "8px 14px", borderRadius: 8, border: "none",
              background: active === it.id ? "color-mix(in oklch, var(--ink) 6%, transparent)" : "transparent",
              color: active === it.id ? "var(--ink)" : "var(--ink-soft)",
              fontSize: 13.5, fontWeight: 500, fontFamily: "var(--ui)",
              cursor: "pointer", transition: "all 0.18s ease"
            }}
            onMouseEnter={(e) => { if (active !== it.id) e.currentTarget.style.color = "var(--ink)"; }}
            onMouseLeave={(e) => { if (active !== it.id) e.currentTarget.style.color = "var(--ink-soft)"; }}>
              {it.label}
            </button>
          ))}
          <a href="https://mail.google.com/mail/?view=cm&to=sam@courtava.com" target="_blank" rel="noreferrer" style={{
            marginLeft: 12, padding: "9px 16px", borderRadius: 999,
            background: "var(--ink)", color: "var(--bg)",
            fontSize: 13, fontWeight: 500, textDecoration: "none",
            display: "inline-flex", alignItems: "center", gap: 8,
            transition: "transform 0.18s ease"
          }}
          onMouseEnter={(e) => e.currentTarget.style.transform = "translateY(-1px)"}
          onMouseLeave={(e) => e.currentTarget.style.transform = "translateY(0)"}>
            Get in touch
            <svg width="11" height="11" viewBox="0 0 11 11" fill="none"><path d="M2 9L9 2M9 2H3.5M9 2V7.5" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round"/></svg>
          </a>
        </div>
      </div>
    </nav>
  );
}

// ---------- Hero ----------

function Hero() {
  const [time, setTime] = useState("");
  useEffect(() => {
    const update = () => {
      const opts = { timeZone: "Africa/Kigali", hour: "2-digit", minute: "2-digit", hour12: false };
      setTime(new Intl.DateTimeFormat("en-GB", opts).format(new Date()) + " CAT");
    };
    update();
    const id = setInterval(update, 30000);
    return () => clearInterval(id);
  }, []);

  return (
    <section id="top" style={{
      paddingTop: 140, paddingBottom: 100,
      maxWidth: 1240, margin: "0 auto", padding: "140px 40px 100px"
    }}>
      <div style={{
        display: "grid",
        gridTemplateColumns: "1.45fr 1fr",
        gap: 80, alignItems: "center"
      }}>
        {/* Left: copy */}
        <div>
          <div style={{
            display: "inline-flex", alignItems: "center", gap: 10,
            padding: "7px 14px", borderRadius: 999,
            background: "color-mix(in oklch, var(--accent) 10%, transparent)",
            border: "1px solid color-mix(in oklch, var(--accent) 22%, transparent)",
            fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--accent-deep)",
            fontWeight: 500, marginBottom: 36
          }}>
            <Dot live />
            Building Courtava in Kigali · {time}
          </div>

          <h1 style={{
            fontFamily: "var(--display)", fontWeight: 400,
            fontSize: "clamp(54px, 7vw, 96px)",
            lineHeight: 0.98, letterSpacing: -0.02,
            color: "var(--ink)", margin: 0, textWrap: "balance"
          }}>
            Software engineer<br />
            building <em style={{ fontStyle: "italic", color: "var(--accent-deep)" }}>products</em><br />
            people return to.
          </h1>

          <p style={{
            fontFamily: "var(--ui)", fontSize: 19, lineHeight: 1.55,
            color: "var(--ink-soft)", marginTop: 36, maxWidth: 540,
            textWrap: "pretty"
          }}>
            I'm Samuel — founder of <strong style={{ color: "var(--ink)", fontWeight: 600 }}>Courtava</strong>,
            a sports community platform helping players find courts, book games and grow local scenes.
            I design, build and ship — across mobile, web and ML.
          </p>

          <div style={{ display: "flex", gap: 12, marginTop: 44, flexWrap: "wrap" }}>
            <a href="#courtava" onClick={(e) => { e.preventDefault(); document.getElementById("courtava").scrollIntoView({ behavior: "smooth", block: "start" }); }}
              style={{
                padding: "13px 22px", borderRadius: 999,
                background: "var(--ink)", color: "var(--bg)",
                fontFamily: "var(--ui)", fontSize: 14, fontWeight: 500,
                textDecoration: "none", display: "inline-flex", alignItems: "center", gap: 10
              }}>
              See the Courtava case study
              <span style={{ display: "inline-flex" }}><svg width="13" height="13" viewBox="0 0 13 13" fill="none"><path d="M2 11L11 2M11 2H4M11 2V9" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/></svg></span>
            </a>
            <a href="https://github.com/Samkwizera" target="_blank" rel="noreferrer"
              style={{
                padding: "13px 22px", borderRadius: 999,
                background: "transparent", color: "var(--ink)",
                border: "1px solid color-mix(in oklch, var(--ink) 18%, transparent)",
                fontFamily: "var(--ui)", fontSize: 14, fontWeight: 500,
                textDecoration: "none", display: "inline-flex", alignItems: "center", gap: 10
              }}>
              <svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>
              github.com/Samkwizera
            </a>
            <a href="https://mail.google.com/mail/?view=cm&to=sam@courtava.com" target="_blank" rel="noreferrer"
              style={{
                padding: "13px 22px", borderRadius: 999,
                background: "var(--accent)", color: "var(--bg)",
                fontFamily: "var(--ui)", fontSize: 14, fontWeight: 500,
                textDecoration: "none", display: "inline-flex", alignItems: "center", gap: 10
              }}>
              Get in touch
              <svg width="13" height="13" viewBox="0 0 13 13" fill="none"><path d="M2 11L11 2M11 2H4M11 2V9" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/></svg>
            </a>
          </div>

          <div style={{
            display: "flex", gap: 36, marginTop: 64,
            paddingTop: 32, borderTop: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
            fontFamily: "var(--ui)"
          }}>
            {[
              { k: "Currently", v: "Founder of Courtava" },
              { k: "Also at", v: "Velozly · Frontend" },
              { k: "Based in", v: "Kigali, Rwanda" }
            ].map(item => (
              <div key={item.k}>
                <div style={{ fontSize: 11.5, letterSpacing: 1.4, textTransform: "uppercase", color: "var(--ink-soft)", marginBottom: 6 }}>{item.k}</div>
                <div style={{ fontSize: 14, color: "var(--ink)", fontWeight: 500 }}>{item.v}</div>
              </div>
            ))}
          </div>
        </div>

        {/* Right: portrait */}
        <div style={{ position: "relative" }}>
          <div style={{
            position: "relative", aspectRatio: "4/5",
            borderRadius: 4, overflow: "hidden",
            background: "var(--ink)",
            boxShadow: "0 30px 80px -30px rgba(20,22,24,0.35), 0 8px 24px -8px rgba(20,22,24,0.15)"
          }}>
            <img src="assets/portrait.jpg" alt="Samuel Kwizera"
              style={{ width: "100%", height: "100%", objectFit: "cover", filter: "contrast(1.02) saturate(0.98)" }} />
            {/* Caption strip */}
            <div style={{
              position: "absolute", left: 0, right: 0, bottom: 0,
              padding: "16px 20px",
              background: "linear-gradient(to top, rgba(0,0,0,0.55), transparent)",
              color: "rgba(255,255,255,0.95)",
              fontFamily: "var(--ui)", fontSize: 12, letterSpacing: 0.4,
              display: "flex", justifyContent: "space-between"
            }}>
              <span>SAMUEL KWIZERA IHIMBAZWE</span>
              <span style={{ opacity: 0.7 }}>EST. 2024</span>
            </div>
          </div>
          {/* Floating cards */}
          <div style={{
            position: "absolute", left: -28, top: 40,
            background: "var(--bg)",
            border: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
            borderRadius: 12, padding: "12px 14px",
            boxShadow: "0 12px 30px -12px rgba(20,22,24,0.18)",
            fontFamily: "var(--ui)", fontSize: 12,
            display: "flex", alignItems: "center", gap: 10
          }}>
            <span style={{ fontSize: 18 }}>🏟️</span>
            <div>
              <div style={{ fontWeight: 600, color: "var(--ink)" }}>Courtava</div>
              <div style={{ color: "var(--ink-soft)", fontSize: 11 }}>Beta · Kigali</div>
            </div>
          </div>
          <div style={{
            position: "absolute", right: -20, bottom: 60,
            background: "var(--ink)", color: "var(--bg)",
            borderRadius: 12, padding: "14px 16px",
            boxShadow: "0 12px 30px -12px rgba(20,22,24,0.4)",
            fontFamily: "var(--ui)", fontSize: 12, lineHeight: 1.4,
            maxWidth: 200
          }}>
            <div style={{ display: "flex", alignItems: "center", gap: 6, opacity: 0.7, fontSize: 10.5, letterSpacing: 1, textTransform: "uppercase", marginBottom: 4 }}>
              <span style={{ width: 5, height: 5, borderRadius: 999, background: "var(--accent)" }} />
              Now shipping
            </div>
            Real-time court availability across Kigali
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Marquee of expertise ----------

function Marquee() {
  const items = [
    "TypeScript", "React & Next.js", "Flutter", "Firebase", "Mapbox",
    "Machine Learning", "Python", "Product Strategy", "B2B SaaS",
    "REST APIs", "Real-time Systems", "UX Engineering"
  ];
  return (
    <div style={{
      borderTop: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
      borderBottom: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
      overflow: "hidden", padding: "22px 0",
      background: "color-mix(in oklch, var(--ink) 2%, var(--bg))"
    }}>
      <div style={{
        display: "flex", gap: 48, whiteSpace: "nowrap",
        animation: "marquee 40s linear infinite",
        fontFamily: "var(--ui)", fontSize: 14, color: "var(--ink-soft)",
        width: "max-content"
      }}>
        {[...items, ...items, ...items].map((it, i) => (
          <span key={i} style={{ display: "inline-flex", alignItems: "center", gap: 48 }}>
            {it}
            <span style={{ width: 4, height: 4, borderRadius: 999, background: "var(--accent)", flexShrink: 0 }} />
          </span>
        ))}
      </div>
    </div>
  );
}

// ---------- Summary section ----------

function Summary() {
  return (
    <section id="work" style={{ maxWidth: 1240, margin: "0 auto", padding: "120px 40px 80px" }}>
      <div style={{ display: "grid", gridTemplateColumns: "260px 1fr", gap: 80 }}>
        <SectionLabel num="01">Summary</SectionLabel>
        <div>
          <p style={{
            fontFamily: "var(--display)", fontWeight: 400,
            fontSize: "clamp(28px, 3vw, 40px)", lineHeight: 1.25, letterSpacing: -0.01,
            color: "var(--ink)", margin: 0, maxWidth: 820, textWrap: "balance"
          }}>
            I build software that ships. From a sports platform connecting Kigali's
            community to ML systems and B2B SaaS — I move from
            <em style={{ fontStyle: "italic", color: "var(--accent-deep)" }}> idea</em> to
            <em style={{ fontStyle: "italic", color: "var(--accent-deep)" }}> production</em> end-to-end.
          </p>
          <div style={{
            marginTop: 56, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 40,
            paddingTop: 40, borderTop: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)"
          }}>
            {[
              { stat: "1", label: "Product founded", sub: "Courtava — sports community platform" },
              { stat: "10+", label: "Apps shipped", sub: "Mobile, web, ML, B2B SaaS" },
              { stat: "4", label: "Stacks in production", sub: "Flutter · Next.js · Python · Firebase" }
            ].map((c, i) => (
              <div key={i}>
                <div style={{
                  fontFamily: "var(--display)", fontSize: 56, fontWeight: 400,
                  color: "var(--ink)", lineHeight: 1, letterSpacing: -0.02,
                  fontVariantNumeric: "tabular-nums"
                }}>{c.stat}</div>
                <div style={{ fontFamily: "var(--ui)", fontSize: 13.5, fontWeight: 600, color: "var(--ink)", marginTop: 12 }}>{c.label}</div>
                <div style={{ fontFamily: "var(--ui)", fontSize: 13, color: "var(--ink-soft)", marginTop: 4, lineHeight: 1.5 }}>{c.sub}</div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Courtava case study ----------

function Courtava() {
  const [tab, setTab] = useState("product");
  const tabs = [
    { id: "product", label: "Product" },
    { id: "tech", label: "Tech & architecture" },
    { id: "traction", label: "Early traction" }
  ];

  const bullets = {
    product: [
      { v: "Designed and shipped a Flutter mobile app", d: "letting players discover, book and review sports courts across Kigali — solving a fragmented, mostly word-of-mouth process." },
      { v: "Built real-time court availability", d: "via Firebase Firestore listeners — bookings, cancellations and live status reflected instantly across all clients." },
      { v: "Engineered location-aware discovery", d: "with Mapbox: distance-sorted court listings, in-app navigation and neighborhood-level filtering tuned for Kigali geography." },
      { v: "Owned end-to-end UX decisions", d: "from onboarding flow to booking confirmation — built a design system that scales across iOS and Android." }
    ],
    tech: [
      { v: "Architected a serverless backend on Firebase", d: "(Auth, Firestore, Cloud Functions, Storage) — zero infra ops, pay-per-use scaling, ready for spikes around weekend matches." },
      { v: "Implemented role-based access", d: "for players, court owners and admins — with secure rules and audited write paths to prevent double-bookings." },
      { v: "Designed a modular component library", d: "shared between user app and partner court-owner dashboard for consistent visual language and faster iteration." },
      { v: "Built a Next.js + TypeScript marketing site", d: "and partner web portal — same design tokens, same content models, deployed on Vercel." }
    ],
    traction: [
      { v: "Validated demand with on-the-ground research", d: "across Kigali sports venues — translated player & owner pain points into a focused MVP scope." },
      { v: "Onboarded launch-week courts", d: "and ran the first live bookings — using behavior data to prioritize the next sprint's feature set." },
      { v: "Iterating on a tight product loop", d: "weekly releases informed by direct user feedback, in-app analytics and venue-side metrics." }
    ]
  };

  return (
    <section id="courtava" style={{ background: "var(--ink)", color: "var(--bg)", padding: "120px 0" }}>
      <div style={{ maxWidth: 1240, margin: "0 auto", padding: "0 40px" }}>
        {/* Header */}
        <div style={{ display: "grid", gridTemplateColumns: "260px 1fr", gap: 80, marginBottom: 64 }}>
          <div>
            <div style={{
              display: "flex", alignItems: "center", gap: 14,
              fontFamily: "var(--ui)", fontSize: 12, fontWeight: 500,
              letterSpacing: 1.6, textTransform: "uppercase",
              color: "color-mix(in oklch, var(--bg) 55%, transparent)", marginBottom: 28
            }}>
              <span style={{ color: "var(--accent)", fontVariantNumeric: "tabular-nums" }}>02</span>
              <span style={{ width: 28, height: 1, background: "currentColor", opacity: 0.4 }} />
              <span>Featured Case Study</span>
            </div>
          </div>
          <div>
            <div style={{
              display: "inline-flex", alignItems: "center", gap: 10,
              padding: "6px 12px", borderRadius: 999,
              background: "color-mix(in oklch, var(--accent) 18%, transparent)",
              color: "var(--accent)", fontFamily: "var(--ui)",
              fontSize: 12, fontWeight: 500, marginBottom: 24
            }}>
              <Dot live /> Founder & Lead Engineer · 2024 — Present
            </div>
            <h2 style={{
              fontFamily: "var(--display)", fontWeight: 400,
              fontSize: "clamp(48px, 6.5vw, 88px)", lineHeight: 1, letterSpacing: -0.02,
              margin: 0, color: "var(--bg)"
            }}>
              Courtava.
            </h2>
            <p style={{
              fontFamily: "var(--ui)", fontSize: 20, lineHeight: 1.55,
              color: "color-mix(in oklch, var(--bg) 75%, transparent)",
              maxWidth: 700, marginTop: 24, textWrap: "pretty"
            }}>
              <strong style={{ color: "var(--bg)", fontWeight: 600 }}>The problem:</strong> finding and booking
              a sports court in Kigali still happens over WhatsApp, phone calls and
              guesswork. <strong style={{ color: "var(--bg)", fontWeight: 600 }}>Courtava</strong> is
              a real-time sports community platform — discover courts near you,
              see live availability, book in seconds, and grow your local scene.
            </p>
            <a href="https://courtava.com" target="_blank" rel="noreferrer" style={{
              display: "inline-flex", alignItems: "center", gap: 8, marginTop: 28,
              padding: "11px 22px", borderRadius: 999,
              background: "var(--accent)", color: "var(--bg)",
              fontFamily: "var(--ui)", fontSize: 13.5, fontWeight: 600,
              textDecoration: "none", transition: "opacity 0.18s ease"
            }}
              onMouseEnter={e => e.currentTarget.style.opacity = "0.85"}
              onMouseLeave={e => e.currentTarget.style.opacity = "1"}
            >
              Visit courtava.com
              <svg width="11" height="11" viewBox="0 0 11 11" fill="none"><path d="M2 9L9 2M9 2H3.5M9 2V7.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/></svg>
            </a>
          </div>
        </div>

        {/* Metrics row */}
        <div style={{
          display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 0,
          padding: "32px 0", marginBottom: 56,
          borderTop: "1px solid color-mix(in oklch, var(--bg) 14%, transparent)",
          borderBottom: "1px solid color-mix(in oklch, var(--bg) 14%, transparent)"
        }}>
          {[
            { v: "iOS + Android", k: "Platforms shipped" },
            { v: "Realtime", k: "Booking sync" },
            { v: "Mapbox", k: "Location engine" },
            { v: "Solo founder", k: "Design + engineering" }
          ].map((m, i, arr) => (
            <div key={i} style={{
              padding: "0 32px",
              borderRight: i < arr.length - 1 ? "1px solid color-mix(in oklch, var(--bg) 14%, transparent)" : "none"
            }}>
              <div style={{
                fontFamily: "var(--display)", fontSize: 32, fontWeight: 400,
                color: "var(--bg)", lineHeight: 1.1, letterSpacing: -0.01
              }}>{m.v}</div>
              <div style={{
                fontFamily: "var(--ui)", fontSize: 12, fontWeight: 500,
                letterSpacing: 1.2, textTransform: "uppercase",
                color: "color-mix(in oklch, var(--bg) 55%, transparent)", marginTop: 10
              }}>{m.k}</div>
            </div>
          ))}
        </div>

        {/* Tabs + content */}
        <div style={{ display: "grid", gridTemplateColumns: "1.1fr 1fr", gap: 64, alignItems: "start" }}>
          <div>
            <div style={{
              display: "inline-flex", padding: 4, borderRadius: 999,
              background: "color-mix(in oklch, var(--bg) 8%, transparent)",
              border: "1px solid color-mix(in oklch, var(--bg) 12%, transparent)",
              marginBottom: 32
            }}>
              {tabs.map(t => (
                <button key={t.id} onClick={() => setTab(t.id)} style={{
                  padding: "9px 18px", borderRadius: 999, border: "none",
                  background: tab === t.id ? "var(--bg)" : "transparent",
                  color: tab === t.id ? "var(--ink)" : "color-mix(in oklch, var(--bg) 70%, transparent)",
                  fontFamily: "var(--ui)", fontSize: 13, fontWeight: 500,
                  cursor: "pointer", transition: "all 0.18s ease"
                }}>{t.label}</button>
              ))}
            </div>

            <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "grid", gap: 22 }}>
              {bullets[tab].map((b, i) => (
                <li key={i} style={{
                  display: "grid", gridTemplateColumns: "auto 1fr", gap: 16,
                  fontFamily: "var(--ui)", animation: "fadeUp 0.45s ease both",
                  animationDelay: `${i * 60}ms`
                }}>
                  <span style={{
                    width: 22, height: 22, borderRadius: 6, flexShrink: 0,
                    marginTop: 2,
                    background: "color-mix(in oklch, var(--accent) 22%, transparent)",
                    color: "var(--accent)", display: "grid", placeItems: "center",
                    fontSize: 12, fontWeight: 600, fontVariantNumeric: "tabular-nums"
                  }}>{i + 1}</span>
                  <div style={{ fontSize: 15, lineHeight: 1.55, color: "color-mix(in oklch, var(--bg) 88%, transparent)" }}>
                    <strong style={{ color: "var(--bg)", fontWeight: 600 }}>{b.v}</strong>
                    <span style={{ color: "color-mix(in oklch, var(--bg) 65%, transparent)" }}> — {b.d}</span>
                  </div>
                </li>
              ))}
            </ul>
          </div>

          {/* Phone mockup */}
          <CourtavaPhone />
        </div>

        {/* Stack pills */}
        <div style={{ marginTop: 64, paddingTop: 32, borderTop: "1px solid color-mix(in oklch, var(--bg) 12%, transparent)" }}>
          <div style={{ fontFamily: "var(--ui)", fontSize: 11.5, letterSpacing: 1.6, textTransform: "uppercase", color: "color-mix(in oklch, var(--bg) 55%, transparent)", marginBottom: 16 }}>Built with</div>
          <div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
            {["Flutter", "Dart", "Firebase Auth", "Firestore", "Cloud Functions", "Mapbox", "Next.js", "TypeScript", "Tailwind", "Vercel"].map(s => (
              <span key={s} style={{
                padding: "7px 14px", borderRadius: 999,
                background: "color-mix(in oklch, var(--bg) 8%, transparent)",
                border: "1px solid color-mix(in oklch, var(--bg) 14%, transparent)",
                color: "color-mix(in oklch, var(--bg) 88%, transparent)",
                fontFamily: "var(--ui)", fontSize: 12.5, fontWeight: 500
              }}>{s}</span>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

function CourtavaPhone() {
  return (
    <div style={{ position: "relative", display: "flex", justifyContent: "center" }}>
      <div style={{
        width: 300, height: 600, borderRadius: 44,
        background: "linear-gradient(140deg, #1c1e22, #2a2d32)",
        padding: 10,
        boxShadow: "0 40px 80px -30px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.06)"
      }}>
        <div style={{
          width: "100%", height: "100%", borderRadius: 36,
          background: "var(--bg)", overflow: "hidden", position: "relative",
          fontFamily: "var(--ui)", color: "var(--ink)"
        }}>
          {/* Status bar */}
          <div style={{ display: "flex", justifyContent: "space-between", padding: "14px 22px 8px", fontSize: 11.5, fontWeight: 600, color: "var(--ink)" }}>
            <span>9:41</span>
            <span style={{ display: "flex", gap: 5, alignItems: "center" }}>
              <span style={{ display: "inline-block", width: 14, height: 8, border: "1px solid currentColor", borderRadius: 2, position: "relative" }}>
                <span style={{ position: "absolute", inset: 1, background: "currentColor", borderRadius: 1 }} />
              </span>
            </span>
          </div>

          {/* Header */}
          <div style={{ padding: "8px 20px 14px" }}>
            <div style={{ fontSize: 11, letterSpacing: 1.2, textTransform: "uppercase", color: "var(--ink-soft)" }}>Tonight in Kigali</div>
            <div style={{ fontFamily: "var(--display)", fontSize: 24, fontWeight: 400, marginTop: 4, letterSpacing: -0.01 }}>Find a court.</div>
          </div>

          {/* Map preview */}
          <div style={{
            margin: "0 16px", height: 130, borderRadius: 16,
            background: `
              radial-gradient(circle at 30% 40%, color-mix(in oklch, var(--accent) 30%, transparent), transparent 40%),
              radial-gradient(circle at 70% 60%, color-mix(in oklch, var(--accent) 18%, transparent), transparent 38%),
              linear-gradient(135deg, oklch(0.94 0.01 165), oklch(0.88 0.02 165))
            `,
            position: "relative", overflow: "hidden"
          }}>
            {/* Streets */}
            <svg viewBox="0 0 280 130" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", opacity: 0.5 }}>
              <path d="M0 40 Q140 20 280 50" stroke="white" strokeWidth="1.5" fill="none" />
              <path d="M0 90 Q140 110 280 80" stroke="white" strokeWidth="1.5" fill="none" />
              <path d="M60 0 Q90 65 70 130" stroke="white" strokeWidth="1.5" fill="none" />
              <path d="M200 0 Q210 65 220 130" stroke="white" strokeWidth="1.5" fill="none" />
            </svg>
            {/* Pins */}
            {[
              { x: 20, y: 30 }, { x: 60, y: 60 }, { x: 75, y: 35 }
            ].map((p, i) => (
              <div key={i} style={{
                position: "absolute", left: `${p.x}%`, top: `${p.y}%`,
                width: 14, height: 14, borderRadius: "50% 50% 50% 0",
                background: "var(--accent)", transform: "rotate(-45deg)",
                border: "2px solid white",
                boxShadow: "0 4px 8px rgba(0,0,0,0.2)",
                animation: `pulse 2.4s ease-in-out infinite`,
                animationDelay: `${i * 0.4}s`
              }} />
            ))}
            <div style={{
              position: "absolute", bottom: 8, left: 10,
              padding: "4px 8px", borderRadius: 999,
              background: "rgba(255,255,255,0.92)",
              fontSize: 10, fontWeight: 600, color: "var(--ink)"
            }}>3 courts nearby</div>
          </div>

          {/* List */}
          <div style={{ padding: "16px 16px 0", display: "grid", gap: 10 }}>
            {[
              { name: "Amahoro Tennis Court", dist: "1.2 km", status: "live", time: "Free at 18:30" },
              { name: "Kigali Heights Padel", dist: "2.4 km", status: "busy", time: "Booked till 20:00" },
              { name: "Nyarutarama Football 5", dist: "3.1 km", status: "live", time: "Free at 19:00" }
            ].map((c, i) => (
              <div key={i} style={{
                padding: "11px 13px", borderRadius: 12,
                background: "color-mix(in oklch, var(--ink) 4%, var(--bg))",
                border: "1px solid color-mix(in oklch, var(--ink) 7%, transparent)",
                display: "grid", gridTemplateColumns: "1fr auto", gap: 8, alignItems: "center"
              }}>
                <div>
                  <div style={{ fontSize: 12.5, fontWeight: 600, color: "var(--ink)" }}>{c.name}</div>
                  <div style={{ fontSize: 10.5, color: "var(--ink-soft)", marginTop: 2, display: "flex", alignItems: "center", gap: 6 }}>
                    <Dot live={c.status === "live"} />
                    {c.time} · {c.dist}
                  </div>
                </div>
                <button style={{
                  padding: "6px 10px", borderRadius: 999, border: "none",
                  background: c.status === "live" ? "var(--ink)" : "color-mix(in oklch, var(--ink) 8%, transparent)",
                  color: c.status === "live" ? "var(--bg)" : "var(--ink-soft)",
                  fontSize: 10.5, fontWeight: 600, fontFamily: "var(--ui)",
                  cursor: c.status === "live" ? "pointer" : "default"
                }}>{c.status === "live" ? "Book" : "Waitlist"}</button>
              </div>
            ))}
          </div>

          {/* Tab bar */}
          <div style={{
            position: "absolute", bottom: 12, left: 16, right: 16,
            padding: "10px 16px", borderRadius: 999,
            background: "var(--ink)", color: "var(--bg)",
            display: "flex", justifyContent: "space-between", alignItems: "center",
            fontSize: 11, fontWeight: 500
          }}>
            {["Discover", "Bookings", "Community", "Me"].map((t, i) => (
              <span key={t} style={{
                opacity: i === 0 ? 1 : 0.55,
                color: i === 0 ? "var(--accent)" : "inherit"
              }}>{t}</span>
            ))}
          </div>
        </div>
      </div>
    </div>
  );
}

// ---------- Other experience: Velozly etc ----------

function Experience() {
  const items = [
    {
      role: "Frontend Developer",
      org: "Velozly",
      meta: "Oct 2025 — Present · Remote",
      tag: "B2B SaaS",
      bullets: [
        "Engineered a high-converting B2B growth landing page in TypeScript and Next.js, directly supporting customer acquisition for the SaaS platform.",
        "Built a B2B growth blueprint dashboard translating complex business strategy into pixel-perfect, accessible interactive UI components."
      ]
    },
    {
      role: "Software Engineering Student",
      org: "African Leadership University",
      meta: "2024 — Present · Kigali",
      tag: "Project-based",
      bullets: [
        "BSc Software Engineering — coursework in Machine Learning, Data Structures, Web Dev, Systems Engineering, DevOps and Databases.",
        "Built and shipped a portfolio of 6+ project-based applications spanning mobile, web, ML and B2B contexts."
      ]
    }
  ];

  return (
    <section style={{ maxWidth: 1240, margin: "0 auto", padding: "120px 40px 60px" }}>
      <div style={{ display: "grid", gridTemplateColumns: "260px 1fr", gap: 80 }}>
        <SectionLabel num="03">Experience</SectionLabel>
        <div style={{ display: "grid", gap: 4 }}>
          {items.map((it, i) => (
            <div key={i} style={{
              display: "grid", gridTemplateColumns: "1fr 2fr", gap: 48,
              padding: "32px 0",
              borderTop: i === 0 ? "1px solid color-mix(in oklch, var(--ink) 12%, transparent)" : "none",
              borderBottom: "1px solid color-mix(in oklch, var(--ink) 12%, transparent)"
            }}>
              <div>
                <div style={{ fontFamily: "var(--ui)", fontSize: 12, color: "var(--ink-soft)", marginBottom: 8 }}>{it.meta}</div>
                <div style={{ fontFamily: "var(--display)", fontSize: 28, fontWeight: 400, color: "var(--ink)", lineHeight: 1.15, letterSpacing: -0.01 }}>{it.org}</div>
                <div style={{ fontFamily: "var(--ui)", fontSize: 14, color: "var(--ink)", marginTop: 6, fontWeight: 500 }}>{it.role}</div>
                <div style={{ marginTop: 14 }}><Pill tone="ghost">{it.tag}</Pill></div>
              </div>
              <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "grid", gap: 14 }}>
                {it.bullets.map((b, j) => (
                  <li key={j} style={{
                    fontFamily: "var(--ui)", fontSize: 15, lineHeight: 1.6,
                    color: "var(--ink-soft)", paddingLeft: 22, position: "relative"
                  }}>
                    <span style={{
                      position: "absolute", left: 0, top: 9,
                      width: 10, height: 1, background: "var(--accent-deep)"
                    }} />
                    {b}
                  </li>
                ))}
              </ul>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ---------- Supporting projects ----------

function Projects() {
  const projects = [
    {
      name: "AMISAG AI",
      cat: "AI · TypeScript",
      desc: "AI-powered virtual networking platform with conversational AI integration.",
      role: "Builder · End-to-end",
      year: "2025",
      github: "https://github.com/Samkwizera/amisag-ai"
    },
    {
      name: "Kigali City Directory",
      cat: "Flutter · Maps",
      desc: "Mobile app connecting residents with hospitals, police, parks and public services across Kigali.",
      role: "Builder · End-to-end",
      year: "2025",
      github: "https://github.com/Samkwizera/individual_assignment_2"
    },
    {
      name: "GarageGuru",
      cat: "Flutter · Marketplace",
      desc: "Two-sided marketplace connecting car owners with garage service providers — dual user roles.",
      role: "Builder · End-to-end",
      year: "2025",
      github: "https://github.com/Bonaeineza31/Garage-Guru"
    },
    {
      name: "Mwitange",
      cat: "USSD · SMS · Healthcare",
      desc: "Connects blood donors with hospitals in real time — designed for low-resource environments.",
      role: "Builder · End-to-end",
      year: "2024",
      github: "https://github.com/Samkwizera"
    },
    {
      name: "Insurance Predictor",
      cat: "ML · Python · FastAPI",
      desc: "Linear regression model predicting US medical insurance charges from demographic & lifestyle factors — live API on Render.",
      role: "ML Engineer",
      year: "2025",
      github: "https://github.com/Samkwizera/linear_regression_model"
    },
    {
      name: "AirBnB Clone v1 & v2",
      cat: "Python · Flask · MySQL",
      desc: "Full MVC architecture with REST API — recreating production patterns end-to-end.",
      role: "Builder · End-to-end",
      year: "2024",
      github: "https://github.com/Samkwizera/alu-AirBnB_clone"
    }
  ];

  return (
    <section id="projects" style={{ maxWidth: 1240, margin: "0 auto", padding: "60px 40px 100px" }}>
      <div style={{ display: "grid", gridTemplateColumns: "260px 1fr", gap: 80 }}>
        <div>
          <SectionLabel num="04">Other projects</SectionLabel>
          <p style={{ fontFamily: "var(--ui)", fontSize: 14, color: "var(--ink-soft)", lineHeight: 1.55, marginTop: -16, maxWidth: 220 }}>
            Things I've shipped while building Courtava — across mobile, web, ML and civic tech.
          </p>
        </div>
        <div style={{
          display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 1,
          background: "color-mix(in oklch, var(--ink) 10%, transparent)",
          border: "1px solid color-mix(in oklch, var(--ink) 10%, transparent)"
        }}>
          {projects.map((p, i) => (
            <article key={i} className="proj-card" style={{
              background: "var(--bg)",
              padding: "28px 28px 24px",
              cursor: "pointer",
              transition: "background 0.2s ease",
              display: "grid", gap: 18, gridTemplateRows: "auto 1fr auto",
              minHeight: 200
            }}>
              <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: 16 }}>
                <div>
                  <div style={{ fontFamily: "var(--ui)", fontSize: 11.5, letterSpacing: 1.4, textTransform: "uppercase", color: "var(--accent-deep)", marginBottom: 8 }}>{p.cat}</div>
                  <h3 style={{ fontFamily: "var(--display)", fontSize: 26, fontWeight: 400, color: "var(--ink)", margin: 0, letterSpacing: -0.01 }}>{p.name}</h3>
                </div>
                <span style={{ fontFamily: "var(--ui)", fontSize: 12, color: "var(--ink-soft)", fontVariantNumeric: "tabular-nums" }}>{p.year}</span>
              </div>
              <p style={{ fontFamily: "var(--ui)", fontSize: 14.5, lineHeight: 1.55, color: "var(--ink-soft)", margin: 0, textWrap: "pretty" }}>{p.desc}</p>
              <div style={{
                display: "flex", justifyContent: "space-between", alignItems: "center",
                paddingTop: 14, borderTop: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
                fontFamily: "var(--ui)", fontSize: 12
              }}>
                <span style={{ color: "var(--ink-soft)" }}>{p.role}</span>
                {p.github ? (
                  <a href={p.github} target="_blank" rel="noreferrer" className="proj-arrow" style={{ display: "inline-flex", alignItems: "center", gap: 6, color: "var(--ink)", fontWeight: 500, transition: "gap 0.2s ease", textDecoration: "none" }}>
                    GitHub <svg width="11" height="11" viewBox="0 0 11 11" fill="none"><path d="M2 9L9 2M9 2H3.5M9 2V7.5" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round"/></svg>
                  </a>
                ) : (
                  <span className="proj-arrow" style={{ display: "inline-flex", alignItems: "center", gap: 6, color: "var(--ink)", fontWeight: 500, transition: "gap 0.2s ease" }}>
                    Read more <svg width="11" height="11" viewBox="0 0 11 11" fill="none"><path d="M2 9L9 2M9 2H3.5M9 2V7.5" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round"/></svg>
                  </span>
                )}
              </div>
            </article>
          ))}
        </div>
      </div>
    </section>
  );
}

// ---------- Skills ----------

function Skills() {
  const groups = [
    { title: "Languages", items: ["TypeScript", "JavaScript", "Python", "Dart", "C++", "Shell", "HTML/CSS"] },
    { title: "Frontend", items: ["React", "Next.js", "Tailwind CSS", "Component architecture", "Responsive design"] },
    { title: "Mobile", items: ["Flutter", "Firebase", "Google Maps", "Mapbox"] },
    { title: "Backend & data", items: ["Node.js", "Flask", "REST APIs", "MySQL", "Firestore"] },
    { title: "Machine learning", items: ["scikit-learn", "NumPy", "Pandas", "Matplotlib", "Linear regression", "PCA"] },
    { title: "DevOps & tools", items: ["Git/GitHub", "Linux", "Bash", "Nginx", "Vercel"] }
  ];

  return (
    <section id="skills" style={{
      background: "color-mix(in oklch, var(--ink) 3%, var(--bg))",
      padding: "100px 0",
      borderTop: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
      borderBottom: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)"
    }}>
      <div style={{ maxWidth: 1240, margin: "0 auto", padding: "0 40px" }}>
        <div style={{ display: "grid", gridTemplateColumns: "260px 1fr", gap: 80 }}>
          <SectionLabel num="05">Skills</SectionLabel>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "40px 32px" }}>
            {groups.map(g => (
              <div key={g.title}>
                <div style={{
                  fontFamily: "var(--ui)", fontSize: 12,
                  letterSpacing: 1.4, textTransform: "uppercase",
                  color: "var(--ink)", fontWeight: 600, marginBottom: 14,
                  paddingBottom: 10, borderBottom: "1px solid color-mix(in oklch, var(--ink) 14%, transparent)"
                }}>{g.title}</div>
                <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "flex", flexWrap: "wrap", gap: 6 }}>
                  {g.items.map(it => (
                    <li key={it} style={{
                      padding: "5px 10px", borderRadius: 6,
                      background: "var(--bg)",
                      border: "1px solid color-mix(in oklch, var(--ink) 10%, transparent)",
                      fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--ink-soft)"
                    }}>{it}</li>
                  ))}
                </ul>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Education + Certs ----------

function Education() {
  return (
    <section style={{ maxWidth: 1240, margin: "0 auto", padding: "100px 40px" }}>
      <div style={{ display: "grid", gridTemplateColumns: "260px 1fr 1fr", gap: 64 }}>
        <SectionLabel num="06">Education & certs</SectionLabel>
        <div>
          <div style={{ fontFamily: "var(--ui)", fontSize: 12, color: "var(--ink-soft)", marginBottom: 8 }}>2024 — Present</div>
          <div style={{ fontFamily: "var(--display)", fontSize: 28, fontWeight: 400, color: "var(--ink)", lineHeight: 1.2, letterSpacing: -0.01 }}>BSc Software Engineering</div>
          <div style={{ fontFamily: "var(--ui)", fontSize: 14, color: "var(--ink)", marginTop: 8, fontWeight: 500 }}>African Leadership University · Kigali</div>
          <p style={{ fontFamily: "var(--ui)", fontSize: 14, lineHeight: 1.6, color: "var(--ink-soft)", marginTop: 16, textWrap: "pretty" }}>
            Coursework: Machine Learning · Data Structures & Algorithms · Web Development · Systems Engineering · DevOps · Databases.
          </p>
          <div style={{ marginTop: 16, display: "flex", flexWrap: "wrap", gap: 6 }}>
            <Pill tone="accent">English</Pill>
            <Pill tone="accent">Kinyarwanda</Pill>
            <Pill tone="accent">French</Pill>
          </div>
        </div>
        <div>
          <div style={{ fontFamily: "var(--ui)", fontSize: 11.5, letterSpacing: 1.4, textTransform: "uppercase", color: "var(--ink-soft)", marginBottom: 16, fontWeight: 600 }}>Certifications</div>
          <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "grid", gap: 14 }}>
            {[
              { t: "Flutter & Dart — The Complete Guide", o: "Coursera", y: "2025" },
              { t: "Data Analysis with R", o: "Coursera", y: "2025" },
              { t: "ALU Machine Learning Program", o: "African Leadership University", y: "2025" },
              { t: "System Engineering & DevOps", o: "African Leadership University", y: "2025" }
            ].map((c, i) => (
              <li key={i} style={{
                display: "grid", gridTemplateColumns: "1fr auto", gap: 12,
                padding: "12px 0", borderBottom: "1px solid color-mix(in oklch, var(--ink) 8%, transparent)",
                fontFamily: "var(--ui)"
              }}>
                <div>
                  <div style={{ fontSize: 14, fontWeight: 500, color: "var(--ink)" }}>{c.t}</div>
                  <div style={{ fontSize: 12.5, color: "var(--ink-soft)", marginTop: 2 }}>{c.o}</div>
                </div>
                <span style={{ fontSize: 12, color: "var(--ink-soft)", fontVariantNumeric: "tabular-nums" }}>{c.y}</span>
              </li>
            ))}
          </ul>
        </div>
      </div>
    </section>
  );
}

// ---------- Contact / footer ----------

function Contact() {
  const [copied, setCopied] = useState(false);
  const copy = () => {
    navigator.clipboard.writeText("sam@courtava.com");
    setCopied(true);
    setTimeout(() => setCopied(false), 1500);
  };

  return (
    <section id="contact" style={{ background: "var(--ink)", color: "var(--bg)", padding: "120px 0 60px" }}>
      <div style={{ maxWidth: 1240, margin: "0 auto", padding: "0 40px" }}>
        <div style={{
          display: "flex", alignItems: "center", gap: 14,
          fontFamily: "var(--ui)", fontSize: 12, fontWeight: 500,
          letterSpacing: 1.6, textTransform: "uppercase",
          color: "color-mix(in oklch, var(--bg) 55%, transparent)", marginBottom: 32
        }}>
          <span style={{ color: "var(--accent)", fontVariantNumeric: "tabular-nums" }}>07</span>
          <span style={{ width: 28, height: 1, background: "currentColor", opacity: 0.4 }} />
          <span>Let's build</span>
        </div>

        <h2 style={{
          fontFamily: "var(--display)", fontWeight: 400,
          fontSize: "clamp(56px, 8vw, 120px)", lineHeight: 0.96, letterSpacing: -0.025,
          margin: 0, color: "var(--bg)", maxWidth: 1100
        }}>
          Have a product worth<br />
          <em style={{ fontStyle: "italic", color: "var(--accent)" }}>building?</em> Let's talk.
        </h2>

        <a href="https://mail.google.com/mail/?view=cm&to=sam@courtava.com" target="_blank" rel="noreferrer" style={{
          display: "inline-flex", alignItems: "center", gap: 10, marginTop: 40,
          padding: "15px 28px", borderRadius: 999,
          background: "var(--accent)", color: "var(--bg)",
          fontFamily: "var(--ui)", fontSize: 15, fontWeight: 600,
          textDecoration: "none", transition: "opacity 0.18s ease"
        }}
          onMouseEnter={e => e.currentTarget.style.opacity = "0.85"}
          onMouseLeave={e => e.currentTarget.style.opacity = "1"}
        >
          Get in touch
          <svg width="13" height="13" viewBox="0 0 13 13" fill="none"><path d="M2 11L11 2M11 2H4M11 2V9" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/></svg>
        </a>

        <div style={{
          marginTop: 64, display: "grid",
          gridTemplateColumns: "repeat(3, 1fr)", gap: 24
        }}>
          {[
            { k: "Email", v: "sam@courtava.com", action: copy, actionLabel: copied ? "Copied!" : "Copy" },
            { k: "GitHub", v: "github.com/Samkwizera", action: () => window.open("https://github.com/Samkwizera", "_blank"), actionLabel: "Visit" },
            { k: "Location", v: "Kigali, Rwanda", action: null, actionLabel: null }
          ].map((c, i) => (
            <div key={i} style={{
              padding: "28px",
              border: "1px solid color-mix(in oklch, var(--bg) 15%, transparent)",
              borderRadius: 8, fontFamily: "var(--ui)",
              display: "grid", gap: 14
            }}>
              <div style={{ fontSize: 11.5, letterSpacing: 1.4, textTransform: "uppercase", color: "color-mix(in oklch, var(--bg) 55%, transparent)" }}>{c.k}</div>
              <div style={{ fontSize: 18, color: "var(--bg)", fontWeight: 500, wordBreak: "break-word" }}>{c.v}</div>
              {c.action && (
                <button onClick={c.action} style={{
                  marginTop: 4, alignSelf: "start",
                  padding: "8px 14px", borderRadius: 999,
                  background: "color-mix(in oklch, var(--bg) 8%, transparent)",
                  border: "1px solid color-mix(in oklch, var(--bg) 18%, transparent)",
                  color: "var(--bg)", fontFamily: "var(--ui)", fontSize: 12.5, fontWeight: 500,
                  cursor: "pointer"
                }}>{c.actionLabel}</button>
              )}
            </div>
          ))}
        </div>

        <div style={{
          marginTop: 96, paddingTop: 32,
          borderTop: "1px solid color-mix(in oklch, var(--bg) 14%, transparent)",
          display: "flex", justifyContent: "space-between", alignItems: "center",
          fontFamily: "var(--ui)", fontSize: 12, color: "color-mix(in oklch, var(--bg) 55%, transparent)"
        }}>
          <span>© 2026 Samuel Kwizera Ihimbazwe — Founder, Courtava.</span>
          <span>Designed & built in Kigali.</span>
        </div>
      </div>
    </section>
  );
}

// ---------- Tweaks ----------

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "accentHue": 165,
  "displayFont": "Instrument Serif",
  "warmth": "warm"
}/*EDITMODE-END*/;

function TweaksLayer() {
  const [tweaks, setTweak] = window.useTweaks(TWEAK_DEFAULTS);

  useEffect(() => {
    const root = document.documentElement;
    root.style.setProperty("--accent", `oklch(0.62 0.13 ${tweaks.accentHue})`);
    root.style.setProperty("--accent-deep", `oklch(0.42 0.13 ${tweaks.accentHue})`);

    const tones = {
      warm: { bg: "oklch(0.97 0.005 80)", ink: "oklch(0.18 0.008 60)", soft: "oklch(0.45 0.008 60)" },
      cool: { bg: "oklch(0.98 0.004 230)", ink: "oklch(0.18 0.01 230)", soft: "oklch(0.46 0.01 230)" },
      neutral: { bg: "oklch(0.97 0 0)", ink: "oklch(0.18 0 0)", soft: "oklch(0.46 0 0)" }
    };
    const t = tones[tweaks.warmth] || tones.warm;
    root.style.setProperty("--bg", t.bg);
    root.style.setProperty("--ink", t.ink);
    root.style.setProperty("--ink-soft", t.soft);

    root.style.setProperty("--display", `'${tweaks.displayFont}', Georgia, serif`);
  }, [tweaks]);

  return (
    <window.TweaksPanel title="Tweaks">
      <window.TweakSection title="Accent">
        <window.TweakSlider label="Hue" value={tweaks.accentHue} min={0} max={360} step={1}
          onChange={(v) => setTweak("accentHue", v)} />
      </window.TweakSection>
      <window.TweakSection title="Tone">
        <window.TweakRadio value={tweaks.warmth}
          options={[{ value: "warm", label: "Warm" }, { value: "cool", label: "Cool" }, { value: "neutral", label: "Neutral" }]}
          onChange={(v) => setTweak("warmth", v)} />
      </window.TweakSection>
      <window.TweakSection title="Display font">
        <window.TweakRadio value={tweaks.displayFont}
          options={[
            { value: "Instrument Serif", label: "Instrument" },
            { value: "Fraunces", label: "Fraunces" },
            { value: "Inter", label: "Inter" }
          ]}
          onChange={(v) => setTweak("displayFont", v)} />
      </window.TweakSection>
    </window.TweaksPanel>
  );
}

// ---------- App ----------

function App() {
  const [active, setActive] = useState("top");

  useEffect(() => {
    const ids = ["top", "work", "courtava", "projects", "skills", "contact"];
    const onScroll = () => {
      const y = window.scrollY + 120;
      let current = "top";
      for (const id of ids) {
        const el = document.getElementById(id);
        if (el && el.offsetTop <= y) current = id;
      }
      setActive(current);
    };
    window.addEventListener("scroll", onScroll, { passive: true });
    onScroll();
    return () => window.removeEventListener("scroll", onScroll);
  }, []);

  const jump = (id) => {
    const el = document.getElementById(id);
    if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
    else window.scrollTo({ top: 0, behavior: "smooth" });
  };

  return (
    <>
      <TopNav active={active} onJump={jump} />
      <Hero />
      <Marquee />
      <Summary />
      <Courtava />
      <Experience />
      <Projects />
      <Skills />
      <Education />
      <Contact />
      <TweaksLayer />
    </>
  );
}

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