/* global React, ReactDOM */
const { useState, useEffect, useCallback, useRef } = React;

/* ==========================================================================
   Project data
   ========================================================================== */
const PROJECTS = [
  {
    id: "mode",
    name: "Mode Network",
    role: "Lead Product Designer, Mode Network",
    year: "2024",
    outcome: "Cross-chain UX for Superchain interoperability and onboarding flows.",
    tags: ["Product Design", "Design System", "Web3", "L2", "React", "TypeScript"],
    context: [
      "Mode is an L2 in the Superchain ecosystem focused on AI-native applications. As lead designer I owned the end-to-end product surface: bridge, portal, identity, and the marketing funnel that fed into them.",
      "Shipped a redesigned bridging experience and a unified portal that consolidated three previously fragmented surfaces. Set the foundation for cross-chain UX patterns reused by ecosystem partners.",
    ],
    facts: [
      ["Role", "Lead Product Designer"],
      ["Engagement", "May 2024 to Oct 2024"],
      ["Scope", "Bridge · Portal · Identity"],
      ["Team", "8 design + eng"],
    ],
    palette: ["#2B2EFD", "#5457FD", "#0B0B36"],
  },
  {
    id: "mantle",
    name: "Mantle Network",
    role: "Senior Product Designer, Mantle",
    year: "2023",
    outcome: "Core protocol UI and ecosystem dashboards for a top-ten L2.",
    tags: ["Product Design", "Design System", "Dashboards", "Figma", "Web3"],
    context: [
      "Owned the protocol-facing product surface for Mantle, including the staking dashboard, ecosystem hub, and developer tooling pages.",
      "Built a shared component library across three product teams. Established interaction patterns for high-stakes financial flows handled at billion-dollar TVL.",
    ],
    facts: [
      ["Role", "Senior Product Designer"],
      ["Engagement", "Dec 2022 to Sep 2023"],
      ["Scope", "Protocol UI · Ecosystem"],
      ["Stack", "Figma · React · Tailwind"],
    ],
    palette: ["#0B0B36", "#2B2EFD", "#7E81FD"],
  },
  {
    id: "windranger",
    name: "Windranger Labs",
    role: "Senior Product Designer, Windranger",
    year: "2023",
    outcome: "Multi-dApp design system for a portfolio of DeFi products.",
    tags: ["Design System", "Tokens", "Documentation", "Storybook"],
    context: [
      "Built a cross-product design system spanning four dApps with shared identity, token contracts, and component libraries.",
      "Documentation, governance, and contribution model. Reduced new product spin-up from weeks to days.",
    ],
    facts: [
      ["Role", "Senior Product Designer"],
      ["Engagement", "Feb 2022 to Sep 2023"],
      ["Scope", "Design system · 4 dApps"],
      ["Stack", "Figma · Storybook"],
    ],
    palette: ["#37373D", "#2B2EFD", "#C2C5C9"],
  },
  {
    id: "oddscenes",
    name: "Odd Scenes",
    role: "Creative Director, Odd Scenes",
    year: "2024 / Now",
    outcome: "AI-native design studio. Brand, web, product, pitch, social, merch.",
    tags: ["Brand", "Web", "Product", "Pitch", "Social", "Merch", "AI"],
    context: [
      "Founded Odd Scenes as a solo studio operated through a custom stack of automation, agents, and tooling that handles 60 to 80% of production work.",
      "Clients ship faster than they would with a traditional agency, at a fraction of the cost. Output across brand, web, product, pitch, social, and merch.",
    ],
    facts: [
      ["Role", "Founder · Creative Director"],
      ["Engagement", "Nov 2024 to Present"],
      ["Scope", "Brand · Web · Product"],
      ["Live", "oddscenes.com"],
    ],
    palette: ["#030304", "#2B2EFD", "#F6244A"],
    external: "https://oddscenes.com",
  },
  {
    id: "skillflux",
    name: "SkillFlux",
    role: "Product Designer, SkillFlux",
    year: "2024",
    outcome: "AI learning platform for personalized skill development.",
    tags: ["Product Design", "Onboarding", "AI UX", "Mobile"],
    context: [
      "Designed the core learning experience for SkillFlux, an AI tutor that personalizes curriculum based on goals and pace.",
      "Onboarding, daily session UI, progress mechanics. Tested across cohorts of early users.",
    ],
    facts: [
      ["Role", "Product Designer"],
      ["Scope", "Core product"],
      ["Stack", "Figma · React Native"],
    ],
    palette: ["#131467", "#7E81FD", "#9395FD"],
  },
  {
    id: "digiheal",
    name: "DigiHeal",
    role: "Product Designer, DigiHeal",
    year: "2023",
    outcome: "Digital health platform for patient-clinician coordination.",
    tags: ["Healthcare", "Product Design", "Compliance", "Forms"],
    context: [
      "Designed clinical workflows and patient-facing tools for a digital health platform serving outpatient care.",
      "Worked within HIPAA-compliant constraints. Reduced time-to-action for clinicians on triage flows.",
    ],
    facts: [
      ["Role", "Product Designer"],
      ["Scope", "Patient · Clinician"],
      ["Stack", "Figma · React"],
    ],
    palette: ["#0e0e11", "#2B2EFD", "#37373D"],
  },
];

/* ==========================================================================
   SVG placeholder thumbnails
   ========================================================================== */
function ProjectThumb({ project, variant = 0 }) {
  const [c1, c2, c3] = project.palette;
  const id = project.id + "-" + variant;
  // Variant 0 = card thumb. 1..4 = modal screenshots.
  if (variant === 0) {
    return (
      <svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <defs>
          <linearGradient id={`g-${id}`} x1="0" y1="0" x2="1" y2="1">
            <stop offset="0%" stopColor={c1} />
            <stop offset="100%" stopColor={c3 || c2} />
          </linearGradient>
          <pattern id={`p-${id}`} width="6" height="6" patternUnits="userSpaceOnUse">
            <path d="M0 6 L6 0" stroke={c2} strokeWidth="0.6" opacity="0.18" />
          </pattern>
        </defs>
        <rect width="400" height="300" fill={`url(#g-${id})`} />
        <rect width="400" height="300" fill={`url(#p-${id})`} />
        {/* Dim "browser frame" content suggesting product UI */}
        <g opacity="0.85">
          <rect x="32" y="32" width="336" height="56" rx="6" fill="rgba(255,255,255,0.06)" stroke="rgba(255,255,255,0.18)" />
          <circle cx="50" cy="60" r="5" fill="rgba(255,255,255,0.5)" />
          <rect x="68" y="55" width="80" height="10" rx="3" fill="rgba(255,255,255,0.35)" />
          <rect x="32" y="104" width="220" height="120" rx="6" fill="rgba(255,255,255,0.06)" stroke="rgba(255,255,255,0.16)" />
          <rect x="262" y="104" width="106" height="58" rx="6" fill={c2} opacity="0.55" />
          <rect x="262" y="170" width="106" height="54" rx="6" fill="rgba(255,255,255,0.08)" stroke="rgba(255,255,255,0.16)" />
          <rect x="32" y="240" width="120" height="10" rx="3" fill="rgba(255,255,255,0.4)" />
          <rect x="32" y="258" width="180" height="8" rx="3" fill="rgba(255,255,255,0.22)" />
        </g>
        {/* corner mark */}
        <g transform="translate(354, 270)">
          <rect x="-22" y="-12" width="22" height="14" rx="3" fill="rgba(0,0,0,0.45)" />
          <text x="-11" y="-2" textAnchor="middle" fontFamily="OS Sans Condensed, monospace" fontSize="7" fill="white" letterSpacing="0.15em">{project.year.toUpperCase()}</text>
        </g>
      </svg>
    );
  }
  // Modal shots — different compositions
  if (variant === 1) {
    return (
      <svg viewBox="0 0 800 450" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <defs>
          <linearGradient id={`gm-${id}`} x1="0" y1="0" x2="1" y2="1">
            <stop offset="0%" stopColor={c1} />
            <stop offset="100%" stopColor={c2} />
          </linearGradient>
        </defs>
        <rect width="800" height="450" fill={`url(#gm-${id})`} />
        <g opacity="0.9">
          <rect x="60" y="60" width="680" height="40" rx="6" fill="rgba(255,255,255,0.08)" stroke="rgba(255,255,255,0.18)" />
          <rect x="60" y="120" width="320" height="270" rx="8" fill="rgba(0,0,0,0.25)" stroke="rgba(255,255,255,0.16)" />
          <rect x="400" y="120" width="340" height="130" rx="8" fill={c2} opacity="0.7" />
          <rect x="400" y="260" width="340" height="130" rx="8" fill="rgba(255,255,255,0.08)" stroke="rgba(255,255,255,0.16)" />
          <text x="80" y="160" fontFamily="OS Sans Expanded, sans-serif" fontWeight="700" fontSize="22" fill="white">{project.name}</text>
          <text x="80" y="186" fontFamily="OS Sans Condensed, monospace" fontSize="10" fill="rgba(255,255,255,0.65)" letterSpacing="0.2em">{project.role.toUpperCase()}</text>
        </g>
      </svg>
    );
  }
  if (variant === 2) {
    return (
      <svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <rect width="400" height="300" fill={c3 || c1} />
        <g opacity="0.85">
          <rect x="20" y="20" width="170" height="260" rx="8" fill="rgba(255,255,255,0.06)" stroke="rgba(255,255,255,0.18)" />
          <rect x="32" y="40" width="120" height="10" rx="3" fill="rgba(255,255,255,0.5)" />
          <rect x="32" y="60" width="80" height="8" rx="3" fill="rgba(255,255,255,0.25)" />
          {[0,1,2,3,4].map(i => (
            <rect key={i} x="32" y={90 + i*30} width="146" height="20" rx="4" fill="rgba(255,255,255,0.08)" />
          ))}
          <rect x="210" y="20" width="170" height="170" rx="8" fill={c2} opacity="0.7" />
          <rect x="210" y="200" width="170" height="80" rx="8" fill="rgba(255,255,255,0.06)" stroke="rgba(255,255,255,0.18)" />
        </g>
      </svg>
    );
  }
  if (variant === 3) {
    return (
      <svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <rect width="400" height="300" fill={c1} />
        <g opacity="0.92">
          <rect x="40" y="40" width="320" height="40" rx="6" fill="rgba(255,255,255,0.1)" />
          <circle cx="200" cy="180" r="60" fill={c2} opacity="0.85" />
          <circle cx="200" cy="180" r="60" fill="none" stroke="rgba(255,255,255,0.6)" strokeWidth="1" />
          <text x="200" y="184" textAnchor="middle" fontFamily="OS Sans Expanded, sans-serif" fontWeight="700" fontSize="22" fill="white">{project.name.split(" ")[0]}</text>
          <rect x="40" y="260" width="320" height="20" rx="4" fill="rgba(255,255,255,0.08)" />
        </g>
      </svg>
    );
  }
  return (
    <svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
      <rect width="400" height="300" fill={c3 || c1} />
      <g opacity="0.9">
        {[0,1,2,3].map(i => (
          <rect key={i} x={20 + i*95} y="40" width="80" height="220" rx="6" fill="rgba(255,255,255,0.06)" stroke="rgba(255,255,255,0.18)" />
        ))}
        <rect x="20" y="60" width="60" height="6" rx="2" fill="rgba(255,255,255,0.4)" />
        <rect x="115" y="60" width="60" height="6" rx="2" fill="rgba(255,255,255,0.4)" />
        <rect x="210" y="60" width="60" height="6" rx="2" fill="rgba(255,255,255,0.4)" />
        <rect x="305" y="60" width="60" height="6" rx="2" fill="rgba(255,255,255,0.4)" />
      </g>
    </svg>
  );
}

/* ==========================================================================
   Theme handling
   ========================================================================== */
function useTheme() {
  const [theme, setTheme] = useState(() => {
    if (typeof window === "undefined") return "dark";
    try {
      const stored = localStorage.getItem("jb-theme");
      if (stored === "light" || stored === "dark") return stored;
    } catch (e) {}
    if (window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches) {
      return "light";
    }
    return "dark";
  });
  useEffect(() => {
    const root = document.documentElement;
    root.classList.toggle("theme-light", theme === "light");
    root.classList.toggle("theme-dark", theme === "dark");
    try { localStorage.setItem("jb-theme", theme); } catch (e) {}
  }, [theme]);
  return [theme, setTheme];
}

function ThemeToggle({ theme, onChange }) {
  const next = theme === "dark" ? "light" : "dark";
  return (
    <button
      className="theme-toggle"
      type="button"
      aria-label={`Switch to ${next} mode`}
      title={`Switch to ${next} mode`}
      onClick={() => onChange(next)}
    >
      {theme === "dark" ? (
        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" /></svg>
      ) : (
        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" /></svg>
      )}
    </button>
  );
}

/* ==========================================================================
   Top bar
   ========================================================================== */
function TopBar({ theme, setTheme }) {
  const [scrolled, setScrolled] = useState(false);
  useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 8);
    onScroll();
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
  return (
    <header className={`topbar${scrolled ? " scrolled" : ""}`}>
      <div className="container topbar-inner">
        <a className="logo-slot" href="#top" aria-label="Justin Brazeau">
          {/* <span className="logo-mark" aria-hidden="true">JB</span> */}
          <img src="/uploads/favicon/favicon.png" alt="JB" className="logo-mark" />
          <span className="logo-name">Justin Brazeau</span>
        </a>
        <nav className="topbar-nav" aria-label="Primary">
          <a className="nav-link" href="#work">Work</a>
          <a className="nav-link" href="#about">About</a>
          <a className="nav-link" href="#studio">Studio</a>
          <a className="nav-link" href="#contact">Contact</a>
          <ThemeToggle theme={theme} onChange={setTheme} />
        </nav>
      </div>
    </header>
  );
}

/* ==========================================================================
   Hero
   ========================================================================== */
function Hero() {
  return (
    <section className="hero" id="top" data-screen-label="Hero">
      <div className="hero-ambient" aria-hidden="true" />
      <div className="container">
        <p className="hero-name" style={{ display: 'none' }}>
          Justin Brazeau
        </p>
        <h1>
          Product Designer.<br />
          <span className="accent">AI-powered</span> design &amp; media.
        </h1>
        <p className="hero-summary">
          10+ years in design. 8+ years building software for the web. Running on a custom stack of
          automation, agents, and tooling that handles 60 to 80% of the production pipeline,
          leaving the human work focused on craft and direction.
        </p>
        <div className="hero-actions">
          <a className="btn btn-primary" href="mailto:justin@oddscenes.com">
            Email
            <span className="arrow" aria-hidden="true">↗</span>
          </a>
          <a className="btn btn-ghost" href="https://linkedin.com/in/justinbrazeau" target="_blank" rel="noopener noreferrer">
            LinkedIn
            <span className="arrow" aria-hidden="true">↗</span>
          </a>
        </div>
        <div className="hero-meta">
          <div className="hero-meta-item">
            <div className="k t-condensed">Based</div>
            <div className="v">TH · Remote globally</div>
          </div>
          <div className="hero-meta-item">
            <div className="k t-condensed">Currently</div>
            <div className="v">Creative Director, Odd Scenes</div>
          </div>
          <div className="hero-meta-item">
            <div className="k t-condensed">Focus</div>
            <div className="v">AI + Design + Tech</div>
          </div>
          {/* <div className="hero-meta-item">
            <div className="k t-condensed">Sectors</div>
            <div className="v">SaaS · Fintech · Web3</div>
          </div> */}
          {/* <div className="hero-meta-item">
            <div className="k t-condensed">Available</div>
            <div className="v">Senior &amp; Staff roles</div>
          </div> */}
          <div className="hero-meta-item">
            <div className="k t-condensed">Status</div>
            <div className="v">Actively Building</div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ==========================================================================
   Work
   ========================================================================== */
// function WorkGrid({ onOpen }) {
//   return (
//     <section className="section" id="work" data-screen-label="Selected Work">
//       <div className="container">
//         <div className="section-head">
//           <div className="head-left">
//             <div className="label">02 / Selected Work</div>
//             <h2>Recent projects</h2>
//           </div>
//           {/* <div className="head-right">
//             Six projects across web3, AI, learning, and health. Click any card for context, screens, and stack.
//           </div> */}
//         </div>
//         <div className="work-grid">
//           {PROJECTS.map((p, i) => (
//             <button
//               key={p.id}
//               className="work-card"
//               onClick={() => onOpen(i)}
//               aria-label={`Open ${p.name} case`}
//             >
//               <div className="work-thumb"><ProjectThumb project={p} variant={0} /></div>
//               <div className="work-meta">
//                 <h3 className="work-name">{p.name}</h3>
//                 <span className="work-year">{p.year}</span>
//               </div>
//               <div className="work-role">{p.role}</div>
//               <p className="work-outcome">{p.outcome}</p>
//             </button>
//           ))}
//         </div>
//       </div>
//     </section>
//   );
// }

function WorkGrid({ onOpen }) {
  return (
    <section className="section section-work" id="work" data-screen-label="Selected Work">
      <div className="container">

        <div className="section-head">
          <div className="head-left">
            <div className="label">02 / Selected Work</div>
            <h2>Recent projects</h2>
          </div>
        </div>

        <img src="/uploads/work/cover.png" alt="Cover image showing thumbnails of projects" style={{ width: "100%", height: "auto", borderRadius: 8 }} />

        <div style={{ marginTop: "2rem", display: "flex", flexDirection: "column", alignItems: "center", gap: "0.75rem" }}>
          <p style={{ margin: 0, opacity: 0.6, fontSize: "0.9rem" }}>View recent demos at this link</p>
          <a className="btn btn-primary" href="https://oddscenes.com/work" target="_blank" rel="noopener noreferrer" style={{ background: "var(--primary-500)", color: "#fff" }}>
            View Work <span className="arrow" aria-hidden="true">↗</span>
          </a>
        </div>

      </div>
    </section>
  );
}

/* ==========================================================================
   Modal
   ========================================================================== */
function ProjectModal({ index, onClose, onPrev, onNext }) {
  const dialogRef = useRef(null);
  useEffect(() => {
    const onKey = (e) => {
      if (e.key === "Escape") onClose();
      else if (e.key === "ArrowLeft") onPrev();
      else if (e.key === "ArrowRight") onNext();
    };
    document.addEventListener("keydown", onKey);
    const prevOverflow = document.body.style.overflow;
    document.body.style.overflow = "hidden";
    return () => {
      document.removeEventListener("keydown", onKey);
      document.body.style.overflow = prevOverflow;
    };
  }, [onClose, onPrev, onNext]);

  if (index == null) return null;
  const p = PROJECTS[index];
  return (
    <div className="modal-backdrop" role="presentation" onClick={onClose}>
      <div
        className="modal"
        role="dialog"
        aria-modal="true"
        aria-labelledby={`modal-${p.id}-title`}
        ref={dialogRef}
        onClick={(e) => e.stopPropagation()}
      >
        <button className="modal-close" type="button" onClick={onClose} aria-label="Close">
          Close <span aria-hidden="true">esc</span>
        </button>
        <div className="modal-head">
          <div>
            <div className="role">{p.role}</div>
            <h3 id={`modal-${p.id}-title`}>{p.name}</h3>
          </div>
          <div className="modal-nav" aria-label="Project navigation">
            <button type="button" onClick={onPrev} aria-label="Previous project">
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6" /></svg>
            </button>
            <button type="button" onClick={onNext} aria-label="Next project">
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6" /></svg>
            </button>
          </div>
        </div>

        <div className="modal-shots">
          <div className="shot"><ProjectThumb project={p} variant={1} /></div>
          <div className="shot"><ProjectThumb project={p} variant={2} /></div>
          <div className="shot"><ProjectThumb project={p} variant={3} /></div>
          <div className="shot"><ProjectThumb project={p} variant={4} /></div>
        </div>

        <div className="modal-grid" style={{ marginTop: 28 }}>
          <div className="modal-context">
            {p.context.map((c, i) => <p key={i}>{c}</p>)}
            <div className="modal-tags">
              {p.tags.map(t => <span key={t} className="tag">{t}</span>)}
            </div>
            {p.external && (
              <div style={{ marginTop: 24 }}>
                <a className="btn btn-ghost" href={p.external} target="_blank" rel="noopener noreferrer">
                  Visit {p.external.replace(/^https?:\/\//, "")} <span className="arrow" aria-hidden="true">↗</span>
                </a>
              </div>
            )}
          </div>
          <div className="kv-list">
            {p.facts.map(([k, v]) => (
              <div className="kv" key={k}>
                <div className="k">{k}</div>
                <div className="v">{v}</div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </div>
  );
}

/* ==========================================================================
   About
   ========================================================================== */
const TIMELINE = [
  ["Nov 2024 / Now",        "Odd Scenes Media", "Creative Director"],
  ["May 2024 / Oct 2024",   "Mode Network",     "Lead Product Designer"],
  ["Dec 2022 / Sep 2023",   "Mantle Network",   "Senior Product Designer"],
  ["Feb 2022 / Sep 2023",   "Windranger Labs",  "Senior Product Designer"],
  ["Apr 2016 / Apr 2022",   "Toptal",           "Freelance Product Designer"],
  // ["Apr 2019 / Jun 2020",   "Scubago",          "Frontend Developer"],
  // ["Apr 2017 / Mar 2019",   "GoHiring GmbH",    "Designer & Frontend Developer"],
];

const SKILL_GROUPS = [
  ["Design", ["Product Design", "UI", "Visual Design", "Brand Identity", "Design Systems", "Information Architecture", "Typography"]],
  ["AI & Automation", ["Human Centered AI Design", "Generative Design", "AI Productivity", "Workflow Design", "Automation", "n8n"]],
  ["Development", ["Front-End", "React.js", "TypeScript", "JavaScript", "Node.js", "CSS"]],
  ["Strategy", ["Product Strategy", "User Research"]],
];

function About() {
  return (
    <section className="section section-bio" id="about" data-screen-label="About">
      <div className="container">
        <div className="section-head">
          <div className="head-left">
            <div className="label">03 / About</div>
            <h2>Senior product designer working at the intersection of design, code, and AI.</h2>
          </div>
          {/* <div className="head-right">
            10 years across SaaS, fintech, web3, and remote startups. Currently solo at Odd Scenes.
          </div> */}
        </div>
        <div className="about-grid">
          <div className="about-bio">
            <p>
              Product designer with a decade of work behind shipped software across SaaS,
              fintech, web3, and remote startups. Comfortable owning a surface end-to-end,
              from research through production.
            </p>
            <p>
              Eight years writing frontend code keeps the work grounded in what is buildable.
              The last two have been spent rebuilding personal practice around AI: agents,
              automation, and tooling that takes most of the production load so the human
              hours go into craft and direction.
            </p>
            {/* <p> */}
              {/* Based in Thailand, working remote globally.  */}
              {/* Most recently Lead Product Designer at Mode Network and Senior Product Designer at Mantle Network. */}
            {/* </p> */}
          </div>
          <div className="timeline" aria-label="Experience" style={{ display: 'none' }}>
            {TIMELINE.map(([dates, company, role], i) => (
              <div className="timeline-item" key={i}>
                <div className="dates">{dates}</div>
                <div className="company">{company}</div>
                <div className="role">{role}</div>
              </div>
            ))}
          </div>
        </div>
        <div className="skills" aria-label="Skills">
          {SKILL_GROUPS.map(([label, items]) => (
            <div className="skill-row" key={label}>
              <div className="label">{label}</div>
              <div className="tags">
                {items.map(it => <span className="tag" key={it}>{it}</span>)}
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ==========================================================================
   Studio
   ========================================================================== */
function Studio({ theme }) {
  return (
    <section className="studio" id="studio" data-screen-label="Studio">
      <div className="container studio-inner">
        <div>
          <div className="studio-rule" aria-hidden="true" />
          <div className="label t-condensed" style={{ color: "var(--fg-subtle)", fontSize: 11, letterSpacing: "0.22em", marginBottom: 14 }}>
            04 / Currently Building
          </div>
          <h2>Odd Scenes.<br /><span style={{ color: "var(--fg-muted)" }}>An AI-native studio.</span></h2>
          <p>
            Odd Scenes is an AI-native design studio for startups and small businesses. Brand,
            web, product, pitch, social, and merch. Built for teams that need senior creative
            work shipped on a startup timeline.
          </p>
          <a className="btn btn-primary" href="https://oddscenes.com" target="_blank" rel="noopener noreferrer" style={{ background: "var(--primary-500)", color: "#fff" }}>
            Visit oddscenes.com <span className="arrow" aria-hidden="true">↗</span>
          </a>
        </div>
        <aside className="studio-card" aria-label="Odd Scenes summary">
          <div className="studio-tag">Studio · Est 2024</div>
          <div className="studio-wordmark">
            {/* <span className="glyph" aria-hidden="true">○</span>
            Odd Scenes */}
            <img src={theme === "light" ? "/uploads/os-logo-lightmode.svg" : "/uploads/os-logo.svg"} alt="Odd Scenes wordmark" style={{ width: "100%", height: "auto", marginBottom: '0.75rem', maxWidth: '290px' }} />
          </div>
          <p style={{ color: "var(--fg-muted)", fontSize: 14, marginTop: 6, marginBottom: 24 }}>
            Solo operator. Custom stack. <br />Senior-level output across surfaces.
          </p>
          <div className="studio-services">
            {["Brand", "Web", "Product", "Pitch", "Social", "Merch"].map(s => (
              <span className="tag" key={s}>{s}</span>
            ))}
          </div>
          <div className="kv-list" style={{ borderLeft: 0, paddingLeft: 0, gap: 12 }}>
            <div className="kv"><div className="k">Pipeline</div><div className="v">60 to 80% automated</div></div>
            <div className="kv"><div className="k">Engagement</div><div className="v">Project · Retainer</div></div>
            <div className="kv"><div className="k">Site</div><div className="v">oddscenes.com</div></div>
          </div>
        </aside>
      </div>
    </section>
  );
}

/* ==========================================================================
   Contact
   ========================================================================== */
function Contact() {
  return (
    <section className="contact" id="contact" data-screen-label="Contact">
      <div className="container">
        <div className="section-head">
          <div className="head-left">
            <div className="label">05 / Contact</div>
          </div>
        </div>
        <h2>Let's <span className="underline">talk.</span></h2>
        <div className="contact-links">
          <a className="contact-link" href="mailto:justin@oddscenes.com">
            <span className="label">Email</span>
            <span className="handle">justin@oddscenes.com</span>
            <span className="arrow" aria-hidden="true">↗</span>
          </a>
          <a className="contact-link" href="https://linkedin.com/in/justinbrazeau" target="_blank" rel="noopener noreferrer">
            <span className="label">LinkedIn</span>
            <span className="handle">linkedin.com/in/justinbrazeau</span>
            <span className="arrow" aria-hidden="true">↗</span>
          </a>
          <a className="contact-link" href="https://github.com/justinbrazeau" target="_blank" rel="noopener noreferrer">
            <span className="label">GitHub</span>
            <span className="handle">github.com/justinbrazeau</span>
            <span className="arrow" aria-hidden="true">↗</span>
          </a>
          <a className="contact-link contact-link-bottom" href="https://x.com/justinbrazeau" target="_blank" rel="noopener noreferrer">
            <span className="label">X</span>
            <span className="handle">x.com/justinbrazeau</span>
            <span className="arrow" aria-hidden="true">↗</span>
          </a>
          {/* <a className="contact-link" href="https://cal.com/justinbrazeau" target="_blank" rel="noopener noreferrer">
            <span className="label">Book a call</span>
            <span className="handle">cal.com/justinbrazeau</span>
            <span className="arrow" aria-hidden="true">↗</span>
          </a> */}
        </div>
      </div>
    </section>
  );
}

function Footer() {
  const year = new Date().getFullYear();
  return (
    <footer className="footer container" role="contentinfo">
      <div className="col">© {year} <strong>Justin Brazeau</strong></div>
      {/* <div className="col">Built solo · Bangkok</div> */}
      <div className="col">v18 · {year}</div>
    </footer>
  );
}

/* ==========================================================================
   App
   ========================================================================== */
function App() {
  const [theme, setTheme] = useTheme();
  const [openIndex, setOpenIndex] = useState(null);
  const open = useCallback((i) => setOpenIndex(i), []);
  const close = useCallback(() => setOpenIndex(null), []);
  const prev = useCallback(() => setOpenIndex(i => (i == null ? 0 : (i - 1 + PROJECTS.length) % PROJECTS.length)), []);
  const next = useCallback(() => setOpenIndex(i => (i == null ? 0 : (i + 1) % PROJECTS.length)), []);

  return (
    <div className="page">
      <TopBar theme={theme} setTheme={setTheme} />
      <main>
        <Hero />
        <WorkGrid onOpen={open} />
        <About />
        <Studio theme={theme} />
        <Contact />
      </main>
      <Footer />
      {openIndex != null && (
        <ProjectModal
          index={openIndex}
          onClose={close}
          onPrev={prev}
          onNext={next}
        />
      )}
    </div>
  );
}

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