// portfolio.jsx — Mahmoud Sadder, AI & Cybersecurity Engineer
// Dark editorial single-page portfolio. Self-contained React component.


/* ----------------------------------------------------------------- data */
const NAV_LINKS = [
  { label: "About", href: "#about" },
  { label: "Projects", href: "#projects" },
  { label: "Experience", href: "#experience" },
  { label: "Skills", href: "#skills" },
  { label: "Contact", href: "#contact" },
];

const PROJECTS = [
  {
    tag: "AI · React",
    name: "Sanfoor",
    desc: "Bilingual AI academic assistant for ZU students. RAG pipeline over course material, answered in Arabic & English.",
    award: "Crown Prince Foundation Award Qualifier",
    stack: ["React", "TypeScript", "Gemini API", "RAG"],
    link: null,
  },
  {
    tag: "Security · Tooling",
    name: "AirStrike",
    desc: "Modular Wi-Fi penetration-testing framework with an interactive web interface for orchestrating attacks.",
    award: null,
    stack: ["Python", "Flask", "Linux"],
    link: "https://airstrike.dev",
  },
  {
    tag: "Full-Stack",
    name: "Joflix",
    desc: "Secure full-stack streaming platform with role-based access control and a complete admin panel.",
    award: null,
    stack: ["ASP.NET Core", "MySQL", "Entity Framework"],
    link: "https://github.com/mahmoud-sadder/Joflix",
  },
];

const EXPERIENCE = [
  {
    range: "Feb 2026 — Present",
    role: "AI Engineer",
    org: "Al-Hussein Technical University (HTU) · 9xAI",
    desc: "Nationally selected AI Engineer building production-grade AI for government and industry.",
    current: true,
  },
  {
    range: "Apr 2025 — Present",
    role: "Security Researcher",
    org: "Yogosha Strike Force",
    desc: "Offensive security research and coordinated vulnerability disclosure on a private, vetted bug-bounty force.",
    current: true,
  },
  {
    range: "Oct 2025 — Jan 2026",
    role: "SOC Analyst Intern",
    org: "Green Circle",
    desc: "Monitored, triaged and escalated security events; tuned detections across the SOC pipeline.",
    current: false,
  },
  {
    range: "Apr — May 2025",
    role: "Cybersecurity Intern",
    org: "Central Bank of Jordan",
    desc: "Supported security operations and risk assessment for national financial infrastructure.",
    current: false,
  },
  {
    range: "Feb — May 2025",
    role: "Cybersecurity Intern",
    org: "National Cyber Security Center (NCSC)",
    desc: "Threat analysis and hands-on defensive security practice at the national level.",
    current: false,
  },
];

const SKILL_CLUSTERS = [
  { label: "AI & ML", items: ["LLM Deployment", "RAG Pipelines", "Gemini / OpenAI APIs", "Prompt Engineering", "Fine-tuning"] },
  { label: "Security", items: ["Penetration Testing", "SOC Operations", "Threat Analysis", "Vulnerability Research", "Incident Response"] },
  { label: "Cloud", items: ["AWS", "Docker", "Linux", "CI / CD"] },
  { label: "Development", items: ["React", "TypeScript", "Python", "ASP.NET Core", "Full-Stack"] },
];

const CERTS = [
  { name: "eJPT", issuer: "INE Security", url: "https://certs.ine.com/aa5b0e3b-63f2-4454-a45c-4ada9ce69baf#acc.q59EVSiF" },
  { name: "ISC2 CC", issuer: "ISC2", url: "https://www.credly.com/badges/43d776f4-c5a9-4936-92ef-3a8ae72df507/linked_in_profile" },
  { name: "ICCA", issuer: "INE Security", url: "https://certs.ine.com/e885af94-d4fa-4e2d-b521-494eb349934f#acc.q31EU5h9" },
  { name: "AWS CCP", issuer: "Amazon Web Services", url: "https://cp.certmetrics.com/amazon/en/public/verify/credential/20e6c445c81a4b6f9d07e4a2ce90b014" },
  { name: "Python Power-Up", issuer: "HTU · edX", url: "https://www.credential.net/1da9f363-89e0-4aaf-ab8c-ccb7b5e5cf8b#acc.rvqbi4AW" },
];

const CONTACTS = {
  email: "mahmouds4dr@gmail.com",
  linkedin: "https://www.linkedin.com/in/mahmoud-sadder/",
  github: "https://github.com/mahmoud-sadder",
};

const PHOTO_SRC = { grey: "assets/mahmoud-grey.png", formal: "assets/mahmoud-formal.png", "no-background": "assets/no-background.png" };

/* --------------------------------------------------------------- helpers */
const MUTED = "#888";
const BODY = "#e5e5e5";
const SURFACE = "#111111";
const BORDER = "#222222";
const BORDER_HI = "#2e2e2e";

const MONO = "'JetBrains Mono', ui-monospace, monospace";

function useReveal(options) {
  const ref = React.useRef(null);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const io = new IntersectionObserver(
      (entries) => {
        entries.forEach((e) => {
          if (e.isIntersecting) {
            el.classList.add("in");
            io.unobserve(el);
          }
        });
      },
      { threshold: 0.12, rootMargin: "0px 0px -8% 0px", ...(options || {}) }
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);
  return ref;
}

function Reveal({ children, delay = 0, as = "div", style, className = "", ...rest }) {
  const ref = useReveal();
  const Tag = as;
  return (
    <Tag
      ref={ref}
      className={"reveal " + className}
      style={{ transitionDelay: delay + "ms", ...style }}
      {...rest}
    >
      {children}
    </Tag>
  );
}

// monospace eyebrow label with angle-bracket framing
function MonoLabel({ children, accent, style }) {
  return (
    <span style={{
      fontFamily: MONO, fontSize: 13, letterSpacing: ".06em", whiteSpace: "nowrap",
      color: MUTED, display: "inline-flex", alignItems: "center", gap: 7, ...style,
    }}>
      <span style={{ color: accent }}>&lt;</span>
      {children}
      <span style={{ color: accent }}>/&gt;</span>
    </span>
  );
}

function SectionHead({ index, kicker, title, accent, sub }) {
  return (
    <Reveal style={{ marginBottom: 56 }}>
      <div style={{ display: "flex", alignItems: "baseline", gap: 14, marginBottom: 18 }}>
        <span style={{ fontFamily: MONO, fontSize: 13, color: accent, letterSpacing: ".05em" }}>{index}</span>
        <span style={{ fontFamily: MONO, fontSize: 13, color: MUTED, letterSpacing: ".18em", textTransform: "uppercase" }}>{kicker}</span>
        <span style={{ flex: 1, height: 1, background: BORDER, transform: "translateY(-2px)" }} />
      </div>
      <h2 style={{ margin: 0, fontSize: "clamp(1.9rem, 3.2vw, 2.9rem)", fontWeight: 700, color: "#fafafa", letterSpacing: "-0.02em", lineHeight: 1.08 }}>
        {title}
      </h2>
      {sub && <p style={{ margin: "16px 0 0", color: MUTED, fontSize: 16, maxWidth: 560, lineHeight: 1.6 }}>{sub}</p>}
    </Reveal>
  );
}

/* ------------------------------------------------------------------- nav */
function Nav({ accent }) {
  const [scrolled, setScrolled] = React.useState(false);
  React.useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 24);
    onScroll();
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
  return (
    <header style={{
      position: "fixed", top: 0, left: 0, right: 0, zIndex: 50,
      backdropFilter: scrolled ? "blur(14px) saturate(160%)" : "none",
      background: scrolled ? "rgba(10,10,10,0.72)" : "transparent",
      borderBottom: scrolled ? `1px solid ${BORDER}` : "1px solid transparent",
      transition: "all .4s ease",
    }}>
      <nav style={{
        maxWidth: 1160, margin: "0 auto", padding: "0 32px", height: 68,
        display: "flex", alignItems: "center", justifyContent: "space-between",
      }}>
        <a href="#top" style={{ display: "flex", alignItems: "center" }}>
          <span style={{ fontWeight: 700, fontSize: 15, color: "#fafafa", letterSpacing: "-0.01em" }}>Mahmoud Sadder</span>
        </a>
        <div style={{ display: "flex", alignItems: "center", gap: 4 }}>
          {NAV_LINKS.map((l) => (
            <a key={l.href} href={l.href}
              style={{ fontSize: 13.5, color: MUTED, padding: "8px 14px", borderRadius: 8, transition: "color .2s" }}
              onMouseEnter={(e) => (e.currentTarget.style.color = BODY)}
              onMouseLeave={(e) => (e.currentTarget.style.color = MUTED)}>
              {l.label}
            </a>
          ))}
          <a href={`mailto:${CONTACTS.email}`}
            style={{
              marginLeft: 10, fontSize: 13.5, fontWeight: 500, color: "#0a0a0a",
              background: accent, padding: "9px 16px", borderRadius: 9, transition: "transform .2s, box-shadow .2s",
            }}
            onMouseEnter={(e) => { e.currentTarget.style.transform = "translateY(-1px)"; e.currentTarget.style.boxShadow = `0 8px 24px ${accent}40`; }}
            onMouseLeave={(e) => { e.currentTarget.style.transform = "none"; e.currentTarget.style.boxShadow = "none"; }}>
            Get in touch
          </a>
        </div>
      </nav>
    </header>
  );
}

/* ----------------------------------------------------------------- hero */
function Hero({ accent, pattern }) {
  const patternStyle =
    pattern === "none"
      ? {}
      : pattern === "grid"
      ? {
          backgroundImage:
            "linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px)",
          backgroundSize: "46px 46px",
        }
      : {
          backgroundImage: "radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px)",
          backgroundSize: "28px 28px",
        };

  return (
    <section id="top" style={{ position: "relative", minHeight: "100vh", display: "flex", alignItems: "center", overflow: "hidden" }}>
      {/* animated faint pattern */}
      <div data-anim aria-hidden="true" style={{
        position: "absolute", inset: 0, ...patternStyle,
        maskImage: "radial-gradient(ellipse 75% 65% at 28% 42%, #000 0%, transparent 72%)",
        WebkitMaskImage: "radial-gradient(ellipse 75% 65% at 28% 42%, #000 0%, transparent 72%)",
        animation: pattern === "none" ? "none" : "drift 70s linear infinite",
      }} />
      {/* accent glow */}
      <div data-anim aria-hidden="true" style={{
        position: "absolute", top: "8%", right: "6%", width: 520, height: 520,
        background: `radial-gradient(circle, ${accent}1f 0%, transparent 68%)`,
        filter: "blur(20px)", animation: "floatGlow 14s ease-in-out infinite", pointerEvents: "none",
      }} />

      <div className="hero-inner" style={{ position: "relative", maxWidth: 1160, margin: "0 auto", padding: "0 32px", width: "100%", minHeight: "100vh", display: "grid", gridTemplateColumns: "1fr 400px", gap: "0 40px", alignItems: "center" }}>
        <div style={{ paddingTop: 120, paddingBottom: 80 }}>
          <div className="h-rise d0">
            <MonoLabel accent={accent} style={{ fontSize: 14 }}>AI &amp; Cybersecurity Engineer</MonoLabel>
          </div>
          <h1 className="h-rise d1" style={{
            margin: "26px 0 0", fontWeight: 800, color: "#ffffff",
            fontSize: "clamp(2.6rem, 6.2vw, 5rem)", lineHeight: 1.04, letterSpacing: "-0.035em",
            textWrap: "balance",
          }}>
            Building secure, intelligent<br />systems for <span style={{ color: accent }}>governments.</span>
          </h1>
          <div className="h-rise d3" style={{ display: "flex", flexWrap: "wrap", gap: 14, marginTop: 40 }}>
            <a href="#projects"
              style={{
                display: "inline-flex", alignItems: "center", gap: 9, fontSize: 15, fontWeight: 600,
                color: "#0a0a0a", background: accent, padding: "14px 24px", borderRadius: 11, transition: "transform .2s, box-shadow .2s",
              }}
              onMouseEnter={(e) => { e.currentTarget.style.transform = "translateY(-2px)"; e.currentTarget.style.boxShadow = `0 14px 34px ${accent}45`; }}
              onMouseLeave={(e) => { e.currentTarget.style.transform = "none"; e.currentTarget.style.boxShadow = "none"; }}>
              View Projects
              <span aria-hidden="true">↗</span>
            </a>
            <a href="assets/Mahmoud-Sadder-CV.pdf" target="_blank" rel="noopener"
              style={{
                display: "inline-flex", alignItems: "center", gap: 9, fontSize: 15, fontWeight: 500,
                color: BODY, padding: "14px 24px", borderRadius: 11, border: `1px solid ${BORDER_HI}`, transition: "border-color .2s, color .2s",
              }}
              onMouseEnter={(e) => { e.currentTarget.style.borderColor = accent; e.currentTarget.style.color = "#fff"; }}
              onMouseLeave={(e) => { e.currentTarget.style.borderColor = BORDER_HI; e.currentTarget.style.color = BODY; }}>
              Download CV
              <span aria-hidden="true" style={{ color: MUTED }}>↓</span>
            </a>
          </div>
        </div>

        <div className="hero-photo-col" style={{ alignSelf: "center", position: "relative", display: "flex", alignItems: "center", justifyContent: "center" }}>
          <img src="assets/mahmoud-clean.png" alt="Mahmoud Sadder" style={{
            maxHeight: "60vh", width: "auto", maxWidth: "100%", display: "block", position: "relative", zIndex: 1,
            maskImage: "linear-gradient(to bottom, #000 82%, transparent 100%)",
            WebkitMaskImage: "linear-gradient(to bottom, #000 82%, transparent 100%)",
          }} />
        </div>
      </div>

      {/* scroll cue */}
      <div aria-hidden="true" style={{ position: "absolute", bottom: 30, left: "50%", transform: "translateX(-50%)", fontFamily: MONO, fontSize: 11, color: "#555", letterSpacing: ".2em" }}>
        SCROLL
      </div>
    </section>
  );
}

/* ---------------------------------------------------------------- shells */
function Section({ id, children, padY }) {
  return (
    <section id={id} style={{ position: "relative", padding: `${padY}px 32px`, scrollMarginTop: 80 }}>
      <div style={{ maxWidth: 1160, margin: "0 auto" }}>{children}</div>
    </section>
  );
}

/* ----------------------------------------------------------------- about */
function About({ accent, photo }) {
  return (
    <div style={{ display: "grid", gridTemplateColumns: "minmax(0, 380px) 1fr", gap: 64, alignItems: "center" }} className="about-grid">
      <Reveal>
        <div style={{ position: "relative" }}>
          <div style={{
            aspectRatio: "4 / 5", borderRadius: 18, overflow: "hidden",
            border: `1px solid ${BORDER_HI}`, background: SURFACE,
            boxShadow: "0 30px 80px -20px rgba(0,0,0,0.8)",
          }}>
            <img src={PHOTO_SRC[photo] || PHOTO_SRC.grey} alt="Mahmoud Sadder"
              style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }} />
          </div>
        </div>
      </Reveal>

      <div>
        <Reveal>
          <div style={{ fontFamily: MONO, fontSize: 13, color: MUTED, letterSpacing: ".16em", textTransform: "uppercase" }}>Who is Mahmoud</div>
          <h3 style={{ margin: "12px 0 0", fontSize: "clamp(2.2rem, 4vw, 3.2rem)", fontWeight: 800, color: "#ffffff", letterSpacing: "-0.03em", lineHeight: 1.02 }}>
            Mahmoud Sadder
          </h3>
          <div style={{ margin: "12px 0 0", fontSize: 16, fontWeight: 500, color: accent }}>AI &amp; Cybersecurity Engineer · Amman, Jordan</div>
        </Reveal>
        <Reveal delay={80}>
          <p style={{ margin: "24px 0 0", fontSize: 16.5, lineHeight: 1.75, color: MUTED }}>
            I work at the intersection of <span style={{ color: "#e5e5e5" }}>national security and intelligent systems</span> —
            a nationally selected AI Engineer in Jordan's 9xAI program, building production-grade AI for
            government and industry. My background spans LLM deployment, RAG pipelines, SOC operations,
            penetration testing, and full-stack development.
          </p>
        </Reveal>
        <Reveal delay={140}>
          <p style={{ margin: "18px 0 0", fontSize: 16.5, lineHeight: 1.75, color: MUTED }}>
            I'm focused on the MENA region's digital transformation — making government systems smarter and
            more secure.
          </p>
        </Reveal>
        <Reveal delay={200}>
          <div style={{ marginTop: 34, paddingTop: 28, borderTop: `1px solid ${BORDER}` }}>
            <div style={{ fontFamily: MONO, fontSize: 11, color: "#555", letterSpacing: ".14em", textTransform: "uppercase", marginBottom: 16 }}>Experience at</div>
            <div style={{ display: "flex", flexWrap: "wrap", gap: "10px 14px" }}>
              {["Central Bank of Jordan", "National Cyber Security Center", "HTU · 9xAI", "Yogosha Strike Force", "Green Circle"].map((org) => (
                <span key={org} style={{
                  fontFamily: MONO, fontSize: 12, color: "#bdbdbd", whiteSpace: "nowrap",
                  border: `1px solid ${BORDER}`, borderRadius: 8, padding: "7px 12px", background: "rgba(255,255,255,0.015)",
                }}>{org}</span>
              ))}
            </div>
          </div>
        </Reveal>
      </div>
    </div>
  );
}

/* -------------------------------------------------------------- projects */
function ProjectCard({ p, accent, i }) {
  const [hov, setHov] = React.useState(false);
  return (
    <Reveal delay={i * 90}>
      <a href={p.link || "#contact"} target={p.link ? "_blank" : undefined} rel={p.link ? "noopener noreferrer" : undefined}
        onMouseEnter={() => setHov(true)} onMouseLeave={() => setHov(false)}
        style={{
          display: "flex", flexDirection: "column", height: "100%",
          background: SURFACE, border: `1px solid ${hov ? BORDER_HI : BORDER}`,
          borderRadius: 16, padding: "28px 26px 24px",
          transition: "border-color .3s, transform .3s, box-shadow .3s",
          transform: hov ? "translateY(-4px)" : "none",
          boxShadow: hov ? "0 24px 60px -28px rgba(0,0,0,0.9)" : "none",
        }}>
        <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
          <span style={{ fontFamily: MONO, fontSize: 11.5, color: accent, letterSpacing: ".06em", textTransform: "uppercase", whiteSpace: "nowrap" }}>{p.tag}</span>
          <span aria-hidden="true" style={{
            fontSize: 18, color: hov ? accent : MUTED, transition: "transform .3s, color .3s",
            transform: hov ? "translate(3px,-3px)" : "none",
          }}>↗</span>
        </div>
        <h3 style={{ margin: "18px 0 0", fontSize: 25, fontWeight: 700, color: "#fafafa", letterSpacing: "-0.02em" }}>{p.name}</h3>
        <p style={{ margin: "12px 0 0", fontSize: 14.5, lineHeight: 1.65, color: MUTED }}>{p.desc}</p>
        {p.award && (
          <div style={{ marginTop: 16, display: "inline-flex", alignSelf: "flex-start", alignItems: "center", gap: 8, fontFamily: MONO, fontSize: 11.5, color: "#d4d4d4", background: "rgba(255,255,255,0.03)", border: `1px solid ${BORDER}`, borderRadius: 8, padding: "6px 11px" }}>
            <span style={{ color: accent }}>★</span>{p.award}
          </div>
        )}
        <div style={{ flex: 1 }} />
        <div style={{ display: "flex", flexWrap: "wrap", gap: 8, marginTop: 26, paddingTop: 22, borderTop: `1px solid ${BORDER}` }}>
          {p.stack.map((s) => (
            <span key={s} style={{
              fontFamily: MONO, fontSize: 11, color: "#bdbdbd", whiteSpace: "nowrap",
              border: `1px solid ${BORDER}`, borderRadius: 7, padding: "4px 9px", background: "rgba(255,255,255,0.015)",
            }}>{s}</span>
          ))}
        </div>
      </a>
    </Reveal>
  );
}

function Projects({ accent }) {
  return (
    <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))", gap: 22 }}>
      {PROJECTS.map((p, i) => <ProjectCard key={p.name} p={p} accent={accent} i={i} />)}
    </div>
  );
}

/* ------------------------------------------------------------ experience */
function Experience({ accent }) {
  return (
    <div style={{ position: "relative" }}>
      {/* vertical line */}
      <div aria-hidden="true" style={{ position: "absolute", left: 0, top: 8, bottom: 8, width: 1, background: BORDER }} className="exp-line" />
      <div style={{ display: "flex", flexDirection: "column", gap: 0 }}>
        {EXPERIENCE.map((e, i) => (
          <Reveal key={i} delay={i * 70}>
            <div className="exp-row" style={{
              display: "grid", gridTemplateColumns: "190px 1fr", gap: 36,
              padding: "26px 0 26px 36px", position: "relative",
              borderBottom: i < EXPERIENCE.length - 1 ? `1px solid ${BORDER}` : "none",
            }}>
              {/* dot */}
              <span aria-hidden="true" style={{
                position: "absolute", left: -5.5, top: 32, width: 12, height: 12, borderRadius: "50%",
                background: e.current ? accent : "#3a3a3a",
                border: `2px solid #0a0a0a`,
                boxShadow: e.current ? `0 0 0 4px ${accent}22` : "none",
              }} />
              <div style={{ fontFamily: MONO, fontSize: 13, color: MUTED, letterSpacing: ".02em", paddingTop: 2 }}>
                {e.range}
                {e.current && (
                  <span style={{ display: "block", marginTop: 8, color: accent, fontSize: 11, letterSpacing: ".08em" }}>● ACTIVE</span>
                )}
              </div>
              <div>
                <h3 style={{ margin: 0, fontSize: 20, fontWeight: 600, color: "#fafafa", letterSpacing: "-0.01em" }}>{e.role}</h3>
                <div style={{ margin: "5px 0 0", fontSize: 14.5, color: accent, fontWeight: 500 }}>{e.org}</div>
                <p style={{ margin: "12px 0 0", fontSize: 14.5, lineHeight: 1.65, color: MUTED, maxWidth: 560 }}>{e.desc}</p>
              </div>
            </div>
          </Reveal>
        ))}
      </div>
    </div>
  );
}

/* ---------------------------------------------------------------- skills */
function Skills({ accent }) {
  return (
    <div style={{ display: "grid", gridTemplateColumns: "1.15fr 1fr", gap: 56 }} className="skills-grid">
      <div>
        <Reveal style={{ marginBottom: 8 }}>
          <MonoLabel accent={accent}>capabilities</MonoLabel>
        </Reveal>
        <div style={{ display: "flex", flexDirection: "column", gap: 30, marginTop: 26 }}>
          {SKILL_CLUSTERS.map((c, i) => (
            <Reveal key={c.label} delay={i * 60}>
              <div>
                <div style={{ fontFamily: MONO, fontSize: 12.5, color: "#fafafa", letterSpacing: ".06em", textTransform: "uppercase", marginBottom: 14 }}>{c.label}</div>
                <div style={{ display: "flex", flexWrap: "wrap", gap: 9 }}>
                  {c.items.map((s) => (
                    <span key={s} style={{
                      fontSize: 13.5, color: BODY, background: SURFACE,
                      border: `1px solid ${BORDER}`, borderRadius: 9, padding: "7px 13px",
                      transition: "border-color .2s",
                    }}
                      onMouseEnter={(ev) => (ev.currentTarget.style.borderColor = BORDER_HI)}
                      onMouseLeave={(ev) => (ev.currentTarget.style.borderColor = BORDER)}>
                      {s}
                    </span>
                  ))}
                </div>
              </div>
            </Reveal>
          ))}
        </div>
      </div>

      <div>
        <Reveal style={{ marginBottom: 8 }}>
          <MonoLabel accent={accent}>certifications</MonoLabel>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 14, marginTop: 26 }}>
          {CERTS.map((c, i) => (
            <Reveal key={c.name} delay={i * 60}>
              <a href={c.url} target="_blank" rel="noopener noreferrer" style={{ display: "block", textDecoration: "none", color: "inherit", height: "100%" }}>
                <div style={{
                  background: SURFACE, border: `1px solid ${BORDER}`, borderRadius: 13,
                  padding: "20px 18px", height: "100%", transition: "border-color .25s, transform .25s",
                }}
                  onMouseEnter={(e) => { e.currentTarget.style.borderColor = BORDER_HI; e.currentTarget.style.transform = "translateY(-2px)"; }}
                  onMouseLeave={(e) => { e.currentTarget.style.borderColor = BORDER; e.currentTarget.style.transform = "none"; }}>
                  <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }}>
                    <span style={{ width: 30, height: 30, borderRadius: 8, border: `1px solid ${BORDER_HI}`, display: "flex", alignItems: "center", justifyContent: "center", color: accent, fontSize: 14 }}>◆</span>
                    <span style={{ fontFamily: MONO, fontSize: 10, color: accent, letterSpacing: ".1em" }}>↗ VERIFY</span>
                  </div>
                  <div style={{ fontSize: 17, fontWeight: 700, color: "#fafafa", letterSpacing: "-0.01em" }}>{c.name}</div>
                  <div style={{ fontFamily: MONO, fontSize: 11.5, color: MUTED, marginTop: 4 }}>{c.issuer}</div>
                </div>
              </a>
            </Reveal>
          ))}
        </div>
      </div>
    </div>
  );
}

/* --------------------------------------------------------------- contact */
function ContactIcon({ type, accent }) {
  const common = { width: 18, height: 18, fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round" };
  if (type === "email")
    return (<svg viewBox="0 0 24 24" {...common}><rect x="3" y="5" width="18" height="14" rx="2" /><path d="m3 7 9 6 9-6" /></svg>);
  if (type === "linkedin")
    return (<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M4.98 3.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5ZM3 9h4v12H3V9Zm6 0h3.8v1.7h.05c.53-1 1.83-2.05 3.77-2.05 4.03 0 4.78 2.65 4.78 6.1V21h-4v-5.4c0-1.3 0-2.96-1.8-2.96-1.8 0-2.08 1.4-2.08 2.86V21H9V9Z" /></svg>);
  return (<svg viewBox="0 0 24 24" width="19" height="19" fill="currentColor"><path d="M12 2C6.48 2 2 6.58 2 12.25c0 4.53 2.87 8.37 6.84 9.73.5.1.68-.22.68-.49 0-.24-.01-.87-.01-1.71-2.78.62-3.37-1.37-3.37-1.37-.46-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.62.07-.62 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.71 0 0 .84-.27 2.75 1.05a9.36 9.36 0 0 1 5 0c1.91-1.32 2.75-1.05 2.75-1.05.55 1.41.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9 0 1.37-.01 2.48-.01 2.82 0 .27.18.6.69.49A10.02 10.02 0 0 0 22 12.25C22 6.58 17.52 2 12 2Z" /></svg>);
}

function Contact({ accent }) {
  const links = [
    { type: "email", label: "Email", value: "mahmouds4dr@gmail.com", href: `mailto:${CONTACTS.email}` },
    { type: "linkedin", label: "LinkedIn", value: "mahmoud-sadder", href: CONTACTS.linkedin },
    { type: "github", label: "GitHub", value: "mahmoud-sadder", href: CONTACTS.github },
  ];
  return (
    <div style={{ textAlign: "center", maxWidth: 720, margin: "0 auto" }}>
      <Reveal>
        <MonoLabel accent={accent}>get in touch</MonoLabel>
      </Reveal>
      <Reveal delay={70}>
        <h2 style={{ margin: "22px 0 0", fontSize: "clamp(2.2rem, 4.5vw, 3.4rem)", fontWeight: 700, color: "#ffffff", letterSpacing: "-0.03em", lineHeight: 1.05 }}>
          Let's work together.
        </h2>
      </Reveal>
      <Reveal delay={130}>
        <p style={{ margin: "20px auto 0", maxWidth: 480, fontSize: 16.5, lineHeight: 1.65, color: MUTED }}>
          Open to opportunities in AI engineering, cybersecurity, and public-sector technology.
        </p>
      </Reveal>
      <Reveal delay={190}>
        <div style={{ display: "flex", flexWrap: "wrap", justifyContent: "center", gap: 14, marginTop: 44 }}>
          {links.map((l) => (
            <a key={l.type} href={l.href} target={l.type === "email" ? undefined : "_blank"} rel="noopener"
              style={{
                display: "inline-flex", alignItems: "center", gap: 11, padding: "13px 20px",
                background: SURFACE, border: `1px solid ${BORDER}`, borderRadius: 12,
                color: BODY, transition: "border-color .25s, transform .25s, color .25s",
              }}
              onMouseEnter={(e) => { e.currentTarget.style.borderColor = accent; e.currentTarget.style.transform = "translateY(-2px)"; e.currentTarget.style.color = "#fff"; }}
              onMouseLeave={(e) => { e.currentTarget.style.borderColor = BORDER; e.currentTarget.style.transform = "none"; e.currentTarget.style.color = BODY; }}>
              <span style={{ color: accent, display: "flex" }}><ContactIcon type={l.type} accent={accent} /></span>
              <span style={{ display: "flex", flexDirection: "column", alignItems: "flex-start", lineHeight: 1.2 }}>
                <span style={{ fontFamily: MONO, fontSize: 10.5, color: MUTED, letterSpacing: ".06em" }}>{l.label}</span>
                <span style={{ fontSize: 14, fontWeight: 500 }}>{l.value}</span>
              </span>
            </a>
          ))}
        </div>
      </Reveal>
    </div>
  );
}

/* ----------------------------------------------------------------- foot */
function Footer({ accent }) {
  return (
    <footer style={{ borderTop: `1px solid ${BORDER}`, padding: "34px 32px" }}>
      <div style={{ maxWidth: 1160, margin: "0 auto", display: "flex", flexWrap: "wrap", gap: 16, alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
          <span style={{ width: 8, height: 8, borderRadius: "50%", background: accent }} />
          <span style={{ fontFamily: MONO, fontSize: 12.5, color: MUTED }}>Mahmoud Sadder — Amman, Jordan</span>
        </div>
        <span style={{ fontFamily: MONO, fontSize: 12, color: "#555" }}>© {new Date().getFullYear()} · Designed &amp; built with care</span>
      </div>
    </footer>
  );
}

/* ------------------------------------------------------------------ app */
function Portfolio() {
  const accent = "#3b82f6";
  const padY = 116;

  return (
    <div style={{ "--accent": accent }}>
      <Nav accent={accent} />
      <main>
        <Hero accent={accent} pattern="dots" />

        <Section id="about" padY={padY}>
          <SectionHead index="01" kicker="About" title="At the intersection of security & intelligence." accent={accent} />
          <About accent={accent} photo="formal" />
        </Section>

        <Section id="projects" padY={padY}>
          <SectionHead index="02" kicker="Projects" title="Selected work." accent={accent}
            sub="A few systems I've shipped across AI, security tooling, and full-stack engineering." />
          <Projects accent={accent} />
        </Section>

        <Section id="experience" padY={padY}>
          <SectionHead index="03" kicker="Experience" title="Where I've worked." accent={accent} />
          <Experience accent={accent} />
        </Section>

        <Section id="skills" padY={padY}>
          <SectionHead index="04" kicker="Skills & Credentials" title="Tools & certifications." accent={accent} />
          <Skills accent={accent} />
        </Section>

        <Section id="contact" padY={padY + 20}>
          <Contact accent={accent} />
        </Section>
      </main>
      <Footer accent={accent} />

      <style>{`
        @keyframes hslide { from { transform: translateY(16px); } to { transform: none; } }
        .h-rise { opacity: 1; transform: none; }
        @media (prefers-reduced-motion: no-preference) {
          .h-rise { animation: hslide .7s cubic-bezier(.16,1,.3,1) backwards; }
          .h-rise.d1 { animation-delay: .07s; }
          .h-rise.d2 { animation-delay: .14s; }
          .h-rise.d3 { animation-delay: .21s; }
        }
        @media (max-width: 900px) {
          .hero-inner { grid-template-columns: 1fr !important; }
          .hero-photo-col { display: none !important; }
        }
        @media (max-width: 860px) {
          .about-grid { grid-template-columns: 1fr !important; gap: 40px !important; }
          .skills-grid { grid-template-columns: 1fr !important; gap: 40px !important; }
          .exp-row { grid-template-columns: 1fr !important; gap: 6px !important; }
        }
        @media (max-width: 560px) {
          nav a[href="#about"], nav a[href="#projects"], nav a[href="#experience"], nav a[href="#skills"] { display: none; }
        }
      `}</style>
    </div>
  );
}

window.Portfolio = Portfolio;
