/* Page sections for OrthoVaultOS marketing site.
   Hero supports 3 layout variants: 'split', 'centered', 'editorial'.
   Colors come from CSS custom properties (--bg, --surface, --text, etc.)
   defined in index.html and flipped by [data-theme="dark"] on the root. */

function useIsMobile(breakpoint = 640) {
  const [mobile, setMobile] = React.useState(window.innerWidth < breakpoint);
  React.useEffect(() => {
    const fn = () => setMobile(window.innerWidth < breakpoint);
    window.addEventListener('resize', fn);
    return () => window.removeEventListener('resize', fn);
  }, [breakpoint]);
  return mobile;
}

function Logo({ size = 32, accent = '#b91c2c' }) {
  return (
    <a href="index.html" style={{
      display: 'flex', alignItems: 'center', gap: 11,
      textDecoration: 'none', color: 'inherit'
    }}>
      <img
        src="assets/logo.png"
        alt="OrthoVaultOS"
        style={{
          width: size + 8, height: size + 8, display: 'block',
          borderRadius: 8,
          boxShadow: 'var(--logo-shadow)'
        }} />
      
      <span style={{
        display: 'inline-flex', alignItems: 'center', gap: 4,
        fontSize: 22, fontWeight: 800, letterSpacing: 0.2,
        textTransform: 'uppercase', color: 'var(--text)',
        fontFamily: '"Geist", -apple-system, BlinkMacSystemFont, sans-serif'
      }}>
        <span>
          ORTHO<span style={{ color: accent }}>VAULT</span>
        </span>
        <span style={{
          display: 'inline-flex', alignItems: 'center',
          padding: '3px 8px 4px',
          fontSize: 20, fontWeight: 800, letterSpacing: 0.3,
          color: accent,
          background: 'transparent',
          border: `2px solid ${accent}`,
          borderRadius: 4,
          lineHeight: 1
        }}>
          OS
        </span>
      </span>
    </a>);

}

function Nav({ accent }) {
  const [session, setSession] = React.useState(null);
  const [tier, setTier]       = React.useState('free');
  const [menuOpen, setMenuOpen] = React.useState(false);
  const isMobile = useIsMobile(880);

  React.useEffect(() => {
    // supabaseClient is only available on pages that load supabase-client.js.
    // Marketing pages don't load it — gracefully fall back to signed-out state.
    if (typeof supabaseClient === 'undefined') return;
    supabaseClient.auth.getSession().then(({ data: { session: s } }) => {
      if (!s) return;
      setSession(s);
      supabaseClient.from('profiles').select('tier').eq('id', s.user.id).single()
        .then(({ data }) => { if (data) setTier(data.tier); });
    });
  }, []);

  React.useEffect(() => { if (!isMobile) setMenuOpen(false); }, [isMobile]);

  const isPro = tier === 'professional';

  const navLinks = (
    <React.Fragment>
      <a href="index.html#how" style={{ fontSize: 16, color: 'var(--text)', textDecoration: 'none', fontWeight: 700 }}>How it works</a>
      <a href="index.html#pricing" style={{ fontSize: 16, color: 'var(--text)', textDecoration: 'none', fontWeight: 700 }}>Pricing</a>
      <a href="procedure-library.html" style={{ fontSize: 16, color: 'var(--text)', textDecoration: 'none', fontWeight: 700 }}>Procedure Library</a>
      <a href="resident-guide.html" style={{ fontSize: 16, color: 'var(--text)', textDecoration: 'none', fontWeight: 700 }}>Resident Guide</a>
      <a href="faq.html" style={{ fontSize: 16, color: 'var(--text)', textDecoration: 'none', fontWeight: 700 }}>FAQ</a>
    </React.Fragment>
  );

  const authControls = session ? (
    /* ── Logged-in state ── */
    <div style={{ display: 'flex', gap: 8, alignItems: 'center', flexWrap: isMobile ? 'wrap' : 'nowrap' }}>
      {isPro && (
        <a href="photos.html" style={{
          border: `1px solid ${accent}44`, background: `${accent}0f`, color: accent,
          fontSize: 14, padding: '9px 14px', borderRadius: 9,
          fontFamily: 'inherit', fontWeight: 600, letterSpacing: -0.1,
          textDecoration: 'none', display: 'inline-flex', alignItems: 'center', gap: 6,
          whiteSpace: 'nowrap'
        }}>
          📷 Photo Sync
        </a>
      )}
      <a href="account.html" style={{
        border: '1px solid var(--btn-ghost-border)', background: 'var(--btn-ghost-bg)',
        color: 'var(--btn-ghost-fg)',
        fontSize: 14, padding: '9px 14px', borderRadius: 9,
        fontFamily: 'inherit', fontWeight: 600, letterSpacing: -0.1,
        textDecoration: 'none', display: 'inline-flex', alignItems: 'center', gap: 7,
        whiteSpace: 'nowrap'
      }}>
        <span style={{
          width: 22, height: 22, borderRadius: 11,
          background: `linear-gradient(135deg, ${accent}, #7a1421)`,
          color: '#fff', fontSize: 10, fontWeight: 700,
          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
          fontFamily: '"Geist Mono", monospace', flexShrink: 0,
        }}>
          {(session.user.email || '?')[0].toUpperCase()}
        </span>
        My account
      </a>
    </div>
  ) : (
    /* ── Logged-out state ── */
    <div style={{ display: 'flex', gap: 8, alignItems: 'center', flexWrap: isMobile ? 'wrap' : 'nowrap' }}>
      <a href="signin.html" style={{
        border: 'none', background: 'transparent', fontSize: 16, color: 'var(--text)',
        cursor: 'pointer', padding: '9px 12px', fontFamily: 'inherit', fontWeight: 700,
        textDecoration: 'none'
      }}>Sign in</a>
      <a href="signup.html" style={{
        border: '1px solid var(--btn-ghost-border)', background: 'var(--btn-ghost-bg)', color: accent,
        fontSize: 15, padding: '10px 16px', borderRadius: 9, cursor: 'pointer',
        fontFamily: 'inherit', fontWeight: 700, letterSpacing: -0.1,
        textDecoration: 'none', display: 'inline-block', whiteSpace: 'nowrap'
      }}>Sign up</a>
      <a href="download.html" style={{
        border: '1px solid var(--btn-solid-bg)', background: 'var(--btn-solid-bg)', color: 'var(--btn-solid-fg)',
        fontSize: 15, padding: '10px 16px', borderRadius: 9, cursor: 'pointer',
        fontFamily: 'inherit', fontWeight: 700, letterSpacing: -0.1,
        textDecoration: 'none', display: 'inline-block', whiteSpace: 'nowrap'
      }}>Download now</a>
    </div>
  );

  return (
    <nav style={{
      position: 'sticky', top: 0, zIndex: 50,
      background: 'var(--nav-bg)',
      backdropFilter: 'saturate(180%) blur(14px)',
      WebkitBackdropFilter: 'saturate(180%) blur(14px)',
      borderBottom: '1px solid var(--border-soft)'
    }}>
      <div style={{
        maxWidth: 1320, margin: '0 auto', padding: isMobile ? '14px 16px' : '16px 28px',
        display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 28
      }}>
        <Logo accent={accent} size={isMobile ? 26 : 32} />

        {isMobile ? (
          <button
            onClick={() => setMenuOpen((v) => !v)}
            aria-label="Toggle menu"
            aria-expanded={menuOpen}
            style={{
              border: '1px solid var(--btn-ghost-border)', background: 'var(--btn-ghost-bg)',
              color: 'var(--text)', width: 40, height: 40, borderRadius: 9,
              display: 'flex', alignItems: 'center', justifyContent: 'center',
              cursor: 'pointer', flexShrink: 0
            }}>
            <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round">
              {menuOpen ? (
                <React.Fragment>
                  <line x1="5" y1="5" x2="19" y2="19" />
                  <line x1="19" y1="5" x2="5" y2="19" />
                </React.Fragment>
              ) : (
                <React.Fragment>
                  <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" />
                </React.Fragment>
              )}
            </svg>
          </button>
        ) : (
          <React.Fragment>
            <div style={{ display: 'flex', gap: 24, alignItems: 'center' }}>
              {navLinks}
            </div>
            {authControls}
          </React.Fragment>
        )}
      </div>

      {isMobile && menuOpen && (
        <div style={{
          padding: '4px 16px 20px',
          display: 'flex', flexDirection: 'column', gap: 16,
          borderTop: '1px solid var(--border-soft)'
        }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 14, paddingTop: 14 }}>
            {navLinks}
          </div>
          {authControls}
        </div>
      )}
    </nav>);
}

/* Hero brand mark — the logo with a breathing crimson halo behind it.
   Halo scale controlled via --halo-size CSS custom property. */
function HeroBrandMark({ size = 72, haloScale = '210%' }) {
  return (
    <div className="logo-stage" style={{ width: size, height: size, '--halo-size': haloScale }}>
      <div className="logo-halo" aria-hidden="true"></div>
      <img
        src="assets/logo.png"
        alt="OrthoVaultOS"
        style={{
          width: size, height: size, display: 'block',
          borderRadius: Math.round(size * 0.22),
          boxShadow: 'var(--shadow-lg)'
        }} />
      
    </div>);

}

function HeroEyebrow({ accent }) {
  return (
    <div style={{
      display: 'inline-flex', alignItems: 'center', gap: 8,
      padding: '5px 11px 5px 8px', borderRadius: 100,
      background: 'rgba(185, 28, 44, 0.06)',
      border: '1px solid rgba(185, 28, 44, 0.18)',
      fontSize: 12, color: accent, fontWeight: 500, letterSpacing: 0.1
    }}>
      <span style={{ width: 6, height: 6, borderRadius: 3, background: accent, display: 'inline-block' }}></span>
      Now in early access
    </div>);

}

function HeroCtas({ accent, size = 'md' }) {
  const padY = size === 'lg' ? '13px' : '11px';
  const padX = size === 'lg' ? '22px' : '18px';
  const fs = size === 'lg' ? 14 : 13.5;
  return (
    <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
      <a href="download.html" style={{
        background: 'var(--btn-solid-bg)', color: 'var(--btn-solid-fg)', border: 'none', padding: `${padY} ${padX}`,
        borderRadius: 10, fontSize: fs, fontWeight: 500, cursor: 'pointer', fontFamily: 'inherit',
        letterSpacing: -0.1, display: 'inline-flex', alignItems: 'center', gap: 8,
        textDecoration: 'none'
      }}>
        Download now
        <span style={{ fontSize: 10.5, opacity: 0.55, fontFamily: '"Geist Mono", ui-monospace, monospace' }}>↗</span>
      </a>
      <button
        onClick={() => window.openDemoModal && window.openDemoModal()}
        style={{
          background: 'transparent', color: accent, border: `1px solid ${accent}44`,
          padding: `${padY} ${padX}`, borderRadius: 10, fontSize: fs, fontWeight: 500,
          cursor: 'pointer', fontFamily: 'inherit', letterSpacing: -0.1,
          display: 'inline-flex', alignItems: 'center', gap: 8,
        }}>
        <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" style={{ display: 'block' }}>
          <polygon points="6 4 20 12 6 20" />
        </svg>
        Watch demo
      </button>
    </div>);

}

/* Full-screen lightbox for the 30-second product demo. Opened globally via
   window.openDemoModal() so any CTA (across hero variants) can trigger it
   without prop-drilling through three different hero layouts. */
function DemoModal() {
  const [open, setOpen] = React.useState(false);
  const videoRef = React.useRef(null);

  React.useEffect(() => {
    window.openDemoModal = () => setOpen(true);
    return () => { delete window.openDemoModal; };
  }, []);

  React.useEffect(() => {
    if (open && videoRef.current) {
      videoRef.current.currentTime = 0;
      videoRef.current.play().catch(() => {});
    }
  }, [open]);

  React.useEffect(() => {
    if (!open) return;
    const onKey = (e) => { if (e.key === 'Escape') setOpen(false); };
    window.addEventListener('keydown', onKey);
    return () => window.removeEventListener('keydown', onKey);
  }, [open]);

  if (!open) return null;

  return (
    <div
      onClick={() => setOpen(false)}
      style={{
        position: 'fixed', inset: 0, zIndex: 1000,
        background: 'rgba(8, 10, 14, 0.85)',
        display: 'flex', alignItems: 'center', justifyContent: 'center',
        padding: 24,
      }}>
      <div
        onClick={(e) => e.stopPropagation()}
        style={{
          width: '100%', maxWidth: 960, borderRadius: 14, overflow: 'hidden',
          background: '#000', boxShadow: '0 40px 100px -20px rgba(0,0,0,0.7)',
          position: 'relative',
        }}>
        <button
          onClick={() => setOpen(false)}
          aria-label="Close demo"
          style={{
            position: 'absolute', top: 12, right: 12, zIndex: 1,
            width: 32, height: 32, borderRadius: 16, border: 'none',
            background: 'rgba(0,0,0,0.55)', color: '#fff', fontSize: 16,
            cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center',
          }}>
          ✕
        </button>
        <video
          ref={videoRef}
          src="assets/demo.mp4?v=5"
          controls
          loop
          playsInline
          style={{ width: '100%', height: 'auto', display: 'block' }} />
      </div>
    </div>);

}

function AppShot({ maxWidth = 980, videoSrc }) {
  return (
    <div style={{
      maxWidth,
      width: '100%',
      borderRadius: 14,
      overflow: 'hidden',
      background: 'var(--surface)',
      border: '1px solid var(--border)',
      boxShadow: 'var(--shadow-lg)'
    }}>
      {videoSrc ? (
        <video
          src={videoSrc}
          poster="assets/app-screenshot.png"
          autoPlay
          muted
          loop
          playsInline
          style={{ width: '100%', height: 'auto', display: 'block' }} />
      ) : (
        <img
          src="assets/app-screenshot.png"
          alt="OrthoVaultOS — Total Knee Arthroplasty view"
          style={{ width: '100%', height: 'auto', display: 'block' }} />
      )}
    </div>);

}

/* Macbook-style frame around the app screenshot — thin dark bezel,
   small camera dot up top, and a tapered hinge/base strip wider than
   the screen so it reads as a 3D-ish device, not just a black card.
   Used in the split hero. */
function LaptopFrame({ src, alt, videoSrc, maxWidth = 820 }) {
  return (
    <div style={{ width: '100%', maxWidth, margin: '0 auto' }}>
      {/* Lid — silver/aluminum chassis */}
      <div style={{
        background: 'linear-gradient(180deg, #dcdce0 0%, #c4c4c8 55%, #b0b0b4 100%)',
        borderRadius: '14px 14px 5px 5px',
        padding: '10px 10px 12px',
        border: '1px solid rgba(0,0,0,0.18)',
        boxShadow:
        'inset 0 1px 0 rgba(255,255,255,0.75),' +
        'inset 0 -1px 0 rgba(0,0,0,0.08),' +
        '0 30px 60px -30px rgba(0,0,0,0.55),' +
        '0 12px 24px -16px rgba(14,21,37,0.45)',
        position: 'relative'
      }}>
        {/* Black bezel surrounding the display (macOS-style) */}
        <div style={{
          background: '#0a0a0c',
          borderRadius: '7px 7px 3px 3px',
          padding: '22px 14px 14px',
          position: 'relative',
          boxShadow: 'inset 0 0 0 1px rgba(255,255,255,0.04)'
        }}>
          {/* Camera dot in the top bezel */}
          <div style={{
            position: 'absolute', top: 9, left: '50%', transform: 'translateX(-50%)',
            width: 5, height: 5, borderRadius: 3,
            background: 'radial-gradient(circle at 35% 35%, #3a3a3d 0%, #0a0a0c 80%)',
            boxShadow: 'inset 0 0 0 0.5px rgba(255,255,255,0.05)'
          }}></div>
          {/* Screen content */}
          <div style={{
            borderRadius: 2, overflow: 'hidden', background: '#000',
            aspectRatio: '16 / 10',
            position: 'relative'
          }}>
            {videoSrc ? (
              <video
                src={videoSrc}
                poster={src}
                autoPlay
                muted
                loop
                playsInline
                style={{ width: '100%', height: '100%', display: 'block', objectFit: 'cover', objectPosition: 'top center' }} />
            ) : (
              <img src={src} alt={alt} className="laptop-screenshot" />
            )}
            {/* Animated glare sweep across the glass */}
            <div aria-hidden="true" className="laptop-glare"></div>
            {/* Subtle static glare layer */}
            <div aria-hidden="true" style={{
              position: 'absolute', inset: 0, pointerEvents: 'none',
              background: 'linear-gradient(125deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,0) 65%, rgba(255,255,255,0.04) 100%)'
            }}></div>
            {/* Blinking "live" indicator dot */}
            <div aria-hidden="true" className="laptop-live"></div>
          </div>
        </div>
      </div>

      {/* Hinge / base — slightly wider than the lid, deep underside shadow */}
      <div style={{ position: 'relative' }}>
        <div style={{
          position: 'relative',
          height: 14,
          marginLeft: '-4%', marginRight: '-4%',
          background: 'linear-gradient(180deg, #b8b8bc 0%, #9a9a9e 45%, #6e6e72 100%)',
          borderRadius: '0 0 14px 14px',
          boxShadow:
          'inset 0 1px 0 rgba(255,255,255,0.45),' +
          'inset 0 -1px 0 rgba(0,0,0,0.25),' +
          '0 24px 36px -16px rgba(0,0,0,0.5)'
        }}>
          {/* Hinge notch */}
          <div style={{
            position: 'absolute', top: 0, left: '50%', transform: 'translateX(-50%)',
            width: '16%', maxWidth: 130, height: 6,
            background: 'linear-gradient(180deg, #4a4a4d 0%, #1a1a1c 100%)',
            borderRadius: '0 0 10px 10px',
            boxShadow: 'inset 0 1px 1px rgba(0,0,0,0.55)'
          }}></div>
        </div>
        {/* Soft cast shadow on the surface below */}
        <div aria-hidden="true" style={{
          position: 'absolute', left: '6%', right: '6%', top: '100%',
          height: 26,
          background: 'radial-gradient(50% 100% at 50% 0%, rgba(0,0,0,0.30), transparent 70%)',
          filter: 'blur(2px)',
          pointerEvents: 'none'
        }}></div>
      </div>
    </div>);

}

/* Three-up feature strip under the laptop — icon + title + one-line subtitle,
   full-width, evenly spaced. Small crimson icons against the page bg. */
function HeroFeatureStrip({ accent }) {
  const isMobile = useIsMobile();
  const items = [
  {
    title: 'Access anywhere',
    subtitle: 'Web-based. Always with you.',
    icon:
    <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke={accent} strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
          <path d="M17.5 19a4.5 4.5 0 0 0 .5-8.97A6.5 6.5 0 0 0 5.5 12.5 4.5 4.5 0 0 0 6.5 19h11z" />
        </svg>

  },
  {
    title: 'Save hours every week',
    subtitle: 'Streamline documentation.',
    icon:
    <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke={accent} strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
          <circle cx="12" cy="12" r="9" />
          <polyline points="12 7 12 12 15.5 14" />
        </svg>

  },
  {
    title: 'Built for every surgeon',
    subtitle: 'Orthopedic today, everything tomorrow.',
    icon:
    <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke={accent} strokeWidth="1.7" strokeLinejoin="round" strokeLinecap="round">
          <polygon points="12 3 21 8 12 13 3 8 12 3" />
          <polyline points="3 12 12 17 21 12" />
          <polyline points="3 16 12 21 21 16" />
        </svg>

  }];


  return (
    <div style={{
      display: 'grid', gridTemplateColumns: isMobile ? '1fr' : 'repeat(3, 1fr)', gap: isMobile ? 24 : 40,
      maxWidth: 1100, margin: isMobile ? '40px auto 0' : '64px auto 0', padding: '0 8px'
    }}>
      {items.map((f) =>
      <div key={f.title} style={{ display: 'flex', alignItems: 'flex-start', gap: 16 }}>
          <div style={{ flexShrink: 0, paddingTop: 2 }}>{f.icon}</div>
          <div>
            <div style={{
            fontSize: 16, fontWeight: 600, color: 'var(--text)',
            letterSpacing: -0.2, lineHeight: 1.3, marginBottom: 4
          }}>{f.title}</div>
            <div style={{
            fontSize: 13.5, color: 'var(--muted)',
            lineHeight: 1.5, textWrap: 'pretty'
          }}>{f.subtitle}</div>
          </div>
        </div>
      )}
    </div>);

}

/* Social-proof row under the hero CTAs: overlapping head avatars,
   five filled stars in the accent color, and a short tagline.
   Avatars are color-blocked initials (placeholder pending real
   testimonial photos — honest about the placeholder state). */
function TrustRow({ accent }) {
  const reviewers = [
  { initials: 'JM', alt: 'Reviewer 1' },
  { initials: 'AK', alt: 'Reviewer 2' },
  { initials: 'RS', alt: 'Reviewer 3' },
  { initials: 'TL', alt: 'Reviewer 4' }];

  return (
    <div style={{
      marginTop: 28, display: 'flex', alignItems: 'center', gap: 14, flexWrap: 'wrap'
    }}>
      {/* Avatar stack */}
      <div style={{ display: 'flex', alignItems: 'center' }}>
        {reviewers.map((r, i) =>
        <div key={r.initials} aria-label={r.alt} style={{
          width: 38, height: 38, borderRadius: 19,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          background: `linear-gradient(135deg, ${accent}, #7a1421)`,
          color: '#fff', fontSize: 12.5, fontWeight: 700,
          fontFamily: '"Geist Mono", ui-monospace, monospace',
          border: '2px solid var(--bg)',
          marginLeft: i === 0 ? 0 : -10,
          position: 'relative', zIndex: reviewers.length - i,
          boxShadow: '0 1px 0 rgba(14,21,37,0.10), 0 4px 10px -4px rgba(14,21,37,0.25)'
        }}>{r.initials}</div>
        )}
      </div>
      {/* Stars + tagline */}
      <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
        <div style={{ display: 'flex', gap: 2, alignItems: 'center' }}>
          {[0, 1, 2, 3, 4].map((i) =>
          <svg key={i} width="15" height="15" viewBox="0 0 24 24" fill={accent}
          style={{ filter: `drop-shadow(0 1px 0 ${accent}33)` }}>
              <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" />
            </svg>
          )}
        </div>
        <div style={{ fontSize: 12.5, color: 'var(--muted)', letterSpacing: -0.1 }}>
          Trusted by orthopedic surgeons and residents
        </div>
      </div>
    </div>);

}

function HeroSplit({ accent }) {
  const isMobile = useIsMobile();
  return (
    <div style={{ maxWidth: 1280, margin: '0 auto', padding: isMobile ? '40px 20px 40px' : '72px 28px 64px' }}>
      <div style={{
        display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1.25fr', gap: isMobile ? 40 : 56, alignItems: 'center'
      }}>
      <div>
        <h1 style={{
            fontSize: isMobile ? 34 : 60, lineHeight: 1.05, letterSpacing: isMobile ? -1 : -1.6, fontWeight: 600,
            margin: '0 0 18px', color: 'var(--text)', textWrap: 'balance'
          }}>
          Surgical mastery,{' '}
          <span style={{
              color: accent, fontWeight: 600,
              textTransform: 'uppercase', letterSpacing: -0.5
            }}>AMPLIFIED.</span>
        </h1>
        <p style={{ fontSize: isMobile ? 15.5 : 17, lineHeight: 1.6, color: 'var(--muted)', maxWidth: 520, margin: '0 0 28px', textWrap: 'pretty' }}>
          OrthoVaultOS brings precision to every decision. Customize procedures to your technique, reference in real-time during surgery, and build your personal surgical knowledge base.
        </p>
        <HeroCtas accent={accent} />
        <TrustRow accent={accent} />
        <div style={{
            marginTop: 36, paddingTop: 24, borderTop: '1px solid var(--border)',
            display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: isMobile ? 12 : 24
          }}>
          <Stat n="237" label="Procedures" />
          <Stat n="9" label="Specialties" />
          <Stat n="Free" label="to start" />
        </div>
      </div>
      <div style={{ position: 'relative' }}>
        {/* Strong crimson glow under the screenshot — echoes the logo's vault glow */}
        <div style={{
            position: 'absolute', inset: isMobile ? -20 : -80, background:
            `radial-gradient(60% 55% at 70% 40%, ${accent}55, ${accent}1f 38%, transparent 65%), radial-gradient(45% 45% at 30% 75%, ${accent}26, transparent 65%)`,
            filter: 'blur(8px)',
            pointerEvents: 'none'
          }}></div>
        <div style={{ position: 'relative' }}>
          <LaptopFrame
              src="assets/app-screenshot.png"
              videoSrc="assets/demo.mp4?v=5"
              alt="OrthoVaultOS — Total Knee Arthroplasty view"
              maxWidth={760} />

        </div>
      </div>
      </div>
      <HeroFeatureStrip accent={accent} />
    </div>);

}

function HeroCentered({ accent }) {
  const isMobile = useIsMobile();
  return (
    <div style={{ maxWidth: 1280, margin: '0 auto', padding: isMobile ? '48px 20px 40px' : '80px 28px 48px', textAlign: 'center' }}>
      <div style={{ display: 'flex', justifyContent: 'center' }}>
        <HeroEyebrow accent={accent} />
      </div>
      <h1 style={{
        fontSize: isMobile ? 36 : 76, lineHeight: isMobile ? 1.05 : 1.0, letterSpacing: isMobile ? -1 : -2.2, fontWeight: 600,
        margin: '22px auto 18px', color: 'var(--text)', maxWidth: 980,
        textWrap: 'balance'
      }}>
        Surgical mastery,{' '}
        <span style={{
          color: accent, fontWeight: 600,
          textTransform: 'uppercase', letterSpacing: -0.5
        }}>AMPLIFIED.</span>
      </h1>
      <p style={{
        fontSize: isMobile ? 15.5 : 18, lineHeight: 1.6, color: 'var(--muted)', maxWidth: 680,
        margin: '0 auto 32px', textWrap: 'pretty'
      }}>
        OrthoVaultOS brings precision to every decision. Customize procedures to your technique, reference in real-time during surgery, and build your personal surgical knowledge base.
      </p>
      <div style={{ display: 'flex', justifyContent: 'center' }}>
        <HeroCtas accent={accent} size="lg" />
      </div>
      <div style={{ marginTop: 64, display: 'flex', justifyContent: 'center', position: 'relative' }}>
        <div style={{
          position: 'absolute', inset: isMobile ? -20 : -80, background:
          `radial-gradient(50% 55% at 50% 45%, ${accent}55, ${accent}1f 40%, transparent 65%)`,
          filter: 'blur(8px)',
          pointerEvents: 'none'
        }}></div>
        <div style={{ position: 'relative', width: '100%' }}>
          <div style={{ display: 'flex', justifyContent: 'center' }}>
            <AppShot maxWidth={1100} videoSrc="assets/demo.mp4?v=5" />
          </div>
        </div>
      </div>
    </div>);

}

function HeroEditorial({ accent }) {
  const isMobile = useIsMobile();
  return (
    <div style={{ maxWidth: 1320, margin: '0 auto', padding: isMobile ? '44px 20px 40px' : '64px 28px 56px' }}>
      <div style={{
        display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1.15fr 1fr', gap: isMobile ? 28 : 40, alignItems: 'end'
      }}>
        <div>
          <div style={{ marginBottom: 18 }}>
            <HeroEyebrow accent={accent} />
          </div>
          <h1 style={{
            fontSize: isMobile ? 42 : 100, lineHeight: isMobile ? 0.98 : 0.93, letterSpacing: isMobile ? -1.4 : -3.4, fontWeight: 600,
            margin: '8px 0 0', color: 'var(--text)', textWrap: 'balance'
          }}>
            Surgical<br />mastery,<br />
            <span style={{
              color: accent, fontWeight: 600,
              textTransform: 'uppercase', letterSpacing: -1.5
            }}>AMPLIFIED.</span>
          </h1>
        </div>
        <div style={{ paddingBottom: 18 }}>
          <p style={{ fontSize: isMobile ? 15 : 16, lineHeight: 1.6, color: 'var(--muted)', margin: '0 0 22px', textWrap: 'pretty' }}>
            OrthoVaultOS brings precision to every decision. Customize procedures to your technique, reference in real-time during surgery, and build your personal surgical knowledge base.
          </p>
          <HeroCtas accent={accent} />
          <div style={{
            marginTop: 28, paddingTop: 20, borderTop: '1px solid var(--border)',
            display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: isMobile ? 10 : 16
          }}>
            <Stat n="9" label="Specialties" small />
            <Stat n="237" label="Procedures" small />
            <Stat n="Free" label="to start" small />
          </div>
        </div>
      </div>
      <div style={{ position: 'relative', marginTop: 56 }}>
        <div style={{
          position: 'absolute', inset: isMobile ? -20 : -60, background:
          `radial-gradient(45% 60% at 50% 50%, ${accent}55, ${accent}1f 40%, transparent 65%)`,
          filter: 'blur(8px)',
          pointerEvents: 'none'
        }}></div>
        <div style={{ position: 'relative', display: 'flex', justifyContent: 'center' }}>
          <AppShot maxWidth={1200} videoSrc="assets/demo.mp4?v=5" />
        </div>
      </div>
    </div>);

}

function Stat({ n, label, small }) {
  return (
    <div>
      <div style={{
        fontSize: small ? 18 : 22, fontWeight: 600, letterSpacing: -0.6, color: 'var(--text)',
        fontFamily: '"Geist Mono", ui-monospace, monospace'
      }}>{n}</div>
      <div style={{ fontSize: 12, color: 'var(--subtle)', marginTop: 4 }}>{label}</div>
    </div>);

}

/* "The Old Way" — a dark, full-bleed contrast section that establishes
   the problem (fragmented surgical workflows) before How It Works shows
   the solution. Six-column composition:
     1   — left text panel with eyebrow + headline + paragraph + CTA
     2-5 — four atmospheric image slots with X-mark labels
     6   — solid crimson panel with the brand mark + tagline + arrow CTA
   Image slots use <image-slot> so the user can drop their own grainy
   photos later; until then they read as moody dark placeholders. */
/* "The Old Way" — a dark, full-bleed contrast section that establishes
   the problem (fragmented surgical workflows) before How It Works shows
   the solution. Six-column composition:
     1   — left text panel with eyebrow + headline + paragraph + CTA
     2-5 — four anatomy-themed line-art illustrations + X-mark labels
     6   — solid crimson panel with the brand mark + tagline */

/* Stylized line-art illustrations for each "old way" failure mode.
   Stroke-only, low opacity so they read as atmospheric backgrounds rather
   than literal photos. Anatomy motifs throughout (knee, hand, vertebra,
   hip ball) tie them to the orthopedic subject matter. */
function OldWayIllustration({ kind, accent }) {
  const ink = 'rgba(176, 184, 196, 0.55)';
  const dim = 'rgba(176, 184, 196, 0.28)';
  const paper = '#15181f';

  const Knee = ({ s = 1 }) =>
  <g strokeLinecap="round" strokeLinejoin="round">
      {/* femur shaft */}
      <path d={`M${20 * s} ${4 * s} L${22 * s} ${22 * s} Q${20 * s} ${28 * s} ${24 * s} ${32 * s}`} stroke={ink} strokeWidth={1.1} fill="none" />
      <path d={`M${36 * s} ${4 * s} L${34 * s} ${22 * s} Q${36 * s} ${28 * s} ${32 * s} ${32 * s}`} stroke={ink} strokeWidth={1.1} fill="none" />
      {/* condyles */}
      <ellipse cx={28 * s} cy={32 * s} rx={10 * s} ry={4 * s} stroke={ink} strokeWidth={1.1} fill="none" />
      {/* patella */}
      <ellipse cx={28 * s} cy={30 * s} rx={4 * s} ry={5 * s} stroke={ink} strokeWidth={1} fill="none" />
      {/* tibia + fibula */}
      <path d={`M${22 * s} ${38 * s} L${24 * s} ${60 * s}`} stroke={ink} strokeWidth={1.1} fill="none" />
      <path d={`M${34 * s} ${38 * s} L${32 * s} ${60 * s}`} stroke={ink} strokeWidth={1.1} fill="none" />
    </g>;


  const Vertebra = ({ s = 1 }) =>
  <g strokeLinecap="round" strokeLinejoin="round" fill="none">
      {/* body */}
      <ellipse cx={28 * s} cy={28 * s} rx={14 * s} ry={8 * s} stroke={ink} strokeWidth={1.1} />
      {/* spinous process */}
      <path d={`M${28 * s} ${36 * s} L${28 * s} ${48 * s} L${24 * s} ${52 * s}`} stroke={ink} strokeWidth={1.1} />
      {/* transverse processes */}
      <path d={`M${12 * s} ${30 * s} L${4 * s} ${36 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${44 * s} ${30 * s} L${52 * s} ${36 * s}`} stroke={ink} strokeWidth={1.1} />
      {/* canal */}
      <circle cx={28 * s} cy={38 * s} r={4 * s} stroke={ink} strokeWidth={1} />
    </g>;


  const Hand = ({ s = 1 }) =>
  <g strokeLinecap="round" strokeLinejoin="round" fill="none">
      {/* metacarpals */}
      <path d={`M${10 * s} ${56 * s} L${14 * s} ${30 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${20 * s} ${56 * s} L${22 * s} ${26 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${30 * s} ${56 * s} L${30 * s} ${24 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${40 * s} ${56 * s} L${38 * s} ${28 * s}`} stroke={ink} strokeWidth={1.1} />
      {/* phalanges */}
      <path d={`M${14 * s} ${30 * s} L${15 * s} ${18 * s} L${16 * s} ${10 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${22 * s} ${26 * s} L${23 * s} ${14 * s} L${24 * s} ${4 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${30 * s} ${24 * s} L${31 * s} ${12 * s} L${32 * s} ${2 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${38 * s} ${28 * s} L${39 * s} ${16 * s} L${40 * s} ${8 * s}`} stroke={ink} strokeWidth={1.1} />
      {/* thumb */}
      <path d={`M${6 * s} ${52 * s} L${2 * s} ${42 * s} L${0 * s} ${36 * s}`} stroke={ink} strokeWidth={1.1} />
      {/* wrist */}
      <path d={`M${4 * s} ${58 * s} Q${24 * s} ${64 * s} ${44 * s} ${58 * s}`} stroke={ink} strokeWidth={1} />
    </g>;


  const Hip = ({ s = 1 }) =>
  <g strokeLinecap="round" strokeLinejoin="round" fill="none">
      {/* acetabulum */}
      <path d={`M${10 * s} ${20 * s} A${20 * s} ${20 * s} 0 0 1 ${50 * s} ${20 * s}`} stroke={ink} strokeWidth={1.2} />
      <path d={`M${14 * s} ${22 * s} A${16 * s} ${16 * s} 0 0 1 ${46 * s} ${22 * s}`} stroke={ink} strokeWidth={1} />
      {/* femoral head */}
      <circle cx={30 * s} cy={28 * s} r={10 * s} stroke={ink} strokeWidth={1.2} />
      {/* femoral neck + greater trochanter */}
      <path d={`M${38 * s} ${34 * s} L${48 * s} ${44 * s} L${48 * s} ${56 * s}`} stroke={ink} strokeWidth={1.2} />
      <path d={`M${48 * s} ${44 * s} L${56 * s} ${42 * s}`} stroke={ink} strokeWidth={1.2} />
      {/* shaft */}
      <path d={`M${44 * s} ${52 * s} L${42 * s} ${64 * s}`} stroke={ink} strokeWidth={1.1} />
    </g>;


  const Foot = ({ s = 1 }) =>
  <g strokeLinecap="round" strokeLinejoin="round" fill="none">
      {/* calcaneus (heel) */}
      <ellipse cx={28 * s} cy={56 * s} rx={9 * s} ry={6 * s} stroke={ink} strokeWidth={1.1} />
      {/* tarsals */}
      <path d={`M${24 * s} ${48 * s} Q${28 * s} ${42 * s} ${36 * s} ${42 * s}`} stroke={ink} strokeWidth={1} />
      {/* metatarsals fanning out */}
      <path d={`M${36 * s} ${42 * s} L${42 * s} ${24 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${36 * s} ${42 * s} L${38 * s} ${20 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${34 * s} ${42 * s} L${32 * s} ${18 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${32 * s} ${42 * s} L${26 * s} ${20 * s}`} stroke={ink} strokeWidth={1.1} />
      <path d={`M${30 * s} ${44 * s} L${20 * s} ${26 * s}`} stroke={ink} strokeWidth={1.1} />
      {/* phalanges — short toe bones */}
      <ellipse cx={42 * s} cy={20 * s} rx={3 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={42 * s} cy={14 * s} rx={2.5 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={38 * s} cy={16 * s} rx={3 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={38 * s} cy={10 * s} rx={2.5 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={32 * s} cy={14 * s} rx={3 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={32 * s} cy={8 * s} rx={2.5 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={26 * s} cy={16 * s} rx={3 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={26 * s} cy={10 * s} rx={2.5 * s} ry={3 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={20 * s} cy={22 * s} rx={3.5 * s} ry={3.5 * s} stroke={ink} strokeWidth={1} />
      <ellipse cx={18 * s} cy={16 * s} rx={3 * s} ry={3.5 * s} stroke={ink} strokeWidth={1} />
    </g>;


  const ChildHand = ({ s = 1 }) =>
  // Wobbly, slightly-off-center hand outline like a child traced their
  // own palm on paper. No bones — just a single squiggled silhouette
  // around 5 fingers + a thumb. Drawn with a softer, crayon-y stroke.
  <g strokeLinecap="round" strokeLinejoin="round" fill="none">
      <path
      d={`M ${10 * s} ${58 * s}
            Q ${6 * s} ${54 * s} ${5 * s} ${48 * s}
            Q ${4 * s} ${40 * s} ${10 * s} ${36 * s}
            Q ${12 * s} ${32 * s} ${9 * s} ${22 * s}
            Q ${8 * s} ${12 * s} ${14 * s} ${10 * s}
            Q ${18 * s} ${10 * s} ${17 * s} ${18 * s}
            Q ${16 * s} ${24 * s} ${18 * s} ${28 * s}
            Q ${19 * s} ${22 * s} ${20 * s} ${10 * s}
            Q ${21 * s} ${2 * s} ${25 * s} ${3 * s}
            Q ${28 * s} ${4 * s} ${27 * s} ${14 * s}
            Q ${26 * s} ${22 * s} ${28 * s} ${28 * s}
            Q ${29 * s} ${20 * s} ${30 * s} ${6 * s}
            Q ${31 * s} ${0 * s} ${35 * s} ${1 * s}
            Q ${38 * s} ${2 * s} ${37 * s} ${12 * s}
            Q ${36 * s} ${20 * s} ${38 * s} ${28 * s}
            Q ${39 * s} ${22 * s} ${41 * s} ${12 * s}
            Q ${43 * s} ${6 * s} ${46 * s} ${8 * s}
            Q ${48 * s} ${12 * s} ${46 * s} ${22 * s}
            Q ${45 * s} ${30 * s} ${48 * s} ${36 * s}
            Q ${52 * s} ${42 * s} ${50 * s} ${50 * s}
            Q ${48 * s} ${58 * s} ${42 * s} ${60 * s}
            Q ${30 * s} ${62 * s} ${20 * s} ${61 * s}
            Q ${14 * s} ${60 * s} ${10 * s} ${58 * s} Z`}
      stroke={ink} strokeWidth={1.3} />
      {/* a little smile face on the palm — unmistakably a kid's drawing */}
      <g transform={`translate(${20 * s}, ${44 * s})`} opacity="0.85">
        <circle cx={3 * s} cy="0" r={0.9 * s} fill={ink} stroke="none" />
        <circle cx={11 * s} cy="0" r={0.9 * s} fill={ink} stroke="none" />
        <path d={`M ${2 * s} ${4 * s} Q ${7 * s} ${8 * s} ${12 * s} ${4 * s}`} stroke={ink} strokeWidth={1} />
      </g>
    </g>;


  if (kind === 'scattered-notes') {
    // Blackboard with scattered post-it notes
    return (
      <svg viewBox="0 0 240 200" preserveAspectRatio="xMidYMid slice"
      style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', display: 'block' }}>
        <defs>
          {/* Subtle chalk-dust texture on the blackboard */}
          <radialGradient id="chalkDust" cx="50%" cy="40%" r="65%">
            <stop offset="0%" stopColor="rgba(255,255,255,0.06)" />
            <stop offset="100%" stopColor="rgba(255,255,255,0)" />
          </radialGradient>
        </defs>

        {/* Wood frame around the blackboard */}
        <rect x="6" y="8" width="228" height="184" fill="#3a2614" stroke="#241608" strokeWidth="1" rx="3" />
        <rect x="8" y="10" width="224" height="180" fill="none" stroke="#5a3a20" strokeWidth="0.6" rx="2" />

        {/* Blackboard surface */}
        <rect x="16" y="18" width="208" height="164" fill="#1c2622" stroke="#0e1410" strokeWidth="0.6" rx="1" />
        <rect x="16" y="18" width="208" height="164" fill="url(#chalkDust)" rx="1" />

        {/* Faint chalk smudges on the board */}
        <g opacity="0.18" stroke="#e8e6dc" strokeWidth="0.6" fill="none" strokeLinecap="round">
          <path d="M30 40 Q60 32 90 38" />
          <path d="M120 56 Q150 50 180 58" />
          <path d="M40 130 Q70 124 100 132" />
          <path d="M150 150 L200 144" />
        </g>

        {/* Post-it notes — many, heavily overlapping, varied colors and angles.
             A push-pin and squiggle "writing" on each. */}
        {(() => {
          const notes = [
          // Back layer
          { x: 18, y: 24, w: 50, h: 46, rot: -14, fill: '#c4b4dc', writing: 4 },
          { x: 52, y: 22, w: 50, h: 46, rot: 7, fill: '#a8d8b9', writing: 4 },
          { x: 96, y: 28, w: 48, h: 50, rot: -4, fill: '#e89db0', writing: 5 },
          { x: 138, y: 22, w: 52, h: 48, rot: 11, fill: '#e8d765', writing: 4 },
          { x: 178, y: 30, w: 48, h: 48, rot: -8, fill: '#a8d8b9', writing: 4 },
          // Middle layer
          { x: 36, y: 60, w: 50, h: 46, rot: 4, fill: '#e8d765', writing: 5 },
          { x: 78, y: 64, w: 52, h: 48, rot: -10, fill: '#e89db0', writing: 4 },
          { x: 122, y: 60, w: 48, h: 50, rot: 8, fill: '#c4b4dc', writing: 5 },
          { x: 162, y: 66, w: 50, h: 46, rot: -5, fill: '#e8d765', writing: 4 },
          // Front layer
          { x: 20, y: 100, w: 52, h: 48, rot: -11, fill: '#a8d8b9', writing: 5 },
          { x: 62, y: 106, w: 50, h: 46, rot: 6, fill: '#e8d765', writing: 4 },
          { x: 104, y: 102, w: 52, h: 50, rot: -3, fill: '#e89db0', writing: 5 },
          { x: 146, y: 108, w: 50, h: 46, rot: 9, fill: '#c4b4dc', writing: 4 },
          { x: 184, y: 102, w: 48, h: 48, rot: -7, fill: '#a8d8b9', writing: 4 },
          // Bottom row
          { x: 32, y: 140, w: 50, h: 42, rot: 13, fill: '#e89db0', writing: 3 },
          { x: 74, y: 146, w: 50, h: 40, rot: -5, fill: '#e8d765', writing: 3 },
          { x: 116, y: 142, w: 50, h: 42, rot: 7, fill: '#a8d8b9', writing: 3 },
          { x: 158, y: 148, w: 50, h: 40, rot: -10, fill: '#c4b4dc', writing: 3 },
          { x: 196, y: 144, w: 46, h: 42, rot: 5, fill: '#e8d765', writing: 3 }];

          return notes.map((n, i) =>
          <g key={i} transform={`translate(${n.x}, ${n.y}) rotate(${n.rot})`}>
              {/* drop shadow */}
              <rect x="1.5" y="2.5" width={n.w} height={n.h} fill="rgba(0,0,0,0.55)" rx="1" />
              {/* note body */}
              <rect width={n.w} height={n.h} fill={n.fill} rx="1" opacity="0.95" />
              {/* top corner curl */}
              <path d={`M${n.w - 8} 0 L${n.w} 0 L${n.w} 8 Z`} fill="rgba(0,0,0,0.10)" />
              {/* writing — squiggly horizontal lines */}
              {Array.from({ length: n.writing }).map((_, j) => {
              const y = 10 + j * 7;
              const w = n.w - 10 - (j % 2 ? 6 : 0);
              return (
                <path key={j}
                d={`M5 ${y} q${w / 4} -1.5 ${w / 2} 0 q${w / 4} 1.5 ${w / 2} 0`}
                stroke="rgba(0,0,0,0.45)" strokeWidth="0.7" fill="none" strokeLinecap="round" />);

            })}
              {/* push pin */}
              <circle cx={n.w / 2} cy="4" r="1.8" fill={accent} stroke="rgba(0,0,0,0.4)" strokeWidth="0.4" />
              <circle cx={n.w / 2 - 0.5} cy="3.5" r="0.5" fill="rgba(255,255,255,0.6)" />
            </g>
          );
        })()}

        {/* Chalk dust at the bottom edge */}
        <rect x="16" y="178" width="208" height="4" fill="rgba(255,255,255,0.05)" />
      </svg>);

  }

  if (kind === 'clunky-system') {
    // Mac with macOS-style error dialogs stacked on screen. Each dialog has
    // rounded corners, traffic-light controls, a warning icon, and right-
    // aligned Cancel + primary buttons.
    const dialog = (x, y, w, h, title, body, opts = {}) => {
      const { i = 0, rot = 0, urgent = false, working = false } = opts;
      const primary = urgent ? accent : '#0a6fef';
      return (
        <g key={i} transform={`translate(${x}, ${y}) rotate(${rot})`}>
          {/* drop shadow */}
          <rect x="1" y="3" width={w} height={h} fill="rgba(0,0,0,0.45)" rx="5" />
          {/* dialog body */}
          <rect width={w} height={h} fill="#f4f4f5" stroke="#9aa0a6" strokeWidth="0.35" rx="5" />
          {/* title bar with traffic lights */}
          <rect x="0" y="0" width={w} height="8" fill="#e6e7ea" rx="5" />
          <rect x="0" y="4" width={w} height="4" fill="#e6e7ea" />
          <circle cx="5" cy="4" r="1.6" fill="#ff5f57" />
          <circle cx="10" cy="4" r="1.6" fill="#febc2e" />
          <circle cx="15" cy="4" r="1.6" fill="#28c840" />
          <line x1="0" y1="8" x2={w} y2="8" stroke="#cfd1d6" strokeWidth="0.3" />
          {/* warning icon (or beach ball if 'working') */}
          {working ?
          <g transform="translate(11, 22)">
              <circle cx="0" cy="0" r="4.8" fill="#f4f4f5" stroke="#9aa0a6" strokeWidth="0.3" />
              <path d="M0 -4.8 A4.8 4.8 0 0 1 4.8 0 L0 0 Z" fill="#ff5f57" />
              <path d="M4.8 0 A4.8 4.8 0 0 1 0 4.8 L0 0 Z" fill="#febc2e" />
              <path d="M0 4.8 A4.8 4.8 0 0 1 -4.8 0 L0 0 Z" fill="#28c840" />
              <path d="M-4.8 0 A4.8 4.8 0 0 1 0 -4.8 L0 0 Z" fill="#0a6fef" />
            </g> :

          <g transform="translate(11, 22)">
              <path d="M0 -5 L5.5 4.5 L-5.5 4.5 Z" fill={accent} stroke="#7a0e18" strokeWidth="0.3" strokeLinejoin="round" />
              <rect x="-0.5" y="-2" width="1" height="3.6" fill="#ffffff" />
              <circle cx="0" cy="2.7" r="0.55" fill="#ffffff" />
            </g>
          }
          {/* title */}
          <text x="22" y="19" fontFamily="-apple-system, BlinkMacSystemFont, sans-serif" fontSize="5" fontWeight="700" fill="#1c1c1e">{title}</text>
          {/* body lines */}
          <text x="22" y="25" fontFamily="-apple-system, BlinkMacSystemFont, sans-serif" fontSize="3.8" fill="#48484b">{body[0]}</text>
          {body[1] && <text x="22" y="30" fontFamily="-apple-system, BlinkMacSystemFont, sans-serif" fontSize="3.8" fill="#48484b">{body[1]}</text>}
          {/* right-aligned buttons */}
          <rect x={w - 32} y={h - 9} width="14" height="6" rx="2.2" fill="#ffffff" stroke="#b6b9bf" strokeWidth="0.4" />
          <text x={w - 30} y={h - 4.7} fontFamily="-apple-system, BlinkMacSystemFont, sans-serif" fontSize="3.6" fill="#1c1c1e">Cancel</text>
          <rect x={w - 16} y={h - 9} width="14" height="6" rx="2.2" fill={primary} />
          <text x={w - 14} y={h - 4.7} fontFamily="-apple-system, BlinkMacSystemFont, sans-serif" fontSize="3.6" fontWeight="700" fill="#ffffff">{urgent ? 'Retry' : 'OK'}</text>
        </g>);

    };

    return (
      <svg viewBox="0 0 240 200" preserveAspectRatio="xMidYMid slice"
      style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', display: 'block' }}>
        <defs>
          <clipPath id="monitorClip">
            <rect x="38" y="28" width="164" height="108" rx="2" />
          </clipPath>
          <linearGradient id="macDesktop" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="#3a4a6b" />
            <stop offset="100%" stopColor="#1a2440" />
          </linearGradient>
          <linearGradient id="crtGlare" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="rgba(255,255,255,0.32)" />
            <stop offset="40%" stopColor="rgba(255,255,255,0)" />
          </linearGradient>
        </defs>

        {/* monitor bezel */}
        <rect x="32" y="22" width="176" height="128" rx="6" fill="#0e1117" stroke={ink} strokeWidth="1" />
        <rect x="38" y="28" width="164" height="108" rx="2" fill="url(#macDesktop)" stroke={dim} strokeWidth="0.6" />
        {/* stand */}
        <path d="M108 150 L108 160 L98 168 L142 168 L132 160 L132 150" stroke={ink} strokeWidth="1" fill="none" />

        {/* macOS menu bar */}
        <g clipPath="url(#monitorClip)">
          <rect x="38" y="28" width="164" height="6" fill="rgba(255,255,255,0.18)" />
          <circle cx="42" cy="31" r="1.2" fill="rgba(255,255,255,0.85)" />
          <rect x="46" y="30" width="8" height="2" fill="rgba(255,255,255,0.7)" />
          <rect x="56" y="30" width="6" height="2" fill="rgba(255,255,255,0.55)" />
          <rect x="64" y="30" width="6" height="2" fill="rgba(255,255,255,0.55)" />
          <rect x="180" y="30" width="18" height="2" fill="rgba(255,255,255,0.55)" />
        </g>

        {/* Stacked macOS error dialogs */}
        <g clipPath="url(#monitorClip)">
          {[
          dialog(42, 36, 86, 40, 'OperativeDB Not Responding', ['The app is unresponsive.', 'Force quit?'], { i: 0, rot: -2, urgent: true }),
          dialog(100, 50, 86, 40, 'Connection Lost', ['Could not reach orthovault.', 'Try again?'], { i: 1, rot: 3 }),
          dialog(54, 72, 82, 40, 'Template Corrupt', ['Unable to open template.', 'File is damaged.'], { i: 2, rot: -3, urgent: true }),
          dialog(118, 86, 82, 38, 'Sync Failed', ['Timed out after 30 seconds.', 'Working offline.'], { i: 3, rot: 4 }),
          dialog(46, 100, 78, 32, 'Saving…', ['Please wait while we save.'], { i: 4, rot: -2, working: true }),
          dialog(126, 28, 76, 30, 'Update Required', ['v2.1.4 → v2.2.0 available.'], { i: 5, rot: -5 })]
          }
        </g>

        {/* Scan-lines + screen glare */}
        <g opacity="0.4" clipPath="url(#monitorClip)">
          {Array.from({ length: 22 }).map((_, i) =>
          <line key={i} x1="38" y1={28 + i * 5} x2="202" y2={28 + i * 5} stroke="rgba(0,0,0,0.18)" strokeWidth="0.4" />
          )}
        </g>
        <rect x="38" y="28" width="164" height="108" fill="url(#crtGlare)" opacity="0.25" />
      </svg>);

  }

  if (kind === 'outdated-templates') {
    // Old-school radiograph light box with a knee x-ray clipped on,
    // overlaid with translucent implant template sheets
    return (
      <svg viewBox="0 0 240 200" preserveAspectRatio="xMidYMid slice"
      style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', display: 'block' }}>
        <defs>
          <radialGradient id="lightboxGlow" cx="50%" cy="50%" r="60%">
            <stop offset="0%" stopColor="#eaf3ff" />
            <stop offset="60%" stopColor="#cfdef0" />
            <stop offset="100%" stopColor="#8fa3bf" />
          </radialGradient>
          <linearGradient id="lightboxFrame" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="#3a3e48" />
            <stop offset="50%" stopColor="#2a2e38" />
            <stop offset="100%" stopColor="#1a1e26" />
          </linearGradient>
          {/* Subtle film vignette */}
          <radialGradient id="filmVignette" cx="50%" cy="50%" r="60%">
            <stop offset="60%" stopColor="rgba(0,0,0,0)" />
            <stop offset="100%" stopColor="rgba(0,0,0,0.45)" />
          </radialGradient>
        </defs>

        {/* Wall behind */}
        <rect x="0" y="0" width="240" height="200" fill="#0c0f15" />

        {/* Light box frame */}
        <rect x="14" y="14" width="212" height="172" fill="url(#lightboxFrame)" stroke="#0a0c11" strokeWidth="0.8" rx="4" />
        {/* Bezel inner */}
        <rect x="20" y="20" width="200" height="160" fill="#10141c" stroke="#0a0c11" strokeWidth="0.4" rx="2" />
        {/* Illuminated surface */}
        <rect x="24" y="24" width="192" height="152" fill="url(#lightboxGlow)" rx="1" />

        {/* Power LED + label strip on the frame */}
        <circle cx="218" cy="178" r="1.6" fill="#7ed957" />
        <rect x="20" y="178" width="20" height="3" fill="#1a1e26" />

        {/* X-ray clipped to the lightbox — knee AP view, slightly inset */}
        <g transform="translate(50, 30)">
          {/* Film border (slightly translucent so the lightbox glows through) */}
          <rect width="140" height="140" fill="rgba(18, 22, 30, 0.78)" stroke="rgba(40,46,58,0.6)" strokeWidth="0.6" />
          <rect width="140" height="140" fill="url(#filmVignette)" />
          {/* "L" marker */}
          <text x="6" y="14" fontFamily="monospace" fontSize="8" fill="#cfdef0" opacity="0.9">L</text>
          {/* date/ID stamp */}
          <text x="100" y="14" fontFamily="monospace" fontSize="5" fill="#cfdef0" opacity="0.55">04.12.83</text>

          {/* Knee — AP view, bones rendered as bright x-ray exposure */}
          <g stroke="#e6edf6" strokeWidth="1.4" fill="rgba(230,237,246,0.18)" strokeLinejoin="round" strokeLinecap="round">
            {/* Femur shaft */}
            <path d="M52 22 Q54 50 50 70 L46 80 Q44 84 50 86 L70 86 L90 86 Q96 84 94 80 L90 70 Q86 50 88 22 Z" />
            {/* Distal femur condyles */}
            <ellipse cx="58" cy="84" rx="14" ry="8" fill="rgba(230,237,246,0.32)" />
            <ellipse cx="82" cy="84" rx="14" ry="8" fill="rgba(230,237,246,0.32)" />
            {/* Patella (anterior overlay) */}
            <ellipse cx="70" cy="78" rx="9" ry="11" fill="rgba(230,237,246,0.18)" />
            {/* Tibial plateau */}
            <path d="M44 94 L96 94 L92 100 L48 100 Z" fill="rgba(230,237,246,0.28)" />
            {/* Tibial spines */}
            <path d="M66 94 L68 90 L70 94 M72 94 L74 90 L76 94" strokeWidth="0.9" fill="none" />
            {/* Tibia shaft */}
            <path d="M50 100 Q48 118 48 140 L52 140 Q52 130 56 110 L60 102 Z" />
            <path d="M90 100 Q92 118 92 140 L88 140 Q88 130 84 110 L80 102 Z" />
            {/* Fibula */}
            <path d="M96 102 L98 138 L100 138 L100 100 Z" fill="rgba(230,237,246,0.22)" />
            {/* Joint space line */}
            <line x1="46" y1="92" x2="96" y2="92" strokeWidth="0.5" opacity="0.4" />
          </g>
        </g>

        {/* Translucent implant template sheet #1 — tibial baseplate with sizing
             ladder. Slight blue tint, transparent like acetate. */}
        <g transform="translate(38, 100) rotate(-3)" opacity="0.78">
          <rect width="98" height="62" fill="rgba(178, 220, 255, 0.16)" stroke="rgba(178, 220, 255, 0.55)" strokeWidth="0.5" />
          {/* Header */}
          <text x="4" y="9" fontFamily="monospace" fontSize="4.5" fill="rgba(178, 220, 255, 0.85)">TIBIAL BASEPLATE · TEMPLATE</text>
          {/* Tibial component outline (D-shaped from above) */}
          <path d="M14 24 Q14 16 26 14 L70 14 Q86 16 86 26 L86 40 Q86 50 70 52 L26 52 Q14 50 14 42 Z"
          fill="none" stroke="rgba(178, 220, 255, 0.85)" strokeWidth="0.8" />
          {/* Keel slot */}
          <rect x="42" y="26" width="16" height="14" fill="none" stroke="rgba(178, 220, 255, 0.7)" strokeWidth="0.6" />
          {/* Sizing ladder */}
          {[0, 1, 2, 3, 4].map((i) =>
          <g key={i}>
              <line x1={20 + i * 14} y1="56" x2={20 + i * 14} y2="60" stroke="rgba(178, 220, 255, 0.7)" strokeWidth="0.5" />
              <text x={18 + i * 14} y="66" fontFamily="monospace" fontSize="3.5" fill="rgba(178, 220, 255, 0.6)">{i + 1}</text>
            </g>
          )}
        </g>

        {/* Translucent implant template sheet #2 — femoral component, rotated */}
        <g transform="translate(98, 36) rotate(4)" opacity="0.78">
          <rect width="92" height="62" fill="rgba(178, 220, 255, 0.14)" stroke="rgba(178, 220, 255, 0.55)" strokeWidth="0.5" />
          <text x="4" y="9" fontFamily="monospace" fontSize="4.5" fill="rgba(178, 220, 255, 0.85)">FEMORAL · TEMPLATE</text>
          {/* Femoral component lateral profile — boxy J shape */}
          <path d="M12 26 L12 18 L42 14 L68 14 Q78 16 78 24 L78 38 Q78 46 70 48 L52 50 L42 56 L32 50 L20 46 Q12 42 12 32 Z"
          fill="none" stroke="rgba(178, 220, 255, 0.85)" strokeWidth="0.8" />
          {/* Inner peg + cut lines */}
          <circle cx="40" cy="28" r="2" fill="none" stroke="rgba(178, 220, 255, 0.7)" strokeWidth="0.5" />
          <circle cx="58" cy="28" r="2" fill="none" stroke="rgba(178, 220, 255, 0.7)" strokeWidth="0.5" />
          <line x1="20" y1="36" x2="74" y2="36" stroke="rgba(178, 220, 255, 0.55)" strokeWidth="0.4" strokeDasharray="2 1.5" />
          {/* Size stamp */}
          <text x="62" y="58" fontFamily="monospace" fontSize="4.5" fill="rgba(178, 220, 255, 0.7)">SIZE 4</text>
        </g>

        {/* Bulldog clips holding everything at the top of the light box */}
        {[80, 160].map((cx) =>
        <g key={cx} transform={`translate(${cx}, 22)`}>
            {/* shadow */}
            <rect x="-7" y="1" width="14" height="5" fill="rgba(0,0,0,0.45)" rx="0.5" />
            {/* clip body */}
            <rect x="-7" y="0" width="14" height="5" fill="#6b7280" stroke="#2a2e38" strokeWidth="0.4" rx="0.5" />
            {/* handles */}
            <path d="M-5 0 L-8 -4 M5 0 L8 -4" stroke="#9aa4b3" strokeWidth="0.8" fill="none" strokeLinecap="round" />
          </g>
        )}

        {/* A faint smudge / fingerprint on the lightbox glass */}
        <ellipse cx="190" cy="60" rx="8" ry="5" fill="rgba(0,0,0,0.06)" />
        <ellipse cx="38" cy="155" rx="6" ry="4" fill="rgba(0,0,0,0.05)" />
      </svg>);

  }

  if (kind === 'hard-to-find') {
    // The child's hand drawing is the centerpiece — the one easy-to-find
    // image among a scatter of half-buried anatomy fragments around it.
    // Reinforces "no central library: the wrong thing surfaces first."
    return (
      <svg viewBox="0 0 240 200" preserveAspectRatio="xMidYMid slice"
      style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', display: 'block' }}>
        {/* Background — faded, partially-clipped anatomy scraps around the edges */}
        <g transform="translate(-12, 14) rotate(-18)" opacity="0.45">
          <rect width="58" height="48" fill={paper} stroke={ink} strokeWidth="0.6" />
          <g transform="translate(8, 0)"><Knee s={0.72} /></g>
        </g>
        <g transform="translate(192, 8) rotate(14)" opacity="0.45">
          <rect width="58" height="48" fill={paper} stroke={ink} strokeWidth="0.6" />
          <g transform="translate(8, 0)"><Hip s={0.72} /></g>
        </g>
        <g transform="translate(-8, 134) rotate(12)" opacity="0.45">
          <rect width="58" height="48" fill={paper} stroke={ink} strokeWidth="0.6" />
          <g transform="translate(6, 0)"><Vertebra s={0.74} /></g>
        </g>
        <g transform="translate(196, 138) rotate(-10)" opacity="0.45">
          <rect width="58" height="48" fill={paper} stroke={ink} strokeWidth="0.6" />
          <g transform="translate(8, 0)"><Foot s={0.66} /></g>
        </g>
        <g transform="translate(78, -10) rotate(6)" opacity="0.4">
          <rect width="54" height="44" fill={paper} stroke={ink} strokeWidth="0.5" />
          <g transform="translate(8, -2)"><Hand s={0.62} /></g>
        </g>
        <g transform="translate(82, 168) rotate(-5)" opacity="0.4">
          <rect width="58" height="42" fill={paper} stroke={ink} strokeWidth="0.5" />
        </g>

        {/* Centerpiece — child's hand drawing sized to match the lightbox
             in the neighboring Outdated Templates panel (same bounds:
             x=14..226, y=14..186, so 212×172). */}
        <g transform="translate(14, 14)">
          {/* drop shadow */}
          <rect x="3" y="5" width="212" height="172" fill="rgba(0,0,0,0.55)" />
          {/* paper */}
          <rect width="212" height="172" fill="#f2ecdc" stroke="#3a3a40" strokeWidth="0.6" />
          {/* faint paper texture lines */}
          <g opacity="0.18" stroke="#3a3a40" strokeWidth="0.3">
            {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((i) =>
            <line key={i} x1="14" y1={24 + i * 14} x2="198" y2={24 + i * 14} />
            )}
          </g>
          {/* masking tape at the top */}
          <g transform="translate(80, -5) rotate(-4)" opacity="0.85">
            <rect width="62" height="13" fill="rgba(220,200,140,0.8)" stroke="rgba(120,100,40,0.35)" strokeWidth="0.3" />
            <line x1="0" y1="2" x2="62" y2="2" stroke="rgba(120,100,40,0.25)" strokeWidth="0.4" />
            <line x1="0" y1="11" x2="62" y2="11" stroke="rgba(120,100,40,0.25)" strokeWidth="0.4" />
          </g>
          {/* The child's hand drawing — crayon stroke, big and centered.
               Hand glyph is 56×64 native; scaled to fill most of the paper. */}
          <g transform="translate(46, 22) scale(2.5)">
            <g stroke="#202028" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" fill="none">
              <path d="M 10 58
                       Q 6 54 5 48
                       Q 4 40 10 36
                       Q 12 32 9 22
                       Q 8 12 14 10
                       Q 18 10 17 18
                       Q 16 24 18 28
                       Q 19 22 20 10
                       Q 21 2 25 3
                       Q 28 4 27 14
                       Q 26 22 28 28
                       Q 29 20 30 6
                       Q 31 0 35 1
                       Q 38 2 37 12
                       Q 36 20 38 28
                       Q 39 22 41 12
                       Q 43 6 46 8
                       Q 48 12 46 22
                       Q 45 30 48 36
                       Q 52 42 50 50
                       Q 48 58 42 60
                       Q 30 62 20 61
                       Q 14 60 10 58 Z" />





















              
              {/* smiley on palm */}
              <circle cx="23" cy="44" r="0.9" fill="#202028" stroke="none" />
              <circle cx="31" cy="44" r="0.9" fill="#202028" stroke="none" />
              <path d="M 22 48 Q 27 52 32 48" strokeWidth="1.1" />
              {/* heart on one finger */}
              <path d="M 35 18 q -1.5 -2 -3 0 q -1.5 2 1.5 4 q 3 -2 1.5 -4 z" fill="#c83a3a" stroke="#c83a3a" strokeWidth="0.5" opacity="0.85" />
            </g>
          </g>
          {/* signature scribble — "ME!" */}
          <g transform="translate(168, 158)" opacity="0.75">
            <text x="0" y="0" fontFamily="'Comic Sans MS', cursive, sans-serif" fontSize="13" fill="#202028">ME!</text>
          </g>
        </g>

        {/* small magnifying glass + question mark hint at the corner */}
        <g transform="translate(220, 18)" opacity="0.7">
          <circle cx="0" cy="0" r="7" stroke={accent} strokeWidth="0.9" fill="none" />
          <line x1="5" y1="5" x2="9" y2="9" stroke={accent} strokeWidth="1.1" strokeLinecap="round" />
          <text x="-2.5" y="2.5" fontFamily="-apple-system, BlinkMacSystemFont, sans-serif" fontSize="7" fill={accent} fontWeight="700">?</text>
        </g>
      </svg>);

  }

  return null;
}

function OldWay({ accent }) {
  const isMobile = useIsMobile();
  const failures = [
  { id: 'old-way-1', kind: 'scattered-notes', label: 'Scattered Notes', line1: 'Information everywhere.', line2: 'Hard to find.' },
  { id: 'old-way-2', kind: 'clunky-system', label: 'Clunky Systems', line1: 'Outdated. Slow.', line2: 'Not built for surgeons.' },
  { id: 'old-way-3', kind: 'outdated-templates', label: 'Outdated Templates', line1: 'Not procedure-specific.', line2: 'Hard to customize.' },
  { id: 'old-way-4', kind: 'hard-to-find', label: 'Hard to Find Visuals', line1: 'No central library.', line2: 'Wastes time.' }];


  return (
    <section style={{
      borderTop: '1px solid #000',
      background: '#0a0c11',
      color: '#f0f1f3',
      padding: 0,
      position: 'relative',
      overflow: 'hidden',
      '--accent-particle': `${accent}aa`
    }}>
      {/* Slow crimson scan sweep across the whole section */}
      <div className="old-way-scan" aria-hidden="true"></div>
      <div style={{
        display: 'grid',
        gridTemplateColumns: isMobile ? '1fr' : 'minmax(420px, 1.4fr) repeat(4, 1fr) minmax(260px, 0.95fr)',
        minHeight: isMobile ? 'auto' : 460
      }}>
        {/* 1 — Left text panel */}
        <div style={{
          padding: isMobile ? '48px 20px' : '56px 44px',
          display: 'flex', flexDirection: 'column', justifyContent: 'center',
          background: 'radial-gradient(120% 90% at 0% 0%, rgba(185,28,44,0.10) 0%, rgba(10,12,17,0) 60%), #0a0c11',
          borderRight: '1px solid rgba(255,255,255,0.06)',
          position: 'relative', overflow: 'hidden'
        }}>
          {/* Drifting fragment particles — 225 mixed shards generated
               procedurally with deterministic pseudo-random positions,
               sizes, rotations, and animation phases. */}
          {Array.from({ length: 225 }, (_, i) => {
            // Cheap deterministic hash so each particle reads as random
            // but the layout is stable across renders.
            const hash = (n, m) => ((n * 9301 + 49297) % 233280) / 233280 * m;
            const top = hash(i * 7 + 11, 100);
            const left = hash(i * 13 + 5, 100);
            const sizeRoll = hash(i * 17 + 3, 1);
            // Mostly small particles, occasional bigger shards
            const w = sizeRoll < 0.6 ? 2 + Math.floor(hash(i * 19, 4)) : 6 + Math.floor(hash(i * 23, 18));
            const h = hash(i * 29, 1) < 0.5 ? 2 + Math.floor(hash(i * 31, 3)) : w;
            const rot = -45 + hash(i * 37, 90);
            const dur = 7 + hash(i * 41, 6);
            const d = hash(i * 43, 3);
            return { top: `${top}%`, left: `${left}%`, w, h, rot, dur, d };
          }).map((p, i) => (
          <span key={i} className="frag-particle" style={{
            top: p.top, left: p.left, width: p.w, height: p.h,
            ['--rot']: `${p.rot}deg`,
            ['--dur']: `${p.dur}s`,
            ['--d']: `${p.d}s`,
            ['--dx']: `${(i % 2 ? -1 : 1) * (6 + i % 3 * 4)}px`,
            ['--dy']: `${(i % 3 - 1) * 8}px`
          }}></span>
          ))}
          <div style={{
            fontSize: 16, fontWeight: 600, color: accent, letterSpacing: 2,
            textTransform: 'uppercase', marginBottom: 22,
            fontFamily: '"Geist Mono", ui-monospace, monospace'
          }}>THE OUTDATED WAY:</div>
          <h2 style={{
            position: 'relative',
            fontSize: isMobile ? 26 : 32, lineHeight: 1.08, letterSpacing: -1.2, fontWeight: 600,
            margin: '0 0 22px', color: '#f0f1f3',
            textAlign: 'left',
            overflow: 'visible'
          }}>
            Surgical workflows are
            <br />
            <span style={{ fontStyle: 'italic', color: accent, display: 'inline-block', whiteSpace: 'nowrap', marginLeft: '-3px', fontSize: '1.5em', lineHeight: 1.05, letterSpacing: '-0.04em' }}>
              {'Fragmented.'.split('').map((ch, i) => {
                const offsets = [
                { rest: 'translate(0,0) rotate(0deg)', peak: 'translate(0px,-2px) rotate(-2deg)' },
                { rest: 'translate(0,0) rotate(0.4deg)', peak: 'translate(1px,0px) rotate(2deg)' },
                { rest: 'translate(0,-1px) rotate(-0.6deg)', peak: 'translate(-1px,1px) rotate(1.5deg)' },
                { rest: 'translate(0,0.5px) rotate(0.8deg)', peak: 'translate(0px,-2px) rotate(-1.2deg)' },
                { rest: 'translate(-0.5px,0) rotate(-0.4deg)', peak: 'translate(1px,1px) rotate(2.5deg)' }];

                const o = offsets[i % offsets.length];
                return (
                  <span key={i} className="frag-letter" style={{
                    ['--rest']: o.rest,
                    ['--peak']: o.peak,
                    ['--d']: `${(i * 0.18).toFixed(2)}s`,
                    whiteSpace: ch === ' ' ? 'pre' : 'normal'
                  }}>{ch}</span>);

              })}
            </span>
          </h2>
          <p style={{
            fontSize: 16, lineHeight: 1.6, color: '#b0b8c4',
            margin: '0 0 32px', textWrap: 'pretty', maxWidth: 420
          }}>
            Scattered notes. Outdated templates. No visual library. Surgeons and residents waste valuable time rebuilding the same workflows.
          </p>
          <a href="#how" style={{
            alignSelf: 'flex-start',
            display: 'inline-flex', alignItems: 'center', gap: 10,
            padding: '12px 20px',
            border: '1px solid rgba(255,255,255,0.20)',
            borderRadius: 10,
            background: 'rgba(255,255,255,0.03)',
            color: '#f0f1f3',
            fontSize: 13.5, fontWeight: 600, letterSpacing: -0.1,
            textDecoration: 'none', fontFamily: 'inherit'
          }}>
            See the difference
            <span style={{
              display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              width: 18, height: 18, borderRadius: 9, background: accent, color: '#fff'
            }}>
              <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round">
                <line x1="5" y1="12" x2="19" y2="12" />
                <polyline points="12 5 19 12 12 19" />
              </svg>
            </span>
          </a>
        </div>

        {/* 2-5 — Four atmospheric image panels */}
        {failures.map((f, i) =>
        <div key={f.id} className="old-way-panel" style={{
          position: 'relative',
          background: '#0a0c11',
          borderRight: isMobile || i === failures.length - 1 ? 'none' : '1px solid rgba(255,255,255,0.06)',
          borderTop: isMobile ? '1px solid rgba(255,255,255,0.06)' : 'none',
          display: 'flex', flexDirection: 'column',
          minHeight: isMobile ? 260 : 400
        }}>
            {/* Anatomy line-art illustration fills the panel */}
            <div className="old-way-image-wrap" style={{
            position: 'absolute', top: 0, left: 0, right: 0, bottom: 140,
            overflow: 'hidden',
            background: '#13151a'
          }}>
              <OldWayIllustration kind={f.kind} accent={accent} />
              {/* Dark wash at the bottom so the caption sits on a solid base */}
              <div aria-hidden="true" style={{
              position: 'absolute', inset: 0, pointerEvents: 'none',
              background: 'linear-gradient(180deg, rgba(10,12,17,0.20) 0%, rgba(10,12,17,0.0) 25%, rgba(10,12,17,0.0) 55%, rgba(10,12,17,0.90) 100%)'
            }}></div>
            </div>

            {/* Caption — absolutely anchored at the bottom of the panel
               (height 120px) so the X-mark sits at exactly the same
               vertical level in every panel, regardless of label length. */}
            <div style={{
            position: 'absolute', left: 0, right: 0, bottom: 0,
            padding: '18px 22px 24px',
            display: 'flex', flexDirection: 'column', gap: 8,
            height: 140, boxSizing: 'border-box'
          }}>
              <div style={{ display: 'flex', alignItems: 'flex-start', gap: 8 }}>
                <span className="old-way-x" style={{
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                width: 20, height: 20, borderRadius: 10, background: accent, color: '#fff', flexShrink: 0
              }}>
                  <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3.5" strokeLinecap="round">
                    <line x1="18" y1="6" x2="6" y2="18" />
                    <line x1="6" y1="6" x2="18" y2="18" />
                  </svg>
                </span>
                <span style={{
                fontSize: 15, fontWeight: 600, color: '#f0f1f3', letterSpacing: -0.1,
                lineHeight: 1.25
              }}>{f.label}</span>
              </div>
              <div style={{ fontSize: 13.5, color: '#7a8290', lineHeight: 1.55 }}>
                {f.line1}<br />{f.line2}
              </div>
            </div>
          </div>
        )}

        {/* 6 — Crimson "everything you need" panel */}
        <div style={{
          padding: '36px 22px',
          background: `linear-gradient(180deg, ${accent} 0%, #7a1421 100%)`,
          color: '#fff',
          display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
          textAlign: 'center', gap: 22, position: 'relative'
        }}>
          <div style={{
            width: '95%', maxWidth: 320, aspectRatio: '1 / 1', position: 'relative'
          }}>
            <img src="assets/logo.png" alt="OrthoVault OS"
            style={{
              width: '100%', height: '100%', display: 'block',
              borderRadius: 32,
              boxShadow: '0 20px 50px -16px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.10)'
            }} />
          </div>
          <div style={{
            fontSize: 18, fontWeight: 600, letterSpacing: -0.3, lineHeight: 1.3
          }}>
            One platform.<br />Everything you need.
          </div>
        </div>
      </div>
    </section>);

}

function HowItWorks({ accent }) {
  const isMobile = useIsMobile();
  const steps = [
  {
    num: '01',
    title: 'Walk into pre-op',
    body: 'Open OrthoVaultOS, search for the procedure, or pick it from your starred list. Instant search across every procedure in your library.',
    detail: 'Search-and-go in the seconds you have.'
  },
  {
    num: '02',
    title: 'Pick the surgeon',
    body: 'Tap the surgeon\'s name and the entire panel reconfigures — their gloves, suture sizes, tourniquet pressure, positioning, the pearls they always mention.',
    detail: 'Surgeon preferences are first-class data, cross-referenced from other residents and the attendings themselves.'
  },
  {
    num: '03',
    title: 'Reference case',
    body: 'Pull up technique PDFs, evidence papers, or the surgeon\'s tray of implants. Glance at the next step without breaking sterile field.',
    detail: 'Take a picture in the OR and upload it within the app. Streamlined process.'
  }];

  return (
    <section id="how" style={{
      borderTop: '1px solid var(--border)',
      background: 'var(--surface-2)', padding: isMobile ? '48px 20px' : '88px 28px'
    }}>
      <div style={{ maxWidth: 1200, margin: '0 auto' }}>
        <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 2fr', gap: isMobile ? 20 : 64, alignItems: 'start', marginBottom: isMobile ? 32 : 56 }}>
          <div>
            <div style={{
              fontSize: 11.5, fontWeight: 600, color: accent, letterSpacing: 1.4,
              textTransform: 'uppercase', marginBottom: 12
            }}>How it works</div>
            <h2 style={{ fontSize: isMobile ? 28 : 38, lineHeight: 1.1, letterSpacing: -1, fontWeight: 600, margin: 0, color: 'var(--text)', textWrap: 'balance' }}>
              Three taps from{' '}
              <span style={{ color: accent, fontStyle: 'italic' }}>scrub-in</span> to{' '}
              <span style={{ color: accent, fontStyle: 'italic' }}>ready</span>.
            </h2>
          </div>
          <p style={{ fontSize: 16.5, lineHeight: 1.6, color: 'var(--muted)', margin: '6px 0 0', textWrap: 'pretty' }}>
            Designed for the speed of the OR. No friction, no cloud round-trips, no broken sterile field for a forgotten suture size. Just the surgeon's playbook, where you need it.
          </p>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : 'repeat(3, 1fr)', gap: isMobile ? 16 : 28 }}>
          {steps.map((s) =>
          <div key={s.num} style={{
            padding: '28px 24px 24px',
            background: 'var(--surface)',
            border: '1px solid var(--border)',
            borderRadius: 14,
            position: 'relative',
            boxShadow: 'var(--shadow-card)'
          }}>
              <div style={{
              fontFamily: '"Geist Mono", ui-monospace, monospace',
              fontSize: 11.5, color: accent, fontWeight: 600, letterSpacing: 0.8,
              marginBottom: 16
            }}>STEP {s.num}</div>
              <h3 style={{ fontSize: 19, fontWeight: 600, letterSpacing: -0.4, margin: '0 0 10px', color: 'var(--text)' }}>
                {s.title}
              </h3>
              <p style={{ fontSize: 14, lineHeight: 1.55, color: 'var(--muted)', margin: '0 0 16px', textWrap: 'pretty' }}>
                {s.body}
              </p>
              <div style={{
              fontSize: 12, color: 'var(--subtle)', borderTop: '1px solid var(--border-soft)',
              paddingTop: 14, lineHeight: 1.5
            }}>{s.detail}</div>
            </div>
          )}
        </div>
      </div>
    </section>);

}

/* "Built for surgeons" — what the app offers. Dark section with a left
   text panel and 5 feature cards. Each card has a small accent icon,
   title, one-line description, and a stylized visual preview at the
   bottom (procedure list, OR positioning diagram, preference cart,
   numbered op-note steps, AI chat). All visuals are SVG/CSS so the
   panel reads as a dense, in-product preview. */
function BuiltForSurgeons({ accent }) {
  const isMobile = useIsMobile();
  const cards = [
  {
    title: 'Procedure Templates',
    sub: 'Template, customize, and reuse with ease.',
    icon:
    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <rect x="3" y="3" width="18" height="18" rx="2" />
          <line x1="9" y1="9" x2="15" y2="9" />
          <line x1="9" y1="13" x2="15" y2="13" />
          <line x1="9" y1="17" x2="13" y2="17" />
        </svg>,

    preview: 'procedures'
  },
  {
    title: 'Visual Positioning',
    sub: 'Detailed positioning library with visuals.',
    icon:
    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <circle cx="12" cy="6" r="2" />
          <path d="M5 14h14" />
          <path d="M7 14l2 6M17 14l-2 6" />
          <path d="M9 10c1.5-1 4.5-1 6 0" />
        </svg>,

    preview: 'positioning'
  },
  {
    title: 'Case Cart',
    sub: 'The instrument tray, built per surgeon, ready before you scrub in.',
    icon:
    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <circle cx="9" cy="20" r="1.5" />
          <circle cx="17" cy="20" r="1.5" />
          <path d="M3 4h2l2.6 11.6a2 2 0 0 0 2 1.4h6.8a2 2 0 0 0 2-1.4L21 8H6" />
        </svg>,

    preview: 'cart'
  },
  {
    title: 'Op Notes',
    sub: 'Smart, structured, and fast.',
    icon:
    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" />
          <polyline points="14 3 14 9 20 9" />
          <line x1="8" y1="13" x2="16" y2="13" />
          <line x1="8" y1="17" x2="14" y2="17" />
        </svg>,

    preview: 'opnotes'
  },
  {
    title: 'AI Assistant',
    sub: 'Your surgical copilot. Ask anything, in context.',
    icon:
    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <circle cx="12" cy="12" r="3.5" />
          <path d="M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M5 19l2-2M17 7l2-2" />
        </svg>,

    preview: 'ai'
  },
  {
    title: 'X-Ray Annotation',
    sub: 'Draw, label, and drag-place implants for pre-op planning.',
    icon:
    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <path d="M4 3h16v18H4z" />
          <path d="M9 3v18M4 9h5M4 15h5" />
          <path d="M14 8l4 4-4 4" />
        </svg>,

    preview: 'xray'
  },
  {
    title: 'Evidence Annotation',
    sub: 'Highlight and drop notes directly on papers you upload.',
    icon:
    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" />
          <polyline points="14 3 14 9 20 9" />
          <path d="M8 14h4" stroke={accent} strokeWidth="3.5" />
        </svg>,

    preview: 'pdfnote'
  }];


  /* Per-card preview visuals — each is a small slice of what the
     feature actually does, drawn in HTML/CSS for crispness. */
  const renderPreview = (kind) => {
    if (kind === 'procedures') {
      // A list of "Procedure" rows with one selected (accent).
      const rows = [
      { label: 'Pelvic ex-fix' },
      { label: 'Femur IM nail', active: true },
      { label: 'Distal radius ORIF' }];

      return (
        <div style={{
          background: '#0e1118', border: '1px solid rgba(255,255,255,0.06)',
          borderRadius: 7, padding: '10px 9px',
          color: '#b0b8c4', fontFamily: '"Geist Mono", ui-monospace, monospace'
        }}>
          <div style={{
            fontSize: 8.5, color: 'rgba(176,184,196,0.5)', letterSpacing: 0.8,
            marginBottom: 7, textTransform: 'uppercase'
          }}>Cases</div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
            {rows.map((r) =>
            <div key={r.label} style={{
              display: 'flex', alignItems: 'center', gap: 7,
              padding: '4px 7px', borderRadius: 5,
              background: r.active ? `${accent}26` : 'transparent',
              color: r.active ? '#ffffff' : '#b0b8c4',
              border: r.active ? `1px solid ${accent}66` : '1px solid transparent'
            }}>
                <span style={{
                width: 3.5, height: 3.5, borderRadius: 2,
                background: r.active ? accent : 'rgba(176,184,196,0.4)'
              }}></span>
                <span style={{ fontSize: 9.5 }}>{r.label}</span>
              </div>
            )}
          </div>
        </div>);

    }

    if (kind === 'positioning') {
      // A library of surgical positions — 6 small position thumbnails
      // in a 3×2 grid, one highlighted (the selected position).
      const positions = [
      { name: 'Supine', sel: true,
        svg:
        <g>
              <rect x="6" y="14" width="32" height="3" fill="#2a2f3a" rx="0.5" />
              <rect x="6" y="11" width="32" height="3" fill="rgba(120,200,230,0.45)" rx="1" />
              <circle cx="10" cy="9.5" r="1.6" fill="#e6c9b2" />
              <rect x="12" y="9" width="22" height="2.2" fill="#e6c9b2" rx="0.8" />
            </g>

      },
      { name: 'Lateral',
        svg:
        <g>
              <rect x="6" y="14" width="32" height="3" fill="#2a2f3a" rx="0.5" />
              <rect x="6" y="11" width="32" height="3" fill="rgba(120,200,230,0.45)" rx="1" />
              <circle cx="10" cy="10" r="1.6" fill="#e6c9b2" />
              <path d="M12 11 L28 11 L30 8 L34 8" stroke="#e6c9b2" strokeWidth="2.2" strokeLinecap="round" fill="none" />
            </g>

      },
      { name: 'Prone',
        svg:
        <g>
              <rect x="6" y="14" width="32" height="3" fill="#2a2f3a" rx="0.5" />
              <rect x="6" y="11" width="32" height="3" fill="rgba(120,200,230,0.45)" rx="1" />
              <circle cx="34" cy="9.5" r="1.6" fill="#e6c9b2" />
              <rect x="10" y="9" width="22" height="2.2" fill="#e6c9b2" rx="0.8" />
              <rect x="10" y="11.2" width="22" height="1.2" fill="rgba(255,255,255,0.15)" />
            </g>

      }];


      return (
        <div style={{
          background: '#0e1118', border: '1px solid rgba(255,255,255,0.06)',
          borderRadius: 7, padding: '10px 9px'
        }}>
          <div style={{
            fontSize: 8.5, color: 'rgba(176,184,196,0.55)', letterSpacing: 0.8,
            marginBottom: 7, textTransform: 'uppercase',
            fontFamily: '"Geist Mono", ui-monospace, monospace'
          }}>Position Library</div>
          <div style={{
            display: 'flex', flexDirection: 'column', gap: 4
          }}>
            {positions.map((p) =>
            <div key={p.name} style={{
              display: 'flex', alignItems: 'center', gap: 7,
              background: p.sel ? `${accent}1f` : 'rgba(255,255,255,0.02)',
              border: p.sel ? `1px solid ${accent}66` : '1px solid transparent',
              borderRadius: 5,
              padding: '3px 7px'
            }}>
                <svg viewBox="0 0 44 22" width="30" height="15" style={{ display: 'block', flexShrink: 0 }}>
                  {p.svg}
                </svg>
                <span style={{
                fontSize: 9.5, color: p.sel ? '#fff' : '#e0e3e8',
                fontWeight: p.sel ? 600 : 500, letterSpacing: -0.1
              }}>{p.name}</span>
              </div>
            )}
          </div>
        </div>);

    }

    if (kind === 'cart') {
      // "Pelvic Ex-Fix Cart" with item rows + quantities — sized to fill the card.
      const items = [
      { name: 'Synthes Ex-Fix Set', qty: '1' },
      { name: 'Schanz Pin 5.0 mm', qty: '4' },
      { name: 'Carbon Fiber Rod', qty: '3' }];

      return (
        <div style={{
          background: '#0e1118', border: '1px solid rgba(255,255,255,0.06)',
          borderRadius: 7, padding: '10px 9px'
        }}>
          <div style={{
            background: `linear-gradient(180deg, ${accent}33, ${accent}14)`,
            borderRadius: 5, padding: '5px 8px', marginBottom: 7,
            fontSize: 10, fontWeight: 600, color: '#fff',
            letterSpacing: -0.1
          }}>Pelvic Ex-Fix Cart</div>
          <div style={{
            display: 'flex', justifyContent: 'space-between',
            fontSize: 7.5, color: 'rgba(176,184,196,0.5)',
            textTransform: 'uppercase', letterSpacing: 0.8,
            padding: '0 4px 5px',
            fontFamily: '"Geist Mono", ui-monospace, monospace'
          }}>
            <span>Item</span><span>Qty</span>
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
            {items.map((it) =>
            <div key={it.name} style={{
              display: 'flex', justifyContent: 'space-between', alignItems: 'center',
              padding: '4px 7px',
              background: 'rgba(255,255,255,0.02)',
              borderRadius: 5
            }}>
                <span style={{ display: 'flex', alignItems: 'center', gap: 7, fontSize: 9.5, color: '#e0e3e8' }}>
                  <span style={{ width: 2.5, height: 7, borderRadius: 1.5, background: accent }}></span>
                  {it.name}
                </span>
                <span style={{
                fontSize: 9, color: 'rgba(176,184,196,0.75)',
                fontFamily: '"Geist Mono", ui-monospace, monospace'
              }}>{it.qty}</span>
              </div>
            )}
          </div>
        </div>);

    }

    if (kind === 'opnotes') {
      const steps = [
      'Patient positioning',
      'Incision',
      'Closure'];

      return (
        <div style={{
          background: '#0e1118', border: '1px solid rgba(255,255,255,0.06)',
          borderRadius: 7, padding: '10px 9px'
        }}>
          <div style={{
            fontSize: 10, fontWeight: 600, color: '#fff',
            marginBottom: 7, letterSpacing: -0.1
          }}>Procedure Steps</div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
            {steps.map((s, i) =>
            <div key={s} style={{
              display: 'flex', alignItems: 'center', gap: 8,
              padding: '4px 7px',
              background: 'rgba(255,255,255,0.02)',
              borderRadius: 5
            }}>
                <span style={{
                width: 14, height: 14, borderRadius: 3,
                background: `${accent}26`, color: accent,
                fontFamily: '"Geist Mono", ui-monospace, monospace',
                fontSize: 9, fontWeight: 700,
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center'
              }}>{i + 1}</span>
                <span style={{ fontSize: 9.5, color: '#e0e3e8' }}>{s}</span>
              </div>
            )}
          </div>
        </div>);

    }

    if (kind === 'ai') {
      return (
        <div style={{
          background: '#0e1118', border: '1px solid rgba(255,255,255,0.06)',
          borderRadius: 7, padding: '10px 9px',
          display: 'flex', flexDirection: 'column', gap: 6
        }}>
          <div style={{
            fontSize: 10, fontWeight: 600, color: '#fff', letterSpacing: -0.1
          }}>Ask anything…</div>
          {[
          'What are the key steps for a pelvic ex-fix?',
          'Suggest implant sizing for a TKA.'].
          map((q, i) =>
          <div key={i} style={{
            display: 'flex', gap: 7, alignItems: 'flex-start',
            padding: '5px 7px',
            background: 'rgba(255,255,255,0.02)',
            border: '1px solid rgba(255,255,255,0.05)',
            borderRadius: 5,
            fontSize: 9.5, color: '#d0d4dc', lineHeight: 1.35
          }}>
              <svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke={accent} strokeWidth="2.4" style={{ flexShrink: 0, marginTop: 1 }}>
                <circle cx="12" cy="12" r="9" />
                <path d="M9 10h6M9 14h4" />
              </svg>
              <span>{q}</span>
            </div>
          )}
          <div style={{
            background: `linear-gradient(180deg, ${accent}26, ${accent}14)`,
            border: `1px solid ${accent}66`,
            borderRadius: 5,
            padding: '5px 8px',
            display: 'flex', alignItems: 'center', justifyContent: 'space-between',
            fontSize: 9, fontWeight: 600, color: '#fff',
            fontFamily: '"Geist Mono", ui-monospace, monospace',
            letterSpacing: 0.3
          }}>
            <span>Generating…</span>
            <span style={{ display: 'inline-flex', gap: 2.5 }}>
              <span style={{ width: 3, height: 3, borderRadius: 1.5, background: '#fff', opacity: 0.85 }}></span>
              <span style={{ width: 3, height: 3, borderRadius: 1.5, background: '#fff', opacity: 0.6 }}></span>
              <span style={{ width: 3, height: 3, borderRadius: 1.5, background: '#fff', opacity: 0.35 }}></span>
            </span>
          </div>
        </div>);

    }

    if (kind === 'xray') {
      return (
        <div style={{
          background: '#0e1118', border: '1px solid rgba(255,255,255,0.06)',
          borderRadius: 7, padding: '9px', display: 'flex', gap: 8, alignItems: 'center'
        }}>
          <div style={{
            width: 44, height: 52, borderRadius: 4, flexShrink: 0, position: 'relative',
            background: 'radial-gradient(60% 90% at 50% 40%, rgba(255,255,255,0.16), rgba(0,0,0,0) 70%), #05070a'
          }}>
            <div style={{
              position: 'absolute', left: '50%', top: 8, bottom: 8, width: 7,
              transform: 'translateX(-50%)', borderRadius: 2,
              background: 'rgba(220,225,235,0.55)'
            }}></div>
            <div style={{
              position: 'absolute', left: '50%', top: '32%', width: 14, height: 14,
              transform: 'translateX(-50%)', borderRadius: 3,
              border: `1.5px solid ${accent}`, background: `${accent}22`
            }}></div>
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 5, minWidth: 0 }}>
            <div style={{ fontSize: 9.5, fontWeight: 600, color: '#fff' }}>Locking plate</div>
            <div style={{ fontSize: 8.5, color: '#7a8290', lineHeight: 1.4 }}>Drag-placed, non-destructive layer</div>
            <div style={{ display: 'flex', gap: 4, marginTop: 2 }}>
              {['↖', '✎', 'T'].map((s, i) =>
              <span key={i} style={{
                width: 16, height: 16, borderRadius: 4,
                background: i === 0 ? `${accent}33` : 'rgba(255,255,255,0.05)',
                border: i === 0 ? `1px solid ${accent}88` : '1px solid rgba(255,255,255,0.08)',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                fontSize: 8, color: i === 0 ? '#fff' : '#7a8290'
              }}>{s}</span>
              )}
            </div>
          </div>
        </div>);

    }

    if (kind === 'pdfnote') {
      const lines = [1, 0.9, 0.75, 0.5];
      return (
        <div style={{
          background: '#0e1118', border: '1px solid rgba(255,255,255,0.06)',
          borderRadius: 7, padding: '10px 9px', display: 'flex', gap: 8
        }}>
          <div style={{ flex: 1, display: 'flex', flexDirection: 'column', gap: 5, paddingTop: 2 }}>
            {lines.map((w, i) =>
            <div key={i} style={{
              height: 5, width: `${w * 100}%`, borderRadius: 2,
              background: i === 1 ? `${accent}55` : 'rgba(255,255,255,0.10)'
            }}></div>
            )}
          </div>
          <div style={{
            width: 20, height: 20, borderRadius: '11px 11px 11px 3px', flexShrink: 0,
            background: `linear-gradient(180deg, ${accent}, #7a1421)`,
            display: 'flex', alignItems: 'center', justifyContent: 'center',
            boxShadow: `0 2px 8px -2px ${accent}88`
          }}>
            <svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="2.6" strokeLinecap="round">
              <line x1="12" y1="6" x2="12" y2="18" /><line x1="6" y1="12" x2="18" y2="12" />
            </svg>
          </div>
        </div>);

    }
    return null;
  };

  return (
    <section style={{
      borderTop: '1px solid var(--border)',
      background: '#0a0c11', color: '#f0f1f3',
      padding: isMobile ? '40px 20px' : '16px 28px 20px',
      position: 'relative', overflow: 'hidden'
    }}>
      {/* Soft accent wash in the top-left */}
      <div aria-hidden="true" style={{
        position: 'absolute', inset: 0, pointerEvents: 'none',
        background: `radial-gradient(60% 60% at 0% 0%, ${accent}14, transparent 60%)`
      }}></div>

      <div style={{ position: 'relative', maxWidth: 1320, margin: '0 auto' }}>
        {/* Text panel */}
        <div style={{
          display: 'flex', flexDirection: 'column',
          justifyContent: 'center',
          padding: isMobile ? '8px 0 20px' : '8px 0 24px',
          maxWidth: 560
        }}>
          <div style={{
            fontSize: 12, fontWeight: 600, color: accent, letterSpacing: 1.6,
            textTransform: 'uppercase', marginBottom: 16,
            fontFamily: '"Geist Mono", ui-monospace, monospace'
          }}>Built for surgeons</div>
          <h2 style={{
            fontSize: 30, lineHeight: 1.05, letterSpacing: -0.9, fontWeight: 600,
            margin: '0 0 14px', color: '#f0f1f3', textWrap: 'balance'
          }}>
            Everything you need.
            <br />In one platform.
          </h2>
          <button
            type="button"
            onClick={() => window.openFeatureExplorer && window.openFeatureExplorer()}
            style={{
              alignSelf: 'flex-start',
              display: 'inline-flex', alignItems: 'center', gap: 10,
              padding: '12px 20px',
              background: accent, color: '#fff', border: 'none',
              borderRadius: 10,
              fontSize: 13.5, fontWeight: 600, letterSpacing: -0.1,
              cursor: 'pointer', fontFamily: 'inherit',
              boxShadow: `0 6px 18px -8px ${accent}99`
            }}>
            Explore Features
            <span style={{
              display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              width: 18, height: 18, borderRadius: 9, background: 'rgba(255,255,255,0.18)'
            }}>
              <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round">
                <line x1="5" y1="12" x2="19" y2="12" />
                <polyline points="12 5 19 12 12 19" />
              </svg>
            </span>
          </button>
        </div>

        {/* Feature cards */}
        <div style={{
          display: 'grid', gridTemplateColumns: isMobile ? '1fr' : 'repeat(4, 1fr)', gap: 14,
          paddingBottom: isMobile ? 4 : 24
        }}>
        {cards.map((c) =>
        <article key={c.title} style={{
          background: '#0e1118',
          border: '1px solid rgba(255,255,255,0.07)',
          borderRadius: 12,
          padding: 12,
          display: 'flex', flexDirection: 'column', gap: 10,
          position: 'relative', overflow: 'hidden',
          boxShadow: '0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 36px -24px rgba(0,0,0,0.45)'
        }}>
            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
              {/* icon badge */}
              <span style={{
              width: 26, height: 26, borderRadius: 8,
              background: `${accent}1f`, color: accent,
              border: `1px solid ${accent}66`,
              display: 'inline-flex', alignItems: 'center', justifyContent: 'center'
            }}>{c.icon}</span>
            </div>
            <div>
              <h3 style={{
              fontSize: 14, fontWeight: 600, letterSpacing: -0.2,
              margin: '0 0 4px', color: '#f0f1f3'
            }}>{c.title}</h3>
              <p style={{
              fontSize: 11.5, lineHeight: 1.45, color: '#7a8290',
              margin: 0, textWrap: 'pretty'
            }}>{c.sub}</p>
            </div>
            <div>{renderPreview(c.preview)}</div>
          </article>
        )}
        </div>
      </div>
    </section>);

}

/* Convert #rrggbb to "r, g, b" for use inside rgba(var(--accent-rgb), a). */
function hexToRgbTriple(hex) {
  const h = hex.replace('#', '');
  const v = h.length === 3 ? h.split('').map((c) => c + c).join('') : h;
  const n = parseInt(v, 16);
  return `${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}`;
}

/* "In the OR" — two intra-operative photo slots, composed asymmetrically.
   The user drops their own images via the <image-slot> web component;
   empty state reads as intentional thanks to the muted caption and
   crimson rule. Slots persist via the sidecar so a fill survives reload. */
function InTheOR({ accent }) {
  const accentRgb = hexToRgbTriple(accent);
  const isMobile = useIsMobile();
  return (
    <section style={{
      borderTop: '1px solid var(--border)',
      background: 'var(--surface)',
      padding: isMobile ? '48px 20px' : '96px 28px',
      position: 'relative',
      overflow: 'hidden',
      ['--accent-rgb']: accentRgb
    }}>
      {/* Soft crimson wash so the photo block sits inside the brand atmosphere */}
      <div aria-hidden="true" style={{
        position: 'absolute', inset: 0, pointerEvents: 'none',
        background: `radial-gradient(60% 70% at 85% 20%, ${accent}14, transparent 60%), radial-gradient(50% 60% at 10% 90%, ${accent}10, transparent 65%)`
      }}></div>

      <div style={{ position: 'relative', maxWidth: 1200, margin: '0 auto' }}>
        <div style={{
          display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1.6fr', gap: isMobile ? 16 : 64,
          alignItems: 'start', marginBottom: isMobile ? 28 : 48
        }}>
          <div>
            <div style={{
              fontSize: 11.5, fontWeight: 600, color: accent, letterSpacing: 1.4,
              textTransform: 'uppercase', marginBottom: 12
            }}>From the field</div>
            <h2 style={{
              fontSize: isMobile ? 28 : 38, lineHeight: 1.1, letterSpacing: -1, fontWeight: 600,
              margin: 0, color: 'var(--text)', textWrap: 'balance'
            }}>
              Built where the{' '}
              <span style={{
                color: accent, fontWeight: 600,
                textTransform: 'uppercase', letterSpacing: -0.5
              }}>CASES</span> happen.
            </h2>
          </div>
          <p style={{
            fontSize: 16.5, lineHeight: 1.6, color: 'var(--muted)',
            margin: '6px 0 0', textWrap: 'pretty', maxWidth: 560
          }}>
            Capture the moments that matter — approach, retraction, the final reduction. Photos sync to the procedure record so the next resident on rotation walks in already knowing what good looks like.
          </p>
        </div>

        {/* Asymmetric three-photo composition.
             Left column: two stacked photos (OR team + room setup).
             Right column: large hero photo offset down. */}
        <div style={{
          display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1.15fr', gap: 24,
          alignItems: 'start'
        }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 28 }}>
            <figure style={{ margin: 0 }}>
              <div className="photo-card">
                <div className="photo-card__inner" style={{ aspectRatio: '3 / 2' }}>
                  <image-slot
                    id="intra-op-1"
                    shape="rect"
                    src="assets/or-team.jpg"
                    placeholder="Drop intra-op photo · approach"
                    style={{
                      display: 'block', width: '100%', height: '100%',
                      background: 'var(--surface-2)'
                    }}>
                  </image-slot>
                </div>
              </div>
              <figcaption style={{
                display: 'flex', alignItems: 'baseline', gap: 12,
                marginTop: 18, fontSize: 13.5, lineHeight: 1.5,
                color: 'var(--muted)',
                fontFamily: '"Geist", -apple-system, BlinkMacSystemFont, sans-serif',
                textWrap: 'pretty'
              }}>
                <span style={{
                  color: accent, fontWeight: 600, flexShrink: 0,
                  fontFamily: '"Geist Mono", ui-monospace, monospace',
                  fontSize: 12, letterSpacing: 0.4
                }}>01</span>
                <span>Walking through the steps · the resident logs each one in OrthoVaultOS, then exports a fully functional operative plan</span>
              </figcaption>
            </figure>

            <figure style={{ margin: 0 }}>
              <div className="photo-card">
                <div className="photo-card__inner" style={{ aspectRatio: '5 / 4' }}>
                  <image-slot
                    id="intra-op-3"
                    shape="rect"
                    src="assets/or-room-setup.jpg"
                    placeholder="Drop intra-op photo · room setup"
                    style={{
                      display: 'block', width: '100%', height: '100%',
                      background: 'var(--surface-2)'
                    }}>
                  </image-slot>
                </div>
              </div>
              <figcaption style={{
                display: 'flex', alignItems: 'baseline', gap: 12,
                marginTop: 18, fontSize: 13.5, lineHeight: 1.5,
                color: 'var(--muted)',
                fontFamily: '"Geist", -apple-system, BlinkMacSystemFont, sans-serif',
                textWrap: 'pretty'
              }}>
                <span style={{
                  color: accent, fontWeight: 600, flexShrink: 0,
                  fontFamily: '"Geist Mono", ui-monospace, monospace',
                  fontSize: 12, letterSpacing: 0.4
                }}>03</span>
                <span>Room setup in a flash · actual images from the surgeon you’re scrubbing with, configured the way they like it</span>
              </figcaption>
            </figure>
          </div>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 28, paddingTop: isMobile ? 0 : 80 }}>
            <figure style={{ margin: 0 }}>
              <div className="photo-card">
                <div className="photo-card__inner" style={{ aspectRatio: '5 / 4' }}>
                  <image-slot
                    id="intra-op-2"
                    shape="rect"
                    src="assets/knee-closeup.jpg"
                    placeholder="Drop intra-op photo · key step"
                    style={{
                      display: 'block', width: '100%', height: '100%',
                      background: 'var(--surface-2)'
                    }}>
                  </image-slot>
                </div>
              </div>
              <figcaption style={{
                display: 'flex', alignItems: 'baseline', gap: 12,
                marginTop: 18, fontSize: 13.5, lineHeight: 1.5,
                color: 'var(--muted)',
                fontFamily: '"Geist", -apple-system, BlinkMacSystemFont, sans-serif',
                textWrap: 'pretty'
              }}>
                <span style={{
                  color: accent, fontWeight: 600, flexShrink: 0,
                  fontFamily: '"Geist Mono", ui-monospace, monospace',
                  fontSize: 12, letterSpacing: 0.4
                }}>02</span>
                <span>Hohmann and Z-retractor placement is easier when you have pictures of exactly where they go</span>
              </figcaption>
            </figure>
          </div>
        </div>
      </div>
    </section>);

}

/* Beyond ortho — a quiet acknowledgment that the app is designed for
   orthopedics today, but the underlying structure (surgeon prefs, steps,
   pearls, references) maps to any surgical subspecialty. The grid lists
   adjacent fields with a small "soon" tag on the ones we plan to support
   officially. Editorial spacing, no icons — names earn their own weight. */
function OtherSpecialties({ accent }) {
  const isMobile = useIsMobile();
  const specialties = [
  { name: 'General surgery', soon: true },
  { name: 'Cardiothoracic', soon: true },
  { name: 'Vascular', soon: true },
  { name: 'Neurosurgery', soon: true },
  { name: 'Plastic & recon.', soon: true },
  { name: 'Urology', soon: true },
  { name: 'Otolaryngology', soon: true },
  { name: 'OB / GYN', soon: true },
  { name: 'Ophthalmology', soon: true },
  { name: 'Trauma', soon: true },
  { name: 'Pediatric surgery', soon: true },
  { name: 'Transplant', soon: true }];


  return (
    <section style={{
      borderTop: '1px solid var(--border)',
      background: 'var(--bg)',
      padding: isMobile ? '32px 20px' : '28px 28px'
    }}>
      <div style={{ maxWidth: 1200, margin: '0 auto' }}>
        <div style={{
          display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1.6fr', gap: isMobile ? 16 : 64,
          alignItems: 'start'
        }}>
          <div>
            <div style={{
              fontSize: 11.5, fontWeight: 600, color: accent, letterSpacing: 1.4,
              textTransform: 'uppercase', marginBottom: 12
            }}>Beyond ortho</div>
            <h2 style={{
              fontSize: isMobile ? 28 : 38, lineHeight: 1.1, letterSpacing: -1, fontWeight: 600,
              margin: 0, color: 'var(--text)', textWrap: 'balance'
            }}>
              Built for{' '}
              <span style={{
                fontWeight: 700,
                textTransform: 'uppercase', letterSpacing: -0.5
              }}>ORTHO</span>.{' '}
              <span style={{
                color: accent, fontWeight: 600,
                textTransform: 'uppercase', letterSpacing: -0.5
              }}>USEFUL</span> in any OR.
            </h2>
          </div>
          <p style={{
            fontSize: 16.5, lineHeight: 1.6, color: 'var(--muted)',
            margin: '6px 0 0', textWrap: 'pretty', maxWidth: 600
          }}>
            Every surgical subspecialty runs on the same loop — surgeon preferences, steps, pearls, references. Official support for the fields below is on the roadmap, but the app already works today for any surgeon who wants to capture and reference their cases.
          </p>
        </div>
        <div style={{ marginTop: isMobile ? 24 : 40, display: 'grid', gridTemplateColumns: isMobile ? 'repeat(2, 1fr)' : 'repeat(4, 1fr)', gap: 0 }}>
          {specialties.map((s) => (
            <div key={s.name} style={{
              display: 'flex', alignItems: 'center', justifyContent: 'space-between',
              padding: '11px 16px 11px 0',
              borderBottom: '1px solid var(--border-soft)'
            }}>
              <span style={{ fontSize: 14, color: 'var(--muted)' }}>{s.name}</span>
              {s.soon && (
                <span style={{
                  fontSize: 10, fontWeight: 600, color: accent,
                  background: `${accent}1a`, padding: '2px 8px', borderRadius: 100,
                  fontFamily: '"Geist Mono", ui-monospace, monospace', letterSpacing: 0.4,
                  textTransform: 'uppercase'
                }}>Soon</span>
              )}
            </div>
          ))}
        </div>
      </div>
    </section>);

}

function Pricing({ accent }) {
  const isMobile = useIsMobile();
  const tiers = [
  {
    name: 'Free',
    price: '$0',
    sub: 'forever',
    tag: 'Try it in one case',
    cta: 'Download now',
    ctaHref: 'download.html',
    ctaStyle: 'ghost',
    featured: false,
    limits: { surgeons: '1 surgeon', procedures: '1 procedure' },
    features: [
    'Full app, no time limit',
    'Surgeon preference panel',
    'Procedure steps & technique notes',
    'Evidence & implant references',
    'AI assistant (bring your own API key)'],

    excluded: ['Phone-to-desktop photo upload', 'Operative report parser', 'Import/export']
  },
  {
    name: 'Essentials',
    price: '$9.99',
    sub: 'per month',
    tag: 'For residents, fellows & attendings — all rotations',
    cta: 'Get Essentials',
    ctaHref: 'signup.html?plan=essentials',
    ctaStyle: 'solid',
    featured: false,
    limits: { surgeons: 'Up to 10 surgeons', procedures: 'Up to 20 procedures' },
    features: [
    'Everything in Free',
    'Up to 10 surgeon profiles',
    'Up to 20 procedures',
    'Favorites & quick-access',
    'Import/export surgeon templates',
    'Evidence & technique attachments'],

    excluded: ['Phone-to-desktop photo upload', 'Operative report parser']
  },
  {
    name: 'Professional',
    price: '$19.99',
    sub: 'per month',
    tag: 'For residents, fellows & attendings — all rotations',
    cta: 'Get Professional',
    ctaHref: 'signup.html?plan=professional',
    ctaStyle: 'featured',
    featured: true,
    badge: 'Most popular',
    limits: { surgeons: 'Unlimited surgeons', procedures: 'Unlimited procedures' },
    features: [
    'Everything in Free',
    'Unlimited surgeon profiles',
    'Unlimited procedures',
    'Favorites & quick-access',
    'Import/export surgeon templates',
    'Evidence & technique attachments',
    'Phone images directly to app'],

    excluded: []
  }];


  return (
    <section id="pricing" style={{
      borderTop: '1px solid var(--border)',
      padding: isMobile ? '48px 20px' : '88px 28px', background: 'var(--surface-2)'
    }}>
      <div style={{ maxWidth: 1200, margin: '0 auto' }}>
        <div style={{ textAlign: 'center', marginBottom: isMobile ? 32 : 48 }}>
          <div style={{
            fontSize: 11.5, fontWeight: 600, color: accent, letterSpacing: 1.4,
            textTransform: 'uppercase', marginBottom: 12
          }}>Pricing</div>
          <h2 style={{ fontSize: isMobile ? 26 : 40, lineHeight: 1.1, letterSpacing: -1.2, fontWeight: 600, margin: '0 0 14px', color: 'var(--text)' }}>
            Start with one procedure. Scale to your whole department.
          </h2>
          <p style={{ fontSize: 16, color: 'var(--muted)', margin: 0, maxWidth: 540, marginLeft: 'auto', marginRight: 'auto' }}>
            Resident-friendly pricing. Cancel anytime. No credit card required for the free tier.
          </p>
        </div>

        <div style={{
          display: 'grid', gridTemplateColumns: isMobile ? '1fr' : 'repeat(3, 1fr)', gap: 18, alignItems: 'stretch'
        }}>
          {tiers.map((t) => {
            const isFeat = t.featured;
            const cardBg = isFeat ? 'var(--feat-bg)' : 'var(--surface)';
            const cardFg = isFeat ? 'var(--feat-fg)' : 'var(--text)';
            const cardMuted = isFeat ? 'var(--feat-muted)' : 'var(--subtle)';
            const cardText = isFeat ? 'var(--feat-text)' : 'var(--text)';
            const cardBorder = isFeat ? 'var(--feat-bg)' : 'var(--border-strong)';
            const limitsBg = isFeat ? 'var(--feat-overlay)' : 'rgba(120,120,140,0.06)';
            return (
              <div key={t.name} style={{
                position: 'relative',
                background: cardBg,
                color: cardFg,
                border: `1px solid ${cardBorder}`,
                borderRadius: 16,
                padding: '32px 28px',
                display: 'flex', flexDirection: 'column',
                boxShadow: isFeat ? 'var(--shadow-feat)' : 'var(--shadow-card)'
              }}>
                {t.badge &&
                <div style={{
                  position: 'absolute', top: -12, left: '50%', transform: 'translateX(-50%)',
                  background: accent, color: '#ffffff', fontSize: 10.5, fontWeight: 600,
                  padding: '4px 12px', borderRadius: 100, letterSpacing: 0.4, textTransform: 'uppercase',
                  whiteSpace: 'nowrap', boxShadow: `0 6px 14px -4px ${accent}99`
                }}>{t.badge}</div>
                }
                <div style={{
                  fontSize: 11, fontWeight: 600, letterSpacing: 1.4, textTransform: 'uppercase',
                  color: isFeat ? cardMuted : accent
                }}>{t.tag}</div>
                <div style={{ fontSize: 22, fontWeight: 600, letterSpacing: -0.5, marginTop: 6 }}>{t.name}</div>
                <div style={{ display: 'flex', alignItems: 'baseline', gap: 6, marginTop: 14 }}>
                  <span style={{ fontSize: 42, fontWeight: 600, letterSpacing: -1.5, fontFamily: '"Geist Mono", ui-monospace, monospace' }}>{t.price}</span>
                  <span style={{ fontSize: 13, color: cardMuted }}>{t.sub}</span>
                </div>

                <div style={{
                  marginTop: 22, padding: '12px 14px', borderRadius: 10,
                  background: limitsBg,
                  fontSize: 12.5, lineHeight: 1.5,
                  color: cardText,
                  fontFamily: '"Geist Mono", ui-monospace, monospace'
                }}>
                  <div>{t.limits.surgeons}</div>
                  <div>{t.limits.procedures}</div>
                </div>

                <ul style={{ listStyle: 'none', padding: 0, margin: '24px 0 0', display: 'flex', flexDirection: 'column', gap: 9 }}>
                  {t.features.map((f) =>
                  <li key={f} style={{ display: 'flex', gap: 10, alignItems: 'flex-start', fontSize: 13.5, lineHeight: 1.45 }}>
                      <span style={{ color: isFeat ? cardFg : accent, flexShrink: 0, marginTop: 2 }}>
                        <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3"><polyline points="20 6 9 17 4 12"></polyline></svg>
                      </span>
                      <span style={{ color: cardText }}>{f}</span>
                    </li>
                  )}
                </ul>

                <div style={{ flex: 1 }}></div>
                <a href={t.ctaHref || '#'} style={{
                  width: '100%', padding: '11px', fontSize: 13.5, fontWeight: 500,
                  borderRadius: 9, cursor: 'pointer', fontFamily: 'inherit', letterSpacing: -0.1,
                  marginTop: 28,
                  background: isFeat ? cardFg : t.ctaStyle === 'solid' ? 'var(--btn-solid-bg)' : 'var(--btn-ghost-bg)',
                  color: isFeat ? cardBg : t.ctaStyle === 'solid' ? 'var(--btn-solid-fg)' : 'var(--btn-ghost-fg)',
                  border: isFeat ? 'none' : t.ctaStyle === 'ghost' ? '1px solid var(--btn-ghost-border)' : 'none',
                  textDecoration: 'none', textAlign: 'center', display: 'block', boxSizing: 'border-box'
                }}>
                  {t.cta}
                </a>
              </div>);

          })}
        </div>

        <div style={{
          maxWidth: 760, margin: '28px auto 0', textAlign: 'center',
          fontSize: 12.5, color: 'var(--subtle)'
        }}>
          Note: OrthoVaultOS is <strong style={{ color: 'var(--text)', fontWeight: 600 }}>not a HIPAA-protected app</strong>. Do not enter patient identifiers or any PHI. Use only de-identified information.
        </div>
      </div>
    </section>);

}

function Testimonials({ accent }) {
  const isMobile = useIsMobile();
  const quotes = [
  {
    quote: "Walked into my first solo TKA assist actually knowing Dr. Alami's positioning, suture sizes, and which trial she wanted first. Felt like I'd already scrubbed with her ten times.",
    name: 'Dr. Azer',
    org: 'PGY-2 · Orthopaedic Surgery'
  },
  {
    quote: "My attendings stopped repeating themselves. The juniors actually show up prepared. The pearls panel is doing the teaching I used to have to do manually between cases.",
    name: 'Dr. Patel',
    org: 'Chief Resident · Sports Medicine'
  },
  {
    quote: "I used to keep a folder of scribbled prefs cards from every attending. Now it's one app. New rotation, search the surgeon, walk in knowing what they want.",
    name: 'Dr. Samara',
    org: 'PGY-4 · Trauma Service'
  }];


  return (
    <section id="testimonials" style={{
      borderTop: '1px solid var(--border)',
      padding: isMobile ? '48px 20px' : '88px 28px', background: 'var(--surface)'
    }}>
      <div style={{ maxWidth: 1200, margin: '0 auto' }}>
        <div style={{ marginBottom: isMobile ? 28 : 48, maxWidth: 720 }}>
          <div style={{
            fontSize: 11.5, fontWeight: 600, color: accent, letterSpacing: 1.4,
            textTransform: 'uppercase', marginBottom: 12
          }}>From the residents</div>
          <h2 style={{ fontSize: isMobile ? 28 : 38, lineHeight: 1.1, letterSpacing: -1, fontWeight: 600, margin: 0, color: 'var(--text)', textWrap: 'balance' }}>
            The people who actually scrub in.
          </h2>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : 'repeat(3, 1fr)', gap: isMobile ? 16 : 24 }}>
          {quotes.map((q, i) =>
          <figure key={i} style={{
            margin: 0, padding: 28,
            border: '1px solid var(--border)',
            borderRadius: 14, background: 'var(--surface-2)',
            display: 'flex', flexDirection: 'column', gap: 22
          }}>
              <svg width="22" height="18" viewBox="0 0 24 18" fill={accent} style={{ opacity: 0.85 }}>
                <path d="M0 18V10C0 4.5 3.5 0.5 8 0V3.5C5.5 4.5 4 6.5 4 9H8V18H0ZM14 18V10C14 4.5 17.5 0.5 22 0V3.5C19.5 4.5 18 6.5 18 9H22V18H14Z" />
              </svg>
              <blockquote style={{
              margin: 0, fontSize: 16, lineHeight: 1.5, color: 'var(--text)',
              letterSpacing: -0.2, textWrap: 'pretty'
            }}>
                {q.quote}
              </blockquote>
              <figcaption style={{
              display: 'flex', alignItems: 'center', gap: 10,
              paddingTop: 16, borderTop: '1px solid var(--border)',
              marginTop: 'auto'
            }}>
                <div style={{
                width: 30, height: 30, borderRadius: 8,
                background: 'var(--btn-solid-bg)', color: 'var(--btn-solid-fg)',
                display: 'flex', alignItems: 'center', justifyContent: 'center',
                fontSize: 10.5, fontFamily: '"Geist Mono", ui-monospace, monospace', fontWeight: 600
              }}>{q.name.split(' ').map((w) => w[0]).join('').slice(0, 2)}</div>
                <div>
                  <div style={{ fontSize: 13, fontWeight: 600, color: 'var(--text)' }}>{q.name}</div>
                  <div style={{ fontSize: 11.5, color: 'var(--subtle)' }}>{q.org}</div>
                </div>
              </figcaption>
            </figure>
          )}
        </div>
      </div>
    </section>);

}

function CallToAction({ accent }) {
  const isMobile = useIsMobile();
  return (
    <section style={{
      borderTop: '1px solid var(--border)',
      background: 'var(--bg)',
      padding: isMobile ? '40px 20px' : '56px 28px',
      position: 'relative',
      overflow: 'hidden'
    }}>
      {/* Crimson glow echoing the hero */}
      <div style={{
        position: 'absolute', inset: 0, background:
        `radial-gradient(40% 60% at 50% 50%, ${accent}10, ${accent}05 40%, transparent 70%)`,
        pointerEvents: 'none'
      }}></div>
      <div style={{
        position: 'relative', maxWidth: 820, margin: '0 auto', textAlign: 'center'
      }}>
        <div style={{ display: 'flex', justifyContent: 'center', marginBottom: 16 }}>
          <HeroBrandMark size={isMobile ? 64 : 90} haloScale="220%" />
        </div>
        <h2 style={{
          fontSize: isMobile ? 28 : 40, lineHeight: 1.05, letterSpacing: -1.2, fontWeight: 600,
          margin: '0 0 14px', color: 'var(--text)', textWrap: 'balance'
        }}>
          Join surgeons{' '}
          <span style={{
            color: accent, fontWeight: 600,
            textTransform: 'uppercase', letterSpacing: -0.4
          }}>mastering</span>{' '}
          their craft.
        </h2>
        <p style={{
          fontSize: 16, lineHeight: 1.6, color: 'var(--muted)',
          margin: '0 auto 22px', maxWidth: 580, textWrap: 'pretty'
        }}>
          Start free. Learn how your technique compares to the best. Upgrade when you're ready.
        </p>
        <a href="download.html" style={{
          background: 'var(--btn-solid-bg)', color: 'var(--btn-solid-fg)', border: 'none',
          padding: '15px 28px', borderRadius: 10, fontSize: 15, fontWeight: 500,
          cursor: 'pointer', fontFamily: 'inherit', letterSpacing: -0.1,
          display: 'inline-flex', alignItems: 'center', gap: 10,
          boxShadow: `0 10px 30px -10px ${accent}55`,
          textDecoration: 'none'
        }}>
          Get started free
          <span style={{ fontSize: 12, opacity: 0.55, fontFamily: '"Geist Mono", ui-monospace, monospace' }}>→</span>
        </a>
      </div>
    </section>);

}

function Footer({ accent }) {
  const isMobile = useIsMobile();
  return (
    <footer style={{
      borderTop: '1px solid var(--border)',
      background: 'var(--surface-2)', padding: isMobile ? '40px 20px 28px' : '56px 28px 36px'
    }}>
      <div style={{
        maxWidth: 1200, margin: '0 auto',
        display: 'grid', gridTemplateColumns: isMobile ? '1fr 1fr' : '1.5fr 1fr 1fr 1fr', gap: isMobile ? 28 : 36
      }}>
        <div style={isMobile ? { gridColumn: '1 / -1' } : undefined}>
          <Logo accent={accent} />
          <p style={{ fontSize: 13, color: 'var(--subtle)', marginTop: 14, lineHeight: 1.55, maxWidth: 280 }}>
            Built for any surgical subspecialty — currently ships with orthopedic templates, with more subspecialties coming.
          </p>
        </div>
        {[
        { h: 'Product', links: [{ label: 'Download', href: 'download.html' }, { label: 'How it works', href: 'index.html#how' }, { label: 'Pricing', href: 'index.html#pricing' }] },
        { h: 'Resources', links: [
          { label: 'Procedure library', href: 'procedure-library.html' },
          { label: 'Resident guide', href: 'resident-guide.html' },
          { label: 'FAQ', href: 'faq.html' },
          { label: 'Support', href: 'support.html' }]
        },
        { h: 'Company', links: [
          { label: 'About', href: 'about.html' },
          { label: 'Privacy', href: 'about.html#privacy' },
          { label: 'Terms', href: 'about.html#terms' },
          { label: 'Medical Disclaimer', href: 'about.html#disclaimer' }]
        }].
        map((col) =>
        <div key={col.h}>
            <div style={{ fontSize: 11.5, fontWeight: 600, color: 'var(--text)', letterSpacing: 0.8, textTransform: 'uppercase', marginBottom: 14 }}>{col.h}</div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 9 }}>
              {col.links.map((l) => {
              const label = typeof l === 'string' ? l : l.label;
              const href = typeof l === 'string' ? '#' : l.href;
              return (
                <a key={label} href={href} style={{ fontSize: 13, color: 'var(--muted)', textDecoration: 'none' }}>{label}</a>);
            })}
            </div>
          </div>
        )}
      </div>
      <div style={{
        maxWidth: 1200, margin: isMobile ? '28px auto 0' : '40px auto 0',
        paddingTop: 22, borderTop: '1px solid var(--border-soft)',
        display: 'flex', flexDirection: isMobile ? 'column' : 'row', gap: isMobile ? 8 : 0,
        justifyContent: 'space-between', alignItems: isMobile ? 'flex-start' : 'center',
        fontSize: 12, color: 'var(--subtle)'
      }}>
        <span>© 2026 OrthoVaultOS · Built by surgeons, for surgeons.</span>
        <span style={{ fontFamily: '"Geist Mono", ui-monospace, monospace' }}>v1.4.2</span>
      </div>
    </footer>);

}

Object.assign(window, { Nav, HeroSplit, HeroCentered, HeroEditorial, OldWay, HowItWorks, BuiltForSurgeons, InTheOR, OtherSpecialties, Pricing, Testimonials, CallToAction, Footer });