// Brown Ocean — homepage sections + reusable bits

const { useState: useS, useEffect: useE, useRef: useR, useMemo: useM } = React;

// ============== HERO ==============
function Hero({ variant = "editorial", showLeaves = true, onQuote }) {
  return (
    <section className="hero-gradient hero-section" style={{
      position: "relative",
      display: "flex", alignItems: "center",
      overflow: "hidden",
      borderBottomLeftRadius: 32, borderBottomRightRadius: 32,
      marginTop: -88
    }}>

      <FloatingLeaves show={showLeaves} density={4} />

      <div className="container" style={{ position: "relative", zIndex: 3, paddingTop: 24, paddingBottom: 40, width: "100%" }}>
        {variant === "editorial"  && <HeroEditorial onQuote={onQuote} />}
        {variant === "cinematic"  && <HeroCinematic onQuote={onQuote} />}
        {variant === "product"    && <HeroProductLed onQuote={onQuote} />}
      </div>

      {/* trust strip */}
      <div style={{
        position: "absolute", bottom: 0, left: 0, right: 0,
        background: "rgba(26, 15, 8, 0.55)",
        backdropFilter: "blur(8px)",
        WebkitBackdropFilter: "blur(8px)",
        borderTop: "1px solid rgba(245, 232, 216, 0.14)",
        padding: "16px 0",
        zIndex: 4,
        borderBottomLeftRadius: 32, borderBottomRightRadius: 32
      }}>
        <div className="container" style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 32, flexWrap: "wrap" }}>
          {CERTIFICATIONS.slice(0, 4).map(c => (
            <div key={c.code} style={{
              display: "flex", alignItems: "baseline", gap: 8,
              color: "var(--sand-300)", fontSize: 12
            }}>
              <span className="display" style={{ fontSize: 16, color: "var(--gold)", fontWeight: 600, letterSpacing: "0.04em" }}>{c.code}</span>
              <span className="mono" style={{ fontSize: 10, opacity: 0.6, letterSpacing: "0.08em" }}>CERTIFIED</span>
            </div>
          ))}
          <div className="mono" style={{ color: "var(--sand-300)", fontSize: 10, opacity: 0.6, letterSpacing: "0.14em" }}>
            EXPORTING SINCE MMXX
          </div>
        </div>
      </div>
    </section>
  );
}

function HeroEditorial({ onQuote }) {
  return (
    <div className="hero-editorial-grid">
      <div>
        <div className="eyebrow" style={{ color: "var(--gold)", marginBottom: 28 }}>
          BROWN OCEAN EXPORTS · SINGLE-ORIGIN MAKHANA
        </div>
        <h1 className="display" style={{
          fontSize: "clamp(48px, 7vw, 110px)",
          color: "var(--sand-100)",
          margin: 0,
          lineHeight: 0.95
        }}>
          The Euryale Ferox,<br/>
          <span className="display-italic" style={{ color: "var(--gold)" }}>raised to export grade.</span>
        </h1>
        <p style={{
          marginTop: 36, maxWidth: 520,
          fontSize: 18, lineHeight: 1.6,
          color: "var(--sand-300)"
        }}>
          Hand-harvested from Bihar's Purnia and Katihar wetlands. Graded, slow-roasted and shipped, traceable, to the world's better grocers.
        </p>
        <div style={{ display: "flex", gap: 14, marginTop: 44, flexWrap: "wrap" }}>
          <button className="btn btn-gold" onClick={onQuote}>Request Export Quote →</button>
          <a href="/products" className="btn btn-ghost" style={{ color: "var(--sand-100)", borderColor: "var(--sand-300)" }}>
            Explore the range
          </a>
        </div>

        <div style={{
          display: "flex", gap: 48, marginTop: 64, flexWrap: "wrap",
          paddingTop: 32, borderTop: "1px solid rgba(245, 232, 216, 0.18)"
        }}>
          {[
            ["12", "countries shipped"],
            ["18-24", "mm pop, hand-graded"],
            ["100%", "traceable to grower"]
          ].map(([k, v]) => (
            <div key={v}>
              <div className="display" style={{ fontSize: 36, color: "var(--sand-100)" }}>{k}</div>
              <div className="mono" style={{ fontSize: 11, color: "var(--sand-400)", marginTop: 4, textTransform: "uppercase", letterSpacing: "0.18em" }}>{v}</div>
            </div>
          ))}
        </div>
      </div>

      <div style={{ position: "relative" }}>
        <div style={{
          position: "relative", aspectRatio: "1",
          borderRadius: 32, overflow: "hidden",
          boxShadow: "0 30px 80px rgba(0,0,0,0.45)",
          background: "#F5E8D8"
        }}>
          <img
            src="assets/product-himalayan-salt.png"
            alt="Brown Ocean — Roasted Makhana, Himalayan Salt, 50g"
            loading="eager"
            style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }}
          />
        </div>

        <div style={{
          position: "absolute", top: -20, right: -20,
          background: "var(--sand-100)", color: "var(--brown-900)",
          padding: "14px 20px", borderRadius: 999,
          boxShadow: "0 10px 30px rgba(0,0,0,0.25)",
          display: "flex", alignItems: "center", gap: 10, fontSize: 13,
          border: "1px solid var(--line-soft)"
        }}>
          <span style={{ width: 8, height: 8, background: "var(--leaf)", borderRadius: "50%" }} />
          <span className="mono" style={{ fontSize: 11, letterSpacing: "0.14em", textTransform: "uppercase" }}>
            Available · FCL &amp; LCL
          </span>
        </div>

        <div style={{
          position: "absolute", left: -20, bottom: -20,
          background: "var(--brown-900)", color: "var(--sand-100)",
          padding: "16px 22px", borderRadius: 16,
          boxShadow: "0 10px 30px rgba(0,0,0,0.35)",
          display: "flex", flexDirection: "column", gap: 4,
          minWidth: 180
        }}>
          <div className="mono" style={{ fontSize: 10, opacity: 0.7, letterSpacing: "0.18em" }}>LOT 24-PUR-0142</div>
          <div className="display" style={{ fontSize: 18, color: "var(--gold)" }}>Himalayan Salt</div>
          <div style={{ display: "flex", gap: 14, marginTop: 6, fontSize: 11, color: "var(--sand-300)" }}>
            <span>22 mm pop</span>
            <span style={{ opacity: 0.4 }}>|</span>
            <span>50 g retail</span>
          </div>
        </div>
      </div>
    </div>
  );
}

function HeroCinematic({ onQuote }) {
  return (
    <div style={{ position: "relative", textAlign: "center", padding: "40px 0" }}>
      <div className="eyebrow" style={{ color: "var(--gold)", marginBottom: 32 }}>
        SINCE MMXX · BIHAR · INDIA
      </div>
      <h1 className="display" style={{
        fontSize: "clamp(64px, 12vw, 200px)",
        color: "var(--sand-100)",
        margin: 0, lineHeight: 0.92
      }}>
        Brown<br/>
        <span className="display-italic" style={{ color: "var(--gold)" }}>Ocean.</span>
      </h1>
      <p style={{
        margin: "40px auto 0", maxWidth: 540,
        fontSize: 19, lineHeight: 1.6, color: "var(--sand-300)"
      }}>
        Premium makhana from Bihar's Purnia and Katihar wetlands — graded, roasted, and shipped to fifty markets.
      </p>
      <div style={{ display: "flex", gap: 14, justifyContent: "center", marginTop: 44, flexWrap: "wrap" }}>
        <button className="btn btn-gold" onClick={onQuote}>Request Export Quote →</button>
        <a href="/products" className="btn btn-ghost" style={{ color: "var(--sand-100)", borderColor: "var(--sand-300)" }}>
          Explore the range
        </a>
      </div>
    </div>
  );
}

function HeroProductLed({ onQuote }) {
  return (
    <div className="hero-product-grid">
      <div style={{ textAlign: "right" }}>
        <div className="eyebrow" style={{ color: "var(--gold)" }}>FLAVOUR · 01</div>
        <div className="display" style={{ fontSize: 32, color: "var(--sand-100)", marginTop: 8 }}>Peri Peri</div>
        <div className="mono" style={{ fontSize: 11, color: "var(--sand-400)", marginTop: 4 }}>SPICY · AFRICAN HEAT</div>
      </div>
      <div style={{
        position: "relative", aspectRatio: "1",
        borderRadius: "50%", overflow: "hidden",
        border: "8px solid rgba(224, 176, 75, 0.4)",
        boxShadow: "0 30px 80px rgba(0,0,0,0.45)",
        background: "#4A2C1D",
        backgroundImage: "repeating-linear-gradient(-30deg, transparent 0 18px, rgba(224, 176, 75, 0.06) 18px 19px)"
      }}>
        <div style={{
          position: "absolute", inset: 0,
          display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center",
          background: "radial-gradient(ellipse at center, transparent 40%, rgba(42, 24, 16, 0.65))",
          color: "var(--sand-100)", textAlign: "center"
        }}>
          <h1 className="display" style={{ fontSize: "clamp(48px, 8vw, 120px)", margin: 0 }}>
            <span className="display-italic" style={{ color: "var(--gold)" }}>Eleven</span><br/>
            flavours.
          </h1>
        </div>
      </div>
      <div>
        <p style={{ fontSize: 16, color: "var(--sand-300)", lineHeight: 1.6 }}>
          From Himalayan Salt to Lime &amp; Mint — every flavour, batch-roasted on a single line and graded to the same export-ready standard.
        </p>
        <button className="btn btn-gold" onClick={onQuote} style={{ marginTop: 24 }}>Request Quote →</button>
      </div>
    </div>
  );
}

// ============== BRAND STORY ==============
function BrandStory() {
  return (
    <section id="story" className="section-pad">
      <div className="container">
        <div className="brand-story-grid">
          <Reveal>
            <SectionHeader
              eyebrow="ORIGIN"
              title="From the Purnia and Katihar wetlands"
              italic="to the world's pantry."
              body="Brown Ocean is the export imprint of Ascendance Agro Pvt Ltd. We work directly with farming families across Purnia, Katihar and Darbhanga — the three districts that produce ninety percent of the world's makhana."
            />
            <div style={{
              marginTop: 48, padding: 32,
              background: "var(--sand-100)",
              borderRadius: "var(--radius-lg)",
              boxShadow: "var(--shadow-sm)",
              borderLeft: "3px solid var(--leaf)"
            }}>
              <p className="display-italic" style={{
                fontSize: 22, lineHeight: 1.5,
                color: "var(--brown-800)", margin: 0
              }}>
                "Makhana is harvested from pond-water by hand, dried in the sun, and popped one kernel at a time. There is no industrial shortcut. That's why grade matters."
              </p>
              <div className="mono" style={{ marginTop: 20, color: "var(--brown-600)", fontSize: 11, letterSpacing: "0.14em" }}>
                — VISHAL · FOUNDER, ASCENDANCE AGRO
              </div>
            </div>
          </Reveal>
          <Reveal delay={0.15}>
            <div className="brand-story-images">
              <ImageFrame ratio="3 / 4" src="assets/wetland-purnia.jpg"
                alt="Purnia and Katihar wetlands · Purnia, Bihar" caption="↳ Wetland · Purnia, BR" />
              <ImageFrame ratio="3 / 4" src="assets/hand-grading.jpg"
                alt="Hand-graded raw makhana" caption="↳ Hand-grading · 22 mm pop" />
              <ImageFrame ratio="3 / 4" src="assets/slow-roast.jpg"
                alt="Slow-roasted makhana in wooden bowl" caption="↳ Slow-roast batch line" />
              <ImageFrame ratio="3 / 4" src="assets/grower-coop.jpg"
                alt="Purnia and Katihar farmer with lotus leaf" caption="↳ Purnia and Katihar grower co-op" />
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

// ============== DIFFERENTIATION ==============
function Differentiation() {
  return (
    <section id="why-us" className="section-pad" style={{
      background: "var(--brown-800)",
      color: "var(--sand-200)",
      borderRadius: 32,
      margin: "0 24px"
    }}>
      <div className="container">
        <Reveal>
          <SectionHeader
            light eyebrow="WHY BROWN OCEAN"
            title="Five things"
            italic="we do differently."
            body="Most exporters trade what passes muster. We trade only what we'd happily put on our own table."
          />
        </Reveal>
        <div className="diff-grid" style={{
          marginTop: 80,
          borderTop: "1px solid rgba(245, 232, 216, 0.15)",
          borderBottom: "1px solid rgba(245, 232, 216, 0.15)"
        }}>
          {DIFFERENTIATORS.map((d, i) => (
            <div key={d.n} style={{
              padding: "40px 24px",
              borderRight: i < 4 ? "1px solid rgba(245, 232, 216, 0.15)" : "none"
            }}>
              <div className="mono" style={{ color: "var(--gold)", marginBottom: 24, letterSpacing: "0.18em" }}>{d.n}</div>
              <h3 className="display" style={{ fontSize: 22, color: "var(--sand-100)", margin: 0, lineHeight: 1.15 }}>
                {d.title}
              </h3>
              <p style={{ marginTop: 16, fontSize: 14, lineHeight: 1.55, color: "var(--sand-300)" }}>
                {d.body}
              </p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ============== FLAVOUR SELECTOR ==============
function FlavourGrid({ onQuote }) {
  const [active, setActive] = useS(FLAVOURS[0].id);
  const f = FLAVOURS.find(x => x.id === active);

  return (
    <section id="flavours" className="section-pad">
      <div className="container">
        <Reveal>
          <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-end", flexWrap: "wrap", gap: 32 }}>
            <SectionHeader
              eyebrow="ROASTED RANGE"
              title="Eleven flavours,"
              italic="one line."
              body="Batch-roasted with cold-pressed sunflower oil. Nitrogen-flushed. Twelve-month shelf-life through ocean transit."
            />
            <button className="btn btn-primary" onClick={onQuote}>Request samples →</button>
          </div>
        </Reveal>

        <div className="flavour-outer-grid" style={{ marginTop: 72 }}>
          {/* Selector */}
          <div className="card flavour-selector-grid" style={{
            padding: 32,
            background: "var(--sand-100)"
          }}>
            {FLAVOURS.map((fl, i) => {
              const isActive = fl.id === active;
              return (
                <button key={fl.id}
                  onClick={() => { setActive(fl.id); if (window.gtag) window.gtag("event", "view_item", { item_id: fl.id, item_name: fl.name }); }}
                  style={{
                    textAlign: "left", padding: "18px 20px",
                    borderTop: i >= 2 ? "1px solid var(--line-soft)" : "none",
                    borderLeft: (i % 2 === 1) ? "1px solid var(--line-soft)" : "none",
                    background: isActive ? "var(--brown-800)" : "transparent",
                    color: isActive ? "var(--sand-100)" : "var(--brown-900)",
                    transition: "background 0.15s ease, color 0.15s ease",
                    borderRadius: 12,
                    cursor: "pointer",
                    display: "flex", alignItems: "center", gap: 14
                  }}>
                  <div style={{
                    width: 14, height: 14, borderRadius: "50%",
                    background: fl.color,
                    boxShadow: isActive ? "0 0 0 3px rgba(245, 232, 216, 0.25)" : "0 0 0 2px var(--line-soft)"
                  }} />
                  <div style={{ flex: 1 }}>
                    <div className="display" style={{ fontSize: 18, fontWeight: 500 }}>{fl.name}</div>
                    <div className="mono" style={{ fontSize: 10, opacity: 0.7, letterSpacing: "0.14em", textTransform: "uppercase", marginTop: 2 }}>
                      {fl.tag}
                    </div>
                  </div>
                  <div style={{ display: "flex", gap: 2 }}>
                    {[1, 2, 3, 4].map(n => (
                      <span key={n} style={{
                        width: 4, height: 12, borderRadius: 2,
                        background: n <= fl.heat ? (isActive ? "var(--gold)" : "var(--rust)") : "transparent",
                        border: n > fl.heat ? "1px solid currentColor" : "none",
                        opacity: n > fl.heat ? 0.3 : 1
                      }} />
                    ))}
                  </div>
                </button>
              );
            })}
          </div>

          {/* Detail card */}
          <div style={{ position: "relative" }}>
            <div className="card" key={f.id} style={{
              padding: 0, overflow: "hidden",
              animation: "fadeUp 0.4s ease-out"
            }}>
              <div style={{
                background: f.color,
                padding: "40px 36px",
                color: "#fff",
                position: "relative",
                minHeight: 180
              }}>
                <div className="mono" style={{ fontSize: 11, opacity: 0.85, letterSpacing: "0.18em" }}>
                  FLAVOUR · {String(FLAVOURS.findIndex(x => x.id === f.id) + 1).padStart(2, "0")}
                </div>
                <h3 className="display" style={{
                  fontSize: 56, margin: "12px 0 0", color: "#fff", lineHeight: 1
                }}>
                  {f.name}
                </h3>
                <div style={{ marginTop: 14, fontSize: 14, opacity: 0.9 }}>{f.tag}</div>
              </div>
              <div style={{ padding: "32px 36px" }}>
                <div className="eyebrow" style={{ marginBottom: 12 }}>SEASONING NOTES</div>
                <div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
                  {f.profile.map(p => (
                    <span key={p} style={{
                      padding: "6px 12px", borderRadius: 999,
                      background: "var(--sand-200)",
                      fontSize: 13, color: "var(--brown-800)"
                    }}>{p}</span>
                  ))}
                </div>
                <div style={{ marginTop: 32, display: "grid", gridTemplateColumns: "1fr 1fr", gap: 24 }}>
                  <div>
                    <div className="eyebrow" style={{ marginBottom: 8 }}>HEAT</div>
                    <div className="display" style={{ fontSize: 22, color: "var(--brown-800)" }}>
                      {["Mild", "Light", "Medium", "Hot", "Extra hot"][f.heat]}
                    </div>
                  </div>
                  <div>
                    <div className="eyebrow" style={{ marginBottom: 8 }}>SKU</div>
                    <div className="display" style={{ fontSize: 22, color: "var(--brown-800)" }}>
                      18g · 65g · 200g
                    </div>
                  </div>
                </div>
                <button className="btn btn-primary" onClick={() => onQuote(f.id)} style={{ marginTop: 28, width: "100%" }}>
                  Request quote — {f.name} →
                </button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ============== CATEGORIES ==============
function Categories({ onQuote }) {
  return (
    <section id="categories" className="section-pad">
      <div className="container">
        <Reveal>
          <SectionHeader
            align="center" eyebrow="TWO WAYS TO BUY"
            title="Trade-grade,"
            italic="or retail-ready."
          />
        </Reveal>
        <div className="categories-grid" style={{ marginTop: 80 }}>
          {CATEGORIES.map((c, i) => (
            <Reveal key={c.id} delay={i * 0.1}>
              <div className="card" style={{ overflow: "hidden", padding: 0, height: "100%", display: "flex", flexDirection: "column" }}>
                <div style={{ aspectRatio: "16 / 10", overflow: "hidden",
                  background: c.id === "raw" ? "var(--sand-300)" : "#E8D29A",
                  backgroundImage: c.img ? "none" : `repeating-linear-gradient(-30deg, transparent 0 16px, rgba(74, 44, 29, 0.07) 16px 17px)`,
                  display: "flex", alignItems: "center", justifyContent: "center"
                }}>
                  {c.img
                    ? <img src={c.img} alt={c.name} loading="lazy" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
                    : <span className="mono" style={{ color: "var(--brown-700)", fontSize: 11, letterSpacing: "0.18em" }}>↳ {c.placeholder}</span>
                  }
                </div>
                <div style={{ padding: 36, flex: 1, display: "flex", flexDirection: "column" }}>
                  <div className="eyebrow">{c.eyebrow}</div>
                  <h3 className="display" style={{ fontSize: 38, color: "var(--brown-900)", margin: "10px 0 16px" }}>{c.name}</h3>
                  <p style={{ color: "var(--ink-soft)", fontSize: 16, lineHeight: 1.6 }}>{c.body}</p>
                  <ul style={{ margin: "20px 0 32px", padding: 0, listStyle: "none", display: "grid", gap: 8 }}>
                    {c.bullets.map(b => (
                      <li key={b} style={{ display: "flex", alignItems: "center", gap: 10, fontSize: 14, color: "var(--brown-800)" }}>
                        <span style={{ width: 6, height: 6, background: "var(--leaf)", borderRadius: "50%" }} />
                        {b}
                      </li>
                    ))}
                  </ul>
                  <button className="btn btn-primary" onClick={() => onQuote(c.id)} style={{ marginTop: "auto", alignSelf: "flex-start" }}>
                    Request {c.name.toLowerCase()} quote →
                  </button>
                </div>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

// ============== INGREDIENTS ==============
function Ingredients() {
  return (
    <section id="ingredients" className="section-pad">
      <div className="container">
        <div className="ingredients-outer-grid">
          <Reveal>
            <SectionHeader
              eyebrow="WHAT'S IN THE PACK"
              title="Ingredients,"
              italic="declared."
              body="Plant-based, gluten-free, no preservatives. Every component disclosed in line with EU 1169/2011 and US FDA labelling."
            />
          </Reveal>
          <Reveal delay={0.15}>
            <div className="ingredients-inner-grid">
              <IngCol title="Base" tone="leaf" items={INGREDIENTS.base} />
              <IngCol title="Flavouring" tone="gold" items={INGREDIENTS.flavouring} />
              <div style={{ gridColumn: "1 / -1" }}>
                <div className="eyebrow" style={{ color: "var(--brown-600)", marginBottom: 16 }}>ADDITIVES (INS CODES)</div>
                <div className="additives-grid">
                  {INGREDIENTS.additives.map(a => (
                    <div key={a.code} style={{
                      background: "var(--sand-100)",
                      borderRadius: 14,
                      padding: "18px 18px",
                      border: "1px solid var(--line-soft)"
                    }}>
                      <div className="mono" style={{ color: "var(--brown-600)", letterSpacing: "0.14em" }}>{a.code}</div>
                      <div style={{ marginTop: 6, fontWeight: 500, color: "var(--brown-900)" }}>{a.name}</div>
                      <div style={{ marginTop: 4, fontSize: 12, color: "var(--ink-soft)" }}>{a.role}</div>
                    </div>
                  ))}
                </div>
              </div>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}
function IngCol({ title, items, tone }) {
  return (
    <div style={{
      background: "var(--sand-100)",
      borderRadius: 18,
      padding: 24,
      borderTop: `3px solid ${tone === "leaf" ? "var(--leaf)" : "var(--gold)"}`
    }}>
      <div className="eyebrow" style={{ marginBottom: 14 }}>{title}</div>
      <ul style={{ margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 10 }}>
        {items.map(it => (
          <li key={it} style={{ fontSize: 14, color: "var(--brown-900)", lineHeight: 1.4 }}>{it}</li>
        ))}
      </ul>
    </div>
  );
}

// ============== NUTRITION ==============
function NutritionTable() {
  const [variant, setVariant] = useS("raw");
  const data = NUTRITION[variant];
  return (
    <section id="nutrition" className="section-pad">
      <div className="container-narrow">
        <Reveal>
          <SectionHeader
            align="center" eyebrow="NUTRITION FACTS"
            title="Naturally"
            italic="nutrient-dense."
            body="Per 100 g, declared. Independent lab analysis on file — sent with every export consignment."
          />
        </Reveal>
        <div style={{ marginTop: 56, display: "flex", justifyContent: "center", gap: 6, flexWrap: "wrap" }}>
          {[["raw", "Raw kernels"], ["roasted", "Roasted, salted"]].map(([k, label]) => (
            <button key={k} onClick={() => setVariant(k)}
              style={{
                padding: "10px 22px",
                borderRadius: 999,
                background: variant === k ? "var(--brown-800)" : "transparent",
                color: variant === k ? "var(--sand-100)" : "var(--brown-700)",
                border: "1px solid var(--brown-700)",
                fontSize: 13, fontWeight: 500,
                transition: "background 0.2s ease"
              }}>
              {label}
            </button>
          ))}
        </div>
        <div className="card" style={{
          marginTop: 40, padding: "8px 0",
          background: "var(--sand-100)",
          overflow: "hidden"
        }}>
          <div style={{
            padding: "20px 36px",
            display: "flex", justifyContent: "space-between", alignItems: "baseline", flexWrap: "wrap", gap: 8,
            borderBottom: "2px solid var(--brown-800)"
          }}>
            <div>
              <div className="display" style={{ fontSize: 26, color: "var(--brown-900)" }}>Nutrition</div>
              <div className="mono" style={{ color: "var(--brown-600)", marginTop: 4 }}>SERVING · {data.serving}</div>
            </div>
            <div className="mono" style={{ color: "var(--brown-600)" }}>
              {variant.toUpperCase()}
            </div>
          </div>
          <div style={{ overflowX: "auto" }}>
            <table style={{ width: "100%", borderCollapse: "collapse", minWidth: 280 }}>
              <tbody>
                {data.rows.map((r, i) => (
                  <tr key={r.label} style={{ borderBottom: i < data.rows.length - 1 ? "1px solid var(--line-soft)" : "none" }}>
                    <td style={{
                      padding: "14px 24px",
                      fontSize: 15,
                      color: r.label.startsWith("—") ? "var(--ink-soft)" : "var(--brown-900)",
                      fontWeight: r.label.startsWith("—") ? 400 : 500,
                      paddingLeft: r.label.startsWith("—") ? 40 : 24
                    }}>
                      {r.label.replace("— ", "")}
                    </td>
                    <td style={{ padding: "14px 24px", textAlign: "right", fontFamily: "var(--mono)", color: "var(--brown-800)" }}>
                      <span style={{ fontSize: 18, fontWeight: 500 }}>{r.value}</span>
                      {r.unit && <span style={{ fontSize: 13, color: "var(--brown-600)", marginLeft: 6 }}>{r.unit}</span>}
                    </td>
                  </tr>
                ))}
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </section>
  );
}

// ============== CERTIFICATIONS ==============
function Certifications() {
  const [hovered, setHovered] = useS(null);
  return (
    <section id="certifications" className="section-pad">
      <div className="container">
        <Reveal>
          <SectionHeader
            align="center" eyebrow="CERTIFIED"
            title="Documented"
            italic="every step."
            body="From farm-gate to FOB. Every consignment ships with a complete document pack."
          />
        </Reveal>
        <div className="cert-grid" style={{ marginTop: 72 }}>
          {CERTIFICATIONS.map((c, i) => (
            <div key={c.code}
              onMouseEnter={() => setHovered(c.code)}
              onMouseLeave={() => setHovered(null)}
              style={{
                position: "relative",
                background: hovered === c.code ? "var(--brown-800)" : "var(--sand-100)",
                color: hovered === c.code ? "var(--sand-100)" : "var(--brown-900)",
                borderRadius: 22,
                padding: "36px 28px",
                aspectRatio: "1",
                display: "flex", flexDirection: "column", justifyContent: "space-between",
                boxShadow: "var(--shadow-sm)",
                transition: "background 0.3s ease, color 0.3s ease, transform 0.3s ease",
                transform: hovered === c.code ? "translateY(-4px)" : "none",
                cursor: "default",
                overflow: "hidden"
              }}>
              <div className="mono" style={{ letterSpacing: "0.18em", opacity: hovered === c.code ? 0.7 : 0.6 }}>
                SINCE {c.since}
              </div>
              <div className="display" style={{ fontSize: "clamp(36px, 4vw, 56px)", lineHeight: 1, fontWeight: 600 }}>
                {c.code}
              </div>
              <div style={{ fontSize: 12, lineHeight: 1.4, opacity: 0.85 }}>
                {hovered === c.code ? c.desc : c.full}
              </div>
              <div className="mono" style={{ fontSize: 10, opacity: 0.6 }}>
                {c.issued}
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ============== PROCESS TIMELINE ==============
function ProcessTimeline() {
  const [active, setActive] = useS(0);
  const refs = useR([]);
  useE(() => {
    const io = new IntersectionObserver((entries) => {
      entries.forEach(e => {
        if (e.isIntersecting) {
          const idx = Number(e.target.dataset.idx);
          setActive(idx);
        }
      });
    }, { threshold: 0.55, rootMargin: "-20% 0px -20% 0px" });
    refs.current.forEach(r => r && io.observe(r));
    return () => io.disconnect();
  }, []);

  return (
    <section id="process" className="section-pad" style={{ position: "relative" }}>
      <div className="container">
        <Reveal>
          <SectionHeader
            eyebrow="THE LINE"
            title="Five steps,"
            italic="from pond to port."
            body="Vertically integrated — every step under our supervision, in one Bihar facility."
          />
        </Reveal>

        <div className="process-outer-grid" style={{ marginTop: 96 }}>
          {/* Sticky image column */}
          <div className="process-sticky-col">
            <div style={{ position: "relative", aspectRatio: "4 / 5", borderRadius: "var(--radius-lg)", overflow: "hidden", boxShadow: "var(--shadow-lg)" }}>
              {PROCESS_STEPS.map((s, i) => {
                const tones = ["#4F7A4D", "#8C5A38", "#B88A2E", "#6B4226", "#3D2418"];
                return (
                  <div key={i} style={{
                    position: "absolute", inset: 0,
                    background: tones[i],
                    backgroundImage: s.img ? "none" : `repeating-linear-gradient(-30deg, transparent 0 18px, rgba(245, 232, 216, 0.06) 18px 19px)`,
                    display: "flex", alignItems: "center", justifyContent: "center",
                    opacity: active === i ? 1 : 0,
                    transition: "opacity 0.6s ease"
                  }}>
                    {s.img
                      ? <img src={s.img} alt={s.title} loading="lazy" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
                      : <div className="mono" style={{ color: "rgba(245, 232, 216, 0.7)", fontSize: 11, letterSpacing: "0.18em" }}>↳ {s.placeholder}</div>
                    }
                  </div>
                );
              })}
              <div style={{
                position: "absolute", inset: 0,
                background: "linear-gradient(180deg, transparent 60%, rgba(42, 24, 16, 0.7))",
                display: "flex", alignItems: "flex-end", padding: 32
              }}>
                <div style={{ color: "var(--sand-100)" }}>
                  <div className="mono" style={{ fontSize: 11, opacity: 0.8 }}>STEP {PROCESS_STEPS[active].n}</div>
                  <div className="display" style={{ fontSize: 28, marginTop: 4 }}>{PROCESS_STEPS[active].title}</div>
                </div>
              </div>
            </div>
          </div>

          {/* Step list */}
          <div style={{ position: "relative" }}>
            {/* vertical line */}
            <div style={{
              position: "absolute", left: 18, top: 0, bottom: 0,
              width: 2, background: "var(--line)"
            }} />
            <div style={{
              position: "absolute", left: 18, top: 0,
              width: 2, height: `${(active + 0.5) * (100 / PROCESS_STEPS.length)}%`,
              background: "var(--brown-800)",
              transition: "height 0.6s ease"
            }} />
            <div style={{ display: "grid", gap: 20 }}>
              {PROCESS_STEPS.map((s, i) => (
                <div key={s.n} ref={el => refs.current[i] = el} data-idx={i}
                  style={{
                    paddingLeft: 56,
                    paddingTop: 16, paddingBottom: 16,
                    minHeight: 200,
                    position: "relative"
                  }}>
                  {/* dot */}
                  <div style={{
                    position: "absolute", left: 12, top: 22,
                    width: 14, height: 14, borderRadius: "50%",
                    background: active === i ? "var(--brown-800)" : "var(--sand-300)",
                    border: "2px solid var(--brown-800)",
                    transition: "background 0.3s ease",
                    zIndex: 2
                  }} />
                  <div className="mono" style={{
                    color: active === i ? "var(--brown-800)" : "var(--brown-500)",
                    letterSpacing: "0.18em",
                    transition: "color 0.3s ease"
                  }}>
                    {s.n} · {s.region}
                  </div>
                  <h3 className="display" style={{
                    fontSize: 36, color: "var(--brown-900)", margin: "8px 0 12px",
                    opacity: active === i ? 1 : 0.5,
                    transition: "opacity 0.3s ease"
                  }}>
                    {s.title}
                  </h3>
                  <p style={{
                    fontSize: 16, lineHeight: 1.6, color: "var(--ink-soft)",
                    maxWidth: 460,
                    opacity: active === i ? 1 : 0.4,
                    transition: "opacity 0.3s ease"
                  }}>
                    {s.body}
                  </p>
                </div>
              ))}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ============== EXPORT MAP ==============
function ExportMap() {
  const [hovered, setHovered] = useS(null);
  return (
    <section id="exports" className="section-pad">
      <div className="container">
        <Reveal>
          <div className="export-map-grid">
            <div>
              <SectionHeader
                eyebrow="GLOBAL REACH"
                title="Twelve markets,"
                italic="and counting."
                body="From Mundra and JNPT, we ship FCL and LCL across four continents. In-house documentation, fumigation and phytosanitary clearance — no third-party hand-offs."
              />
              <div className="regions-grid" style={{ marginTop: 40 }}>
                {REGIONS.map(r => (
                  <button key={r.short}
                    onMouseEnter={() => setHovered(r.short)}
                    onMouseLeave={() => setHovered(null)}
                    style={{
                      textAlign: "left", padding: "10px 14px",
                      borderRadius: 10,
                      background: hovered === r.short ? "var(--brown-800)" : "transparent",
                      color: hovered === r.short ? "var(--sand-100)" : "var(--brown-900)",
                      transition: "all 0.15s ease",
                      fontSize: 14
                    }}>
                    <span className="mono" style={{ marginRight: 10, color: hovered === r.short ? "var(--gold)" : "var(--brown-500)", fontSize: 11 }}>
                      {r.short}
                    </span>
                    {r.name}
                  </button>
                ))}
              </div>
            </div>

            <div style={{
              position: "relative",
              background: "var(--sand-100)",
              borderRadius: "var(--radius-lg)",
              padding: 32,
              boxShadow: "var(--shadow-md)",
              aspectRatio: "10 / 7"
            }}>
              <svg viewBox="0 0 100 70" style={{ width: "100%", height: "100%" }}>
                {/* World silhouette — abstract dots */}
                {Array.from({ length: 690 }).map((_, i) => {
                  const x = (i % 30) * 3.4 + 1;
                  const y = Math.floor(i / 30) * 3 + 1;
                  const land = (
                    (x > 14 && x < 38 && y > 24 && y < 50) ||
                    (x > 24 && x < 34 && y > 48 && y < 65) ||
                    (x > 44 && x < 60 && y > 16 && y < 35) ||
                    (x > 46 && x < 66 && y > 35 && y < 68) ||
                    (x > 55 && x < 66 && y > 38 && y < 50) ||
                    (x > 64 && x < 90 && y > 22 && y < 56) ||
                    (x > 70 && x < 82 && y > 54 && y < 62) ||
                    (x > 78 && x < 92 && y > 60 && y < 68)
                  );
                  if (!land) return null;
                  return <circle key={i} cx={x} cy={y} r="0.7" fill="var(--brown-300)" opacity="0.4" />;
                })}
                {/* Origin */}
                <circle cx="68" cy="42" r="2" fill="var(--gold)" stroke="#fff" strokeWidth="0.6" />
                <text x="68" y="48" textAnchor="middle" fontSize="2.4" fill="var(--brown-900)" fontFamily="JetBrains Mono">BIHAR</text>
                {/* Routes */}
                {REGIONS.map(r => {
                  const isHover = hovered === r.short;
                  return (
                    <g key={r.short}>
                      <path d={`M68 42 Q ${(68 + r.x) / 2} ${Math.min(r.y, 42) - 15}, ${r.x} ${r.y}`}
                        stroke={isHover ? "var(--brown-800)" : "var(--brown-300)"}
                        strokeWidth={isHover ? 0.5 : 0.25}
                        strokeDasharray="0.8 0.8"
                        fill="none"
                        opacity={isHover ? 1 : 0.6} />
                      <circle cx={r.x} cy={r.y} r={isHover ? 1.4 : 1}
                        fill={isHover ? "var(--brown-800)" : "var(--leaf)"}
                        stroke="#fff" strokeWidth="0.4" />
                      {isHover && (
                        <text x={r.x} y={r.y - 3} textAnchor="middle" fontSize="2.4"
                          fill="var(--brown-900)" fontFamily="JetBrains Mono" fontWeight="500">{r.short}</text>
                      )}
                    </g>
                  );
                })}
              </svg>
              <div style={{ position: "absolute", bottom: 16, left: 24, right: 24, display: "flex", justifyContent: "space-between", alignItems: "center" }}>
                <div className="mono" style={{ fontSize: 10, color: "var(--brown-600)", letterSpacing: "0.18em" }}>
                  ORIGIN · BIHAR / IN
                </div>
                <div className="mono" style={{ fontSize: 10, color: "var(--brown-600)", letterSpacing: "0.18em" }}>
                  → {REGIONS.length} DESTINATIONS
                </div>
              </div>
            </div>
          </div>
        </Reveal>
      </div>
    </section>
  );
}

// ============== TESTIMONIALS ==============
function Testimonials() {
  const [active, setActive] = useS(0);
  return (
    <section id="testimonials" className="section-pad" style={{ background: "var(--sand-200)", margin: "0 24px", borderRadius: 32 }}>
      <div className="container">
        <Reveal>
          <SectionHeader
            align="center" eyebrow="WHAT BUYERS SAY"
            title="Trusted in"
            italic="twelve markets."
          />
        </Reveal>
        <div style={{ marginTop: 64, maxWidth: 880, margin: "64px auto 0" }}>
          <div className="card testimonial-card" style={{ background: "var(--sand-100)" }}>
            <div className="display" style={{ fontSize: 64, color: "var(--gold)", lineHeight: 0.5 }}>"</div>
            <p className="display-italic" style={{ fontSize: 24, lineHeight: 1.5, color: "var(--brown-900)", margin: "8px 0 0" }}>
              {TESTIMONIALS[active].quote}
            </p>
            <div style={{ marginTop: 32, display: "flex", justifyContent: "space-between", alignItems: "flex-end", flexWrap: "wrap", gap: 16 }}>
              <div>
                <div style={{ fontWeight: 500, color: "var(--brown-900)" }}>{TESTIMONIALS[active].author}</div>
                <div style={{ fontSize: 13, color: "var(--ink-soft)", marginTop: 4 }}>{TESTIMONIALS[active].company}</div>
              </div>
              <div className="mono" style={{ color: "var(--brown-600)", fontSize: 11, letterSpacing: "0.18em" }}>
                MARKET · {TESTIMONIALS[active].region}
              </div>
            </div>
          </div>
          <div style={{ display: "flex", gap: 8, justifyContent: "center", marginTop: 32 }}>
            {TESTIMONIALS.map((_, i) => (
              <button key={i} onClick={() => setActive(i)}
                style={{
                  width: active === i ? 32 : 8, height: 8,
                  borderRadius: 999,
                  background: active === i ? "var(--brown-800)" : "var(--brown-300)",
                  transition: "all 0.3s ease"
                }} />
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ============== FINAL CTA ==============
function FinalCTA({ onQuote }) {
  return (
    <section style={{ padding: "120px 0" }}>
      <div className="container">
        <div className="cta-inner-box" style={{
          background: "var(--brown-900)",
          color: "var(--sand-100)",
          borderRadius: 32,
          textAlign: "center",
          position: "relative",
          overflow: "hidden"
        }}>
          <FloatingLeaves show={true} density={3} />
          <div style={{ position: "relative", zIndex: 2 }}>
            <div className="eyebrow" style={{ color: "var(--gold)", marginBottom: 24 }}>READY TO TRADE?</div>
            <h2 className="display" style={{ fontSize: "clamp(40px, 7vw, 96px)", margin: 0 }}>
              Let's load your<br/>
              <span className="display-italic" style={{ color: "var(--gold)" }}>first container.</span>
            </h2>
            <p style={{ marginTop: 24, fontSize: 18, color: "var(--sand-300)", maxWidth: 540, margin: "24px auto 0" }}>
              Tell us what you need — we'll come back inside one business day with pricing, samples and a sailing schedule.
            </p>
            <button className="btn btn-gold" onClick={onQuote} style={{ marginTop: 44, padding: "18px 32px", fontSize: 15 }}>
              Request Export Quote →
            </button>
          </div>
        </div>
      </div>
    </section>
  );
}

Object.assign(window, {
  Hero, BrandStory, Differentiation, FlavourGrid, Categories,
  Ingredients, NutritionTable, Certifications, ProcessTimeline,
  ExportMap, Testimonials, FinalCTA
});
