// App carousel + Protocol stepper + PDF reveal
const { useEffect: useEffectA, useRef: useRefA, useState: useStateA } = React;

const SCREENS = [
  { src: 'assets/screens/THEFIRSTSCREENSHOT.jpg', label: 'Daily Gut Score', tag: 'HOME' },
  { src: 'assets/screens/SCREENSHOT_5.jpg', label: 'Daily Check-In', tag: 'CHECK-IN' },
  { src: 'assets/screens/SCREENSHOT_1.jpg', label: 'AI Meal Analysis', tag: 'CAMERA' },
  { src: 'assets/screens/SCREENSHOT_3.jpg', label: 'Trigger Evidence', tag: 'EVIDENCE' },
  { src: 'assets/screens/SCNREESHOT_6.jpg', label: 'Body Context', tag: 'CONTEXT' },
  { src: 'assets/screens/SCREENSHOT_2.jpg', label: 'Your Trigger Map', tag: 'MAP' },
  { src: 'assets/screens/THESECONDSCREENSHOT.jpg', label: 'AI Gut Coach', tag: 'COACH' },
  { src: 'assets/screens/SCREENSHOT_4.jpg', label: 'Tolerance Rebuild', tag: 'REBUILD' },
];

function AppCarousel() {
  const [active, setActive] = useStateA(0);
  const trackRef = useRefA(null);
  const touchRef = useRefA({ x: 0, y: 0, locked: null });

  const onTouchStart = (e) => {
    const t = e.touches[0];
    touchRef.current = { x: t.clientX, y: t.clientY, locked: null };
  };
  const onTouchMove = (e) => {
    const t = e.touches[0];
    const dx = t.clientX - touchRef.current.x;
    const dy = t.clientY - touchRef.current.y;
    if (touchRef.current.locked === null && (Math.abs(dx) > 8 || Math.abs(dy) > 8)) {
      touchRef.current.locked = Math.abs(dx) > Math.abs(dy) ? 'x' : 'y';
    }
    if (touchRef.current.locked === 'x') e.preventDefault();
  };
  const onTouchEnd = (e) => {
    const t = e.changedTouches[0];
    const dx = t.clientX - touchRef.current.x;
    if (touchRef.current.locked === 'x' && Math.abs(dx) > 40) {
      if (dx < 0) setActive(a => Math.min(SCREENS.length - 1, a + 1));
      else setActive(a => Math.max(0, a - 1));
    }
  };

  return (
    <section id="features" className="sec app-sec">
      <div className="container">
        <div className="app-head" data-reveal>
          <span className="eyebrow"><span className="num">03</span><span className="dot" /> Inside Gutsy</span>
          <h2 className="serif app-title">A log <em className="serif-it">that finally</em> knows what to ask.</h2>
          <p className="app-sub">Instant food, stool, symptom analysis — no more guesswork on your gut health.</p>
        </div>

        <div className="app-stage" data-reveal>
          <div
            className="app-phones"
            onTouchStart={onTouchStart}
            onTouchMove={onTouchMove}
            onTouchEnd={onTouchEnd}
          >
            {SCREENS.map((s, i) => {
              const offset = i - active;
              const abs = Math.abs(offset);
              const tx = offset * 280;
              const rot = offset * 6;
              const sc = abs === 0 ? 1 : abs === 1 ? 0.85 : 0.7;
              const op = abs > 3 ? 0 : 1 - abs * 0.18;
              const z = 100 - abs;
              return (
                <div
                  key={i}
                  className={`app-phone ${i === active ? 'active' : ''}`}
                  style={{
                    transform: `translateX(calc(-50% + ${tx}px)) rotateY(${-rot}deg) scale(${sc})`,
                    opacity: op, zIndex: z,
                    pointerEvents: abs > 2 ? 'none' : 'auto',
                  }}
                  onClick={() => setActive(i)}
                  onMouseEnter={() => setActive(i)}
                >
                  <div className="phone">
                    <div className="phone-screen">
                      <img src={s.src} alt={s.label} />
                    </div>
                  </div>
                </div>
              );
            })}
          </div>

          <div className="app-meta">
            <div className="cap" style={{color:'var(--accent)'}}>{String(active+1).padStart(2,'0')} / {String(SCREENS.length).padStart(2,'0')}</div>
            <h3 className="serif app-active-label">{SCREENS[active].label}</h3>
            <div className="cap" style={{color:'var(--muted)'}}>{SCREENS[active].tag}</div>
          </div>

          <div className="app-tabs">
            {SCREENS.map((s, i) => (
              <button key={i} className={`app-tab ${i===active?'on':''}`} onClick={()=>setActive(i)}>
                <span className="cap">{String(i+1).padStart(2,'0')}</span>
                <span>{s.label}</span>
              </button>
            ))}
          </div>
        </div>
      </div>
      <style>{`
        .app-sec { background: var(--bg-2); border-top: 1px solid var(--line); }
        .app-head { max-width: 100%; margin-bottom: 80px; }
        .app-title { margin-top: 28px; font-size: clamp(36px, 5.4vw, 92px); line-height: 1; letter-spacing: -0.04em; font-weight: 300; max-width: 100%; white-space: nowrap; }
        .app-title em { color: var(--accent); }
        [data-theme="dark"] .app-title em { color: var(--accent-glow); }
        .app-sub { margin-top: 28px; font-size: 20px; color: var(--ink-2); max-width: 100%; white-space: nowrap; }

        .app-stage { position: relative; perspective: 2000px; }
        .app-phones {
          height: 620px;
          position: relative;
          display: flex; align-items: center; justify-content: center;
          transform-style: preserve-3d;
        }
        .app-phone {
          position: absolute;
          left: 50%; top: 50%;
          transform-origin: center center;
          margin-top: -290px;
          transition: transform 0.7s cubic-bezier(0.2,0.8,0.2,1), opacity 0.7s;
          cursor: pointer;
          transform-style: preserve-3d;
        }
        .app-phone .phone {
          transition: box-shadow 0.5s;
        }
        .app-phone.active .phone {
          box-shadow:
            0 1px 2px rgba(0,0,0,0.2),
            0 60px 100px -30px rgba(0,0,0,0.45),
            0 100px 180px -40px rgba(0,0,0,0.3),
            0 0 0 1px var(--accent);
        }

        .app-meta {
          margin-top: 32px;
          text-align: center;
          position: relative; z-index: 50;
        }
        .app-active-label {
          font-size: 26px;
          font-weight: 300;
          letter-spacing: -0.03em;
          color: var(--ink);
          margin: 6px 0;
        }

        .app-tabs {
          margin-top: 56px;
          display: flex; gap: 0;
          flex-wrap: wrap;
          border-top: 1px solid var(--line);
          border-bottom: 1px solid var(--line);
        }
        .app-tab {
          flex: 1; min-width: 160px;
          padding: 18px 16px;
          background: transparent;
          border: none; border-right: 1px solid var(--line);
          color: var(--muted);
          cursor: pointer; text-align: left;
          display: flex; align-items: center; gap: 14px;
          font-family: 'Inter Tight', sans-serif;
          font-size: 13px;
          transition: all 0.4s;
        }
        .app-tab:last-child { border-right: none; }
        .app-tab .cap { color: var(--muted); }
        .app-tab.on { background: var(--accent); color: var(--bg); }
        .app-tab.on .cap { color: var(--bg); opacity: 0.6; }
        .app-tab:hover:not(.on) { color: var(--ink); background: var(--paper); }

        .app-bullets {
          margin-top: 64px;
          list-style: none;
          display: grid; grid-template-columns: repeat(3, 1fr);
          gap: 24px;
        }
        .app-bullets li {
          font-family: 'Fraunces', serif;
          font-size: 22px;
          font-weight: 300;
          letter-spacing: -0.02em;
          color: var(--ink);
          padding-top: 20px;
          border-top: 1px solid var(--line);
        }
        .app-bullets .bd { color: var(--accent); margin-right: 12px; font-size: 10px; vertical-align: middle; }

        @media (max-width: 900px) {
          .app-title {
            white-space: normal;
            font-size: clamp(32px, 9vw, 56px);
            letter-spacing: -0.03em;
          }
          .app-sub {
            white-space: normal;
            font-size: 17px;
            line-height: 1.4;
          }
          .app-head { margin-bottom: 48px; }
          .app-phones {
            height: 520px;
            touch-action: pan-y;
          }
          .app-tab { min-width: 50%; }
          .app-bullets { grid-template-columns: 1fr; }
        }
        @media (max-width: 480px) {
          .app-title { font-size: clamp(28px, 9vw, 40px); }
        }
      `}</style>
    </section>
  );
}

function Protocol() {
  const [active, setActive] = useStateA(0);
  const weeks = [
    { num: '01', title: 'Baseline established.', body: 'Gutsy calibrates your personal gut health through your food, stool, and symptom analysis.', tag: 'Calibration phase' },
    { num: '02', title: 'Patterns emerge.', body: 'First trigger candidates surface with hit rates.', tag: 'Pattern discovery' },
    { num: '03', title: 'Triggers identified.', body: 'Top personal triggers, with statistical confidence.', tag: 'Confidence ≥ 70%' },
    { num: '04', title: 'Elimination begins.', body: 'Guided removal. Symptom load drops, week over week.', tag: 'Symptom resolution' },
    { num: '05', title: 'Clarity & Confidence.', body: 'Gutsy begins to understand your patterns and gut health better than ever before.', tag: 'Tolerance mapping' },
    { num: '06', title: 'Your personal map.', body: 'Finished trigger profile. Doctor-ready PDF.', tag: 'Doctor-ready report' },
  ];

  return (
    <section id="protocol" className="sec proto-sec">
      <div className="container">
        <div className="proto-head" data-reveal>
          <span className="eyebrow"><span className="num">04</span><span className="dot" /> The 6-Week Protocol</span>
          <h2 className="serif proto-title">
            Your gut is <em className="serif-it">talking.</em><br />
            Gutsy is <em className="serif-it">listening.</em>
          </h2>
        </div>

        <div className="proto-stage" data-reveal>
          <div className="proto-progress">
            <div className="proto-progress-fill" style={{width: `${((active+1)/6)*100}%`}} />
            {weeks.map((_,i) => (
              <button key={i} className={`proto-tick ${i<=active?'on':''}`} style={{left: `${(i/5)*100}%`}} onClick={()=>setActive(i)} />
            ))}
          </div>

          <div className="proto-content">
            <div className="proto-card">
              <div className="proto-week-num serif">{weeks[active].num}</div>
              <div>
                <div className="cap" style={{color:'var(--accent)'}}>WEEK {weeks[active].num}</div>
                <h3 className="serif proto-week-title">{weeks[active].title.replace(/\.$/, '')}<em className="serif-it">.</em></h3>
                <p className="proto-week-body">{weeks[active].body}</p>
                <div className="cap" style={{color:'var(--muted)', marginTop:24}}>{weeks[active].tag}</div>
              </div>
            </div>

            <div className="proto-rail">
              {weeks.map((w, i) => (
                <button key={i} className={`proto-rail-item ${i===active?'on':''}`} onClick={()=>setActive(i)} onMouseEnter={()=>setActive(i)}>
                  <div className="proto-rail-num cap">WK {w.num}</div>
                  <div className="proto-rail-title">{w.title.replace(/\.$/,'')}</div>
                </button>
              ))}
            </div>
          </div>

          <div className="proto-controls">
            <button className="proto-btn" onClick={()=>setActive(Math.max(0, active-1))} disabled={active===0}>← Prev</button>
            <div className="cap" style={{color:'var(--muted)'}}>{String(active+1).padStart(2,'0')} / 06</div>
            <button className="proto-btn" onClick={()=>setActive(Math.min(5, active+1))} disabled={active===5}>Next →</button>
          </div>
        </div>
      </div>

      <style>{`
        .proto-sec { background: var(--bg); border-top: 1px solid var(--line); }
        .proto-head { max-width: 1100px; margin-bottom: 80px; }
        .proto-title { margin-top: 28px; font-size: clamp(40px, 6vw, 96px); line-height: 1; letter-spacing: -0.04em; font-weight: 300; }
        .proto-title em { color: var(--accent); }
        [data-theme="dark"] .proto-title em { color: var(--accent-glow); }

        .proto-progress {
          position: relative;
          height: 1px;
          background: var(--line);
          margin-bottom: 48px;
        }
        .proto-progress-fill {
          position: absolute; left: 0; top: 0; height: 1px;
          background: var(--accent);
          transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1);
        }
        .proto-tick {
          position: absolute; top: 50%;
          width: 12px; height: 12px;
          background: var(--bg);
          border: 1px solid var(--line);
          border-radius: 50%;
          transform: translate(-50%, -50%);
          cursor: pointer;
          padding: 0;
          transition: all 0.3s;
        }
        .proto-tick.on { background: var(--accent); border-color: var(--accent); }

        .proto-content {
          display: grid;
          grid-template-columns: 1.4fr 1fr;
          gap: 48px;
          align-items: start;
        }
        .proto-card {
          background: var(--paper);
          border: 1px solid var(--line);
          padding: 56px;
          display: flex;
          gap: 40px;
          min-height: 420px;
          position: relative;
        }
        .proto-week-num {
          font-size: 200px;
          line-height: 0.85;
          font-weight: 200;
          letter-spacing: -0.05em;
          color: var(--accent);
          opacity: 0.18;
        }
        .proto-week-title {
          font-size: clamp(36px, 4vw, 64px);
          line-height: 1;
          letter-spacing: -0.03em;
          font-weight: 300;
          margin: 12px 0 20px;
          color: var(--ink);
        }
        .proto-week-title em { color: var(--accent); }
        [data-theme="dark"] .proto-week-title em { color: var(--accent-glow); }
        .proto-week-body { font-size: 18px; color: var(--ink-2); line-height: 1.5; max-width: 380px; }

        .proto-rail {
          display: flex; flex-direction: column;
          border-top: 1px solid var(--line);
        }
        .proto-rail-item {
          padding: 18px 0;
          border-bottom: 1px solid var(--line);
          background: transparent; border-left: none; border-right: none;
          text-align: left;
          cursor: pointer;
          color: var(--muted);
          font-family: 'Inter Tight', sans-serif;
          font-size: 16px;
          display: flex; gap: 24px; align-items: baseline;
          transition: all 0.4s;
        }
        .proto-rail-item .proto-rail-num { width: 50px; color: var(--muted); }
        .proto-rail-item.on { color: var(--ink); padding-left: 16px; }
        .proto-rail-item.on .proto-rail-num { color: var(--accent); }
        .proto-rail-item:hover { color: var(--ink); }

        .proto-controls {
          margin-top: 48px;
          display: flex; align-items: center; justify-content: space-between;
          padding-top: 32px;
          border-top: 1px solid var(--line);
        }
        .proto-btn {
          background: transparent; border: none;
          font-family: 'JetBrains Mono', monospace;
          font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
          color: var(--ink); cursor: pointer;
          transition: opacity 0.3s;
        }
        .proto-btn:disabled { opacity: 0.3; cursor: default; }

        @media (max-width: 900px) {
          .proto-content { grid-template-columns: 1fr; }
          .proto-card { padding: 32px; flex-direction: column; gap: 16px; }
          .proto-week-num { font-size: 120px; }
        }
      `}</style>
    </section>
  );
}

function PdfReveal() {
  const ref = useRefA(null);
  const [vis, setVis] = useStateA(false);

  useEffectA(() => {
    const obs = new IntersectionObserver(([e]) => {
      if (e.isIntersecting) setVis(true);
    }, { threshold: 0.18 });
    if (ref.current) obs.observe(ref.current);
    return () => obs.disconnect();
  }, []);

  // Weekly bowel pattern summary — frequency, Bristol dominance, symptom load
  // Pattern: IBS-D presentation softens to ideal Type 4 by Wk 06
  const weeks = [
    { wk: '01', bms: 12, perDay: 1.7, bristol: 7, bDom: 80, load: 82 },
    { wk: '02', bms: 10, perDay: 1.4, bristol: 6, bDom: 60, load: 71 },
    { wk: '03', bms:  9, perDay: 1.3, bristol: 5, bDom: 50, load: 54 },
    { wk: '04', bms:  8, perDay: 1.1, bristol: 4, bDom: 50, load: 40 },
    { wk: '05', bms:  7, perDay: 1.0, bristol: 4, bDom: 70, load: 28 },
    { wk: '06', bms:  7, perDay: 1.0, bristol: 4, bDom: 80, load: 18 },
  ];

  // Symptom load % vs cumulative confirmed triggers — the inverse correlation
  // that explains *why* symptoms drop. Both indexed at week endpoints.
  const trendSym  = weeks.map(w => w.load);          // 82 → 18
  const trendTrig = [0, 2, 5, 8, 11, 12];            // 0 → 12 confirmed

  const triggers = [
    { name: 'Soy Sauce',  cls: 'FRUCTAN',           conf: 92, lag: 24 },
    { name: 'Apples',     cls: 'POLYOL · sorbitol', conf: 84, lag: 36 },
    { name: 'Garlic',     cls: 'FRUCTAN',           conf: 78, lag: 26 },
    { name: 'Mozzarella', cls: 'LACTOSE',           conf: 71, lag: 22 },
  ];

  return (
    <section id="report" className="sec pdf-sec" ref={ref}>
      <div className="container pdf-grid">
        <div className="pdf-text" data-reveal>
          <span className="eyebrow"><span className="num">05</span><span className="dot" /> Doctor-Ready Export</span>
          <h2 className="serif pdf-title">
            Walk in with <em className="serif-it">evidence.</em><br />
            Walk out with <em className="serif-it">answers.</em>
          </h2>
          <p className="pdf-sub">One page. Six weeks of clinical-grade data. The conversation finally has facts.</p>
          <ul className="pdf-list">
            <li>Weekly bowel pattern · Bristol type · symptom load</li>
            <li>Triggers identified vs symptoms over 6 weeks</li>
            <li>Top suspects ranked by Bayesian confidence</li>
            <li>Apple Health pattern insights · sleep, HRV, motion</li>
            <li>Print-ready PDF · shareable · doctor-tested</li>
          </ul>
          <a className="btn btn-ghost" href="#" style={{marginTop: 32}}>
            <span>See sample report</span>
            <span className="arr">→</span>
          </a>
        </div>

        <div className={`pdf-frame ${vis ? 'in' : ''}`}>
          <div className="pdf-bg" />
          <div className="pdf-paper">

            {/* MASTHEAD */}
            <div className="pdf-mast">
              <div className="pdf-mast-l">
                <div className="pdf-mast-eye"><span className="pdf-pulse" />6-WEEK CLINICAL REPORT</div>
                <div className="pdf-mast-word">Gutsy<span className="pdf-mast-mid">·</span></div>
                <svg className="pdf-mast-wave" viewBox="0 0 160 14" preserveAspectRatio="none">
                  <path d="M0,9 C20,9 28,3 60,5 C90,6.5 105,11 130,10 C145,9.5 154,8.5 160,9"
                        fill="none" stroke="#0F2818" strokeWidth="0.9" strokeLinecap="round"/>
                </svg>
              </div>
              <div className="pdf-mast-r">
                <div><span>PATIENT</span><em>J. Reyes</em></div>
                <div><span>DOB</span><em>1989-04-22</em></div>
                <div><span>MRN</span><em>A-2837</em></div>
                <div><span>RANGE</span><em>42 DAYS</em></div>
                <div><span>ISSUED</span><em>2026-04-26</em></div>
              </div>
            </div>

            {/* HERO RESULT */}
            <div className="pdf-hero">
              <div className="pdf-hero-num">−72<span className="pdf-hero-pct">%</span></div>
              <div className="pdf-hero-cap">
                <div className="pdf-hero-line">SYMPTOM LOAD REDUCTION</div>
                <div className="pdf-hero-sub">Week 1 baseline → Week 6 endpoint</div>
                <div className="pdf-hero-quad">
                  <div><div className="pdf-hero-q-num">12</div><div className="pdf-hero-q-lbl">TRIGGERS</div></div>
                  <div><div className="pdf-hero-q-num">34h</div><div className="pdf-hero-q-lbl">TRANSIT</div></div>
                  <div><div className="pdf-hero-q-num">86%</div><div className="pdf-hero-q-lbl">ADHERENCE</div></div>
                </div>
              </div>
            </div>

            {/* WEEKLY BOWEL PATTERN */}
            <section className="pdf-block">
              <div className="pdf-block-head">
                <span className="pdf-mono">WEEKLY BOWEL PATTERN</span>
                <span className="pdf-mono pdf-fade">FREQUENCY · BRISTOL · LOAD</span>
              </div>
              <div className="pdf-weekly">
                <div className="pdf-wk-headers">
                  <span></span>
                  <span>FREQUENCY</span>
                  <span>AVG BRISTOL</span>
                  <span>SYMPTOM LOAD</span>
                </div>
                {weeks.map((w, i) => {
                  const isIdeal = w.bristol === 4;
                  return (
                    <div key={i} className="pdf-wk-row">
                      <span className="pdf-wk-label">WK {w.wk}</span>
                      <span className="pdf-wk-freq">
                        <em>{w.bms}</em> BMs · {w.perDay.toFixed(1)}/d
                      </span>
                      <span className={`pdf-wk-bristol ${isIdeal ? 'ideal' : ''}`}>
                        <span className="pdf-wk-btype">Type {w.bristol}</span>
                        <span className="pdf-wk-bdom">· {w.bDom}%</span>
                      </span>
                      <span className="pdf-wk-load">
                        <span className="pdf-wk-bar">
                          <span
                            className="pdf-wk-bar-fill"
                            style={{ width: vis ? `${w.load}%` : '0%', transitionDelay: `${0.25 + i*0.08}s` }}
                          />
                        </span>
                        <span className="pdf-wk-pct">{w.load}<span className="pct">%</span></span>
                      </span>
                    </div>
                  );
                })}
              </div>
              <div className="pdf-wk-legend">
                <span className="pdf-mono pdf-fade">IDEAL · TYPE 4 · 7 BMs/wk</span>
                <span className="pdf-mono pdf-fade">−78% LOAD · WK 01 → WK 06</span>
              </div>
            </section>

            {/* DUAL-AXIS TREND: SYMPTOMS DOWN, TRIGGERS UP */}
            <section className="pdf-block">
              <div className="pdf-block-head">
                <span className="pdf-mono">SYMPTOMS × TRIGGERS · WEEKLY</span>
                <span className="pdf-mono pdf-fade">INVERSE CORRELATION</span>
              </div>
              {(() => {
                // x: 6 evenly-spaced points across 14→306 (room for axis labels)
                const xs = [14, 72, 130, 188, 246, 306];
                // y: 4 (top) → 64 (bottom), so map symptoms (0-100) and triggers (0-12)
                const ySym  = v => 4 + (1 - v/100) * 60;
                const yTrig = v => 4 + (1 - v/12)  * 60;
                const symPts  = xs.map((x,i) => [x, ySym(trendSym[i])]);
                const trigPts = xs.map((x,i) => [x, yTrig(trendTrig[i])]);
                const smooth = (pts) => pts.reduce((d,[x,y],i,arr) => {
                  if (i === 0) return `M${x},${y}`;
                  const [px,py] = arr[i-1];
                  const cx = px + (x-px)*0.5;
                  return `${d} C${cx},${py} ${cx},${y} ${x},${y}`;
                }, '');
                const symPath  = smooth(symPts);
                const trigPath = smooth(trigPts);
                return (
                  <svg viewBox="0 0 320 80" className="pdf-trend2" preserveAspectRatio="none">
                    <defs>
                      <linearGradient id="symG" x1="0" x2="0" y1="0" y2="1">
                        <stop offset="0%" stopColor="#0F2818" stopOpacity="0.16"/>
                        <stop offset="100%" stopColor="#0F2818" stopOpacity="0"/>
                      </linearGradient>
                    </defs>
                    {/* baseline */}
                    <line x1="14" x2="306" y1="64" y2="64" stroke="rgba(15,40,24,0.10)" strokeWidth="0.5" />
                    {/* symptom area + line */}
                    <path className="pdf-fill"
                          d={`${symPath} L${xs[xs.length-1]},64 L${xs[0]},64 Z`}
                          fill="url(#symG)" />
                    <path className="pdf-line pdf-line-sym" d={symPath}
                          fill="none" stroke="#0F2818" strokeWidth="1.5" strokeLinecap="round" />
                    {/* trigger line — peacock, dashed */}
                    <path className="pdf-line pdf-line-trig" d={trigPath}
                          fill="none" stroke="#0E3B5C" strokeWidth="1.3" strokeLinecap="round"
                          strokeDasharray="3 3" />
                    {/* dots */}
                    {symPts.map(([x,y],i) => (
                      <circle key={`s${i}`} cx={x} cy={y} r="2.2" fill="#FBF8EC" stroke="#0F2818" strokeWidth="1" />
                    ))}
                    {trigPts.map(([x,y],i) => (
                      <circle key={`t${i}`} cx={x} cy={y} r="1.8" fill="#0E3B5C" />
                    ))}
                    {/* y-axis labels (left = symptoms %, right = trigger count) */}
                    <text x="2"   y="8"  className="pdf-axis">100%</text>
                    <text x="2"   y="66" className="pdf-axis">0</text>
                    <text x="318" y="8"  className="pdf-axis pdf-axis-r">12</text>
                    <text x="318" y="66" className="pdf-axis pdf-axis-r">0</text>
                  </svg>
                );
              })()}
              <div className="pdf-trend-labels">
                <span>WK 01</span><span>WK 02</span><span>WK 03</span><span>WK 04</span><span>WK 05</span><span>WK 06</span>
              </div>
              <div className="pdf-trend-legend">
                <span className="pdf-trend-key">
                  <span className="pdf-trend-swatch sym" /> SYMPTOM LOAD %
                </span>
                <span className="pdf-trend-key">
                  <span className="pdf-trend-swatch trig" /> TRIGGERS IDENTIFIED
                </span>
              </div>
            </section>

            {/* LEAD SUSPECT — DARK AURORA PLATE */}
            <div className="pdf-suspect">
              <div className="pdf-suspect-aurora" />
              <div className="pdf-suspect-grain" />
              <div className="pdf-suspect-content">
                <div className="pdf-suspect-head">
                  <span className="pdf-suspect-pulse" />
                  <span>#1 SUSPECT · CONFIRMED</span>
                </div>
                <div className="pdf-suspect-name">Oat Milk</div>
                <div className="pdf-suspect-class">LOW FODMAP · PERSONAL SENSITIVITY</div>
                <div className="pdf-suspect-tagline">The trigger your <em>dietitian missed.</em></div>
                <div className="pdf-suspect-row">
                  <div className="pdf-suspect-stat">
                    <div className="pdf-suspect-num">94<span className="of">%</span></div>
                    <div className="pdf-suspect-lbl">HIT RATE</div>
                  </div>
                  <div className="pdf-suspect-divider" />
                  <div className="pdf-suspect-stat">
                    <div className="pdf-suspect-num small">31<span className="of">/33</span></div>
                    <div className="pdf-suspect-lbl">EXPOSURES</div>
                  </div>
                  <div className="pdf-suspect-divider" />
                  <div className="pdf-suspect-stat">
                    <div className="pdf-suspect-num small">+24h</div>
                    <div className="pdf-suspect-lbl">AVG ONSET</div>
                  </div>
                </div>
                <div className="pdf-suspect-foot">
                  <span>TOP SYMPTOM</span>
                  <span className="pdf-suspect-foot-sym">Bloating · 31 of 33 exposures</span>
                </div>
              </div>
            </div>

            {/* TOP TRIGGERS LIST */}
            <section className="pdf-block">
              <div className="pdf-block-head">
                <span className="pdf-mono">TOP CONFIRMED TRIGGERS</span>
                <span className="pdf-mono pdf-fade">RANKED BY EVIDENCE</span>
              </div>
              <div className="pdf-trigs">
                {triggers.map((t,i)=>(
                  <div key={i} className="pdf-trig">
                    <span className="pdf-trig-rank">{String(i+2).padStart(2,'0')}</span>
                    <div className="pdf-trig-name">
                      <span>{t.name}</span>
                      <span className="pdf-trig-class">{t.cls}</span>
                    </div>
                    <div className="pdf-trig-bar">
                      <div className="pdf-trig-fill" style={{width: vis ? `${t.conf}%` : '0%', transitionDelay: `${0.4 + i*0.09}s`}} />
                    </div>
                    <span className="pdf-trig-pct">{t.conf}<span className="pct">%</span></span>
                    <span className="pdf-trig-lag">+{t.lag}h</span>
                  </div>
                ))}
              </div>
            </section>

            {/* APPLE HEALTH · PATTERNS */}
            <section className="pdf-block">
              <div className="pdf-block-head">
                <span className="pdf-mono">APPLE HEALTH · PATTERNS</span>
                <span className="pdf-mono pdf-fade">GUT × STRESS × MOTION</span>
              </div>
              <div className="pdf-health-grid">
                <div className="pdf-health-insights">
                  <div className="pdf-insight">
                    <div className="pdf-insight-stat">
                      Sleep <em>&lt; 6h</em> → next-day flare
                      <span className="pdf-insight-x">3.1×</span>
                    </div>
                    <div className="pdf-mono pdf-fade">n=11 nights · gut permeability link</div>
                  </div>
                  <div className="pdf-insight">
                    <div className="pdf-insight-stat">
                      Low-step days <em>&lt; 3k</em> → bloating
                      <span className="pdf-insight-x">+64%</span>
                    </div>
                    <div className="pdf-mono pdf-fade">Movement aids motility · 15-min walks</div>
                  </div>
                </div>
                <div className="pdf-health-shift">
                  <div className="pdf-mono pdf-fade pdf-shift-head">WK 01 → WK 06</div>
                  <div className="pdf-shift-row">
                    <span className="pdf-mono">SLEEP</span>
                    <span className="pdf-shift-val"><em>5.6h</em><span className="pdf-shift-arr">→</span><strong>7.1h</strong></span>
                  </div>
                  <div className="pdf-shift-row">
                    <span className="pdf-mono">HRV</span>
                    <span className="pdf-shift-val"><em>38ms</em><span className="pdf-shift-arr">→</span><strong>47ms</strong></span>
                  </div>
                  <div className="pdf-shift-row">
                    <span className="pdf-mono">RHR</span>
                    <span className="pdf-shift-val"><em>72bpm</em><span className="pdf-shift-arr">→</span><strong>64bpm</strong></span>
                  </div>
                  <div className="pdf-shift-row">
                    <span className="pdf-mono">STEPS</span>
                    <span className="pdf-shift-val"><em>4.2k</em><span className="pdf-shift-arr">→</span><strong>6.8k</strong></span>
                  </div>
                </div>
              </div>
            </section>

            {/* FOOTER */}
            <div className="pdf-foot">
              <span>CONFIDENTIAL · PATIENT COPY</span>
              <span className="pdf-foot-mid">TRANSIT-AWARE BAYESIAN INFERENCE · n=42 · p&lt;0.05</span>
              <span>01 / 01</span>
            </div>
          </div>
        </div>
      </div>

      <style>{`
        .pdf-sec { background: var(--bg-2); padding: 140px 0; border-top: 1px solid var(--line); }
        .pdf-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 80px; align-items: center; }
        .pdf-text { max-width: 520px; }
        .pdf-title { margin-top: 28px; font-size: clamp(40px, 5.5vw, 88px); line-height: 1; letter-spacing: -0.04em; font-weight: 300; }
        .pdf-title em { color: var(--accent); }
        [data-theme="dark"] .pdf-title em { color: var(--accent-glow); }
        .pdf-sub { margin-top: 28px; font-size: 20px; color: var(--ink-2); }
        .pdf-list { list-style: none; margin-top: 32px; border-top: 1px solid var(--line); }
        .pdf-list li {
          padding: 14px 0; border-bottom: 1px solid var(--line);
          color: var(--ink-2); font-size: 16px;
          position: relative; padding-left: 24px;
        }
        .pdf-list li::before {
          content: ""; position: absolute; left: 0; top: 22px;
          width: 8px; height: 1px; background: var(--accent);
        }

        .pdf-frame {
          position: relative;
          width: 100%;
          opacity: 0;
          transform: translateY(40px) rotate(-1.6deg);
          transition: all 1.2s cubic-bezier(0.2,0.8,0.2,1);
        }
        .pdf-frame.in { opacity: 1; transform: translateY(0) rotate(-1.2deg); }
        .pdf-frame:hover { transform: translateY(-8px) rotate(0deg); transition-duration: 0.7s; }

        .pdf-bg {
          position: absolute; inset: -40px; z-index: 0;
          background:
            radial-gradient(ellipse at 30% 30%, rgba(15,40,24,0.20), transparent 60%),
            radial-gradient(ellipse at 70% 80%, rgba(14,59,92,0.14), transparent 60%);
          filter: blur(50px);
        }

        /* === PAPER === */
        .pdf-paper {
          --p-cream: #FBF8EC;
          --p-paper: #F5F0E0;
          --p-ink: #0F2818;
          --p-ink-2: rgba(15,40,24,0.78);
          --p-graphite: #6B5D52;
          --p-line: rgba(15,40,24,0.12);
          --p-line-2: rgba(15,40,24,0.06);
          --p-peacock: #0E3B5C;
          --p-glow: #6BA27E;

          position: relative; z-index: 1;
          width: 100%; height: auto;
          background:
            radial-gradient(ellipse at 0% 0%, rgba(232,224,208,0.55), transparent 55%),
            radial-gradient(ellipse at 100% 100%, rgba(232,224,208,0.4), transparent 60%),
            var(--p-cream);
          color: var(--p-ink);
          padding: 26px 28px 18px;
          box-shadow:
            0 1px 2px rgba(0,0,0,0.08),
            0 30px 60px -20px rgba(0,0,0,0.22),
            0 60px 120px -30px rgba(15,40,24,0.18);
          font-family: 'Inter Tight', system-ui, sans-serif;
          font-size: 10px; line-height: 1.45;
          display: flex; flex-direction: column;
          overflow: hidden;
        }
        .pdf-paper::before {
          content: "";
          position: absolute; inset: 0;
          background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.4 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
          opacity: 0.05; mix-blend-mode: multiply; pointer-events: none;
          z-index: 1;
        }
        .pdf-paper > * { position: relative; z-index: 2; }

        .pdf-mono {
          font-family: 'JetBrains Mono', monospace;
          text-transform: uppercase;
          letter-spacing: 0.18em;
          font-size: 8px;
          font-weight: 500;
          color: var(--p-ink);
        }
        .pdf-fade { color: var(--p-graphite); opacity: 0.7; }

        .pdf-pulse {
          width: 5px; height: 5px; border-radius: 50%;
          background: var(--p-ink);
          box-shadow: 0 0 8px rgba(15,40,24,0.4);
          animation: pdfPulse 2.4s ease-in-out infinite;
          display: inline-block;
        }
        @keyframes pdfPulse {
          0%, 100% { opacity: 0.55; transform: scale(1); }
          50% { opacity: 1; transform: scale(1.25); }
        }

        /* === MASTHEAD === */
        .pdf-mast {
          display: flex; justify-content: space-between; align-items: flex-start;
          gap: 16px;
          padding-bottom: 14px;
          border-bottom: 1px solid var(--p-line);
        }
        .pdf-mast-eye {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.22em;
          text-transform: uppercase;
          color: var(--p-ink);
          display: inline-flex; align-items: center; gap: 6px;
          margin-bottom: 8px;
        }
        .pdf-mast-word {
          font-family: 'Fraunces', 'Instrument Serif', serif;
          font-weight: 300;
          font-size: 30px;
          letter-spacing: -0.04em;
          line-height: 0.9;
          color: var(--p-ink);
        }
        .pdf-mast-mid {
          color: var(--p-graphite);
          margin-left: 6px;
          font-weight: 200;
        }
        .pdf-mast-wave {
          width: 140px; height: 12px; display: block;
          margin-top: 4px;
          stroke-dasharray: 220;
          stroke-dashoffset: 220;
          opacity: 0;
        }
        .pdf-frame.in .pdf-mast-wave {
          animation: pdfWave 1.6s 0.35s cubic-bezier(0.2,0.8,0.2,1) forwards;
        }
        @keyframes pdfWave {
          0% { opacity: 0; stroke-dashoffset: 220; }
          100% { opacity: 1; stroke-dashoffset: 0; }
        }
        .pdf-mast-r {
          font-family: 'JetBrains Mono', monospace;
          font-size: 7.5px;
          letter-spacing: 0.04em;
          color: var(--p-graphite);
          text-align: right;
          line-height: 1.7;
        }
        .pdf-mast-r > div { display: flex; justify-content: flex-end; gap: 10px; }
        .pdf-mast-r > div span { color: var(--p-graphite); opacity: 0.6; min-width: 44px; text-align: right; }
        .pdf-mast-r > div em {
          font-style: normal;
          color: var(--p-ink);
          font-family: 'JetBrains Mono', monospace;
          min-width: 80px; text-align: left;
        }

        /* === HERO === */
        .pdf-hero {
          margin-top: 14px;
          padding-bottom: 14px;
          border-bottom: 1px solid var(--p-line);
          display: grid;
          grid-template-columns: auto 1fr;
          gap: 22px;
          align-items: center;
        }
        .pdf-hero-num {
          font-family: 'Fraunces', serif;
          font-weight: 200;
          font-size: 64px;
          line-height: 0.88;
          letter-spacing: -0.05em;
          color: var(--p-ink);
          font-feature-settings: 'tnum';
        }
        .pdf-hero-pct {
          font-size: 26px;
          color: var(--p-graphite);
          margin-left: 3px;
          font-weight: 300;
          vertical-align: 22px;
        }
        .pdf-hero-cap { align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
        .pdf-hero-line {
          font-family: 'JetBrains Mono', monospace;
          font-size: 9px;
          letter-spacing: 0.22em;
          text-transform: uppercase;
          color: var(--p-ink);
        }
        .pdf-hero-sub {
          font-family: 'Fraunces', 'Instrument Serif', serif;
          font-style: italic;
          font-size: 12px;
          color: var(--p-graphite);
          margin-top: -4px;
        }
        .pdf-hero-quad {
          margin-top: 6px; padding-top: 10px;
          border-top: 1px solid var(--p-line-2);
          display: grid;
          grid-template-columns: repeat(3, 1fr);
          gap: 10px;
        }
        .pdf-hero-q-num {
          font-family: 'Fraunces', serif;
          font-weight: 300;
          font-size: 18px;
          letter-spacing: -0.03em;
          color: var(--p-ink);
          margin-bottom: 1px;
          font-feature-settings: 'tnum';
        }
        .pdf-hero-q-lbl {
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.2em;
          color: var(--p-graphite);
        }

        /* === BLOCK COMMON === */
        .pdf-block { margin-top: 14px; }
        .pdf-block-head {
          display: flex; justify-content: space-between; align-items: center;
          padding-bottom: 7px;
          border-bottom: 1px solid var(--p-line);
          margin-bottom: 10px;
        }

        /* === WEEKLY BOWEL PATTERN === */
        .pdf-weekly { display: flex; flex-direction: column; }
        .pdf-wk-headers,
        .pdf-wk-row {
          display: grid;
          grid-template-columns: 44px 90px 90px 1fr;
          gap: 14px;
          align-items: center;
          padding: 8px 0;
        }
        .pdf-wk-headers {
          padding: 0 0 8px;
          border-bottom: 1px solid var(--p-line);
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.2em;
          color: var(--p-graphite); opacity: 0.7;
        }
        .pdf-wk-row {
          border-bottom: 1px solid var(--p-line-2);
        }
        .pdf-wk-row:last-of-type { border-bottom: none; }
        .pdf-wk-label {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.2em;
          color: var(--p-ink);
        }
        .pdf-wk-freq {
          font-family: 'Inter Tight', sans-serif;
          font-size: 9px;
          color: var(--p-graphite);
          font-feature-settings: 'tnum';
        }
        .pdf-wk-freq em {
          font-style: normal;
          font-family: 'Fraunces', serif;
          font-size: 14px;
          color: var(--p-ink);
          letter-spacing: -0.02em;
          margin-right: 3px;
          font-weight: 400;
        }
        .pdf-wk-bristol {
          display: inline-flex; align-items: baseline; gap: 4px;
          font-family: 'Inter Tight', sans-serif;
          font-size: 9px;
          color: var(--p-graphite);
          padding: 3px 9px 3px 9px;
          border: 1px solid rgba(160,69,69,0.32);
          background: rgba(160,69,69,0.06);
          border-radius: 100px;
          width: fit-content;
        }
        .pdf-wk-bristol.ideal {
          border-color: rgba(15,40,24,0.32);
          background: rgba(15,40,24,0.05);
        }
        .pdf-wk-btype {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.12em;
          color: #a04545;
          font-weight: 600;
        }
        .pdf-wk-bristol.ideal .pdf-wk-btype { color: var(--p-ink); }
        .pdf-wk-bdom {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.04em;
          color: var(--p-graphite);
        }
        .pdf-wk-load {
          display: grid;
          grid-template-columns: 1fr 38px;
          gap: 10px;
          align-items: center;
        }
        .pdf-wk-bar {
          height: 6px;
          background: rgba(15,40,24,0.06);
          border-radius: 100px;
          position: relative;
          overflow: hidden;
          display: block;
        }
        .pdf-wk-bar-fill {
          position: absolute; left: 0; top: 0; bottom: 0;
          width: 0;
          background: linear-gradient(90deg,
            #6B5D52 0%,
            #3D3530 35%,
            var(--p-ink) 70%,
            var(--p-peacock) 100%);
          border-radius: 100px;
          transition: width 1.4s cubic-bezier(0.2,0.8,0.2,1);
          box-shadow: 0 0 0 0.5px rgba(255,255,255,0.04) inset;
        }
        .pdf-wk-pct {
          font-family: 'Fraunces', serif;
          font-size: 14px;
          font-weight: 400;
          color: var(--p-ink);
          letter-spacing: -0.02em;
          text-align: right;
          font-feature-settings: 'tnum';
        }
        .pdf-wk-pct .pct {
          font-size: 9px; color: var(--p-graphite);
          margin-left: 1px;
        }
        .pdf-wk-legend {
          display: flex; justify-content: space-between;
          padding-top: 8px; margin-top: 4px;
          border-top: 1px solid var(--p-line-2);
        }

        /* === TREND === */
        .pdf-trend, .pdf-trend2 { width: 100%; display: block; }
        .pdf-trend { height: 64px; }
        .pdf-trend2 { height: 80px; }
        .pdf-line, .pdf-fill {
          stroke-dasharray: 600; stroke-dashoffset: 600;
          opacity: 0;
        }
        .pdf-frame.in .pdf-line-sym {
          animation: pdfDraw 2s 0.5s cubic-bezier(0.2,0.8,0.2,1) forwards;
        }
        .pdf-frame.in .pdf-line-trig {
          animation: pdfDraw 2s 0.9s cubic-bezier(0.2,0.8,0.2,1) forwards;
        }
        .pdf-frame.in .pdf-line {
          animation: pdfDraw 2s 0.5s cubic-bezier(0.2,0.8,0.2,1) forwards;
        }
        .pdf-frame.in .pdf-fill {
          animation: pdfFillIn 1.4s 1.5s ease-out forwards;
        }
        .pdf-axis {
          font-family: 'JetBrains Mono', monospace;
          font-size: 6px;
          letter-spacing: 0.08em;
          fill: var(--p-graphite);
          opacity: 0.7;
        }
        .pdf-axis-r { text-anchor: end; }
        .pdf-trend-legend {
          display: flex; gap: 18px;
          padding-top: 6px;
          margin-top: 2px;
          border-top: 1px solid var(--p-line-2);
        }
        .pdf-trend-key {
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.18em;
          color: var(--p-graphite);
          display: inline-flex; align-items: center; gap: 5px;
        }
        .pdf-trend-swatch {
          width: 14px; height: 2px; display: inline-block;
        }
        .pdf-trend-swatch.sym  { background: var(--p-ink); }
        .pdf-trend-swatch.trig {
          background: linear-gradient(90deg, var(--p-peacock) 0 50%, transparent 50% 100%);
          background-size: 6px 2px;
          background-repeat: repeat-x;
          background-color: transparent;
          background-image: repeating-linear-gradient(90deg, var(--p-peacock) 0 3px, transparent 3px 6px);
        }
        @keyframes pdfDraw {
          0% { opacity: 0; stroke-dashoffset: 600; }
          15% { opacity: 1; }
          100% { opacity: 1; stroke-dashoffset: 0; }
        }
        @keyframes pdfFillIn { to { opacity: 1; stroke-dashoffset: 0; } }

        .pdf-trend circle {
          opacity: 0;
          animation: pdfDot 0.4s ease-out forwards;
        }
        .pdf-frame.in .pdf-trend circle:nth-child(4) { animation-delay: 0.7s; }
        .pdf-frame.in .pdf-trend circle:nth-child(5) { animation-delay: 0.9s; }
        .pdf-frame.in .pdf-trend circle:nth-child(6) { animation-delay: 1.1s; }
        .pdf-frame.in .pdf-trend circle:nth-child(7) { animation-delay: 1.3s; }
        .pdf-frame.in .pdf-trend circle:nth-child(8) { animation-delay: 1.5s; }
        .pdf-frame.in .pdf-trend circle:nth-child(9) { animation-delay: 1.7s; }
        @keyframes pdfDot { to { opacity: 1; } }

        .pdf-trend-labels {
          display: flex; justify-content: space-between;
          padding: 6px 0 0;
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.18em;
          color: var(--p-graphite);
        }

        /* === SUSPECT — DARK AURORA PLATE === */
        .pdf-suspect {
          position: relative;
          margin-top: 16px;
          padding: 16px 18px 14px;
          border-radius: 12px;
          overflow: hidden;
          background:
            linear-gradient(135deg, #0F2818 0%, #134029 45%, #0E3B5C 100%);
          color: #FBF8EC;
          isolation: isolate;
          box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.08),
            0 8px 24px -8px rgba(15,40,24,0.4);
        }
        .pdf-suspect-aurora {
          position: absolute; inset: -40%;
          background:
            radial-gradient(circle at 22% 30%, rgba(74,139,92,0.55), transparent 50%),
            radial-gradient(circle at 80% 75%, rgba(14,59,92,0.55), transparent 55%);
          filter: blur(28px);
          z-index: 0;
        }
        .pdf-suspect-grain {
          position: absolute; inset: 0;
          background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
          opacity: 0.06;
          mix-blend-mode: screen;
          pointer-events: none;
          z-index: 1;
        }
        .pdf-suspect-content { position: relative; z-index: 2; }
        .pdf-suspect-head {
          display: inline-flex; align-items: center; gap: 6px;
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.22em;
          color: rgba(251,248,236,0.72);
          margin-bottom: 8px;
        }
        .pdf-suspect-pulse {
          width: 5px; height: 5px; border-radius: 50%;
          background: #6BA27E;
          box-shadow: 0 0 10px rgba(107,162,126,0.85);
          animation: pdfPulse 2s ease-in-out infinite;
        }
        .pdf-suspect-name {
          font-family: 'Fraunces', serif;
          font-weight: 300;
          font-size: 28px;
          letter-spacing: -0.04em;
          line-height: 0.9;
          background: linear-gradient(135deg, #FBF8EC 0%, rgba(251,248,236,0.78) 100%);
          -webkit-background-clip: text;
          background-clip: text;
          -webkit-text-fill-color: transparent;
        }
        .pdf-suspect-class {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.22em;
          color: rgba(251,248,236,0.6);
          margin-top: 4px;
        }
        .pdf-suspect-tagline {
          font-family: 'Fraunces', serif;
          font-style: italic;
          font-size: 12px;
          letter-spacing: -0.01em;
          color: rgba(251,248,236,0.85);
          margin-top: 6px;
          margin-bottom: 14px;
        }
        .pdf-suspect-tagline em {
          font-style: italic;
          color: #c9e8d3;
        }
        .pdf-suspect-row {
          display: flex; align-items: stretch; gap: 12px;
          padding-top: 10px;
          border-top: 1px solid rgba(251,248,236,0.12);
        }
        .pdf-suspect-stat { flex: 1; min-width: 0; }
        .pdf-suspect-num {
          font-family: 'Fraunces', serif;
          font-weight: 300;
          font-size: 30px;
          letter-spacing: -0.04em;
          line-height: 1;
          background: linear-gradient(135deg, #FBF8EC 0%, rgba(168,217,185,0.85) 100%);
          -webkit-background-clip: text;
          background-clip: text;
          -webkit-text-fill-color: transparent;
          font-feature-settings: 'tnum';
        }
        .pdf-suspect-num.small { font-size: 20px; }
        .pdf-suspect-num .of {
          font-size: 12px;
          color: rgba(251,248,236,0.55);
          margin-left: 2px;
          -webkit-text-fill-color: rgba(251,248,236,0.55);
          background: none;
        }
        .pdf-suspect-num.small .of { font-size: 11px; }
        .pdf-suspect-lbl {
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.22em;
          color: rgba(251,248,236,0.55);
          margin-top: 4px;
        }
        .pdf-suspect-divider {
          width: 1px; background: rgba(251,248,236,0.12);
          flex: 0 0 1px;
        }
        .pdf-suspect-foot {
          margin-top: 10px;
          display: flex; justify-content: space-between; align-items: baseline;
          padding-top: 9px;
          border-top: 1px solid rgba(251,248,236,0.12);
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.2em;
          color: rgba(251,248,236,0.55);
        }
        .pdf-suspect-foot-sym {
          font-family: 'Fraunces', serif;
          font-style: italic;
          font-size: 11px;
          letter-spacing: -0.01em;
          color: #FBF8EC;
          text-transform: none;
        }

        /* === TRIGGERS LIST === */
        .pdf-trigs { display: flex; flex-direction: column; }
        .pdf-trig {
          display: grid;
          grid-template-columns: 22px 1.4fr 1fr 38px 32px;
          gap: 10px;
          align-items: center;
          padding: 8px 0;
          border-bottom: 1px solid var(--p-line-2);
        }
        .pdf-trig:last-child { border-bottom: none; }
        .pdf-trig-rank {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.18em;
          color: var(--p-graphite); opacity: 0.7;
        }
        .pdf-trig-name {
          display: flex; flex-direction: column; gap: 1px;
        }
        .pdf-trig-name > span:first-child {
          font-family: 'Fraunces', serif;
          font-size: 13px;
          font-weight: 400;
          color: var(--p-ink);
          letter-spacing: -0.01em;
        }
        .pdf-trig-class {
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.18em;
          color: var(--p-graphite);
          opacity: 0.7;
        }
        .pdf-trig-bar {
          height: 4px;
          background: rgba(15,40,24,0.08);
          border-radius: 100px;
          position: relative;
          overflow: hidden;
        }
        .pdf-trig-fill {
          position: absolute; left: 0; top: 0; bottom: 0;
          width: 0;
          background: linear-gradient(90deg, var(--p-ink) 0%, var(--p-peacock) 100%);
          border-radius: 100px;
          transition: width 1.4s cubic-bezier(0.2,0.8,0.2,1);
        }
        .pdf-trig-pct {
          font-family: 'Fraunces', serif;
          font-size: 14px;
          font-weight: 400;
          color: var(--p-ink);
          letter-spacing: -0.02em;
          text-align: right;
          font-feature-settings: 'tnum';
        }
        .pdf-trig-pct .pct {
          font-size: 9px; color: var(--p-graphite);
          margin-left: 1px;
        }
        .pdf-trig-lag {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.04em;
          color: var(--p-graphite);
          text-align: right;
        }

        /* === HEALTH (PATTERNS + SHIFT) === */
        .pdf-health-grid {
          display: grid;
          grid-template-columns: 1.45fr 1fr;
          gap: 20px;
          align-items: stretch;
        }
        .pdf-health-insights {
          display: flex; flex-direction: column; gap: 12px;
          padding-right: 18px;
          border-right: 1px solid var(--p-line);
        }
        .pdf-insight {
          padding: 8px 0;
          border-bottom: 1px solid var(--p-line-2);
        }
        .pdf-insight:last-child { border-bottom: none; padding-bottom: 0; }
        .pdf-insight-stat {
          display: flex; align-items: baseline; gap: 8px;
          font-family: 'Fraunces', serif;
          font-size: 13px;
          font-weight: 400;
          color: var(--p-ink);
          letter-spacing: -0.01em;
          line-height: 1.25;
          margin-bottom: 4px;
        }
        .pdf-insight-stat em {
          font-style: italic;
          font-family: 'Instrument Serif', serif;
          color: var(--p-peacock);
        }
        .pdf-insight-x {
          margin-left: auto;
          font-family: 'Fraunces', serif;
          font-weight: 400;
          font-size: 18px;
          letter-spacing: -0.03em;
          color: var(--p-ink);
          font-feature-settings: 'tnum';
        }

        .pdf-health-shift {
          display: flex; flex-direction: column; gap: 8px;
        }
        .pdf-shift-head {
          padding-bottom: 4px;
          border-bottom: 1px solid var(--p-line-2);
          margin-bottom: 4px;
        }
        .pdf-shift-row {
          display: grid;
          grid-template-columns: 50px 1fr;
          align-items: baseline;
          gap: 8px;
          padding: 5px 0;
        }
        .pdf-shift-val {
          font-family: 'Fraunces', serif;
          font-size: 13px;
          font-feature-settings: 'tnum';
          display: inline-flex; align-items: baseline; gap: 6px;
          justify-content: flex-end;
          text-align: right;
        }
        .pdf-shift-val em {
          font-style: normal;
          color: var(--p-graphite);
          font-size: 11px;
          font-weight: 300;
        }
        .pdf-shift-val strong {
          font-weight: 400;
          color: var(--p-ink);
          letter-spacing: -0.02em;
        }
        .pdf-shift-arr {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px;
          color: var(--p-graphite);
          opacity: 0.6;
          margin: 0 1px;
        }

        /* === FOOT === */
        .pdf-foot {
          margin-top: auto;
          padding-top: 12px;
          border-top: 1px solid var(--p-line);
          display: flex;
          justify-content: space-between; align-items: center; gap: 8px;
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.18em;
          color: var(--p-graphite);
        }
        .pdf-foot-mid { flex: 1; text-align: center; }

        /* === RESPONSIVE === */
        @media (max-width: 1100px) {
          .pdf-grid { grid-template-columns: 1fr; gap: 64px; }
          .pdf-paper { padding: 22px 22px 16px; font-size: 9.5px; }
          .pdf-mast-word { font-size: 26px; }
          .pdf-hero-num { font-size: 54px; }
          .pdf-suspect-name { font-size: 24px; }
          .pdf-suspect-num { font-size: 26px; }
          .pdf-suspect-num.small { font-size: 17px; }
          .pdf-trig { grid-template-columns: 18px 1.4fr 1fr 32px 28px; gap: 8px; }
          .pdf-wk-headers, .pdf-wk-row {
            grid-template-columns: 36px 70px 76px 1fr;
            gap: 10px;
          }
        }
        @media (max-width: 600px) {
          .pdf-paper { padding: 18px 16px 14px; font-size: 8.5px; }
          .pdf-mast { gap: 10px; }
          .pdf-mast-r > div em { min-width: 64px; }
          .pdf-mast-r { font-size: 6.5px; }
          .pdf-hero { gap: 14px; }
          .pdf-hero-num { font-size: 46px; }
          .pdf-hero-pct { font-size: 20px; vertical-align: 16px; }
          .pdf-suspect-row { gap: 8px; }
          .pdf-trig { grid-template-columns: 14px 1.3fr 0.8fr 26px 24px; gap: 6px; }

          /* Weekly bar: stack frequency + bristol on mobile, keep bar visible */
          .pdf-wk-headers { display: none; }
          .pdf-wk-row {
            grid-template-columns: 30px 1fr;
            gap: 6px 10px;
            grid-template-areas:
              "label freq"
              "label bristol"
              "load  load";
            row-gap: 4px;
          }
          .pdf-wk-label   { grid-area: label; align-self: start; padding-top: 4px; }
          .pdf-wk-freq    { grid-area: freq; }
          .pdf-wk-bristol { grid-area: bristol; align-self: start; margin-top: 2px; }
          .pdf-wk-load    { grid-area: load; grid-template-columns: 1fr 32px; }

          /* Health grid stacks */
          .pdf-health-grid {
            grid-template-columns: 1fr;
            gap: 14px;
          }
          .pdf-health-insights {
            border-right: none;
            border-bottom: 1px solid var(--p-line);
            padding-right: 0;
            padding-bottom: 12px;
          }
          .pdf-insight-stat { font-size: 12px; }
          .pdf-insight-x { font-size: 16px; }
        }
      `}</style>
    </section>
  );
}

// Compact teaser used on home — mini paper that links to /sample-report
function PdfTeaser() {
  const ref = useRefA(null);
  const [vis, setVis] = useStateA(false);

  useEffectA(() => {
    const obs = new IntersectionObserver(([e]) => {
      if (e.isIntersecting) setVis(true);
    }, { threshold: 0.18 });
    if (ref.current) obs.observe(ref.current);
    return () => obs.disconnect();
  }, []);

  return (
    <section id="report" className="sec teaser-sec" ref={ref}>
      <div className="container teaser-grid">
        <div className="teaser-text" data-reveal>
          <span className="eyebrow"><span className="num">05</span><span className="dot" /> Doctor-Ready Export</span>
          <h2 className="serif teaser-title">
            Walk in with <em className="serif-it">evidence.</em><br />
            Walk out with <em className="serif-it">answers.</em>
          </h2>
          <p className="teaser-sub">One page. Six weeks. The conversation finally has facts.</p>
          <a className="btn btn-ghost" href="/sample-report" style={{marginTop: 32}}>
            <span>See full sample report</span>
            <span className="arr">→</span>
          </a>
        </div>

        <a href="/sample-report" className={`teaser-card ${vis ? 'in' : ''}`} aria-label="See full sample report">
          <div className="teaser-card-bg" />
          <div className="teaser-paper">
            <div className="teaser-mast">
              <div>
                <div className="teaser-eye"><span className="teaser-pulse" />6-WEEK CLINICAL REPORT</div>
                <div className="teaser-word">Gutsy<span className="teaser-mid">·</span></div>
              </div>
              <div className="teaser-stamp">
                <div className="teaser-mono pdf-fade">PROTOCOL</div>
                <div className="teaser-stamp-num">06/06</div>
              </div>
            </div>

            <svg className="teaser-wave" viewBox="0 0 240 14" preserveAspectRatio="none">
              <path d="M0,9 C30,9 42,3 90,5 C135,6.5 158,11 195,10 C218,9.5 232,8.5 240,9"
                    fill="none" stroke="#0F2818" strokeWidth="0.9" strokeLinecap="round"/>
            </svg>

            {/* SUSPECT PLATE — the wow moment */}
            <div className="teaser-suspect">
              <div className="teaser-suspect-aurora" />
              <div className="teaser-suspect-grain" />
              <div className="teaser-suspect-content">
                <div className="teaser-suspect-head">
                  <span className="teaser-suspect-pulse" />
                  <span>#1 SUSPECT · CONFIRMED</span>
                </div>
                <div className="teaser-suspect-name">Oat Milk</div>
                <div className="teaser-suspect-class">LOW FODMAP · PERSONAL SENSITIVITY</div>
                <div className="teaser-suspect-tagline">The trigger your <em>dietitian missed.</em></div>
                <div className="teaser-suspect-stats">
                  <div className="teaser-suspect-stat">
                    <div className="teaser-suspect-num">94<span className="of">%</span></div>
                    <div className="teaser-suspect-lbl">HIT RATE</div>
                  </div>
                  <div className="teaser-suspect-divider" />
                  <div className="teaser-suspect-stat">
                    <div className="teaser-suspect-num small">31<span className="of">/33</span></div>
                    <div className="teaser-suspect-lbl">EXPOSURES</div>
                  </div>
                  <div className="teaser-suspect-divider" />
                  <div className="teaser-suspect-stat">
                    <div className="teaser-suspect-num small">+24h</div>
                    <div className="teaser-suspect-lbl">ONSET</div>
                  </div>
                </div>
              </div>
            </div>

            {/* TOP TRIGGERS PREVIEW */}
            <div className="teaser-trigs-head">
              <span className="teaser-mono">TOP CONFIRMED TRIGGERS</span>
              <span className="teaser-mono pdf-fade">RANKED BY EVIDENCE</span>
            </div>
            <div className="teaser-rows">
              <div className="teaser-row">
                <span className="teaser-row-rank">02</span>
                <div className="teaser-row-name">
                  <span>Soy Sauce</span>
                  <span className="teaser-row-class">FRUCTAN</span>
                </div>
                <span className="teaser-row-bar">
                  <span className="teaser-row-fill" style={{width: vis ? '92%' : '0%', transitionDelay: '0.45s'}} />
                </span>
                <span className="teaser-row-pct">92<span>%</span></span>
              </div>
              <div className="teaser-row">
                <span className="teaser-row-rank">03</span>
                <div className="teaser-row-name">
                  <span>Apples</span>
                  <span className="teaser-row-class">POLYOL · sorbitol</span>
                </div>
                <span className="teaser-row-bar">
                  <span className="teaser-row-fill" style={{width: vis ? '84%' : '0%', transitionDelay: '0.55s'}} />
                </span>
                <span className="teaser-row-pct">84<span>%</span></span>
              </div>
              <div className="teaser-row faded">
                <span className="teaser-row-rank">04</span>
                <div className="teaser-row-name">
                  <span>Garlic</span>
                  <span className="teaser-row-class">FRUCTAN</span>
                </div>
                <span className="teaser-row-bar">
                  <span className="teaser-row-fill" style={{width: vis ? '78%' : '0%', transitionDelay: '0.65s'}} />
                </span>
                <span className="teaser-row-pct">78<span>%</span></span>
              </div>
            </div>

            <div className="teaser-fade" />
            <div className="teaser-cta">
              <span>See full sample report</span>
              <span className="arr">→</span>
            </div>
          </div>
        </a>
      </div>

      <style>{`
        .teaser-sec {
          background: var(--bg-2);
          padding: 140px 0;
          border-top: 1px solid var(--line);
        }
        .teaser-grid {
          display: grid;
          grid-template-columns: 1fr 1fr;
          gap: 80px;
          align-items: center;
        }
        .teaser-text { max-width: 520px; }
        .teaser-title {
          margin-top: 28px;
          font-size: clamp(40px, 5.5vw, 88px);
          line-height: 1;
          letter-spacing: -0.04em;
          font-weight: 300;
        }
        .teaser-title em { color: var(--accent); }
        [data-theme="dark"] .teaser-title em { color: var(--accent-glow); }
        .teaser-sub {
          margin-top: 24px;
          font-size: 19px;
          color: var(--ink-2);
          max-width: 460px;
        }

        .teaser-card {
          position: relative;
          display: block;
          text-decoration: none;
          opacity: 0;
          transform: translateY(40px) rotate(-1.4deg);
          transition: all 1.2s cubic-bezier(0.2,0.8,0.2,1);
          cursor: pointer;
        }
        .teaser-card.in { opacity: 1; transform: translateY(0) rotate(-1deg); }
        .teaser-card:hover { transform: translateY(-6px) rotate(0deg); transition-duration: 0.7s; }

        .teaser-card-bg {
          position: absolute; inset: -30px; z-index: 0;
          background:
            radial-gradient(ellipse at 30% 30%, rgba(15,40,24,0.18), transparent 60%),
            radial-gradient(ellipse at 70% 80%, rgba(14,59,92,0.12), transparent 60%);
          filter: blur(50px);
        }

        .teaser-paper {
          position: relative; z-index: 1;
          background:
            radial-gradient(ellipse at 0% 0%, rgba(232,224,208,0.55), transparent 55%),
            radial-gradient(ellipse at 100% 100%, rgba(232,224,208,0.4), transparent 60%),
            #FBF8EC;
          color: #0F2818;
          padding: 28px 30px 0;
          box-shadow:
            0 1px 2px rgba(0,0,0,0.08),
            0 30px 60px -20px rgba(0,0,0,0.22),
            0 60px 120px -30px rgba(15,40,24,0.18);
          font-family: 'Inter Tight', system-ui, sans-serif;
          font-size: 10px;
          overflow: hidden;
        }
        .teaser-paper::before {
          content: "";
          position: absolute; inset: 0;
          background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.4 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
          opacity: 0.05; mix-blend-mode: multiply; pointer-events: none;
          z-index: 1;
        }
        .teaser-paper > * { position: relative; z-index: 2; }

        .teaser-mono {
          font-family: 'JetBrains Mono', monospace;
          text-transform: uppercase;
          letter-spacing: 0.18em;
          font-size: 8px;
          font-weight: 500;
          color: #0F2818;
        }
        .teaser-paper .pdf-fade { color: #6B5D52; opacity: 0.7; }

        .teaser-mast {
          display: flex; justify-content: space-between; align-items: flex-start;
        }
        .teaser-eye {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.22em; text-transform: uppercase;
          color: #0F2818;
          display: inline-flex; align-items: center; gap: 6px;
          margin-bottom: 8px;
        }
        .teaser-pulse {
          width: 5px; height: 5px; border-radius: 50%;
          background: #0F2818;
          box-shadow: 0 0 8px rgba(15,40,24,0.4);
          animation: pdfPulse 2.4s ease-in-out infinite;
          display: inline-block;
        }
        .teaser-word {
          font-family: 'Fraunces', 'Instrument Serif', serif;
          font-weight: 300;
          font-size: 30px;
          letter-spacing: -0.04em;
          line-height: 0.9;
          color: #0F2818;
        }
        .teaser-mid {
          color: #6B5D52;
          margin-left: 6px;
          font-weight: 200;
        }
        .teaser-stamp { text-align: right; }
        .teaser-stamp-num {
          font-family: 'Fraunces', serif;
          font-weight: 300;
          font-size: 18px;
          letter-spacing: -0.03em;
          margin-top: 2px;
          color: #0F2818;
        }
        .teaser-wave {
          width: 240px; height: 12px; display: block;
          margin-top: 6px;
          stroke-dasharray: 320;
          stroke-dashoffset: 320;
          opacity: 0;
        }
        .teaser-card.in .teaser-wave {
          animation: pdfWave 1.6s 0.35s cubic-bezier(0.2,0.8,0.2,1) forwards;
        }

        /* === TEASER SUSPECT PLATE (dark aurora) === */
        .teaser-suspect {
          position: relative;
          margin-top: 16px;
          padding: 18px 20px 16px;
          border-radius: 14px;
          overflow: hidden;
          background:
            linear-gradient(135deg, #0F2818 0%, #134029 45%, #0E3B5C 100%);
          color: #FBF8EC;
          isolation: isolate;
          box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.08),
            0 8px 24px -8px rgba(15,40,24,0.4);
        }
        .teaser-suspect-aurora {
          position: absolute; inset: -40%;
          background:
            radial-gradient(circle at 22% 30%, rgba(74,139,92,0.55), transparent 50%),
            radial-gradient(circle at 80% 75%, rgba(14,59,92,0.55), transparent 55%);
          filter: blur(28px);
          z-index: 0;
        }
        .teaser-suspect-grain {
          position: absolute; inset: 0;
          background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
          opacity: 0.06;
          mix-blend-mode: screen;
          pointer-events: none;
          z-index: 1;
        }
        .teaser-suspect-content { position: relative; z-index: 2; }
        .teaser-suspect-head {
          display: inline-flex; align-items: center; gap: 6px;
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.22em;
          color: rgba(251,248,236,0.72);
          margin-bottom: 8px;
        }
        .teaser-suspect-pulse {
          width: 5px; height: 5px; border-radius: 50%;
          background: #6BA27E;
          box-shadow: 0 0 10px rgba(107,162,126,0.85);
          animation: pdfPulse 2s ease-in-out infinite;
        }
        .teaser-suspect-name {
          font-family: 'Fraunces', serif;
          font-weight: 300;
          font-size: 30px;
          letter-spacing: -0.04em;
          line-height: 0.9;
          background: linear-gradient(135deg, #FBF8EC 0%, rgba(251,248,236,0.78) 100%);
          -webkit-background-clip: text;
          background-clip: text;
          -webkit-text-fill-color: transparent;
        }
        .teaser-suspect-class {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.22em;
          color: rgba(251,248,236,0.6);
          margin-top: 4px;
        }
        .teaser-suspect-tagline {
          font-family: 'Fraunces', serif;
          font-style: italic;
          font-size: 12px;
          letter-spacing: -0.01em;
          color: rgba(251,248,236,0.85);
          margin-top: 6px;
          margin-bottom: 14px;
        }
        .teaser-suspect-tagline em {
          font-style: italic;
          color: #c9e8d3;
        }
        .teaser-suspect-stats {
          display: flex; align-items: stretch; gap: 12px;
          padding-top: 10px;
          border-top: 1px solid rgba(251,248,236,0.12);
        }
        .teaser-suspect-stat { flex: 1; min-width: 0; }
        .teaser-suspect-num {
          font-family: 'Fraunces', serif;
          font-weight: 300;
          font-size: 28px;
          letter-spacing: -0.04em;
          line-height: 1;
          background: linear-gradient(135deg, #FBF8EC 0%, rgba(168,217,185,0.85) 100%);
          -webkit-background-clip: text;
          background-clip: text;
          -webkit-text-fill-color: transparent;
          font-feature-settings: 'tnum';
        }
        .teaser-suspect-num.small { font-size: 18px; }
        .teaser-suspect-num .of {
          font-size: 12px;
          color: rgba(251,248,236,0.55);
          margin-left: 2px;
          -webkit-text-fill-color: rgba(251,248,236,0.55);
          background: none;
        }
        .teaser-suspect-num.small .of { font-size: 11px; }
        .teaser-suspect-lbl {
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.22em;
          color: rgba(251,248,236,0.55);
          margin-top: 4px;
        }
        .teaser-suspect-divider {
          width: 1px; background: rgba(251,248,236,0.12);
          flex: 0 0 1px;
        }

        /* === TEASER TRIGGERS LIST === */
        .teaser-trigs-head {
          display: flex; justify-content: space-between; align-items: center;
          padding: 18px 0 8px;
          margin-top: 4px;
          border-bottom: 1px solid rgba(15,40,24,0.12);
        }
        .teaser-rows {
          padding: 4px 0 28px;
          display: flex; flex-direction: column;
        }
        .teaser-row {
          display: grid;
          grid-template-columns: 22px 1.4fr 1fr 38px;
          gap: 10px;
          align-items: center;
          padding: 9px 0;
          border-bottom: 1px solid rgba(15,40,24,0.06);
        }
        .teaser-row:last-child { border-bottom: none; }
        .teaser-row.faded { opacity: 0.45; }
        .teaser-row-rank {
          font-family: 'JetBrains Mono', monospace;
          font-size: 8px; letter-spacing: 0.18em;
          color: #6B5D52; opacity: 0.7;
        }
        .teaser-row-name {
          display: flex; flex-direction: column; gap: 1px;
        }
        .teaser-row-name > span:first-child {
          font-family: 'Fraunces', serif;
          font-size: 13px;
          font-weight: 400;
          color: #0F2818;
          letter-spacing: -0.01em;
        }
        .teaser-row-class {
          font-family: 'JetBrains Mono', monospace;
          font-size: 7px; letter-spacing: 0.18em;
          color: #6B5D52;
          opacity: 0.7;
          text-transform: uppercase;
        }
        .teaser-row-bar {
          height: 4px;
          background: rgba(15,40,24,0.08);
          border-radius: 100px;
          position: relative;
          overflow: hidden;
        }
        .teaser-row-fill {
          position: absolute; left: 0; top: 0; bottom: 0;
          width: 0;
          background: linear-gradient(90deg, #0F2818 0%, #0E3B5C 100%);
          border-radius: 100px;
          transition: width 1.4s cubic-bezier(0.2,0.8,0.2,1);
        }
        .teaser-row-pct {
          font-family: 'Fraunces', serif;
          font-size: 14px;
          font-weight: 400;
          color: #0F2818;
          text-align: right;
          font-feature-settings: 'tnum';
        }
        .teaser-row-pct span {
          font-size: 9px; color: #6B5D52;
          margin-left: 1px;
        }

        .teaser-fade {
          position: absolute;
          left: 0; right: 0; bottom: 56px;
          height: 80px;
          background: linear-gradient(to bottom, rgba(251,248,236,0) 0%, #FBF8EC 75%);
          pointer-events: none;
          z-index: 3;
        }
        .teaser-cta {
          position: relative;
          margin: 0 -30px 0;
          padding: 16px 30px;
          background: #0F2818;
          color: #FBF8EC;
          font-family: 'JetBrains Mono', monospace;
          text-transform: uppercase;
          letter-spacing: 0.18em;
          font-size: 11px;
          font-weight: 500;
          display: flex; justify-content: space-between; align-items: center;
          z-index: 4;
        }
        .teaser-cta .arr { transition: transform 0.4s; }
        .teaser-card:hover .teaser-cta .arr { transform: translateX(4px); }

        @media (max-width: 1100px) {
          .teaser-grid { grid-template-columns: 1fr; gap: 56px; }
          .teaser-paper { padding: 24px 22px 0; }
          .teaser-cta { margin: 0 -22px 0; padding: 14px 22px; }
        }
        @media (max-width: 600px) {
          .teaser-sec { padding: 100px 0; }
          .teaser-paper { padding: 20px 18px 0; }
          .teaser-suspect { padding: 16px 16px 14px; }
          .teaser-suspect-name { font-size: 26px; }
          .teaser-suspect-num { font-size: 24px; }
          .teaser-suspect-num.small { font-size: 16px; }
          .teaser-suspect-stats { gap: 8px; }
          .teaser-row { grid-template-columns: 18px 1.3fr 1fr 32px; gap: 8px; }
          .teaser-cta { margin: 0 -18px 0; padding: 12px 18px; font-size: 10px; }
        }
      `}</style>
    </section>
  );
}

window.AppCarousel = AppCarousel;
window.Protocol = Protocol;
window.PdfReveal = PdfReveal;
window.PdfTeaser = PdfTeaser;
