// ─────────────────────────────────────────────────────────────────────────
// Django static asset resolver.
// window.NIRAN_ASSETS is injected by the template as {% static 'assets/' %}.
// Falls back to relative "assets/" for standalone/local preview.
const asset = (name) => (window.NIRAN_ASSETS || "assets/") + name;
// ─────────────────────────────────────────────────────────────────────────

// Niran — eco-friendly memorial wreath site
// Single-page scroll narrative. Reverent, dark-mode gallery feel.

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "palette": "ink",
  "typePair": "editorial",
  "density": "regular",
  "heroVariant": "asymmetric",
  "showThai": true
} /*EDITMODE-END*/;

// ───────────────────────────────────────────────────────────────────────────
// Data

const COLLECTIONS = [
{
  id: "shroud",
  no: "I",
  th: "พวงหรีดผ้าห่อศพ",
  en: "Shroud-cloth wreath",
  note: "Donated onward as shrouds for those in need.",
  items: [
  { sku: "NR3001", img: asset("NR3001.png"), price: 1500, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 3 ผืน" },
  { sku: "NR3002", img: asset("NR3002.png"), price: 1500, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 3 ผืน" },
  { sku: "NR5001", img: asset("NR5001.png"), price: 1900, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 5 ผืน" },
  { sku: "NR5002", img: asset("NR5002.png"), price: 1900, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 5 ผืน" },
  { sku: "NR5003", img: asset("NR5003.png"), price: 1900, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 5 ผืน" },
  { sku: "NR5004", img: asset("NR5004.png"), price: 1900, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 5 ผืน" },
  { sku: "NR8001", img: asset("NR8001.png"), price: 2500, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 8 ผืน" },
  { sku: "NR8002", img: asset("NR8002.png"), price: 2500, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 8 ผืน" },
  { sku: "NR1001", img: asset("NR1001.jpg"), price: 2900, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 10 ผืน" },
  { sku: "NR1002", img: asset("NR1002.jpg"), price: 2900, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 10 ผืน" },
  { sku: "NR1003", img: asset("NR1003.jpg"), price: 2900, desc: "บริจาคต่อเป็นชุดผ้าห่อศพ 10 ผืน" }]

},
{
  id: "uniform",
  no: "II",
  th: "พวงหรีดชุดนักเรียน",
  en: "School-uniform wreath",
  note: "Donated onward as school uniforms for students in need.",
  items: [
  { sku: "NU2001", img: asset("NU2001.png"), price: 3000, desc: "บริจาคต่อเป็นชุดนักเรียน 2 ชุด" },
  { sku: "NU2002", img: asset("NU2002.png"), price: 3000, desc: "บริจาคต่อเป็นชุดนักเรียน 2 ชุด" },
  { sku: "NU2003", img: asset("NU2003.png"), price: 3000, desc: "บริจาคต่อเป็นชุดนักเรียน 2 ชุด" },
  { sku: "NU2004", img: asset("NU2004.png"), price: 3000, desc: "บริจาคต่อเป็นชุดนักเรียน 2 ชุด" },
  { sku: "NU4001", img: asset("NU4001.png"), price: 5000, desc: "บริจาคต่อเป็นชุดนักเรียน 4 ชุด" }]

},
{
  id: "phakhaoma",
  no: "III",
  th: "พวงหรีดผ้าขาวม้า",
  en: "Pha Khao Ma wreath",
  note: "Returned to communities as Pha Khao Ma — a working cloth that generates income.",
  items: [
  { sku: "NP3001", img: asset("NP3001.png"), price: 1750, desc: "บริจาคต่อเป็นผ้าขาวม้า 3 ผืน" }]

}];



const PALETTES = {
  ink: { bg: "#0e0e0c", fg: "#e8e2d5", fgSoft: "rgba(232,226,213,.62)", fgDim: "rgba(232,226,213,.36)", tan: "#a89678", green: "#0f3a32", gold: "#c9a86b", rule: "rgba(232,226,213,.14)", isDark: true },
  forest: { bg: "#0c2520", fg: "#ede8da", fgSoft: "rgba(237,232,218,.66)", fgDim: "rgba(237,232,218,.40)", tan: "#b8a17a", green: "#0f3a32", gold: "#d4b878", rule: "rgba(237,232,218,.16)", isDark: true },
  bone: { bg: "#ede7df", fg: "#1a1a18", fgSoft: "rgba(26,26,24,.62)", fgDim: "rgba(26,26,24,.34)", tan: "#8a7a66", green: "#0f3a32", gold: "#8a6f3a", rule: "rgba(26,26,24,.16)", isDark: false }
};

const TYPE_PAIRS = {
  editorial: {
    label: "Editorial",
    display: '"Cormorant Garamond", serif',
    body: '"IBM Plex Sans", system-ui, sans-serif',
    mono: '"IBM Plex Mono", ui-monospace, monospace',
    thai: '"Arimo", system-ui, sans-serif',
    displayWeight: 300,
    displayItalic: true
  },
  quiet: {
    label: "Quiet",
    display: '"Tenor Sans", serif',
    body: '"Manrope", system-ui, sans-serif',
    mono: '"JetBrains Mono", ui-monospace, monospace',
    thai: '"Arimo", system-ui, sans-serif',
    displayWeight: 400,
    displayItalic: false
  },
  archive: {
    label: "Archive",
    display: '"Italiana", serif',
    body: '"Work Sans", system-ui, sans-serif',
    mono: '"Space Mono", ui-monospace, monospace',
    thai: '"Arimo", system-ui, sans-serif',
    displayWeight: 400,
    displayItalic: false
  }
};

const DENSITY = {
  compact: { gutter: "clamp(16px,3vw,40px)", pad: "clamp(56px,9vw,120px)" },
  regular: { gutter: "clamp(20px,4vw,56px)", pad: "clamp(80px,12vw,180px)" },
  airy: { gutter: "clamp(28px,6vw,80px)", pad: "clamp(120px,16vw,240px)" }
};

// ───────────────────────────────────────────────────────────────────────────
// Hooks & helpers

function useReveal() {
  React.useEffect(() => {
    const els = document.querySelectorAll(".reveal");
    const io = new IntersectionObserver((entries) => {
      entries.forEach((e) => {
        if (e.isIntersecting) {
          e.target.classList.add("in");
          io.unobserve(e.target);
        }
      });
    }, { threshold: 0.12, rootMargin: "0px 0px -8% 0px" });
    els.forEach((el) => io.observe(el));
    return () => io.disconnect();
  });
}

function useScrollY() {
  const [y, setY] = React.useState(0);
  React.useEffect(() => {
    const onScroll = () => setY(window.scrollY);
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
  return y;
}

// ───────────────────────────────────────────────────────────────────────────
// Components

function ApplyTheme({ palette, typePair, density }) {
  React.useEffect(() => {
    const p = PALETTES[palette] || PALETTES.ink;
    const t = TYPE_PAIRS[typePair] || TYPE_PAIRS.editorial;
    const d = DENSITY[density] || DENSITY.regular;
    const r = document.documentElement.style;
    r.setProperty("--bg", p.bg);
    r.setProperty("--fg", p.fg);
    r.setProperty("--fg-soft", p.fgSoft);
    r.setProperty("--fg-dim", p.fgDim);
    r.setProperty("--tan", p.tan);
    r.setProperty("--green", p.green);
    r.setProperty("--gold", p.gold);
    r.setProperty("--rule", p.rule);
    r.setProperty("--font-display", t.display);
    r.setProperty("--font-body", t.body);
    r.setProperty("--font-mono", t.mono);
    r.setProperty("--font-thai", t.thai);
    r.setProperty("--display-weight", t.displayWeight);
    r.setProperty("--display-style", t.displayItalic ? "italic" : "normal");
    r.setProperty("--gutter", d.gutter);
    r.setProperty("--section-pad", d.pad);
    document.body.dataset.dark = p.isDark ? "1" : "0";
  }, [palette, typePair, density]);
  return null;
}

function Nav() {
  const y = useScrollY();
  const past = y > 80;
  const [open, setOpen] = React.useState(false);
  const navLinks = [
    ["Collection", "#collection"],
    ["Story", "#story"],
    ["Atelier", "#atelier"],
    ["Source", "#source"],
    ["Process", "#process"],
    ["Afterlife", "#afterlife"],
    ["Distributors", "#distributors"],
    ["Service", "#service"],
    ["Recognition", "#recognition"],
  ];
  const navStyle = {
    position: "fixed", top: 0, left: 0, right: 0, zIndex: 50,
    display: "flex", alignItems: "center", justifyContent: "space-between",
    padding: `${past ? "14px" : "22px"} var(--gutter)`,
    transition: "padding .35s ease, background .35s ease, border-color .35s ease",
    background: (past || open) ? "color-mix(in oklab, var(--bg) 94%, transparent)" : "transparent",
    backdropFilter: (past || open) ? "blur(14px)" : "none",
    WebkitBackdropFilter: (past || open) ? "blur(14px)" : "none",
    borderBottom: (past || open) ? "1px solid var(--rule)" : "1px solid transparent",
    pointerEvents: "auto",
    flexWrap: "wrap",
  };
  return (
    <header style={navStyle}>
      {/* Logo + hamburger row */}
      <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", flexWrap: "nowrap" }}>
        <a href="#top" style={{ display: "flex", alignItems: "center", gap: 12 }}>
          <img src={asset("niran-logo.png")} alt="" style={{
            width: 38, height: 38, objectFit: "cover", flexShrink: 0,
            display: "block", borderRadius: "50%"
          }} />
          <span style={{
            fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
            fontWeight: 400, fontSize: 22, letterSpacing: ".18em"
          }}>NIRAN</span>
          <span className="label" style={{ fontSize: 9.5, opacity: .55, marginLeft: 4 }}>EST 2023</span>
        </a>

        {/* Desktop nav */}
        <nav style={{ display: "flex", gap: 28, flexWrap: "wrap" }} className="nav-desktop">
          {navLinks.map(([t, href]) =>
            <a key={href} href={href} className="label" style={{ fontSize: 10.5, transition: "color .3s" }}
              onMouseEnter={(e) => e.currentTarget.style.color = "var(--fg)"}
              onMouseLeave={(e) => e.currentTarget.style.color = "var(--fg-soft)"}>{t}</a>
          )}
        </nav>

        {/* Hamburger button (mobile only, shown via CSS) */}
        <button
          className="nav-hamburger"
          onClick={() => setOpen(o => !o)}
          aria-label="เมนู"
          style={{
            flexDirection: "column", justifyContent: "center", gap: 5, padding: "6px",
            background: "none", border: "none", cursor: "pointer",
          }}
        >
          <span style={{ display: "block", width: 22, height: 1.5, background: open ? "transparent" : "var(--fg)", transition: "all .25s",
            transform: open ? "rotate(45deg) translate(4px,4px)" : "none" }}></span>
          <span style={{ display: "block", width: 22, height: 1.5, background: "var(--fg)", transition: "all .25s",
            transform: open ? "rotate(-45deg)" : "none" }}></span>
          {!open && <span style={{ display: "block", width: 14, height: 1.5, background: "var(--fg)", transition: "all .25s" }}></span>}
        </button>
      </div>

      {/* Mobile contact bar — inside fixed header so it doesn't get overlapped */}
      <div className="mobile-contact-bar" style={{ display: open ? "none" : undefined, padding: 0, background: "none", border: "none" }}>
        <a href="tel:0828384994">
          <img src={asset("images/niranImg/icons/telephone-call@2x.png")} alt="" />
          082 838 4994
        </a>
        <span className="mcb-sep">|</span>
        <a href="https://lin.ee/KpuPbQ0" target="_blank" rel="noopener noreferrer">
          <img src={asset("images/niranImg/icons/icons8-line-96.png")} alt="" />
          @niranwreath
        </a>
      </div>

      {/* Mobile drawer — always in DOM, toggled via display */}
      <nav className="nav-drawer" style={{
        width: "100%",
        display: open ? "flex" : "none",
        flexDirection: "column",
        paddingBottom: 20,
        borderTop: "1px solid var(--rule)",
        marginTop: 10,
      }}>
        {navLinks.map(([t, href]) =>
          <a key={href} href={href}
            onClick={() => setOpen(false)}
            style={{
              fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".16em",
              textTransform: "uppercase", padding: "14px 0",
              borderBottom: "1px solid var(--rule)", color: "var(--fg-soft)",
              textDecoration: "none", display: "block",
            }}
            onMouseEnter={(e) => e.currentTarget.style.color = "var(--fg)"}
            onMouseLeave={(e) => e.currentTarget.style.color = "var(--fg-soft)"}
          >{t}</a>
        )}
      </nav>
    </header>
  );
}

function Hero({ variant, showThai }) {
  const y = useScrollY();
  const parallax = Math.min(y * 0.18, 120);
  const fade = Math.max(0, 1 - y / 540);

  if (variant === "centered") return <HeroCentered showThai={showThai} parallax={parallax} fade={fade} />;
  if (variant === "fullbleed") return <HeroFull showThai={showThai} parallax={parallax} fade={fade} />;
  return <HeroAsymmetric showThai={showThai} parallax={parallax} fade={fade} />;
}

function HeroAsymmetric({ showThai, parallax, fade }) {
  return (
    <section id="top" className="hero-grid" style={{
      minHeight: "100vh", display: "grid",
      gridTemplateColumns: "minmax(0,1fr) minmax(0,1.05fr)",
      alignItems: "center", gap: "clamp(24px,5vw,80px)",
      paddingTop: "clamp(120px,16vh,180px)",
      paddingBottom: "clamp(60px,8vh,100px)",
      position: "relative"
    }}>
      <div style={{ opacity: fade }}>
        <div className="label" style={{ marginBottom: 28 }}>
          <span style={{ color: "var(--gold)" }}></span>
        </div>
        {showThai &&
        <div style={{
          fontFamily: '"Charmonman", "Arimo", system-ui, cursive',
          fontWeight: 400,
          fontSize: "clamp(46px,7vw,96px)",
          lineHeight: 1.35, letterSpacing: "-.005em",
          marginBottom: 18,
          color: "var(--gold)"
        }}>
            ไว้อาลัย<br />ไม่ทิ้งอะไร
          </div>
        }
        <h1 style={{
          margin: 0,
          fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(34px,4.6vw,68px)",
          lineHeight: 1.05, letterSpacing: "-.01em",
          color: "var(--fg)"
        }}>
          Turning Grief<br />into<br />Giving.
        </h1>
        <p style={{
          marginTop: 36, maxWidth: 520,
          color: "var(--fg-soft)",
          fontFamily: "var(--font-thai)",
          fontSize: "clamp(17px, 1.4vw, 21px)",
          lineHeight: 1.6, fontWeight: 400
        }}>
          พวงหรีดผ้าที่ไม่จบแค่งานศพ — แต่ยังคงมีคุณค่าต่อไป
        </p>
        <div style={{ display: "flex", gap: 28, marginTop: 44, alignItems: "center" }}>
          <a href="#collection" style={{
            fontFamily: "var(--font-body)", fontSize: 13,
            letterSpacing: ".02em",
            borderBottom: "1px solid var(--fg)", paddingBottom: 4,
            transition: "color .3s, border-color .3s"
          }}>View the collection</a>
          <a href="#story" className="label" style={{ fontSize: 10.5, fontFamily: "\"IBM Plex Sans\"" }}>Our story →</a>
        </div>
      </div>

      <div style={{ position: "relative", height: "min(92vh, 920px)" }}>
        <div style={{
          position: "absolute", inset: 0,
          transform: `translateY(${parallax * -0.3}px)`,
          transition: "transform .1s linear"
        }}>
          <img src={asset("hero-founder-v2.jpg")} alt="Orn-Napat (Earn), founder of Niran, with a pleated cotton wreath" style={{
            width: "100%", height: "100%", objectFit: "cover", objectPosition: "center top",
            filter: "contrast(1.02)"
          }} />
        </div>
        {/* Edition tag floating over image */}
        <div style={{
          position: "absolute", right: 0, bottom: -2,
          padding: "10px 14px", background: "var(--bg)",
          display: "flex", flexDirection: "column", gap: 4
        }}>
          <div className="label" style={{ fontSize: 10 }}></div>
          <div className="label" style={{ fontSize: 9.5, color: "var(--fg-dim)" }}></div>
        </div>
      </div>

      {/* Scroll hint */}
      <div style={{
        position: "absolute", bottom: 34, left: "var(--gutter)",
        display: "flex", alignItems: "center", gap: 10, opacity: fade
      }}>
        <span style={{ width: 32, height: 1, background: "var(--fg-soft)" }} />
        <span className="label" style={{ fontSize: 9.5 }}>Scroll</span>
      </div>
    </section>);

}

function HeroCentered({ showThai, fade }) {
  return (
    <section id="top" style={{
      minHeight: "100vh", display: "grid", placeItems: "center",
      paddingTop: "clamp(120px,16vh,180px)", paddingBottom: 60,
      textAlign: "center", position: "relative"
    }}>
      <div style={{ opacity: fade, maxWidth: 980 }}>
        <div className="label" style={{ marginBottom: 36 }}>
          Niran &nbsp;·&nbsp; พวงหรีดผ้า &nbsp;·&nbsp; Bangkok
        </div>
        {showThai &&
        <div style={{
          fontFamily: '"Charmonman", "Arimo", system-ui, cursive',
          fontWeight: 400,
          fontSize: "clamp(56px,8.5vw,140px)", lineHeight: 1.35, marginBottom: 22,
          color: "var(--gold)"
        }}>ไว้อาลัย<br />ไม่ทิ้งอะไร</div>
        }
        <h1 style={{
          margin: 0,
          fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(40px,6vw,92px)", lineHeight: 1.04, letterSpacing: "-.01em"
        }}>A farewell that keeps giving.</h1>
        <img src={asset("hero-founder-v2.jpg")} alt="" style={{
          margin: "64px auto 0", width: "min(520px, 70vw)", height: "auto"
        }} />
      </div>
    </section>);

}

function HeroFull({ showThai, parallax }) {
  return (
    <section id="top" style={{
      minHeight: "100vh", padding: 0, position: "relative", overflow: "hidden"
    }}>
      <img src={asset("hero-founder-v2.jpg")} alt="" style={{
        position: "absolute", inset: 0, width: "100%", height: "115%",
        objectFit: "cover", objectPosition: "center 30%",
        transform: `translateY(${parallax * -0.4}px)`,
        filter: "brightness(.88) contrast(1.03)"
      }} />
      <div style={{
        position: "absolute", inset: 0,
        background: "linear-gradient(to right, rgba(0,0,0,.55), rgba(0,0,0,.0) 55%, rgba(0,0,0,.4))"
      }} />
      <div style={{
        position: "absolute", left: "var(--gutter)", bottom: "12vh", right: "var(--gutter)",
        color: "#e8e2d5"
      }}>
        {showThai &&
        <div style={{
          fontFamily: '"Charmonman", "Arimo", system-ui, cursive',
          fontWeight: 400,
          fontSize: "clamp(46px,6.6vw,100px)", lineHeight: 1.35,
          color: "var(--gold)"
        }}>ไว้อาลัย<br />ไม่ทิ้งอะไร</div>
        }
        <h1 style={{
          margin: "10px 0 0",
          fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
          fontWeight: 300, fontSize: "clamp(34px,4.6vw,68px)", lineHeight: 1.04
        }}>A farewell that keeps giving.</h1>
      </div>
    </section>);

}

// ───────────────────────────────────────────────────────────────────────────

function Manifesto() {
  const thaiBody = {
    margin: 0, fontFamily: "var(--font-thai)",
    fontSize: "clamp(17px, 1.3vw, 20px)", lineHeight: 1.75,
    color: "var(--fg)"
  };
  const enBody = {
    margin: 0, fontFamily: "var(--font-body)",
    fontSize: "clamp(17px, 1.3vw, 20px)", lineHeight: 1.7,
    color: "var(--fg)"
  };
  const quoteBase = {
    margin: 0, paddingLeft: "clamp(18px, 1.6vw, 28px)",
    borderLeft: "1px solid var(--fg-soft)",
    fontStyle: "italic",
    color: "var(--fg)"
  };

  return (
    <section id="story" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      <header className="reveal" style={{
        marginBottom: "clamp(48px, 6vw, 88px)",
        display: "flex", alignItems: "baseline", gap: 18
      }}>
        <div className="label" style={{ fontSize: "20px" }}>02 — STORY</div>
        <div style={{ flex: 1, height: 1, background: "var(--rule)" }} />
      </header>

      <div className="reveal story-grid" style={{
        display: "grid",
        gridTemplateColumns: "minmax(0, 0.85fr) minmax(0, 1fr) minmax(0, 1fr)",
        gap: "clamp(36px, 5vw, 88px)",
        alignItems: "start"
      }}>
        {/* Founder portrait */}
        <figure style={{ margin: 0, position: "sticky", top: 110 }}>
          <div style={{
            aspectRatio: "3/4", overflow: "hidden", background: "#1a1816"
          }}>
            <img src={asset("story-hands-fabric.jpg")}
            alt="Hands on cream NIRAN cotton in late-afternoon light"
            loading="lazy" style={{
              width: "100%", height: "100%", objectFit: "cover",
              objectPosition: "center",
              filter: "contrast(1.02)"
            }} />
          </div>
          <figcaption className="label" style={{
            marginTop: 14, color: "var(--fg-dim)",
            display: "flex", justifyContent: "space-between", gap: 10
          }}>
            <span></span>
            <span></span>
          </figcaption>
        </figure>

        {/* Thai column */}
        <div style={{ display: "flex", flexDirection: "column", gap: "clamp(22px, 2vw, 32px)" }}>
          <p style={thaiBody}>
            งานศพคือช่วงเวลาที่ทุกคนอยากมอบสิ่งที่ดีที่สุด นิรันดร์จึงเกิดขึ้นจากคำถามง่าย ๆ ว่า —
          </p>
          <blockquote style={{
            ...quoteBase,
            fontFamily: "var(--font-thai)",
            fontSize: "clamp(18px, 1.45vw, 22px)", lineHeight: 1.65
          }}>
            “ถ้าสิ่งที่เราส่งมอบ ในวันสุดท้าย ยังคงมีคุณค่าต่อไปได้ ทำไมเราถึงไม่ทำแบบนั้น?”
          </blockquote>
          <p style={thaiBody}>
            ผ้าทุกผืนของเราจึงเดินทางต่อ — เป็นชุดนักเรียน เป็นผ้าห่อศพ หรือผ้าขาวม้าที่สร้างรายได้คืนสู่ชุมชน
          </p>
          <p style={{ ...thaiBody, color: "var(--fg-soft)" }}>
            เพราะการไว้อาลัยที่ดี ไม่จำเป็นต้องทิ้งอะไรไว้เบื้องหลัง
          </p>
        </div>

        {/* English column */}
        <div style={{ display: "flex", flexDirection: "column", gap: "clamp(22px, 2vw, 32px)" }}>
          <p style={enBody}>
            A funeral is the moment everyone wants to give their best.
            Niran was born from a simple question:
          </p>
          <blockquote style={{
            ...quoteBase,
            fontFamily: "var(--font-display)",
            fontWeight: "var(--display-weight)",
            fontSize: "clamp(22px, 1.9vw, 30px)", lineHeight: 1.4, letterSpacing: "-.005em"
          }}>
            “If what we give on someone’s final day can still create value
            — why wouldn’t we?”
          </blockquote>
          <p style={enBody}>
            Every piece of fabric we use travels on —
            becoming a school uniform, a shroud, or <em style={{ fontStyle: "italic" }}>Pha Khao Ma</em> that
            gives back to local communities.
          </p>
          <p style={{ ...enBody, color: "var(--fg-soft)" }}>
            Because a meaningful farewell doesn’t have to leave anything behind.
          </p>
        </div>
      </div>

      {/* Impact stats */}
      <div className="reveal" style={{
        marginTop: "clamp(72px, 10vw, 140px)",
        paddingTop: "clamp(28px, 3vw, 44px)",
        borderTop: "1px solid var(--rule)",
        display: "grid",
        gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))",
        gap: "clamp(28px, 4vw, 64px)",
        alignItems: "start"
      }}>
        <ImpactStat n="680" l1="ชีวิตที่ดีขึ้น" l2="จากพวงหรีดของคุณ" />
        <ImpactStat n="0" l1="ขยะที่เกิดขึ้น" l2="จากทุกออร์เดอร์" />
        <ImpactStat n="400+" l1="ครอบครัวที่ไว้วางใจ" l2="นิรันดร์ทุกเดือน" />
        <ImpactStat n="1" l1="แบรนด์แรกในไทย" l2="ที่ทำสิ่งนี้" />
      </div>
    </section>);

}

function ImpactStat({ n, l1, l2 }) {
  return (
    <div style={{ display: "flex", flexDirection: "column", gap: "clamp(14px, 1.2vw, 22px)" }}>
      <div style={{
        fontFamily: "var(--font-display)", fontStyle: "italic",
        fontWeight: 400,
        fontSize: "clamp(48px, 5.6vw, 88px)",
        lineHeight: 1, letterSpacing: "-.01em",
        color: "var(--gold)"
      }}>{n}</div>
      <div style={{
        fontFamily: "var(--font-thai)",
        fontSize: "clamp(14px, 1.05vw, 16px)",
        lineHeight: 1.55,
        color: "var(--fg-soft)"
      }}>
        <div>{l1}</div>
        <div>{l2}</div>
      </div>
    </div>);

}

// ───────────────────────────────────────────────────────────────────────────
// Atelier — sunlit editorial collage of process photos.
// Tonally lighter than the rest of the page; warm cream against ink.

function Atelier() {
  const steps = [
  {
    n: "01",
    img: asset("atelier-portrait.jpg"),
    thName: "คัดสรรผ้า",
    enName: "Selecting the fabric",
    thBody: "เราเลือกใช้เฉพาะผ้าธรรมชาติที่ไม่ผ่านการฟอกย้อม ทุกผืนถูกพิจารณาด้วยมือก่อนเริ่มงาน เพราะเนื้อผ้าที่ดีคือจุดเริ่มต้นของทุกสิ่ง",
    enBody: "Only undyed natural fibre passes our hands. The feel of the fabric is the first decision."
  },
  {
    n: "02",
    img: asset("atelier-cutting.jpg"),
    thName: "ตัดและจัดวาง",
    enName: "Cutting and arranging",
    thBody: "ไม่มีแม่พิมพ์ ไม่มีเครื่องจักร ช่างทุกคนพับ ตัด และจัดวางผ้าด้วยมือ ความไม่เหมือนกันเล็กน้อยในแต่ละชิ้นคือหลักฐานของความเป็นมนุษย์",
    enBody: "No moulds, no machines. Each fold and cut is human — which is why no two are identical."
  },
  {
    n: "03",
    img: asset("step3-pinning.jpg"),
    thName: "ประกอบและตรวจสอบ",
    enName: "Building and checking",
    thBody: "พวงหรีดทุกชิ้นผ่านการตรวจก่อนออกจากมือช่าง เราไม่รีบ เพราะสิ่งที่จะไปอยู่ในพิธีสำคัญของครอบครัวต้องสมบูรณ์",
    enBody: "Every wreath is checked before it leaves. It will stand at the most important moment of a family's life."
  },
  {
    n: "04",
    img: asset("step4-brochure.jpg"),
    thName: "ส่งต่อด้วยความหมาย",
    enName: "Passed on with purpose",
    thBody: "เมื่องานจบลง ผ้าไม่ถูกทิ้ง แต่เดินทางต่อ — กลับมาที่เรา เพื่อถูกแยก ซัก และส่งต่อในรูปแบบใหม่ที่ยังคงมีคุณค่า",
    enBody: "When the ceremony ends, the fabric doesn't stop. It returns, is remade, and lives on."
  }];


  return (
    <section id="atelier" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      {/* Header */}
      <header className="reveal" style={{ marginBottom: "clamp(64px, 7vw, 110px)" }}>
        <div className="label" style={{ marginBottom: 28, fontSize: "20px" }}>03 — MADE BY HAND

        </div>
        <h2 style={{
          margin: 0, maxWidth: 1040,
          fontFamily: "var(--font-thai)",
          fontStyle: "italic", fontWeight: 400,
          fontSize: "clamp(28px, 3.4vw, 54px)", lineHeight: 1.35,
          letterSpacing: "-.003em",
          color: "rgba(232, 226, 213, 0.32)"
        }}>
          พวงหรีดแต่ละชิ้นไม่ได้แค่ถูกประกอบ<br />
          แต่ถูกสร้างขึ้นด้วยความตั้งใจ
        </h2>
        <p style={{
          margin: "22px 0 0", maxWidth: 760,
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(18px, 1.5vw, 24px)", lineHeight: 1.5,
          color: "var(--fg-soft)"
        }}>
          Each wreath is not assembled — it is made with intention.
        </p>
      </header>

      {/* 2×2 step grid */}
      <div className="reveal step-grid">
        {steps.map((s) =>
        <article key={s.n} className="step-cell">
            <div style={{
            aspectRatio: "4/3",
            overflow: "hidden",
            background: "#1a1816",
            marginBottom: "clamp(8px, 1vw, 14px)"
          }}>
              <img src={s.img} alt={s.enName} loading="lazy" style={{
              width: "100%", height: "100%", objectFit: "cover",
              filter: "contrast(1.02)"
            }} />
            </div>
            <div style={{
            fontFamily: "var(--font-display)", fontStyle: "italic",
            fontWeight: 400,
            fontSize: "clamp(48px, 5.6vw, 84px)",
            lineHeight: 1, letterSpacing: "-.01em",
            color: "var(--gold)"
          }}>{s.n}</div>
            <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
              <div style={{
              fontFamily: "var(--font-thai)", fontStyle: "italic",
              fontSize: "clamp(18px, 1.4vw, 22px)",
              color: "var(--fg-dim)",
              fontWeight: 400
            }}>{s.thName}</div>
              <div style={{
              fontFamily: "var(--font-mono)",
              fontSize: "clamp(11px, .82vw, 12.5px)",
              letterSpacing: ".18em", textTransform: "uppercase",
              color: "var(--fg)",
              fontWeight: 500
            }}>{s.enName}</div>
            </div>
            <p style={{
            margin: 0,
            fontFamily: "var(--font-thai)",
            fontSize: "clamp(15px, 1.15vw, 18px)", lineHeight: 1.75,
            color: "var(--fg)"
          }}>{s.thBody}</p>
            <p style={{
            margin: 0,
            fontFamily: "var(--font-body)", fontStyle: "italic",
            fontSize: "clamp(13.5px, 1.05vw, 16px)", lineHeight: 1.65,
            color: "var(--fg-soft)"
          }}>{s.enBody}</p>
          </article>
        )}
      </div>

      {/* Founder — A Message from the Founder */}
      <div className="reveal founder-grid" style={{
        marginTop: "clamp(80px, 10vw, 140px)",
        paddingTop: "clamp(40px, 5vw, 64px)",
        borderTop: "1px solid var(--rule)",
        display: "grid",
        gridTemplateColumns: "minmax(220px, 300px) minmax(0, 1fr)",
        gap: "clamp(40px, 6vw, 100px)",
        alignItems: "start"
      }}>
        {/* Left — portrait + name caption */}
        <figure style={{ margin: 0, position: "sticky", top: 100 }}>
          <div style={{
            aspectRatio: "4/5", overflow: "hidden", background: "#1a1816"
          }}>
            <img src={asset("founder.jpg")} alt="Orn-Napat (Earn), founder" loading="lazy" style={{
              width: "100%", height: "100%", objectFit: "cover",
              objectPosition: "center 22%",
              filter: "contrast(1.02)"
            }} />
          </div>
          <figcaption style={{
            marginTop: 22, display: "flex", flexDirection: "column", gap: 4
          }}>
            <div style={{
              fontFamily: "var(--font-thai)",
              fontSize: 17,
              color: "var(--fg-soft)",
              lineHeight: 1.4
            }}>อรนภัส บุญอนันตพัฒน์</div>
            <div style={{
              fontFamily: "var(--font-thai)",
              fontSize: 15,
              color: "var(--fg-dim)",
              lineHeight: 1.4
            }}>(เอิร์น)</div>
            <div className="label" style={{ marginTop: 16, color: "var(--fg-soft)" }}>
              Orn-Napat Boonanantaphat (Earn)
            </div>
            <div className="label" style={{ color: "var(--fg-dim)" }}>
              Founder, Niran
            </div>
          </figcaption>
        </figure>

        {/* Right — message */}
        <div style={{ display: "flex", flexDirection: "column", gap: "clamp(22px, 2vw, 32px)" }}>
          <div className="label">A message from the founder</div>

          {/* Thai pull-quote */}
          <blockquote style={{
            margin: 0,
            paddingLeft: "clamp(18px, 1.6vw, 26px)",
            borderLeft: "2px solid var(--gold)",
            fontFamily: "var(--font-thai)",
            fontStyle: "italic", fontWeight: 400,
            fontSize: "clamp(22px, 2.2vw, 36px)",
            lineHeight: 1.4,
            color: "rgba(232, 226, 213, 0.45)"
          }}>
            “เอิร์นเชื่อมาตลอดว่าคุณค่าของคน ไม่ควรหยุดแค่วันสุดท้าย”
          </blockquote>

          {/* Thai body */}
          <p style={{
            margin: 0, fontFamily: "var(--font-thai)",
            fontSize: "clamp(15px, 1.15vw, 18px)", lineHeight: 1.85,
            color: "var(--fg-soft)"
          }}>นิรันดร์เกิดจากความเชื่อที่มีมาตั้งแต่ต้นว่า ช่วงเวลาของการจากลาคือหนึ่งในช่วงเวลาที่สำคัญที่สุดในชีวิตของคนเรา และสิ่งที่เราส่งมอบในวันนั้น ควรสะท้อนความหมายนั้นอย่างแท้จริง

          </p>
          <p style={{
            margin: 0, fontFamily: "var(--font-thai)",
            fontSize: "clamp(15px, 1.15vw, 18px)", lineHeight: 1.85,
            color: "var(--fg-soft)"
          }}>
            แต่เอิร์นก็ตั้งคำถามมาตลอดเช่นกันว่า ทำไมสิ่งที่เราส่งมอบในวันนั้นถึงต้องจบลงในวันนั้น ทำไมการไว้อาลัยที่ดีถึงวัดกันที่ความสวยงามชั่วคราว ในเมื่อคนที่เราสูญเสียไปมีคุณค่ามากกว่านั้น
          </p>
          <p style={{
            margin: 0, fontFamily: "var(--font-thai)",
            fontSize: "clamp(15px, 1.15vw, 18px)", lineHeight: 1.85,
            color: "var(--fg-soft)"
          }}>นิรันดร์จึงเกิดขึ้น จากความเชื่อว่าการไว้อาลัยที่ดีที่สุด คือสิ่งที่ยังคงส่งต่อคุณค่าต่อไป แม้งานจะจบแล้ว

          </p>

          <hr style={{
            border: 0, borderTop: "1px solid var(--rule)",
            margin: "clamp(10px, 1.2vw, 18px) 0"
          }} />

          {/* English translation */}
          <p style={{
            margin: 0, fontFamily: "var(--font-body)", fontStyle: "italic",
            fontSize: "clamp(14px, 1.05vw, 16px)", lineHeight: 1.75,
            color: "var(--fg-soft)"
          }}>
            “I have always believed that a person’s worth should not end on their final day.”
          </p>
          <p style={{
            margin: 0, fontFamily: "var(--font-body)", fontStyle: "italic",
            fontSize: "clamp(14px, 1.05vw, 16px)", lineHeight: 1.75,
            color: "var(--fg-soft)"
          }}>
            Niran was born from a belief that the moment of farewell is one of the most significant moments in any life — and that what we give on that day should truly reflect that meaning.
          </p>
          <p style={{
            margin: 0, fontFamily: "var(--font-body)", fontStyle: "italic",
            fontSize: "clamp(14px, 1.05vw, 16px)", lineHeight: 1.75,
            color: "var(--fg-soft)"
          }}>Niran exists because of that question  and the conviction that the most meaningful farewell is one that keeps giving, long after the day is over.

          </p>
        </div>
      </div>
    </section>);

}

function Stat({ n, k }) {
  return (
    <div>
      <div style={{
        fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
        fontWeight: 400, fontSize: "clamp(34px,4vw,56px)", lineHeight: 1, color: "var(--gold)"
      }}>{n}</div>
      <div className="label" style={{ marginTop: 10, lineHeight: 1.4 }}>{k}</div>
    </div>);

}

// ───────────────────────────────────────────────────────────────────────────
// Collection grid — editorial asymmetric, with one real photo for No. III and
// stylised fabric-stripe placeholders for the rest.

function FabricPlaceholder({ tone = "ivory", seed = 1 }) {
  // Subtle vertical stripes evoking pleated cloth. Not a hand-drawn wreath.
  const stripeBase = tone === "ivory" ? "#e8dfcc" : "#d8ccb3";
  const stripeShadow = tone === "ivory" ? "#bba98a" : "#a8956f";
  const bg = tone === "ivory" ? "#ddd0b4" : "#c8b791";
  const angle = seed * 7 % 4 === 0 ? "92deg" : "88deg";
  return (
    <div style={{
      position: "absolute", inset: 0,
      background: `
        linear-gradient(${angle},
          ${stripeShadow} 0%, ${stripeBase} 4%, ${bg} 8%,
          ${stripeBase} 14%, ${stripeShadow} 18%, ${stripeBase} 22%,
          ${bg} 28%, ${stripeBase} 34%, ${stripeShadow} 40%,
          ${bg} 46%, ${stripeBase} 52%, ${stripeShadow} 58%,
          ${bg} 64%, ${stripeBase} 72%, ${stripeShadow} 78%,
          ${stripeBase} 86%, ${bg} 92%, ${stripeShadow} 100%
        ),
        radial-gradient(ellipse at 50% 40%, rgba(255,250,235,.35), rgba(0,0,0,.25) 78%)
      `,
      backgroundBlendMode: "multiply",
      filter: "blur(.4px) contrast(.92)"
    }}>
      {/* Soft circular vignette to hint at wreath shape */}
      <div style={{
        position: "absolute", inset: "10% 14%",
        borderRadius: "50%",
        boxShadow: "0 0 0 1px rgba(0,0,0,.05), inset 0 0 80px rgba(0,0,0,.35)",
        background: "radial-gradient(circle at 50% 40%, rgba(255,250,235,.18), transparent 60%)",
        pointerEvents: "none"
      }} />
    </div>);

}

function PieceCard({ item }) {
  const [hover, setHover] = React.useState(false);

  return (
    <article
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      onClick={() => window.location.href = "/productlist"}
      className="reveal"
      style={{ display: "flex", flexDirection: "column", gap: 14, cursor: "pointer" }}>
      <div style={{
        position: "relative",
        aspectRatio: "4/5",
        background: "#000",
        overflow: "hidden"
      }}>
        <img src={item.img} alt={item.sku} loading="lazy" style={{
          position: "absolute", inset: 0, width: "100%", height: "100%",
          objectFit: "cover", objectPosition: "center top",
          transform: hover ? "scale(1.025)" : "scale(1)",
          transition: "transform 1.4s cubic-bezier(.2,.7,.2,1)",
          filter: "contrast(1.02)"
        }} />
        {/* Hover overlay */}
        <div style={{
          position: "absolute", inset: 0,
          background: "linear-gradient(to top, rgba(14,14,12,.65), transparent 55%)",
          opacity: hover ? 1 : 0, transition: "opacity .5s ease",
          display: "flex", alignItems: "flex-end", justifyContent: "flex-end",
          padding: "20px 22px"
        }}>
          <span className="label" style={{ color: "#c9a86b" }}>Inquire →</span>
        </div>
      </div>

      {/* Caption: product number (title) + description (subtitle) + price */}
      <div style={{ display: "grid", gridTemplateColumns: "1fr auto", gap: 12, alignItems: "baseline" }}>
        <div>
          <div style={{
            fontFamily: "var(--font-mono)",
            fontSize: "clamp(13px, 1vw, 15px)",
            letterSpacing: ".14em",
            color: "var(--fg)",
            fontWeight: 500,
            lineHeight: 1.2
          }}>{item.sku}</div>
          <div style={{
            fontFamily: "var(--font-thai)", fontStyle: "italic",
            fontSize: "clamp(14px, 1.05vw, 16px)",
            lineHeight: 1.4,
            color: "var(--fg-soft)", fontWeight: 400,
            marginTop: 6
          }}>{item.desc}</div>
        </div>
        <div style={{
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: 400,
          fontSize: "clamp(20px, 1.7vw, 26px)",
          color: "var(--gold)",
          lineHeight: 1,
          fontVariantNumeric: "tabular-nums",
          whiteSpace: "nowrap"
        }}>฿{item.price.toLocaleString()}</div>
      </div>
    </article>);

}

function Collection() {
  return (
    <section id="collection" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1480, marginInline: "auto"
    }}>
      <header className="coll-section-header" style={{
        display: "grid", gridTemplateColumns: "1fr auto", alignItems: "end",
        marginBottom: "clamp(56px, 6vw, 80px)",
        borderBottom: "1px solid var(--rule)", paddingBottom: 22
      }}>
        <div>
          <div className="label" style={{ marginBottom: 14, fontSize: "20px" }}>01 — THE COLLECTION</div>
          <h2 style={{
            margin: 0, fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
            fontWeight: "var(--display-weight)", fontSize: "clamp(36px,4.6vw,68px)",
            lineHeight: 1, letterSpacing: "-.01em"
          }}>Our Design</h2>
        </div>
        <div className="label" style={{ textAlign: "right", color: "var(--fg-soft)" }}>
          <div>Three collections</div>
          <div style={{ color: "var(--fg-dim)", marginTop: 4 }}>Prices in Thai Baht</div>
        </div>
      </header>

      {COLLECTIONS.map((coll, ci) =>
      <div key={coll.id} id={`collection-${coll.id}`} style={{
        marginTop: ci === 0 ? 0 : "clamp(80px, 10vw, 140px)"
      }}>
          {/* Subsection header */}
          <header className="reveal coll-sub-header" style={{
          marginBottom: "clamp(36px, 4vw, 56px)",
          display: "grid",
          gridTemplateColumns: "auto minmax(0, 1fr) auto",
          gap: "clamp(18px, 2vw, 32px)",
          alignItems: "baseline"
        }}>
            <div style={{
            fontFamily: "var(--font-display)", fontStyle: "italic",
            fontWeight: 400,
            fontSize: "clamp(28px, 3vw, 44px)",
            lineHeight: 1, letterSpacing: "-.005em",
            color: "var(--gold)"
          }}>Collection {coll.no}</div>
            <div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
              <h3 style={{
              margin: 0,
              fontFamily: "var(--font-thai)", fontStyle: "italic",
              fontWeight: 400,
              fontSize: "clamp(22px, 2.2vw, 34px)",
              lineHeight: 1.2,
              color: "var(--fg)"
            }}>{coll.th}</h3>
              <div className="label" style={{ color: "var(--fg-soft)" }}>
                {coll.en}
              </div>
            </div>
            <div className="label" style={{
            color: "var(--fg-dim)", textAlign: "right",
            fontVariantNumeric: "tabular-nums"
          }}>
              {String(coll.items.length).padStart(2, "0")} pieces
            </div>
          </header>

          {/* Subsection note */}
          <p className="reveal" style={{
          margin: "0 0 clamp(36px, 4vw, 56px)",
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(16px, 1.4vw, 22px)",
          lineHeight: 1.5,
          color: "var(--fg-soft)",
          maxWidth: 680
        }}>
            {coll.note}
          </p>

          {/* Grid of cards */}
          <div className="coll-cards" style={{
          display: "grid",
          gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
          gap: "clamp(22px, 2.6vw, 44px)"
        }}>
            {coll.items.map((item) =>
          <PieceCard key={item.sku} item={item} />
          )}
          </div>
        </div>
      )}
    </section>);

}

// ───────────────────────────────────────────────────────────────────────────

// ───────────────────────────────────────────────────────────────────────────
// Source — cinematic mill / loom interlude.
// Cool tonal counterpoint to the warm Atelier; the upstream story.

function Source() {
  const materials = [
  {
    pct: "50%",
    img: asset("source-thread.jpg"),
    thTitle: "ฝ้ายธรรมชาติ ไม่ฟอกขาว",
    enTitle: "Unbleached cotton",
    thBody: "ผ้าฝ้ายที่ไม่ผ่านกระบวนการฟอกสี สีธรรมชาติของเส้นใยถูกคงไว้ตั้งแต่ต้น — ไม่มีสารเคมี ไม่มีสิ่งเจือปน",
    enBody: "Cotton in its truest form. No bleach, no chemicals — only what the fibre naturally holds."
  },
  {
    pct: "50%",
    img: asset("oe-cotton-cones.jpg"),
    thTitle: "เส้นใยรีไซเคิล OE Cotton",
    enTitle: "Recycled OE cotton",
    thBody: "เส้นใยที่ผ่านกระบวนการ Open-End Spinning จากวัสดุรีไซเคิล ลดการใช้ทรัพยากรใหม่ และยืดอายุของเส้นใยที่มีอยู่แล้ว",
    enBody: "Spun through an open-end process from recycled material — giving existing fibres a second life before the fabric even begins."
  }];


  return (
    <section id="source" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      background: "color-mix(in oklab, var(--bg) 88%, #1a1f24 12%)",
      marginInline: "calc(var(--gutter) * -1)",
      paddingInline: "var(--gutter)"
    }}>
      <div style={{ maxWidth: 1280, marginInline: "auto" }}>
        {/* Header */}
        <header className="reveal" style={{ marginBottom: "clamp(56px, 7vw, 100px)" }}>
          <div className="label" style={{ marginBottom: 28, fontSize: "20px" }}>04 — FROM THE LOOM

          </div>
          <h2 style={{
            margin: 0, maxWidth: 1100,
            fontFamily: "var(--font-thai)",
            fontStyle: "italic", fontWeight: 400,
            fontSize: "clamp(28px, 3.4vw, 54px)", lineHeight: 1.35,
            letterSpacing: "-.003em",
            color: "rgba(232, 226, 213, 0.32)"
          }}>
            ผ้าทุกผืนของนิรันดร์<br />
            เริ่มต้นจากธรรมชาติ และกลับคืนสู่ธรรมชาติ
          </h2>
          <p style={{
            margin: "22px 0 0", maxWidth: 760,
            fontFamily: "var(--font-display)", fontStyle: "italic",
            fontWeight: "var(--display-weight)",
            fontSize: "clamp(18px, 1.5vw, 24px)", lineHeight: 1.5,
            color: "var(--fg-soft)"
          }}>
            Every piece of fabric at Niran begins in nature — and is made to return to it.
          </p>
        </header>

        {/* 2-up materials grid */}
        <div className="reveal" style={{
          display: "grid",
          gridTemplateColumns: "repeat(auto-fit, minmax(340px, 1fr))",
          gap: "clamp(36px, 4.5vw, 80px)"
        }}>
          {materials.map((m, i) =>
          <article key={i} style={{
            display: "flex", flexDirection: "column",
            gap: "clamp(16px, 1.5vw, 24px)"
          }}>
              <div style={{
              position: "relative", aspectRatio: "4/3",
              overflow: "hidden", background: "#1a1816"
            }}>
                <img src={m.img} alt={m.enTitle} loading="lazy" style={{
                width: "100%", height: "100%", objectFit: "cover",
                filter: "contrast(1.02)"
              }} />
                <div style={{
                position: "absolute", top: 16, right: 16,
                padding: "6px 12px",
                background: "var(--gold)",
                color: "var(--bg)",
                fontFamily: "var(--font-mono)",
                fontSize: 11, letterSpacing: ".08em",
                fontWeight: 500
              }}>{m.pct}</div>
              </div>
              <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
                <div style={{
                fontFamily: "var(--font-thai)", fontStyle: "italic",
                fontSize: "clamp(20px, 1.7vw, 28px)", lineHeight: 1.3,
                color: "var(--fg-dim)", fontWeight: 400
              }}>{m.thTitle}</div>
                <div style={{
                fontFamily: "var(--font-mono)",
                fontSize: "clamp(11px, .82vw, 12.5px)",
                letterSpacing: ".18em", textTransform: "uppercase",
                color: "var(--fg)", fontWeight: 500
              }}>{m.enTitle}</div>
              </div>
              <p style={{
              margin: 0, fontFamily: "var(--font-thai)",
              fontSize: "clamp(15px, 1.15vw, 18px)", lineHeight: 1.75,
              color: "var(--fg)"
            }}>{m.thBody}</p>
              <p style={{
              margin: 0, fontFamily: "var(--font-body)", fontStyle: "italic",
              fontSize: "clamp(13.5px, 1.05vw, 16px)", lineHeight: 1.65,
              color: "var(--fg-soft)"
            }}>{m.enBody}</p>
            </article>
          )}
        </div>

        {/* Closing bilingual line */}
        <div className="reveal" style={{
          marginTop: "clamp(56px, 7vw, 100px)",
          paddingTop: "clamp(24px, 3vw, 40px)",
          borderTop: "1px solid var(--rule)",
          display: "grid",
          gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))",
          gap: "clamp(28px, 4vw, 64px)"
        }}>
          <p style={{
            margin: 0, fontFamily: "var(--font-thai)",
            fontStyle: "italic", fontWeight: 400,
            fontSize: "clamp(16px, 1.3vw, 20px)", lineHeight: 1.7,
            color: "var(--fg-dim)"
          }}>
            เราไม่ได้เลือกวัสดุเพื่อภาพลักษณ์ แต่เพราะมันคือสิ่งที่ถูกต้องตั้งแต่เริ่มต้น
          </p>
          <p style={{
            margin: 0, fontFamily: "var(--font-body)", fontStyle: "italic",
            fontSize: "clamp(14px, 1.05vw, 16px)", lineHeight: 1.75,
            color: "var(--fg-soft)"
          }}>
            We did not choose these materials for appearance. We chose them because they were right from the very beginning.
          </p>
        </div>
      </div>
    </section>);

}

// ─────────────────────────────────────────────────────────────────────────
// The Afterlife — what becomes of each wreath type after the ceremony.

function FlowIcon({ name }) {
  const common = {
    width: "44%", height: "44%", viewBox: "0 0 24 24", fill: "none",
    stroke: "currentColor", strokeWidth: 1.2,
    strokeLinecap: "round", strokeLinejoin: "round"
  };
  const paths = {
    disc: <g><circle cx="12" cy="12" r="9" /><circle cx="12" cy="12" r="3.5" /><circle cx="12" cy="12" r="0.6" fill="currentColor" stroke="none" /></g>,
    home: <g><path d="M4 11 L12 4.5 L20 11" /><path d="M6 9.8 V19.5 H18 V9.8" /><path d="M10.5 19.5 V15 H13.5 V19.5" /></g>,
    heart: <path d="M12 20s-6.5-4.2-6.5-9A3.5 3.5 0 0112 8.2 3.5 3.5 0 0118.5 11c0 4.8-6.5 9-6.5 9z" />,
    truck: <g><path d="M2.5 6.5 H13 V16 H2.5 Z" /><path d="M13 9.5 H17.5 L21 13 V16 H13" /><circle cx="6" cy="17.5" r="1.6" /><circle cx="17" cy="17.5" r="1.6" /></g>,
    shield: <g><path d="M12 3 L19 6 V11 C19 16 12 21 12 21 C12 21 5 16 5 11 V6 Z" /><path d="M9 11.5 l2 2 l4 -4.2" /></g>,
    tailor: <g><circle cx="6" cy="6.5" r="2" /><circle cx="6" cy="17.5" r="2" /><path d="M7.8 7.6 L20 16" /><path d="M7.8 16.4 L20 8" /></g>,
    people: <g><circle cx="8.5" cy="8.5" r="2.4" /><circle cx="16" cy="9" r="2" /><path d="M3.5 18.5 c0 -3 2.2 -5 5 -5 s5 2 5 5" /><path d="M14.5 18.5 c0 -2.6 1.8 -4.6 4.2 -4.6" /></g>,
    recycle: <g><path d="M5.5 13 A7 7 0 0 1 11 5.5" /><path d="M18.5 11 A7 7 0 0 1 13 18.5" /><path d="M11 5.5 L9 6.6 M11 5.5 L11.4 7.7" /><path d="M13 18.5 L15 17.4 M13 18.5 L12.6 16.3" /></g>
  };
  return (
    <span style={{
      width: "clamp(56px, 5vw, 72px)", aspectRatio: "1",
      borderRadius: "50%",
      border: "1px solid color-mix(in oklab, var(--gold) 55%, transparent)",
      display: "inline-flex", alignItems: "center", justifyContent: "center",
      color: "var(--gold)", flexShrink: 0
    }}>
      <svg {...common}>{paths[name] || paths.disc}</svg>
    </span>);

}

function FlowArrow() {
  return (
    <span className="flow-arrow" style={{
      flexShrink: 0, color: "color-mix(in oklab, var(--gold) 50%, transparent)",
      display: "inline-flex", alignItems: "center", justifyContent: "center",
      marginTop: "clamp(26px, 2.4vw, 34px)"
    }}>
      <svg width="34" height="12" viewBox="0 0 34 12" fill="none"
      stroke="currentColor" strokeWidth="1.1"
      strokeLinecap="round" strokeLinejoin="round">
        <line x1="1" y1="6" x2="28" y2="6" />
        <path d="M25 2.5 L30 6 L25 9.5" />
      </svg>
    </span>);

}

function FlowStep({ step }) {
  return (
    <div className="flow-step" style={{
      flex: 1, minWidth: 0,
      display: "flex", flexDirection: "column", alignItems: "center",
      textAlign: "center", gap: "clamp(12px, 1.2vw, 18px)"
    }}>
      <FlowIcon name={step.icon} />
      <div style={{
        fontFamily: "var(--font-thai)",
        fontSize: "clamp(13.5px, 1.05vw, 16px)", lineHeight: 1.45,
        color: "var(--fg)", maxWidth: 180
      }}>{step.th}</div>
      <div style={{
        fontFamily: "var(--font-body)", fontStyle: "italic",
        fontSize: "clamp(12px, 0.92vw, 13.5px)", lineHeight: 1.45,
        color: "var(--fg-dim)", maxWidth: 180
      }}>{step.en}</div>
    </div>);

}

function AfterlifeFlow({ flow }) {
  return (
    <div style={{ display: "flex", flexDirection: "column", gap: "clamp(18px, 1.8vw, 26px)" }}>
      {flow.label &&
      <div className="label" style={{ color: "var(--gold)", textAlign: "center" }}>
          {flow.label}
        </div>
      }
      <div className="afterlife-flow" style={{
        display: "flex", alignItems: "flex-start", justifyContent: "center",
        gap: "clamp(4px, 0.6vw, 10px)"
      }}>
        {flow.steps.map((step, i) =>
        <React.Fragment key={i}>
            <FlowStep step={step} />
            {i < flow.steps.length - 1 && <FlowArrow />}
          </React.Fragment>
        )}
      </div>
    </div>);

}

function Afterlife() {
  const TYPES = [
  {
    th: "พวงหรีดผ้า", en: "Fabric wreath",
    flows: [
    {
      label: "ทางเลือกที่ 1 — วัดรับบริจาคได้",
      steps: [
      { icon: "disc", th: "พวงหรีดหลังงาน", en: "After ceremony" },
      { icon: "home", th: "มอบให้วัดโดยตรง", en: "Donate to temple" },
      { icon: "heart", th: "ผ้าห่อศพผู้ไม่มีญาติ", en: "Shroud for those without family" }]

    },
    {
      label: "ทางเลือกที่ 2 — นิรันดร์รับคืนฟรี (สำหรับ กทม และ ปริมณฆล)",
      steps: [
      { icon: "disc", th: "พวงหรีดหลังงาน", en: "After ceremony" },
      { icon: "truck", th: "นิรันดร์รับคืน", en: "Niran collects" },
      { icon: "home", th: "บริจาคให้กู้ภัย มูลนิธิ และโรงพยาบาล", en: "Donated to temple" },
      { icon: "heart", th: "ผ้าห่อศพผู้ไม่มีญาติ", en: "Shroud for those without family" }]

    }]

  },
  {
    th: "พวงหรีดชุดนักเรียน", en: "Uniform wreath",
    flows: [
    {
      steps: [
      { icon: "disc", th: "พวงหรีดหลังงาน", en: "After ceremony" },
      { icon: "truck", th: "รับกลับทุกชิ้น", en: "Niran collects all" },
      { icon: "shield", th: "ซัก ฆ่าเชื้อ เคลือบ antibacterial", en: "Washed & treated" },
      { icon: "tailor", th: "ตัดเย็บเป็นชุด", en: "Tailored to size" },
      { icon: "people", th: "บริจาคต่อโรงเรียน", en: "Donated per school" }]

    }]

  },
  {
    th: "ผ้าขาวม้า", en: "Pha Khao Ma",
    flows: [
    {
      steps: [
      { icon: "disc", th: "พวงหรีดหลังงาน", en: "After ceremony" },
      { icon: "home", th: "มอบให้วัดโดยตรง", en: "Donate directly" },
      { icon: "recycle", th: "ใช้ประโยชน์ได้หลากหลาย", en: "Many uses within the temple" }]

    }]

  }];


  return (
    <section id="afterlife" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      <header className="reveal" style={{ marginBottom: "clamp(48px, 5vw, 80px)" }}>
        <div className="label" style={{ marginBottom: 28, fontSize: "20px" }}>06 — THE AFTERLIFE  · 

        </div>
        <h2 style={{
          margin: 0, maxWidth: 1080,
          fontFamily: "var(--font-thai)",
          fontStyle: "italic", fontWeight: 400,
          fontSize: "clamp(28px, 3.4vw, 54px)", lineHeight: 1.35,
          letterSpacing: "-.003em",
          color: "rgba(232, 226, 213, 0.32)"
        }}>
          เมื่องานศพจบลง ผ้าของเราเพิ่งเริ่มต้น
        </h2>
        <p style={{
          margin: "22px 0 0", maxWidth: 760,
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(18px, 1.5vw, 24px)", lineHeight: 1.5,
          color: "var(--fg-soft)"
        }}>
          When the ceremony ends, the fabric begins again.
        </p>
      </header>

      <div style={{ display: "flex", flexDirection: "column", gap: "clamp(20px, 2.4vw, 36px)" }}>
        {TYPES.map((t) =>
        <div key={t.th} className="afterlife-block" style={{
          border: "1px solid var(--rule)",
          display: "grid",
          gridTemplateColumns: "minmax(180px, 240px) minmax(0, 1fr)",
          gap: "clamp(28px, 4vw, 64px)",
          padding: "clamp(32px, 4vw, 56px)",
          alignItems: "center"
        }}>
            {/* Type label */}
            <div>
              <div style={{
              fontFamily: "var(--font-thai)", fontStyle: "italic",
              fontWeight: 400,
              fontSize: "clamp(26px, 2.6vw, 40px)", lineHeight: 1.2,
              letterSpacing: "-.003em",
              color: "rgba(232, 226, 213, 0.30)",
              marginBottom: 10
            }}>{t.th}</div>
              <div className="label" style={{ color: "var(--fg-soft)" }}>
                {t.en}
              </div>
            </div>

            {/* Flows */}
            <div style={{ display: "flex", flexDirection: "column", gap: "clamp(40px, 4vw, 64px)" }}>
              {t.flows.map((flow, i) =>
            <AfterlifeFlow key={i} flow={flow} />
            )}
            </div>
          </div>
        )}
      </div>
    </section>);

}

function Distributors() {
  const REGIONS = [
  {
    th: "ภาคเหนือ",
    en: "Northern",
    locs: [
    {
      name: "เชียงราย · เชียงใหม่ · พะเยา · ลำพูน",
      areas: [
      "ส่งฟรีพื้นที่จังหวัดเชียงราย อำเภอเมือง · นอกอำเภอ คิดราคาส่งตามจริง · ตัดรอบ 15.00 น.",
      "เชียงใหม่ พะเยา ลำพูน จังหวัดใกล้เคียง คิดราคาส่งตามจริง · ตัดรอบ 12.00 น."],

      tel: ["063-145-9323"],
      line: "@Boonamata"
    },
    {
      name: "ลำปาง",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 16.00 น."],
      tel: ["081-595-4788", "094-269-5939"],
      line: "Niranlampang"
    },
    {
      name: "น่าน",
      areas: ["ส่งฟรีในระยะ 20 กม. · ตัดรอบ 17.00 น."],
      tel: ["090-321-5264", "097-037-2952"],
      line: "@336jwhkl"
    }]

  },
  {
    th: "ภาคกลาง",
    en: "Central",
    locs: [
    {
      name: "กทม. และปริมณฑล",
      areas: [
      "ส่งฟรี กทม. และสมุทรปราการ",
      "จังหวัดปริมณฑล ค่าส่ง 150 บาท · ตัดรอบ 15.00 น."],

      tel: ["082-838-4994"],
      line: "@niranwreath"
    },
    {
      name: "อยุธยา",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 16.30 น."],
      tel: ["087-707-7581", "082-245-6592"],
      line: "@022tjtne"
    },
    {
      name: "พิษณุโลก · สุโขทัย",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 17.00 น."],
      tel: ["099-206-6768"],
      line: "niran.plk"
    },
    {
      name: "สุพรรณบุรี",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 17.00 น."],
      tel: ["086-500-5354", "089-551-6262"],
      line: "@563jourr"
    },
    {
      name: "ลพบุรี",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 18.00 น."],
      tel: ["099-123-4546"],
      line: "0991234546"
    }]

  },
  {
    th: "ภาคตะวันออกเฉียงเหนือ",
    en: "Northeastern · Isaan",
    locs: [
    {
      name: "อุดรธานี",
      areas: ["ส่งฟรีในเขตเทศบาล · ตัดรอบ 14.00 น."],
      tel: ["084-204-8778"],
      line: "@508rwshw"
    },
    {
      name: "อุบลราชธานี",
      areas: ["ส่งฟรีในระยะ 5 กม. · ตัดรอบ 19.00 น."],
      tel: ["094-831-9146"],
      line: "@niranubon"
    },
    {
      name: "สุรินทร์",
      areas: ["ส่งฟรีในเขตอำเภอเมืองสุรินทร์ · ตัดรอบ 16.00 น."],
      tel: ["089-323-6992"],
      line: "0893236992"
    }]

  },
  {
    th: "ภาคตะวันออก",
    en: "Eastern",
    locs: [
    {
      name: "ชลบุรี และระยอง",
      areas: ["ส่งฟรีในระยะ 8 กม. · ตัดรอบ 15.00 น."],
      tel: ["099-446-9146"],
      line: "@005sshrb"
    },
    {
      name: "ฉะเชิงเทรา",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 15.00 น."],
      tel: ["088-860-9866", "087-989-7917"],
      line: "@373ztkeh"
    },
    {
      name: "จันทบุรี",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 16.00 น."],
      tel: ["082-494-9245"],
      line: "@298fptit"
    },
    {
      name: "ตราด",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 17.00 น."],
      tel: ["096-979-3659"],
      line: "0969793659"
    }]

  },
  {
    th: "ภาคตะวันตก",
    en: "Western",
    locs: [
    {
      name: "ราชบุรี · กาญจนบุรี",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 16.00 น."],
      tel: ["065-151-9798"],
      line: "@908frsrf"
    },
    {
      name: "ประจวบคีรีขันธ์ · เพชรบุรี",
      areas: ["ส่งฟรีตัวเมืองหัวหิน · ตัดรอบ 15.30 น."],
      tel: ["092-291-6594"],
      line: "@353glmfc"
    }]

  },
  {
    th: "ภาคใต้",
    en: "Southern",
    locs: [
    {
      name: "นครศรีธรรมราช · สุราษฎร์ธานี · พัทลุง · กระบี่",
      areas: ["ส่งฟรีในระยะ 5 กม. · ตัดรอบ 14.00 น."],
      tel: ["081-506-8356"],
      line: "0815068356"
    },
    {
      name: "ภูเก็ต",
      areas: ["ส่งฟรีในเขตเทศบาลนครภูเก็ต · ตัดรอบ 15.00 น."],
      tel: ["081-569-4623"],
      line: "green456phuket"
    },
    {
      name: "สงขลา",
      areas: ["ส่งฟรีในระยะ 5 กม. จากวงเวียนน้ำพุ (หาดใหญ่) · ตัดรอบ 11.00 น."],
      tel: ["094-898-5965", "089-489-9656"],
      line: "@974wpwzi"
    },
    {
      name: "ระนอง",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 14.00 น."],
      tel: ["062-956-1639"],
      line: "@yba0855a"
    },
    {
      name: "ยะลา",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 19.00 น."],
      tel: ["080-215-5756"],
      line: "TEAMBOONYALA"
    },
    {
      name: "ตรัง",
      areas: ["ส่งฟรีในระยะ 8 กม. · ตัดรอบ 17.00 น."],
      tel: ["093-696-6255"],
      line: "@420xikrg"
    },
    {
      name: "ชุมพร",
      areas: ["ส่งฟรีในระยะ 10 กม. · ตัดรอบ 16.00 น."],
      tel: ["089-474-5979"],
      line: "@niran.chumphon"
    }]

  }];


  const total = REGIONS.reduce((n, r) => n + r.locs.length, 0);

  return (
    <section id="distributors" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      <header className="reveal" style={{ marginBottom: "clamp(48px, 5vw, 80px)" }}>
        <div className="label" style={{ marginBottom: 28, fontSize: "20px" }}>
          07 — DISTRIBUTORS
        </div>
        <h2 style={{
          margin: 0, maxWidth: 1080,
          fontFamily: "var(--font-thai)",
          fontStyle: "italic", fontWeight: 400,
          fontSize: "clamp(28px, 3.4vw, 54px)", lineHeight: 1.35,
          letterSpacing: "-.003em",
          color: "rgba(232, 226, 213, 0.32)"
        }}>
          ตัวแทนจำหน่ายอย่างเป็นทางการ<br />
          ทั่วประเทศไทย
        </h2>
        <p style={{
          margin: "22px 0 0", maxWidth: 760,
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(18px, 1.5vw, 24px)", lineHeight: 1.5,
          color: "var(--fg-soft)"
        }}>
          Our authorised distributors across 33 locations in Thailand.
        </p>
      </header>

      {/* Regions */}
      <div style={{ display: "flex", flexDirection: "column", gap: "clamp(56px, 7vw, 96px)" }}>
        {REGIONS.map((region) =>
        <RegionBlock key={region.th} region={region} />
        )}
      </div>
    </section>);

}

function RegionBlock({ region }) {
  return (
    <div className="reveal">
      {/* Region header */}
      <header className="region-header" style={{
        display: "grid",
        gridTemplateColumns: "auto minmax(0, 1fr) auto",
        gap: "clamp(16px, 2vw, 28px)",
        alignItems: "baseline",
        paddingBottom: "clamp(16px, 1.6vw, 24px)",
        borderBottom: "1px solid var(--rule)",
        marginBottom: "clamp(28px, 3vw, 44px)"
      }}>
        <div style={{
          fontFamily: "var(--font-thai)", fontStyle: "italic",
          fontWeight: 400,
          fontSize: "clamp(26px, 3vw, 44px)",
          lineHeight: 1.1, letterSpacing: "-.003em",
          color: "var(--gold)"
        }}>{region.th}</div>
        <div className="label" style={{ color: "var(--fg-soft)" }}>
          {region.en}
        </div>
        <div className="label" style={{
          color: "var(--fg-dim)", fontVariantNumeric: "tabular-nums"
        }}>
          {String(region.locs.length).padStart(2, "0")} locations
        </div>
      </header>

      {/* Location cards grid */}
      <div className="dist-cards" style={{
        display: "grid",
        gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
        gap: "clamp(20px, 2.4vw, 36px)"
      }}>
        {region.locs.map((loc, i) =>
        <DistributorCard key={i} loc={loc} />
        )}
      </div>
    </div>);

}

function DistributorCard({ loc }) {
  return (
    <article style={{
      paddingTop: "clamp(20px, 2vw, 28px)",
      borderTop: "1px solid var(--rule)",
      display: "flex", flexDirection: "column",
      gap: "clamp(14px, 1.4vw, 20px)",
      minWidth: 0
    }}>
      {/* Location name */}
      <h3 style={{
        margin: 0,
        fontFamily: "var(--font-thai)",
        fontStyle: "italic", fontWeight: 400,
        fontSize: "clamp(18px, 1.4vw, 22px)", lineHeight: 1.3,
        letterSpacing: "-.003em",
        color: "var(--fg)"
      }}>
        {loc.name}
      </h3>

      {/* Service area / cutoff */}
      <div style={{ display: "flex", flexDirection: "column", gap: 4 }}>
        {loc.areas.map((a, i) =>
        <div key={i} style={{
          fontFamily: "var(--font-thai)",
          fontSize: "clamp(13.5px, 1.05vw, 15.5px)",
          lineHeight: 1.55,
          color: "var(--fg-soft)"
        }}>{a}</div>
        )}
      </div>

      {/* Contact: phone + LINE */}
      <div style={{
        marginTop: "auto",
        paddingTop: "clamp(12px, 1.2vw, 18px)",
        borderTop: "1px solid var(--rule)",
        display: "flex", flexDirection: "column", gap: 6
      }}>
        {loc.tel.map((t, i) =>
        <a key={i} href={`tel:${t.replace(/[^0-9+]/g, "")}`}
        className="label" style={{
          color: "var(--fg)", letterSpacing: ".1em",
          fontVariantNumeric: "tabular-nums",
          display: "inline-block"
        }}>
            ☏ &nbsp;{t}
          </a>
        )}
        <div className="label" style={{
          color: "var(--gold)", letterSpacing: ".1em", marginTop: 2
        }}>
          LINE &nbsp;·&nbsp; {loc.line}
        </div>
      </div>
    </article>);

}

function FuneralService() {
  return (
    <section id="service" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      <header className="reveal" style={{ marginBottom: "clamp(56px, 7vw, 100px)" }}>
        <div className="label" style={{ marginBottom: 28, fontSize: "20px" }}>
          08 — FUNERAL SERVICE
        </div>
        <h2 style={{
          margin: 0, maxWidth: 1080,
          fontFamily: "var(--font-thai)",
          fontStyle: "italic", fontWeight: 400,
          fontSize: "clamp(28px, 3.4vw, 54px)", lineHeight: 1.35,
          letterSpacing: "-.003em",
          color: "rgba(232, 226, 213, 0.32)"
        }}>
          บริการจัดงานศพแบบครบวงจร<br />
          ตั้งแต่ต้นจนจบ ด้วยความเคารพ
        </h2>
        <p style={{
          margin: "22px 0 0", maxWidth: 760,
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(18px, 1.5vw, 24px)", lineHeight: 1.5,
          color: "var(--fg-soft)"
        }}>
          A full-service funeral offering, from beginning to end, with reverence.
        </p>
      </header>

      {/* Coming soon panel */}
      <div className="reveal" style={{
        borderTop: "1px solid var(--rule)",
        borderBottom: "1px solid var(--rule)",
        padding: "clamp(80px, 12vw, 180px) clamp(24px, 4vw, 56px)",
        display: "flex", flexDirection: "column",
        alignItems: "center", justifyContent: "center",
        gap: "clamp(18px, 2vw, 28px)",
        textAlign: "center"
      }}>
        <div className="label" style={{ color: "var(--gold)" }}>
          เร็ว ๆ นี้
        </div>
        <div style={{
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: 400,
          fontSize: "clamp(56px, 7vw, 120px)",
          lineHeight: 1, letterSpacing: "-.015em",
          color: "var(--gold)"
        }}>
          Coming Soon
        </div>
        <p style={{
          margin: 0, maxWidth: 540,
          fontFamily: "var(--font-thai)", fontStyle: "italic",
          fontSize: "clamp(15px, 1.2vw, 18px)", lineHeight: 1.6,
          color: "var(--fg-dim)"
        }}>
          เรากำลังเตรียมบริการที่จะดูแลคุณ ในช่วงเวลาที่สำคัญที่สุด
        </p>
      </div>
    </section>);

}

function Recognition() {
  const awards = [
  {
    year: "2024",
    img: asset("trophy-creative-excellence.png"),
    thName: "รางวัล Creative Sustainability Award",
    enName: "Creative Sustainability Award",
    thOrg: "จาก Creative Excellence Award 2024",
    enOrg: "Creative Excellence Awards"
  },
  {
    year: "2024",
    img: asset("trophy-industry-award.png"),
    thName: "รางวัลอุตสาหกรรมยอดเยี่ยม",
    enName: "Outstanding Industry Award",
    thOrg: "สาขา การพัฒนาผลิตภัณฑ์เชิงสร้างสรรค์",
    enOrg: "Creative Product Development category"
  },
  {
    year: "2024",
    img: asset("trophy-top-entrepreneur.png"),
    thName: "รางวัลการออกแบบสินค้ายอดเยี่ยมแห่งปี",
    enName: "Best Product Design of the Year",
    thOrg: "จาก Thailand Top Entrepreneur 2024",
    enOrg: "Thailand Top Entrepreneur Awards"
  }];


  return (
    <section id="recognition" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      <header className="reveal" style={{ marginBottom: "clamp(56px, 7vw, 100px)" }}>
        <div className="label" style={{ marginBottom: 28, fontSize: "20px" }}>09 — RECOGNITION

        </div>
        <h2 style={{
          margin: 0, maxWidth: 1080,
          fontFamily: "var(--font-thai)",
          fontStyle: "italic", fontWeight: 400,
          fontSize: "clamp(28px, 3.4vw, 54px)", lineHeight: 1.35,
          letterSpacing: "-.003em",
          color: "rgba(232, 226, 213, 0.32)"
        }}>
          แนวคิดเพื่อสิ่งแวดล้อมที่สร้างประโยชน์ให้สังคมได้จริง<br />
          การันตีด้วยรางวัลอันทรงเกียรติระดับประเทศ
        </h2>
        <p style={{
          margin: "22px 0 0", maxWidth: 760,
          fontFamily: "var(--font-display)", fontStyle: "italic",
          fontWeight: "var(--display-weight)",
          fontSize: "clamp(18px, 1.5vw, 24px)", lineHeight: 1.5,
          color: "var(--fg-soft)"
        }}>
          Sustainability that benefits society — affirmed by national-level honours.
        </p>
      </header>

      <div className="reveal" style={{
        display: "grid",
        gridTemplateColumns: "repeat(auto-fit, minmax(260px, 1fr))",
        gap: 0,
        borderTop: "1px solid var(--rule)"
      }}>
        {awards.map((a, i) =>
        <article key={i} style={{
          padding: "clamp(36px, 4vw, 56px) clamp(24px, 2.4vw, 40px)",
          paddingLeft: i === 0 ? 0 : "clamp(24px, 2.4vw, 40px)",
          paddingRight: i === awards.length - 1 ? 0 : "clamp(24px, 2.4vw, 40px)",
          borderRight: i < awards.length - 1 ? "1px solid var(--rule)" : "none",
          display: "flex", flexDirection: "column",
          gap: "clamp(14px, 1.2vw, 20px)"
        }}>
            {/* Year — small gold label */}
            <div className="label" style={{ color: "var(--gold)" }}>{a.year}</div>

            {/* English award name — the title (serif display, prominent) */}
            <h3 style={{
            margin: 0,
            fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
            fontWeight: "var(--display-weight)",
            fontSize: "clamp(28px, 2.8vw, 44px)", lineHeight: 1.1,
            letterSpacing: "-.005em",
            color: "var(--fg)"
          }}>{a.enName}</h3>

            {/* Thai award name */}
            <div style={{
            fontFamily: "var(--font-thai)", fontStyle: "italic",
            fontSize: "clamp(15px, 1.2vw, 19px)", lineHeight: 1.4,
            color: "var(--fg-soft)",
            fontWeight: 400
          }}>{a.thName}</div>

            <div style={{
            marginTop: "auto", paddingTop: "clamp(14px, 1.4vw, 22px)",
            borderTop: "1px solid var(--rule)",
            display: "flex", flexDirection: "column", gap: 4
          }}>
              <div style={{
              fontFamily: "var(--font-thai)",
              fontSize: "clamp(13px, 1vw, 15px)", lineHeight: 1.5,
              color: "var(--fg-soft)"
            }}>{a.thOrg}</div>
              <div className="label" style={{ color: "var(--fg-dim)" }}>
                {a.enOrg}
              </div>
            </div>
          </article>
        )}
      </div>
    </section>);

}

function Process() {
  return (
    <section id="process" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      <header className="reveal" style={{ marginBottom: "clamp(56px, 7vw, 100px)" }}>
        <div className="label" style={{ marginBottom: 28, fontSize: "20px" }}> 05 — Process &nbsp;·&nbsp; กระบวนการ</div>
      </header>

      <div className="reveal process-grid" style={{
        display: "grid",
        gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1fr)",
        gap: "clamp(36px, 6vw, 100px)",
        alignItems: "center"
      }}>
        {/* Image left */}
        <figure style={{ margin: 0 }}>
          <div style={{
            aspectRatio: "4/5", overflow: "hidden", background: "#1a1816"
          }}>
            <img src={asset("atelier-measure.jpg")} alt="Every piece passes through hands" loading="lazy" style={{
              width: "100%", height: "100%", objectFit: "cover",
              filter: "contrast(1.02)"
            }} />
          </div>
        </figure>

        {/* Text right */}
        <div style={{ display: "flex", flexDirection: "column", gap: "clamp(24px, 2.4vw, 40px)" }}>
          <h2 style={{
            margin: 0,
            fontFamily: "var(--font-thai)",
            fontStyle: "italic", fontWeight: 400,
            fontSize: "clamp(28px, 3.6vw, 60px)", lineHeight: 1.25,
            letterSpacing: "-.003em",
            color: "rgba(232, 226, 213, 0.32)"
          }}>
            ทุกชิ้นผ่านมือ<br />
            ก่อนถึงมือคุณ
          </h2>

          <p style={{
            margin: 0, fontFamily: "var(--font-thai)",
            fontSize: "clamp(15px, 1.2vw, 18px)", lineHeight: 1.85,
            color: "var(--fg-soft)"
          }}>
            ไม่มีเครื่องจักร ช่างทุกคนพับ ตัด และตรวจแต่ละชิ้นด้วยมือ ความแตกต่างเล็กน้อยในแต่ละชิ้นคือหลักฐานว่ามีคนทุ่มเทให้กับสิ่งที่คุณจะส่งมอบ
          </p>

          <p style={{
            margin: 0, fontFamily: "var(--font-body)", fontStyle: "italic",
            fontSize: "clamp(14px, 1.1vw, 17px)", lineHeight: 1.75,
            color: "var(--fg-soft)"
          }}>
            No machines. Every piece is folded, cut, and checked by hand — because what you give that day deserves nothing less.
          </p>
        </div>
      </div>
    </section>);

}

// ───────────────────────────────────────────────────────────────────────────

function Commission() {
  return (
    <section id="commission" style={{
      paddingTop: "var(--section-pad)", paddingBottom: "var(--section-pad)",
      maxWidth: 1280, marginInline: "auto"
    }}>
      <div className="reveal" style={{
        display: "grid", gridTemplateColumns: "minmax(0,1fr) minmax(0,1.2fr)",
        gap: "clamp(24px, 5vw, 88px)", alignItems: "center"
      }}>
        <div>
          <div className="label" style={{ marginBottom: 14 }}> 06 — Commission</div>
          <h2 style={{
            margin: 0,
            fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
            fontWeight: "var(--display-weight)",
            fontSize: "clamp(32px,4vw,60px)", lineHeight: 1.05, letterSpacing: "-.01em"
          }}>
            For a specific<br />person, a specific day.
          </h2>
          <p style={{ marginTop: 28, color: "var(--fg-soft)", maxWidth: 440, lineHeight: 1.7 }}>
            Custom wreaths are built around the person being remembered — their colour,
            a piece of their cloth, a passage they kept. Three week lead time. From ฿14,000.
          </p>
        </div>

        <form onSubmit={(e) => {e.preventDefault();alert("Thank you. We will respond within two days.");}}
        style={{ display: "grid", gap: 22 }}>
          <Field label="Your name" name="name" />
          <Field label="Email" name="email" type="email" />
          <Field label="In memory of" name="name_of" />
          <Field label="Date of service" name="date" type="date" />
          <Field label="A few words" name="words" textarea />
          <button type="submit" style={{
            justifySelf: "start", marginTop: 8,
            fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".18em",
            textTransform: "uppercase",
            color: "var(--bg)", background: "var(--gold)",
            padding: "16px 28px", border: 0,
            transition: "background .3s"
          }}
          onMouseEnter={(e) => e.currentTarget.style.background = "var(--fg)"}
          onMouseLeave={(e) => e.currentTarget.style.background = "var(--gold)"}>
            Send Inquiry
          </button>
        </form>
      </div>
    </section>);

}

function Field({ label, name, type = "text", textarea = false }) {
  const [focus, setFocus] = React.useState(false);
  const common = {
    name, type,
    onFocus: () => setFocus(true), onBlur: () => setFocus(false),
    style: {
      width: "100%", background: "transparent",
      border: 0, borderBottom: `1px solid ${focus ? "var(--gold)" : "var(--rule)"}`,
      color: "var(--fg)", fontFamily: "var(--font-body)", fontSize: 15,
      padding: "10px 0", outline: "none",
      transition: "border-color .3s",
      resize: "none"
    }
  };
  return (
    <label style={{ display: "block" }}>
      <span className="label" style={{ display: "block", marginBottom: 6 }}>{label}</span>
      {textarea ? <textarea rows={3} {...common} /> : <input {...common} />}
    </label>);

}

// ───────────────────────────────────────────────────────────────────────────

function Footer() {
  return (
    <footer id="contact" style={{
      paddingTop: "clamp(60px, 8vw, 100px)", paddingBottom: 48,
      borderTop: "1px solid var(--rule)", maxWidth: 1480, marginInline: "auto"
    }}>
      <div className="footer-grid" style={{
        display: "grid", gridTemplateColumns: "minmax(0,1.4fr) minmax(0,1fr)",
        gap: 40, alignItems: "start"
      }}>
        <div>
          <div style={{
            fontFamily: "var(--font-display)", fontStyle: "var(--display-style)",
            fontWeight: 400, fontSize: 28, letterSpacing: ".22em", marginBottom: 16
          }}>NIRAN</div>
          <p style={{ color: "var(--fg-soft)", maxWidth: 320, lineHeight: 1.7, margin: 0 }}>
            Eco-friendly memorial wreaths. Made in Thailand, returned to the earth.
          </p>
        </div>
        <FooterCol title="Write" lines={["+66 82 838 4994", "LINE Official", "@niranwreath"]} />
      </div>
      <div style={{
        marginTop: 72, paddingTop: 22, borderTop: "1px solid var(--rule)",
        display: "flex", justifyContent: "space-between"
      }}>
        <span className="label">© Niran</span>
        <span className="label" style={{ color: "var(--fg-dim)" }}>ไว้อาลัย ไม่ทิ้งอะไร</span>
      </div>
    </footer>);

}

function FooterCol({ title, lines, cta }) {
  return (
    <div>
      <div className="label" style={{ marginBottom: 16, color: "var(--gold)" }}>{title}</div>
      <div style={{ display: "flex", flexDirection: "column", gap: 4, color: "var(--fg-soft)" }}>
        {lines.map((l, i) => <span key={i}>{l}</span>)}
        {cta && <a href="#" style={{
          marginTop: 14, color: "var(--fg)",
          borderBottom: "1px solid var(--fg)", paddingBottom: 3, alignSelf: "start"
        }}>{cta}</a>}
      </div>
    </div>);

}

// ───────────────────────────────────────────────────────────────────────────

function App() {
  const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
  useReveal();

  React.useEffect(() => {
    document.getElementById("root").classList.add("ready");
  }, []);

  return (
    <React.Fragment>
      <ApplyTheme palette={t.palette} typePair={t.typePair} density={t.density} />
      <Nav />
      <main>
        <Hero variant={t.heroVariant} showThai={t.showThai} />
        <Collection />
        <Manifesto />
        <Atelier />
        <Source />
        <Process />
        <Afterlife />
        <Distributors />
        <FuneralService />
        <Recognition />
      </main>
      <Footer />

      <TweaksPanel title="Tweaks">
        <TweakSection label="Palette" />
        <TweakRadio
          label="Mode"
          value={t.palette}
          options={["ink", "forest", "bone"]}
          onChange={(v) => setTweak("palette", v)} />
        

        <TweakSection label="Typography" />
        <TweakRadio
          label="Pair"
          value={t.typePair}
          options={["editorial", "quiet", "archive"]}
          onChange={(v) => setTweak("typePair", v)} />
        

        <TweakSection label="Density" />
        <TweakRadio
          label="Space"
          value={t.density}
          options={["compact", "regular", "airy"]}
          onChange={(v) => setTweak("density", v)} />
        

        <TweakSection label="Hero" />
        <TweakRadio
          label="Layout"
          value={t.heroVariant}
          options={["asymmetric", "centered", "fullbleed"]}
          onChange={(v) => setTweak("heroVariant", v)} />
        
        <TweakToggle
          label="Show Thai"
          value={t.showThai}
          onChange={(v) => setTweak("showThai", v)} />
        
      </TweaksPanel>
    </React.Fragment>);

}

ReactDOM.createRoot(document.getElementById("root")).render(<App />);