// Genesis chrome: EXACT takegenesis.com header + nav + footer + mobile menu.
// Ported from the compare/guide pages (which already mirror the live Shopify theme).
// Variant-scoped: A = navy + standard gold #D4AF37 (matches the live site).
// B/C/D = warm gold #C4A265 + variant-specific background, for the proposed rebrand.
// Logo PNG is identical across all four variants — only bg and accent colors shift.
const { useState, useEffect, useLayoutEffect, useRef } = React;

function chromePalette(variant){
  if (variant === "B") return { headerBg:"#0f0f11", footerBg:"#0c0c0e", gold:"#C4A265", colTitle:"#C4A265" };
  if (variant === "C") return { headerBg:"#0f172a", footerBg:"#1a1a2e", gold:"#C4A265", colTitle:"#C4A265" };
  if (variant === "D") return { headerBg:"#0f172a", footerBg:"#1a1a26", gold:"#C4A265", colTitle:"#C4A265" };
  return { headerBg:"#0f172a", footerBg:"#1a1a2e", gold:"#D4AF37", colTitle:"#d4af37" };
}

function buildChromeCss(p){
  return `
    .announcement-bar{background:${p.gold};overflow:hidden;height:41px;display:flex;align-items:center;padding:6px 0}
    .announcement-bar__track{display:inline-block;white-space:nowrap;animation:announcementScroll 40s linear infinite;will-change:transform;-webkit-backface-visibility:hidden;backface-visibility:hidden}
    .announcement-bar__item{display:inline-block;font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:11px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:#0a0a0a;padding:0 36px;white-space:nowrap}
    .announcement-bar__item::before{content:'\\2726';margin-right:8px}
    @keyframes announcementScroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(-50%,0,0)}}
    .site-header-wrap{position:fixed;top:0;left:0;right:0;z-index:250;background:${p.headerBg};font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:16px;letter-spacing:0.6px;line-height:1.8;color:rgba(245,245,245,0.75)}
    .site-header{display:flex;align-items:center;justify-content:space-between;padding:20px 30px;max-width:1440px;margin:0 auto}
    .site-header__logo{display:block;text-decoration:none}
    .site-header__logo img{height:60px;width:auto;object-fit:contain}
    .site-header__nav{display:none;align-items:center;gap:32px;margin-right:auto;padding-left:32px}
    .site-header__nav a{font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:13px;font-weight:600;letter-spacing:0.5px;text-transform:uppercase;text-decoration:none;color:#ededeb;transition:opacity 0.2s ease;padding:10px 0}
    .site-header__nav a:hover{opacity:0.7}
    .site-header__nav a.nav-active{color:${p.gold}}
    .site-header__controls{display:flex;align-items:center;gap:16px;flex-shrink:0}
    .site-header__cta{display:inline-flex;align-items:center;justify-content:center;padding:12px 24px;background:#ededeb;color:${p.headerBg};font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:12px;font-weight:600;letter-spacing:0.5px;text-transform:uppercase;text-decoration:none;border-radius:0;white-space:nowrap;transition:background 0.2s ease,color 0.2s ease;box-shadow:0 0 4px rgba(0,0,0,0.25)}
    .site-header__cta:hover{background:#fff;color:${p.headerBg}}
    .site-header__icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px;color:#ededeb;text-decoration:none;transition:opacity 0.2s ease;position:relative}
    .site-header__icon:hover{opacity:0.7}
    .site-header__hamburger{display:flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;margin:0;background:none;border:1px solid rgba(237,237,235,0.3);cursor:pointer;color:#ededeb;transition:opacity 0.2s ease}
    .site-header__hamburger:hover{opacity:0.7}
    .site-mobile-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:350;opacity:0;pointer-events:none;transition:opacity 0.3s ease}
    .site-mobile-overlay.open{opacity:1;pointer-events:auto}
    .site-mobile-menu{position:fixed;top:0;right:0;bottom:0;width:380px;max-width:100vw;overflow-y:auto;background:#fff;box-shadow:-4px 0 24px rgba(0,0,0,0.15);transform:translateX(100%);transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);z-index:400;padding:24px;display:flex;flex-direction:column;gap:0}
    .site-mobile-menu.open{transform:translateX(0)}
    .site-mobile-menu__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
    .site-mobile-menu__title{font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:11px;font-weight:600;letter-spacing:1px;text-transform:uppercase;color:#949494;margin:0}
    .site-mobile-menu__close{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;margin:0;background:none;border:none;cursor:pointer;color:#0f172a;transition:opacity 0.2s ease}
    .site-mobile-menu__close:hover{opacity:0.6}
    .site-mobile-menu__products{display:flex;flex-direction:column;gap:0;margin-bottom:16px}
    .site-mobile-menu__product{display:flex;align-items:center;gap:12px;padding:12px 0;text-decoration:none;color:#0f172a;border-bottom:1px solid #ccc;transition:opacity 0.2s ease}
    .site-mobile-menu__product:first-child{border-top:1px solid #ccc}
    .site-mobile-menu__product:hover{opacity:0.7}
    .site-mobile-menu__product-name{flex:1;font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:14px;font-weight:700;text-transform:uppercase;letter-spacing:0.3px;line-height:1.3;color:#0f172a}
    .site-mobile-menu__product-arrow{flex-shrink:0;color:#0f172a}
    .site-mobile-menu__shop-btn{display:block;width:100%;padding:18px 0;background:#0f172a;color:#fff;font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:14px;font-weight:600;letter-spacing:0.5px;text-transform:uppercase;text-align:center;text-decoration:none;border-radius:0;border:none;cursor:pointer;transition:background 0.2s ease;margin-bottom:20px}
    .site-mobile-menu__shop-btn:hover{background:#1a3063}
    .site-mobile-menu__links{list-style:none;padding:0;margin:0 0 24px;display:flex;flex-direction:column;gap:0}
    .site-mobile-menu__links a{font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:15px;font-weight:500;color:#0f172a;text-decoration:none;padding:14px 0;display:block;transition:opacity 0.2s ease;letter-spacing:0.6px}
    .site-mobile-menu__links a:hover{opacity:0.6}
    .site-mobile-menu__account{display:flex;align-items:center;gap:10px;padding:18px 0;border-top:1px solid #ccc;margin-bottom:16px;text-decoration:none;color:#0f172a;font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:14px;font-weight:600;transition:opacity 0.2s ease}
    .site-mobile-menu__account:hover{opacity:0.6}
    .site-mobile-menu__social{display:flex;align-items:center;gap:20px;padding:12px 0}
    .site-mobile-menu__social a{color:#949494;transition:opacity 0.2s ease}
    .site-mobile-menu__social a:hover{opacity:0.6}
    @media(min-width:1200px){.site-header__nav{display:flex}.site-header__logo img{height:50px}}
    @media(max-width:749px){.site-header__cta{display:none}.site-header__nav{display:none}.site-header{padding:16px 20px}}
    .site-footer{background:${p.footerBg};padding:0 0 100px;margin-top:48px}
    .site-footer-inner{max-width:1200px;margin:0 auto;padding:0 30px}
    .site-footer__fda{text-align:center;font-size:11px;color:rgba(255,255,255,0.65);line-height:1.6;letter-spacing:0.6px;padding:20px 20px;border-top:1px solid rgba(255,255,255,0.1);border-bottom:none}
    .site-footer__tagline{text-align:center;font-size:13px;color:rgba(255,255,255,0.55);font-style:italic;font-weight:400;letter-spacing:0.6px;line-height:1.8;padding:24px 0 0;max-width:900px;margin:0 auto}
    .site-footer__social-centered{display:flex;gap:0;justify-content:center;padding:36px 0;border-top:1px solid rgba(237,237,235,0.15);margin-top:32px}
    .site-footer__social-centered a{display:flex;align-items:center;justify-content:center;width:42px;height:42px;padding:11px;color:#ededeb;transition:opacity 0.2s}
    .site-footer__social-centered a:hover{opacity:0.7}
    .site-footer__bottom{border-top:1px solid rgba(237,237,235,0.15);padding:30px 0 0;margin-top:0}
    .site-footer__bottom-inner{max-width:1200px;margin:0 auto;padding:0 30px;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px}
    .site-footer__copyright{font-size:11px;color:#ededeb;display:flex;gap:12px;flex-wrap:wrap;align-items:center;line-height:24px}
    .site-footer__copyright a{color:#ededeb;text-decoration:none;transition:opacity 0.2s;display:inline-block;min-height:24px;padding:4px 0}
    .site-footer__copyright a:hover{opacity:0.7}
    .site-footer__payments{display:flex;gap:6px;flex-wrap:wrap}
    .site-footer__payments .list-payment{list-style:none;display:flex;gap:6px;flex-wrap:wrap;padding:0;margin:0}
    .site-footer__payments .list-payment__item{display:inline-flex}
    @media(max-width:600px){.site-footer__bottom-inner{flex-direction:column;align-items:center;text-align:center}}
    .site-footer__columns{display:grid;grid-template-columns:repeat(3,1fr);gap:32px;padding:48px 0 0;border-top:1px solid ${p.gold}26;max-width:900px;margin:0 auto}
    .site-footer__col{display:flex;flex-direction:column;gap:0}
    .site-footer__col-title{font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:13px;font-weight:700;text-transform:uppercase;letter-spacing:1.04px;color:${p.colTitle};margin-bottom:12px;line-height:1.3}
    .site-footer__col a{font-family:Inter,-apple-system,"system-ui",sans-serif;font-size:14px;color:rgba(255,255,255,0.5);text-decoration:none;transition:color 0.2s;font-weight:400;letter-spacing:0.6px;line-height:1.8;padding:4px 0;display:block}
    .site-footer__col a:hover{color:#ededeb}
    @media(max-width:600px){.site-footer__columns{grid-template-columns:1fr;gap:24px}}
  `;
}

// Inline CSS as a style element child so it's present on first paint (avoids FOUC
// on hard refresh where useEffect'd injection would leave the header unstyled).
function GenesisChromeStyles({ variant }){
  const css = buildChromeCss(chromePalette(variant));
  return <style>{css}</style>;
}

const ANNOUNCEMENT_ITEMS = [
  "Back in Stock: Genesis Dawn & Dusk",
  "We Ship Within 1-2 Business Days",
  "130+ Customers. Zero Refunds.",
  "Subscribe & Save 10% Every Month",
  "Join the Genesis Lab on Telegram",
  "42 Ingredients. Two Scoops. Done.",
];

function AnnouncementBar(){
  const doubled = [...ANNOUNCEMENT_ITEMS, ...ANNOUNCEMENT_ITEMS];
  return (
    <div className="announcement-bar">
      <div className="announcement-bar__track">
        {doubled.map((t, i) => (
          <span className="announcement-bar__item" key={i}>{t}</span>
        ))}
      </div>
    </div>
  );
}

function AccountIcon(){
  return (
    <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="8" r="4"/>
      <path d="M4 21v-1a6 6 0 0 1 12 0v1"/>
    </svg>
  );
}

function CartIcon(){
  return (
    <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"/>
      <line x1="3" y1="6" x2="21" y2="6"/>
      <path d="M16 10a4 4 0 0 1-8 0"/>
    </svg>
  );
}

function HamburgerIcon(){
  return (
    <svg width="24" height="16" viewBox="0 0 24 16" fill="none">
      <line x1="0" y1="1" x2="24" y2="1" stroke="currentColor" strokeWidth="2"/>
      <line x1="0" y1="8" x2="24" y2="8" stroke="currentColor" strokeWidth="2"/>
      <line x1="0" y1="15" x2="24" y2="15" stroke="currentColor" strokeWidth="2"/>
    </svg>
  );
}

function CloseIcon(){
  return (
    <svg width="20" height="20" viewBox="0 0 20 20" fill="none">
      <line x1="2" y1="2" x2="18" y2="18" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
      <line x1="18" y1="2" x2="2" y2="18" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
    </svg>
  );
}

function ProductArrow(){
  return (
    <svg className="site-mobile-menu__product-arrow" width="28" height="21" viewBox="0 0 28 21" fill="none">
      <path d="M17 1L26 10.5L17 20" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
      <line x1="1" y1="10.5" x2="26" y2="10.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
    </svg>
  );
}

function IgIcon({ size = 20 }){
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
      <rect x="2" y="2" width="20" height="20" rx="5"/>
      <circle cx="12" cy="12" r="5"/>
      <circle cx="17.5" cy="6.5" r="1.5" fill="currentColor" stroke="none"/>
    </svg>
  );
}

function XIcon({ size = 20 }){
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="currentColor">
      <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>
    </svg>
  );
}

function TgIcon({ size = 20 }){
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="currentColor">
      <path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/>
    </svg>
  );
}

// Payment-icons row — verbatim markup from the live Shopify theme. Parsed via
// DOMParser (no script execution) and adopted as live SVG nodes, so React
// doesn't need JSX conversion for every attribute and we don't call innerHTML.
const PAYMENT_ICONS_HTML = `
<ul class="list list-payment" role="list">
<li class="list-payment__item"><svg class="icon icon--full-color" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="pi-american_express" viewBox="0 0 38 24" width="38" height="24"><title id="pi-american_express">American Express</title><path fill="#000" d="M35 0H3C1.3 0 0 1.3 0 3v18c0 1.7 1.4 3 3 3h32c1.7 0 3-1.3 3-3V3c0-1.7-1.4-3-3-3Z" opacity=".07"/><path fill="#006FCF" d="M35 1c1.1 0 2 .9 2 2v18c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V3c0-1.1.9-2 2-2h32Z"/><path fill="#FFF" d="M22.012 19.936v-8.421L37 11.528v2.326l-1.732 1.852L37 17.573v2.375h-2.766l-1.47-1.622-1.46 1.628-9.292-.02Z"/><path fill="#006FCF" d="M23.013 19.012v-6.57h5.572v1.513h-3.768v1.028h3.678v1.488h-3.678v1.01h3.768v1.531h-5.572Z"/><path fill="#006FCF" d="m28.557 19.012 3.083-3.289-3.083-3.282h2.386l1.884 2.083 1.89-2.082H37v.051l-3.017 3.23L37 18.92v.093h-2.307l-1.917-2.103-1.898 2.104h-2.321Z"/><path fill="#FFF" d="M22.71 4.04h3.614l1.269 2.881V4.04h4.46l.77 2.159.771-2.159H37v8.421H19l3.71-8.421Z"/><path fill="#006FCF" d="m23.395 4.955-2.916 6.566h2l.55-1.315h2.98l.55 1.315h2.05l-2.904-6.566h-2.31Zm.25 3.777.875-2.09.873 2.09h-1.748Z"/><path fill="#006FCF" d="M28.581 11.52V4.953l2.811.01L32.84 9l1.456-4.046H37v6.565l-1.74.016v-4.51l-1.644 4.494h-1.59L30.35 7.01v4.51h-1.768Z"/></svg></li>
<li class="list-payment__item"><svg class="icon icon--full-color" viewBox="0 0 38 24" xmlns="http://www.w3.org/2000/svg" role="img" width="38" height="24" aria-labelledby="pi-diners_club"><title id="pi-diners_club">Diners Club</title><path opacity=".07" d="M35 0H3C1.3 0 0 1.3 0 3v18c0 1.7 1.4 3 3 3h32c1.7 0 3-1.3 3-3V3c0-1.7-1.4-3-3-3z"/><path fill="#fff" d="M35 1c1.1 0 2 .9 2 2v18c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V3c0-1.1.9-2 2-2h32"/><path d="M12 12v3.7c0 .3-.2.3-.5.2-1.9-.8-3-3.3-2.3-5.4.4-1.1 1.2-2 2.3-2.4.4-.2.5-.1.5.2V12zm2 0V8.3c0-.3 0-.3.3-.2 2.1.8 3.2 3.3 2.4 5.4-.4 1.1-1.2 2-2.3 2.4-.4.2-.4.1-.4-.2V12zm7.2-7H13c3.8 0 6.8 3.1 6.8 7s-3 7-6.8 7h8.2c3.8 0 6.8-3.1 6.8-7s-3-7-6.8-7z" fill="#3086C8"/></svg></li>
<li class="list-payment__item"><svg class="icon icon--full-color" viewBox="0 0 38 24" width="38" height="24" role="img" aria-labelledby="pi-discover" fill="none" xmlns="http://www.w3.org/2000/svg"><title id="pi-discover">Discover</title><path fill="#000" opacity=".07" d="M35 0H3C1.3 0 0 1.3 0 3v18c0 1.7 1.4 3 3 3h32c1.7 0 3-1.3 3-3V3c0-1.7-1.4-3-3-3z"/><path d="M35 1c1.1 0 2 .9 2 2v18c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V3c0-1.1.9-2 2-2h32z" fill="#fff"/><path d="M3.57 7.16H2v5.5h1.57c.83 0 1.43-.2 1.96-.63.63-.52 1-1.3 1-2.11-.01-1.63-1.22-2.76-2.96-2.76zm1.26 4.14c-.34.3-.77.44-1.47.44h-.29V8.1h.29c.69 0 1.11.12 1.47.44.37.33.59.84.59 1.37 0 .53-.22 1.06-.59 1.39zm2.19-4.14h1.07v5.5H7.02v-5.5zm3.69 2.11c-.64-.24-.83-.4-.83-.69 0-.35.34-.61.8-.61.32 0 .59.13.86.45l.56-.73c-.46-.4-1.01-.61-1.62-.61-.97 0-1.72.68-1.72 1.58 0 .76.35 1.15 1.35 1.51.42.15.63.25.74.31.21.14.32.34.32.57 0 .45-.35.78-.83.78-.51 0-.92-.26-1.17-.73l-.69.67c.49.73 1.09 1.05 1.9 1.05 1.11 0 1.9-.74 1.9-1.81.02-.89-.35-1.29-1.57-1.74zm1.92.65c0 1.62 1.27 2.87 2.9 2.87.46 0 .86-.09 1.34-.32v-1.26c-.43.43-.81.6-1.29.6-1.08 0-1.85-.78-1.85-1.9 0-1.06.79-1.89 1.8-1.89.51 0 .9.18 1.34.62V7.38c-.47-.24-.86-.34-1.32-.34-1.61 0-2.92 1.28-2.92 2.88zm12.76.94l-1.47-3.7h-1.17l2.33 5.64h.58l2.37-5.64h-1.16l-1.48 3.7zm3.13 1.8h3.04v-.93h-1.97v-1.48h1.9v-.93h-1.9V8.1h1.97v-.94h-3.04v5.5zm7.29-3.87c0-1.03-.71-1.62-1.95-1.62h-1.59v5.5h1.07v-2.21h.14l1.48 2.21h1.32l-1.73-2.32c.81-.17 1.26-.72 1.26-1.56zm-2.16.91h-.31V8.03h.33c.67 0 1.03.28 1.03.82 0 .55-.36.85-1.05.85z" fill="#231F20"/><path d="M20.16 12.86a2.931 2.931 0 100-5.862 2.931 2.931 0 000 5.862z" fill="url(#pi-paint0_linear)"/><path opacity=".65" d="M20.16 12.86a2.931 2.931 0 100-5.862 2.931 2.931 0 000 5.862z" fill="url(#pi-paint1_linear)"/><path d="M36.57 7.506c0-.1-.07-.15-.18-.15h-.16v.48h.12v-.19l.14.19h.14l-.16-.2c.06-.01.1-.06.1-.13zm-.2.07h-.02v-.13h.02c.06 0 .09.02.09.06 0 .05-.03.07-.09.07z" fill="#231F20"/><path d="M36.41 7.176c-.23 0-.42.19-.42.42 0 .23.19.42.42.42.23 0 .42-.19.42-.42 0-.23-.19-.42-.42-.42zm0 .77c-.18 0-.34-.15-.34-.35 0-.19.15-.35.34-.35.18 0 .33.16.33.35 0 .19-.15.35-.33.35z" fill="#231F20"/><path d="M37 12.984S27.09 19.873 8.976 23h26.023a2 2 0 002-1.984l.024-3.02L37 12.985z" fill="#F48120"/><defs><linearGradient id="pi-paint0_linear" x1="21.657" y1="12.275" x2="19.632" y2="9.104" gradientUnits="userSpaceOnUse"><stop stop-color="#F89F20"/><stop offset=".25" stop-color="#F79A20"/><stop offset=".533" stop-color="#F68D20"/><stop offset=".62" stop-color="#F58720"/><stop offset=".723" stop-color="#F48120"/><stop offset="1" stop-color="#F37521"/></linearGradient><linearGradient id="pi-paint1_linear" x1="21.338" y1="12.232" x2="18.378" y2="6.446" gradientUnits="userSpaceOnUse"><stop stop-color="#F58720"/><stop offset=".359" stop-color="#E16F27"/><stop offset=".703" stop-color="#D4602C"/><stop offset=".982" stop-color="#D05B2E"/></linearGradient></defs></svg></li>
<li class="list-payment__item"><svg class="icon icon--full-color" viewBox="0 0 38 24" xmlns="http://www.w3.org/2000/svg" role="img" width="38" height="24" aria-labelledby="pi-master"><title id="pi-master">Mastercard</title><path opacity=".07" d="M35 0H3C1.3 0 0 1.3 0 3v18c0 1.7 1.4 3 3 3h32c1.7 0 3-1.3 3-3V3c0-1.7-1.4-3-3-3z"/><path fill="#fff" d="M35 1c1.1 0 2 .9 2 2v18c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V3c0-1.1.9-2 2-2h32"/><circle fill="#EB001B" cx="15" cy="12" r="7"/><circle fill="#F79E1B" cx="23" cy="12" r="7"/><path fill="#FF5F00" d="M22 12c0-2.4-1.2-4.5-3-5.7-1.8 1.3-3 3.4-3 5.7s1.2 4.5 3 5.7c1.8-1.2 3-3.3 3-5.7z"/></svg></li>
<li class="list-payment__item"><svg class="icon icon--full-color" viewBox="0 0 38 24" xmlns="http://www.w3.org/2000/svg" width="38" height="24" role="img" aria-labelledby="pi-paypal"><title id="pi-paypal">PayPal</title><path opacity=".07" d="M35 0H3C1.3 0 0 1.3 0 3v18c0 1.7 1.4 3 3 3h32c1.7 0 3-1.3 3-3V3c0-1.7-1.4-3-3-3z"/><path fill="#fff" d="M35 1c1.1 0 2 .9 2 2v18c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V3c0-1.1.9-2 2-2h32"/><path fill="#003087" d="M23.9 8.3c.2-1 0-1.7-.6-2.3-.6-.7-1.7-1-3.1-1h-4.1c-.3 0-.5.2-.6.5L14 15.6c0 .2.1.4.3.4H17l.4-3.4 1.8-2.2 4.7-2.1z"/><path fill="#3086C8" d="M23.9 8.3l-.2.2c-.5 2.8-2.2 3.8-4.6 3.8H18c-.3 0-.5.2-.6.5l-.6 3.9-.2 1c0 .2.1.4.3.4H19c.3 0 .5-.2.5-.4v-.1l.4-2.4v-.1c0-.2.3-.4.5-.4h.3c2.1 0 3.7-.8 4.1-3.2.2-1 .1-1.8-.4-2.4-.1-.5-.3-.7-.5-.8z"/><path fill="#012169" d="M23.3 8.1c-.1-.1-.2-.1-.3-.1-.1 0-.2 0-.3-.1-.3-.1-.7-.1-1.1-.1h-3c-.1 0-.2 0-.2.1-.2.1-.3.2-.3.4l-.7 4.4v.1c0-.3.3-.5.6-.5h1.3c2.5 0 4.1-1 4.6-3.8v-.2c-.1-.1-.3-.2-.5-.2h-.1z"/></svg></li>
<li class="list-payment__item"><svg class="icon icon--full-color" xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 38 24" width="38" height="24" aria-labelledby="pi-shopify_pay"><title id="pi-shopify_pay">Shop Pay</title><path opacity=".07" d="M35 0H3C1.3 0 0 1.3 0 3v18c0 1.7 1.4 3 3 3h32c1.7 0 3-1.3 3-3V3c0-1.7-1.4-3-3-3z" fill="#000"/><path d="M35.889 0C37.05 0 38 .982 38 2.182v19.636c0 1.2-.95 2.182-2.111 2.182H2.11C.95 24 0 23.018 0 21.818V2.182C0 .982.95 0 2.111 0H35.89z" fill="#5A31F4"/><path d="M9.35 11.368c-1.017-.223-1.47-.31-1.47-.705 0-.372.306-.558.92-.558.54 0 .934.238 1.225.704a.079.079 0 00.104.03l1.146-.584a.082.082 0 00.032-.114c-.475-.831-1.353-1.286-2.51-1.286-1.52 0-2.464.755-2.464 1.956 0 1.275 1.15 1.597 2.17 1.82 1.02.222 1.474.31 1.474.705 0 .396-.332.582-.993.582-.612 0-1.065-.282-1.34-.83a.08.08 0 00-.107-.035l-1.143.57a.083.083 0 00-.036.111c.454.92 1.384 1.437 2.627 1.437 1.583 0 2.539-.742 2.539-1.98s-1.155-1.598-2.173-1.82v-.003zM15.49 8.855c-.65 0-1.224.232-1.636.646a.04.04 0 01-.069-.03v-2.64a.08.08 0 00-.08-.081H12.27a.08.08 0 00-.08.082v8.194a.08.08 0 00.08.082h1.433a.08.08 0 00.081-.082v-3.594c0-.695.528-1.227 1.239-1.227.71 0 1.226.521 1.226 1.227v3.594a.08.08 0 00.081.082h1.433a.08.08 0 00.081-.082v-3.594c0-1.51-.981-2.577-2.355-2.577zM20.753 8.62c-.778 0-1.507.24-2.03.588a.082.082 0 00-.027.109l.632 1.088a.08.08 0 00.11.03 2.5 2.5 0 011.318-.366c1.25 0 2.17.891 2.17 2.068 0 1.003-.736 1.745-1.669 1.745-.76 0-1.288-.446-1.288-1.077 0-.361.152-.657.548-.866a.08.08 0 00.032-.113l-.596-1.018a.08.08 0 00-.098-.035c-.799.299-1.359 1.018-1.359 1.984 0 1.46 1.152 2.55 2.76 2.55 1.877 0 3.227-1.313 3.227-3.195 0-2.018-1.57-3.492-3.73-3.492zM28.675 8.843c-.724 0-1.373.27-1.845.746-.026.027-.069.007-.069-.029v-.572a.08.08 0 00-.08-.082h-1.397a.08.08 0 00-.08.082v8.182a.08.08 0 00.08.081h1.433a.08.08 0 00.081-.081v-2.683c0-.036.043-.054.069-.03a2.6 2.6 0 001.808.7c1.682 0 2.993-1.373 2.993-3.157s-1.313-3.157-2.993-3.157zm-.271 4.929c-.956 0-1.681-.768-1.681-1.783s.723-1.783 1.681-1.783c.958 0 1.68.755 1.68 1.783 0 1.027-.713 1.783-1.681 1.783h.001z" fill="#fff"/></svg></li>
<li class="list-payment__item"><svg class="icon icon--full-color" viewBox="0 0 38 24" xmlns="http://www.w3.org/2000/svg" role="img" width="38" height="24" aria-labelledby="pi-visa"><title id="pi-visa">Visa</title><path opacity=".07" d="M35 0H3C1.3 0 0 1.3 0 3v18c0 1.7 1.4 3 3 3h32c1.7 0 3-1.3 3-3V3c0-1.7-1.4-3-3-3z"/><path fill="#fff" d="M35 1c1.1 0 2 .9 2 2v18c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V3c0-1.1.9-2 2-2h32"/><path d="M28.3 10.1H28c-.4 1-.7 1.5-1 3h1.9c-.3-1.5-.3-2.2-.6-3zm2.9 5.9h-1.7c-.1 0-.1 0-.2-.1l-.2-.9-.1-.2h-2.4c-.1 0-.2 0-.2.2l-.3.9c0 .1-.1.1-.1.1h-2.1l.2-.5L27 8.7c0-.5.3-.7.8-.7h1.5c.1 0 .2 0 .2.2l1.4 6.5c.1.4.2.7.2 1.1.1.1.1.1.1.2zm-13.4-.3l.4-1.8c.1 0 .2.1.2.1.7.3 1.4.5 2.1.4.2 0 .5-.1.7-.2.5-.2.5-.7.1-1.1-.2-.2-.5-.3-.8-.5-.4-.2-.8-.4-1.1-.7-1.2-1-.8-2.4-.1-3.1.6-.4.9-.8 1.7-.8 1.2 0 2.5 0 3.1.2h.1c-.1.6-.2 1.1-.4 1.7-.5-.2-1-.4-1.5-.4-.3 0-.6 0-.9.1-.2 0-.3.1-.4.2-.2.2-.2.5 0 .7l.5.4c.4.2.8.4 1.1.6.5.3 1 .8 1.1 1.4.2.9-.1 1.7-.9 2.3-.5.4-.7.6-1.4.6-1.4 0-2.5.1-3.4-.2-.1.2-.1.2-.2.1zm-3.5.3c.1-.7.1-.7.2-1 .5-2.2 1-4.5 1.4-6.7.1-.2.1-.3.3-.3H18c-.2 1.2-.4 2.1-.7 3.2-.3 1.5-.6 3-1 4.5 0 .2-.1.2-.3.2M5 8.2c0-.1.2-.2.3-.2h3.4c.5 0 .9.3 1 .8l.9 4.4c0 .1 0 .1.1.2 0-.1.1-.1.1-.1l2.1-5.1c-.1-.1 0-.2.1-.2h2.1c0 .1 0 .1-.1.2l-3.1 7.3c-.1.2-.1.3-.2.4-.1.1-.3 0-.5 0H9.7c-.1 0-.2 0-.2-.2L7.9 9.5c-.2-.2-.5-.5-.9-.6-.6-.3-1.7-.5-1.9-.5L5 8.2z" fill="#142688"/></svg></li>
</ul>
`;

// Adopt payment-icon DOM before paint so the footer doesn't flash empty on refresh.
function PaymentIcons(){
  const ref = useRef(null);
  useLayoutEffect(() => {
    if (!ref.current) return;
    const doc = new DOMParser().parseFromString(PAYMENT_ICONS_HTML, "text/html");
    ref.current.replaceChildren(...doc.body.childNodes);
  }, []);
  return (
    <div
      ref={ref}
      className="site-footer__payments"
      style={{contentVisibility:"auto", containIntrinsicSize:"auto 24px"}}
    />
  );
}

function SiteHeader({ variant }){
  const [menuOpen, setMenuOpen] = useState(false);
  const close = () => setMenuOpen(false);

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

  useEffect(() => {
    const onKey = (e) => { if (e.key === "Escape") setMenuOpen(false); };
    window.addEventListener("keydown", onKey);
    return () => window.removeEventListener("keydown", onKey);
  }, []);

  return (
    <>
      <GenesisChromeStyles variant={variant} />
      <div className="site-header-wrap">
        <AnnouncementBar />
        <header className="site-header">
          <a href="https://takegenesis.com" className="site-header__logo">
            <img
              src="https://takegenesis.com/cdn/shop/files/genesis_overlaid_logo_copy.png?v=1745300568&width=300"
              alt="Genesis"
              loading="eager"
            />
          </a>
          <nav className="site-header__nav">
            <a href="https://takegenesis.com/products/genesis-dawn">Dawn</a>
            <a href="https://takegenesis.com/products/genesis-dusk">Dusk</a>
            <a href="https://compare.takegenesis.com">Compare</a>
            <a href="https://takegenesis.com/pages/faqs">FAQs</a>
            <a href="https://obviously.takegenesis.com/register" target="_blank" rel="noopener noreferrer">Affiliates</a>
            <a href="https://t.me/takegenesis" target="_blank" rel="noopener noreferrer">Lab</a>
          </nav>
          <div className="site-header__controls">
            <a href="https://takegenesis.com/products/dawn-dusk-bundle" className="site-header__cta">Shop the Stack →</a>
            <a href="https://takegenesis.com/account" className="site-header__icon" aria-label="Account"><AccountIcon /></a>
            <a href="https://takegenesis.com/cart" className="site-header__icon" aria-label="Cart"><CartIcon /></a>
            <button className="site-header__hamburger" aria-label="Menu" onClick={() => setMenuOpen(true)}><HamburgerIcon /></button>
          </div>
        </header>
      </div>
      <div className={"site-mobile-overlay" + (menuOpen ? " open" : "")} onClick={close} />
      <div className={"site-mobile-menu" + (menuOpen ? " open" : "")}>
        <div className="site-mobile-menu__header">
          <span className="site-mobile-menu__title">The Lineup</span>
          <button className="site-mobile-menu__close" onClick={close} aria-label="Close"><CloseIcon /></button>
        </div>
        <div className="site-mobile-menu__products">
          <a href="https://takegenesis.com/products/genesis-dawn" className="site-mobile-menu__product" onClick={close}>
            <span className="site-mobile-menu__product-name">Genesis Dawn</span><ProductArrow />
          </a>
          <a href="https://takegenesis.com/products/genesis-dusk" className="site-mobile-menu__product" onClick={close}>
            <span className="site-mobile-menu__product-name">Genesis Dusk</span><ProductArrow />
          </a>
        </div>
        <a href="https://takegenesis.com/products/dawn-dusk-bundle" className="site-mobile-menu__shop-btn" onClick={close}>Shop the Stack</a>
        <div className="site-mobile-menu__links">
          <a href="https://compare.takegenesis.com" onClick={close}>Compare</a>
          <a href="https://guide.takegenesis.com" target="_blank" rel="noopener noreferrer" onClick={close}>Protocol</a>
          <a href="https://takegenesis.com/pages/faqs" onClick={close}>FAQs</a>
          <a href="https://takegenesis.com/pages/concierge" onClick={close}>Concierge</a>
          <a href="https://takegenesis.com/collections/merch" onClick={close}>Merch</a>
          <a href="https://takegenesis.com/pages/contact" onClick={close}>Contact</a>
          <a href="https://obviously.takegenesis.com/register" target="_blank" rel="noopener noreferrer" onClick={close}>Affiliate Program (20%)</a>
          <a href="https://t.me/takegenesis" target="_blank" rel="noopener noreferrer" onClick={close}>The Genesis Lab (Telegram)</a>
        </div>
        <a href="https://takegenesis.com/account" className="site-mobile-menu__account" onClick={close}>
          <AccountIcon /><span>My Account &amp; Subscriptions</span>
        </a>
        <div className="site-mobile-menu__social">
          <a href="https://www.instagram.com/take.genesis" target="_blank" rel="noopener noreferrer" aria-label="Instagram"><IgIcon /></a>
          <a href="https://x.com/takegenesis" target="_blank" rel="noopener noreferrer" aria-label="X"><XIcon /></a>
          <a href="https://t.me/takegenesis" target="_blank" rel="noopener noreferrer" aria-label="Telegram"><TgIcon /></a>
        </div>
      </div>
    </>
  );
}

function SiteFooter({ variant }){
  return (
    <footer className="site-footer">
      <div className="site-footer-inner">
        <div className="site-footer__fda">
          *These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure, or prevent any disease. Individual results may vary. Consult your healthcare provider before starting any supplement regimen.
        </div>
        <div className="site-footer__columns">
          <div className="site-footer__col">
            <div className="site-footer__col-title">Products</div>
            <a href="https://takegenesis.com/products/dawn-dusk-bundle">Dawn + Dusk Bundle</a>
            <a href="https://takegenesis.com/products/genesis-dawn">Genesis Dawn (AM)</a>
            <a href="https://takegenesis.com/products/genesis-dusk">Genesis Dusk (PM)</a>
            <a href="https://compare.takegenesis.com">Compare Genesis</a>
          </div>
          <div className="site-footer__col">
            <div className="site-footer__col-title">Learn</div>
            <a href="https://takegenesis.com/pages/faqs">Frequently Asked Questions</a>
            <a href="https://guide.takegenesis.com" target="_blank" rel="noopener noreferrer">Protocol</a>
            <a href="https://takegenesis.com/pages/concierge">Concierge</a>
            <a href="https://takegenesis.com/pages/contact">Contact</a>
            <a href="https://obviously.takegenesis.com/register" target="_blank" rel="noopener noreferrer">Affiliate Program (20%)</a>
          </div>
          <div className="site-footer__col">
            <div className="site-footer__col-title">Community</div>
            <a href="https://t.me/takegenesis" target="_blank" rel="noopener noreferrer">The Genesis Lab (Telegram)</a>
            <a href="https://x.com/takegenesis" target="_blank" rel="noopener noreferrer">@takegenesis on X</a>
            <a href="https://www.instagram.com/take.genesis" target="_blank" rel="noopener noreferrer">@take.genesis on Instagram</a>
          </div>
        </div>
        <div className="site-footer__tagline">42 ingredients. Two scoops. Zero refunds.</div>
        <div className="site-footer__social-centered">
          <a href="https://www.instagram.com/take.genesis" target="_blank" rel="noopener noreferrer" aria-label="Instagram"><IgIcon size={22} /></a>
          <a href="https://x.com/takegenesis" target="_blank" rel="noopener noreferrer" aria-label="X"><XIcon size={22} /></a>
          <a href="https://t.me/takegenesis" target="_blank" rel="noopener noreferrer" aria-label="Telegram"><TgIcon size={22} /></a>
        </div>
        <div className="site-footer__bottom">
          <div className="site-footer__bottom-inner">
            <div className="site-footer__copyright">
              © 2026, <a href="https://takegenesis.com">Genesis</a> ·{" "}
              <a href="https://takegenesis.com/policies/privacy-policy">Privacy policy</a> ·{" "}
              <a href="https://takegenesis.com/policies/terms-of-service">Terms of service</a> ·{" "}
              <a href="https://takegenesis.com/policies/refund-policy">Refund policy</a>
            </div>
            <PaymentIcons />
          </div>
        </div>
      </div>
    </footer>
  );
}

window.Header = SiteHeader;
window.Footer = SiteFooter;
