// Portfolio content — easy to edit
// Helper to convert hex to RGB for colorizing SVG icons
const hexToRgb = (hex) => {
  const r = parseInt(hex.slice(1, 3), 16);
  const g = parseInt(hex.slice(3, 5), 16);
  const b = parseInt(hex.slice(5, 7), 16);
  return { r, g, b };
};

// Create filter that colorizes black SVGs to a target color
const createColorFilter = (hex) => {
  if (hex === "#ffffff") return "brightness(1.2)";
  const { r, g, b } = hexToRgb(hex);
  const brightness = (r * 0.299 + g * 0.587 + b * 0.114) / 255;
  const hue = Math.atan2(Math.sqrt(3) * (g - b), 2 * r - g - b) * (180 / Math.PI);
  const sat = brightness < 0.5 ? 100 : 80;
  return `brightness(0) saturate(100%) invert(${brightness < 0.5 ? 100 : 0}%) hue-rotate(${hue}deg)`;
};

const TECH = [
  { name: "Java",       color: "#f89820", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/java.svg" alt="Java" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(71%) sepia(51%) saturate(350%) hue-rotate(4deg) brightness(102%)'}} />
  )},
  { name: "Kotlin",     color: "#7F52FF", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/kotlin.svg" alt="Kotlin" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(39%) sepia(70%) saturate(750%) hue-rotate(250deg) brightness(98%)'}} />
  )},
  { name: "JavaScript", color: "#F7DF1E", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/javascript.svg" alt="JavaScript" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(93%) sepia(45%) saturate(1000%) hue-rotate(2deg) brightness(104%)'}} />
  )},
  { name: "TypeScript", color: "#3178C6", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/typescript.svg" alt="TypeScript" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(39%) sepia(84%) saturate(600%) hue-rotate(190deg) brightness(98%)'}} />
  )},
  { name: "React",      color: "#61DAFB", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/react.svg" alt="React" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(75%) sepia(76%) saturate(500%) hue-rotate(150deg) brightness(103%)'}} />
  )},
  { name: "Next.js",    color: "#ffffff", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/nextdotjs.svg" alt="Next.js" style={{width:24,height:24,filter:'brightness(1.2)'}} />
  )},
  { name: "Node.js",    color: "#5FA04E", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/nodedotjs.svg" alt="Node.js" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(55%) sepia(48%) saturate(400%) hue-rotate(80deg) brightness(102%)'}} />
  )},
  { name: "MySQL",      color: "#00758F", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/mysql.svg" alt="MySQL" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(35%) sepia(75%) saturate(600%) hue-rotate(180deg) brightness(98%)'}} />
  )},
  { name: "Paper",      color: "#2C7BE5", icon: (
    <svg viewBox="0 0 24 24" width={24} height={24} xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M23.987 1.004 20.56 21.576a.86.86 0 0 1-.844.71.9.9 0 0 1-.322-.068l-6.067-2.477-3.24 3.95A.83.83 0 0 1 9.43 24a.8.8 0 0 1-.295-.054.85.85 0 0 1-.562-.803V18.47l11.57-14.184L5.827 16.674l-5.29-2.17A.85.85 0 0 1 0 13.768a.87.87 0 0 1 .429-.79L22.715.12a.83.83 0 0 1 .428-.12.853.853 0 0 1 .844 1.004" /></svg>
  )},
  { name: "Astro",      color: "#FF5C97", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/astro.svg" alt="Astro" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(70%) sepia(51%) saturate(450%) hue-rotate(320deg) brightness(104%)'}} />
  )},
  { name: "Gradle",     color: "#6D4C41", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/gradle.svg" alt="Gradle" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(42%) sepia(28%) saturate(250%) hue-rotate(20deg) brightness(95%)'}} />
  )},
  { name: "Git",        color: "#F05032", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/git.svg" alt="Git" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(61%) sepia(49%) saturate(600%) hue-rotate(348deg) brightness(102%)'}} />
  )},
  { name: "Tailwind",   color: "#06B6D4", icon: (
    <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/tailwindcss.svg" alt="Tailwind" style={{width:24,height:24,filter:'brightness(0) saturate(100%) invert(73%) sepia(75%) saturate(450%) hue-rotate(160deg) brightness(104%)'}} />
  )},
];

const TIMELINE = [
  {
    date: "2024 — Present",
    title: "Senior Full-Stack Engineer",
    company: "Aperture Labs",
    desc: "Leading the rebuild of the design-tooling platform. Shipped a collaborative canvas serving 40k+ daily editors with sub-100ms input latency.",
    tags: ["TypeScript", "Next.js", "WebSockets", "Postgres"],
  },
  {
    date: "2022 — 2024",
    title: "Product Engineer",
    company: "Northwind",
    desc: "Owned end-to-end delivery of the merchant onboarding flow. Cut activation time by 38% and rewrote the form runtime as a strongly-typed state machine.",
    tags: ["React", "Node.js", "GraphQL", "XState"],
  },
  {
    date: "2020 — 2022",
    title: "Software Engineer",
    company: "Loomstack",
    desc: "Built the Android client and backend pipelines for a video-collab app. Designed the realtime sync layer and migrated CI to a reproducible Docker setup.",
    tags: ["Kotlin", "Java", "Docker", "gRPC"],
  },
  {
    date: "2019 — 2020",
    title: "Software Engineering Intern",
    company: "Crestone Systems",
    desc: "Wrote internal tools for the data-platform team and contributed performance fixes to a heavily-trafficked Express service.",
    tags: ["JavaScript", "Express", "MySQL"],
  },
];

const PROJECTS = [
  {
    n: "01",
    title: "Loomscript",
    label: "Editor • IDE",
    desc: "A browser-based scripting environment with live multiplayer cursors, hot-reloading runtimes, and a first-class Git story.",
    tags: ["Next.js", "TypeScript", "WASM", "Yjs"],
  },
  {
    n: "02",
    title: "Tideboard",
    label: "Analytics",
    desc: "Realtime KPI dashboards for ops teams. Streams 2M events/min through a custom aggregation engine into reactive visualizations.",
    tags: ["React", "Node.js", "ClickHouse", "Redis"],
  },
  {
    n: "03",
    title: "Quiet Hours",
    label: "iOS App",
    desc: "A focus-timer iOS app with calm motion design and an end-of-day reflection journal. Featured in App Store under Productivity.",
    tags: ["Swift", "Kotlin", "Firebase"],
  },
  {
    n: "04",
    title: "Paperclip",
    label: "Dev tool",
    desc: "A self-hosted clipboard sync service with E2E encryption, offline-first conflict resolution, and a tiny menu-bar client.",
    tags: ["Rust", "TypeScript", "SQLite"],
  },
];

const TESTIMONIALS = [
  {
    featured: true,
    quote: "Sven is the rare engineer who treats the interface as part of the product, not the wrapper around it. He shipped our new editor in a quarter and it still feels like a team of designers worked on it.",
    name: "Priya Ramanathan",
    role: "VP Engineering",
    company: "Aperture Labs",
    initials: "PR",
    accent: "var(--accent)",
  },
  {
    quote: "Calm under pressure, sharp on the details. The migration he led didn't drop a single request.",
    name: "Marcus Hale",
    role: "Staff Engineer",
    company: "Northwind",
    initials: "MH",
  },
  {
    quote: "Half the PRs I review from Sven teach me something. The other half are too clean to argue with.",
    name: "Jules Okafor",
    role: "Tech Lead",
    company: "Loomstack",
    initials: "JO",
  },
  {
    quote: "He turned our prototype into a product without losing the magic that got us excited in the first place.",
    name: "Anna Voss",
    role: "Founder",
    company: "Quiet Hours",
    initials: "AV",
  },
];

Object.assign(window, { TECH, TIMELINE, PROJECTS, TESTIMONIALS });
