// ═══════════════════════════════════════════════════════════════════
// Paulo Lebtag — Portfolio (responsive: mobile / tablet / desktop)
// ═══════════════════════════════════════════════════════════════════
const { useState, useEffect, useRef, useMemo } = React;

/* ─── DATA ─── */
const PROJECTS = [
{ id: 'vonex', code: 'PRJ-001', name: 'CCM', full: 'Customer Communication Management', company: 'CCM', companyUrl: 't6.digital', role: 'Lead UX/UI + PM', year: '2023–Now', status: 'active',
  statusLabel: 'Working', accent: '#7B5FFF',
  tags: ['Omnichannel', 'AI', 'Product Strategy', 'UX/UI', 'CCM', 'CRM', 'WhatsApp', 'RCS', 'Email', 'Interaction Design', 'Research'],
  tagline: 'Unifying 6 communication channels with AI into one intelligent platform.',
  about: 'I helped with the ideation, benchmarking, prototyping, development and implementation of this innovative solution for clients. We developed a solution that combines omnichannel communication, artificial intelligence and data analysis to improve communication.',
  problem: 'Companies struggled with fragmented customer communication—limited channels, no data enrichment, automation without strategic insight, and unpredictable strategy outcomes from lack of real-time intelligence.',
  solution: 'Vonex CCM brings WhatsApp, RCS, SMS, Email, Voice and Chat together with AI automation, real-time analytics, payment integration and a visual Journey Builder — coordinating channels rather than just stacking them.',
  impact: ['Pitched to Samsung, Didi Global and Carrefour', 'Platform reached break-even', 'Led team of 4 designers & PMs as sole senior', '+50% customer satisfaction via coordinated channels (academic research)', 'In-person + remote sales support at industry events', 'Trained new clients post-implementation'],
  Demo: () => window.VonexDemo ? React.createElement(window.VonexDemo) : null,
  behance: 'https://www.behance.net/gallery/221141557/CCM-My-participation-in-this-project',
  behanceResearch: 'https://www.behance.net/gallery/230515536/CCM-UX-Research',
  leadership: 'As the only senior professional on the team, I took on a leadership role — leveraging my experience to guide and coordinate the project. I worked alongside a junior designer, a mid-level UX/UI designer and two mid-level product managers, ensuring alignment between design, business strategy and technical feasibility. My responsibilities spanned both UX and Product Management, making me directly accountable for visual design decisions, user experience flow analysis and strategic roadmap planning.',
  team: '1 Senior (lead) · 1 Junior Designer · 1 Mid UX/UI · 2 Mid Product Managers',
  whatIsCCM: 'A Customer Communication Management (CCM) system streamlines and enhances how businesses communicate with their customers across multiple channels. It centralizes and manages all customer interactions, ensuring consistency, personalization and efficiency in every message delivered.',
  problemDetails: [
    ['Limited Communication Channels', 'Companies often rely on a few channels to reach customers, reducing engagement opportunities.'],
    ['Negative Feedback in Digital Spaces', 'The lack of responsive and personalized communication leads to a surge in online criticism.'],
    ['Insufficient Personalized Service', 'Providing tailored experiences is a struggle without the right tools.'],
    ['Database Management Challenges', 'Organizing, enriching and keeping customer data accurate is a complex task.'],
    ['Low Team Productivity', 'The absence of streamlined processes hampers efficiency.'],
    ['Unpredictable Strategy Outcomes', 'Businesses are frequently surprised by results due to lack of real-time insights.']
  ],
  traditionalLimitations: [
    ['Channel Integration Gaps', 'Omnichannel systems offer multiple channels but lack the coordination needed for a unified experience.'],
    ['Mailing Management Without Enrichment', 'They manage customer lists but ignore essential tasks like data enrichment, lead nurturing and cleansing.'],
    ['Automation Without Co-Creation', 'Automation is available but rarely includes co-creating customer journeys to enhance engagement.'],
    ['Reports Without Strategic Insight', 'Reports and dashboards exist but fail to deliver actionable insights that drive real-time strategy adjustments.']
  ],
  modules: [
    ['Messenger', 'Send individual and mass messages efficiently across WhatsApp, RCS, SMS, Email, Voice and Chat.'],
    ['Automaton AI', 'Integrates AI to automate operations, enhancing responsiveness and accuracy.'],
    ['Finance', 'Facilitates smooth payment transactions directly within the communication system.'],
    ['Advance', 'Data-driven insights to support and evolve business strategies.'],
    ['Elos', 'Diverse integration options to unify different platforms and tools.'],
    ['Presence 4.0', 'Cutting-edge technology solutions to enhance physical environments.']
  ],
  responsibilities: [
    'Involved since project inception — first to start working on it. Led ideation, benchmarking, prototyping, development and implementation.',
    'Designed visual presentations and pitched the project to Samsung, Didi Global, Carrefour and other major companies.',
    'Led the implementation of AI-driven solutions, data analytics and omnichannel capabilities within the system.',
    'Created the visual style for the platform and coordinated the style guide — assisting in the future development of a design system.',
    'Oversaw developers as they coded the interfaces, ensuring adherence to defined rules for both BackEnd and FrontEnd.',
    'Conducted competitor research with parametric analysis across numerous features; researched early adopters and their characteristics.',
    'Helped sell the product at events (in-person and remotely) and trained new clients post-implementation.'
  ],
  insightStat: ['50%', 'Boost in customer satisfaction from effectively coordinated channels — according to academic research that underpinned the strategic direction of the platform.'],
  uxResearchNote: 'A dedicated UX Research effort (with Maria Clara Coimbra and Suzany Nogueira) is documented separately on Behance — covering communication, CRM and AI workstreams that fed into the CCM roadmap.' },
{ id: 'unipix', code: 'PRJ-002', name: 'SMS Campaign System', full: 'SMS Marketing Platform', company: 'SMS Campaign System', companyUrl: 'unipix.com.br', role: 'Lead UX/UI + PM', year: '2022', status: 'done',
  statusLabel: 'Finished', accent: '#00CCFF',
  tags: ['SaaS', 'Campaign UX', 'Analytics', 'Design System', 'NOC'],
  tagline: 'Turning a white-label dependency into a proprietary SMS platform — one that reached break-even fast and now drives recurring revenue for Vonex.',
  about: 'As the only senior on the team, I led UX and Product Management to design Vonex’s own bulk-SMS marketing platform: campaign creation and scheduling, real-time delivery tracking, engagement analytics and a companion NOC (Network Operations Center) — replacing the rented white-label system the company depended on.',
  problem: 'Vonex resold SMS dispatch through third-party white-label systems. That left the company with no control over the user experience, no room to scale and razor-thin margins — and the customer data lived inside someone else’s platform.',
  problemDetails: [
    ['No control over UX', 'The rented platform could not be tailored to clients or to Vonex’s own operation.'],
    ['Capped scalability', 'Third-party limits throttled volume and blocked growth.'],
    ['Thin margins', 'Reselling someone else’s product left little room for profitability.'],
    ['No data ownership', 'Delivery and engagement data stayed locked inside the vendor’s system.']
  ],
  solution: 'We designed two coordinated products: the SMS platform for creating, scheduling and tracking bulk campaigns, and a NOC for client configuration and message-delivery oversight. Grounded in a competitor benchmark and a full service blueprint, the work shipped as a complete Design System for a consistent, intuitive experience across the platform.',
  modulesTitle: 'Platform Capabilities',
  modules: [
    ['Campaign Manager', 'Create and schedule multiple bulk-SMS campaigns at once, organized by cost center and product route.'],
    ['Real-time Tracking', 'Live delivery status — handset, operator, scheduled, failed — as each campaign runs.'],
    ['Engagement Analytics', 'Clicks, replies, time-to-open and click-by-region maps to measure every send.'],
    ['Mailing Validation', 'Validate and cleanse contact lists before dispatch, with black/white-list management.'],
    ['NOC', 'A Network Operations Center for client configuration and message-delivery oversight.'],
    ['Four SMS routes', 'UniSMS Long, Short, LA Exclusivo and Fast — matched to each campaign’s volume and speed.']
  ],
  leadership: 'I was the only senior professional on the team, leading both UX and Product Management. I mentored a junior designer and partnered with a mid-level product manager, balancing strategic thinking, hands-on design and the migration roadmap that moved existing customers onto the new system.',
  team: '1 Senior (lead) · 1 Junior Designer · 1 Mid Product Manager',
  responsibilities: [
    'Ran a comprehensive benchmark of the main competitors — UI, feature set and cost — to understand the SMS-delivery market.',
    'Built a complete service blueprint mapping the end-to-end campaign process.',
    'Designed the campaign-management and analytics flows, plus the NOC for delivery oversight.',
    'Created the Design System and style guides for a uniform experience across the platform.',
    'Planned the roadmap to migrate existing white-label customers onto the new system.'
  ],
  insightStat: ['2', 'Two coordinated systems were designed — the SMS campaign platform for dispatches and a NOC (Network Operations Center) for client configuration and delivery oversight.'],
  impact: ['Reached break-even swiftly and now drives significant revenue and profit', 'Two coordinated products shipped: SMS platform + NOC', 'Full Design System and style guide delivered', 'Competitor benchmark + end-to-end service blueprint', 'Migration roadmap moved white-label customers onto the new platform', 'Raised leadership’s recognition of design’s strategic value'],
  Demo: () => window.UnipixDemo ? React.createElement(window.UnipixDemo) : null,
  behance: 'https://www.behance.net/gallery/221142857/SMS-Marketing-Platform',
  site: 'https://unipix.com.br/prod-sms.html' },
{ id: 'agrodash', code: 'PRJ-003', name: 'AgroDash', full: 'Precision Agriculture Analytics Dashboard', company: 'AgroDash', companyUrl: 'agritech.com.br', role: 'Lead Product Designer', year: '2023', status: 'done',
  statusLabel: 'Soon', soon: true, accent: '#00E59F',
  tags: ['AgriTech', 'Data Viz', 'Dashboard', 'B2B'],
  tagline: 'Real-time farm intelligence: crop health, irrigation, weather and financials in one view.',
  about: 'I designed a precision agriculture dashboard for a rural cooperative in Goiás with interactive farm plot maps, crop health monitoring, automated irrigation scheduling, climate alerts and revenue forecasting.',
  problem: 'A rural cooperative in Goiás managed 354 ha across spreadsheets and disconnected apps—no unified view of crop health, irrigation needs or financial performance.',
  solution: 'Designed a precision agriculture dashboard with interactive farm plot maps, crop health monitoring, automated irrigation scheduling, climate alerts and revenue forecasting.',
  impact: ['354 ha monitored across 7 plot types', '2× faster operational decisions', 'Irrigation water waste reduced 18%', 'Pilot expanded to 3 additional cooperatives'],
  Demo: () => window.AgroDash ? React.createElement(window.AgroDash) : null,
  behance: null },
{ id: 'gestor', code: 'PRJ-004', name: 'Gestor Food', full: 'Food Orders Management App', company: 'Gestor Food', companyUrl: 'gestorfood.com.br', role: 'Lead Product Designer', year: '2022', status: 'done',
  statusLabel: 'Soon', soon: true, accent: '#FFB020',
  tags: ['Mobile', 'Food-tech', 'Kanban', 'B2B'],
  tagline: 'Replacing paper tickets and WhatsApp chaos with real-time order intelligence.',
  about: 'I designed a tablet-first order management app with a Kanban board, live table map, role-specific views for kitchen vs floor staff, and end-of-day reporting.',
  problem: 'Restaurant staff managed orders across paper, WhatsApp and verbal instructions—causing errors, delays and customer dissatisfaction at peak hours.',
  solution: 'Designed a tablet-first order management app with a Kanban board, live table map, role-specific views for kitchen vs floor staff, and end-of-day reporting.',
  impact: ['Order error rate reduced 60%', 'Average ticket processing time down 3 min', 'Deployed in 5-restaurant pilot', 'Manager satisfaction score 9.2/10'],
  Demo: () => window.GestorDemo ? React.createElement(window.GestorDemo) : null,
  behance: 'https://www.behance.net/gallery/221314201/Gestor-Food-Orders-App' }];

const EXTRA_TABLE_ROWS = [
{ id: 'acsp', company: 'Microentrepreneur Portal', companyUrl: 'acsp.com.br', statusLabel: 'Soon', soon: true,
  title: 'ERP', about: 'I assisted from the ideation, benchmarking, and prototyping stages. We developed a mini-ERP for small entrepreneurs, with features for managing inflows and outflows, including full tax control.' },
{ id: 'cefasfv', company: 'CefasFV', companyUrl: 'concretize.com.br', statusLabel: 'Soon', soon: true,
  title: 'Redesign of Salesapp', about: 'We completely redesigned an app to help external wholesale sellers. Through the app, it is possible to place sales orders, schedule deliveries and manage the entire customer portfolio.' },
{ id: 'cefaserp', company: 'CefasERP', companyUrl: 'concretize.com.br', statusLabel: 'Soon', soon: true,
  title: 'Redesign of ERP MENU', about: 'Redesign of the home screen with the navigation architecture of the Cefas ERP.' },
{ id: 'tempo', company: 'Tempo Telecom', companyUrl: 'www.tempooficial.com.br', statusLabel: 'Soon', soon: true,
  title: 'Telephone line management App', about: 'We designed an application for managing telephone lines.' }];

const BEHANCE_LINKS = [
{ title: 'CCM — Customer Communication Management', company: 't6.digital', year: '2023–Now', url: 'https://www.behance.net/gallery/221141557/CCM-My-participation-in-this-project', type: 'B2B SaaS · AI · CCM' },
{ title: 'SMS Marketing Platform', company: 'unipix.com.br', year: '2022', url: 'https://www.behance.net/gallery/221142857/SMS-Marketing-Platform', type: 'SaaS · Campaign UX' },
{ title: 'Mini-ERP for Microentrepreneurs', company: 'acsp.com.br', year: '2021', url: 'https://www.behance.net/gallery/221226905/Web-platform-for-micro-entrepreneurs', type: 'ERP · Small Business' },
{ title: 'Redesign of CefasFV Salesapp', company: 'concretize.com.br', year: '2021', url: 'https://www.behance.net/gallery/221139377/Redesign-of-the-Cefas-Sales-App', type: 'Mobile · Wholesale' },
{ title: 'Redesign of the Menu of CefasERP', company: 'concretize.com.br', year: '2021', url: 'https://www.behance.net/gallery/221137853/Redesign-of-the-Menu-of-CefasERP', type: 'ERP · Navigation' },
{ title: 'Gestor — Food Orders App', company: 'Internal Project', year: '2022', url: 'https://www.behance.net/gallery/221314201/Gestor-Food-Orders-App', type: 'Mobile · B2B' },
{ title: 'Paulo Lebtag — Full Profile', company: 'Behance', year: '—', url: 'https://www.behance.net/paulolebtag', type: 'Portfolio Profile' }];

const EDUCATION = {
  software: [
  { school: 'Estácio de Sá University', degree: 'Graduation in Software Engineering at Estácio de Sá University',
    detail: 'I started a new graduation in software to deepen my technical knowledge and further explore Artificial Intelligence and Data Analysis.',
    period: '2024–Currently', active: true, logoText: 'Estácio', logoBg: '#3a3a3a' }],
  design: [
  { school: 'Federal University of Goiás', degree: "Master's degree in Visual Arts at the Federal University of Goiás",
    detail: 'I conducted research in Interface Design, exploring the temporal experience of interaction with graphical user interfaces to discover new development possibilities and methodological approaches. This is my master’s dissertation, “A perspectiva temporal no projeto de interfaces gráficas” (2021).',
    period: '2019–2020', logoText: 'UFG', logoBg: '#1f2937',
    link: 'https://repositorio.bc.ufg.br/tede/items/56e15ee9-f5af-454d-aabe-e0e88b2814b3', linkLabel: 'Read the dissertation ↗' },
  { school: 'Federal University of Goiás', degree: 'Postgraduate in Strategic Design at the Federal University of Goiás',
    detail: 'In my postgraduate studies, I researched business rules and developed support service redesign projects using Design Thinking tools.',
    period: '2019–2020', logoText: 'UFG', logoBg: '#1f2937' },
  { school: 'Federal University of Goiás', degree: 'Graduation in Graphic Design at the Federal University of Goiás',
    detail: 'During my studies, I researched graphic interface projects for the web.',
    period: '2011–2015', logoText: 'UFG', logoBg: '#1f2937' }]
};

/* ─── ICONS (lucide-style) ─── */
const Ic = {
  home: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /><polyline points="9 22 9 12 15 12 15 22" /></svg>,
  user: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="8" r="4" /><path d="M4 21a8 8 0 0 1 16 0" /></svg>,
  grad: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><path d="M22 10v6M2 10l10-5 10 5-10 5z" /><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5" /></svg>,
  briefcase: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="7" width="20" height="14" rx="2" /><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16" /></svg>,
  mail: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="4" width="20" height="16" rx="2" /><path d="m22 7-10 6L2 7" /></svg>,
  file: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /></svg>,
  search: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><circle cx="11" cy="11" r="7" /><path d="m21 21-4.3-4.3" /></svg>,
  filter: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" /></svg>,
  eye: (s) => <svg width={s || 18} height={s || 18} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z" /><circle cx="12" cy="12" r="3" /></svg>,
  trash: (s) => <svg width={s || 18} height={s || 18} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><polyline points="3 6 5 6 21 6" /><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /></svg>,
  pencil: (s) => <svg width={s || 18} height={s || 18} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" /><path d="m18.5 2.5 3 3L12 15l-4 1 1-4z" /></svg>,
  close: (s) => <svg width={s || 14} height={s || 14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>,
  menu: (s) => <svg width={s || 22} height={s || 22} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><line x1="3" y1="6" x2="21" y2="6" /><line x1="3" y1="12" x2="21" y2="12" /><line x1="3" y1="18" x2="21" y2="18" /></svg>,
  sortDown: (s) => <svg width={s || 10} height={s || 10} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="6 9 12 15 18 9" /></svg>,
  arrowUp: (s) => <svg width={s || 14} height={s || 14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><line x1="12" y1="19" x2="12" y2="5" /><polyline points="5 12 12 5 19 12" /></svg>,
  dots: (s) => <svg width={s || 16} height={s || 16} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><circle cx="5" cy="12" r="1" /><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /></svg>,
  clock: (s) => <svg width={s || 13} height={s || 13} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10" /><polyline points="12 6 12 12 16 14" /></svg>,
  linkedin: (s) => <svg width={s || 18} height={s || 18} viewBox="0 0 24 24" fill="currentColor"><path d="M20.5 2h-17A1.5 1.5 0 0 0 2 3.5v17A1.5 1.5 0 0 0 3.5 22h17a1.5 1.5 0 0 0 1.5-1.5v-17A1.5 1.5 0 0 0 20.5 2zM8 19H5v-9h3zM6.5 8.25A1.75 1.75 0 1 1 8.25 6.5 1.75 1.75 0 0 1 6.5 8.25zM19 19h-3v-4.74c0-1.42-.6-1.93-1.38-1.93s-1.62.42-1.62 2v4.67h-3v-9h2.92v1.31a3.11 3.11 0 0 1 2.7-1.4c1.55 0 3.38.86 3.38 3.86z" /></svg>,
  whatsapp: (s) => <svg width={s || 18} height={s || 18} viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.5 2 2 6.5 2 12c0 1.76.46 3.45 1.32 4.95L2 22l5.25-1.38A9.94 9.94 0 0 0 12 22c5.5 0 10-4.5 10-10S17.5 2 12 2zm5.84 14.16c-.25.7-1.45 1.36-2.02 1.41-.55.05-1.07.32-3.6-.74-3.04-1.27-5-4.37-5.15-4.58-.15-.2-1.25-1.66-1.25-3.16 0-1.5.79-2.24 1.07-2.55.28-.31.61-.39.81-.39h.58c.19 0 .43-.07.67.51.25.6.84 2.04.91 2.19.07.15.12.32.02.51-.1.2-.15.31-.3.48-.15.17-.32.38-.46.51-.15.15-.31.31-.13.61.18.3.79 1.31 1.7 2.12 1.17 1.04 2.15 1.36 2.45 1.51.3.15.48.13.66-.08.18-.21.76-.89.96-1.19.2-.3.4-.25.68-.15.27.1 1.73.81 2.02.96.3.15.5.22.57.34.07.13.07.73-.18 1.43z" /></svg>,
  flag: (s) => <svg width={s || 16} height={(s || 16) * 0.75} viewBox="0 0 32 22" style={{ borderRadius: 2 }}><rect width="32" height="22" fill="#009b3a" /><polygon points="16,3 29,11 16,19 3,11" fill="#fedf00" /><circle cx="16" cy="11" r="4.5" fill="#002776" /></svg>,
  pin: (s) => <svg width={s || 20} height={(s || 20) * 1.2} viewBox="0 0 24 30" fill="none"><path d="M12 0C5.4 0 0 5.4 0 12c0 9 12 18 12 18s12-9 12-18C24 5.4 18.6 0 12 0z" fill="#22c55e" /><circle cx="12" cy="12" r="4.5" fill="#fff" /></svg>
};

/* ─── NAV ─── */
const NAV = [
{ id: 'home', icon: Ic.home, label: 'Home' },
{ id: 'about', icon: Ic.user, label: 'About' },
{ id: 'education', icon: Ic.grad, label: 'Education' },
{ id: 'work', icon: Ic.briefcase, label: 'Work' },
{ id: 'contact', icon: Ic.mail, label: 'Contact' },
{ id: 'appendix', icon: Ic.file, label: 'Appendix' }];

/* ─── VIEWPORT HOOK ─── */
function useViewport() {
  const [w, setW] = useState(typeof window !== 'undefined' ? window.innerWidth : 1280);
  useEffect(() => {
    const fn = () => setW(window.innerWidth);
    window.addEventListener('resize', fn);
    return () => window.removeEventListener('resize', fn);
  }, []);
  return { w, isMobile: w <= 768, isTablet: w > 768 && w <= 1024, isDesktop: w > 1024 };
}

/* ─── Walking cursor (decorative, follows a CSS keyframe path) ─── */
function WalkingCursor({ label, color = '#1a9fff', animation = 'cursor-walk 24s ease-in-out infinite', top, left, right, bottom, delay = '0s', zIndex = 50 }) {
  return (
    <div style={{ position: 'absolute', top, left, right, bottom, zIndex, animation, animationDelay: delay, willChange: 'transform', pointerEvents: 'none' }}>
      <svg width="22" height="22" viewBox="0 0 24 24" fill={color} stroke="#fff" strokeWidth="1.5" style={{ filter: 'drop-shadow(0 2px 4px rgba(0,0,0,0.3))' }}>
        <path d="M5 3l4 16 3-7 7-3z" />
      </svg>
      <div style={{ background: color, color: '#fff', padding: '4px 10px', borderRadius: 5, fontSize: 13, fontWeight: 500, marginTop: -2, marginLeft: 14, whiteSpace: 'nowrap', boxShadow: `0 4px 10px ${color}66`, fontFamily: 'Inter' }}>{label}</div>
    </div>
  );
}

/* ─── Real user cursor enhancement (follows actual mouse) ─── */
function UserCursor() {
  const ref = useRef(null);
  const innerRef = useRef(null);
  const [enabled, setEnabled] = useState(false);
  // Only enable on devices with a real (fine) pointer
  useEffect(() => {
    if (typeof window === 'undefined' || !window.matchMedia('(pointer: fine)').matches) return;
    setEnabled(true);
  }, []);

  // Once enabled (so the cursor element is mounted), follow the real mouse
  // and hide the native OS cursor so only this one shows.
  useEffect(() => {
    const el = ref.current;
    if (!enabled || !el) return;
    const inner = innerRef.current;
    const hideNative = document.createElement('style');
    hideNative.textContent = '*,*::before,*::after{cursor:none !important}';
    document.head.appendChild(hideNative);
    // Is the element under the pointer interactive? cursor:none hides native hints,
    // so detect by tag / role / data-actionable / an inline pointer|resize cursor.
    const isActionable = (px, py) => {
      let n = document.elementFromPoint(px, py);
      for (let i = 0; n && i < 6; i++, n = n.parentElement) {
        const t = n.tagName;
        if (t === 'BUTTON' || t === 'A' || t === 'INPUT' || t === 'SELECT' || t === 'TEXTAREA' || t === 'LABEL') return true;
        if (n.getAttribute && (n.getAttribute('role') === 'button' || n.hasAttribute('data-actionable'))) return true;
        const c = n.style && n.style.cursor;
        if (c && (c.indexOf('pointer') !== -1 || c.indexOf('resize') !== -1)) return true;
      }
      return false;
    };
    let raf = 0, x = -100, y = -100;
    const onMove = (e) => { x = e.clientX; y = e.clientY; el.style.opacity = '1'; if (!raf) raf = requestAnimationFrame(apply); };
    const apply = () => { raf = 0; el.style.transform = `translate3d(${x}px, ${y}px, 0)`; if (inner) inner.style.transform = `scale(${isActionable(x, y) ? 1.07 : 1})`; };
    const onEnter = () => { el.style.opacity = '1'; };
    const onLeave = () => { el.style.opacity = '0'; };
    window.addEventListener('mousemove', onMove, { passive: true });
    document.addEventListener('mouseenter', onEnter);
    document.addEventListener('mouseleave', onLeave);
    return () => {
      window.removeEventListener('mousemove', onMove);
      document.removeEventListener('mouseenter', onEnter);
      document.removeEventListener('mouseleave', onLeave);
      cancelAnimationFrame(raf);
      hideNative.remove();
    };
  }, [enabled]);
  if (!enabled) return null;
  return (
    <div ref={ref} style={{ position: 'fixed', top: 0, left: 0, zIndex: 9999, pointerEvents: 'none', transform: 'translate3d(-100px,-100px,0)', opacity: 0, transition: 'opacity .2s' }}>
      <div ref={innerRef} style={{ transformOrigin: '0 0', transition: 'transform .12s ease' }}>
        <svg width="22" height="22" viewBox="0 0 24 24" fill="#22c55e" stroke="#fff" strokeWidth="1.5" style={{ filter: 'drop-shadow(0 2px 4px rgba(0,0,0,0.4))' }}>
          <path d="M5 3l4 16 3-7 7-3z" />
        </svg>
        <div style={{ background: '#22c55e', color: '#fff', padding: '4px 10px', borderRadius: 5, fontSize: 13, fontWeight: 600, marginTop: -2, marginLeft: 14, whiteSpace: 'nowrap', boxShadow: '0 4px 10px rgba(34,197,94,0.5)', fontFamily: 'Inter' }}>You</div>
      </div>
    </div>
  );
}

/* ─── Simulated visitor cursors (decorative) — 1–3 per page, roam the viewport ─── */
const VISITOR_SETS = {
  home:      [ { label: 'Visitor 7',  color: '#06b6d4', animation: 'visitor-walk-b 30s ease-in-out infinite', left: '68%', top: '66%', delay: '-8s' } ],
  about:     [ { label: 'Visitor 4',  color: '#ec4899', animation: 'visitor-walk-a 26s ease-in-out infinite', left: '22%', top: '30%', delay: '-2s' },
               { label: 'Visitor 9',  color: '#14b8a6', animation: 'visitor-walk-c 32s ease-in-out infinite', right: '18%', top: '60%', delay: '-12s' } ],
  education: [ { label: 'Visitor 5',  color: '#f97316', animation: 'visitor-walk-d 29s ease-in-out infinite', left: '30%', top: '55%', delay: '-6s' },
               { label: 'Visitor 12', color: '#8b5cf6', animation: 'visitor-walk-a 34s ease-in-out infinite', right: '26%', top: '24%', delay: '-15s' } ],
  work:      [ { label: 'Visitor 18', color: '#06b6d4', animation: 'visitor-walk-a 31s ease-in-out infinite', left: '18%', top: '64%', delay: '-9s' },
               { label: 'Visitor 21', color: '#ec4899', animation: 'visitor-walk-e 35s ease-in-out infinite', left: '48%', top: '22%', delay: '-18s' },
               { label: 'Visitor 27', color: '#a855f7', animation: 'visitor-walk-c 27s ease-in-out infinite', right: '30%', top: '50%', delay: '-22s' } ],
  detail:    [ { label: 'Visitor 6',  color: '#14b8a6', animation: 'visitor-walk-a 30s ease-in-out infinite', right: '16%', top: '40%', delay: '-5s' } ],
  contact:   [ { label: 'Visitor 8',  color: '#f97316', animation: 'visitor-walk-c 28s ease-in-out infinite', left: '22%', top: '32%', delay: '-4s' },
               { label: 'Visitor 24', color: '#8b5cf6', animation: 'visitor-walk-b 33s ease-in-out infinite', right: '20%', top: '66%', delay: '-14s' } ],
  appendix:  [ { label: 'Visitor 11', color: '#ec4899', animation: 'visitor-walk-d 29s ease-in-out infinite', left: '28%', top: '40%', delay: '-7s' },
               { label: 'Visitor 15', color: '#06b6d4', animation: 'visitor-walk-e 34s ease-in-out infinite', right: '24%', top: '28%', delay: '-16s' } ]
};

function VisitorLayer({ view, vp }) {
  if (vp && vp.isMobile) return null;
  const set = VISITOR_SETS[view] || [];
  if (!set.length) return null;
  return (
    <div style={{ position: 'fixed', inset: 0, pointerEvents: 'none', overflow: 'hidden', zIndex: 45 }}>
      {set.map((v, i) => <WalkingCursor key={view + '-' + i} {...v} zIndex={45} />)}
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   SIDEBAR  (desktop)  /  TOP-BAR + DRAWER  (mobile)
   ─────────────────────────────────────────────────────────── */
function Sidebar({ view, setView, vp }) {
  const [drawerOpen, setDrawerOpen] = useState(false);
  const isMobile = vp.isMobile;

  if (isMobile) {
    return (
      <>
        <header style={{ position: 'sticky', top: 0, zIndex: 100, height: 56, background: 'var(--bg2)', borderBottom: '1px solid var(--b1)', display: 'flex', alignItems: 'center', padding: '0 16px', gap: 12, flexShrink: 0 }}>
          <div style={{ display: 'flex', alignItems: 'baseline', gap: 4 }}>
            <span style={{ fontFamily: 'Inter', fontWeight: 900, fontSize: 20, lineHeight: 1, color: '#fff', letterSpacing: -1 }}>Paulo</span>
            <span style={{ fontFamily: 'Inter', fontWeight: 900, fontSize: 20, lineHeight: 1, color: 'var(--ac-blue)', letterSpacing: -1 }}>Lebtag</span>
          </div>
          <div style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center', gap: 8 }}>
            <div style={{ width: 7, height: 7, borderRadius: '50%', background: 'var(--ac3)', boxShadow: '0 0 6px var(--ac3)', animation: 'blink 2.5s infinite' }} />
            <span style={{ fontSize: 11, color: 'var(--ac3)', fontWeight: 500 }}>Available</span>
          </div>
          <button onClick={() => setDrawerOpen(true)} style={{ background: 'transparent', border: 'none', color: '#fff', cursor: 'pointer', padding: 4, display: 'flex' }}>
            {Ic.menu(22)}
          </button>
        </header>
        {drawerOpen && (
          <div onClick={() => setDrawerOpen(false)} style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.55)', zIndex: 200 }}>
            <div onClick={(e) => e.stopPropagation()} style={{ position: 'absolute', top: 0, right: 0, bottom: 0, width: 260, maxWidth: '85vw', background: 'var(--bg2)', borderLeft: '1px solid var(--b1)', display: 'flex', flexDirection: 'column' }}>
              <div style={{ display: 'flex', alignItems: 'center', padding: '16px 22px', borderBottom: '1px solid var(--b1)' }}>
                <div>
                  <div style={{ fontFamily: 'Inter', fontWeight: 900, fontSize: 24, lineHeight: 0.95, color: '#fff', letterSpacing: -1.2 }}>Paulo</div>
                  <div style={{ fontFamily: 'Inter', fontWeight: 900, fontSize: 24, lineHeight: 0.95, color: 'var(--ac-blue)', letterSpacing: -1.2 }}>Lebtag</div>
                </div>
                <button onClick={() => setDrawerOpen(false)} style={{ marginLeft: 'auto', background: 'transparent', border: 'none', color: '#fff', cursor: 'pointer', padding: 4, display: 'flex' }}>{Ic.close(18)}</button>
              </div>
              <nav style={{ flex: 1, padding: '12px', display: 'flex', flexDirection: 'column', gap: 2 }}>
                {NAV.map((n) => {
                  const on = view === n.id || (view === 'detail' && n.id === 'work');
                  return (
                    <button key={n.id} onClick={() => { setView(n.id); setDrawerOpen(false); }}
                      style={{ padding: '12px 14px', borderRadius: 8, border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 12, textAlign: 'left',
                        background: on ? 'var(--bg4)' : 'transparent', color: on ? '#fff' : 'var(--t3)' }}>
                      <span style={{ color: on ? 'var(--ac-blue)' : 'var(--t3)' }}>{n.icon(17)}</span>
                      <span style={{ fontSize: 14, fontWeight: on ? 600 : 500 }}>{n.label}</span>
                    </button>
                  );
                })}
              </nav>
              <div style={{ padding: '16px 22px', borderTop: '1px solid var(--b1)' }}>
                <div style={{ display: 'flex', gap: 8 }}>
                  <a href="https://www.linkedin.com/in/paulolebtag/" target="_blank" rel="noreferrer" style={{ flex: 1, padding: '9px', borderRadius: 6, border: '1px solid var(--b2)', background: 'var(--bg3)', color: '#0a66c2', display: 'flex', alignItems: 'center', justifyContent: 'center', textDecoration: 'none' }}>{Ic.linkedin(16)}</a>
                  <a href="https://www.behance.net/paulolebtag" target="_blank" rel="noreferrer" style={{ flex: 1, padding: '9px', borderRadius: 6, border: '1px solid var(--b2)', background: 'var(--bg3)', color: 'var(--ac-blue)', fontSize: 12, fontWeight: 700, textDecoration: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>Be</a>
                </div>
                <div style={{ fontSize: 10, color: 'var(--t4)', fontFamily: 'var(--ff-mono)', marginTop: 12 }}>v3.0 · 2026</div>
              </div>
            </div>
          </div>
        )}
      </>
    );
  }

  // Desktop / tablet sidebar
  const w = vp.isTablet ? 180 : 220;
  return (
    <div style={{ width: w, height: '100vh', background: 'var(--bg2)', borderRight: '1px solid var(--b1)', display: 'flex', flexDirection: 'column', flexShrink: 0 }}>
      <div style={{ padding: '24px 22px 18px', borderBottom: '1px solid var(--b1)' }}>
        <div style={{ fontFamily: 'Inter', fontWeight: 900, fontSize: 30, lineHeight: 0.95, color: '#fff', letterSpacing: -1.5 }}>Paulo</div>
        <div style={{ fontFamily: 'Inter', fontWeight: 900, fontSize: 30, lineHeight: 0.95, color: 'var(--ac-blue)', letterSpacing: -1.5 }}>Lebtag</div>
        <div style={{ color: 'var(--t3)', marginTop: 6, fontFamily: 'var(--ff-mono)', letterSpacing: 0.5, fontSize: 10 }}>Sr. AI Product Designer</div>
      </div>
      <div style={{ padding: '12px 22px', borderBottom: '1px solid var(--b1)', display: 'flex', alignItems: 'center', gap: 8 }}>
        <div style={{ width: 7, height: 7, borderRadius: '50%', background: 'var(--ac3)', boxShadow: '0 0 6px var(--ac3)', animation: 'blink 2.5s infinite' }} />
        <span style={{ fontSize: 11, color: 'var(--ac3)', fontWeight: 500 }}>Available to work</span>
      </div>
      <nav style={{ flex: 1, padding: '10px 12px', display: 'flex', flexDirection: 'column', gap: 2 }}>
        {NAV.map((n) => {
          const on = view === n.id || (view === 'detail' && n.id === 'work');
          return (
            <button key={n.id} onClick={() => setView(n.id)}
              style={{ width: '100%', padding: '10px 12px', borderRadius: 8, border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 11, textAlign: 'left', transition: 'all 0.15s', background: on ? 'var(--bg4)' : 'transparent', color: on ? '#fff' : 'var(--t3)' }}>
              <span style={{ color: on ? 'var(--ac-blue)' : 'var(--t3)', flexShrink: 0 }}>{n.icon(16)}</span>
              <span style={{ fontSize: 13, fontWeight: on ? 600 : 500 }}>{n.label}</span>
              {on && <div style={{ marginLeft: 'auto', width: 5, height: 5, borderRadius: '50%', background: 'var(--ac-blue)' }} />}
            </button>);
        })}
      </nav>
      <div style={{ padding: '16px 22px', borderTop: '1px solid var(--b1)' }}>
        <div style={{ display: 'flex', gap: 8, marginBottom: 10 }}>
          <a href="https://www.linkedin.com/in/paulolebtag/" target="_blank" rel="noreferrer" style={{ flex: 1, padding: '7px', borderRadius: 6, border: '1px solid var(--b2)', background: 'var(--bg3)', color: '#0a66c2', display: 'flex', alignItems: 'center', justifyContent: 'center', textDecoration: 'none' }}>{Ic.linkedin(15)}</a>
          <a href="https://www.behance.net/paulolebtag" target="_blank" rel="noreferrer" style={{ flex: 1, padding: '7px', borderRadius: 6, border: '1px solid var(--b2)', background: 'var(--bg3)', color: 'var(--ac-blue)', fontSize: 11, fontWeight: 700, textDecoration: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>Be</a>
        </div>
        <div style={{ fontSize: 10, color: 'var(--t4)', fontFamily: 'var(--ff-mono)' }}>v3.0 · 2026</div>
      </div>
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   HOME — responsive hero
   ─────────────────────────────────────────────────────────── */
function HomeView({ setView, vp }) {
  const worldDots = useMemo(() => {
    const dots = [];
    const mask = [
    "      ........                                              ",
    "    ............      ......                                ",
    "    .............. .........                                ",
    "    .................... ...                                ",
    "     .................. ...                                 ",
    "        ...............                                     ",
    "        ...........                                         ",
    "         .........                                          ",
    "         .........                                          ",
    "          .......                                           ",
    "           ......                                           ",
    "           ......                                           ",
    "          .......                                           ",
    "          .......                                           ",
    "          .......                                           ",
    "           .....                                            ",
    "            ...                                             ",
    "            ...                                             ",
    "             .                                              "];
    mask.forEach((row, r) => { for (let c = 0; c < row.length; c++) { if (row[c] === '.') dots.push([c, r]); } });
    return dots;
  }, []);

  const isMobile = vp.isMobile;
  const isTablet = vp.isTablet;
  const compact = isMobile || isTablet;

  // Resizable hero name — drag any of the 8 handles, clamped to ±30%.
  const [scale, setScale] = useState(1);
  const scaleRef = useRef(1);
  const boxRef = useRef(null);
  const startResize = (e) => {
    e.preventDefault(); e.stopPropagation();
    const box = boxRef.current; if (!box) return;
    const rect = box.getBoundingClientRect();
    const cx = rect.left + rect.width / 2, cy = rect.top + rect.height / 2;
    const startDist = Math.hypot(e.clientX - cx, e.clientY - cy) || 1;
    const startScale = scaleRef.current;
    const move = (ev) => {
      const d = Math.hypot(ev.clientX - cx, ev.clientY - cy);
      const ns = Math.max(0.7, Math.min(1.3, startScale * (d / startDist)));
      scaleRef.current = ns; setScale(ns);
    };
    const up = () => { window.removeEventListener('pointermove', move); window.removeEventListener('pointerup', up); };
    window.addEventListener('pointermove', move); window.addEventListener('pointerup', up);
  };

  // Mobile: single-column stack. Desktop: side-by-side.
  return (
    <div className="view-enter" style={{ minHeight: '100%', height: isMobile ? 'auto' : '100%', overflow: isMobile ? 'visible' : 'hidden', background: 'var(--bg2)', position: 'relative' }}>
      <svg style={{ position: 'absolute', top: -200, right: -200, width: 1200, height: 1200, opacity: 0.07, pointerEvents: 'none' }} viewBox="0 0 1200 1200">
        {[100, 200, 300, 400, 500, 600].map((r) => <circle key={r} cx="600" cy="600" r={r} stroke="#fff" strokeWidth="1" fill="none" />)}
      </svg>

      <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', minHeight: isMobile ? 'auto' : '100%', position: 'relative' }}>
        {/* LEFT — text block */}
        <div style={{ padding: isMobile ? '40px 24px 32px' : (isTablet ? '60px 36px' : '80px 60px'), display: 'flex', flexDirection: 'column', justifyContent: 'center', position: 'relative', zIndex: 2 }}>
          <div style={{ fontSize: isMobile ? 18 : 24, color: '#fff', fontWeight: 400, marginBottom: 14, opacity: 0.92 }}>Hi, I'm</div>
          <div ref={boxRef} style={{ position: 'relative', display: 'inline-block', alignSelf: 'flex-start', marginBottom: isMobile ? 22 : 32, maxWidth: '100%', userSelect: 'none', touchAction: 'none' }}>
            <div style={{ position: 'absolute', inset: isMobile ? '-10px -14px' : '-16px -22px', border: '2px solid var(--ac-blue)', pointerEvents: 'none' }}>
              {/* 8 handles: 4 corners + 4 midpoints — drag to resize the name (±30%) */}
              {[
                { top: -7, left: -7, cursor: 'nwse-resize' },
                { top: -7, right: -7, cursor: 'nesw-resize' },
                { bottom: -7, left: -7, cursor: 'nesw-resize' },
                { bottom: -7, right: -7, cursor: 'nwse-resize' },
                { top: -7, left: '50%', transform: 'translateX(-50%)', cursor: 'ns-resize' },
                { bottom: -7, left: '50%', transform: 'translateX(-50%)', cursor: 'ns-resize' },
                { top: '50%', left: -7, transform: 'translateY(-50%)', cursor: 'ew-resize' },
                { top: '50%', right: -7, transform: 'translateY(-50%)', cursor: 'ew-resize' },
              ].map((pos, i) => (
                <div key={i} data-actionable="1" onPointerDown={startResize} style={{ position: 'absolute', width: 12, height: 12, background: '#fff', border: '2px solid var(--ac-blue)', pointerEvents: 'auto', ...pos }} />
              ))}
            </div>
            <h1 style={{ fontSize: `calc(clamp(44px, 11vw, 96px) * ${scale})`, fontWeight: 700, color: '#fff', letterSpacing: '-0.04em', lineHeight: 1, margin: 0, fontFamily: 'Inter', wordBreak: 'keep-all' }}>
              Paulo <span style={{ fontWeight: 300, animation: 'blink 1.06s step-end infinite' }}>|</span> Lebtag
            </h1>
          </div>

          <div style={{ fontSize: 'clamp(16px, 2.4vw, 24px)', color: '#fff', marginBottom: isMobile ? 24 : 36, lineHeight: 1.3 }}>
            <span style={{ color: 'var(--ac-blue)', fontWeight: 700 }}>Sênior AI Product Designer </span>
            <span style={{ opacity: 0.9 }}>at your service</span>
          </div>

          <button onClick={() => setView('work')}
            style={{ alignSelf: 'flex-start', padding: '14px 28px', borderRadius: 8, background: 'transparent', border: '1.5px dashed rgba(255,255,255,0.45)', color: '#fff', fontSize: 14, fontWeight: 500, cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 8, fontFamily: 'Inter', transition: 'all .2s' }}
            onMouseEnter={(e) => { e.currentTarget.style.borderColor = 'var(--ac-blue)'; e.currentTarget.style.color = 'var(--ac-blue)'; }}
            onMouseLeave={(e) => { e.currentTarget.style.borderColor = 'rgba(255,255,255,0.45)'; e.currentTarget.style.color = '#fff'; }}>
            Available to work
          </button>
        </div>

        {/* RIGHT — visual */}
        <HomeVisual worldDots={worldDots} vp={vp} />
      </div>
    </div>
  );
}

function HomeVisual({ worldDots, vp }) {
  const isMobile = vp.isMobile;
  const isTablet = vp.isTablet;

  // Mobile/tablet: fluid card stack
  if (isMobile) {
    return (
      <div style={{ position: 'relative', padding: '0 20px 40px', display: 'flex', flexDirection: 'column', gap: 20 }}>
        <ProCard compact />
        <PhotoBlock compact worldDots={worldDots} />
        <SkillsCard compact />
      </div>
    );
  }

  // Desktop: original absolute-positioned floating cards
  return (
    <div style={{ position: 'relative', overflow: 'visible' }}>
      <svg viewBox="0 0 60 20" style={{ position: 'absolute', left: '-150px', top: '48%', width: '65%', height: '45%', opacity: 0.35 }} preserveAspectRatio="xMidYMid meet">
        {worldDots.map(([c, r], i) => <circle key={i} cx={c} cy={r} r="0.22" fill="#5a7da8" />)}
      </svg>

      <div style={{ position: 'absolute', left: 'calc(22% - 150px)', top: '72%', display: 'flex', flexDirection: 'column', alignItems: 'center', zIndex: 3 }}>
        <div style={{ background: '#fff', borderRadius: 8, padding: '7px 12px', display: 'flex', alignItems: 'center', gap: 7, boxShadow: '0 6px 18px rgba(0,0,0,0.3)', marginBottom: 8 }}>
          {Ic.flag(18)}
          <span style={{ fontSize: 13, fontWeight: 600, color: '#1a2332' }}>Based in Brazil</span>
        </div>
        {Ic.pin(22)}
      </div>

      <div style={{ position: 'absolute', right: isTablet ? '4%' : '8%', top: '8%', width: isTablet ? 280 : 340, background: '#fff', borderRadius: 14, padding: '20px 22px', boxShadow: '0 18px 40px rgba(0,0,0,0.35)', zIndex: 4, animation: 'float-a 6.5s ease-in-out infinite' }}>
        <ProCardInner />
      </div>

      <image-slot id="hero-paulo-photo" placeholder="Drop your hero photo" shape="rounded" radius="10" fit="cover"
        style={{ position: 'absolute', right: isTablet ? '4%' : '8%', top: '30%', width: isTablet ? 280 : 380, height: isTablet ? 360 : 480, background: '#2a3548', boxShadow: '0 20px 60px rgba(0,0,0,0.5)', zIndex: 2 }}></image-slot>

      <div style={{ position: 'absolute', right: isTablet ? '2%' : '4%', bottom: '4%', width: isTablet ? 340 : 420, background: '#fff', borderRadius: 14, padding: '18px 20px', boxShadow: '0 18px 40px rgba(0,0,0,0.35)', zIndex: 4, display: 'flex', gap: 18, animation: 'float-b 7.2s ease-in-out infinite', animationDelay: '-2s' }}>
        <SkillsCardInner />
      </div>

      {/* Walking cursors — outside clipped zone, can wander freely */}
      <WalkingCursor label="Paulo Lebtag" color="#1a9fff" animation="cursor-walk 24s ease-in-out infinite" left="42%" top="48%" zIndex={50} />
      <WalkingCursor label="Visitor 1" color="#f59e0b" animation="visitor-walk-a 28s ease-in-out infinite" left="18%" top="22%" delay="-4s" zIndex={50} />
    </div>
  );
}

function ProCardInner() {
  return (
    <>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 14 }}>
        <div style={{ fontSize: 14, fontWeight: 600, color: '#1a2332' }}>Professional experience</div>
        <span style={{ color: '#9aa3b2', cursor: 'pointer' }}>{Ic.dots(16)}</span>
      </div>
      <div style={{ fontSize: 36, fontWeight: 700, color: '#1a2332', letterSpacing: -1, marginBottom: 6 }}>13 years</div>
      <div style={{ display: 'flex', alignItems: 'center', gap: 6, marginTop: 4 }}>
        <span style={{ color: '#22c55e', display: 'flex' }}>{Ic.arrowUp(14)}</span>
        <span style={{ fontSize: 12, color: '#5a6478' }}>Years of experience</span>
        <svg viewBox="0 0 120 36" style={{ marginLeft: 'auto', width: 130, height: 36 }}>
          <polyline fill="none" stroke="#22c55e" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" points="0,30 12,26 22,28 32,22 44,24 56,16 68,18 80,12 92,14 104,8 116,4" />
          <circle cx="104" cy="8" r="3.5" fill="#22c55e" />
          <circle cx="104" cy="8" r="7" fill="none" stroke="#22c55e" strokeWidth="1" opacity="0.4" />
        </svg>
      </div>
    </>
  );
}

function ProCard({ compact }) {
  return (
    <div style={{ background: '#fff', borderRadius: 14, padding: '18px 20px', boxShadow: '0 14px 32px rgba(0,0,0,0.3)' }}>
      <ProCardInner />
    </div>
  );
}

function PhotoBlock({ compact, worldDots }) {
  return (
    <div style={{ position: 'relative', borderRadius: 12, overflow: 'visible' }}>
      <svg viewBox="0 0 60 20" style={{ position: 'absolute', left: '-10%', top: '60%', width: '110%', height: '50%', opacity: 0.35, pointerEvents: 'none' }} preserveAspectRatio="xMidYMid meet">
        {worldDots.map(([c, r], i) => <circle key={i} cx={c} cy={r} r="0.22" fill="#5a7da8" />)}
      </svg>
      <image-slot id="hero-paulo-photo" placeholder="Drop your hero photo" shape="rounded" radius="10" fit="cover"
        style={{ display: 'block', width: '100%', height: 360, background: '#2a3548', boxShadow: '0 14px 40px rgba(0,0,0,0.45)' }}></image-slot>
      <div style={{ position: 'absolute', left: 14, bottom: 14, background: '#fff', borderRadius: 8, padding: '6px 10px', display: 'flex', alignItems: 'center', gap: 6, boxShadow: '0 6px 14px rgba(0,0,0,0.3)' }}>
        {Ic.flag(16)}
        <span style={{ fontSize: 11.5, fontWeight: 600, color: '#1a2332' }}>Based in Brazil</span>
      </div>
    </div>
  );
}

function SkillsCardInner() {
  return (
    <>
      <div style={{ position: 'absolute', top: -18, left: 90, background: '#1a2332', color: '#fff', fontSize: 11, padding: '4px 9px', borderRadius: 5, display: 'flex', alignItems: 'center', gap: 5 }}><span style={{ width: 9, height: 9, background: '#a855f7', borderRadius: 2 }} /> UI</div>
      <div style={{ position: 'absolute', top: 60, left: -58, background: '#1a2332', color: '#fff', fontSize: 11, padding: '4px 9px', borderRadius: 5, display: 'flex', alignItems: 'center', gap: 5 }}><span style={{ width: 9, height: 9, background: '#f59e0b', borderRadius: 2 }} /> Product</div>
      <div style={{ position: 'absolute', bottom: -18, left: 120, background: '#1a2332', color: '#fff', fontSize: 11, padding: '4px 9px', borderRadius: 5, display: 'flex', alignItems: 'center', gap: 5 }}><span style={{ width: 9, height: 9, background: '#22c55e', borderRadius: 2 }} /> UX</div>
      <div style={{ position: 'absolute', top: -18, left: 6, background: '#1a2332', color: '#fff', fontSize: 11, padding: '4px 9px', borderRadius: 5, display: 'flex', alignItems: 'center', gap: 5 }}><span style={{ width: 9, height: 9, background: '#1a9fff', borderRadius: 2 }} /> AI</div>
      <svg viewBox="0 0 100 100" style={{ width: 130, height: 130, flexShrink: 0 }}>
        <circle cx="50" cy="50" r="38" fill="none" stroke="#f59e0b" strokeWidth="14" strokeDasharray="60 179" strokeDashoffset="0" transform="rotate(-90 50 50)" />
        <circle cx="50" cy="50" r="38" fill="none" stroke="#a855f7" strokeWidth="14" strokeDasharray="60 179" strokeDashoffset="-60" transform="rotate(-90 50 50)" />
        <circle cx="50" cy="50" r="38" fill="none" stroke="#22c55e" strokeWidth="14" strokeDasharray="60 179" strokeDashoffset="-120" transform="rotate(-90 50 50)" />
        <circle cx="50" cy="50" r="38" fill="none" stroke="#1a9fff" strokeWidth="14" strokeDasharray="59 180" strokeDashoffset="-180" transform="rotate(-90 50 50)" />
      </svg>
      <div style={{ borderLeft: '1px solid #e5e7eb', paddingLeft: 18, display: 'flex', flexDirection: 'column', justifyContent: 'center', flex: 1 }}>
        <div style={{ fontSize: 15, fontWeight: 600, color: '#1a2332', marginBottom: 3 }}>Skills</div>
        <div style={{ fontSize: 13, color: '#5a6478', marginBottom: 8 }}>Balanced</div>
        <div style={{ fontSize: 'clamp(20px, 4vw, 24px)', fontWeight: 700, color: '#1a2332', letterSpacing: -0.5 }}>100% success!</div>
      </div>
    </>
  );
}

function SkillsCard({ compact }) {
  return (
    <div style={{ background: '#fff', borderRadius: 14, padding: '20px 18px', boxShadow: '0 14px 32px rgba(0,0,0,0.3)', display: 'flex', gap: 16, position: 'relative', marginTop: 18 }}>
      <SkillsCardInner />
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   TOPO LINES SVG
   ─────────────────────────────────────────────────────────── */
const TopoBackground = () =>
<svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', pointerEvents: 'none', opacity: 0.5 }} preserveAspectRatio="xMidYMid slice" viewBox="0 0 800 600">
  {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((i) =>
    <path key={i} d={`M ${-50 + i * 15} ${100 + i * 30} C ${150 + i * 20} ${50 + i * 25}, ${400 - i * 15} ${250 + i * 20}, ${650 + i * 10} ${180 + i * 35} S ${900} ${400 + i * 15}, ${850} ${550 + i * 5}`} fill="none" stroke="#c8bda3" strokeWidth="0.8" opacity={0.35 - i * 0.025} />
  )}
</svg>;

/* ───────────────────────────────────────────────────────────
   ABOUT — responsive
   ─────────────────────────────────────────────────────────── */
function AboutView({ vp }) {
  const isMobile = vp.isMobile;
  const isTablet = vp.isTablet;
  return (
    <div className="view-enter" style={{ minHeight: '100%', height: isMobile ? 'auto' : '100%', overflow: isMobile ? 'visible' : 'auto', background: 'var(--cream)', position: 'relative', color: 'var(--ink)' }}>
      <TopoBackground />
      <div style={{ position: 'relative', zIndex: 1, padding: isMobile ? '32px 20px' : (isTablet ? '40px 36px' : '60px 64px'), display: 'grid', gridTemplateColumns: isMobile ? '1fr' : (isTablet ? '320px 1fr' : '440px 1fr'), gap: isMobile ? 32 : (isTablet ? 36 : 60) }}>
        <div>
          <image-slot id="about-paulo-photo" placeholder="Drop your about photo" shape="rounded" radius="6" fit="cover"
            style={{ width: '100%', height: isMobile ? 280 : 380, background: '#dcd7c7', marginBottom: 20, display: 'block' }}></image-slot>
          <div style={{ fontSize: 'clamp(24px, 4vw, 30px)', fontWeight: 700, color: 'var(--ink)', letterSpacing: -0.8, marginBottom: 6, fontFamily: 'Inter' }}>Paulo Lebtag</div>
          <div style={{ fontSize: 'clamp(15px, 2vw, 18px)', color: 'var(--ac-blue)', fontWeight: 500, marginBottom: 18 }}>Sr. UX/UI/Product Designer</div>
          <div style={{ display: 'flex', gap: 10 }}>
            <a href="https://www.linkedin.com/in/paulolebtag/" target="_blank" rel="noreferrer" style={{ width: 36, height: 36, borderRadius: 8, background: '#0a66c2', color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', textDecoration: 'none' }}>{Ic.linkedin(18)}</a>
            <a href="https://wa.me/5562993815020" target="_blank" rel="noreferrer" style={{ width: 36, height: 36, borderRadius: 8, background: '#25d366', color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', textDecoration: 'none' }}>{Ic.whatsapp(18)}</a>
          </div>
        </div>

        <div style={{ paddingTop: 4 }}>
          <div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, marginBottom: 20 }}>
            <span style={{ width: 6, height: 6, borderRadius: '50%', background: 'var(--ac-blue)' }} />
            <span style={{ fontSize: 15, color: 'var(--ac-blue)', fontWeight: 600 }}>About me</span>
          </div>
          {[
            'I am a Senior UX/UI and Product Designer, managing all product stages from conception to market performance, focusing on business models.',
            'I have experience in Design, AI, and Data Analysis.',
            "I hold a master's in interface design, specializing in strategic design, with a bachelor's in graphic design, and I'm studying Software Engineering.",
            'Here are some companies I have helped with my product solutions:'
          ].map((p, i) => (
            <div key={i} style={{ fontSize: 'clamp(15px, 2.2vw, 22px)', color: 'var(--ink2)', lineHeight: 1.5, fontWeight: 400, marginBottom: i === 3 ? 36 : 24 }}>{p}</div>
          ))}

          {/* Company logos — real brand PNGs, equal-height row */}
          <div style={{ borderTop: '1px solid rgba(40,30,10,0.08)', paddingTop: 32, marginTop: 8 }}>
            <div style={{ display: 'grid', gridTemplateColumns: isMobile ? 'repeat(2, 1fr)' : 'repeat(4, 1fr)', gap: isMobile ? 24 : 12, alignItems: 'center', justifyItems: 'center' }}>
              <div style={{ height: 60, display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }}>
                <img src="logos/samsung.png" alt="Samsung" style={{ height: 26, width: 'auto', objectFit: 'contain' }} />
              </div>
              <div style={{ height: 60, display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }}>
                <img src="logos/carrefour.png" alt="Carrefour" style={{ height: 50, width: 'auto', objectFit: 'contain' }} />
              </div>
              <div style={{ height: 60, display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }}>
                <img src="logos/didi.png" alt="DiDi" style={{ height: 30, width: 'auto', objectFit: 'contain' }} />
              </div>
              <div style={{ height: 60, display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }}>
                <img src="logos/acsp.png" alt="Associação Comercial de São Paulo" style={{ height: 48, width: 'auto', objectFit: 'contain' }} />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   EDUCATION — responsive
   ─────────────────────────────────────────────────────────── */
function EducationView({ vp }) {
  const isMobile = vp.isMobile;
  return (
    <div className="view-enter" style={{ minHeight: '100%', height: isMobile ? 'auto' : '100%', overflow: isMobile ? 'visible' : 'auto', background: 'var(--cream)', position: 'relative', color: 'var(--ink)' }}>
      <TopoBackground />
      <div style={{ position: 'relative', zIndex: 1, padding: isMobile ? '32px 20px' : '60px 64px', display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', gap: isMobile ? 32 : 60 }}>
        <div style={{ paddingTop: isMobile ? 0 : 30 }}>
          <div style={{ fontSize: 14, color: 'var(--ac-blue)', fontWeight: 700, letterSpacing: 3, marginBottom: 24 }}>EDUCATION</div>
          {[
            'I bridge market and academic knowledge with degrees in Graphic Design and Strategic Design.',
            'My research spans interface projects for the web, business rules, and redesigning support services using Design Thinking.',
            "I hold a master's in Interface Design, researching temporal interaction experiences and new methodologies.",
            "Currently, I'm pursuing a new degree in software to delve deeper into AI and Data Analysis."
          ].map((p, i) => (
            <p key={i} style={{ fontSize: 'clamp(15px, 2.2vw, 22px)', color: 'var(--ink2)', lineHeight: 1.5, marginBottom: 22 }}>{p}</p>
          ))}
        </div>

        <div style={{ position: 'relative', paddingLeft: 30 }}>
          <div style={{ position: 'absolute', left: 8, top: 30, bottom: 30, width: 1, background: '#c8bda3' }} />
          <div style={{ position: 'relative', marginBottom: 24 }}>
            <div style={{ position: 'absolute', left: -26, top: 8, width: 9, height: 9, borderRadius: '50%', background: 'var(--cream)', border: '1.5px solid #8a94aa' }} />
            <div style={{ fontSize: 15, color: 'var(--ink)', fontWeight: 600, marginBottom: 14 }}>Software Development</div>
            {EDUCATION.software.map((e, i) => <EduCard key={i} edu={e} active={e.active} />)}
          </div>
          <div style={{ position: 'relative' }}>
            <div style={{ position: 'absolute', left: -26, top: 8, width: 9, height: 9, borderRadius: '50%', background: 'var(--cream)', border: '1.5px solid #8a94aa' }} />
            <div style={{ fontSize: 15, color: 'var(--ink)', fontWeight: 600, marginBottom: 14 }}>UX/UI/Product Design</div>
            {EDUCATION.design.map((e, i) => <EduCard key={i} edu={e} />)}
          </div>
        </div>
      </div>
    </div>
  );
}

function EduCard({ edu, active }) {
  return (
    <div style={{ position: 'relative', background: '#fff', border: `1.5px solid ${active ? 'var(--ac-blue)' : '#e5e0d0'}`, borderRadius: 10, padding: '14px 16px', marginBottom: 14, display: 'flex', gap: 12 }}>
      <div style={{ width: 54, height: 54, borderRadius: 8, background: edu.logoBg, color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 12, fontWeight: 700, flexShrink: 0, fontFamily: 'Inter' }}>{edu.logoText}</div>
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{ fontSize: 13.5, fontWeight: 600, color: 'var(--ink)', marginBottom: 6, lineHeight: 1.3 }}>{edu.degree}</div>
        <div style={{ fontSize: 12, color: 'var(--ink3)', lineHeight: 1.55, marginBottom: 10 }}>{edu.detail}</div>
        <div style={{ display: 'inline-flex', alignItems: 'center', gap: 5, fontSize: 11, color: 'var(--ink3)' }}>
          {Ic.clock(12)}{edu.period}
        </div>
        {edu.link && (
          <div style={{ marginTop: 12 }}>
            <a href={edu.link} target="_blank" rel="noreferrer" style={{ display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 11.5, fontWeight: 600, color: 'var(--ac-blue)', textDecoration: 'none', padding: '6px 11px', border: '1px solid var(--ac-blue)', borderRadius: 7 }}>
              {edu.linkLabel || 'View ↗'}
            </a>
          </div>
        )}
      </div>
      {active &&
        <div style={{ position: 'absolute', right: -20, bottom: -18, display: 'flex', alignItems: 'flex-end', pointerEvents: 'none' }}>
          <svg width="22" height="22" viewBox="0 0 24 24" fill="var(--ac-blue)" stroke="#fff" strokeWidth="1.5"><path d="M5 3l4 16 3-7 7-3z" /></svg>
          <div style={{ background: 'var(--ac-blue)', color: '#fff', padding: '4px 10px', borderRadius: 5, fontSize: 13, fontWeight: 500, marginLeft: -2, boxShadow: '0 4px 10px rgba(26,159,255,0.4)' }}>Paulo Lebtag</div>
        </div>
      }
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   WORK — responsive (table on desktop, cards on mobile)
   ─────────────────────────────────────────────────────────── */
function ProjectLogo({ project }) {
  const id = project.id;
  if (id === 'vonex') return <div style={{ width: 34, height: 34, borderRadius: '50%', background: '#dce8f7', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
    <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#1a9fff" strokeWidth="1.8"><circle cx="12" cy="12" r="9" /><circle cx="12" cy="12" r="4" /><circle cx="12" cy="12" r="1.5" fill="#1a9fff" /></svg>
  </div>;
  if (id === 'unipix') return <div style={{ width: 34, height: 34, borderRadius: '50%', background: '#dcfce7', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
    <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#22c55e" strokeWidth="2.2" strokeLinecap="round"><polyline points="5 12 19 12" /><polyline points="13 6 19 12 13 18" /></svg>
  </div>;
  if (id === 'agrodash') return <div style={{ width: 34, height: 34, borderRadius: '50%', background: '#fef3c7', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 13, fontWeight: 700, color: '#a16207', fontFamily: 'Inter', flexShrink: 0 }}>AD</div>;
  if (id === 'gestor') return <div style={{ width: 34, height: 34, borderRadius: '50%', background: '#fee2e2', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 13, fontWeight: 700, color: '#dc2626', fontFamily: 'Inter', flexShrink: 0 }}>GF</div>;
  return <div style={{ width: 34, height: 34, borderRadius: '50%', background: '#e5e7eb', flexShrink: 0 }} />;
}

function ExtraLogo({ row }) {
  const colors = {
    'acsp': ['#f3f4f6', '#4b5563', 'ACSP'],
    'cefasfv': ['#dbeafe', '#1d4ed8', 'C'],
    'cefaserp': ['#e0e7ff', '#4338ca', 'CE'],
    'tempo': ['#e0f2fe', '#0369a1', 'T']
  };
  const [bg, fg, letter] = colors[row.id] || ['#e5e7eb', '#374151', '—'];
  return <div style={{ width: 34, height: 34, borderRadius: '50%', background: bg, color: fg, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 11, fontWeight: 700, fontFamily: 'Inter', flexShrink: 0 }}>{letter}</div>;
}

function StatusPill({ label }) {
  const color = label === 'Working' ? { fg: '#b45309', bg: '#fef3c7' }
    : label === 'Soon' ? { fg: '#6b7280', bg: '#f3f4f6' }
    : { fg: '#15803d', bg: '#dcfce7' };
  return <span style={{ display: 'inline-block', padding: '4px 12px', borderRadius: 20, fontSize: 11, fontWeight: 600, color: color.fg, background: color.bg }}>{label}</span>;
}

function WorkView({ setView, setDetailProject, vp }) {
  const isMobile = vp.isMobile;
  const isTablet = vp.isTablet;
  const [selected, setSelected] = useState(new Set(['vonex']));
  const [showFilter, setShowFilter] = useState(true);
  const [search, setSearch] = useState('');
  const allRows = useMemo(() => {
    const proj = PROJECTS.map((p) => ({ kind: 'project', id: p.id, p, company: p.company, companyUrl: p.companyUrl, statusLabel: p.statusLabel, title: p.full, about: p.about, soon: p.soon }));
    const extra = EXTRA_TABLE_ROWS.map((r) => ({ kind: 'extra', id: r.id, ...r }));
    return [...proj, ...extra];
  }, []);
  const filtered = allRows.filter((r) => {
    if (!search) return true;
    const q = search.toLowerCase();
    return r.company.toLowerCase().includes(q) || r.title.toLowerCase().includes(q);
  });

  const onToggle = (id) => setSelected((s) => { const n = new Set(s); n.has(id) ? n.delete(id) : n.add(id); return n; });
  const onOpen = (r) => { if (r.soon) return; if (r.kind === 'project') { setDetailProject(r.p); setView('detail'); } };

  return (
    <div className="view-enter" style={{ minHeight: '100%', height: isMobile ? 'auto' : '100%', overflow: isMobile ? 'visible' : 'auto', background: 'var(--bg2)', padding: isMobile ? '20px 14px' : (isTablet ? '28px 24px' : '40px 48px'), position: 'relative' }}>
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', pointerEvents: 'none', opacity: 0.04 }} preserveAspectRatio="xMidYMid slice" viewBox="0 0 800 600">
        {[0, 1, 2, 3, 4, 5, 6, 7, 8].map((i) =>
          <path key={i} d={`M ${-50 + i * 15} ${100 + i * 30} C ${150 + i * 20} ${50 + i * 25}, ${400 - i * 15} ${250 + i * 20}, ${650 + i * 10} ${180 + i * 35} S ${900} ${400 + i * 15}, ${850} ${550 + i * 5}`} fill="none" stroke="#fff" strokeWidth="1" />
        )}
      </svg>

      <div style={{ position: 'relative', background: '#fff', borderRadius: isMobile ? 14 : 20, padding: isMobile ? '20px 18px' : '32px 36px', boxShadow: '0 24px 60px rgba(0,0,0,0.3)', color: '#1a2332' }}>
        <div style={{ fontSize: isMobile ? 16 : 18, fontWeight: 600, color: '#1a2332', marginBottom: 18 }}>Main projects I want to show</div>

        <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 20, flexWrap: 'wrap' }}>
          {showFilter &&
            <div style={{ display: 'inline-flex', alignItems: 'center', gap: 10, padding: '9px 14px', border: '1.5px solid var(--ac-blue)', borderRadius: 10, background: '#f0f8ff', color: 'var(--ac-blue)', fontSize: 12.5, fontWeight: 500 }}>
              {selected.size} project{selected.size !== 1 ? 's' : ''} to showcase
              <span onClick={() => setShowFilter(false)} style={{ cursor: 'pointer', display: 'flex' }}>{Ic.close(14)}</span>
            </div>
          }
          {!isMobile && (
            <button style={{ display: 'inline-flex', alignItems: 'center', gap: 8, padding: '9px 14px', border: '1.5px solid #e5e7eb', borderRadius: 10, background: '#fff', color: '#374151', fontSize: 12.5, fontWeight: 500, cursor: 'pointer', fontFamily: 'Inter' }}>
              {Ic.filter(15)} More filters
            </button>
          )}
          <div style={{ marginLeft: isMobile ? 0 : 'auto', flex: isMobile ? '1 1 100%' : '0 1 auto', position: 'relative', minWidth: isMobile ? 'auto' : 240 }}>
            <span style={{ position: 'absolute', left: 14, top: '50%', transform: 'translateY(-50%)', color: '#9ca3af', display: 'flex' }}>{Ic.search(15)}</span>
            <input value={search} onChange={(e) => setSearch(e.target.value)} placeholder="Search"
              style={{ width: '100%', padding: '10px 14px 10px 38px', border: '1.5px solid #e5e7eb', borderRadius: 10, fontSize: 13, color: '#1a2332', outline: 'none', fontFamily: 'Inter' }} />
          </div>
        </div>

        {isMobile ? (
          // CARD layout
          <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
            {filtered.map((r, i) => (
              <ProjectCard key={r.id} row={r} idx={i} selected={selected.has(r.id)} onToggle={() => onToggle(r.id)} onOpen={() => onOpen(r)} />
            ))}
          </div>
        ) : (
          // TABLE layout
          <>
            <div style={{ display: 'grid', gridTemplateColumns: isTablet ? '36px 1fr 110px 1.4fr 110px' : '40px 280px 130px 1fr 140px', alignItems: 'center', padding: '12px 8px', borderTop: '1px solid #e5e7eb', borderBottom: '1px solid #e5e7eb', background: '#fafafa' }}>
              <div onClick={() => setSelected((s) => s.size === filtered.length ? new Set() : new Set(filtered.map((r) => r.id)))} style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                <CheckBox state={selected.size === 0 ? 'empty' : selected.size === filtered.length ? 'check' : 'partial'} />
              </div>
              <div style={{ fontSize: 12.5, fontWeight: 600, color: '#1a2332', display: 'flex', alignItems: 'center', gap: 5 }}>Company {Ic.sortDown(11)}</div>
              <div style={{ fontSize: 12.5, fontWeight: 600, color: '#1a2332' }}>Status</div>
              <div style={{ fontSize: 12.5, fontWeight: 600, color: '#1a2332' }}>About</div>
              <div></div>
            </div>
            {filtered.map((r, i) => (
              <Row key={r.id} row={r} idx={i} selected={selected.has(r.id)} onToggle={() => onToggle(r.id)} onOpen={() => onOpen(r)} isTablet={isTablet} />
            ))}
          </>
        )}

        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', paddingTop: 20, gap: 12, flexWrap: 'wrap' }}>
          <button style={{ padding: '8px 16px', border: '1.5px solid #e5e7eb', borderRadius: 10, background: '#fff', fontSize: 12.5, color: '#6b7280', cursor: 'pointer', fontFamily: 'Inter' }}>Previous</button>
          <div style={{ fontSize: 13, color: '#6b7280' }}>Page 1 of 1</div>
          <button style={{ padding: '8px 16px', border: '1.5px solid #e5e7eb', borderRadius: 10, background: '#fff', fontSize: 12.5, color: '#6b7280', cursor: 'pointer', fontFamily: 'Inter' }}>Next</button>
        </div>
      </div>
    </div>
  );
}

function CheckBox({ state }) {
  if (state === 'check') return (
    <div style={{ width: 20, height: 20, borderRadius: 5, background: 'var(--ac-blue)', border: '1.5px solid var(--ac-blue)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round"><polyline points="20 6 9 17 4 12" /></svg>
    </div>
  );
  if (state === 'partial') return (
    <div style={{ width: 20, height: 20, borderRadius: 5, background: '#dceefd', border: '1.5px solid var(--ac-blue)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <div style={{ width: 10, height: 2, background: 'var(--ac-blue)', borderRadius: 1 }} />
    </div>
  );
  return <div style={{ width: 20, height: 20, borderRadius: 5, border: '1.5px solid #d1d5db', background: '#fff' }} />;
}

function Row({ row, idx, selected, onToggle, onOpen, isTablet }) {
  const isCCM = row.id === 'vonex';
  const isSoon = !!row.soon;
  const Logo = row.kind === 'project' ? <ProjectLogo project={row.p} /> : <ExtraLogo row={row} />;
  return (
    <div className="row-in" style={{ animationDelay: `${idx * 40}ms`, display: 'grid', gridTemplateColumns: isTablet ? '36px 1fr 110px 1.4fr 110px' : '40px 280px 130px 1fr 140px', alignItems: 'center', padding: '18px 8px', borderBottom: '1px solid #e5e7eb', transition: 'background .15s', opacity: isSoon ? 0.55 : 1 }}
      onMouseEnter={(e) => e.currentTarget.style.background = '#fafafa'}
      onMouseLeave={(e) => e.currentTarget.style.background = 'transparent'}>
      <div onClick={onToggle} style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><CheckBox state={selected ? 'check' : 'empty'} /></div>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12, minWidth: 0 }}>
        {Logo}
        <div style={{ minWidth: 0 }}>
          <div style={{ fontSize: 14.5, fontWeight: 600, color: '#1a2332', lineHeight: 1.1, overflow: 'hidden', textOverflow: 'ellipsis' }}>{row.company}</div>
          <div style={{ fontSize: 12, color: '#9ca3af', marginTop: 3 }}>{row.companyUrl}</div>
        </div>
      </div>
      <div><StatusPill label={row.statusLabel} /></div>
      <div style={{ paddingRight: 16 }}>
        <div style={{ fontSize: 13.5, color: '#1a2332', fontWeight: 500, marginBottom: 4 }}>{row.title}</div>
        <div style={{ fontSize: 12.5, color: '#6b7280', lineHeight: 1.55, display: '-webkit-box', WebkitLineClamp: isTablet ? 3 : 5, WebkitBoxOrient: 'vertical', overflow: 'hidden' }}>{row.about}</div>
      </div>
      <div style={{ display: 'flex', gap: 12, justifyContent: 'flex-end', alignItems: 'center', position: 'relative' }}>
        {row.kind === 'project' ? (
          <button onClick={isSoon ? undefined : onOpen} disabled={isSoon} title={isSoon ? 'Coming soon' : 'Open demo'} style={{ background: 'transparent', border: 'none', cursor: isSoon ? 'not-allowed' : 'pointer', color: isSoon ? '#d1d5db' : (isCCM ? 'var(--ac-blue)' : '#9ca3af'), display: 'flex', padding: 4, position: 'relative' }}>
            {Ic.eye(20)}
            {isCCM && (
              <>
                <svg width="22" height="22" viewBox="0 0 24 24" fill="#8b5cf6" stroke="#fff" strokeWidth="1.5" style={{ position: 'absolute', top: 18, left: -4 }}><path d="M5 3l4 16 3-7 7-3z" /></svg>
                <div style={{ position: 'absolute', top: 38, left: 14, background: '#8b5cf6', color: '#fff', padding: '4px 10px', borderRadius: 5, fontSize: 12, fontWeight: 600, whiteSpace: 'nowrap', boxShadow: '0 4px 10px rgba(139,92,246,0.4)' }}>Visitor 3</div>
              </>
            )}
          </button>
        ) : (
          <button disabled={isSoon} title={isSoon ? 'Coming soon' : ''} style={{ background: 'transparent', border: 'none', cursor: isSoon ? 'not-allowed' : 'pointer', color: isSoon ? '#d1d5db' : '#9ca3af', padding: 4, display: 'flex' }}>{Ic.eye(20)}</button>
        )}
        <button style={{ background: 'transparent', border: 'none', cursor: 'pointer', color: '#9ca3af', padding: 4, display: 'flex' }}>{Ic.trash(20)}</button>
        <button style={{ background: 'transparent', border: 'none', cursor: 'pointer', color: '#9ca3af', padding: 4, display: 'flex' }}>{Ic.pencil(20)}</button>
      </div>
    </div>
  );
}

function ProjectCard({ row, idx, selected, onToggle, onOpen }) {
  const isCCM = row.id === 'vonex';
  const isSoon = !!row.soon;
  const Logo = row.kind === 'project' ? <ProjectLogo project={row.p} /> : <ExtraLogo row={row} />;
  return (
    <div className="row-in" style={{ animationDelay: `${idx * 40}ms`, background: '#fff', border: '1px solid #e5e7eb', borderRadius: 12, padding: 16, display: 'flex', flexDirection: 'column', gap: 12, opacity: isSoon ? 0.6 : 1 }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
        <div onClick={onToggle} style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><CheckBox state={selected ? 'check' : 'empty'} /></div>
        {Logo}
        <div style={{ flex: 1, minWidth: 0 }}>
          <div style={{ fontSize: 14.5, fontWeight: 600, color: '#1a2332', lineHeight: 1.1 }}>{row.company}</div>
          <div style={{ fontSize: 11.5, color: '#9ca3af', marginTop: 2 }}>{row.companyUrl}</div>
        </div>
        <StatusPill label={row.statusLabel} />
      </div>
      <div>
        <div style={{ fontSize: 13.5, color: '#1a2332', fontWeight: 600, marginBottom: 5 }}>{row.title}</div>
        <div style={{ fontSize: 12.5, color: '#6b7280', lineHeight: 1.55 }}>{row.about}</div>
      </div>
      <div style={{ display: 'flex', gap: 8, paddingTop: 4 }}>
        {row.kind === 'project' && (
          <button onClick={isSoon ? undefined : onOpen} disabled={isSoon} style={{ flex: 1, padding: '10px 14px', borderRadius: 8, background: isSoon ? '#f3f4f6' : (isCCM ? 'var(--ac-blue)' : '#f3f4f6'), border: 'none', color: isSoon ? '#9ca3af' : (isCCM ? '#fff' : '#374151'), fontSize: 13, fontWeight: 600, cursor: isSoon ? 'not-allowed' : 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6, fontFamily: 'Inter' }}>
            {Ic.eye(16)} {isSoon ? 'Soon' : (isCCM ? 'Open demo' : 'View')}
          </button>
        )}
        {row.kind !== 'project' && (
          <button disabled={isSoon} style={{ flex: 1, padding: '10px 14px', borderRadius: 8, background: '#f3f4f6', border: 'none', color: isSoon ? '#9ca3af' : '#374151', fontSize: 13, fontWeight: 500, cursor: isSoon ? 'not-allowed' : 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6, fontFamily: 'Inter' }}>{Ic.eye(16)} {isSoon ? 'Soon' : 'View'}</button>
        )}
        <button style={{ padding: '10px 14px', borderRadius: 8, background: '#f3f4f6', border: 'none', color: '#6b7280', cursor: 'pointer', display: 'flex', alignItems: 'center' }}>{Ic.trash(18)}</button>
        <button style={{ padding: '10px 14px', borderRadius: 8, background: '#f3f4f6', border: 'none', color: '#6b7280', cursor: 'pointer', display: 'flex', alignItems: 'center' }}>{Ic.pencil(18)}</button>
      </div>
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   DETAIL VIEW
   ─────────────────────────────────────────────────────────── */
function DetailView({ project, onBack, vp }) {
  const isMobile = vp.isMobile;
  const [tab, setTab] = useState('demo');
  if (!project) return null;
  return (
    <div className="view-enter" style={{ minHeight: '100%', height: isMobile ? 'auto' : '100%', display: 'flex', flexDirection: 'column', overflow: isMobile ? 'visible' : 'hidden', background: 'var(--bg2)' }}>
      <div style={{ padding: '0 16px', minHeight: 54, display: 'flex', alignItems: 'center', gap: 12, borderBottom: '1px solid var(--b1)', background: 'var(--bg2)', flexShrink: 0, flexWrap: 'wrap' }}>
        <button onClick={onBack} style={{ background: 'transparent', border: '1px solid var(--b2)', borderRadius: 8, padding: '7px 14px', color: 'var(--t2)', fontSize: 12, cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 6, fontFamily: 'Inter' }}>← Back</button>
        <div style={{ width: 10, height: 10, borderRadius: '50%', background: project.accent }} />
        <div style={{ fontSize: isMobile ? 14 : 15, fontWeight: 600, color: '#fff' }}>{project.name}</div>
        {!isMobile && <div style={{ fontSize: 12, color: 'var(--t3)' }}>{project.full}</div>}
        <div style={{ display: 'flex', gap: 1, marginLeft: isMobile ? 'auto' : 24, background: 'var(--bg3)', borderRadius: 8, border: '1px solid var(--b1)', padding: 3 }}>
          {[['demo', 'Demo'], ['case', 'Case']].map(([k, l]) => (
            <button key={k} onClick={() => setTab(k)} style={{ padding: '6px 14px', borderRadius: 6, border: 'none', cursor: 'pointer', fontSize: 12, fontWeight: tab === k ? 600 : 500, background: tab === k ? 'var(--bg4)' : 'transparent', color: tab === k ? '#fff' : 'var(--t3)', fontFamily: 'Inter' }}>{l}</button>
          ))}
        </div>
        {project.site && !isMobile && <a href={project.site} target="_blank" rel="noreferrer" style={{ marginLeft: 'auto', fontSize: 12, color: 'var(--t2)', textDecoration: 'none', padding: '6px 14px', border: '1px solid var(--b2)', borderRadius: 8 }}>Site ↗</a>}
        {project.behance && !isMobile && <a href={project.behance} target="_blank" rel="noreferrer" style={{ marginLeft: project.site ? 8 : 'auto', fontSize: 12, color: 'var(--ac-blue)', textDecoration: 'none', padding: '6px 14px', border: '1px solid var(--ac-blue)', borderRadius: 8 }}>Behance ↗</a>}
      </div>
      {tab === 'demo' ? (
        <div style={{ flex: 1, overflow: 'hidden', minHeight: isMobile ? '70vh' : 'auto' }}>{React.createElement(project.Demo)}</div>
      ) : (
        <div style={{ flex: 1, overflowY: 'auto', padding: isMobile ? '24px 18px' : '40px 60px', maxWidth: 920, color: 'var(--t2)' }}>
          {project.tagline && (
            <div style={{ fontSize: isMobile ? 15 : 17, color: '#fff', fontWeight: 500, lineHeight: 1.45, marginBottom: 22, paddingLeft: 14, borderLeft: `3px solid ${project.accent}` }}>
              {project.tagline}
            </div>
          )}
          <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap', marginBottom: 22 }}>
            {project.tags.map((t) => <span key={t} style={{ padding: '5px 12px', borderRadius: 20, border: `1px solid ${project.accent}55`, fontSize: 11, color: project.accent, fontWeight: 500 }}>{t}</span>)}
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr 1fr' : 'repeat(3,1fr)', gap: 1, background: 'var(--b1)', borderRadius: 10, overflow: 'hidden', marginBottom: 32 }}>
            {[['Role', project.role], ['Company', project.company], ['Year', project.year]].map(([k, v]) => (
              <div key={k} style={{ padding: '14px 16px', background: 'var(--bg3)' }}>
                <div style={{ fontSize: 10, color: 'var(--t4)', textTransform: 'uppercase', letterSpacing: 1, fontWeight: 700, marginBottom: 4 }}>{k}</div>
                <div style={{ fontSize: 13, fontWeight: 600, color: '#fff' }}>{v}</div>
              </div>
            ))}
          </div>

          {project.insightStat && (
            <div style={{ display: 'flex', gap: isMobile ? 16 : 24, alignItems: 'center', padding: isMobile ? '18px 18px' : '24px 28px', background: `linear-gradient(135deg, ${project.accent}1f, ${project.accent}08)`, border: `1px solid ${project.accent}44`, borderRadius: 14, marginBottom: 32, flexDirection: isMobile ? 'column' : 'row', textAlign: isMobile ? 'center' : 'left' }}>
              <div style={{ fontSize: isMobile ? 54 : 68, fontWeight: 800, color: project.accent, lineHeight: 1, fontFamily: 'Inter', flexShrink: 0, letterSpacing: -2 }}>{project.insightStat[0]}</div>
              <div style={{ fontSize: isMobile ? 13 : 14, color: 'var(--t2)', lineHeight: 1.6 }}>{project.insightStat[1]}</div>
            </div>
          )}

          {project.whatIsCCM && (
            <div style={{ padding: '20px 22px', background: 'var(--bg3)', border: '1px solid var(--b1)', borderRadius: 12, marginBottom: 32 }}>
              <div style={{ fontSize: 11, color: 'var(--t4)', textTransform: 'uppercase', letterSpacing: 2, fontWeight: 700, marginBottom: 10 }}>What is a CCM?</div>
              <p style={{ fontSize: 14, color: 'var(--t2)', lineHeight: 1.75, margin: 0 }}>{project.whatIsCCM}</p>
            </div>
          )}

          <div style={{ marginBottom: project.problemDetails ? 18 : 28 }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10 }}>
              <div style={{ width: 3, height: 20, borderRadius: 2, background: 'var(--ac5)' }} />
              <h3 style={{ fontSize: isMobile ? 16 : 18, fontWeight: 700, color: '#fff', margin: 0 }}>The Problem</h3>
            </div>
            <p style={{ fontSize: 14, color: 'var(--t2)', lineHeight: 1.75, margin: 0 }}>{project.problem}</p>
          </div>

          {project.problemDetails && (
            <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', gap: 10, marginBottom: 32 }}>
              {project.problemDetails.map(([t, d]) => (
                <div key={t} style={{ padding: '14px 16px', background: 'var(--bg3)', border: '1px solid var(--b1)', borderRadius: 10 }}>
                  <div style={{ fontSize: 13, fontWeight: 700, color: '#fff', marginBottom: 6, display: 'flex', alignItems: 'center', gap: 8 }}>
                    <span style={{ color: 'var(--ac5)', fontFamily: 'var(--ff-mono)', fontSize: 12 }}>×</span>
                    {t}
                  </div>
                  <div style={{ fontSize: 12.5, color: 'var(--t3)', lineHeight: 1.55 }}>{d}</div>
                </div>
              ))}
            </div>
          )}

          {project.traditionalLimitations && (
            <div style={{ marginBottom: 32 }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
                <div style={{ width: 3, height: 20, borderRadius: 2, background: 'var(--ac4)' }} />
                <h3 style={{ fontSize: isMobile ? 16 : 18, fontWeight: 700, color: '#fff', margin: 0 }}>Why Traditional Omnichannel Falls Short</h3>
              </div>
              <p style={{ fontSize: 13.5, color: 'var(--t3)', lineHeight: 1.7, margin: '0 0 14px' }}>Many companies turn to omnichannel solutions hoping for a seamless customer experience. In practice, traditional platforms stack channels without coordinating them:</p>
              <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', gap: 10 }}>
                {project.traditionalLimitations.map(([t, d]) => (
                  <div key={t} style={{ padding: '14px 16px', background: 'var(--bg3)', border: '1px solid var(--b1)', borderRadius: 10 }}>
                    <div style={{ fontSize: 13, fontWeight: 700, color: '#fff', marginBottom: 6 }}>{t}</div>
                    <div style={{ fontSize: 12.5, color: 'var(--t3)', lineHeight: 1.55 }}>{d}</div>
                  </div>
                ))}
              </div>
            </div>
          )}

          <div style={{ marginBottom: project.modules ? 18 : 28 }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10 }}>
              <div style={{ width: 3, height: 20, borderRadius: 2, background: 'var(--ac-blue)' }} />
              <h3 style={{ fontSize: isMobile ? 16 : 18, fontWeight: 700, color: '#fff', margin: 0 }}>The Solution</h3>
            </div>
            <p style={{ fontSize: 14, color: 'var(--t2)', lineHeight: 1.75, margin: 0 }}>{project.solution}</p>
          </div>

          {project.modules && (
            <div style={{ marginBottom: 32 }}>
              <div style={{ fontSize: 11, color: 'var(--t4)', textTransform: 'uppercase', letterSpacing: 2, fontWeight: 700, marginBottom: 12 }}>{project.modulesTitle || 'The Six Vonex CCM Modules'}</div>
              <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', gap: 10 }}>
                {project.modules.map(([n, d], i) => (
                  <div key={n} style={{ padding: '14px 16px', background: 'var(--bg3)', border: `1px solid ${project.accent}33`, borderRadius: 10, position: 'relative' }}>
                    <div style={{ display: 'flex', alignItems: 'baseline', gap: 8, marginBottom: 6 }}>
                      <span style={{ fontSize: 10, color: project.accent, fontFamily: 'var(--ff-mono)', fontWeight: 700, opacity: 0.7 }}>0{i + 1}</span>
                      <span style={{ fontSize: 14, fontWeight: 700, color: '#fff' }}>{n}</span>
                    </div>
                    <div style={{ fontSize: 12.5, color: 'var(--t3)', lineHeight: 1.55 }}>{d}</div>
                  </div>
                ))}
              </div>
            </div>
          )}

          {project.leadership && (
            <div style={{ marginBottom: 32 }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10 }}>
                <div style={{ width: 3, height: 20, borderRadius: 2, background: project.accent }} />
                <h3 style={{ fontSize: isMobile ? 16 : 18, fontWeight: 700, color: '#fff', margin: 0 }}>Leadership &amp; Team</h3>
              </div>
              <p style={{ fontSize: 14, color: 'var(--t2)', lineHeight: 1.75, margin: '0 0 12px' }}>{project.leadership}</p>
              {project.team && (
                <div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, padding: '8px 14px', background: 'var(--bg3)', border: '1px solid var(--b1)', borderRadius: 999, fontSize: 12, color: 'var(--t2)', fontFamily: 'var(--ff-mono)' }}>
                  <span style={{ color: project.accent }}>◆</span> {project.team}
                </div>
              )}
            </div>
          )}

          {project.responsibilities && (
            <div style={{ marginBottom: 32 }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
                <div style={{ width: 3, height: 20, borderRadius: 2, background: 'var(--ac3)' }} />
                <h3 style={{ fontSize: isMobile ? 16 : 18, fontWeight: 700, color: '#fff', margin: 0 }}>My Responsibilities</h3>
              </div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
                {project.responsibilities.map((r, i) => (
                  <div key={i} style={{ display: 'flex', gap: 12, padding: '12px 16px', background: 'var(--bg3)', borderRadius: 8, border: '1px solid var(--b1)' }}>
                    <span style={{ color: 'var(--ac3)', fontFamily: 'var(--ff-mono)', fontSize: 12, flexShrink: 0, paddingTop: 2 }}>{String(i + 1).padStart(2, '0')}</span>
                    <span style={{ fontSize: 13, color: 'var(--t2)', lineHeight: 1.6 }}>{r}</span>
                  </div>
                ))}
              </div>
            </div>
          )}

          <div style={{ marginBottom: project.uxResearchNote ? 32 : 0 }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
              <div style={{ width: 3, height: 20, borderRadius: 2, background: 'var(--ac3)' }} />
              <h3 style={{ fontSize: isMobile ? 16 : 18, fontWeight: 700, color: '#fff', margin: 0 }}>Impact &amp; Results</h3>
            </div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
              {project.impact.map((item, i) => (
                <div key={i} style={{ display: 'flex', gap: 12, padding: '12px 16px', background: 'var(--bg3)', borderRadius: 8, border: '1px solid var(--b1)' }}>
                  <span style={{ color: project.accent, fontFamily: 'var(--ff-mono)', fontSize: 13, flexShrink: 0 }}>→</span>
                  <span style={{ fontSize: 13, color: 'var(--t2)', lineHeight: 1.6 }}>{item}</span>
                </div>
              ))}
            </div>
          </div>

          {project.uxResearchNote && (
            <div style={{ padding: '18px 20px', background: 'var(--bg3)', border: `1px dashed ${project.accent}66`, borderRadius: 12, display: 'flex', flexDirection: isMobile ? 'column' : 'row', gap: 14, alignItems: isMobile ? 'flex-start' : 'center', justifyContent: 'space-between' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
                <div style={{ fontSize: 11, color: 'var(--t4)', textTransform: 'uppercase', letterSpacing: 2, fontWeight: 700 }}>Companion Case Study</div>
                <div style={{ fontSize: 13.5, color: 'var(--t2)', lineHeight: 1.55 }}>{project.uxResearchNote}</div>
              </div>
              {project.behanceResearch && (
                <a href={project.behanceResearch} target="_blank" rel="noreferrer" style={{ flexShrink: 0, fontSize: 12, color: project.accent, textDecoration: 'none', padding: '8px 14px', border: `1px solid ${project.accent}`, borderRadius: 8, fontWeight: 600, whiteSpace: 'nowrap' }}>Open UX Research ↗</a>
              )}
            </div>
          )}
        </div>
      )}
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   CONTACT
   ─────────────────────────────────────────────────────────── */
function ContactView({ vp }) {
  const isMobile = vp.isMobile;
  return (
    <div className="view-enter" style={{ minHeight: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', background: 'var(--bg2)', position: 'relative', overflow: 'hidden', padding: '32px 0' }}>
      <svg style={{ position: 'absolute', top: -200, right: -200, width: 1000, height: 1000, opacity: 0.06, pointerEvents: 'none' }} viewBox="0 0 1000 1000">
        {[100, 200, 300, 400, 500].map((r) => <circle key={r} cx="500" cy="500" r={r} stroke="#fff" strokeWidth="1" fill="none" />)}
      </svg>
      <div style={{ width: '100%', maxWidth: 680, padding: isMobile ? '0 20px' : '0 40px', position: 'relative', zIndex: 1 }}>
        <div style={{ fontSize: 13, color: 'var(--ac-blue)', fontWeight: 600, letterSpacing: 3, marginBottom: 16, textAlign: 'center' }}>GET IN TOUCH</div>
        <h2 style={{ fontWeight: 800, fontSize: 'clamp(32px, 7vw, 60px)', letterSpacing: -2, lineHeight: 1.05, textAlign: 'center', marginBottom: 14, color: '#fff', fontFamily: 'Inter' }}>
          Let's build<br /><span style={{ color: 'var(--ac-blue)' }}>something great</span>
        </h2>
        <p style={{ fontSize: 'clamp(13px, 1.8vw, 15px)', color: 'var(--t3)', textAlign: 'center', lineHeight: 1.7, marginBottom: 32 }}>Available for full-time roles and select freelance projects.</p>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
          {[['✉', 'paulolebtag@gmail.com', 'mailto:paulolebtag@gmail.com'],
            ['in', 'linkedin.com/in/paulolebtag', 'https://www.linkedin.com/in/paulolebtag/'],
            ['☎', '+55 62 9 9381-5020', 'tel:+5562993815020'],
            ['be', 'behance.net/paulolebtag', 'https://www.behance.net/paulolebtag']].map(([icon, label, href]) => (
            <a key={label} href={href} target="_blank" rel="noreferrer" style={{ display: 'flex', alignItems: 'center', gap: 14, padding: '14px 18px', background: 'var(--bg3)', border: '1px solid var(--b1)', borderRadius: 12, textDecoration: 'none', transition: 'all .2s' }}
              onMouseEnter={(e) => { e.currentTarget.style.borderColor = 'var(--ac-blue)'; }}
              onMouseLeave={(e) => { e.currentTarget.style.borderColor = 'var(--b1)'; }}>
              <div style={{ width: 36, height: 36, borderRadius: 8, background: '#dceefd', color: 'var(--ac-blue)', display: 'flex', alignItems: 'center', justifyContent: 'center', fontWeight: 700, flexShrink: 0, fontFamily: 'Inter' }}>{icon}</div>
              <span style={{ fontSize: 13.5, color: '#fff', fontWeight: 500, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', minWidth: 0 }}>{label}</span>
              <span style={{ marginLeft: 'auto', fontSize: 13, color: 'var(--t4)' }}>↗</span>
            </a>
          ))}
        </div>
      </div>
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   APPENDIX — responsive
   ─────────────────────────────────────────────────────────── */
function AppendixView({ vp }) {
  const isMobile = vp.isMobile;
  return (
    <div className="view-enter" style={{ minHeight: '100%', height: isMobile ? 'auto' : '100%', overflow: isMobile ? 'visible' : 'auto', background: 'var(--bg2)', padding: isMobile ? '20px 14px' : '40px 48px' }}>
      <div style={{ background: '#fff', borderRadius: isMobile ? 14 : 20, padding: isMobile ? '20px 18px' : '32px 36px', boxShadow: '0 24px 60px rgba(0,0,0,0.3)', color: '#1a2332' }}>
        <div style={{ display: 'flex', alignItems: 'baseline', gap: 14, marginBottom: 20, flexWrap: 'wrap' }}>
          <div style={{ fontSize: isMobile ? 16 : 18, fontWeight: 600, color: '#1a2332' }}>Behance Portfolio</div>
          <a href="https://www.behance.net/paulolebtag" target="_blank" rel="noreferrer" style={{ fontSize: 13, color: 'var(--ac-blue)', textDecoration: 'none' }}>behance.net/paulolebtag ↗</a>
          {!isMobile && <div style={{ marginLeft: 'auto', fontSize: 12, color: '#6b7280' }}>{BEHANCE_LINKS.length} published</div>}
        </div>
        {isMobile ? (
          <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
            {BEHANCE_LINKS.map((item) => (
              <div key={item.url} style={{ padding: 14, border: '1px solid #e5e7eb', borderRadius: 10 }}>
                <div style={{ fontSize: 14, fontWeight: 600, color: '#1a2332', marginBottom: 6, lineHeight: 1.3 }}>{item.title}</div>
                <div style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 12, color: '#6b7280', marginBottom: 10, flexWrap: 'wrap' }}>
                  <span>{item.company}</span><span>·</span><span>{item.year}</span>
                </div>
                <div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
                  <span style={{ padding: '3px 10px', borderRadius: 6, background: '#f3f4f6', fontSize: 11, color: '#374151' }}>{item.type}</span>
                  <a href={item.url} target="_blank" rel="noreferrer" style={{ marginLeft: 'auto', fontSize: 12, color: 'var(--ac-blue)', textDecoration: 'none', padding: '5px 12px', border: '1.5px solid var(--ac-blue)', borderRadius: 6 }}>View ↗</a>
                </div>
              </div>
            ))}
          </div>
        ) : (
          <>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 200px 90px 180px 110px', alignItems: 'center', padding: '12px 12px', borderTop: '1px solid #e5e7eb', borderBottom: '1px solid #e5e7eb', background: '#fafafa', fontSize: 12, fontWeight: 600, color: '#1a2332' }}>
              <div>Title</div><div>Company</div><div>Year</div><div>Type</div><div>Link</div>
            </div>
            {BEHANCE_LINKS.map((item) => (
              <div key={item.url} style={{ display: 'grid', gridTemplateColumns: '1fr 200px 90px 180px 110px', alignItems: 'center', padding: '14px 12px', borderBottom: '1px solid #f3f4f6', transition: 'background .15s' }}
                onMouseEnter={(e) => e.currentTarget.style.background = '#fafafa'} onMouseLeave={(e) => e.currentTarget.style.background = 'transparent'}>
                <div style={{ fontSize: 14, fontWeight: 600, color: '#1a2332' }}>{item.title}</div>
                <div style={{ fontSize: 13, color: '#6b7280' }}>{item.company}</div>
                <div style={{ fontSize: 13, color: '#6b7280' }}>{item.year}</div>
                <div><span style={{ padding: '3px 10px', borderRadius: 6, background: '#f3f4f6', fontSize: 11, color: '#374151' }}>{item.type}</span></div>
                <a href={item.url} target="_blank" rel="noreferrer" style={{ fontSize: 12, color: 'var(--ac-blue)', textDecoration: 'none', padding: '5px 12px', border: '1.5px solid var(--ac-blue)', borderRadius: 6, display: 'inline-block', width: 'fit-content' }}>View ↗</a>
              </div>
            ))}
          </>
        )}
      </div>
    </div>
  );
}

/* ───────────────────────────────────────────────────────────
   APP
   ─────────────────────────────────────────────────────────── */
function App() {
  const [view, setView] = useState('home');
  const [detailProject, setDetailProject] = useState(null);
  const [viewKey, setViewKey] = useState(0);
  const vp = useViewport();
  const navigate = (v) => { setView(v); setViewKey((k) => k + 1); };

  const shellStyle = vp.isMobile
    ? { display: 'flex', flexDirection: 'column', minHeight: '100vh', width: '100%' }
    : { display: 'flex', width: '100%', height: '100vh', overflow: 'hidden' };

  return (
    <div style={shellStyle}>
      <UserCursor />
      <VisitorLayer view={view} vp={vp} />
      <Sidebar view={view} setView={navigate} vp={vp} />
      <div style={{ flex: 1, minWidth: 0, minHeight: vp.isMobile ? 'auto' : 0 }} key={viewKey}>
        {view === 'home' && <HomeView setView={navigate} vp={vp} />}
        {view === 'about' && <AboutView vp={vp} />}
        {view === 'education' && <EducationView vp={vp} />}
        {view === 'work' && <WorkView setView={navigate} setDetailProject={setDetailProject} vp={vp} />}
        {view === 'detail' && <DetailView project={detailProject} onBack={() => navigate('work')} vp={vp} />}
        {view === 'contact' && <ContactView vp={vp} />}
        {view === 'appendix' && <AppendixView vp={vp} />}
      </div>
    </div>
  );
}

if (document.getElementById('root')) {
  ReactDOM.createRoot(document.getElementById('root')).render(<App />);
}
