// Header / Logo / Theme + Lang toggle
const { useState, useEffect, useRef, useMemo } = React;

function Logo({ size = 32 }) {
  return (
    <a href="#top" aria-label="init9" style={{ display: 'inline-flex', alignItems: 'center', height: size, color: 'var(--fg)' }}>
      <svg viewBox="100 188 312 120" xmlns="http://www.w3.org/2000/svg" style={{ height: size, width: 'auto', display: 'block' }} aria-hidden="true">
        <path fill="currentColor" fillRule="evenodd" d="M 115.00 277.50 L 102.50 277.00 L 103.00 210.50 L 115.00 210.50 L 116.50 216.00 L 115.00 277.50 Z M 198.00 277.50 L 185.00 276.50 L 151.00 234.50 L 149.50 276.00 L 135.50 277.00 L 136.00 210.50 L 149.00 210.50 L 184.00 254.50 L 185.50 211.00 L 198.50 211.00 L 198.00 277.50 Z M 230.00 277.50 L 217.50 277.00 L 218.00 210.50 L 231.50 211.00 L 230.00 277.50 Z M 280.00 277.50 L 267.50 277.00 L 267.50 224.00 L 245.00 222.50 L 245.00 210.50 L 303.50 211.00 L 303.00 222.50 L 281.50 224.00 L 280.00 277.50 Z" />
        <path fill="#1586D9" fillRule="evenodd" d="M 352.00 267.50 L 336.00 265.50 L 321.50 256.00 L 313.50 241.00 L 313.50 223.00 L 320.50 208.00 L 331.00 198.50 L 346.00 192.50 L 368.00 192.50 L 383.50 199.00 L 375.00 202.50 L 368.00 212.50 L 349.00 210.50 L 342.00 213.50 L 332.50 226.00 L 333.50 240.00 L 342.00 249.50 L 357.00 252.50 L 370.50 248.00 L 367.50 258.00 L 361.00 264.50 L 352.00 267.50 Z M 401.00 211.50 L 392.50 206.00 L 391.50 200.00 L 396.00 193.50 L 404.00 192.50 L 409.50 197.00 L 410.50 204.00 L 407.00 209.50 L 401.00 211.50 Z M 336.00 304.50 L 324.50 303.00 L 352.00 282.50 L 374.50 256.00 L 379.50 240.00 L 376.50 213.00 L 382.00 207.50 L 386.00 207.50 L 396.50 219.00 L 399.50 230.00 L 398.50 245.00 L 391.50 263.00 L 381.50 277.00 L 361.00 295.50 L 336.00 304.50 Z" />
      </svg>
    </a>
  );
}

function Header({ lang, setLang, theme, setTheme }) {
  const t = I18N[lang];
  const [scrolled, setScrolled] = useState(false);
  const [open, setOpen] = useState(false);
  useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 8);
    window.addEventListener('scroll', onScroll);
    return () => window.removeEventListener('scroll', onScroll);
  }, []);

  const navLinks = [
    { href: 'cloud.html', label: t.nav.cloud, color: 'var(--cloud)' },
    { href: 'media.html', label: t.nav.media, color: 'var(--media)' },
    { href: 'tools.html', label: t.nav.tools, color: 'var(--tools)' },
    { href: '#partners', label: t.nav.partner, color: 'var(--fg)' },
    { href: '#contact', label: t.nav.contact, color: 'var(--fg)' },
  ];

  return (
    <header role="banner" style={{
      position: 'sticky', top: 0, zIndex: 50,
      background: scrolled ? `rgba(var(--bg-rgb) / 0.85)` : 'transparent',
      backdropFilter: scrolled ? 'blur(12px) saturate(140%)' : 'none',
      WebkitBackdropFilter: scrolled ? 'blur(12px) saturate(140%)' : 'none',
      borderBottom: scrolled ? '1px solid var(--line)' : '1px solid transparent',
      transition: 'all 200ms ease'
    }}>
      <div className="wrap" style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', height: 72 }}>
        <Logo />
        <nav aria-label="Hauptnavigation" style={{ display: 'flex', alignItems: 'center', gap: 4 }} className="desktop-nav">
          {navLinks.map((l, i) => (
            <a key={i} href={l.href} className="nav-link"
              onMouseEnter={(e) => { e.currentTarget.style.color = l.color; }}
              onMouseLeave={(e) => { e.currentTarget.style.color = 'var(--fg)'; }}
              style={{ padding: '10px 14px', fontSize: 14, fontWeight: 500, transition: 'color 150ms ease' }}>
              {l.label}
            </a>
          ))}
        </nav>
        <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
          <div style={{ display: 'flex', alignItems: 'center', border: '1px solid var(--line)', borderRadius: 999, padding: 2, fontSize: 12, fontWeight: 600, fontFamily: "var(--font-mono)" }}>
            {['de', 'en'].map(l => (
              <button key={l} onClick={() => setLang(l)} style={{
                padding: '5px 10px', borderRadius: 999,
                background: lang === l ? 'var(--fg)' : 'transparent',
                color: lang === l ? 'var(--bg)' : 'var(--muted)', transition: 'all 150ms'
              }}>{l.toUpperCase()}</button>
            ))}
          </div>
          <button onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')} aria-label="toggle theme"
            style={{ width: 36, height: 36, display: 'grid', placeItems: 'center', border: '1px solid var(--line)', borderRadius: 999 }}>
            {theme === 'dark' ? (
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><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 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
            ) : (
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
            )}
          </button>
          <button className="mobile-toggle" onClick={() => setOpen(!open)} aria-label="menu"
            style={{ width: 36, height: 36, display: 'none', placeItems: 'center', border: '1px solid var(--line)', borderRadius: 999 }}>
            {open ? '×' : '≡'}
          </button>
        </div>
      </div>
      {open && (
        <div className="mobile-menu" style={{ borderTop: '1px solid var(--line)', padding: '12px 0', background: 'var(--bg)' }}>
          <div className="wrap" style={{ display: 'flex', flexDirection: 'column' }}>
            {navLinks.map((l, i) => (
              <a key={i} href={l.href} onClick={() => setOpen(false)}
                style={{ padding: '14px 0', fontSize: 16, borderBottom: '1px solid var(--line)' }}>{l.label}</a>
            ))}
          </div>
        </div>
      )}
      <style>{`
        @media (max-width: 880px) { .desktop-nav { display: none !important; } .mobile-toggle { display: grid !important; } }
        @media (min-width: 881px) { .mobile-menu { display: none !important; } }
      `}</style>
    </header>
  );
}

function TickerLine({ items }) {
  const text = items.join('   ✦   ');
  return (
    <div style={{ overflow: 'hidden', borderTop: '1px solid var(--line)', borderBottom: '1px solid var(--line)', padding: '14px 0', whiteSpace: 'nowrap', fontFamily: "var(--font-mono)", fontSize: 13, letterSpacing: '0.06em', textTransform: 'uppercase', color: 'var(--muted)' }}>
      <div style={{ display: 'inline-block', animation: 'ticker 60s linear infinite' }}>
        {[0,1,2,3].map(i => <span key={i} style={{ marginRight: 40 }}>{text}   ✦   </span>)}
      </div>
      <style>{`@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-25%); } }`}</style>
    </div>
  );
}

function Hero({ t, density }) {
  const [mouse, setMouse] = useState({ x: 0.5, y: 0.5 });
  useEffect(() => {
    const onMove = (e) => setMouse({ x: e.clientX / window.innerWidth, y: e.clientY / window.innerHeight });
    window.addEventListener('mousemove', onMove);
    return () => window.removeEventListener('mousemove', onMove);
  }, []);
  const tx = (mouse.x - 0.5) * 30;
  const ty = (mouse.y - 0.5) * 30;
  const py = density === 'compact' ? '60px 0 40px' : '100px 0 60px';

  return (
    <section id="top" style={{ padding: py, position: 'relative', overflow: 'hidden' }}>
      <div className="wrap">
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontFamily: "var(--font-mono)", fontSize: 12, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: '0.08em', marginBottom: 56 }}>
          <span>[ {t.hero.kicker} ]</span>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
            <span style={{ width: 8, height: 8, borderRadius: 999, background: '#10b981', display: 'inline-block', boxShadow: '0 0 8px #10b981' }}></span>
            {t.hero.live}
          </span>
        </div>
        <div style={{ position: 'relative' }}>
          <h1 style={{ fontSize: 'clamp(56px, 11vw, 180px)', lineHeight: 0.9, fontWeight: 700, letterSpacing: '-0.04em', position: 'relative', zIndex: 2 }}>
            <span style={{ display: 'block' }}>{t.hero.line1}</span>
            <span style={{ display: 'block', color: 'var(--muted)' }}>{t.hero.line2}</span>
          </h1>
          <div aria-hidden style={{ position: 'absolute', right: -40, top: '-10%', fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 'clamp(220px, 32vw, 540px)', lineHeight: 1, color: 'var(--accent)', opacity: 0.12, transform: `translate(${tx}px, ${ty}px)`, transition: 'transform 400ms cubic-bezier(.2,.8,.2,1)', pointerEvents: 'none', zIndex: 0 }}>9</div>
        </div>
        <div style={{ marginTop: 48, display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) auto', gap: 40, alignItems: 'end' }} className="hero-bottom">
          <p style={{ fontSize: 'clamp(17px, 1.5vw, 22px)', maxWidth: 640, color: 'var(--muted)', lineHeight: 1.5 }}>{t.hero.sub}</p>
          <div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
            <a href="#contact" className="btn-primary" style={{ padding: '16px 26px', borderRadius: 999, background: 'var(--fg)', color: 'var(--bg)', fontWeight: 600, fontSize: 15, display: 'inline-flex', alignItems: 'center', gap: 8, transition: 'transform 150ms' }}>
              {t.hero.cta} <span style={{ fontSize: 18 }}>→</span>
            </a>
            <a href="#divisions" className="btn-secondary" style={{ padding: '16px 26px', borderRadius: 999, border: '1px solid var(--line)', fontWeight: 600, fontSize: 15 }}>{t.hero.ctaSecondary}</a>
          </div>
        </div>
      </div>
      <style>{`
        @media (max-width: 720px) { .hero-bottom { grid-template-columns: 1fr !important; } }
        .btn-primary:hover { transform: translateY(-2px); }
      `}</style>
    </section>
  );
}

function OSStrip({ t }) {
  const o = t.os;
  const glyphs = {
    macOS: <svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M16.365 1.43c0 1.14-.42 2.22-1.13 3.04-.78.91-2.06 1.62-3.13 1.55-.13-1.1.42-2.27 1.07-3.02.74-.86 2.07-1.49 3.19-1.57zM20.5 17.27c-.55 1.27-.81 1.83-1.52 2.95-.99 1.56-2.39 3.51-4.13 3.52-1.55.02-1.95-1-4.05-1-2.1.01-2.55 1.02-4.1 1.01-1.74-.02-3.07-1.78-4.06-3.34-2.78-4.36-3.07-9.48-1.36-12.2 1.22-1.93 3.14-3.06 4.95-3.06 1.84 0 3 1.01 4.52 1.01 1.47 0 2.37-1.01 4.5-1.01 1.62 0 3.33.88 4.55 2.41-4 2.19-3.35 7.91 1.7 8.71z"/></svg>,
    Windows: <svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M3 5.48L10.5 4.45v7.05H3V5.48zm0 13.04V12h7.5v7.55L3 18.52zm8.5-13.4L21 3.75v8.75h-9.5V5.12zm0 7.88H21v8.75l-9.5-1.37V13z"/></svg>,
    Linux: <svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12.5 2c-2.2 0-3.6 1.7-3.6 4.4 0 1.4.5 2.6 1 3.5.4.7.6 1.3.6 1.9 0 1-.6 1.6-1.4 2.4-1 1-2.5 2.4-2.5 4.7 0 .8.2 1.4.5 1.9-.4.4-.6 1-.6 1.5 0 .9.6 1.5 1.5 1.6.7.6 1.7.9 2.8 1.1 1.4.2 2.4.2 3.6 0 1.1-.2 2.1-.5 2.8-1.1.9-.1 1.5-.7 1.5-1.6 0-.5-.2-1.1-.6-1.5.3-.5.5-1.1.5-1.9 0-2.3-1.5-3.7-2.5-4.7-.8-.8-1.4-1.4-1.4-2.4 0-.6.2-1.2.6-1.9.5-.9 1-2.1 1-3.5C16.1 3.7 14.7 2 12.5 2z"/></svg>,
    iOS: <svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="6.5" y="2" width="11" height="20" rx="2.2" fill="none" stroke="currentColor" strokeWidth="1.6"/><circle cx="12" cy="19" r="0.8"/><line x1="10.5" y1="4.5" x2="13.5" y2="4.5" stroke="currentColor" strokeWidth="1" strokeLinecap="round"/></svg>,
    iPadOS: <svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="3.5" y="3" width="17" height="18" rx="2" fill="none" stroke="currentColor" strokeWidth="1.6"/><circle cx="12" cy="18.5" r="0.7"/></svg>,
  };
  return (
    <section id="platforms" style={{ padding: '56px 0', borderTop: '1px solid var(--line)', borderBottom: '1px solid var(--line)', background: 'var(--surface)' }}>
      <div className="wrap">
        <div className="os-grid" style={{ display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 48, alignItems: 'center' }}>
          <div>
            <div className="mono" style={{ fontSize: 12, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: '0.08em', marginBottom: 12 }}>{o.kicker}</div>
            <h2 style={{ fontSize: 'clamp(22px, 2.2vw, 30px)', fontWeight: 600, lineHeight: 1.15, letterSpacing: '-0.02em', marginBottom: 8 }}>{o.title}</h2>
            <p style={{ color: 'var(--muted)', fontSize: 15, lineHeight: 1.55, maxWidth: 460 }}>{o.sub}</p>
          </div>
          <ul style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: 12 }} className="os-list">
            {o.list.map((name) => (
              <li key={name} style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '20px 8px', border: '1px solid var(--line)', borderRadius: 14, background: 'var(--bg)', gap: 10, color: 'var(--fg)' }}>
                <div style={{ opacity: 0.85 }}>{glyphs[name]}</div>
                <span className="mono" style={{ fontSize: 12, color: 'var(--muted)', letterSpacing: '0.04em' }}>{name}</span>
              </li>
            ))}
          </ul>
        </div>
      </div>
      <style>{`
        @media (max-width: 880px) { .os-grid { grid-template-columns: 1fr !important; gap: 24px !important; } }
        @media (max-width: 520px) { .os-list { grid-template-columns: repeat(3, 1fr) !important; } }
      `}</style>
    </section>
  );
}

function Why({ t }) {
  return (
    <section id="why" style={{ padding: '100px 0', borderTop: '1px solid var(--line)', background: 'var(--surface)' }}>
      <div className="wrap">
        <div className="why-grid" style={{ display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 64, alignItems: 'start' }}>
          <div style={{ position: 'sticky', top: 100 }}>
            <div className="mono" style={{ fontSize: 12, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: '0.08em', marginBottom: 24 }}>{t.why.kicker}</div>
            <h2 style={{ fontSize: 'clamp(36px, 4vw, 56px)', lineHeight: 1, fontWeight: 700, whiteSpace: 'pre-line' }}>{t.why.title}</h2>
          </div>
          <div style={{ display: 'grid', gap: 0 }}>
            {t.why.points.map((p, i) => (
              <div key={i} style={{ display: 'grid', gridTemplateColumns: '60px 1fr', gap: 24, padding: '32px 0', borderTop: '1px solid var(--line)' }}>
                <div className="mono" style={{ fontSize: 13, color: 'var(--muted)', paddingTop: 6 }}>{p.n}</div>
                <div>
                  <h3 style={{ fontSize: 22, fontWeight: 600, marginBottom: 10 }}>{p.h}</h3>
                  <p style={{ color: 'var(--muted)', fontSize: 16, lineHeight: 1.55 }}>{p.t}</p>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
      <style>{`@media (max-width: 880px) { .why-grid { grid-template-columns: 1fr !important; gap: 32px !important; } }`}</style>
    </section>
  );
}

function DivisionCard({ id, accentVar, idx, total, data }) {
  const [hover, setHover] = useState(false);
  return (
    <article id={id} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
      style={{ position: 'relative', padding: '48px 40px', borderTop: '1px solid var(--line)', cursor: 'pointer', overflow: 'hidden', transition: 'all 250ms ease', background: hover ? `color-mix(in oklch, ${accentVar} 8%, transparent)` : 'transparent' }}>
      <div className="div-grid" style={{ display: 'grid', gridTemplateColumns: '120px 1.6fr 1fr auto', gap: 32, alignItems: 'start' }}>
        <div className="mono" style={{ fontSize: 13, color: hover ? accentVar : 'var(--muted)', fontWeight: 500, transition: 'color 200ms' }}>0{idx + 1} / 0{total}</div>
        <div>
          <div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, marginBottom: 18, padding: '4px 10px', borderRadius: 999, background: accentVar, color: 'oklch(0.18 0.01 60)', fontFamily: "var(--font-mono)", fontSize: 11, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.08em' }}>
            <span style={{ width: 6, height: 6, borderRadius: 999, background: 'currentColor' }}></span>
            init9.{data.tag}
          </div>
          <h3 style={{ fontSize: 'clamp(28px, 3.2vw, 44px)', lineHeight: 1.05, fontWeight: 600, marginBottom: 16, letterSpacing: '-0.025em' }}>{data.title}</h3>
          <p style={{ fontSize: 17, color: 'var(--muted)', lineHeight: 1.5, maxWidth: 520 }}>{data.desc}</p>
        </div>
        <ul style={{ display: 'grid', gap: 10, paddingTop: 6 }}>
          {data.items.map((it, i) => (
            <li key={i} className="mono" style={{ fontSize: 13, color: 'var(--fg)', display: 'flex', alignItems: 'center', gap: 10 }}>
              <span style={{ width: 5, height: 5, borderRadius: 999, background: accentVar, flexShrink: 0 }}></span>{it}
            </li>
          ))}
        </ul>
        <div style={{ width: 64, height: 64, borderRadius: 999, border: `1px solid var(--line)`, display: 'grid', placeItems: 'center', flexShrink: 0, background: hover ? accentVar : 'transparent', color: hover ? 'oklch(0.18 0.01 60)' : 'var(--fg)', transform: hover ? 'rotate(-45deg)' : 'rotate(0deg)', transition: 'all 250ms ease' }}>
          <span style={{ fontSize: 22 }}>→</span>
        </div>
      </div>
      <div style={{ position: 'absolute', left: 0, top: 0, height: '100%', width: 4, background: accentVar, transform: hover ? 'scaleY(1)' : 'scaleY(0)', transformOrigin: 'top', transition: 'transform 250ms' }}></div>
      <style>{`@media (max-width: 880px) { .div-grid { grid-template-columns: 1fr !important; } }`}</style>
    </article>
  );
}

function Divisions({ t }) {
  const list = [
    { id: 'cloud', accent: 'var(--cloud)', data: t.div.cloud },
    { id: 'media', accent: 'var(--media)', data: t.div.media },
    { id: 'tools', accent: 'var(--tools)', data: t.div.tools },
  ];
  return (
    <section id="divisions" style={{ padding: '100px 0 0', borderTop: '1px solid var(--line)' }}>
      <div className="wrap" style={{ marginBottom: 56 }}>
        <div className="mono" style={{ fontSize: 12, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: '0.08em', marginBottom: 16 }}>{t.div.kicker}</div>
        <h2 style={{ fontSize: 'clamp(40px, 5vw, 72px)', lineHeight: 1, fontWeight: 700, letterSpacing: '-0.03em' }}>
          init9<span style={{ color: 'var(--cloud)' }}>.cloud</span> · init9<span style={{ color: 'var(--media)' }}>.media</span> · init9<span style={{ color: 'var(--tools)' }}>.tools</span>
        </h2>
      </div>
      <div>
        {list.map((d, i) => (
          <DivisionCard key={d.id} id={d.id} accentVar={d.accent} idx={i} total={list.length} data={d.data} />
        ))}
      </div>
    </section>
  );
}

const PARTNERS = [
  { name: 'Atlassian', cat: 'Tools' }, { name: 'Jira', cat: 'Tools' }, { name: 'Confluence', cat: 'Tools' },
  { name: 'Ubiquiti', cat: 'Network', featured: true }, { name: 'UniFi', cat: 'Network' },
  { name: 'Microsoft 365', cat: 'Cloud' }, { name: 'Google Workspace', cat: 'Cloud' }, { name: 'AWS', cat: 'Cloud' },
  { name: 'Hetzner', cat: 'Hosting' }, { name: 'Cloudflare', cat: 'Edge' },
  { name: 'Adobe', cat: 'Media' }, { name: 'DaVinci Resolve', cat: 'Media' },
  { name: 'Sony', cat: 'Hardware' }, { name: 'DJI', cat: 'Drone' },
  { name: 'Figma', cat: 'Design' }, { name: 'GitHub', cat: 'Dev' },
];

function Marquee({ items, speed = 60, reverse = false }) {
  const text = (
    <div style={{ display: 'inline-flex', gap: 56, paddingRight: 56, alignItems: 'center' }}>
      {items.map((p, i) => (
        <span key={i} style={{ fontFamily: "var(--font-display)", fontWeight: 600, fontSize: 'clamp(28px, 4vw, 56px)', letterSpacing: '-0.02em', color: p.featured ? 'var(--accent)' : 'var(--fg)', display: 'inline-flex', alignItems: 'center', gap: 12, whiteSpace: 'nowrap' }}>
          {p.featured && <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, padding: '4px 8px', borderRadius: 4, background: 'var(--accent)', color: 'oklch(0.18 0.01 60)', letterSpacing: '0.05em', textTransform: 'uppercase' }}>★ Featured</span>}
          {p.name}
          <span style={{ color: 'var(--muted)', fontSize: 12, fontFamily: "var(--font-mono)" }}>/{p.cat}</span>
        </span>
      ))}
    </div>
  );
  return (
    <div style={{ overflow: 'hidden', whiteSpace: 'nowrap', padding: '24px 0' }}>
      <div style={{ display: 'inline-flex', animation: `${reverse ? 'marquee-r' : 'marquee'} ${speed}s linear infinite` }}>
        {[0,1,2].map(i => <React.Fragment key={i}>{text}</React.Fragment>)}
      </div>
      <style>{`
        @keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-33.33%); } }
        @keyframes marquee-r { from { transform: translateX(-33.33%); } to { transform: translateX(0); } }
      `}</style>
    </div>
  );
}

function Partners({ t }) {
  return (
    <section id="partners" style={{ padding: '100px 0', borderTop: '1px solid var(--line)' }}>
      <div className="wrap">
        <div style={{ display: 'grid', gridTemplateColumns: '1fr', gap: 24, marginBottom: 48 }}>
          <div className="mono" style={{ fontSize: 12, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: '0.08em' }}>{t.partners.kicker}</div>
          <div className="part-head" style={{ display: 'grid', gridTemplateColumns: '1.2fr 1fr', gap: 48, alignItems: 'end' }}>
            <h2 style={{ fontSize: 'clamp(36px, 4.5vw, 64px)', lineHeight: 1, fontWeight: 700, whiteSpace: 'pre-line' }}>{t.partners.title}</h2>
            <p style={{ color: 'var(--muted)', fontSize: 16, lineHeight: 1.55, maxWidth: 480 }}>{t.partners.sub}</p>
          </div>
        </div>
      </div>
      <div className="wrap" style={{ marginBottom: 56 }}>
        <div className="ubnt-card" style={{ border: '1px solid var(--line)', borderRadius: 24, padding: 40, display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 48, alignItems: 'center', background: 'var(--surface)', position: 'relative', overflow: 'hidden' }}>
          <div style={{ aspectRatio: '4 / 3', borderRadius: 16, background: `repeating-linear-gradient(45deg, var(--line), var(--line) 1px, transparent 1px, transparent 14px), color-mix(in oklch, var(--cloud) 20%, var(--bg))`, position: 'relative', display: 'grid', placeItems: 'center' }}>
            <div style={{ textAlign: 'center', fontFamily: "var(--font-mono)", fontSize: 12, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: '0.08em' }}>
              <div style={{ fontFamily: "var(--font-display)", fontSize: 56, fontWeight: 700, color: 'var(--fg)', letterSpacing: '-0.04em', marginBottom: 8 }}>U</div>
              [ Ubiquiti / UniFi gear photo ]
            </div>
          </div>
          <div>
            <div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, marginBottom: 16, padding: '4px 10px', borderRadius: 999, border: '1px solid var(--line)', fontFamily: "var(--font-mono)", fontSize: 11, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.08em', color: 'var(--muted)' }}>★ {t.partners.featured}</div>
            <h3 style={{ fontSize: 'clamp(28px, 3vw, 40px)', fontWeight: 700, lineHeight: 1.05, marginBottom: 16, letterSpacing: '-0.02em' }}>Ubiquiti<span style={{ color: 'var(--cloud)' }}>.</span> Networking that just works.</h3>
            <p style={{ color: 'var(--muted)', fontSize: 17, lineHeight: 1.55, marginBottom: 24 }}>{t.partners.ubntDesc}</p>
            <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
              {['UniFi Network', 'UniFi Protect', 'UniFi Talk', 'UISP'].map((p) => (
                <span key={p} className="mono" style={{ padding: '6px 12px', borderRadius: 999, border: '1px solid var(--line)', fontSize: 12, color: 'var(--muted)' }}>{p}</span>
              ))}
            </div>
          </div>
        </div>
      </div>
      <Marquee items={PARTNERS} speed={60} />
      <Marquee items={[...PARTNERS].reverse()} speed={75} reverse />
      <style>{`@media (max-width: 880px) { .part-head, .ubnt-card { grid-template-columns: 1fr !important; gap: 24px !important; } }`}</style>
    </section>
  );
}

function CTA({ t }) {
  return (
    <section id="contact" style={{ padding: '120px 0', borderTop: '1px solid var(--line)', position: 'relative', overflow: 'hidden', background: 'color-mix(in oklch, var(--accent) 12%, var(--bg))' }}>
      <div className="wrap">
        <div className="cta-grid" style={{ display: 'grid', gridTemplateColumns: '1.3fr 1fr', gap: 64, alignItems: 'start' }}>
          <div>
            <div className="mono" style={{ fontSize: 12, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: '0.08em', marginBottom: 24 }}>{t.cta.kicker}</div>
            <h2 style={{ fontSize: 'clamp(48px, 6vw, 96px)', lineHeight: 0.95, fontWeight: 700, letterSpacing: '-0.03em', whiteSpace: 'pre-line', marginBottom: 32 }}>{t.cta.title}</h2>
            <p style={{ fontSize: 18, color: 'var(--muted)', lineHeight: 1.55, maxWidth: 560 }}>{t.cta.sub}</p>
          </div>
          <div style={{ display: 'grid', gap: 0, paddingTop: 24 }}>
            <a href={`mailto:${t.cta.mail}`} style={{ padding: '24px 0', borderTop: '1px solid var(--line)', display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: 'clamp(18px, 2vw, 24px)', fontWeight: 500, transition: 'padding 200ms' }}
              onMouseEnter={(e) => { e.currentTarget.style.paddingLeft = '12px'; e.currentTarget.style.color = 'var(--accent)'; }}
              onMouseLeave={(e) => { e.currentTarget.style.paddingLeft = '0'; e.currentTarget.style.color = 'var(--fg)'; }}>
              <span>{t.cta.mail}</span><span>→</span>
            </a>
            <a href={`tel:${t.cta.phone.replace(/\s/g,'')}`} style={{ padding: '24px 0', borderTop: '1px solid var(--line)', display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: 'clamp(18px, 2vw, 24px)', fontWeight: 500, transition: 'padding 200ms' }}
              onMouseEnter={(e) => { e.currentTarget.style.paddingLeft = '12px'; e.currentTarget.style.color = 'var(--accent)'; }}
              onMouseLeave={(e) => { e.currentTarget.style.paddingLeft = '0'; e.currentTarget.style.color = 'var(--fg)'; }}>
              <span>{t.cta.phone}</span><span>→</span>
            </a>
            <div style={{ padding: '24px 0', borderTop: '1px solid var(--line)', borderBottom: '1px solid var(--line)', fontSize: 16, color: 'var(--muted)' }}>{t.cta.addr}</div>
          </div>
        </div>
      </div>
      <style>{`@media (max-width: 880px) { .cta-grid { grid-template-columns: 1fr !important; gap: 40px !important; } }`}</style>
    </section>
  );
}

function Footer({ t, lang }) {
  const year = new Date().getFullYear();
  return (
    <footer style={{ padding: '40px 0', borderTop: '1px solid var(--line)' }}>
      <div className="wrap" style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap', gap: 16 }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 16, flexWrap: 'wrap' }}>
          <Logo size={28} />
          <span className="mono" style={{ fontSize: 12, color: 'var(--muted)' }}>© {year} init9 GmbH · {t.foot.tagline}</span>
        </div>
        <nav aria-label={lang === 'de' ? 'Rechtliche Hinweise' : 'Legal'} style={{ display: 'flex', gap: 24, fontSize: 13 }}>
          <a href="impressum.html" style={{ color: 'var(--muted)' }}>{t.foot.legal}</a>
          <a href="datenschutz.html" style={{ color: 'var(--muted)' }}>{t.foot.privacy}</a>
          <a href="agb.html" style={{ color: 'var(--muted)' }}>{lang === 'de' ? 'AGB' : 'Terms'}</a>
          <a href="barrierefreiheit.html" style={{ color: 'var(--muted)' }}>{lang === 'de' ? 'Barrierefreiheit' : 'Accessibility'}</a>
        </nav>
      </div>
    </footer>
  );
}

Object.assign(window, { Header, Hero, Why, Divisions, Partners, CTA, Footer, TickerLine, OSStrip });
