// Intellegio landing page — three directions, switchable via Tweaks.
//
//   A · Surgical    — keep the cream, drop the italic-coloured accent word.
//                     Emphasis lives in underline rules + a masthead bar.
//   B · Cool paper  — slate-tinted off-white, oxblood accent. No coloured
//                     italic anywhere. Reads as research firm, not AI startup.
//   C · Newsprint   — Playfair Display masthead, drop cap on the lede,
//                     ruled column grid, vol/no dateline. Boldest break.
//
// Variants share the same component tree; they only swap tokens + a handful
// of structural flags (`kickerStyle`, `emphMode`, `cardRadius`, etc.).

// ── Variant tokens ──────────────────────────────────────────────────────────
const variants = {
  A: {
    name: 'A · Surgical',
    bg: '#f6f4ef',
    paper: '#fbfaf6',
    paper2: '#efebe0',
    ink: '#1a1d23',
    ink2: '#4a4f5a',
    ink3: '#8a8f9a',
    rule: '#cfcabd',
    ruleSoft: '#e7e3d8',
    accent: '#1a1d23',          // no second colour at all
    accentSoft: '#e5e1d3',
    secondInk: '#1d3f7a',       // reserved for thin rule marks only
    amber: '#8a5a1f',
    serif: '"Source Serif 4", Georgia, serif',
    sans: '"Geist", "Inter", system-ui, sans-serif',
    mono: '"Geist Mono", ui-monospace, monospace',
    display: '"Source Serif 4", Georgia, serif',
    displayWeight: 500,
    displayTracking: -2.5,
    emphMode: 'underline',      // emphasise the hero word with a rule under it
    kickerStyle: 'mastheadBar',
    cardRadius: 4,
    pillRadius: 999,
    dropCap: false,
    columnRules: false,
  },
  B: {
    name: 'B · Cool paper',
    bg: '#ecedeb',
    paper: '#f4f5f2',
    paper2: '#dfe0dc',
    ink: '#1c1e22',
    ink2: '#494c52',
    ink3: '#878a8f',
    rule: '#c4c6c1',
    ruleSoft: '#dadcd6',
    accent: '#1d3f7a',          // restored ink-blue — used for marks only, never coloured italic
    accentSoft: '#dde3ef',
    secondInk: '#1d3f7a',
    amber: '#8a5a1f',
    serif: '"Source Serif 4", Georgia, serif',
    sans: '"Geist", "Inter", system-ui, sans-serif',
    mono: '"Geist Mono", ui-monospace, monospace',
    display: '"Source Serif 4", Georgia, serif',
    displayWeight: 600,
    displayTracking: -2.2,
    emphMode: 'none',           // no inline emphasis on the hero word — line break carries the rhythm
    kickerStyle: 'dateline',
    cardRadius: 2,
    pillRadius: 4,
    dropCap: false,
    columnRules: false,
  },
  C: {
    name: 'C · Newsprint',
    bg: '#efeadb',
    paper: '#f6f1e1',
    paper2: '#e5dfc7',
    ink: '#16140e',
    ink2: '#46402f',
    ink3: '#8a8472',
    rule: '#2a2519',            // heavy — broadsheet rules
    ruleSoft: '#c4bea8',
    accent: '#16140e',          // accent IS the ink
    accentSoft: '#dfd7bd',
    secondInk: '#16140e',
    amber: '#8a5a1f',
    serif: '"Source Serif 4", Georgia, serif',
    sans: '"Geist", "Inter", system-ui, sans-serif',
    mono: '"Geist Mono", ui-monospace, monospace',
    display: '"Playfair Display", "Bodoni 72", Georgia, serif',
    displayWeight: 900,
    displayTracking: -1.8,
    emphMode: 'none',           // no inline emphasis on the hero word
    kickerStyle: 'volDateline',
    cardRadius: 0,
    pillRadius: 0,
    dropCap: true,
    columnRules: true,
  },
};

// ── Inject hover/transition styles once ─────────────────────────────────────
if (typeof document !== 'undefined' && !document.getElementById('sb-landing-styles')) {
  const s = document.createElement('style');
  s.id = 'sb-landing-styles';
  s.textContent = `
    .sb-btn { transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease; }
    .sb-btn:hover { transform: translateY(-1px); }
    .sb-btn:active { transform: translateY(0); }
    .sb-btn-primary:hover { filter: brightness(1.15); }
    .sb-btn-paper:hover { filter: brightness(.96); }
    .sb-btn-ghost:hover { background: rgba(26,29,35,.06); }
    .sb-link { transition: color .12s ease; cursor: pointer; }
    .sb-archive-card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; cursor: pointer; }
    .sb-archive-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -16px rgba(20,25,40,.18); }
    .sb-preview-btn { transition: background .12s ease, color .12s ease; }
    .sb-nav-link { transition: color .12s ease; cursor: pointer; }
    .sb-faq-item { cursor: default; }
    .sb-dropcap::first-letter {
      font-family: "Playfair Display", "Bodoni 72", Georgia, serif;
      font-size: 5.6em; line-height: .82; float: left;
      padding: .04em .12em 0 0; font-weight: 900;
    }
  `;
  document.head.appendChild(s);
}

// ── Brand mark ──────────────────────────────────────────────────────────────
// In newsprint mode the wordmark gets a more idiosyncratic display face so it
// reads like a nameplate rather than a SaaS logotype.
function SBMark({ size = 30, ink, label = true, mark = false, variant }) {
  const v = variant || variants.A;
  const inkColor = ink || v.ink;
  const wordmarkFace = v.kickerStyle === 'volDateline'
    ? "'Playfair Display', 'Bodoni 72', Georgia, serif"
    : "'Libre Baskerville', 'Baskerville', 'Times New Roman', serif";
  const wordmarkWeight = v.kickerStyle === 'volDateline' ? 900 : 400;

  const Wordmark = () => (
    <span style={{
      fontFamily: wordmarkFace,
      fontSize: size * 0.78,
      letterSpacing: v.kickerStyle === 'volDateline' ? '-0.04em' : '-0.018em',
      color: inkColor,
      lineHeight: 1,
      fontWeight: wordmarkWeight,
      display: 'inline-block',
      whiteSpace: 'nowrap',
      fontStyle: v.kickerStyle === 'volDateline' ? 'italic' : 'normal',
    }}>Intellegio</span>
  );
  const Square = () => (
    <span style={{
      width: size, height: size,
      background: v.ink,
      borderRadius: v.cardRadius === 0 ? 0 : size * 0.117,
      display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
      flexShrink: 0,
    }}>
      <svg width={size} height={size} viewBox="0 0 240 240" style={{ display: 'block' }}>
        <text x="92" y="145" fontFamily="'Libre Baskerville', 'Baskerville', 'Times New Roman', serif" fontSize="108" fontStyle="italic" fill={v.bg}>I</text>
        <text x="150" y="82" fontFamily="'Libre Baskerville', 'Baskerville', 'Times New Roman', serif" fontSize="32" fill={v.secondInk}>º</text>
      </svg>
    </span>
  );
  if (!label) return <Square />;
  if (!mark) return <Wordmark />;
  return (
    <span style={{ display: 'inline-flex', alignItems: 'center', gap: size * 0.4 }}>
      <Square /><Wordmark />
    </span>
  );
}

// ── Section kicker — varies by direction ────────────────────────────────────
// All three avoid the "small caps + accent colour" pattern that started this
// whole conversation. A uses mono in ink, B uses mono in ink with a leading
// rule, C uses bracketed section numbers like a broadsheet.
function SectionKicker({ v, children, n }) {
  if (v.kickerStyle === 'volDateline') {
    return (
      <div style={{ display: 'inline-flex', alignItems: 'center', gap: 12, marginBottom: 20, fontFamily: v.mono, fontSize: 11, color: v.ink2, letterSpacing: 2, textTransform: 'uppercase' }}>
        <span style={{ width: 24, height: 1, background: v.ink }} />
        {n && <span>§ {n}</span>}
        <span>{children}</span>
      </div>
    );
  }
  if (v.kickerStyle === 'dateline') {
    return (
      <div style={{ display: 'inline-flex', alignItems: 'center', gap: 10, marginBottom: 18, fontFamily: v.mono, fontSize: 11.5, color: v.accent, letterSpacing: 2, textTransform: 'uppercase', fontWeight: 600 }}>
        <span style={{ width: 14, height: 6, background: v.accent }} />
        <span>{children}</span>
      </div>
    );
  }
  // mastheadBar (A)
  return (
    <div style={{ fontFamily: v.mono, fontSize: 11.5, color: v.ink2, letterSpacing: 2.2, textTransform: 'uppercase', marginBottom: 18, fontWeight: 500 }}>
      {n && <span style={{ color: v.ink3 }}>{n} &nbsp;/&nbsp; </span>}{children}
    </div>
  );
}

// ── Hero kicker — even more variant-specific ───────────────────────────────
function HeroKicker({ v }) {
  const items = ['Issue Nº 14', 'May 2026', 'Intelligence brief'];
  if (v.kickerStyle === 'volDateline') {
    return (
      <div style={{
        display: 'inline-flex', alignItems: 'center', gap: 18,
        marginBottom: 28, paddingTop: 10, paddingBottom: 10,
        borderTop: `3px double ${v.ink}`,
        borderBottom: `3px double ${v.ink}`,
        paddingLeft: 22, paddingRight: 22,
        fontFamily: v.mono, fontSize: 11, color: v.ink, letterSpacing: 2.4, textTransform: 'uppercase', fontWeight: 600,
      }}>
        <span>Vol. I</span><span style={{ width: 4, height: 4, background: v.ink, borderRadius: '50%' }} />
        <span>Nº 14</span><span style={{ width: 4, height: 4, background: v.ink, borderRadius: '50%' }} />
        <span>May 2026</span><span style={{ width: 4, height: 4, background: v.ink, borderRadius: '50%' }} />
        <span>First Edition</span>
      </div>
    );
  }
  if (v.kickerStyle === 'dateline') {
    return (
      <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginBottom: 28, fontFamily: v.mono, fontSize: 11.5, color: v.ink2, letterSpacing: 2, textTransform: 'uppercase' }}>
        <span style={{ width: 24, height: 1, background: v.accent }} />
        {items.map((it, i) => (
          <React.Fragment key={it}>
            <span>{it}</span>
            {i < items.length - 1 && <span style={{ color: v.ink3 }}>—</span>}
          </React.Fragment>
        ))}
      </div>
    );
  }
  // mastheadBar (A)
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginBottom: 30, fontFamily: v.mono, fontSize: 11.5, color: v.ink2, letterSpacing: 2, textTransform: 'uppercase' }}>
      {items.map((it, i) => (
        <React.Fragment key={it}>
          <span style={{ color: i === 0 ? v.ink : v.ink2, fontWeight: i === 0 ? 600 : 500 }}>{it}</span>
          {i < items.length - 1 && <span style={{ color: v.ink3 }}>│</span>}
        </React.Fragment>
      ))}
    </div>
  );
}

// ── Hero headline — the most-recognisable design move lives here ───────────
// Variant A:   "before you ⎯move⎯ in it"   underline rule, no colour
// Variant B:   "before you  move  in it"   weight contrast 700, no colour
// Variant C:   "before you move in it"     no inline emphasis; lede gets a drop cap
function HeroHeadline({ v }) {
  const lead = 'Read the conversation';
  const tail = (
    <>before you{' '}
      {v.emphMode === 'underline' && (
        <span style={{ borderBottom: `5px solid ${v.ink}`, paddingBottom: 2 }}>enter</span>
      )}
      {v.emphMode === 'weight' && (
        <span style={{ fontWeight: 800 }}>enter</span>
      )}
      {v.emphMode === 'none' && (<span>enter</span>)}
      {' '}it.</>
  );
  return (
    <h1 style={{
      fontFamily: v.display,
      fontSize: v.kickerStyle === 'volDateline' ? 96 : 88,
      lineHeight: v.kickerStyle === 'volDateline' ? 0.95 : 0.98,
      letterSpacing: v.displayTracking,
      margin: 0,
      fontWeight: v.displayWeight,
      textWrap: 'balance',
      color: v.ink,
    }}>
      {lead}<br />{tail}
    </h1>
  );
}

// ── Mini archive cover ──────────────────────────────────────────────────────
function MiniCover({ v, no, topic, audience }) {
  return (
    <div style={{ flex: '0 0 auto', width: 150, height: 200, background: v.paper, border: `1px solid ${v.rule}`, padding: '18px 16px 14px', position: 'relative', boxShadow: '0 6px 18px -10px rgba(20,25,40,.15)', borderRadius: v.cardRadius }}>
      <div style={{ fontFamily: v.mono, fontSize: 9.5, letterSpacing: 1.4, color: v.ink3, textTransform: 'uppercase' }}>Nº {no}</div>
      <div style={{ fontFamily: v.display, fontSize: 18, lineHeight: 1.05, letterSpacing: -0.3, marginTop: 16, fontWeight: v.displayWeight === 900 ? 700 : 500, textWrap: 'balance', color: v.ink }}>{topic}</div>
      <div style={{ width: 24, height: 1.5, background: v.ink, marginTop: 14 }} />
      <div style={{ position: 'absolute', bottom: 14, left: 16, right: 16, fontFamily: v.mono, fontSize: 9, color: v.ink3, letterSpacing: 0.5, textTransform: 'uppercase' }}>{audience}</div>
    </div>
  );
}

// ────────────────────────────────────────────────────────────────────────────
function Landing({ onStart, variantKey = 'A' }) {
  const v = variants[variantKey] || variants.A;
  // Maintain backward compat for chat.jsx which reads window.dossierTokens.
  window.dossierTokens = { ...v, blue: v.secondInk, blueSoft: v.accentSoft };

  const open = (e) => { e && e.preventDefault && e.preventDefault(); onStart && onStart(); };

  return (
    <div style={{ width: '100%', background: v.bg, color: v.ink, fontFamily: v.sans, fontSize: 16, lineHeight: 1.55 }}>

      {/* ── Nav ─────────────────────────────────────────────────────── */}
      <header style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '28px 64px', maxWidth: 1440, margin: '0 auto', borderBottom: v.kickerStyle === 'volDateline' ? `1px solid ${v.rule}` : 'none' }}>
        <SBMark variant={v} />
        <nav style={{ display: 'flex', gap: 36, fontSize: 14.5, color: v.ink2 }}>
          <a className="sb-nav-link" style={{ color: 'inherit', textDecoration: 'none' }}>Product</a>
          <a className="sb-nav-link" style={{ color: 'inherit', textDecoration: 'none' }}>How it works</a>
          <a className="sb-nav-link" style={{ color: 'inherit', textDecoration: 'none' }}>Pricing</a>
          <a className="sb-nav-link" style={{ color: 'inherit', textDecoration: 'none' }}>Sample briefs</a>
        </nav>
        <div style={{ display: 'flex', alignItems: 'center', gap: 20 }}>
          <button className="sb-btn sb-btn-primary" onClick={open} style={{ background: v.ink, color: v.bg, border: 'none', borderRadius: v.pillRadius, padding: '10px 18px', fontFamily: 'inherit', fontSize: 14, fontWeight: 500, cursor: 'pointer' }}>Start a brief →</button>
        </div>
      </header>

      {/* ── Hero ──────────────────────────────────────────────────── */}
      <section style={{ padding: '72px 64px 120px', maxWidth: 1440, margin: '0 auto' }}>
        <div style={{ display: 'grid', gridTemplateColumns: '1.3fr 1fr', gap: 80, alignItems: 'center' }}>
          <div>
            <HeroKicker v={v} />
            <HeroHeadline v={v} />
            <p className={v.dropCap ? 'sb-dropcap' : ''} style={{ fontFamily: v.serif, fontSize: 22, color: v.ink2, marginTop: 32, lineHeight: 1.55, maxWidth: 560, fontWeight: 400 }}>
              Intellegio reads the most-engaged X conversation on your topic — typically the top 100 tweets from the past 30 days — and synthesises them into a brief for the decision you're making this week.
            </p>
            <div style={{ display: 'flex', gap: 14, marginTop: 44, alignItems: 'center' }}>
              <button className="sb-btn sb-btn-primary" onClick={open} style={{ background: v.ink, color: v.bg, border: 'none', borderRadius: v.pillRadius, padding: '15px 24px', fontFamily: 'inherit', fontSize: 15, fontWeight: 500, cursor: 'pointer' }}>Start a brief  →</button>
              <button className="sb-btn sb-btn-ghost" style={{ background: 'transparent', color: v.ink, border: 'none', padding: '15px 8px', borderRadius: v.pillRadius, fontFamily: 'inherit', fontSize: 15, fontWeight: 500, cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 8 }}>
                <span style={{ width: 28, height: 28, borderRadius: v.cardRadius === 0 ? 0 : '50%', border: `1px solid ${v.ink}`, display: 'grid', placeItems: 'center', fontSize: 10 }}>▶</span>
                See a sample brief
              </button>
            </div>
            <div style={{ marginTop: 44, paddingTop: 28, borderTop: `1px solid ${v.rule}`, display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24, maxWidth: 560, position: 'relative' }}>
              {v.columnRules && (
                <>
                  <div style={{ position: 'absolute', top: 28, bottom: 0, left: '33.33%', width: 1, background: v.ruleSoft }} />
                  <div style={{ position: 'absolute', top: 28, bottom: 0, left: '66.66%', width: 1, background: v.ruleSoft }} />
                </>
              )}
              {[
                ['From $9', 'No subscription, ever.'],
                ['24 hrs', 'Typical turnaround.'],
                ['Preview first', 'See the data volume before you pay.'],
              ].map(([k, val], i) => (
                <div key={k} style={{ paddingLeft: v.columnRules && i > 0 ? 18 : 0 }}>
                  <div style={{ fontFamily: v.display, fontSize: 22, fontWeight: v.displayWeight === 900 ? 700 : 500, letterSpacing: -0.3 }}>{k}</div>
                  <div style={{ fontSize: 13, color: v.ink3, marginTop: 4, lineHeight: 1.4 }}>{val}</div>
                </div>
              ))}
            </div>
          </div>

          {/* Brief cover mock */}
          <div style={{ position: 'relative', height: 560 }}>
            <div style={{ position: 'absolute', top: 32, right: 28, width: 320, height: 460, background: v.paper, border: `1px solid ${v.rule}`, boxShadow: '0 30px 80px -30px rgba(20,25,40,.25), 0 2px 6px rgba(20,25,40,.06)', transform: 'rotate(2.5deg)', padding: '36px 32px', borderRadius: v.cardRadius }}>
              <div style={{ fontSize: 11, letterSpacing: 2, color: v.ink3, textTransform: 'uppercase', fontFamily: v.mono }}>Brief Nº 02615</div>
              <div style={{ fontFamily: v.display, fontSize: 32, lineHeight: 1.05, letterSpacing: -0.8, marginTop: 32, fontWeight: v.displayWeight === 900 ? 700 : 500 }}>
                AI Agents for<br />Small Business
              </div>
              <div style={{ width: 40, height: 2, background: v.ink, marginTop: 22 }} />
              <div style={{ fontSize: 13, color: v.ink2, marginTop: 22, lineHeight: 1.55, fontFamily: v.serif }}>
                A third of the corpus is spam. The real signal: narrow tasks work today, autonomous agents don't. One factory owner got 57% more throughput with a whiteboard and one agent.
              </div>
              <div style={{ position: 'absolute', bottom: 28, left: 32, right: 32, display: 'flex', justifyContent: 'space-between', fontSize: 11, color: v.ink3, fontFamily: v.mono }}>
                <span>30-day window</span>
                <span>100 top tweets</span>
                <span>May 2026</span>
              </div>
            </div>
            <div style={{ position: 'absolute', top: 64, right: 70, width: 320, height: 460, background: v.accentSoft, border: `1px solid ${v.rule}`, transform: 'rotate(-3deg)', zIndex: -1, borderRadius: v.cardRadius }} />
            <div style={{ position: 'absolute', top: 80, right: 105, width: 320, height: 460, background: v.bg, border: `1px solid ${v.rule}`, transform: 'rotate(-7deg)', zIndex: -2, borderRadius: v.cardRadius }} />
          </div>
        </div>
      </section>

      {/* ── Pull quote band ────────────────────────────────────────── */}
      <section style={{ borderTop: `1px solid ${v.rule}`, borderBottom: `1px solid ${v.rule}`, padding: '56px 64px', background: v.paper }}>
        <div style={{ display: 'grid', gridTemplateColumns: '160px 1fr 200px', gap: 48, alignItems: 'center', maxWidth: 1440, margin: '0 auto' }}>
          <div style={{ fontSize: 11, letterSpacing: 2, color: v.ink3, textTransform: 'uppercase', fontFamily: v.mono }}>The premise</div>
          <p style={{ fontFamily: v.display, fontSize: 26, lineHeight: 1.35, margin: 0, letterSpacing: -0.3, color: v.ink, fontWeight: v.displayWeight === 900 ? 500 : 400, textWrap: 'balance' }}>
            {v.kickerStyle === 'volDateline' && <span style={{ fontSize: 36, fontFamily: v.display, fontWeight: 900, marginRight: 4, lineHeight: 0 }}>“</span>}
            The real conversation on X used to require enterprise access at thousands of dollars a month.{' '}
            <em style={{ fontStyle: 'italic' }}>It shouldn't.</em>
            {' '}One brief, one topic, one fixed price.
          </p>
          <div style={{ fontSize: 12.5, color: v.ink3, lineHeight: 1.5, textAlign: 'right', fontFamily: v.mono }}>From the editor's note,<br />May 2026</div>
        </div>
      </section>

      {/* ── How it works ──────────────────────────────────────────── */}
      <section style={{ padding: '120px 64px', maxWidth: 1440, margin: '0 auto' }}>
        <div style={{ maxWidth: 720, marginBottom: 72 }}>
          <SectionKicker v={v} n="01">How it works</SectionKicker>
          <h2 style={{ fontFamily: v.display, fontSize: 54, lineHeight: 1.02, letterSpacing: -1.2, margin: 0, fontWeight: v.displayWeight === 900 ? 700 : 500, textWrap: 'balance' }}>
            The query is the product. You approve it before any work begins.
          </h2>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 32, position: 'relative' }}>
          {v.columnRules && [1, 2, 3].map(i => (
            <div key={i} style={{ position: 'absolute', top: 18, bottom: 0, left: `${i * 25}%`, width: 1, background: v.ruleSoft }} />
          ))}
          {window.STEPS.map((s, i) => (
            <div key={s.n} style={{ position: 'relative', paddingLeft: v.columnRules && i > 0 ? 20 : 0, paddingRight: v.columnRules && i < 3 ? 20 : 0 }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 24 }}>
                <span style={{ fontFamily: v.mono, fontSize: 11, color: v.ink2, letterSpacing: 1.6, textTransform: 'uppercase', fontWeight: 600 }}>Step {s.n}</span>
                <span style={{ flex: 1, height: 1, background: v.rule }} />
              </div>
              <div style={{ fontFamily: v.display, fontSize: 26, fontWeight: v.displayWeight === 900 ? 700 : 500, letterSpacing: -0.5, lineHeight: 1.15 }}>{s.title}</div>
              <p style={{ fontSize: 14.5, color: v.ink2, marginTop: 14, lineHeight: 1.6 }}>{s.body}</p>
              {i === 2 && (
                <div style={{ marginTop: 16, display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 11, padding: '5px 11px', background: v.kickerStyle === 'volDateline' ? v.ink : v.accentSoft, color: v.kickerStyle === 'volDateline' ? v.bg : v.accent, borderRadius: v.pillRadius, fontWeight: 600, letterSpacing: 0.6, textTransform: 'uppercase', fontFamily: v.mono }}>
                  ● Transparency checkpoint
                </div>
              )}
            </div>
          ))}
        </div>
      </section>

      {/* ── Pricing ─────────────────────────────────────────────────── */}
      <section style={{ padding: '20px 64px 120px', maxWidth: 1440, margin: '0 auto' }}>
        <div style={{ display: 'flex', alignItems: 'end', justifyContent: 'space-between', marginBottom: 56 }}>
          <div>
            <SectionKicker v={v} n="02">Pricing</SectionKicker>
            <h2 style={{ fontFamily: v.display, fontSize: 54, lineHeight: 1.02, letterSpacing: -1.2, margin: 0, fontWeight: v.displayWeight === 900 ? 700 : 500 }}>
              Pay per brief. Pick the depth.
            </h2>
          </div>
          <div style={{ fontSize: 14.5, color: v.ink2, maxWidth: 320, lineHeight: 1.5, textAlign: 'right' }}>
            No subscriptions, no seats. Three tiers for three kinds of questions.
          </div>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24 }}>
          {window.PRICING.map((p) => (
            <div key={p.tier} style={{
              padding: '40px 36px 36px',
              background: p.featured ? v.ink : v.paper,
              color: p.featured ? v.bg : v.ink,
              border: p.featured ? `1px solid ${v.ink}` : `1px solid ${v.rule}`,
              borderRadius: v.cardRadius,
              position: 'relative',
              minHeight: 480,
              display: 'flex',
              flexDirection: 'column',
            }}>
              {p.featured && (
                <div style={{ position: 'absolute', top: -11, left: 36, background: v.accent, color: v.bg, fontSize: 11, fontWeight: 600, letterSpacing: 1, textTransform: 'uppercase', padding: '4px 10px', borderRadius: v.cardRadius, fontFamily: v.mono }}>Most chosen</div>
              )}
              <div style={{ fontFamily: v.mono, fontSize: 11.5, letterSpacing: 2, textTransform: 'uppercase', color: p.featured ? 'rgba(255,255,255,.6)' : v.ink3, fontWeight: 600 }}>{p.tier}</div>
              <div style={{ display: 'flex', alignItems: 'baseline', gap: 6, marginTop: 22 }}>
                <span style={{ fontFamily: v.display, fontSize: 16, color: p.featured ? 'rgba(255,255,255,.6)' : v.ink3 }}>$</span>
                <span style={{ fontFamily: v.display, fontSize: 76, fontWeight: v.displayWeight === 900 ? 700 : 500, letterSpacing: -2.5, lineHeight: 1 }}>{p.price}</span>
              </div>
              <p style={{ fontFamily: v.serif, fontSize: 17, color: p.featured ? 'rgba(255,255,255,.75)' : v.ink2, marginTop: 20, lineHeight: 1.45, fontStyle: v.emphMode === 'underline' ? 'italic' : 'normal' }}>{p.blurb}</p>
              <div style={{ height: 1, background: p.featured ? 'rgba(255,255,255,.18)' : v.ruleSoft, margin: '24px 0' }} />
              <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'grid', gap: 14, fontSize: 14, lineHeight: 1.5, flex: 1, color: p.featured ? 'rgba(255,255,255,.85)' : v.ink2 }}>
                {p.bullets.map((b) => (
                  <li key={b} style={{ display: 'grid', gridTemplateColumns: '14px 1fr', gap: 12, alignItems: 'start' }}>
                    <svg width="14" height="14" viewBox="0 0 14 14" fill="none" style={{ marginTop: 4 }}>
                      <path d="M2.5 7l3 3 6-6.5" stroke={p.featured ? 'rgba(255,255,255,.7)' : v.ink} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
                    </svg>
                    <span>{b}</span>
                  </li>
                ))}
              </ul>
              <button onClick={open} className={`sb-btn ${p.featured ? 'sb-btn-paper' : 'sb-btn-ghost'}`} style={{
                marginTop: 28, width: '100%',
                background: p.featured ? v.bg : 'transparent',
                color: v.ink,
                border: p.featured ? 'none' : `1px solid ${v.ink}`,
                borderRadius: v.pillRadius, padding: '13px 18px',
                fontFamily: 'inherit', fontSize: 14.5, fontWeight: 500, cursor: 'pointer',
              }}>Start a {p.tier.toLowerCase()} brief →</button>
            </div>
          ))}
        </div>
      </section>

      {/* ── Sample briefs / archive ─────────────────────────────────── */}
      <section style={{ background: v.paper, borderTop: `1px solid ${v.rule}`, borderBottom: `1px solid ${v.rule}`, padding: '120px 64px' }}>
        <div style={{ maxWidth: 1440, margin: '0 auto' }}>
          <div style={{ display: 'flex', alignItems: 'end', justifyContent: 'space-between', marginBottom: 64 }}>
            <div>
              <SectionKicker v={v} n="03">From the archive</SectionKicker>
              <h2 style={{ fontFamily: v.display, fontSize: 54, lineHeight: 1.02, letterSpacing: -1.2, margin: 0, fontWeight: v.displayWeight === 900 ? 700 : 500 }}>
                Briefs we've already written.
              </h2>
            </div>
            <a className="sb-link" style={{ fontSize: 14.5, color: v.ink2 }}>Browse the full archive →</a>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 32 }}>
            {window.SAMPLES.map((s) => (
              <a key={s.no} href={s.pdf} target="_blank" rel="noopener" className="sb-archive-card" style={{ background: v.bg, border: `1px solid ${v.rule}`, padding: '32px', display: 'flex', gap: 28, position: 'relative', textDecoration: 'none', color: 'inherit', borderRadius: v.cardRadius }}>
                <MiniCover v={v} no={s.no} topic={s.topic} audience={s.audience} />
                <div style={{ flex: 1, display: 'flex', flexDirection: 'column', gap: 14, minWidth: 0 }}>
                  <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
                    <div style={{ fontFamily: v.mono, fontSize: 11.5, letterSpacing: 1.8, textTransform: 'uppercase', color: v.ink3, fontWeight: 600 }}>{s.angle}</div>
                    {s.thin ? (
                      <div style={{ fontSize: 11, color: v.amber, fontFamily: v.mono, letterSpacing: 0.4, textTransform: 'uppercase', fontWeight: 600 }}>Thin-corpus brief</div>
                    ) : (
                      <div style={{ fontSize: 11.5, color: v.ink3, fontFamily: v.mono }}>{s.window}</div>
                    )}
                  </div>
                  <h3 style={{ fontFamily: v.display, fontSize: 30, lineHeight: 1.08, letterSpacing: -0.6, margin: 0, fontWeight: v.displayWeight === 900 ? 700 : 500 }}>{s.topic}</h3>
                  <p style={{ fontFamily: v.serif, fontSize: 16, color: v.ink2, margin: 0, lineHeight: 1.5 }}>{s.teaser}</p>
                  <div style={{ marginTop: 'auto', display: 'flex', alignItems: 'center', justifyContent: 'space-between', paddingTop: 16, borderTop: `1px solid ${v.ruleSoft}` }}>
                    <div style={{ display: 'flex', gap: 24, fontSize: 12.5, color: v.ink3 }}>
                      <span><strong style={{ color: v.ink, fontFamily: v.display, fontSize: 17, fontWeight: v.displayWeight === 900 ? 700 : 500, marginRight: 6 }}>{s.corpus}</strong>top tweets</span>
                      <span><strong style={{ color: v.ink, fontFamily: v.display, fontSize: 17, fontWeight: v.displayWeight === 900 ? 700 : 500, marginRight: 6 }}>{s.window}</strong>window</span>
                    </div>
                    <span className="sb-preview-btn" style={{ background: 'transparent', color: v.ink, border: `1px solid ${v.ink}`, borderRadius: v.pillRadius, padding: '8px 14px', fontFamily: 'inherit', fontSize: 13, fontWeight: 500 }}>Preview brief →</span>
                  </div>
                </div>
              </a>
            ))}
          </div>
        </div>
      </section>

      {/* ── FAQ ─────────────────────────────────────────────────────── */}
      <section style={{ padding: '120px 64px', maxWidth: 1440, margin: '0 auto' }}>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.5fr', gap: 80 }}>
          <div>
            <SectionKicker v={v} n="04">Plain answers</SectionKicker>
            <h2 style={{ fontFamily: v.display, fontSize: 48, lineHeight: 1.04, letterSpacing: -1, margin: 0, fontWeight: v.displayWeight === 900 ? 700 : 500 }}>The questions buyers ask before they buy.</h2>
          </div>
          <div>
            {window.FAQ.map((f, i) => (
              <div key={f.q} className="sb-faq-item" style={{ padding: i === 0 ? '0 0 28px' : '28px 0', borderTop: i === 0 ? 'none' : `1px solid ${v.ruleSoft}` }}>
                <div style={{ fontFamily: v.display, fontSize: 24, fontWeight: v.displayWeight === 900 ? 700 : 500, letterSpacing: -0.4 }}>{f.q}</div>
                <p style={{ fontSize: 15.5, color: v.ink2, margin: '12px 0 0', lineHeight: 1.6 }}>{f.a}</p>
              </div>
            ))}
          </div>
        </div>
      </section>

      {/* ── CTA ─────────────────────────────────────────────────────── */}
      <section style={{ padding: '0 64px 64px', maxWidth: 1440, margin: '0 auto' }}>
        <div style={{ background: v.ink, color: v.bg, borderRadius: v.cardRadius === 0 ? 0 : 6, padding: '96px 64px', position: 'relative', overflow: 'hidden' }}>
          {/* Decoration: variant-specific */}
          {v.kickerStyle === 'mastheadBar' && (
            <>
              <div style={{ position: 'absolute', top: -80, right: -80, width: 320, height: 320, borderRadius: '50%', background: v.secondInk, opacity: 0.4 }} />
              <div style={{ position: 'absolute', top: -40, right: -40, width: 240, height: 240, borderRadius: '50%', border: `1px solid rgba(255,255,255,.2)` }} />
            </>
          )}
          {v.kickerStyle === 'dateline' && (
            <div style={{ position: 'absolute', top: 0, right: 64, bottom: 0, width: 4, background: v.accent }} />
          )}
          {v.kickerStyle === 'volDateline' && (
            <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 8, background: `repeating-linear-gradient(90deg, ${v.bg} 0 12px, transparent 12px 24px)` }} />
          )}
          <div style={{ maxWidth: 720, position: 'relative' }}>
            <div style={{ fontSize: 11.5, letterSpacing: 2.4, textTransform: 'uppercase', color: 'rgba(255,255,255,.7)', fontWeight: 600, marginBottom: 24, fontFamily: v.mono }}>Start a brief</div>
            <h2 style={{ fontFamily: v.display, fontSize: 64, lineHeight: 1.02, letterSpacing: -1.6, margin: 0, fontWeight: v.displayWeight === 900 ? 700 : 500, textWrap: 'balance' }}>
              Describe a topic. The rest takes about a minute.
            </h2>
            <p style={{ fontSize: 17, color: 'rgba(255,255,255,.7)', marginTop: 24, maxWidth: 540, lineHeight: 1.55 }}>
              You'll talk to the brief assistant, approve the query, and see a volume estimate before you ever enter a card.
            </p>
            <div style={{ display: 'flex', gap: 14, marginTop: 40 }}>
              <button className="sb-btn sb-btn-paper" onClick={open} style={{ background: v.bg, color: v.ink, border: 'none', borderRadius: v.pillRadius, padding: '16px 28px', fontFamily: 'inherit', fontSize: 16, fontWeight: 500, cursor: 'pointer' }}>Start a brief →</button>
              <button className="sb-btn sb-btn-ghost" style={{ background: 'transparent', color: v.bg, border: `1px solid rgba(255,255,255,.3)`, borderRadius: v.pillRadius, padding: '16px 28px', fontFamily: 'inherit', fontSize: 16, fontWeight: 500, cursor: 'pointer' }}>See a sample first</button>
            </div>
          </div>
        </div>
      </section>

      {/* ── Footer ─────────────────────────────────────────────────── */}
      <footer style={{ padding: '40px 64px 56px', borderTop: `1px solid ${v.rule}`, display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: 13, color: v.ink3, maxWidth: 1440, margin: '0 auto' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
          <SBMark variant={v} size={22} mark />
          <span style={{ color: v.ink3 }}>· Read the conversation before you enter it.</span>
        </div>
        <div style={{ display: 'flex', gap: 28 }}>
          <a className="sb-link" style={{ color: 'inherit' }}>Methodology</a>
          <a className="sb-link" style={{ color: 'inherit' }}>Terms</a>
          <a className="sb-link" style={{ color: 'inherit' }}>Privacy</a>
          <a className="sb-link" style={{ color: 'inherit' }}>hello@intellegio.com</a>
        </div>
      </footer>
    </div>
  );
}

// Initial dossierTokens shim so chat.jsx (which reads window.dossierTokens.blue
// and .blueSoft) has the legacy keys mapped even before Landing first renders.
window.dossierTokens = { ...variants.A, blue: variants.A.secondInk, blueSoft: variants.A.accentSoft };
Object.assign(window, { Landing, SBMark, variants });
