/*
  Direction B — STICKER COLLAGE (responsive)
  Cereal-box wall scrapbook energy. Zines, stickers, taped photos.
*/
function useIsMobile(bp = 768) {
  const [m, setM] = React.useState(() => typeof window !== 'undefined' && window.innerWidth < bp);
  React.useEffect(() => {
    const on = () => setM(window.innerWidth < bp);
    on();
    window.addEventListener('resize', on);
    return () => window.removeEventListener('resize', on);
  }, [bp]);
  return m;
}

const SCstyles = {
  root: {
    fontFamily: "'Space Grotesk', system-ui, sans-serif",
    color: "#1A1410",
    background: "#F4ECE0",
    minHeight: "100%",
    width: "100%",
  },
  display: {
    fontFamily: "'Archivo Black', 'Bagel Fat One', sans-serif",
    letterSpacing: "-0.02em",
    lineHeight: 0.92,
  },
  hand: {
    fontFamily: "'Caveat', 'Permanent Marker', cursive",
  },
  mono: {
    fontFamily: "'JetBrains Mono', ui-monospace, monospace",
    letterSpacing: "0.04em",
  },
};

function SCBoxWall({ style }) {
  const m = useIsMobile();
  return (
    <div style={{
      position: "relative",
      width: "100%",
      height: m ? 260 : 520,
      overflow: "hidden",
      background: "#0d0a07",
      boxShadow: "inset 0 0 0 2px rgba(0,0,0,0.35), inset 0 -50px 80px rgba(0,0,0,0.55), inset 0 8px 20px rgba(0,0,0,0.4)",
      ...style,
    }}>
      <div style={{
        position: "absolute", inset: 0,
        backgroundImage: "url('assets/cereal-collage-2.jpg')",
        backgroundSize: "auto 100%",
        backgroundRepeat: "repeat-x",
        animation: "sc-wall-drift 80s linear infinite",
      }}/>
      <div style={{
        position: "absolute", inset: 0, pointerEvents: "none",
        background: "radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)",
      }}/>
      <div style={{
        position: "absolute", inset: 0, pointerEvents: "none",
        backgroundImage: "repeating-linear-gradient(0deg, rgba(0,0,0,0.05) 0 1px, transparent 1px 3px)",
        mixBlendMode: "multiply", opacity: 0.5,
      }}/>
      <style>{`
        @keyframes sc-wall-drift {
          from { background-position: 0 center; }
          to   { background-position: -1000px center; }
        }
      `}</style>
    </div>
  );
}

function SCPhotoCard({ src, rotate = 0, caption, tape, w = 200, h = 220, responsive = true }) {
  const m = useIsMobile();
  // On mobile: scale down width/height by ~0.75 if responsive
  const rw = responsive && m ? Math.round(w * 0.72) : w;
  const rh = responsive && m ? Math.round(h * 0.72) : h;
  return (
    <div style={{
      position: "relative",
      width: rw, display: "inline-block",
      transform: `rotate(${rotate}deg)`,
      filter: "drop-shadow(2px 4px 8px rgba(0,0,0,0.15))",
    }}>
      {tape != null && tape !== 0 && (
        <div style={{
          position: "absolute", top: -8, left: "50%",
          transform: `translateX(-50%) rotate(${tape}deg)`,
          width: 60, height: 18,
          background: "rgba(255,235,150,0.7)",
          border: "1px solid rgba(0,0,0,0.06)",
          zIndex: 2,
        }}/>
      )}
      <div style={{
        background: "#fff",
        padding: "10px 10px 40px",
      }}>
        <div style={{
          width: "100%", height: rh,
          background: "#DDD",
          overflow: "hidden",
        }}>
          <img src={src} style={{ width: "100%", height: "100%", objectFit: "cover" }}
            onError={(e) => { e.currentTarget.style.display = "none"; }} />
        </div>
        {caption && (
          <div style={{ ...SCstyles.hand, fontSize: 18, color: "#1A1410", marginTop: 10, textAlign: "center", lineHeight: 1 }}>
            {caption}
          </div>
        )}
      </div>
    </div>
  );
}

function SCSticker({ children, bg, rotate = 0, style }) {
  return (
    <div style={{
      display: "inline-block",
      background: bg,
      color: "#1A1410",
      padding: "8px 16px",
      borderRadius: 999,
      border: "2px solid #1A1410",
      transform: `rotate(${rotate}deg)`,
      fontFamily: SCstyles.display.fontFamily,
      fontSize: 14,
      boxShadow: "3px 3px 0 rgba(26,20,16,0.15)",
      ...style,
    }}>{children}</div>
  );
}

function SCButton({ children, color = "var(--ts-pink)", fg = "#fff", rotate = 0, onClick, href = "#", target }) {
  const m = useIsMobile();
  return (
    <a href={href} onClick={onClick} target={target} rel={target === "_blank" ? "noopener noreferrer" : undefined} style={{
      display: "inline-flex", alignItems: "center", gap: 10,
      background: color, color: fg, textDecoration: "none",
      padding: m ? "11px 18px" : "14px 24px",
      fontFamily: SCstyles.display.fontFamily,
      fontSize: m ? 14 : 16,
      borderRadius: 6,
      border: "2px solid #1A1410",
      boxShadow: "3px 3px 0 #1A1410",
      transform: `rotate(${rotate}deg)`,
    }}>{children}</a>
  );
}

function SCHero() {
  const m = useIsMobile();
  return (
    <section style={{ position: "relative", background: "#F4ECE0" }}>
      <SCTicker />

      {/* Nav */}
      <div style={{
        display: "flex", justifyContent: "space-between", alignItems: "center",
        padding: m ? "14px 16px" : "20px 40px",
        borderBottom: "2px dashed rgba(0,0,0,0.2)",
        background: "#F4ECE0", position: "relative", zIndex: 5, gap: 12,
      }}>
        <div style={{ display: "flex", alignItems: "center", gap: 12, minWidth: 0 }}>
          <div style={{
            width: m ? 38 : 44, height: m ? 38 : 44, borderRadius: "50%",
            background: "#0B0B0F", overflow: "hidden", flexShrink: 0,
          }}>
            <img src="assets/logo.jpg" style={{ width: "100%", height: "100%", objectFit: "cover" }}/>
          </div>
          <div style={{ minWidth: 0 }}>
            <div style={{ ...SCstyles.display, fontSize: m ? 15 : 18 }}>Twisted Spoons</div>
            <div style={{ ...SCstyles.mono, fontSize: m ? 9 : 10, color: "rgba(26,20,16,0.6)" }}>MURRIETA · CA · EST. 2025</div>
          </div>
        </div>
        {!m && (
          <nav style={{ display: "flex", gap: 24, ...SCstyles.mono, fontSize: 12, textTransform: "uppercase" }}>
            <a href="#menu" style={{ color: "#1A1410", textDecoration: "none" }}>menu</a>
            <a href="#story" style={{ color: "#1A1410", textDecoration: "none" }}>story</a>
            <a href="#parties" style={{ color: "#1A1410", textDecoration: "none" }}>parties</a>
            <a href="#visit" style={{ color: "#1A1410", textDecoration: "none" }}>visit</a>
          </nav>
        )}
        <SCButton color="#1A1410" fg="#fff" href="#menu">ORDER →</SCButton>
      </div>

      {/* Stickers + headline block */}
      <div style={{ position: "relative", padding: m ? "36px 16px 30px" : "60px 40px 50px", background: "#F4ECE0" }}>
        <div style={{ display: "grid", gridTemplateColumns: m ? "1fr" : "1.3fr 0.9fr", gap: m ? 40 : 40, alignItems: "center" }}>
          <div style={{ position: "relative", zIndex: 2 }}>
            <div style={{ display: "flex", gap: 10, marginBottom: 18, flexWrap: "wrap" }}>
              <SCSticker bg="var(--ts-yellow)" rotate={-3}>★ NOW OPEN ★</SCSticker>
              <SCSticker bg="var(--ts-pink)" rotate={2} style={{ color: "#fff" }}>CEREAL BAR</SCSticker>
            </div>
            <h1 style={{ ...SCstyles.display, fontSize: m ? 62 : 130, margin: 0, color: "#1A1410", lineHeight: 0.88 }}>
              THE<br/>
              <span style={{
                background: "linear-gradient(180deg, #2BA8E0 0%, #0E7FB8 100%)",
                WebkitBackgroundClip: "text",
                WebkitTextFillColor: "transparent",
              }}>CEREAL</span><br/>
              AISLE,
            </h1>
            <div style={{ ...SCstyles.hand, fontSize: m ? 36 : 58, color: "var(--ts-pink)", transform: "rotate(-3deg)", margin: m ? "8px 0 0 20px" : "10px 0 0 40px" }}>
              but better.
            </div>
            <p style={{ fontSize: m ? 15 : 18, lineHeight: 1.55, maxWidth: 500, color: "#3a302a", margin: m ? "20px 0 22px" : "28px 0 28px" }}>
              Pick a cereal. Any cereal. We swirl it into ice cream, pile it with the good stuff, and hand it over before it melts. That's the whole thing.
            </p>
            <div style={{ display: "flex", gap: 12, alignItems: "center", flexWrap: "wrap" }}>
              <SCButton color="var(--ts-pink)" rotate={-1} href="#menu">SEE THE SWIRLS</SCButton>
              <SCButton color="var(--ts-yellow)" fg="#1A1410" rotate={1.5} href="#visit">VISIT THE SHOP</SCButton>
            </div>
          </div>
          <div style={{ position: m ? "static" : "relative", height: m ? "auto" : 440 }}>
            {m ? (
              <div style={{ display: "flex", flexDirection: "column", gap: 14, alignItems: "center" }}>
                <SCPhotoCard src="assets/product1.jpg" rotate={-4} caption="berry tale crumble" tape={4} w={200} h={200} responsive={false}/>
                <SCPhotoCard src="assets/product4.jpg" rotate={5} caption="pebble shake!!" tape={-6} w={200} h={200} responsive={false}/>
              </div>
            ) : (
              <>
                <div style={{ position: "absolute", top: 0, left: 0 }}>
                  <SCPhotoCard src="assets/product1.jpg" rotate={-6} caption="berry tale crumble" tape={4} w={220} h={230}/>
                </div>
                <div style={{ position: "absolute", top: 80, right: 10 }}>
                  <SCPhotoCard src="assets/product4.jpg" rotate={8} caption="pebble shake!!" tape={-6} w={230} h={250}/>
                </div>
                <div style={{ position: "absolute", bottom: 0, left: 70 }}>
                  <SCPhotoCard src="assets/product2.jpg" rotate={-3} caption="#18 smasher" tape={2} w={210} h={210}/>
                </div>
                <svg style={{ position: "absolute", top: 230, left: 190, width: 100, height: 80, transform: "rotate(20deg)" }} viewBox="0 0 100 80" fill="none" stroke="#1A1410" strokeWidth="2.5" strokeLinecap="round">
                  <path d="M10 70 Q 40 10, 85 20" strokeDasharray="4 4"/>
                  <path d="M75 10 L 88 20 L 78 32"/>
                </svg>
                <div style={{ ...SCstyles.hand, position: "absolute", top: 290, left: 80, fontSize: 22, color: "#1A1410", transform: "rotate(-5deg)" }}>
                  made to order!
                </div>
              </>
            )}
          </div>
        </div>
      </div>

      {/* The cereal box WALL */}
      <div style={{ position: "relative", background: "#1A1410", padding: m ? "20px 14px 0" : "28px 28px 0", overflow: "hidden" }}>
        <div style={{
          ...SCstyles.mono, fontSize: m ? 8 : 10, color: "rgba(244,236,224,0.5)",
          display: "flex", justifyContent: "space-between", marginBottom: 12, letterSpacing: "0.3em",
          flexWrap: "wrap", gap: 4,
        }}>
          <span>★ AISLE 7 · CEREAL ★</span>
          {!m && <span>40+ BOXES · ALL FAIR GAME</span>}
          <span>★ SWIRLED TO ORDER ★</span>
        </div>
        <div style={{ position: "relative" }}>
          <SCBoxWall/>
        </div>
        <div style={{
          height: 14, marginTop: 4,
          background: "linear-gradient(180deg, #8B5E34 0%, #5C3A1E 100%)",
          borderTop: "2px solid #3d2613",
          boxShadow: "0 4px 12px rgba(0,0,0,0.4)",
        }}/>
      </div>
    </section>
  );
}

function SCTicker() {
  const m = useIsMobile();
  return (
    <div style={{
      background: "#1A1410", color: "#F4ECE0",
      padding: m ? "10px 0" : "14px 0",
      overflow: "hidden", whiteSpace: "nowrap",
      borderTop: "2px solid #1A1410",
      borderBottom: "2px solid #1A1410",
    }}>
      <div style={{ display: "inline-flex", gap: 28, animation: "sc-marq 30s linear infinite", ...SCstyles.display, fontSize: m ? 14 : 20 }}>
        {Array.from({length: 4}).map((_, i) => (
          <span key={i} style={{display:"inline-flex",gap:28}}>
            <span>CEREALIOUSLY DELICIOUS</span>
            <span style={{color:"var(--ts-pink)"}}>★</span>
            <span style={{color:"var(--ts-yellow)"}}>HAND SWIRLED</span>
            <span style={{color:"var(--ts-pink)"}}>★</span>
            <span style={{color:"var(--ts-cyan)"}}>MURRIETA LOCAL</span>
            <span style={{color:"var(--ts-pink)"}}>★</span>
            <span>SINCE 2025</span>
            <span style={{color:"var(--ts-pink)"}}>★</span>
          </span>
        ))}
      </div>
      <style>{`@keyframes sc-marq { from {transform: translateX(0);} to {transform: translateX(-50%);} }`}</style>
    </div>
  );
}

function SCSwirlOfWeek() {
  const m = useIsMobile();
  const d = window.TS_DATA;
  const s = d.swirls.find(x => x.n === 4);
  return (
    <section style={{
      background: "#F4ECE0",
      padding: m ? "50px 16px" : "70px 40px",
      position: "relative", overflow: "hidden",
    }}>
      <div style={{ display: "grid", gridTemplateColumns: m ? "1fr" : "1fr 1fr", gap: m ? 32 : 40, alignItems: "center" }}>
        <div style={{ position: "relative", display: "flex", justifyContent: "center" }}>
          <SCPhotoCard src="assets/product6.jpg" rotate={-3} tape={0} w={m ? 300 : 440} h={m ? 300 : 440} responsive={false}/>
          <SCSticker bg="var(--ts-pink)" rotate={-12} style={{ color: "#fff", position: "absolute", top: -14, right: m ? 0 : 20, fontSize: m ? 14 : 18 }}>
            SWIRL OF THE WEEK
          </SCSticker>
        </div>
        <div>
          <div style={{ ...SCstyles.mono, fontSize: m ? 11 : 12, color: "var(--ts-pink)", marginBottom: 8 }}>NOW SERVING</div>
          <div style={{ ...SCstyles.display, fontSize: m ? 18 : 20, color: "rgba(26,20,16,0.5)", marginBottom: 4 }}>
            #{String(s.n).padStart(2,"0")}
          </div>
          <h2 style={{ ...SCstyles.display, fontSize: m ? 44 : 78, margin: "0 0 18px", color: "#1A1410", lineHeight: 0.9 }}>
            {s.name.toUpperCase()}
          </h2>
          <div style={{ fontSize: m ? 14 : 16, lineHeight: 1.7, maxWidth: 440, marginBottom: 22 }}>
            <div style={{ display: "grid", gridTemplateColumns: "auto 1fr", gap: "6px 14px" }}>
              <div style={{ ...SCstyles.mono, color: "rgba(26,20,16,0.6)", fontSize: 11 }}>BASE</div><div>{s.base} ice cream</div>
              <div style={{ ...SCstyles.mono, color: "rgba(26,20,16,0.6)", fontSize: 11 }}>BLEND</div><div>{s.blend}</div>
              <div style={{ ...SCstyles.mono, color: "rgba(26,20,16,0.6)", fontSize: 11 }}>TOP</div><div>{s.top}</div>
              <div style={{ ...SCstyles.mono, color: "rgba(26,20,16,0.6)", fontSize: 11 }}>DRIZZLE</div><div>{s.drizzle}</div>
            </div>
          </div>
          <div style={{ display: "flex", gap: 12, alignItems: "center", flexWrap: "wrap" }}>
            <SCButton color="var(--ts-pink)" href="#menu">ORDER THIS SWIRL</SCButton>
            <div style={{ ...SCstyles.hand, fontSize: m ? 22 : 26, color: "var(--ts-pink)", transform: "rotate(-4deg)" }}>← try it!</div>
          </div>
        </div>
      </div>
    </section>
  );
}

function SCMenu() {
  const m = useIsMobile();
  const d = window.TS_DATA;
  const [tab, setTab] = React.useState("all");
  const filtered = d.swirls.filter(s => {
    if (tab === "all") return true;
    if (tab === "choc") return /chocolate|oreo|brownie|reese|nutter|cookie|cocoa|peanut/i.test(s.name + s.blend + s.top);
    if (tab === "fruit") return /strawberr|berry|fruit|bananas|raspberry|cactus|silly/i.test(s.name + s.blend + s.top + s.drizzle);
    if (tab === "classic") return /cinnamon|toast|flake|cereal|honey|frosted|captain|goat/i.test(s.name + s.blend + s.top);
    return true;
  });
  return (
    <section id="menu" style={{ background: "#1A1410", color: "#F4ECE0", padding: m ? "50px 16px" : "70px 40px", position: "relative" }}>
      <div style={{ textAlign: "center", marginBottom: m ? 24 : 36 }}>
        <div style={{ ...SCstyles.mono, fontSize: m ? 10 : 12, color: "var(--ts-yellow)", marginBottom: 10, letterSpacing: "0.3em" }}>
          ★ THE SIGNATURE SWIRLS ★
        </div>
        <h2 style={{ ...SCstyles.display, fontSize: m ? 48 : 100, margin: 0, lineHeight: 0.9 }}>
          TWENTY WAYS<br/>
          <span style={{ color: "var(--ts-pink)" }}>TO GET SWIRLED.</span>
        </h2>
        <div style={{ display: "flex", justifyContent: "center", gap: m ? 8 : 10, marginTop: m ? 20 : 28, flexWrap: "wrap" }}>
          {d.formats.map((f, i) => (
            <div key={i} style={{
              background: "rgba(255,255,255,0.05)",
              border: "1px solid rgba(255,255,255,0.15)",
              padding: m ? "8px 12px" : "10px 16px",
              borderRadius: 6,
            }}>
              <span style={{ ...SCstyles.mono, fontSize: m ? 10 : 11, color: "rgba(255,255,255,0.6)" }}>{f.name}</span>
              <span style={{ ...SCstyles.display, fontSize: m ? 16 : 20, color: "var(--ts-yellow)", marginLeft: 8 }}>{f.price}</span>
              {!m && <span style={{ ...SCstyles.mono, fontSize: 10, color: "rgba(255,255,255,0.5)", marginLeft: 8 }}>{f.size}</span>}
            </div>
          ))}
        </div>
        <div style={{ display: "flex", justifyContent: "center", gap: 8, marginTop: 18, flexWrap: "wrap" }}>
          {[["all","ALL 20"],["choc","CHOCOLATE"],["fruit","FRUITY"],["classic","CLASSIC"]].map(([k,l]) => (
            <button key={k} onClick={() => setTab(k)} style={{
              ...SCstyles.display, fontSize: m ? 12 : 13, letterSpacing: "0.05em",
              padding: m ? "7px 13px" : "8px 16px", borderRadius: 999, cursor: "pointer",
              background: tab === k ? "var(--ts-pink)" : "transparent",
              color: tab === k ? "#fff" : "#F4ECE0",
              border: "2px solid " + (tab === k ? "var(--ts-pink)" : "rgba(255,255,255,0.2)"),
            }}>{l}</button>
          ))}
        </div>
      </div>

      <div style={{
        display: "grid", gridTemplateColumns: m ? "repeat(2, 1fr)" : "repeat(4, 1fr)", gap: m ? 10 : 12,
      }}>
        {filtered.map((sw) => (
          <div key={sw.n} style={{
            background: "#F4ECE0", color: "#1A1410",
            padding: m ? "16px 14px 14px" : "20px 20px 18px",
            position: "relative",
            borderRadius: 4,
            transform: `rotate(${((sw.n % 5) - 2) * 0.3}deg)`,
          }}>
            <div style={{
              position: "absolute", top: -10, left: 12,
              background: "var(--ts-pink)", color: "#fff",
              ...SCstyles.display, fontSize: m ? 11 : 13,
              padding: "4px 10px",
              transform: "rotate(-3deg)",
            }}>#{String(sw.n).padStart(2,"0")}</div>
            <div style={{ fontSize: m ? 26 : 32, marginTop: 4 }}>{sw.emoji}</div>
            <div style={{ ...SCstyles.display, fontSize: m ? 16 : 22, marginTop: 6, lineHeight: 0.95 }}>
              {sw.name.toUpperCase()}
            </div>
            <div style={{
              borderTop: "1px dashed rgba(26,20,16,0.3)",
              marginTop: 10, paddingTop: 10,
              fontSize: m ? 11 : 12, lineHeight: 1.45,
              color: "rgba(26,20,16,0.75)",
            }}>
              <div><strong>{sw.base}</strong> base</div>
              <div>+ {sw.blend}</div>
              <div>+ {sw.top}</div>
              <div style={{ ...SCstyles.mono, fontSize: 10, color: "var(--ts-pink)", marginTop: 6 }}>
                {sw.drizzle.toUpperCase()} DRIZZLE
              </div>
            </div>
          </div>
        ))}
      </div>

      <div style={{ textAlign: "center", marginTop: 24, ...SCstyles.hand, fontSize: m ? 20 : 24, color: "var(--ts-yellow)" }}>
        dairy free options available for every swirl!
      </div>
    </section>
  );
}

function SCStory() {
  const m = useIsMobile();
  return (
    <section id="story" style={{ background: "var(--ts-pink-wall)", padding: m ? "50px 16px" : "70px 40px", position: "relative", overflow: "hidden" }}>
      <div style={{ display: "grid", gridTemplateColumns: m ? "1fr" : "1fr 1fr", gap: m ? 32 : 50, alignItems: "center" }}>
        <div style={{ position: "relative", display: "flex", justifyContent: "center" }}>
          <SCPhotoCard src="assets/astronaut-wall.jpg" rotate={-4} tape={3} w={m ? 300 : 420} h={m ? 360 : 500} caption="the whole squad" responsive={false}/>
        </div>
        <div>
          <div style={{ ...SCstyles.mono, fontSize: m ? 10 : 11, color: "var(--ts-pink)", marginBottom: 10, letterSpacing: "0.3em" }}>OUR STORY</div>
          <h2 style={{ ...SCstyles.display, fontSize: m ? 44 : 80, margin: "0 0 18px", color: "#1A1410", lineHeight: 0.9 }}>
            IT STARTED WITH<br/>
            <span style={{ color: "var(--ts-pink)" }}>A BIG BOWL.</span>
          </h2>
          <p style={{ fontSize: m ? 14 : 17, lineHeight: 1.65, marginBottom: 12, maxWidth: 520 }}>
            Twisted Spoons is a small family shop in Murrieta, California. We're a cereal bar first — floor-to-ceiling boxes on the wall, all the classics, plus the weird ones nobody's made in twenty years. And every single swirl gets made right in front of you.
          </p>
          <p style={{ fontSize: m ? 14 : 17, lineHeight: 1.65, maxWidth: 520 }}>
            Bring the kids. Bring your cousin. Bring a date who isn't afraid of sprinkles. We'll be the ones behind the counter in pink aprons, swirling your cereal into something you can't stop thinking about.
          </p>
          <div style={{ ...SCstyles.hand, fontSize: m ? 22 : 28, color: "var(--ts-pink)", marginTop: 16, transform: "rotate(-2deg)" }}>
            — The Twisted Spoons Fam
          </div>
        </div>
      </div>
    </section>
  );
}

function SCGallery() {
  const m = useIsMobile();
  const items = [
    { src: "assets/product5.jpg", caption: "aye aye captain", rotate: -5, tape: 3 },
    { src: "assets/product4.jpg", caption: "pebble shake!!", rotate: 4, tape: -4 },
    { src: "assets/product3.jpg", caption: "monster shake", rotate: -2, tape: 5 },
    { src: "assets/mascot-bench.jpg", caption: "★ mascot alert ★", rotate: 6, tape: -3 },
    { src: "assets/product6.jpg", caption: "berry crumble", rotate: 3, tape: -4 },
    { src: "assets/product2.jpg", caption: "#18 SMASHER", rotate: -6, tape: 4 },
  ];
  return (
    <section style={{ background: "#F4ECE0", padding: m ? "50px 16px" : "70px 40px", position: "relative" }}>
      <div style={{
        display: "flex", flexDirection: m ? "column" : "row",
        justifyContent: "space-between", alignItems: m ? "flex-start" : "flex-end",
        gap: 16, marginBottom: m ? 24 : 30,
      }}>
        <div>
          <div style={{ ...SCstyles.mono, fontSize: m ? 10 : 11, color: "var(--ts-pink)", marginBottom: 8, letterSpacing: "0.3em" }}>THE SHOP</div>
          <h2 style={{ ...SCstyles.display, fontSize: m ? 40 : 64, margin: 0, color: "#1A1410", lineHeight: 0.9 }}>
            SCRAPBOOK PAGE.
          </h2>
        </div>
        <SCButton color="var(--ts-cyan)" href="https://instagram.com/twistedspoons" target="_blank">SEE MORE ON IG →</SCButton>
      </div>
      {m ? (
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 18, justifyItems: "center" }}>
          {items.map((it, i) => (
            <SCPhotoCard key={i}
              src={it.src} caption={it.caption}
              rotate={it.rotate} tape={it.tape}
              w={150} h={170} responsive={false}/>
          ))}
          <div style={{ gridColumn: "1 / 3", textAlign: "center", marginTop: 8 }}>
            <SCSticker bg="var(--ts-yellow)" rotate={-4}>TAG @TWISTEDSPOONS</SCSticker>
          </div>
        </div>
      ) : (
        <div style={{ position: "relative", height: 520 }}>
          <div style={{ position: "absolute", top: 10, left: 20 }}>
            <SCPhotoCard src="assets/product5.jpg" rotate={-5} caption="aye aye captain" tape={3} w={240} h={240}/>
          </div>
          <div style={{ position: "absolute", top: 60, left: 290 }}>
            <SCPhotoCard src="assets/product4.jpg" rotate={4} caption="pebble shake!!" tape={-4} w={210} h={270}/>
          </div>
          <div style={{ position: "absolute", top: 20, left: 540 }}>
            <SCPhotoCard src="assets/product3.jpg" rotate={-2} caption="monster shake" tape={5} w={230} h={290}/>
          </div>
          <div style={{ position: "absolute", top: 40, right: 20 }}>
            <SCPhotoCard src="assets/mascot-bench.jpg" rotate={6} caption="★ mascot alert ★" tape={-3} w={220} h={300}/>
          </div>
          <div style={{ position: "absolute", bottom: 20, left: 100 }}>
            <SCPhotoCard src="assets/product6.jpg" rotate={3} caption="berry crumble" tape={-4} w={200} h={200}/>
          </div>
          <div style={{ position: "absolute", bottom: 0, left: 380 }}>
            <SCPhotoCard src="assets/product2.jpg" rotate={-6} caption="#18 SMASHER" tape={4} w={220} h={240}/>
          </div>
          <div style={{ position: "absolute", bottom: 40, right: 180 }}>
            <SCSticker bg="var(--ts-yellow)" rotate={-8} style={{ fontSize: 14 }}>TAG @TWISTEDSPOONS</SCSticker>
          </div>
        </div>
      )}
    </section>
  );
}

function SCPartyModal({ open, onClose }) {
  const m = useIsMobile();
  const [status, setStatus] = React.useState('idle');
  const [form, setForm] = React.useState({ name:'', email:'', phone:'', date:'', guests:'', type:'Birthday', notes:'' });
  if (!open) return null;
  const set = k => e => setForm(f => ({ ...f, [k]: e.target.value }));
  const submit = e => {
    e.preventDefault();
    setStatus('sending');
    setTimeout(() => setStatus('sent'), 1800);
  };
  const reset = () => { setStatus('idle'); setForm({ name:'', email:'', phone:'', date:'', guests:'', type:'Birthday', notes:'' }); onClose(); };
  const inp = { width:'100%', boxSizing:'border-box', padding:'10px 14px', borderRadius:6, border:'2px solid #1A1410', fontSize:14, fontFamily:'Space Grotesk,system-ui,sans-serif', background:'#fff', outline:'none' };
  const lbl = { ...SCstyles.display, fontSize:11, letterSpacing:'0.12em', color:'#1A1410', display:'block', marginBottom:5 };
  return (
    <div onClick={reset} style={{ position:'fixed', inset:0, zIndex:10000, background:'rgba(26,20,16,0.75)', backdropFilter:'blur(6px)', display:'flex', alignItems:'center', justifyContent:'center', padding:16 }}>
      <div onClick={e => e.stopPropagation()} style={{ background:'#F4ECE0', border:'3px solid #1A1410', boxShadow:'6px 6px 0 #1A1410', borderRadius:12, width:'100%', maxWidth:520, maxHeight:'90vh', overflowY:'auto', padding: m ? 20 : 36, position:'relative' }}>
        <button onClick={reset} style={{ position:'absolute', top:14, right:14, background:'none', border:'none', fontSize:22, cursor:'pointer', lineHeight:1 }}>✕</button>
        {status === 'sent' ? (
          <div style={{ textAlign:'center', padding:'40px 20px' }}>
            <div style={{ fontSize:54 }}>🎉</div>
            <h3 style={{ ...SCstyles.display, fontSize:34, margin:'12px 0 10px' }}>REQUEST SENT!</h3>
            <p style={{ fontSize:15, lineHeight:1.6, color:'rgba(26,20,16,0.75)', marginBottom:24 }}>We got your party request! We'll reach out within 24 hours to lock in your date.</p>
            <SCButton color="var(--ts-pink)" onClick={reset}>CLOSE ✕</SCButton>
          </div>
        ) : (
          <>
            <div style={{ ...SCstyles.mono, fontSize:10, color:'var(--ts-pink)', letterSpacing:'0.2em', marginBottom:8 }}>★ PARTY REQUEST ★</div>
            <h3 style={{ ...SCstyles.display, fontSize: m ? 30 : 44, margin:'0 0 20px', lineHeight:0.9 }}>BOOK THE<br/><span style={{color:'var(--ts-pink)'}}>CEREAL BAR.</span></h3>
            <form onSubmit={submit} style={{ display:'flex', flexDirection:'column', gap:14 }}>
              <div style={{ display:'grid', gridTemplateColumns: m ? '1fr' : '1fr 1fr', gap:12 }}>
                <div><label style={lbl}>YOUR NAME</label><input required style={inp} value={form.name} onChange={set('name')} placeholder="e.g. Jamie Torres"/></div>
                <div><label style={lbl}>EMAIL</label><input required type="email" style={inp} value={form.email} onChange={set('email')} placeholder="jamie@email.com"/></div>
              </div>
              <div style={{ display:'grid', gridTemplateColumns: m ? '1fr' : '1fr 1fr', gap:12 }}>
                <div><label style={lbl}>PHONE</label><input style={inp} value={form.phone} onChange={set('phone')} placeholder="(555) 000-0000"/></div>
                <div><label style={lbl}>PREFERRED DATE</label><input required type="date" style={inp} value={form.date} onChange={set('date')}/></div>
              </div>
              <div style={{ display:'grid', gridTemplateColumns: m ? '1fr' : '1fr 1fr', gap:12 }}>
                <div><label style={lbl}>GUESTS</label><input required type="number" min="1" max="30" style={inp} value={form.guests} onChange={set('guests')} placeholder="Up to 30"/></div>
                <div><label style={lbl}>EVENT TYPE</label>
                  <select style={{...inp}} value={form.type} onChange={set('type')}>
                    {['Birthday','Graduation','Team Party','Corporate','Just Because'].map(t => <option key={t}>{t}</option>)}
                  </select>
                </div>
              </div>
              <div><label style={lbl}>SPECIAL REQUESTS</label><textarea style={{...inp, resize:'vertical', minHeight:80}} value={form.notes} onChange={set('notes')} placeholder="Favorite cereals, dietary needs, theme ideas..."/></div>
              <SCButton color="var(--ts-pink)">{status === 'sending' ? 'SENDING…' : 'SEND REQUEST →'}</SCButton>
            </form>
          </>
        )}
      </div>
    </div>
  );
}

function SCParties() {
  const m = useIsMobile();
  const [showForm, setShowForm] = React.useState(false);
  return (
    <section id="parties" style={{
      background: "var(--ts-cyan)",
      padding: m ? "50px 16px" : "70px 40px",
      color: "#1A1410",
      position: "relative", overflow: "hidden",
    }}>
      <div style={{ display: "grid", gridTemplateColumns: m ? "1fr" : "1fr 1fr", gap: m ? 36 : 40, alignItems: "center" }}>
        <div>
          <div style={{ ...SCstyles.mono, fontSize: m ? 10 : 11, color: "#1A1410", marginBottom: 10, letterSpacing: "0.3em" }}>PARTIES + PRIVATE EVENTS</div>
          <h2 style={{ ...SCstyles.display, fontSize: m ? 46 : 90, margin: "0 0 18px", color: "#fff", lineHeight: 0.9, textShadow: m ? "2px 2px 0 #1A1410" : "3px 3px 0 #1A1410" }}>
            PARTY AT THE CEREAL BAR.
          </h2>
          <p style={{ fontSize: m ? 14 : 17, lineHeight: 1.6, maxWidth: 500, marginBottom: 20 }}>
            Buy out the whole shop for birthdays, graduations, team wins, or just because it's Tuesday. We bring the cereal wall, the mascot, and the ghost chairs. You bring the crew.
          </p>
          <div style={{ display: "grid", gridTemplateColumns: m ? "1fr 1fr" : "repeat(2,1fr)", gap: 8, maxWidth: 460, marginBottom: 22 }}>
            {["Up to 30 guests", "Custom swirl menu", "Mascot on request", "Photo-op bench included"].map((t, i) => (
              <div key={i} style={{
                background: "#fff", border: "2px solid #1A1410",
                padding: m ? "8px 10px" : "10px 14px", borderRadius: 4,
                ...SCstyles.display, fontSize: m ? 11 : 13,
                transform: `rotate(${(i%2?1:-1)*0.5}deg)`,
              }}>★ {t.toUpperCase()}</div>
            ))}
          </div>
          <SCButton color="var(--ts-pink)" onClick={e => { e.preventDefault(); setShowForm(true); }}>REQUEST A PARTY DATE</SCButton>
        </div>
        <div style={{ position: "relative", height: m ? 340 : 400, display: "flex", alignItems: "center", justifyContent: "center" }}>
          <div style={{
            transform: "rotate(-8deg)",
            background: "var(--ts-yellow)",
            border: "3px solid #1A1410",
            padding: m ? "22px 22px" : "30px 30px",
            boxShadow: m ? "6px 6px 0 #1A1410" : "8px 8px 0 #1A1410",
            maxWidth: m ? "100%" : 380,
          }}>
            <div style={{ ...SCstyles.mono, fontSize: m ? 10 : 11, letterSpacing: "0.3em", marginBottom: 10 }}>★ BIRTHDAY PACKAGE ★</div>
            <div style={{ ...SCstyles.display, fontSize: m ? 26 : 34, lineHeight: 0.95, marginBottom: 6, whiteSpace: "nowrap" }}>
              CEREALIOUSLY
            </div>
            <div style={{ ...SCstyles.display, fontSize: m ? 26 : 34, lineHeight: 0.95, marginBottom: 12 }}>
              BIG PARTY.
            </div>
            <div style={{ fontSize: m ? 12 : 14, lineHeight: 1.5 }}>
              Book 90 minutes of the whole shop, a swirl bar tailored to the birthday kid's favorite cereals, and mascot appearance on request.
            </div>
            <div style={{ ...SCstyles.hand, fontSize: m ? 24 : 32, color: "var(--ts-pink)", marginTop: 10, transform: "rotate(-3deg)" }}>
              from $240
            </div>
          </div>
        </div>
      </div>
      <SCPartyModal open={showForm} onClose={() => setShowForm(false)} />
    </section>
  );
}

function SCVisit() {
  const m = useIsMobile();
  const d = window.TS_DATA;
  return (
    <section id="visit" style={{ background: "#F4ECE0", padding: m ? "50px 16px" : "70px 40px" }}>
      <div style={{ display: "grid", gridTemplateColumns: m ? "1fr" : "1fr 1fr", gap: m ? 32 : 60 }}>
        <div>
          <div style={{ ...SCstyles.mono, fontSize: m ? 10 : 11, color: "var(--ts-pink)", marginBottom: 10, letterSpacing: "0.3em" }}>VISIT US</div>
          <h2 style={{ ...SCstyles.display, fontSize: m ? 48 : 80, margin: "0 0 20px", color: "#1A1410", lineHeight: 0.9 }}>
            FIND THE<br/>SHOP.
          </h2>
          <div style={{ fontSize: m ? 17 : 20, lineHeight: 1.5, marginBottom: 4 }}><strong>{d.address}</strong></div>
          <div style={{ fontSize: m ? 15 : 17, color: "rgba(26,20,16,0.7)", marginBottom: 18 }}>{d.addressLine2}</div>
          <div style={{ ...SCstyles.display, fontSize: m ? 26 : 32, color: "var(--ts-pink)", marginBottom: 24 }}>
            <a href={d.phoneHref} style={{ color: "inherit", textDecoration: "none" }}>{d.phone}</a>
          </div>
          <div style={{ display: "flex", gap: 10, flexWrap: "wrap" }}>
            <SCButton color="var(--ts-cyan)" href="https://maps.google.com/?q=40575+California+Oaks+Rd+Ste+D-3+Murrieta+CA+92562" target="_blank">GET DIRECTIONS</SCButton>
            <SCButton color="#1A1410" fg="#fff" href="tel:19512390390">CALL US</SCButton>
          </div>
        </div>
        <div style={{
          background: "#1A1410", color: "#F4ECE0",
          padding: m ? 22 : 36, borderRadius: 6, border: "3px solid #1A1410",
          boxShadow: m ? "4px 4px 0 rgba(233,30,132,0.8)" : "8px 8px 0 rgba(233,30,132,0.8)",
        }}>
          <div style={{ ...SCstyles.mono, fontSize: m ? 10 : 11, color: "var(--ts-yellow)", letterSpacing: "0.3em", marginBottom: 14 }}>OUR HOURS</div>
          {d.hours.map((h, i) => (
            <div key={i} style={{
              display: "flex", justifyContent: "space-between",
              padding: "10px 0",
              borderBottom: i < 6 ? "1px dashed rgba(244,236,224,0.2)" : "none",
              fontSize: m ? 14 : 16,
            }}>
              <div style={{ ...SCstyles.display, color: i === new Date().getDay()-1 ? "var(--ts-yellow)" : "#F4ECE0" }}>{h.d.toUpperCase()}</div>
              <div>{h.h}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function SCFooter() {
  const m = useIsMobile();
  return (
    <footer style={{ background: "#1A1410", color: "#F4ECE0", padding: m ? "28px 16px" : "36px 40px" }}>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: 12 }}>
        <div style={{ ...SCstyles.display, fontSize: m ? 20 : 28 }}>TWISTED SPOONS <span style={{ color: "var(--ts-pink)" }}>★</span> MURRIETA, CA</div>
        <div style={{ display: "flex", gap: m ? 14 : 20, ...SCstyles.mono, fontSize: m ? 11 : 12, letterSpacing: "0.15em" }}>
          <a href={window.TS_DATA.social.instagram} target="_blank" rel="noopener noreferrer" style={{ color: "#F4ECE0", textDecoration: "none" }}>IG</a>
          <a href={window.TS_DATA.social.tiktok} target="_blank" rel="noopener noreferrer" style={{ color: "#F4ECE0", textDecoration: "none" }}>TIKTOK</a>
          <a href={window.TS_DATA.social.facebook} target="_blank" rel="noopener noreferrer" style={{ color: "#F4ECE0", textDecoration: "none" }}>FACEBOOK</a>
        </div>
      </div>
      <div style={{ marginTop: 14, fontSize: m ? 9 : 11, opacity: 0.5, ...SCstyles.mono }}>
        © 2026 TWISTED SPOONS ICE CREAM CEREAL BAR · CEREALIOUSLY DELICIOUS
      </div>
    </footer>
  );
}

function SCBackToTop() {
  const [vis, setVis] = React.useState(false);
  React.useEffect(() => {
    const fn = () => setVis(window.scrollY > 300);
    window.addEventListener('scroll', fn, { passive: true });
    return () => window.removeEventListener('scroll', fn);
  }, []);
  if (!vis) return null;
  return (
    <button
      onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
      style={{
        position: 'fixed', bottom: 24, right: 24, zIndex: 9998,
        width: 48, height: 48, borderRadius: '50%',
        background: 'var(--ts-pink)', color: '#fff',
        border: '3px solid #1A1410',
        boxShadow: '3px 3px 0 #1A1410',
        fontSize: 22, cursor: 'pointer',
        display: 'flex', alignItems: 'center', justifyContent: 'center',
        transition: 'transform .15s ease',
      }}
      onMouseEnter={e => e.currentTarget.style.transform = 'translateY(-2px)'}
      onMouseLeave={e => e.currentTarget.style.transform = 'translateY(0)'}
    >↑</button>
  );
}

function StickerCollage() {
  return (
    <div className="artboard-root" style={SCstyles.root}>
      <SCHero />
      <SCSwirlOfWeek />
      <SCMenu />
      <SCStory />
      <SCGallery />
      <SCParties />
      <SCVisit />
      <SCFooter />
      <SCBackToTop />
    </div>
  );
}

window.StickerCollage = StickerCollage;
