// Mobile-native marketing site for The Fone Shop
// 390px design target. Touch-first, stacked, single-column.

const { useState, useEffect, useRef } = React;

// ---------- SHARED TOKENS ----------
const ORANGE = '#FF6B1A';
const BG = '#000';
const CARD = '#0a0a0a';
const BORDER = '#1f1f1f';
const MUTED = '#86868b';

// ---------- PRIMITIVES ----------

const Btn = ({ children, onClick, variant = 'primary', full = false, icon, style }) => {
  const [press, setPress] = useState(false);
  const base = {
    height: 52, padding: '0 22px', border: 0, borderRadius: 10,
    fontFamily: 'Inter, system-ui', fontSize: 16, fontWeight: 500,
    letterSpacing: '-0.022em', cursor: 'pointer',
    display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 10,
    width: full ? '100%' : 'auto',
    transition: 'transform 120ms, background 150ms',
    transform: press ? 'scale(0.97)' : 'scale(1)',
    touchAction: 'manipulation',
  };
  const v = variant === 'primary'
    ? { background: press ? '#B8450C' : ORANGE, color: 'var(--accent-text, #000)' }
    : { background: 'transparent', color: 'var(--accent)', boxShadow: 'inset 0 0 0 1px var(--border)' };
  return (
    <button onClick={onClick}
      onPointerDown={() => setPress(true)}
      onPointerUp={() => setPress(false)}
      onPointerLeave={() => setPress(false)}
      style={{ ...base, ...v, ...style }}>
      {icon}{children}
    </button>
  );
};

const Eyebrow = ({ children, style }) => (
  <div style={{ fontSize: 11, fontWeight: 500, letterSpacing: '0.2em', color: MUTED, textTransform: 'uppercase', ...style }}>
    {children}
  </div>
);

const OpenDot = () => (
  <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 12, color: 'var(--fg)' }}>
    <span style={{ width: 7, height: 7, borderRadius: '50%', background: '#30d158', boxShadow: '0 0 8px #30d158', animation: 'pulse 2.4s ease-in-out infinite' }} />
    Open until 7pm
  </span>
);

// ---------- MOBILE HEADER ----------

const MHeader = ({ scrolled, onMenu }) => (
  <header style={{
    position: 'sticky', top: 0, zIndex: 55,
    height: 64,
    background: 'var(--header-blur-bg)',
    backdropFilter: `saturate(180%) blur(${scrolled ? 20 : 14}px)`,
    WebkitBackdropFilter: `saturate(180%) blur(${scrolled ? 20 : 14}px)`,
    borderBottom: `1px solid ${scrolled ? 'var(--border-soft)' : 'transparent'}`,
    transition: 'all 250ms ease',
    display: 'flex', alignItems: 'center', justifyContent: 'space-between',
    padding: '0 16px',
  }}>
    <a href="#top" aria-label="The Fone Shop" style={{ display: 'inline-flex', alignItems: 'center', textDecoration: 'none' }}>
      <img src="../../assets/the-fone-shop-logo-mark.png" alt="The Fone Shop" style={{ height: 72, width: 'auto', display: 'block', marginLeft: -12 }} />
    </a>
    <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
      {typeof ThemeToggle !== 'undefined' && <ThemeToggle />}
      <button aria-label="Menu" onClick={onMenu}
        style={{
          width: 44, height: 44, background: 'var(--surface-2)', border: 0,
          borderRadius: 10, cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center',
        }}>
        <svg width="18" height="12" viewBox="0 0 18 12" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" style={{ color: 'var(--fg)' }}>
          <path d="M1 1h16M1 6h16M1 11h16" />
        </svg>
      </button>
    </div>
  </header>
);

const MenuSheet = ({ open, onClose, onNav }) => {
  useEffect(() => {
    if (!open) return;
    const prev = document.body.style.overflow;
    document.body.style.overflow = 'hidden';
    const onKey = (e) => { if (e.key === 'Escape') onClose(); };
    window.addEventListener('keydown', onKey);
    return () => {
      document.body.style.overflow = prev;
      window.removeEventListener('keydown', onKey);
    };
  }, [open, onClose]);

  const links = [
    ['Repairs', 'services', 'tool'],
    ['Pricing', 'pricing', 'tag'],
    ['Before / After', 'before-after', 'swap'],
    ['How it works', 'how', 'path'],
    ['Reviews', 'reviews', 'star'],
    ['Contact', 'contact', 'pin'],
  ];

  const icon = (k) => {
    const common = { width: 18, height: 18, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' };
    switch (k) {
      case 'tool':  return <svg {...common}><path d="M14.7 6.3a4 4 0 0 0-5 5L3 18l3 3 6.7-6.7a4 4 0 0 0 5-5l-2 2-2.7-.4-.4-2.7 2-1.9z"/></svg>;
      case 'tag':   return <svg {...common}><path d="M20.6 13.4L12 22l-9-9V4h9l8.6 8.6a2 2 0 0 1 0 2.8z"/><circle cx="7.5" cy="7.5" r="1.5"/></svg>;
      case 'swap':  return <svg {...common}><path d="M17 3l4 4-4 4M3 11V7a4 4 0 0 1 4-4h14M7 21l-4-4 4-4M21 13v4a4 4 0 0 1-4 4H3"/></svg>;
      case 'path':  return <svg {...common}><path d="M6 7h6a6 6 0 0 1 6 6v4"/><path d="M9 4 6 7l3 3M15 14l3 3-3 3"/></svg>;
      case 'star':  return <svg {...common}><polygon points="12 2 15 9 22 9.3 16.5 13.9 18.5 21 12 17.3 5.5 21 7.5 13.9 2 9.3 9 9 12 2"/></svg>;
      case 'pin':   return <svg {...common}><path d="M12 22s7-7.5 7-13a7 7 0 0 0-14 0c0 5.5 7 13 7 13z"/><circle cx="12" cy="9" r="2.5"/></svg>;
      case 'admin': return <svg {...common}><rect x="5" y="2" width="14" height="20" rx="3"/><path d="M12 18h.01"/></svg>;
      case 'cam':   return <svg {...common}><path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/></svg>;
      case 'key':   return <svg {...common}><circle cx="8" cy="15" r="4"/><path d="M10.85 12.15L19 4M18 5l3 3M15 8l3 3"/></svg>;
      default: return null;
    }
  };

  return (
    <div aria-hidden={!open} onClick={onClose} style={{
      position: 'fixed', inset: 0, zIndex: 90,
      background: 'rgba(0,0,0,0.55)',
      backdropFilter: 'blur(14px) saturate(140%)',
      WebkitBackdropFilter: 'blur(14px) saturate(140%)',
      opacity: open ? 1 : 0,
      pointerEvents: open ? 'auto' : 'none',
      transition: 'opacity 260ms cubic-bezier(0.25,0.1,0.25,1)',
    }}>
      <aside
        role="dialog" aria-modal="true" aria-label="Menu"
        onClick={e => e.stopPropagation()}
        style={{
          position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,
          background: 'var(--bg)',
          padding: 'max(14px, env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom))',
          transform: open ? 'translateY(0)' : 'translateY(-100%)',
          transition: 'transform 360ms cubic-bezier(0.32,0.72,0,1)',
          display: 'flex', flexDirection: 'column',
          overflowY: 'auto',
        }}
      >
        {/* Top row: logo + status + close */}
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 18 }}>
          <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
            <img src="../../assets/the-fone-shop-logo-mark.png" alt="" style={{ height: 48, width: 'auto', marginLeft: -8 }} />
          </div>
          <button onClick={onClose} aria-label="Close" style={{
            width: 40, height: 40, background: 'var(--surface-2)', border: 0,
            borderRadius: 12, cursor: 'pointer', color: 'var(--fg)', fontSize: 18,
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
          }}>
            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><path d="M18 6L6 18M6 6l12 12"/></svg>
          </button>
        </div>

        {/* Status pills */}
        <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap', alignItems: 'center', marginBottom: 18 }}>
          <OpenDot />
          {typeof RepairCounter !== 'undefined' && <RepairCounter />}
        </div>

        {/* Nav with icons + right chevron */}
        <nav style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
          {links.map(([n, id, ic], i) => (
            <a key={id} href={`#${id}`}
              onClick={e => { e.preventDefault(); onNav(id); }}
              style={{
                display: 'flex', alignItems: 'center', justifyContent: 'space-between',
                padding: '14px 12px', borderRadius: 12,
                fontSize: 20, fontWeight: 500, letterSpacing: '-0.02em',
                color: 'var(--fg)', textDecoration: 'none',
                transition: 'background 160ms',
                opacity: open ? 1 : 0,
                transform: open ? 'translateX(0)' : 'translateX(12px)',
                animation: open ? `fadeSlide 360ms ${80 + i * 45}ms cubic-bezier(0.32,0.72,0,1) both` : 'none',
              }}
              onMouseEnter={e => { e.currentTarget.style.background = 'var(--surface-2)'; }}
              onMouseLeave={e => { e.currentTarget.style.background = 'transparent'; }}
            >
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 14 }}>
                <span style={{
                  width: 36, height: 36, borderRadius: 10,
                  background: 'var(--accent-soft, rgba(255,107,26,0.12))',
                  color: 'var(--accent)',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                }}>{icon(ic)}</span>
                {n}
              </span>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ color: 'var(--fg-3)' }}><path d="M9 18l6-6-6-6"/></svg>
            </a>
          ))}
        </nav>

        {/* Primary CTA */}
        <div style={{ marginTop: 18 }}>
          <Btn full onClick={() => { onClose(); onNav('pricing'); }} icon={icon('cam')}>Snap a quote</Btn>
        </div>

        {/* Other kits — the admin + camera flows */}
        <div style={{ marginTop: 24 }}>
          <div style={{ fontSize: 11, color: 'var(--fg-3)', letterSpacing: '0.14em', textTransform: 'uppercase', marginBottom: 10, padding: '0 4px' }}>
            Owner tools
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
            <a href="../admin/" style={{
              display: 'flex', alignItems: 'center', justifyContent: 'space-between',
              padding: '12px 14px', borderRadius: 12,
              background: 'var(--surface-2)', color: 'var(--fg)', textDecoration: 'none',
              border: '1px solid var(--border-soft)',
            }}>
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 12 }}>
                <span style={{ width: 32, height: 32, borderRadius: 8, background: 'var(--accent-soft, rgba(255,107,26,0.12))', color: 'var(--accent)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>{icon('admin')}</span>
                <span style={{ display: 'flex', flexDirection: 'column' }}>
                  <span style={{ fontSize: 15, fontWeight: 500, letterSpacing: '-0.011em' }}>Admin PWA</span>
                  <span style={{ fontSize: 12, color: 'var(--fg-3)' }}>Leads · Bookings · Shop · Settings</span>
                </span>
              </span>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ color: 'var(--fg-3)' }}><path d="M7 17L17 7M7 7h10v10"/></svg>
            </a>
            <a href="../camera_quote/" style={{
              display: 'flex', alignItems: 'center', justifyContent: 'space-between',
              padding: '12px 14px', borderRadius: 12,
              background: 'var(--surface-2)', color: 'var(--fg)', textDecoration: 'none',
              border: '1px solid var(--border-soft)',
            }}>
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 12 }}>
                <span style={{ width: 32, height: 32, borderRadius: 8, background: 'var(--accent-soft, rgba(255,107,26,0.12))', color: 'var(--accent)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>{icon('cam')}</span>
                <span style={{ display: 'flex', flexDirection: 'column' }}>
                  <span style={{ fontSize: 15, fontWeight: 500, letterSpacing: '-0.011em' }}>Camera Quote</span>
                  <span style={{ fontSize: 12, color: 'var(--fg-3)' }}>Standalone Pillar 1 flow</span>
                </span>
              </span>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ color: 'var(--fg-3)' }}><path d="M7 17L17 7M7 7h10v10"/></svg>
            </a>
            <a href="/sign-in" style={{
              display: 'flex', alignItems: 'center', justifyContent: 'space-between',
              padding: '12px 14px', borderRadius: 12,
              background: 'transparent', color: 'var(--fg-2)', textDecoration: 'none',
              border: '1px dashed var(--border-soft)',
            }}>
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 12 }}>
                <span style={{ width: 32, height: 32, borderRadius: 8, background: 'transparent', color: 'var(--fg-3)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', boxShadow: 'inset 0 0 0 1px var(--border-soft)' }}>{icon('key')}</span>
                <span style={{ fontSize: 14, letterSpacing: '-0.011em' }}>Owner sign-in</span>
              </span>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ color: 'var(--fg-3)' }}><path d="M9 18l6-6-6-6"/></svg>
            </a>
          </div>
        </div>

        {/* Footer: contact row */}
        <div style={{ marginTop: 'auto', paddingTop: 20, borderTop: '1px solid var(--border-soft)' }}>
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>
            <a href="tel:01782343842"
              onClick={() => onClose()}
              style={{
                padding: '12px 10px', borderRadius: 12,
                background: 'var(--accent)', color: 'var(--accent-text, #000)',
                fontSize: 14, fontWeight: 600, letterSpacing: '-0.011em',
                textDecoration: 'none',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 8,
              }}>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6 19.8 19.8 0 0 1-3.1-8.7A2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.3 1.8.6 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.5c.9.3 1.8.5 2.7.6a2 2 0 0 1 1.7 2z"/></svg>
              Call shop
            </a>
            <a href="https://www.facebook.com/thefoneshopst3" target="_blank" rel="noopener"
              onClick={() => onClose()}
              style={{
                padding: '12px 10px', borderRadius: 12,
                background: 'transparent', color: 'var(--accent)',
                fontSize: 14, fontWeight: 500, letterSpacing: '-0.011em',
                textDecoration: 'none',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 8,
                boxShadow: 'inset 0 0 0 1px var(--border)',
              }}>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
              Message
            </a>
          </div>
          <div style={{ marginTop: 14, fontSize: 12, color: 'var(--fg-3)', letterSpacing: '-0.011em', lineHeight: 1.5 }}>
            27 The Strand, Longton · ST3 2NR<br/>
            Open until 7pm today
          </div>
        </div>
      </aside>
    </div>
  );
};

// ---------- MOBILE HERO ----------

const MHero = ({ onSnap }) => (
  <section id="top" style={{
    position: 'relative',
    minHeight: 'min(92vh, 780px)',
    padding: '100px 20px 32px', overflow: 'hidden',
    color: '#fff',
    background: '#000',
    display: 'flex', flexDirection: 'column', justifyContent: 'center',
  }}>
    {/* Full-bleed hero video — iOS-safe autoplay */}
    <video
      aria-hidden="true"
      autoPlay muted loop playsInline
      webkit-playsinline=""
      preload="auto"
      disableRemotePlayback
      controls={false}
      poster="../../assets/hero-teardown-poster.jpg"
      ref={(el) => {
        if (!el) return;
        el.muted = true;
        el.defaultMuted = true;
        el.playsInline = true;
        el.setAttribute('playsinline', '');
        el.setAttribute('webkit-playsinline', '');
        el.setAttribute('muted', '');
        const tryPlay = () => {
          const p = el.play();
          if (p && p.catch) p.catch(() => {
            const kick = () => { el.play().catch(() => {}); document.removeEventListener('touchstart', kick); document.removeEventListener('click', kick); };
            document.addEventListener('touchstart', kick, { once: true, passive: true });
            document.addEventListener('click', kick, { once: true });
          });
        };
        tryPlay();
        el.addEventListener('loadeddata', tryPlay, { once: true });
      }}
      style={{
        position: 'absolute', inset: 0, zIndex: 0,
        width: '100%', height: '100%',
        objectFit: 'cover', objectPosition: 'center',
        pointerEvents: 'none',
      }}
    >
      <source src="../../assets/hero-teardown.webm" type="video/webm" />
      <source src="../../assets/hero-teardown.mp4" type="video/mp4" />
    </video>

    {/* Readability overlay — bottom-heavy gradient so the title floats over
        the video and the copy at the bottom is solidly legible */}
    <div aria-hidden="true" style={{
      position: 'absolute', inset: 0, zIndex: 1,
      background: [
        'linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 25%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.88) 100%)',
        'radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 55%)',
      ].join(', '),
      pointerEvents: 'none',
    }} />

    <div style={{ position: 'relative', zIndex: 2 }}>
      <Eyebrow style={{ marginBottom: 16, color: 'rgba(255,255,255,0.75)' }}>Since 2012 · Longton</Eyebrow>
      <h1 style={{
        margin: 0,
        fontSize: 'clamp(38px, 12vw, 56px)',
        fontWeight: 600, letterSpacing: '-0.03em',
        lineHeight: 1.02, color: '#fff',
        textShadow: '0 2px 30px rgba(0,0,0,0.55)',
      }}>
        Drop it off.<br/>Grab a coffee.<br/>Collect it fixed.
      </h1>
      <p style={{
        margin: '20px 0 0',
        fontSize: 'clamp(15px, 4.2vw, 18px)',
        color: 'rgba(255,255,255,0.85)',
        lineHeight: 1.45, letterSpacing: '-0.011em',
        textShadow: '0 1px 20px rgba(0,0,0,0.55)',
      }}>
        If it's broken, we'll open it. Same pair of hands, same day, since 2012.
      </p>
    </div>

    <div style={{ marginTop: 'auto', paddingTop: 40, position: 'relative', zIndex: 2, display: 'flex', flexDirection: 'column', gap: 10 }}>
      <Btn full onClick={onSnap} icon={
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/></svg>
      }>Snap a quote</Btn>
      <Btn full variant="secondary" onClick={() => window.open('https://www.facebook.com/thefoneshopst3', '_blank')}>Message us</Btn>
    </div>
  </section>
);

// ---------- TRUST STRIP ----------

const MTrust = () => (
  <section style={{
    padding: '32px 20px', borderTop: `1px solid ${BORDER}`, borderBottom: `1px solid ${BORDER}`,
  }}>
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 24 }}>
      {[['Since 2012', 'on The Strand'], ['< 1 hr', 'most repairs'], ['12 mo', 'warranty'], ['Open it', 'no send-offs']].map(([k, v]) => (
        <div key={k}>
          <div style={{ fontSize: 26, fontWeight: 600, letterSpacing: '-0.02em' }}>{k}</div>
          <div style={{ marginTop: 2, fontSize: 12, color: MUTED }}>{v}</div>
        </div>
      ))}
    </div>
  </section>
);

// ---------- MOBILE CALCULATOR ----------

const BRANDS = ['Apple', 'Samsung', 'Google', 'Other'];
const MODELS = {
  Apple: ['iPhone 15', 'iPhone 14', 'iPhone 13', 'iPhone 12', 'Older'],
  Samsung: ['Galaxy S24', 'Galaxy S23', 'Galaxy S22', 'A-series'],
  Google: ['Pixel 8', 'Pixel 7', 'Pixel 6'],
  Other: ['Tell us'],
};
const FIXES = [
  ['Screen', '📱', { 'iPhone 15': 189, 'iPhone 14': 149, 'iPhone 13': 119, 'iPhone 12': 99, 'Older': 79, 'Galaxy S24': 199, 'Galaxy S23': 169, 'Galaxy S22': 139, 'A-series': 79, 'Pixel 8': 159, 'Pixel 7': 139, 'Pixel 6': 119, 'Tell us': 0 }],
  ['Battery', '🔋', { 'iPhone 15': 69, 'iPhone 14': 59, 'iPhone 13': 55, 'iPhone 12': 49, 'Older': 45, 'Galaxy S24': 69, 'Galaxy S23': 65, 'Galaxy S22': 59, 'A-series': 45, 'Pixel 8': 65, 'Pixel 7': 59, 'Pixel 6': 55, 'Tell us': 0 }],
  ['Charge port', '🔌', { 'iPhone 15': 55, 'iPhone 14': 55, 'iPhone 13': 55, 'iPhone 12': 55, 'Older': 45, 'Galaxy S24': 55, 'Galaxy S23': 55, 'Galaxy S22': 55, 'A-series': 45, 'Pixel 8': 55, 'Pixel 7': 55, 'Pixel 6': 55, 'Tell us': 0 }],
  ['Back glass', '🪟', { 'iPhone 15': 89, 'iPhone 14': 79, 'iPhone 13': 69, 'iPhone 12': 59, 'Older': 49, 'Galaxy S24': 99, 'Galaxy S23': 89, 'Galaxy S22': 79, 'A-series': 49, 'Pixel 8': 79, 'Pixel 7': 69, 'Pixel 6': 59, 'Tell us': 0 }],
];

const Chip = ({ label, icon, selected, onClick }) => (
  <button onClick={onClick} style={{
    padding: '14px 16px', minHeight: 52,
    background: selected ? ORANGE : CARD,
    color: selected ? '#000' : '#fff',
    border: `1px solid ${selected ? ORANGE : BORDER}`,
    borderRadius: 12, cursor: 'pointer',
    fontFamily: 'Inter', fontSize: 15, fontWeight: 500,
    letterSpacing: '-0.011em',
    display: 'flex', alignItems: 'center', gap: 8,
    textAlign: 'left',
    transition: 'all 150ms',
  }}>
    {icon && <span style={{ fontSize: 18 }}>{icon}</span>}
    {label}
  </button>
);

const useCountUp = (target, ms = 500) => {
  const [v, setV] = useState(target);
  const ref = useRef(target);
  useEffect(() => {
    const start = ref.current;
    const delta = target - start;
    const t0 = performance.now();
    let raf;
    const tick = (t) => {
      const p = Math.min(1, (t - t0) / ms);
      const eased = 1 - Math.pow(1 - p, 3);
      setV(Math.round(start + delta * eased));
      if (p < 1) raf = requestAnimationFrame(tick);
      else ref.current = target;
    };
    raf = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(raf);
  }, [target]);
  return v;
};

const MCalculator = () => {
  const [brand, setBrand] = useState(null);
  const [model, setModel] = useState(null);
  const [fix, setFix] = useState(null);
  const price = fix && model ? (FIXES.find(f => f[0] === fix)?.[2]?.[model] ?? 0) : 0;
  const display = useCountUp(price);

  const reset = () => { setBrand(null); setModel(null); setFix(null); };

  return (
    <section id="pricing" style={{ padding: '64px 20px', background: 'transparent' }}>
      <Eyebrow>Live pricing</Eyebrow>
      <h2 style={{ margin: '10px 0 8px', fontSize: 36, fontWeight: 600, letterSpacing: '-0.025em', lineHeight: 1.05 }}>
        Tap your<br/>way to a quote.
      </h2>
      <p style={{ margin: 0, fontSize: 15, color: MUTED, lineHeight: 1.45 }}>
        Three taps. Real starting price. Firmed up in 5 minutes, in the shop.
      </p>

      {/* Steps */}
      <div style={{ marginTop: 28 }}>
        {/* Step 1 */}
        <Step num={1} label="Brand" active={!brand} done={!!brand} value={brand} onEdit={() => { setBrand(null); setModel(null); setFix(null); }}>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 8 }}>
            {BRANDS.map(b => <Chip key={b} label={b} selected={brand === b} onClick={() => setBrand(b)} />)}
          </div>
        </Step>

        {/* Step 2 */}
        {brand && (
          <Step num={2} label="Model" active={!model} done={!!model} value={model} onEdit={() => { setModel(null); setFix(null); }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
              {MODELS[brand].map(m => <Chip key={m} label={m} selected={model === m} onClick={() => setModel(m)} />)}
            </div>
          </Step>
        )}

        {/* Step 3 */}
        {model && (
          <Step num={3} label="Fix" active={!fix} done={!!fix} value={fix} onEdit={() => setFix(null)}>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 8 }}>
              {FIXES.map(([name, icon]) => (
                <Chip key={name} label={name} icon={icon} selected={fix === name} onClick={() => setFix(name)} />
              ))}
            </div>
          </Step>
        )}
      </div>

      {/* Quote card */}
      {fix && (
        <div style={{
          marginTop: 24, padding: 24, borderRadius: 18,
          background: `linear-gradient(150deg, color-mix(in oklab, ${ORANGE} 20%, #0a0a0a), #0a0a0a 70%)`,
          border: `1px solid color-mix(in oklab, ${ORANGE} 30%, transparent)`,
          boxShadow: `0 20px 40px rgba(255,107,26,0.15)`,
          animation: 'fadeSlide 400ms cubic-bezier(0.2,0.9,0.3,1)',
        }}>
          <div style={{ fontSize: 11, fontWeight: 500, letterSpacing: '0.2em', color: '#FFA366', textTransform: 'uppercase' }}>Your quote</div>
          <div style={{ marginTop: 8, fontSize: 14, color: 'var(--fg-2)' }}>
            {model} · {fix}
          </div>
          {price === 0 ? (
            <div style={{ marginTop: 16, fontSize: 22, fontWeight: 600 }}>Message us — we'll price it fairly</div>
          ) : (
            <>
              <div style={{ marginTop: 12, display: 'flex', alignItems: 'baseline', gap: 8 }}>
                <div style={{ fontSize: 64, fontWeight: 700, letterSpacing: '-0.04em', lineHeight: 1, fontFeatureSettings: '"tnum"' }}>£{display}</div>
                <div style={{ fontSize: 13, color: MUTED }}>usually same day</div>
              </div>
              <div style={{ marginTop: 14, fontSize: 12, color: MUTED, lineHeight: 1.5 }}>
                Price includes parts, labour, and our 12-month warranty. No fix, no fee.
              </div>
            </>
          )}
          <div style={{ marginTop: 20, display: 'flex', flexDirection: 'column', gap: 8 }}>
            <Btn full onClick={() => window.location.href = 'tel:01782343842'} icon={<span style={{ fontSize: 16 }}>☎</span>}>Call to book</Btn>
            <Btn full variant="secondary" onClick={reset}>Start again</Btn>
          </div>
        </div>
      )}
    </section>
  );
};

const Step = ({ num, label, active, done, value, onEdit, children }) => (
  <div style={{
    marginTop: 16, padding: '16px 16px 18px',
    background: active ? CARD : 'transparent',
    border: `1px solid ${active ? BORDER : 'transparent'}`,
    borderRadius: 14,
  }}>
    <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: active ? 12 : 0 }}>
      <div style={{
        width: 24, height: 24, borderRadius: '50%',
        background: done ? ORANGE : 'var(--surface-2)',
        color: done ? '#000' : MUTED,
        display: 'flex', alignItems: 'center', justifyContent: 'center',
        fontSize: 12, fontWeight: 600, fontFamily: 'JetBrains Mono, monospace',
      }}>{done ? '✓' : num}</div>
      <div style={{ flex: 1, fontSize: 14, fontWeight: 500, color: active ? '#fff' : MUTED }}>
        {label}{value && <span style={{ color: 'var(--fg)', fontWeight: 400 }}> · {value}</span>}
      </div>
      {done && (
        <button onClick={onEdit} style={{
          background: 'transparent', border: 0, color: ORANGE,
          fontSize: 13, cursor: 'pointer', padding: 4,
        }}>Edit</button>
      )}
    </div>
    {active && children}
  </div>
);

// ---------- BEFORE / AFTER ----------

const MBeforeAfter = () => {
  const [x, setX] = useState(50);
  const ref = useRef(null);
  const onMove = (clientX) => {
    const r = ref.current.getBoundingClientRect();
    const pct = Math.max(2, Math.min(98, ((clientX - r.left) / r.width) * 100));
    setX(pct);
  };
  return (
    <section id="before-after" style={{ padding: '64px 20px', background: 'transparent' }}>
      <Eyebrow>Before / after</Eyebrow>
      <h2 style={{ margin: '10px 0 20px', fontSize: 34, fontWeight: 600, letterSpacing: '-0.025em', lineHeight: 1.05 }}>
        Drag to see<br/>what 47 minutes does.
      </h2>

      <div ref={ref}
        onPointerDown={e => { e.currentTarget.setPointerCapture(e.pointerId); onMove(e.clientX); }}
        onPointerMove={e => { if (e.buttons) onMove(e.clientX); }}
        style={{
          position: 'relative', aspectRatio: '1 / 1', borderRadius: 16,
          background: 'var(--bg-2)', overflow: 'hidden', touchAction: 'none',
          border: `1px solid ${BORDER}`, cursor: 'ew-resize', userSelect: 'none',
        }}>
        {/* after (fixed) */}
        <svg viewBox="0 0 400 400" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
          <rect width="400" height="400" fill="#0a0a0a"/>
          <rect x="80" y="30" width="240" height="340" rx="34" fill="#1d1d1f"/>
          <rect x="92" y="42" width="216" height="316" rx="26" fill="#0a0808"/>
          <rect x="160" y="50" width="80" height="20" rx="10" fill="#000"/>
          <rect x="92" y="42" width="216" height="316" rx="26" fill="url(#fg)" opacity="0.6"/>
          <defs>
            <linearGradient id="fg" x1="0" x2="1" y1="0" y2="1">
              <stop offset="0%" stopColor="#FF6B1A" stopOpacity="0.3"/>
              <stop offset="100%" stopColor="#FF6B1A" stopOpacity="0"/>
            </linearGradient>
          </defs>
        </svg>
        {/* before (cracked) */}
        <svg viewBox="0 0 400 400" style={{
          position: 'absolute', inset: 0, width: '100%', height: '100%',
          clipPath: `inset(0 ${100 - x}% 0 0)`,
          WebkitClipPath: `inset(0 ${100 - x}% 0 0)`,
        }}>
          <rect width="400" height="400" fill="#0a0a0a"/>
          <rect x="80" y="30" width="240" height="340" rx="34" fill="#1d1d1f"/>
          <rect x="92" y="42" width="216" height="316" rx="26" fill="#0a0808"/>
          <rect x="160" y="50" width="80" height="20" rx="10" fill="#000"/>
          <g stroke={ORANGE} strokeWidth="0.9" fill="none" opacity="0.95">
            <path d="M 130 80 L 200 180 L 280 140 L 250 240 L 300 330" />
            <path d="M 200 180 L 110 240 L 140 320" />
            <path d="M 200 180 L 240 60" />
            <path d="M 280 140 L 300 80" />
            <path d="M 250 240 L 180 300" />
          </g>
          <circle cx="130" cy="80" r="4" fill={ORANGE}/>
        </svg>
        {/* labels */}
        <div style={{ position: 'absolute', top: 14, left: 14, fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: ORANGE, letterSpacing: '0.2em' }}>BEFORE</div>
        <div style={{ position: 'absolute', top: 14, right: 14, fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: 'var(--fg)', letterSpacing: '0.2em' }}>AFTER</div>

        {/* slider line + handle */}
        <div style={{
          position: 'absolute', top: 0, bottom: 0, left: `${x}%`, width: 2,
          background: ORANGE, transform: 'translateX(-1px)', pointerEvents: 'none',
          boxShadow: '0 0 12px rgba(255,107,26,0.5)',
        }}>
          <div style={{
            position: 'absolute', top: '50%', left: '50%',
            transform: 'translate(-50%, -50%)', width: 44, height: 44,
            borderRadius: '50%', background: ORANGE,
            display: 'flex', alignItems: 'center', justifyContent: 'center',
            boxShadow: '0 4px 12px rgba(0,0,0,0.4)',
          }}>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="#000" strokeWidth="2">
              <path d="M6 4l-4 4 4 4M10 4l4 4-4 4"/>
            </svg>
          </div>
        </div>
      </div>

      {/* stats */}
      <div style={{ marginTop: 20, display: 'flex', justifyContent: 'space-between', padding: '0 4px' }}>
        {[['47m', 'workbench to done'], ['£129', 'fixed, not refurb'], ['12mo', 'warranty']].map(([k, v]) => (
          <div key={k} style={{ whiteSpace: 'nowrap' }}>
            <div style={{ fontSize: 20, fontWeight: 600, letterSpacing: '-0.015em' }}>{k}</div>
            <div style={{ marginTop: 2, fontSize: 11, color: MUTED }}>{v}</div>
          </div>
        ))}
      </div>
    </section>
  );
};

// ---------- SERVICES ----------

const MServices = () => {
  const items = [
    ['01', 'phone', 'Phone repair', "Screens in 40 min. Boards same day. No send-offs."],
    ['02', 'tablet', 'Tablet repair', 'iPads, Samsung, Kindle. Digitisers relaminated — not bodged.'],
    ['03', 'laptop', 'Laptop repair', "Screens, keyboards, boards. Write-offs welcome — show us first."],
    ['04', 'console', 'Console repair', 'PS5, Xbox, Switch. HDMI drop-ins, disc drives, fan rebuilds.'],
  ];
  const shapes = {
    phone: <><rect x="70" y="18" width="60" height="124" rx="12" stroke="currentColor" strokeWidth="1.5" fill="none"/><rect x="78" y="26" width="44" height="108" rx="5" fill="#050505"/></>,
    tablet: <><rect x="40" y="25" width="120" height="110" rx="10" stroke="currentColor" strokeWidth="1.5" fill="none"/><rect x="48" y="32" width="104" height="96" rx="3" fill="#050505"/></>,
    laptop: <><path d="M 30 110 L 30 50 Q 30 42, 38 42 L 162 42 Q 170 42, 170 50 L 170 110 Z" stroke="currentColor" strokeWidth="1.5" fill="none"/><rect x="38" y="50" width="124" height="60" rx="2" fill="#050505"/><path d="M 20 115 L 180 115 L 174 130 L 26 130 Z" stroke="currentColor" strokeWidth="1.5" fill="none"/></>,
    console: <><rect x="20" y="60" width="160" height="70" rx="10" stroke="currentColor" strokeWidth="1.5" fill="none"/><circle cx="55" cy="95" r="10" fill="#050505" stroke="currentColor" strokeWidth="1.5"/><circle cx="145" cy="95" r="10" fill="#050505" stroke="currentColor" strokeWidth="1.5"/></>,
  };
  return (
    <section id="services" style={{ padding: '64px 20px', background: 'transparent' }}>
      <Eyebrow>Repairs</Eyebrow>
      <h2 style={{ margin: '10px 0 24px', fontSize: 34, fontWeight: 600, letterSpacing: '-0.025em', lineHeight: 1.05 }}>
        Whatever's broken.<br/>Probably fixable.
      </h2>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
        {items.map(([n, slug, title, body]) => (
          <div key={n} style={{
            position: 'relative', padding: 20,
            border: `1px solid ${BORDER}`, borderRadius: 14,
            background: CARD, overflow: 'hidden',
            display: 'flex', gap: 14, alignItems: 'center',
          }}>
            <div style={{ width: 56, height: 56, flexShrink: 0, color: ORANGE, opacity: 0.9 }}>
              <svg viewBox="0 0 200 160" style={{ width: '100%', height: '100%' }}>{shapes[slug]}</svg>
            </div>
            <div style={{ flex: 1, minWidth: 0 }}>
              <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: MUTED, letterSpacing: '0.15em' }}>{n}</div>
              <h3 style={{ margin: '4px 0 4px', fontSize: 18, fontWeight: 600, letterSpacing: '-0.015em' }}>{title}</h3>
              <p style={{ margin: 0, fontSize: 13, color: MUTED, lineHeight: 1.4 }}>{body}</p>
            </div>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke={ORANGE} strokeWidth="2" style={{ flexShrink: 0 }}>
              <path d="M6 3l5 5-5 5"/>
            </svg>
          </div>
        ))}
      </div>
    </section>
  );
};

// ---------- SAME DAY INTERSTITIAL ----------

const MInterstitial = () => (
  <section style={{
    position: 'relative', padding: '80px 20px', background: 'var(--bg)',
    textAlign: 'center', overflow: 'hidden',
  }}>
    <div style={{
      position: 'absolute', inset: 0,
      background: `radial-gradient(ellipse at center, rgba(255,107,26,0.18) 0%, rgba(0,0,0,0) 60%)`,
    }} />
    <div style={{ position: 'relative' }}>
      <div style={{
        fontSize: 80, fontWeight: 700, letterSpacing: '-0.035em',
        lineHeight: 0.95, color: 'var(--fg)',
      }}>
        Same<br/>day.
      </div>
      <div style={{ marginTop: 20, fontSize: 16, color: 'var(--fg-2)', letterSpacing: '-0.011em' }}>
        Most repairs, under an hour.
      </div>
    </div>
  </section>
);

// ---------- HOW ----------

const MHow = () => (
  <section id="how" style={{ padding: '64px 20px', background: 'transparent' }}>
    <Eyebrow>How it works</Eyebrow>
    <h2 style={{ margin: '10px 0 32px', fontSize: 34, fontWeight: 600, letterSpacing: '-0.025em', lineHeight: 1.05 }}>
      Three steps.<br/>One morning.
    </h2>
    <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
      {[
        ['01', 'Drop in or message.', "No appointment needed. We're on The Strand."],
        ['02', 'Free diagnostic.', "We tell you exactly what's wrong. No pressure."],
        ['03', 'Fixed. Usually same day.', "Grab a coffee. We'll text when it's ready."],
      ].map(([n, h, b]) => (
        <div key={n} style={{ borderTop: `1px solid ${BORDER}`, paddingTop: 20 }}>
          <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: ORANGE, letterSpacing: '0.15em' }}>{n}</div>
          <h3 style={{ margin: '10px 0 6px', fontSize: 22, fontWeight: 600, letterSpacing: '-0.02em' }}>{h}</h3>
          <p style={{ margin: 0, fontSize: 14, color: MUTED, lineHeight: 1.5 }}>{b}</p>
        </div>
      ))}
    </div>
  </section>
);

// ---------- REVIEWS (horizontal scroll) ----------

const MReviews = () => {
  const reviews = [
    { name: 'Sarah M.', src: 'GOOGLE', date: '18 APR', stars: 5, body: "Cracked my iPhone on the Sunday, dropped it in Monday morning, picked it up at lunch. Lovely folk, proper local shop." },
    { name: 'Dave', src: 'FACEBOOK', date: '12 APR', stars: 0, body: "Honest, quick, fair price. Fixed my laptop screen when Currys said it was a write-off.", rec: true },
    { name: 'Linda H.', src: 'GOOGLE', date: '04 APR', stars: 5, body: "My grandson smashed the back of my phone. Sorted in an hour. Only £45. Proper local." },
    { name: 'Ahmed', src: 'FACEBOOK', date: '28 MAR', stars: 0, body: "PS5 HDMI port snapped off. Thought it was gone. £70 and 2 days later, good as new.", rec: true },
  ];
  return (
    <section id="reviews" style={{ padding: '64px 0', background: 'transparent' }}>
      <div style={{ padding: '0 20px' }}>
        <Eyebrow>The word on the high street</Eyebrow>
        <h2 style={{ margin: '10px 0 24px', fontSize: 34, fontWeight: 600, letterSpacing: '-0.025em', lineHeight: 1.05 }}>
          Longton trusts<br/>the Strand shop.
        </h2>
      </div>
      <div style={{
        display: 'flex', gap: 14, padding: '8px 20px 20px',
        overflowX: 'auto', scrollSnapType: 'x mandatory',
        WebkitOverflowScrolling: 'touch',
      }}>
        {reviews.map((r, i) => (
          <article key={i} style={{
            flex: '0 0 280px', scrollSnapAlign: 'start',
            padding: '24px 22px', background: '#f5f2ea', color: '#111',
            borderRadius: 14, boxShadow: '3px 5px 20px rgba(0,0,0,0.3)',
            transform: `rotate(${(i % 2 === 0 ? -0.5 : 0.7)}deg)`,
            position: 'relative',
          }}>
            <div style={{
              position: 'absolute', right: 14, top: 14,
              fontFamily: 'JetBrains Mono, monospace', fontSize: 9,
              color: '#a8332f', letterSpacing: '0.15em', textAlign: 'right', lineHeight: 1.4,
            }}>{r.date}<br/>{r.src}</div>
            <div style={{ fontFamily: 'Caveat, cursive', fontWeight: 600, fontSize: 34, lineHeight: 1 }}>{r.name}</div>
            {r.stars > 0 && <div style={{ color: '#f5c518', fontSize: 16, letterSpacing: 2, marginTop: 6 }}>{'★'.repeat(r.stars)}</div>}
            {r.rec && (
              <div style={{ marginTop: 6, color: '#0071e3', fontSize: 11, fontWeight: 500, display: 'inline-flex', alignItems: 'center', gap: 4 }}>
                <svg viewBox="0 0 24 24" width="11" height="11" fill="currentColor"><path d="M7 10v11h10V10l-5-8zm11 0h2a1 1 0 011 1v9a1 1 0 01-1 1h-2z"/></svg>
                Recommends
              </div>
            )}
            <p style={{ marginTop: 12, fontSize: 13.5, lineHeight: 1.5, color: '#2a2a2a' }}>{r.body}</p>
          </article>
        ))}
      </div>
    </section>
  );
};

// ---------- LIVE STATUS + MAP ----------

const MStatus = () => (
  <section style={{ padding: '40px 20px', background: 'transparent' }}>
    <div style={{
      padding: 20, borderRadius: 16, background: CARD, border: `1px solid ${BORDER}`,
    }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 8 }}>
        <span style={{ width: 8, height: 8, borderRadius: '50%', background: '#30d158', boxShadow: '0 0 8px #30d158', animation: 'pulse 2s ease-in-out infinite' }} />
        <div style={{ fontSize: 13, color: '#30d158', fontWeight: 500, letterSpacing: '-0.011em' }}>Open now · another 2h 14m</div>
      </div>
      <div style={{ fontSize: 22, fontWeight: 600, letterSpacing: '-0.02em' }}>27 The Strand, Longton<br/>Stoke-on-Trent, ST3 2NR</div>
      {/* Stylised map */}
      <div style={{ marginTop: 14, height: 140, borderRadius: 10, background: 'var(--bg-2)', position: 'relative', overflow: 'hidden', border: `1px solid ${BORDER}` }}>
        <svg viewBox="0 0 320 140" style={{ width: '100%', height: '100%' }}>
          <g stroke="#1a1a1a" strokeWidth="1">
            <path d="M 0 40 L 320 40 M 0 80 L 320 80 M 0 110 L 320 110" />
            <path d="M 60 0 L 60 140 M 140 0 L 140 140 M 220 0 L 220 140 M 280 0 L 280 140" />
          </g>
          <path d="M 0 70 L 320 70" stroke={ORANGE} strokeWidth="1.5" strokeDasharray="3 3" opacity="0.5"/>
          <text x="110" y="64" fontSize="8" fill={MUTED} fontFamily="monospace" letterSpacing="1">THE STRAND</text>
          {/* pin */}
          <g transform="translate(160, 75)">
            <circle r="18" fill={ORANGE} opacity="0.15"/>
            <circle r="10" fill={ORANGE} opacity="0.3"/>
            <circle r="5" fill={ORANGE}/>
            <circle r="2" fill="#000"/>
          </g>
        </svg>
      </div>
      <div style={{ marginTop: 14, display: 'flex', flexDirection: 'column', gap: 8 }}>
        <Btn full onClick={() => window.location.href = 'tel:01782343842'}>☎ Call 01782 343 842</Btn>
        <Btn full variant="secondary" onClick={() => window.open('https://maps.google.com/?q=The+Fone+Shop+Longton+ST3+2NR', '_blank')}>Directions →</Btn>
      </div>
    </div>
  </section>
);

// ---------- FOOTER ----------

const MFooter = () => (
  <footer id="contact" style={{ padding: '32px 20px 140px', background: 'var(--bg-2)', borderTop: `1px solid ${BORDER}` }}>
    <img src="../../assets/the-fone-shop-logo-mark.png" alt="" style={{ height: 72, width: 'auto', display: 'block', marginLeft: -10 }} />
    <div style={{ marginTop: 16, fontSize: 13, color: MUTED, lineHeight: 1.6 }}>
      27 The Strand, Longton<br/>
      Stoke-on-Trent<br/>
      ST3 2NR
    </div>
    <div style={{ marginTop: 16, display: 'flex', flexDirection: 'column', gap: 10 }}>
      <a href="tel:01782343842" style={{ color: 'var(--fg)', fontFamily: 'JetBrains Mono, monospace', fontSize: 14, textDecoration: 'none' }}>📞 01782 343 842</a>
      <a href="mailto:hello@thefoneshoplongton.co.uk" style={{ color: 'var(--fg)', fontSize: 14, textDecoration: 'none' }}>✉ hello@thefoneshoplongton.co.uk</a>
    </div>
    <div style={{ marginTop: 28, fontSize: 11, color: MUTED, display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
      <span>© 2026 The Fone Shop · Independently owned · Since 2012</span>
      <a href="/sign-in" style={{ color: MUTED, fontSize: 11, letterSpacing: '0.08em', textTransform: 'uppercase', textDecoration: 'none', opacity: 0.7 }}
        onMouseEnter={e => e.currentTarget.style.opacity = 1}
        onMouseLeave={e => e.currentTarget.style.opacity = 0.7}>
        Owner →
      </a>
    </div>
  </footer>
);

// ---------- STICKY BOTTOM CTA ----------

const StickyCTA = () => (
  <div style={{
    position: 'sticky', bottom: 0, left: 0, right: 0, zIndex: 40,
    padding: '10px 14px calc(10px + env(safe-area-inset-bottom))',
    background: 'var(--bg)',
    borderTop: '1px solid var(--border)',
    display: 'flex', gap: 8,
  }}>
    <Btn style={{ flex: 1, height: 48 }} onClick={() => window.location.href = 'tel:01782343842'}>☎ Call</Btn>
    <Btn style={{ flex: 1, height: 48 }} variant="secondary" onClick={() => window.open('https://www.facebook.com/thefoneshopst3', '_blank')}>Message</Btn>
  </div>
);

Object.assign(window, {
  MHeader, MenuSheet, MHero, MTrust, MCalculator, MBeforeAfter, MServices,
  MInterstitial, MHow, MReviews, MStatus, MFooter, StickyCTA,
});
