// Shared chrome for the Welcome direction — used across multi-page site.
// Nav (with mobile menu), footer, common CSS.

const WeNav = ({ active = '' }) => {
  const [open, setOpen] = React.useState(false);

  React.useEffect(() => {
    document.body.style.overflow = open ? 'hidden' : '';
    return () => { document.body.style.overflow = ''; };
  }, [open]);

  const closeAnd = () => setOpen(false);

  return (
    <>
      <nav className="we-nav">
        <a href="Leviyet Home.html" className="we-logo" onClick={closeAnd}>
          <div className="we-logo-mark"></div>
          leviyet
        </a>
        <div className="we-navlinks">
          <a href="Leviyet Services.html" className={active === 'services' ? 'on' : ''}>Services</a>
          <a href="Leviyet Work.html" className={active === 'work' ? 'on' : ''}>Work</a>
          <a href="Leviyet Process.html" className={active === 'process' ? 'on' : ''}>Process</a>
          <a href="Leviyet Contact.html" className={active === 'contact' ? 'on' : ''}>Contact</a>
        </div>
        <a href="Leviyet Contact.html" className="we-cta we-cta-desktop">Book intro →</a>
        <button
          className={`we-burger ${open ? 'open' : ''}`}
          aria-label={open ? 'Close menu' : 'Open menu'}
          aria-expanded={open}
          onClick={() => setOpen(o => !o)}
        >
          <span></span>
          <span></span>
        </button>
      </nav>

      <div className={`we-mmenu ${open ? 'open' : ''}`} onClick={closeAnd}>
        <div className="we-mmenu-inner" onClick={e => e.stopPropagation()}>
          <a href="Leviyet Services.html" className={active === 'services' ? 'on' : ''}>
            <span className="we-mm-num">01</span><span>Services</span>
          </a>
          <a href="Leviyet Work.html" className={active === 'work' ? 'on' : ''}>
            <span className="we-mm-num">02</span><span>Work</span>
          </a>
          <a href="Leviyet Process.html" className={active === 'process' ? 'on' : ''}>
            <span className="we-mm-num">03</span><span>Process</span>
          </a>
          <a href="Leviyet Contact.html" className={active === 'contact' ? 'on' : ''}>
            <span className="we-mm-num">04</span><span>Contact</span>
          </a>
          <a href="Leviyet Contact.html" className="we-mm-cta">Book intro call →</a>
          <div className="we-mm-social">
            <a href="https://www.linkedin.com/company/leviyet/" target="_blank" rel="noopener">LinkedIn</a>
            <a href="https://www.instagram.com/leviyet.digital/?hl=en" target="_blank" rel="noopener">Instagram</a>
            <a href="https://www.facebook.com/Leviyet/" target="_blank" rel="noopener">Facebook</a>
            <a href="https://twitter.com/leviyet" target="_blank" rel="noopener">Twitter</a>
          </div>
          <div className="we-mm-foot">
            <div>hello@leviyet.com</div>
            <div>// accepting 2 partnerships in q3 2026</div>
          </div>
        </div>
      </div>
    </>
  );
};

const WeFooter = () => (
  <>
    <footer className="we-foot">
      <div>
        <div className="we-foot-mark">leviyet<em>.</em></div>
        <div className="we-foot-tag">// AI-powered growth partner · est. 2024</div>
      </div>
      <div className="we-foot-col">
        <div className="we-foot-col-h">Services</div>
        <a href="Leviyet Services.html">AI audit</a>
        <a href="Leviyet Services.html">Custom agents</a>
        <a href="Leviyet Services.html">Web</a>
        <a href="Leviyet Services.html">Ads & SEO</a>
      </div>
      <div className="we-foot-col">
        <div className="we-foot-col-h">Company</div>
        <a href="Leviyet Work.html">Work</a>
        <a href="Leviyet Process.html">Process</a>
        <a href="Leviyet FAQ.html">FAQ</a>
        <a href="Leviyet Contact.html">Contact</a>
      </div>
      <div className="we-foot-col">
        <div className="we-foot-col-h">Connect</div>
        <a href="mailto:hello@leviyet.com">hello@leviyet.com</a>
        <a href="https://www.linkedin.com/company/leviyet/" target="_blank" rel="noopener">LinkedIn</a>
        <a href="https://www.instagram.com/leviyet.digital/?hl=en" target="_blank" rel="noopener">Instagram</a>
        <a href="https://www.facebook.com/Leviyet/" target="_blank" rel="noopener">Facebook</a>
        <a href="https://twitter.com/leviyet" target="_blank" rel="noopener">Twitter / X</a>
      </div>
    </footer>
    <div className="we-foot-bot">
      <div>© 2026 leviyet.com</div>
      <div className="we-foot-bot-links">
        <a href="Leviyet Privacy.html">Privacy</a>
        <a href="Leviyet Terms.html">Terms</a>
      </div>
      <div>made with care · in good company</div>
    </div>
  </>
);

window.WeNav = WeNav;
window.WeFooter = WeFooter;

// Inject shared CSS once
if (typeof document !== 'undefined' && !document.getElementById('we-shared-css')) {
  const link1 = document.createElement('link');
  link1.rel = 'preconnect';
  link1.href = 'https://fonts.googleapis.com';
  document.head.appendChild(link1);
  const link2 = document.createElement('link');
  link2.rel = 'stylesheet';
  link2.href = 'https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap';
  document.head.appendChild(link2);

  const s = document.createElement('style');
  s.id = 'we-shared-css';
  s.textContent = `
    html, body { margin: 0; padding: 0; }
    body { font-family: 'Inter', system-ui, sans-serif; background: #f4efe6; color: #1a1612; line-height: 1.5; -webkit-font-smoothing: antialiased; }
    a { color: inherit; text-decoration: none; }
    .we-nav { position: sticky; top: 0; z-index: 50; display: flex; justify-content: space-between; align-items: center; padding: 22px 56px; background: rgba(244,239,230,0.85); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(26,22,18,0.08); }
    .we-logo { display: flex; align-items: center; gap: 10px; font-family: 'Instrument Serif', serif; font-size: 30px; font-style: italic; letter-spacing: -0.02em; position: relative; z-index: 2; }
    .we-logo-mark { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffb89a, #c8542a 70%); position: relative; }
    .we-logo-mark::after { content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); border: 1.5px solid rgba(200,84,42,0.55); border-radius: 50%; animation: wepulse 4s cubic-bezier(.2,.7,.3,1) infinite; }
    @keyframes wepulse {
      0%   { width: 18px; height: 18px; opacity: 0.7; border-width: 1.5px; }
      100% { width: 56px; height: 56px; opacity: 0; border-width: 0.5px; }
    }
    .we-navlinks { display: flex; gap: 32px; font-size: 14px; }
    .we-navlinks a { color: rgba(26,22,18,0.7); position: relative; }
    .we-navlinks a.on { color: #1a1612; }
    .we-navlinks a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: #c8542a; transform: scaleX(0); transform-origin: left; transition: transform 0.35s cubic-bezier(.7,0,.3,1); }
    .we-navlinks a.on::after, .we-navlinks a:hover::after { transform: scaleX(1); }
    .we-navlinks a:hover { color: #1a1612; }
    .we-cta { font-size: 14px; padding: 10px 18px; background: #1a1612; color: #f4efe6; border-radius: 999px; border: none; cursor: pointer; font-weight: 500; transition: transform 0.2s, background 0.2s; display: inline-block; }
    .we-cta:hover { transform: translateY(-2px); background: #c8542a; color: #f4efe6; }

    /* Burger button — hidden on desktop */
    .we-burger { display: none; width: 40px; height: 40px; background: transparent; border: none; cursor: pointer; padding: 0; position: relative; z-index: 60; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
    .we-burger span { display: block; width: 22px; height: 1.5px; background: #1a1612; border-radius: 2px; transition: transform 0.35s cubic-bezier(.7,0,.3,1), opacity 0.2s; }
    .we-burger.open span:nth-child(1) { transform: translateY(3.75px) rotate(45deg); }
    .we-burger.open span:nth-child(2) { transform: translateY(-3.75px) rotate(-45deg); }

    /* Mobile menu overlay */
    .we-mmenu { position: fixed; inset: 0; background: rgba(244,239,230,0.96); backdrop-filter: blur(14px); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.3s cubic-bezier(.2,.8,.3,1); display: flex; align-items: stretch; justify-content: stretch; }
    .we-mmenu.open { opacity: 1; pointer-events: auto; }
    .we-mmenu-inner { flex: 1; padding: 100px 32px 40px; display: flex; flex-direction: column; gap: 4px; max-width: 600px; margin: 0 auto; width: 100%; box-sizing: border-box; }
    .we-mmenu-inner > a { font-family: 'Instrument Serif', serif; font-size: 56px; line-height: 1.1; letter-spacing: -0.025em; color: #1a1612; padding: 14px 0; border-bottom: 1px solid rgba(26,22,18,0.12); display: flex; align-items: baseline; gap: 18px; opacity: 0; transform: translateY(12px); transition: opacity 0.4s, transform 0.4s, color 0.2s; }
    .we-mmenu.open .we-mmenu-inner > a { opacity: 1; transform: translateY(0); }
    .we-mmenu.open .we-mmenu-inner > a:nth-child(1) { transition-delay: 0.05s; }
    .we-mmenu.open .we-mmenu-inner > a:nth-child(2) { transition-delay: 0.10s; }
    .we-mmenu.open .we-mmenu-inner > a:nth-child(3) { transition-delay: 0.15s; }
    .we-mmenu.open .we-mmenu-inner > a:nth-child(4) { transition-delay: 0.20s; }
    .we-mmenu.open .we-mm-cta { transition-delay: 0.28s; }
    .we-mmenu-inner > a:hover { color: #c8542a; }
    .we-mmenu-inner > a.on { color: #c8542a; }
    .we-mm-num { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #c8542a; letter-spacing: 0.15em; min-width: 36px; }
    .we-mm-cta { margin-top: 32px; align-self: flex-start; padding: 16px 28px; background: #1a1612; color: #f4efe6 !important; font-family: 'Inter', sans-serif; font-style: normal; font-size: 16px !important; border-radius: 999px; border: 0 !important; opacity: 0; transform: translateY(12px); transition: opacity 0.4s, transform 0.4s, background 0.2s; }
    .we-mmenu.open .we-mm-cta { opacity: 1; transform: translateY(0); }
    .we-mm-cta:hover { background: #c8542a !important; color: #f4efe6 !important; }
    .we-mm-foot { margin-top: auto; padding-top: 32px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #6b5d4d; display: flex; flex-direction: column; gap: 6px; opacity: 0; transition: opacity 0.4s 0.4s; }
    .we-mmenu.open .we-mm-foot { opacity: 1; }
    .we-mm-social { display: flex; flex-wrap: wrap; gap: 18px 22px; margin-top: 28px; padding-top: 24px; border-top: 1px solid rgba(26,22,18,0.12); opacity: 0; transition: opacity 0.4s 0.34s; }
    .we-mmenu.open .we-mm-social { opacity: 1; }
    .we-mm-social a { font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.08em; color: #4a3f33; transition: color 0.2s; }
    .we-mm-social a:hover { color: #c8542a; }

    .we-foot { padding: 80px 56px 32px; max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 60px; border-top: 1px solid rgba(26,22,18,0.12); margin-top: 100px; }
    .we-foot-mark { font-family: 'Instrument Serif', serif; font-size: 88px; font-weight: 400; letter-spacing: -0.025em; line-height: 0.9; }
    .we-foot-mark em { color: #c8542a; font-style: italic; }
    .we-foot-tag { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #6b5d4d; margin-top: 16px; }
    .we-foot-col-h { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #6b5d4d; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 16px; }
    .we-foot-col a { display: block; color: #1a1612; font-size: 15px; padding: 6px 0; transition: color 0.2s, transform 0.2s; }
    .we-foot-col a:hover { color: #c8542a; transform: translateX(4px); }
    .we-foot-bot { padding: 24px 56px; border-top: 1px solid rgba(26,22,18,0.12); display: flex; justify-content: space-between; align-items: center; gap: 24px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #6b5d4d; max-width: 1400px; margin: 0 auto; }
    .we-foot-bot-links { display: flex; gap: 20px; }
    .we-foot-bot-links a { color: #6b5d4d; transition: color 0.2s; }
    .we-foot-bot-links a:hover { color: #c8542a; }
    @media (max-width: 720px) {
      .we-why-grid { grid-template-columns: 1fr !important; gap: 28px !important; }
    }

    .we-page-hero { padding: 100px 56px 60px; max-width: 1400px; margin: 0 auto; }
    .we-shead { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #c8542a; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 28px; display: flex; align-items: center; gap: 14px; }
    .we-shead-line { width: 32px; height: 1px; background: #c8542a; }
    .we-page-h1 { font-family: 'Instrument Serif', serif; font-size: 124px; line-height: 0.95; letter-spacing: -0.025em; font-weight: 400; margin: 0 0 36px; max-width: 1280px; }
    .we-page-h1 em { color: #c8542a; font-style: italic; }
    .we-page-sub { font-size: 22px; line-height: 1.5; color: #4a3f33; max-width: 720px; margin: 0; }
    .we-section { padding: 80px 56px; max-width: 1400px; margin: 0 auto; }
    .we-stitle { font-family: 'Instrument Serif', serif; font-size: 64px; line-height: 1; letter-spacing: -0.02em; font-weight: 400; margin: 0 0 60px; max-width: 1100px; }
    .we-stitle em { color: #c8542a; font-style: italic; }

    /* ---------- TABLET ---------- */
    @media (max-width: 1024px) {
      .we-nav { padding: 18px 32px; }
      .we-navlinks { display: none; }
      .we-cta-desktop { display: none; }
      .we-burger { display: flex; }
      .we-page-hero { padding: 72px 32px 48px; }
      .we-page-h1 { font-size: 92px; }
      .we-page-sub { font-size: 19px; }
      .we-section { padding: 64px 32px; }
      .we-stitle { font-size: 48px; margin-bottom: 44px; }
      .we-foot { padding: 64px 32px 28px; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
      .we-foot-mark { font-size: 64px; }
      .we-foot-bot { padding: 20px 32px; }
    }

    /* ---------- MOBILE ---------- */
    @media (max-width: 720px) {
      .we-nav { padding: 14px 20px; }
      .we-logo { font-size: 24px; gap: 8px; }
      .we-logo-mark { width: 14px; height: 14px; }
      .we-logo-mark::after { width: 14px; height: 14px; }
      @keyframes wepulse {
        0%   { width: 14px; height: 14px; opacity: 0.7; border-width: 1.5px; }
        100% { width: 42px; height: 42px; opacity: 0; border-width: 0.5px; }
      }
      .we-mmenu-inner { padding: 88px 24px 32px; }
      .we-mmenu-inner > a { font-size: 40px; padding: 10px 0; gap: 14px; }
      .we-mm-num { font-size: 11px; min-width: 28px; }
      .we-mm-cta { font-size: 15px !important; padding: 14px 22px; }
      .we-page-hero { padding: 48px 20px 36px; }
      .we-shead { margin-bottom: 20px; font-size: 11px; }
      .we-page-h1 { font-size: 56px; line-height: 0.96; margin: 0 0 24px; }
      .we-page-h1 br { display: none; }
      .we-page-sub { font-size: 16px; }
      .we-section { padding: 48px 20px; }
      .we-stitle { font-size: 36px; margin-bottom: 32px; }
      .we-foot { padding: 56px 20px 24px; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 64px; }
      .we-foot > div:first-child { grid-column: 1 / -1; }
      .we-foot-mark { font-size: 56px; }
      .we-foot-bot { padding: 18px 20px; flex-direction: column; gap: 8px; text-align: center; }
    }
  `;
  document.head.appendChild(s);
}
