// Shared components — Header, Footer, icons

// ============ ICONS (inline SVG, Lucide-style) ============
const Icon = ({ name, size = 20, ...props }) => {
  const icons = {
    book: <><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/></>,
    sparkles: <><path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4M22 5h-4M4 17v2M5 18H3"/></>,
    chart: <><path d="M3 3v16a2 2 0 0 0 2 2h16"/><path d="m7 14 4-4 4 4 5-5"/></>,
    graduation: <><path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/><path d="M22 10v6M6 12.5V16a6 3 0 0 0 12 0v-3.5"/></>,
    users: <><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></>,
    user: <><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></>,
    clipboard: <><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></>,
    document: <><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></>,
    calendar: <><rect width="18" height="18" x="3" y="4" rx="2" ry="2"/><line x1="16" x2="16" y1="2" y2="6"/><line x1="8" x2="8" y1="2" y2="6"/><line x1="3" x2="21" y1="10" y2="10"/></>,
    check: <><path d="M20 6 9 17l-5-5"/></>,
    arrowRight: <><path d="M5 12h14M12 5l7 7-7 7"/></>,
    arrowLeft: <><path d="M19 12H5M12 19l-7-7 7-7"/></>,
    play: <><polygon points="6 3 20 12 6 21 6 3"/></>,
    menu: <><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></>,
    close: <><path d="M18 6 6 18M6 6l12 12"/></>,
    star: <><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></>,
    starFill: <><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" fill="currentColor"/></>,
    chevronDown: <><path d="m6 9 6 6 6-6"/></>,
    chevronRight: <><path d="m9 18 6-6-6-6"/></>,
    search: <><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></>,
    bell: <><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></>,
    home: <><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"/></>,
    settings: <><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></>,
    twinkle: <><path d="M12 3v3m0 12v3M5.636 5.636l2.122 2.122m8.485 8.485 2.121 2.121M3 12h3m12 0h3M5.636 18.364l2.122-2.122m8.485-8.485 2.121-2.121"/></>,
    brain: <><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/></>,
    target: <><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/></>,
    layers: <><path d="m12.83 2.18 8.57 3.9a1 1 0 0 1 0 1.83l-8.57 3.9a2 2 0 0 1-1.66 0l-8.57-3.9a1 1 0 0 1 0-1.83l8.57-3.9a2 2 0 0 1 1.66 0Z"/><path d="m6 13-3.39 1.54a1 1 0 0 0 0 1.83l8.58 3.9a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83L18 13"/></>,
    pencil: <><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/></>,
    puzzle: <><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z"/></>,
    trophy: <><path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6"/><path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18"/><path d="M4 22h16"/><path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22"/><path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22"/><path d="M18 2H6v7a6 6 0 0 0 12 0V2Z"/></>,
    shield: <><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></>,
    mail: <><rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/></>,
    map: <><path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0Z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/></>,
    bookOpen: <><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></>,
    messageCircle: <><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/></>,
    globe: <><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></>,
    heart: <><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.29 1.51 4.04 3 5.5l7 7Z"/></>,
    zap: <><path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/></>,
    file: <><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><polyline points="14 2 14 8 20 8"/></>,
    gamepad: <><line x1="6" x2="10" y1="11" y2="11"/><line x1="8" x2="8" y1="9" y2="13"/><line x1="15" x2="15.01" y1="12" y2="12"/><line x1="18" x2="18.01" y1="10" y2="10"/><path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258A4 4 0 0 0 17.32 5z"/></>,
    edit: <><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z"/></>,
    briefcase: <><rect width="20" height="14" x="2" y="7" rx="2" ry="2"/><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/></>,
    clock: <><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></>,
    minus: <><path d="M5 12h14"/></>,
    plus: <><path d="M5 12h14M12 5v14"/></>,
    coffee: <><path d="M10 2v2M14 2v2M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1"/><path d="M6 2v2"/></>,
    moon: <><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/></>,
    sun: <><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></>,
    wand: <><path d="M15 4V2M15 16v-2M8 9h2M20 9h2M17.8 11.8 19 13M15 9h.01M17.8 6.2 19 5M3 21l9-9M12.2 6.2 11 5"/></>,
  };
  return (
    <svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" {...props}>
      {icons[name]}
    </svg>
  );
};

// ============ LOGO ============
const Logo = ({ size = 28 }) => (
  <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
    <div style={{
      width: size + 8, height: size + 8,
      borderRadius: 10,
      background: 'var(--signature-gradient)',
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      color: 'white', flexShrink: 0
    }}>
      <Icon name="bookOpen" size={size - 8} />
    </div>
    <span style={{ fontFamily: 'var(--font-display)', fontWeight: 800, fontSize: 20, letterSpacing: '-0.02em', color: 'var(--text-primary)' }}>
      HomeScholar
    </span>
  </div>
);

// ============ HEADER ============
const Header = ({ transparent = true, currentPage = '' }) => {
  const [scrolled, setScrolled] = React.useState(false);
  const [drawerOpen, setDrawerOpen] = React.useState(false);
  const [featuresOpen, setFeaturesOpen] = React.useState(false);

  React.useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 20);
    window.addEventListener('scroll', onScroll);
    onScroll();
    return () => window.removeEventListener('scroll', onScroll);
  }, []);

  const headerStyle = {
    position: 'fixed',
    top: 0, left: 0, right: 0,
    zIndex: 100,
    transition: 'all 200ms ease',
    background: (scrolled || !transparent) ? 'rgba(255,255,255,0.85)' : 'transparent',
    backdropFilter: (scrolled || !transparent) ? 'blur(12px)' : 'none',
    borderBottom: (scrolled || !transparent) ? '1px solid var(--border-subtle)' : '1px solid transparent',
  };

  const navLinkStyle = (active) => ({
    fontSize: 14, fontWeight: 500,
    color: active ? 'var(--primary-blue)' : 'var(--text-primary)',
    padding: '8px 12px', borderRadius: 8,
    transition: 'background 150ms ease',
  });

  const features = [
    { href: 'homeschool-curriculum-planner.html', label: 'Curriculum Planner', icon: 'map', color: 'blue' },
    { href: 'ai-lesson-plan-generator.html', label: 'AI Lesson Plans', icon: 'sparkles', color: 'purple' },
    { href: 'homeschool-gradebook.html', label: 'Gradebook', icon: 'chart', color: 'green' },
    { href: 'homeschool-transcripts-and-report-cards.html', label: 'Transcripts & Reports', icon: 'graduation', color: 'blue' },
    { href: 'homeschool-legal-documents.html', label: 'Legal Documents', icon: 'document', color: 'pink' },
    { href: 'homeschool-co-op-management.html', label: 'Co-op Management', icon: 'users', color: 'orange' },
  ];

  return (
    <>
      <header style={headerStyle}>
        <div className="container" style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', height: 68 }}>
          <a href="index.html" aria-label="HomeScholar home"><Logo /></a>

          {/* Desktop nav */}
          <nav className="desktop-nav" style={{ display: 'none', gap: 4, alignItems: 'center' }}>
            <div
              style={{ position: 'relative' }}
              onMouseEnter={() => setFeaturesOpen(true)}
              onMouseLeave={() => setFeaturesOpen(false)}
            >
              <button style={{...navLinkStyle(false), display: 'flex', alignItems: 'center', gap: 4 }}>
                Features <Icon name="chevronDown" size={14} />
              </button>
              {featuresOpen && (
                <div style={{
                  position: 'absolute', top: '100%', left: 0, marginTop: 4,
                  background: 'white', border: '1px solid var(--border-subtle)',
                  borderRadius: 16, padding: 12, width: 380,
                  boxShadow: 'var(--shadow-lg)',
                  display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 4,
                }}>
                  {features.map(f => (
                    <a key={f.href} href={f.href} style={{
                      display: 'flex', alignItems: 'center', gap: 10, padding: '10px 12px',
                      borderRadius: 10, color: 'var(--text-primary)',
                      transition: 'background 150ms ease'
                    }}
                    onMouseEnter={e => e.currentTarget.style.background = 'var(--bg-subtle)'}
                    onMouseLeave={e => e.currentTarget.style.background = 'transparent'}
                    >
                      <div className={`icon-box icon-${f.color}`} style={{ width: 32, height: 32, borderRadius: 8 }}>
                        <Icon name={f.icon} size={16} />
                      </div>
                      <span style={{ fontSize: 13, fontWeight: 500 }}>{f.label}</span>
                    </a>
                  ))}
                </div>
              )}
            </div>
            <a href="ai-tools.html" style={navLinkStyle(currentPage === 'ai-tools')}>AI Tools</a>
            <a href="pricing.html" style={navLinkStyle(currentPage === 'pricing')}>Pricing</a>
            <a href="homeschool-co-op-management.html" style={navLinkStyle(currentPage === 'coops')}>Co-ops</a>
            <a href="blog.html" style={navLinkStyle(currentPage === 'blog')}>Blog</a>
          </nav>

          <div className="desktop-cta" style={{ display: 'none', gap: 8, alignItems: 'center' }}>
            <a href="#" style={{ ...navLinkStyle(false), fontSize: 14 }}>Log in</a>
            <a href="pricing.html" className="btn btn-gradient" style={{ padding: '10px 18px', minHeight: 40, fontSize: 14 }}>
              Start free trial
            </a>
          </div>

          {/* Mobile menu button */}
          <button
            className="mobile-menu-btn"
            onClick={() => setDrawerOpen(true)}
            aria-label="Open menu"
            style={{ padding: 8, borderRadius: 8, color: 'var(--text-primary)' }}
          >
            <Icon name="menu" size={24} />
          </button>
        </div>
      </header>

      {/* Mobile drawer */}
      {drawerOpen && (
        <div style={{
          position: 'fixed', inset: 0, zIndex: 200,
          background: 'rgba(15,23,42,0.5)', backdropFilter: 'blur(4px)',
        }}
        onClick={() => setDrawerOpen(false)}
        >
          <div
            onClick={e => e.stopPropagation()}
            style={{
              position: 'absolute', top: 0, right: 0, bottom: 0,
              width: 'min(360px, 85vw)', background: 'var(--bg-card)',
              padding: 24, display: 'flex', flexDirection: 'column',
              animation: 'slideIn 250ms ease',
            }}
          >
            <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 32 }}>
              <Logo />
              <button onClick={() => setDrawerOpen(false)} aria-label="Close menu" style={{ padding: 8 }}>
                <Icon name="close" size={24} />
              </button>
            </div>
            <nav style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1 }}>
              <div style={{ fontSize: 11, fontWeight: 700, textTransform: 'uppercase', letterSpacing: '0.08em', color: 'var(--text-tertiary)', padding: '12px 12px 8px' }}>Features</div>
              {features.map(f => (
                <a key={f.href} href={f.href} style={{
                  display: 'flex', alignItems: 'center', gap: 12, padding: '12px',
                  borderRadius: 10, color: 'var(--text-primary)', fontWeight: 500, fontSize: 15,
                }}>
                  <div className={`icon-box icon-${f.color}`} style={{ width: 32, height: 32, borderRadius: 8 }}>
                    <Icon name={f.icon} size={16} />
                  </div>
                  {f.label}
                </a>
              ))}
              <div style={{ fontSize: 11, fontWeight: 700, textTransform: 'uppercase', letterSpacing: '0.08em', color: 'var(--text-tertiary)', padding: '16px 12px 8px' }}>More</div>
              <a href="ai-tools.html" style={{ padding: 12, borderRadius: 10, color: 'var(--text-primary)', fontWeight: 500, fontSize: 15 }}>AI Tools</a>
              <a href="pricing.html" style={{ padding: 12, borderRadius: 10, color: 'var(--text-primary)', fontWeight: 500, fontSize: 15 }}>Pricing</a>
              <a href="blog.html" style={{ padding: 12, borderRadius: 10, color: 'var(--text-primary)', fontWeight: 500, fontSize: 15 }}>Blog</a>
              <a href="#" style={{ padding: 12, borderRadius: 10, color: 'var(--text-primary)', fontWeight: 500, fontSize: 15 }}>Log in</a>
            </nav>
            <a href="pricing.html" className="btn btn-gradient btn-full" style={{ marginTop: 16 }}>
              Start free trial
            </a>
          </div>
        </div>
      )}

      <style>{`
        @keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
        @media (min-width: 900px) {
          .desktop-nav { display: flex !important; }
          .desktop-cta { display: flex !important; }
          .mobile-menu-btn { display: none !important; }
        }
      `}</style>
    </>
  );
};

// ============ FOOTER ============
const Footer = () => (
  <footer style={{ background: 'var(--bg-card)', borderTop: '1px solid var(--border-subtle)', padding: '64px 0 32px' }}>
    <div className="container">
      <div style={{ display: 'grid', gap: 40, gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))' }}>
        <div style={{ gridColumn: 'span 2', minWidth: 200 }}>
          <Logo />
          <p style={{ color: 'var(--text-secondary)', fontSize: 14, marginTop: 16, maxWidth: 320 }}>
            The all-in-one AI homeschool platform. Plan, grade, and generate every document — all for less than two coffees a month.
          </p>
          <div style={{ marginTop: 20, display: 'flex', gap: 8 }}>
            <a href="#" aria-label="TikTok" className="icon-box icon-blue" style={{ width: 36, height: 36, borderRadius: 10 }}>
              <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5.8 20.1a6.34 6.34 0 0 0 10.86-4.43V8.93a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1.84-.36z"/></svg>
            </a>
            <a href="#" aria-label="Instagram" className="icon-box icon-pink" style={{ width: 36, height: 36, borderRadius: 10 }}>
              <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><rect width="20" height="20" x="2" y="2" rx="5"/><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"/><line x1="17.5" x2="17.51" y1="6.5" y2="6.5"/></svg>
            </a>
            <a href="mailto:hello@homescholar.app" aria-label="Email" className="icon-box icon-purple" style={{ width: 36, height: 36, borderRadius: 10 }}>
              <Icon name="mail" size={16} />
            </a>
          </div>
        </div>
        <FooterCol title="Product" links={[
          ['Features', 'index.html#features'], ['AI Tools', 'ai-tools.html'],
          ['Pricing', 'pricing.html'], ['Co-ops', 'homeschool-co-op-management.html'],
          ['Student Portal', 'for-students.html'],
        ]} />
        <FooterCol title="Resources" links={[
          ['Blog', 'blog.html'], ['Homeschool Laws', 'homeschool-laws-texas.html'],
          ['Help Center', '#'], ['Compare', 'compare-homeschool-planet.html'],
        ]} />
        <FooterCol title="Company" links={[
          ['About', 'about.html'], ['Contact', 'contact.html'],
          ['Privacy', 'privacy.html'], ['Terms', 'terms.html'],
        ]} />
      </div>
      <div style={{ marginTop: 48, paddingTop: 24, borderTop: '1px solid var(--border-subtle)', display: 'flex', flexWrap: 'wrap', gap: 12, justifyContent: 'space-between', alignItems: 'center' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, fontSize: 13, color: 'var(--text-secondary)' }}>
          <div style={{ width: 24, height: 24, borderRadius: 6, background: 'var(--signature-gradient)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'white' }}>
            <Icon name="bookOpen" size={14} />
          </div>
          <span>© 2026 Soleo Technologies. Made in Austin, Texas with <Icon name="coffee" size={12} style={{ display: 'inline', verticalAlign: 'middle' }} /> and 3 kids homeschooling in the background.</span>
        </div>
      </div>
    </div>
  </footer>
);

const FooterCol = ({ title, links }) => (
  <div>
    <div style={{ fontWeight: 700, marginBottom: 16, fontSize: 14, color: 'var(--text-primary)' }}>{title}</div>
    <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
      {links.map(([label, href]) => (
        <a key={label} href={href} style={{ fontSize: 14, color: 'var(--text-secondary)' }}>{label}</a>
      ))}
    </div>
  </div>
);

// ============ STICKY MOBILE CTA ============
const StickyMobileCTA = () => {
  const [visible, setVisible] = React.useState(false);
  React.useEffect(() => {
    const onScroll = () => setVisible(window.scrollY > 600);
    window.addEventListener('scroll', onScroll);
    return () => window.removeEventListener('scroll', onScroll);
  }, []);
  return (
    <div className="sticky-mobile-cta" style={{
      position: 'fixed', bottom: 0, left: 0, right: 0,
      zIndex: 90,
      padding: 12,
      background: 'rgba(255,255,255,0.9)',
      backdropFilter: 'blur(12px)',
      borderTop: '1px solid var(--border-subtle)',
      transform: visible ? 'translateY(0)' : 'translateY(100%)',
      transition: 'transform 300ms ease',
    }}>
      <a href="pricing.html" className="btn btn-gradient btn-full" style={{ minHeight: 52 }}>
        Start free trial — $14.99/mo after
      </a>
      <style>{`@media (min-width: 900px) { .sticky-mobile-cta { display: none; } }`}</style>
    </div>
  );
};

// ============ STARS ============
const Stars = ({ count = 5 }) => (
  <span className="stars">
    {Array.from({ length: count }).map((_, i) => (
      <Icon key={i} name="starFill" size={14} />
    ))}
  </span>
);

// ============ BREADCRUMBS ============
const Breadcrumbs = ({ items }) => (
  <nav style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 13, color: 'var(--text-secondary)', marginBottom: 24 }}>
    <a href="index.html" style={{ color: 'var(--text-secondary)' }}>Home</a>
    {items.map((item, i) => (
      <React.Fragment key={i}>
        <Icon name="chevronRight" size={12} />
        {item.href ? <a href={item.href} style={{ color: 'var(--text-secondary)' }}>{item.label}</a> : <span style={{ color: 'var(--text-primary)', fontWeight: 500 }}>{item.label}</span>}
      </React.Fragment>
    ))}
  </nav>
);

// ============ FEATURE CARD ============
const FeatureCard = ({ icon, color, title, description, href }) => (
  <a href={href} className={`card card-accent accent-${color}`} style={{ display: 'block', color: 'inherit', textDecoration: 'none' }}>
    <div className={`icon-box icon-${color}`} style={{ marginBottom: 16 }}>
      <Icon name={icon} size={20} />
    </div>
    <h3 style={{ fontSize: 20, marginBottom: 8 }}>{title}</h3>
    <p style={{ color: 'var(--text-secondary)', fontSize: 15, lineHeight: 1.6, marginBottom: 16 }}>{description}</p>
    <span style={{ color: `var(--primary-${color === 'green' ? 'blue' : color === 'red' || color === 'orange' ? 'blue' : color})`, fontSize: 14, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 4 }}>
      Learn more <Icon name="arrowRight" size={14} />
    </span>
  </a>
);

// ============ REVEAL (scroll-triggered) ============
const useReveal = () => {
  React.useEffect(() => {
    if (typeof IntersectionObserver === 'undefined') return;
    const els = document.querySelectorAll('.reveal');
    const io = new IntersectionObserver((entries) => {
      entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } });
    }, { threshold: 0.1 });
    els.forEach(el => io.observe(el));
    return () => io.disconnect();
  }, []);
};

// Export to window
Object.assign(window, {
  Icon, Logo, Header, Footer, StickyMobileCTA, Stars, Breadcrumbs, FeatureCard, useReveal
});
