// ────────────────────────────────────────────────────────────────────────
//  agenda.jsx — Wedding Day Agenda on an aged-IVORY parchment SCROLL that
//  unrolls downward as the page scrolls. Real HTML/CSS — no baked image.
//
//  • top bronze rod appears first; a soft fold-shadow sits under it where the
//    paper emerges; the ivory parchment unrolls (clip-path) revealing the
//    compact header, then each agenda row fades/slides in as the opening edge
//    passes it, the location buttons last, and the bottom rod settles when the
//    scroll is fully open.
//  • two compact location buttons FLIP on click / tap / keyboard to addresses.
//  • clean & modern: ivory paper, restrained gold accents, no heavy flourishes.
// ────────────────────────────────────────────────────────────────────────
(function () {
  const { useState, useEffect, useRef, useCallback } = React;

  // ── palette ──
  const GOLD = '#C9A24B';      // antique gold
  const GOLD_LT = '#d8b46a';
  const GOLD_HI = '#f0d493';
  const GOLD_DK = '#9c7a32';
  const MAROON = '#6B1D1D';    // deep maroon
  const MAROON_D = '#4a1414';
  const IVORY = '#F3E4C6';     // parchment ivory
  const BROWN = '#6f4a22';     // warm brown
  const INK = '#3A2410';       // warm brown text
  const ICON = '#f0d493';

  const cl = (v, a, b) => Math.max(a, Math.min(b, v));
  const sm = (t) => {t = cl(t, 0, 1);return t * t * (3 - 2 * t);};

  // ── ceremonial gold line/figure icons ──────────────────────────────────
  function Glyph({ name }) {
    const g = { fill: ICON };
    const d = MAROON_D;
    switch (name) {
      case 'gopuram':return (
          <svg viewBox="0 0 40 40" width="60%" height="60%">
          <g {...g}>
            <rect x="9" y="30" width="22" height="6" />
            <polygon points="11,30 29,30 27,23 13,23" />
            <polygon points="13,23 27,23 25,17.5 15,17.5" />
            <polygon points="15,17.5 25,17.5 23,12.5 17,12.5" />
            <rect x="19" y="8.5" width="2" height="4" />
            <circle cx="20" cy="7" r="1.7" />
            <rect x="18" y="31" width="4" height="5" fill={d} />
          </g>
        </svg>);

      case 'mandap':return (
          <svg viewBox="0 0 40 40" width="60%" height="60%">
          <g fill="none" stroke={ICON} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
            <path d="M7 33 L33 33" />
            <path d="M11 33 L11 19 M29 33 L29 19" />
            <path d="M8.5 19 Q20 4 31.5 19" />
            <path d="M14 19 Q20 11 26 19" />
            <path d="M20 4 L20 1.4" />
          </g>
        </svg>);

      case 'family':return (
          <svg viewBox="0 0 40 40" width="62%" height="62%">
          <g {...g}>
            <circle cx="14" cy="11" r="4" />
            <path d="M7.5 23 q0 -7 6.5 -7 q6.5 0 6.5 7 Z" />
            <circle cx="26.5" cy="12.5" r="3.2" />
            <path d="M21 23 q0 -5.5 5.5 -5.5 q5.5 0 5.5 5.5 Z" />
            <rect x="12" y="26" width="16" height="9" rx="2" />
            <rect x="21" y="24" width="5" height="3" rx="1" />
            <circle cx="20" cy="30.5" r="3" fill={d} />
            <circle cx="20" cy="30.5" r="1.6" fill={ICON} />
          </g>
        </svg>);

      case 'meal':return (
          <svg viewBox="0 0 40 40" width="62%" height="62%">
          <g fill="none" stroke={ICON} strokeWidth="2" strokeLinecap="round">
            <circle cx="20" cy="20" r="9" />
            <circle cx="20" cy="20" r="4.4" strokeWidth="1.6" />
            <path d="M7.5 11 L7.5 22 M5.8 11 L5.8 15.5 M9.2 11 L9.2 15.5" strokeWidth="1.6" />
            <path d="M33 11 Q35 15 33 18 L33 23" strokeWidth="1.6" />
          </g>
        </svg>);

      case 'camera':return (
          <svg viewBox="0 0 40 40" width="62%" height="62%">
          <g {...g}>
            <rect x="7.5" y="14.5" width="25" height="16.5" rx="2.6" />
            <rect x="14" y="10.5" width="8.5" height="5" rx="1.6" />
            <circle cx="20" cy="23" r="5.2" fill={d} />
            <circle cx="20" cy="23" r="3" fill={ICON} />
            <circle cx="27.5" cy="18" r="1.3" fill={d} />
          </g>
        </svg>);

      case 'hall':return (
          <svg viewBox="0 0 40 40" width="62%" height="62%">
          <g {...g}>
            <polygon points="6,18 34,18 20,8.5" />
            <rect x="9" y="18" width="22" height="15" />
            <path d="M16.5 33 L16.5 25 Q20 21 23.5 25 L23.5 33 Z" fill={d} />
            <rect x="11.5" y="21" width="3" height="4" fill={d} />
            <rect x="25.5" y="21" width="3" height="4" fill={d} />
            <rect x="19" y="6" width="2" height="3.5" />
          </g>
        </svg>);

      default:return null;
    }
  }

  // compact maroon disc holding a gold glyph
  function IconDisc({ name, size = 'clamp(32px,7.6vw,44px)' }) {
    return (
      <div style={{
        width: size, height: size, borderRadius: '50%', flex: 'none',
        background: 'radial-gradient(circle at 38% 30%, #8c2c28 0%, #6e1f22 48%, #4a1314 100%)',
        border: `1.5px solid ${GOLD_LT}`,
        boxShadow: '0 3px 8px rgba(55,18,10,0.32), inset 0 1px 4px rgba(255,214,150,0.26), inset 0 -3px 6px rgba(28,8,8,0.5)',
        display: 'flex', alignItems: 'center', justifyContent: 'center',
        color: ICON
      }}>
        <Glyph name={name} />
      </div>);

  }

  // ── antique parchment scroll rod (photographic asset). Fills its
  //    container width; the parchment body is inset so the bronze finials
  //    always overhang the paper and are NEVER clipped. ──
  function ScrollRod({ reveal = 1, flip = false }) {
    const op = sm(reveal);
    const A = (q) => window.asset ? window.asset(q) : q;
    const src = flip ? 'assets/scroll-rod-bottom-fixed.png' : 'assets/scroll-rod-top-fixed.png';
    return (
      <div aria-hidden="true" style={{
        position: 'relative', zIndex: 6, lineHeight: 0,
        width: '100%', overflow: 'visible',
        opacity: op, transition: 'opacity .5s ease',
        filter: `drop-shadow(0 ${flip ? '-' : ''}6px 10px rgba(58,32,8,0.28))`
      }}>
        <img src={A(src)} alt="" draggable="false"
          style={{ width: '100%', height: 'auto', display: 'block' }} />
      </div>);

  }

  // slim ornamental divider
  function MiniDivider({ width = 120 }) {
    const OD = window.OrnamentalDivider;
    return <OD width={width} color={GOLD} reveal={1} />;
  }

  // ── one agenda row — compact ivory ticket ──────────────────────────────
  const AgendaItem = React.forwardRef(function AgendaItem(
  { time, ampm, title, desc, icon, show, first, last }, ref) {
    return (
      <div ref={ref} style={{
        display: 'grid',
        gridTemplateColumns: 'clamp(30px,8vw,46px) clamp(34px,8vw,46px) 1fr',
        columnGap: 'clamp(6px,1.8vw,12px)', alignItems: 'center',
        opacity: show,
        transform: `translateY(${(1 - show) * 14}px)`,
        transition: 'opacity .45s ease, transform .55s cubic-bezier(.22,.61,.36,1)'
      }}>
        {/* time */}
        <div style={{ textAlign: 'right', lineHeight: 1.0 }}>
          <div style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 700, color: MAROON,
            fontSize: 'clamp(14px,3.6vw,20px)', fontVariantNumeric: 'lining-nums',
            fontFeatureSettings: '"lnum" 1' }}>{time}</div>
          <div style={{ fontFamily: 'Jost, sans-serif', color: GOLD_DK, letterSpacing: '0.18em',
            fontSize: 'clamp(8px,2vw,10px)', marginTop: 1 }}>{ampm}</div>
        </div>

        {/* timeline column: subtle gold line + disc */}
        <div style={{ position: 'relative', alignSelf: 'stretch', display: 'flex',
          alignItems: 'center', justifyContent: 'center', minHeight: 'clamp(44px,11vw,64px)' }}>
          <span style={{ position: 'absolute', left: '50%', transform: 'translateX(-50%)',
            top: first ? '50%' : 0, bottom: last ? '50%' : 0, width: 1.5,
            background: 'linear-gradient(180deg, rgba(169,128,47,0.12), rgba(169,128,47,0.6) 28%, rgba(169,128,47,0.6) 72%, rgba(169,128,47,0.12))' }} />
          <IconDisc name={icon} />
        </div>

        {/* card */}
        <div style={{
          position: 'relative', padding: 'clamp(7px,1.9vw,12px) clamp(10px,2.6vw,17px)',
          background: 'linear-gradient(158deg, #fff8ea 0%, #f8eed6 58%, #f1e3c6 100%)',
          border: '1px solid rgba(201,162,75,0.55)', borderRadius: 9,
          boxShadow: '0 4px 12px -8px rgba(70,40,12,0.3), inset 0 1px 0 rgba(255,253,248,0.8)'
        }}>
          <h3 style={{ margin: 0, fontFamily: 'Marcellus, serif', color: MAROON,
            fontSize: 'clamp(11.5px,2.9vw,16px)', letterSpacing: '0.04em', lineHeight: 1.18,
            textTransform: 'uppercase' }}>{title}</h3>
          <p style={{ margin: '3px 0 0', fontFamily: '"Cormorant Garamond", serif', fontStyle: 'italic',
            color: INK, fontSize: 'clamp(11.5px,2.7vw,15px)', lineHeight: 1.3, letterSpacing: '0.01em' }}>{desc}</p>
        </div>
      </div>);

  });

  // ── compact horizontal flip-card location button ───────────────────────
  //    Short fixed height (no tall reserved address block); flips on tap to
  //    reveal a 2-line address. Both faces are a tidy [icon | text] row so the
  //    front state has no empty dead space.
  function FlipButton({ icon, label, address }) {
    const [flipped, setFlipped] = useState(false);
    const [hover, setHover] = useState(false);
    const toggle = useCallback(() => setFlipped((v) => !v), []);
    const onKey = useCallback((e) => {
      if (e.key === 'Enter' || e.key === ' ') {e.preventDefault();toggle();}
    }, [toggle]);

    const lift = hover && !flipped ? -3 : 0;
    const H = 'clamp(58px,15vw,70px)';
    // NOTE: these buttons live inside the parchment, which has a clip-path —
    // that flattens any 3D context, so a rotateY flip is neutralised. We use a
    // plain opacity cross-fade between two stacked faces instead (robust here).
    const faceBase = {
      position: 'absolute', inset: 0, display: 'flex', alignItems: 'center',
      justifyContent: 'center', gap: 'clamp(9px,2.4vw,13px)',
      padding: '8px clamp(13px,3.2vw,20px)', borderRadius: 13, overflow: 'hidden',
      transition: 'opacity .35s ease'
    };
    const frontFace = {
      ...faceBase, border: `1px solid ${GOLD_LT}`,
      background: 'linear-gradient(165deg, #7e2424 0%, #6B1D1D 52%, #4a1414 100%)',
      boxShadow: 'inset 0 1px 0 rgba(255,214,160,0.18), inset 0 -2px 5px rgba(40,8,8,0.34)'
    };
    const backFace = {
      ...faceBase,
      border: `1px solid ${GOLD}`,
      background: 'linear-gradient(165deg, #fff8ea 0%, #f6ecd4 55%, #efe0c0 100%)',
      boxShadow: 'inset 0 1px 0 rgba(255,253,247,0.8)'
    };

    return (
      <div
        role="button" tabIndex={0} aria-pressed={flipped}
        aria-label={`${label} — ${flipped ? 'showing address, activate to hide' : 'activate to view address'}`}
        onClick={toggle} onKeyDown={onKey}
        onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
        style={{
          flex: '1 1 240px', maxWidth: 340, minWidth: 0, cursor: 'pointer', outline: 'none',
          transform: `translateY(${lift}px)`, transition: 'transform .3s ease',
          borderRadius: 13,
          boxShadow: hover ?
          '0 12px 22px -13px rgba(60,26,8,0.5), 0 0 0 1px rgba(217,178,94,0.5), 0 0 16px rgba(217,178,94,0.3)' :
          '0 7px 16px -12px rgba(60,26,8,0.42), 0 2px 5px -3px rgba(60,26,8,0.24)'
        }}>
        
        <div style={{ position: 'relative', width: '100%', height: H }}>
          {/* front — maroon plaque: glyph + label/hint */}
          <div style={{ ...frontFace, opacity: flipped ? 0 : 1, pointerEvents: flipped ? 'none' : 'auto' }}>
            <span style={{ width: 'clamp(26px,6.6vw,32px)', height: 'clamp(26px,6.6vw,32px)',
              color: ICON, display: 'flex', alignItems: 'center', justifyContent: 'center', flex: 'none' }}>
              <Glyph name={icon} />
            </span>
            <span style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 2, minWidth: 0 }}>
              <span style={{ fontFamily: 'Marcellus, serif', color: GOLD_HI,
                fontSize: 'clamp(12px,3.1vw,15px)', letterSpacing: '0.12em', lineHeight: 1.1,
                textTransform: 'uppercase' }}>{label}</span>
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 4, whiteSpace: 'nowrap',
                fontFamily: 'Jost, sans-serif', color: 'rgba(236,202,127,0.6)',
                fontSize: 'clamp(8px,2vw,9.5px)', letterSpacing: '0.14em', textTransform: 'uppercase' }}>
                View address
                <svg width="12" height="7" viewBox="0 0 14 8" fill="none"><path d="M1 4 H12 M9 1 L12 4 L9 7"
                  stroke="rgba(236,202,127,0.7)" strokeWidth="1.1" strokeLinecap="round" strokeLinejoin="round" /></svg>
              </span>
            </span>
          </div>
          {/* back — ivory card: disc + label/address */}
          <div style={{ ...backFace, opacity: flipped ? 1 : 0, pointerEvents: flipped ? 'auto' : 'none' }}>
            <IconDisc name={icon} size="clamp(28px,7vw,34px)" />
            <span style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 2, minWidth: 0, textAlign: 'left' }}>
              <span style={{ fontFamily: 'Jost, sans-serif', color: MAROON,
                fontSize: 'clamp(7.5px,2vw,9px)', letterSpacing: '0.18em', textTransform: 'uppercase' }}>{label}</span>
              <span style={{ fontFamily: '"Cormorant Garamond", serif', color: INK,
                fontSize: 'clamp(11.5px,2.9vw,14px)', lineHeight: 1.28 }}>
                {address.map((ln, i) => <span key={i} style={{ display: 'block' }}>{ln}</span>)}
              </span>
            </span>
          </div>
        </div>
      </div>);

  }

  // ── agenda items ───────────────────────────────────────────────────────
  const ITEMS = [
  { time: '8:30', ampm: 'AM', title: 'Guest Arrival at Kovil', icon: 'gopuram',
    desc: 'Please arrive early for a warm welcome and blessings.' },
  { time: '9:00', ampm: 'AM', title: 'Wedding Ceremony', icon: 'mandap',
    desc: 'The sacred ceremony begins with the blessings of our families.' },
  { time: '10:30', ampm: 'AM', title: 'Family Blessings & Photos', icon: 'family',
    desc: 'Special blessings and photographs with close family members.' },
  { time: '12:30', ampm: 'PM', title: 'Lunch at Hall', icon: 'meal',
    desc: 'Join us for a delicious traditional wedding feast.' },
  { time: '2:00', ampm: 'PM', title: 'Photos & Memories', icon: 'camera',
    desc: 'Capturing joyful moments to cherish forever.' }];


  function AgendaScroll() {
    const sectionRef = useRef(null);
    const paperRef = useRef(null);
    const itemRefs = useRef([]);
    const [reveal, setReveal] = useState(0);
    const [paperH, setPaperH] = useState(1000);
    const [fracs, setFracs] = useState(ITEMS.map((_, i) => 0.4 + i * 0.09));

    // measure paper + item positions
    const measure = useCallback(() => {
      const paper = paperRef.current;
      if (!paper) return;
      const h = paper.scrollHeight || 1000;
      setPaperH(h);
      setFracs(itemRefs.current.map((el) => el ? el.offsetTop / h : 0));
    }, []);

    useEffect(() => {
      measure();
      const ro = new ResizeObserver(measure);
      if (paperRef.current) ro.observe(paperRef.current);
      window.addEventListener('resize', measure);
      const t = setTimeout(measure, 400);
      return () => {ro.disconnect();window.removeEventListener('resize', measure);clearTimeout(t);};
    }, [measure]);

    // scroll-linked unroll progress
    useEffect(() => {
      let raf = 0;
      const onScroll = () => {
        if (raf) return;
        raf = requestAnimationFrame(() => {
          raf = 0;
          const el = sectionRef.current;
          if (!el) return;
          const r = el.getBoundingClientRect();
          const vh = window.innerHeight;
          // Unroll over a comfortable scroll distance so the paper visibly
          // opens downward as you scroll — not already-open on arrival.
          const span = cl(paperH * 0.9, vh * 0.72, vh * 1.15);
          const p = cl((vh * 0.82 - r.top) / span, 0, 1);
          setReveal(p);
        });
      };
      onScroll();
      window.addEventListener('scroll', onScroll, { passive: true });
      window.addEventListener('resize', onScroll);
      return () => {window.removeEventListener('scroll', onScroll);window.removeEventListener('resize', onScroll);};
    }, [paperH]);

    const clipR = cl(reveal * 1.06, 0, 1); // paper grows slightly ahead of content
    const hidePct = (1 - clipR) * 100;
    const edgeY = paperH * clipR;
    const rodTop = sm(reveal / 0.05);
    const rodBot = sm((reveal - 0.92) / 0.07);
    const showEdge = reveal > 0.02 && reveal < 0.98;

    const itemShow = (i) => sm((clipR - fracs[i] - 0.01) / 0.1);

    const A = (q) => window.asset ? window.asset(q) : q;
    // Container = the ROD's footprint. Parchment body is inset to the
    // cylinder's span so the bronze finials always overhang the paper.
    const SCROLL_W = 'min(90vw, 560px)';
    const BODY_W = '83.7%';
    const TUCK = `calc(${SCROLL_W} * -0.030)`;

    return (
      <section ref={sectionRef} style={{
        position: 'relative', padding: 'clamp(36px,8vh,84px) 4vw clamp(48px,10vh,104px)',
        background: 'transparent', overflow: 'visible'
      }}>
        {/* soft vignette behind the scroll */}
        <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none',
          background: 'radial-gradient(120% 76% at 50% 42%, transparent 70%, rgba(110,62,24,0.08) 100%)' }} />

        <div style={{ position: 'relative', width: SCROLL_W, margin: '0 auto', overflow: 'visible' }}>
          {/* TOP ROD — foreground, full container width, never clipped */}
          <ScrollRod reveal={rodTop} />

          {/* PARCHMENT BODY — inset & centred beneath the rod's cylinder.
              Only THIS wrapper is clipped during the unroll; the rods sit
              outside it so their finials/end-caps are never masked. */}
          <div style={{ position: 'relative', width: BODY_W, marginLeft: 'auto', marginRight: 'auto', marginTop: TUCK, marginBottom: 0 }}>
            <div ref={paperRef} style={{
              position: 'relative',
              clipPath: `inset(0 0 ${hidePct}% 0)`,
              WebkitClipPath: `inset(0 0 ${hidePct}% 0)`,
              padding: 'clamp(20px,4.6vw,40px) clamp(15px,4.2vw,40px) clamp(22px,5vw,44px)',
              // warm aged IVORY parchment — soft, premium, not flat or saturated
              background:
              'radial-gradient(125% 82% at 50% 0%, #fff2d6 0%, #f7ebcf 26%, #f3e4c6 60%, #ead6ad 100%)',
              boxShadow: '0 22px 52px -26px rgba(70,40,14,0.42), inset 0 0 60px rgba(214,176,110,0.12)',
              borderLeft: '1px solid rgba(169,128,47,0.32)', borderRight: '1px solid rgba(169,128,47,0.32)',
              borderBottom: '1px solid rgba(169,128,47,0.38)'
            }}>
              {/* fine, even paper grain */}
              <div aria-hidden="true" style={{ position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 0.5,
                mixBlendMode: 'multiply', backgroundSize: '160px 160px',
                backgroundImage: "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/></svg>\")" }} />
              {/* soft fold-shadow just under the top rod — paper emerging */}
              <div aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0,
                height: 'clamp(14px,3.2vw,24px)', pointerEvents: 'none',
                background: 'linear-gradient(180deg, rgba(95,58,22,0.30) 0%, rgba(95,58,22,0.10) 45%, rgba(95,58,22,0) 100%)' }} />
              {/* single restrained gold keyline frame */}
              <div aria-hidden="true" style={{ position: 'absolute', inset: 'clamp(8px,2vw,13px)',
                border: `1px solid rgba(201,162,75,0.42)`, borderRadius: 3, pointerEvents: 'none' }} />

              <div style={{ position: 'relative', display: 'flex', flexDirection: 'column',
                alignItems: 'center' }}>

                {/* ── compact header ── */}
                {/* small VR emblem (actual transparent asset, used as-is) */}
                <img src={A('assets/emblem2.png')} alt="Vyshnavan &amp; Rathusaigini" draggable="false"
                  style={{ width: 'clamp(64px,15vw,96px)', height: 'auto', display: 'block',
                    margin: '0 0 7px', filter: 'drop-shadow(0 3px 7px rgba(120,80,20,0.22))' }} />

                <div style={{ fontFamily: 'Marcellus, serif', color: GOLD_DK,
                  fontSize: 'clamp(10.5px,2.9vw,15px)', letterSpacing: '0.17em', whiteSpace: 'nowrap',
                  textAlign: 'center' }}>
                  VYSHNAVAN <span style={{ color: GOLD }}>&amp;</span> RATHUSAIGINI
                </div>

                <div style={{ margin: '8px 0' }}><MiniDivider width={96} /></div>

                <h2 style={{ margin: 0, fontFamily: '"Cormorant Garamond", serif',
                  fontWeight: 700, color: MAROON, fontSize: 'clamp(20px,5.4vw,38px)', letterSpacing: '0.045em',
                  lineHeight: 1.02, textAlign: 'center', textShadow: '0 2px 14px rgba(107,29,29,0.14)' }}>
                  WEDDING DAY AGENDA
                </h2>
                <p style={{ margin: '7px 0 0', fontFamily: '"Cormorant Garamond", serif', fontStyle: 'italic',
                  color: BROWN, fontSize: 'clamp(12px,3.2vw,17px)', letterSpacing: '0.02em', textAlign: 'center' }}>
                  A glimpse of the celebrations awaiting you
                </p>

                {/* ── timeline ── */}
                <div style={{ width: '100%', marginTop: 'clamp(16px,3.6vw,28px)', display: 'flex',
                  flexDirection: 'column', gap: 'clamp(3px,1vw,9px)' }}>
                  {ITEMS.map((it, i) =>
                  <AgendaItem key={i} ref={(el) => itemRefs.current[i] = el}
                  {...it} first={i === 0} last={i === ITEMS.length - 1}
                  show={itemShow(i)} />
                  )}
                </div>

                {/* ── location buttons (secondary) ── */}
                <div style={{ margin: 'clamp(14px,3.2vw,22px) 0 clamp(10px,2.2vw,14px)' }}><MiniDivider width={150} /></div>
                <div style={{ display: 'flex', flexWrap: 'wrap', gap: 'clamp(8px,2vw,12px)',
                  justifyContent: 'center', width: '100%' }}>
                  <FlipButton icon="gopuram" label="Kovil Location"
                  address={['No 450 Thirugnanasampanthar Street,', 'Trincomalee 31000, Sri Lanka']} />
                  <FlipButton icon="hall" label="Wedding Hall Location"
                  address={['No 93, Love Lane, Nilaveli Rd,', 'Trincomalee 31000, Sri Lanka']} />
                </div>
              </div>
            </div>

            {/* rolling unroll edge — subtle, travels down with progress */}
            {showEdge &&
            <div aria-hidden="true" style={{ position: 'absolute', left: -3, right: -3, top: edgeY,
              transform: 'translateY(-50%)', height: 14, pointerEvents: 'none', zIndex: 5 }}>
                <div style={{ position: 'absolute', inset: '0 0 auto 0', height: 5, borderRadius: 999,
                background: 'linear-gradient(180deg,#ecd6a2,#c79a44 60%,#9c7430)',
                boxShadow: '0 6px 12px rgba(60,30,8,0.4), inset 0 1px 1px rgba(255,246,214,0.7)' }} />
                <div style={{ position: 'absolute', top: 5, left: 5, right: 5, height: 9,
                background: 'linear-gradient(180deg, rgba(60,30,8,0.22), rgba(60,30,8,0))' }} />
              </div>
            }
          </div>

          {/* BOTTOM ROD — foreground, tucked over the parchment's lower edge */}
          <div style={{ position: 'relative', zIndex: 6, marginTop: TUCK, overflow: 'visible' }}>
            <ScrollRod reveal={rodBot} flip />
          </div>
        </div>
      </section>);

  }

  window.AgendaScroll = AgendaScroll;
})();
