// scenes2.jsx — Scenes 4, 5, 6, 7 (Inside Program), 8 (CTA)

// ═════════════════════════════════════════════════════════════════════════
// Scene 4 — Attack-surface grid (44 → 60)
// ═════════════════════════════════════════════════════════════════════════
function Scene4Vectors() {
  const start = 44.0, end = 60.0;
  const t = useTime();
  const local = t - start;

  const titleO = interpolate([0, 0.6, 14.6, 15.4], [0, 1, 1, 0], Easing.linear)(local);

  const vectors = [
    { name: 'PHISHING',  stat: '989,123',   sub: 'attacks per quarter',       icon: 'mail' },
    { name: 'SMISHING',  stat: '59,000+',   sub: 'FBI toll-text complaints',  icon: 'sms' },
    { name: 'QUISHING',  stat: '1.7 M',     sub: 'malicious QR codes',        icon: 'qr' },
    { name: 'VISHING',   stat: '+442 %',    sub: 'rise · H2 2024',            icon: 'phone' },
    { name: 'AitM',      stat: '146 %',     sub: 'MFA token theft YoY',       icon: 'lock' },
    { name: 'DEEPFAKE',  stat: '3 sec',     sub: 'of audio to clone a voice', icon: 'face' },
  ];

  const cardShow = (i) => {
    const a = 1.2 + i * 1.3;
    return interpolate([a, a + 0.6, 14.4, 15.2], [0, 1, 1, 0], Easing.easeOutCubic)(local);
  };
  const cardScale = (i) => {
    const a = 1.2 + i * 1.3;
    return interpolate([a, a + 0.55], [0.88, 1], Easing.easeOutBack)(local);
  };

  const cellW = 540, cellH = 290, gap = 24;
  const totalW = cellW * 3 + gap * 2;
  const startX = (1920 - totalW) / 2;
  const startY = 350;

  return (
    <Sprite start={start} end={end}>
      <div style={{ position: 'absolute', inset: 0, background: OR.bg }} />

      <div style={{ opacity: titleO }}>
        <Eyebrow x={120} y={140}>The attack surface · 2026</Eyebrow>
        <div style={{
          position: 'absolute', left: 120, top: 200,
          fontFamily: FF.display,
          fontWeight: 700, fontSize: 76, color: OR.ink,
          letterSpacing: '0.04em', lineHeight: 1,
          textTransform: 'uppercase',
        }}>
          It isn't just email anymore.
        </div>
      </div>

      {vectors.map((v, i) => {
        const col = i % 3, row = Math.floor(i / 3);
        const x = startX + col * (cellW + gap);
        const y = startY + row * (cellH + gap);
        const op = cardShow(i);
        const sc = cardScale(i);
        return (
          <div key={v.name} style={{
            position: 'absolute', left: x, top: y, width: cellW, height: cellH,
            background: OR.bgSlate,
            border: `1px solid ${OR.line}`,
            borderRadius: 0,
            padding: '24px 32px',
            boxSizing: 'border-box',
            opacity: op,
            transform: `scale(${sc})`,
            transformOrigin: 'center',
            display: 'flex', flexDirection: 'column', justifyContent: 'space-between',
          }}>
            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
              <VectorIcon kind={v.icon} color={OR.gold} />
              <div style={{
                fontFamily: FF.mono,
                fontSize: 14, color: OR.inkFaint, letterSpacing: '0.18em',
              }}>0{i + 1} / 06</div>
            </div>

            <div style={{
              fontFamily: FF.display,
              fontSize: 38, fontWeight: 700, color: OR.gold,
              letterSpacing: '0.06em', textTransform: 'uppercase',
            }}>{v.name}</div>

            <div>
              <div style={{
                fontFamily: FF.sans,
                fontSize: 60, fontWeight: 700, color: OR.ink,
                letterSpacing: '-0.03em', lineHeight: 1,
                fontVariantNumeric: 'tabular-nums',
              }}>{v.stat}</div>
              <div style={{
                fontFamily: FF.mono,
                fontSize: 15, color: OR.inkDim, letterSpacing: '0.12em',
                textTransform: 'uppercase', marginTop: 10,
              }}>{v.sub}</div>
            </div>
          </div>
        );
      })}

      <SourceChip text="APWG · Proofpoint · CrowdStrike · Microsoft DDR 2024" x={120} y={1030} />
    </Sprite>
  );
}

function VectorIcon({ kind, color }) {
  const sz = 52;
  const s = { width: sz, height: sz };
  const stroke = color;
  switch (kind) {
    case 'mail': return (
      <svg style={s} viewBox="0 0 56 56" fill="none">
        <rect x="6" y="14" width="44" height="30" stroke={stroke} strokeWidth="2.2" rx="0"/>
        <path d="M6 16 L28 32 L50 16" stroke={stroke} strokeWidth="2.2" fill="none" strokeLinejoin="miter"/>
      </svg>
    );
    case 'sms': return (
      <svg style={s} viewBox="0 0 56 56" fill="none">
        <rect x="14" y="6" width="28" height="44" rx="2" stroke={stroke} strokeWidth="2.2"/>
        <rect x="20" y="14" width="16" height="22" stroke={stroke} strokeWidth="2"/>
        <circle cx="28" cy="44" r="1.6" fill={stroke}/>
      </svg>
    );
    case 'qr': return (
      <svg style={s} viewBox="0 0 56 56" fill="none">
        <rect x="6" y="6" width="16" height="16" stroke={stroke} strokeWidth="2"/>
        <rect x="34" y="6" width="16" height="16" stroke={stroke} strokeWidth="2"/>
        <rect x="6" y="34" width="16" height="16" stroke={stroke} strokeWidth="2"/>
        <rect x="11" y="11" width="6" height="6" fill={stroke}/>
        <rect x="39" y="11" width="6" height="6" fill={stroke}/>
        <rect x="11" y="39" width="6" height="6" fill={stroke}/>
        <rect x="30" y="30" width="4" height="4" fill={stroke}/>
        <rect x="38" y="34" width="4" height="4" fill={stroke}/>
        <rect x="46" y="30" width="4" height="4" fill={stroke}/>
        <rect x="34" y="42" width="4" height="4" fill={stroke}/>
        <rect x="42" y="46" width="4" height="4" fill={stroke}/>
      </svg>
    );
    case 'phone': return (
      <svg style={s} viewBox="0 0 56 56" fill="none">
        <path d="M14 10 c-4 4 -4 12 4 22 c10 12 18 14 22 10 l-4 -8 c-2 -2 -6 0 -8 -2 c-4 -4 -6 -6 -8 -10 c-2 -2 0 -6 -2 -8 z"
          stroke={stroke} strokeWidth="2.2" strokeLinejoin="miter" fill="none"/>
      </svg>
    );
    case 'lock': return (
      <svg style={s} viewBox="0 0 56 56" fill="none">
        <rect x="12" y="24" width="32" height="24" stroke={stroke} strokeWidth="2.2"/>
        <path d="M18 24 v-6 a10 10 0 0 1 20 0 v6" stroke={stroke} strokeWidth="2.2" fill="none"/>
        <circle cx="28" cy="36" r="3" fill={stroke}/>
      </svg>
    );
    case 'face': return (
      <svg style={s} viewBox="0 0 56 56" fill="none">
        <polygon points="28,8 44,20 44,36 28,48 12,36 12,20" stroke={stroke} strokeWidth="2.2" fill="none"/>
        <circle cx="22" cy="24" r="2" fill={stroke}/>
        <circle cx="34" cy="24" r="2" fill={stroke}/>
        <path d="M22 32 Q28 35 34 32" stroke={stroke} strokeWidth="2" fill="none" strokeLinecap="round"/>
      </svg>
    );
    default: return null;
  }
}

// ═════════════════════════════════════════════════════════════════════════
// Scene 5 — 1 in 3 (60 → 70)
// ═════════════════════════════════════════════════════════════════════════
function Scene5OneIn3() {
  const start = 60.0, end = 70.0;
  const t = useTime();
  const local = t - start;

  const titleO = interpolate([0, 0.5, 9.2, 9.7], [0, 1, 1, 0], Easing.linear)(local);

  const figProgress = interpolate([0.6, 4.0], [0, 30], Easing.easeOutCubic)(local);
  const redP        = interpolate([3.6, 5.4], [0, 1], Easing.easeOutCubic)(local);
  const bigO        = interpolate([5.0, 5.8, 9.2, 9.7], [0, 1, 1, 0], Easing.linear)(local);

  const rows = 3, cols = 10;
  const figW = 70, figH = 100, gapX = 30, gapY = 40;
  const gridW = cols * figW + (cols - 1) * gapX;
  const gx = (1920 - gridW) / 2;
  const gy = 320;

  return (
    <Sprite start={start} end={end}>
      <div style={{ position: 'absolute', inset: 0, background: OR.bg }} />

      <div style={{ opacity: titleO }}>
        <Eyebrow x={120} y={140}>KnowBe4 · 11.9 M users tested</Eyebrow>
        <div style={{
          position: 'absolute', left: 120, top: 200,
          fontFamily: FF.display,
          fontWeight: 700, fontSize: 76, color: OR.ink,
          letterSpacing: '0.06em', lineHeight: 1,
          textTransform: 'uppercase',
        }}>
          Without training…
        </div>
      </div>

      {Array.from({ length: rows * cols }).map((_, i) => {
        const col = i % cols, row = Math.floor(i / cols);
        const x = gx + col * (figW + gapX);
        const y = gy + row * (figH + gapY);
        const visible = i < figProgress;
        const isRed = i % 3 === 0;
        const fillP = isRed ? redP : 0;
        return (
          <div key={i} style={{
            position: 'absolute', left: x, top: y, width: figW, height: figH,
            opacity: visible ? 1 : 0,
            transform: `translateY(${visible ? 0 : 14}px)`,
            transition: 'all 280ms',
          }}>
            <FigureGlyph fillP={fillP} />
          </div>
        );
      })}

      <div style={{
        position: 'absolute', left: 0, right: 0, bottom: 100,
        textAlign: 'center', opacity: bigO,
      }}>
        <div style={{
          fontFamily: FF.display,
          fontWeight: 700, fontSize: 180, color: OR.ink,
          letterSpacing: '0.04em', lineHeight: 1,
          textTransform: 'uppercase',
        }}>
          <span style={{ color: OR.gold }}>1</span> in 3 will click.
        </div>
        <div style={{
          fontFamily: FF.mono,
          fontSize: 20, color: OR.inkDim, letterSpacing: '0.26em',
          textTransform: 'uppercase', marginTop: 22,
        }}>
          on the first phishing test · 34.3% baseline
        </div>
      </div>
    </Sprite>
  );
}

function FigureGlyph({ fillP }) {
  const grayCol = 'rgba(253,251,247,0.20)';
  return (
    <svg width="70" height="100" viewBox="0 0 70 100">
      <g fill="none" stroke={grayCol} strokeWidth="2">
        <circle cx="35" cy="20" r="14" />
        <path d="M10 96 v-22 a25 25 0 0 1 50 0 v22" strokeLinejoin="miter" />
      </g>
      <g fill={OR.gold} opacity={fillP}>
        <circle cx="35" cy="20" r="14" />
        <path d="M10 96 v-22 a25 25 0 0 1 50 0 v22 Z" />
      </g>
    </svg>
  );
}

// ═════════════════════════════════════════════════════════════════════════
// Scene 6 — The fix (70 → 82)
// ═════════════════════════════════════════════════════════════════════════
function Scene6Fix() {
  const start = 70.0, end = 82.0;
  const t = useTime();
  const local = t - start;

  const titleO = interpolate([0, 0.5, 11.2, 11.8], [0, 1, 1, 0], Easing.linear)(local);

  const leftFill  = interpolate([0.8, 2.4], [0, 1], Easing.easeOutCubic)(local);
  const arrowP    = interpolate([3.0, 4.6], [0, 1], Easing.easeOutCubic)(local);
  const rightFill = interpolate([4.8, 5.8], [0, 1], Easing.easeOutCubic)(local);

  const eightyO   = interpolate([6.8, 7.6, 11.2, 11.8], [0, 1, 1, 0], Easing.linear)(local);
  const eightyVal = useCountUp({ from: 0, to: 86, start: start + 7.0, end: start + 8.6, ease: Easing.easeOutExpo });

  // Geometry
  const barMax    = 290;
  const baseY     = 760;
  const barW      = 200;
  const leftX     = 580;
  const rightX    = 1340 - barW;
  const leftHeight  = barMax * leftFill;
  const rightHeight = barMax * (4.6 / 34.3) * rightFill;

  return (
    <Sprite start={start} end={end}>
      <div style={{ position: 'absolute', inset: 0, background: OR.bg }} />

      {/* Obsidian backdrop — faceted polygons with gold seams.
          Polygons echo the brand's low-poly gemstone language. */}
      <svg width="1920" height="1080" style={{ position: 'absolute', inset: 0 }} viewBox="0 0 1920 1080" preserveAspectRatio="none">
        <defs>
          <linearGradient id="obFacet1" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0%"   stopColor="#15110a"/>
            <stop offset="100%" stopColor="#080604"/>
          </linearGradient>
          <linearGradient id="obFacet2" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0%"   stopColor="#1c160d"/>
            <stop offset="100%" stopColor="#0a0805"/>
          </linearGradient>
          <linearGradient id="obFacet3" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0%"   stopColor="#0d0a06"/>
            <stop offset="100%" stopColor="#050402"/>
          </linearGradient>
          <radialGradient id="obGlow" cx="50%" cy="46%" r="40%">
            <stop offset="0%"   stopColor="rgba(214,164,95,0.10)"/>
            <stop offset="100%" stopColor="rgba(214,164,95,0)"/>
          </radialGradient>
        </defs>

        {/* base radial glow */}
        <rect width="1920" height="1080" fill="url(#obGlow)" />

        {/* low-poly faceted plates filling whole frame */}
        <polygon fill="url(#obFacet2)" points="0,0 760,0 540,420 0,360" />
        <polygon fill="url(#obFacet1)" points="760,0 1920,0 1920,300 1240,460 540,420" />
        <polygon fill="url(#obFacet3)" points="0,360 540,420 480,720 0,640" />
        <polygon fill="url(#obFacet2)" points="540,420 1240,460 1180,820 480,720" />
        <polygon fill="url(#obFacet1)" points="1240,460 1920,300 1920,800 1180,820" />
        <polygon fill="url(#obFacet3)" points="0,640 480,720 540,1080 0,1080" />
        <polygon fill="url(#obFacet2)" points="480,720 1180,820 1280,1080 540,1080" />
        <polygon fill="url(#obFacet1)" points="1180,820 1920,800 1920,1080 1280,1080" />

        {/* gold seams along facet edges — barely-there */}
        <g stroke={OR.gold} strokeWidth="1" fill="none" opacity="0.18">
          <path d="M 760,0 L 540,420 L 0,360" />
          <path d="M 1240,460 L 540,420" />
          <path d="M 1920,300 L 1240,460" />
          <path d="M 540,420 L 480,720" />
          <path d="M 1240,460 L 1180,820" />
          <path d="M 480,720 L 1180,820" />
          <path d="M 0,640 L 540,1080" />
          <path d="M 1180,820 L 1280,1080" />
        </g>
        {/* one luminous seam catching imagined gold-light */}
        <path d="M 760,0 L 540,420 L 480,720 L 540,1080"
          stroke={OR.gold} strokeWidth="1.4" fill="none" opacity="0.38" />
      </svg>

      {/* Title — centered, kept high to leave room for the chart */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: 110,
        textAlign: 'center', opacity: titleO,
      }}>
        <div style={{
          fontFamily: FF.mono,
          fontSize: 16, letterSpacing: '0.34em', color: OR.gold,
          textTransform: 'uppercase', marginBottom: 20,
        }}>
          ◆ The remedy
        </div>
        <div style={{
          fontFamily: FF.display,
          fontWeight: 700, fontSize: 68, color: OR.ink,
          letterSpacing: '0.06em', lineHeight: 1,
          textTransform: 'uppercase',
        }}>
          One year of training.
        </div>
      </div>

      {/* baseline rule */}
      <div style={{
        position: 'absolute', left: 480, right: 480, top: baseY,
        height: 1, background: 'rgba(214,164,95,0.32)',
      }} />

      {/* LEFT bar — baseline 34.3% (dim, decayed — reads as "bad") */}
      <div style={{
        position: 'absolute', left: leftX, top: baseY - leftHeight,
        width: barW, height: leftHeight,
        background: `linear-gradient(180deg, oklch(36% 0.02 60) 0%, oklch(16% 0.01 60) 100%)`,
        borderTop: `1px solid rgba(244,164,95,0.18)`,
      }} />
      <div style={{
        position: 'absolute', left: leftX - 80, top: baseY - barMax - 110,
        width: barW + 160, textAlign: 'center', opacity: leftFill,
      }}>
        <div style={{
          fontFamily: FF.sans, fontWeight: 700,
          fontSize: 76, color: OR.ink, lineHeight: 1, letterSpacing: '-0.03em',
          fontVariantNumeric: 'tabular-nums',
          opacity: 0.40,
        }}>34.3%</div>
      </div>
      <div style={{
        position: 'absolute', left: leftX - 80, top: baseY + 22,
        width: barW + 160, textAlign: 'center', opacity: leftFill,
        fontFamily: FF.mono,
        fontSize: 15, color: 'rgba(253,251,247,0.40)', letterSpacing: '0.24em',
        textTransform: 'uppercase',
      }}>
        Baseline
      </div>

      {/* Arrow between bars — sits at the mid-height of the bars */}
      <svg width="380" height="40" style={{
        position: 'absolute', left: 800, top: 540, opacity: arrowP,
      }} viewBox="0 0 380 40">
        <path
          d={`M 0 20 L ${arrowP * 350} 20`}
          stroke={OR.gold} strokeWidth="2" fill="none" strokeLinecap="butt"
          strokeDasharray="6 6"
        />
        {arrowP > 0.9 && (
          <polygon points={`${350},20 ${332},10 ${332},30`} fill={OR.gold} />
        )}
      </svg>
      <div style={{
        position: 'absolute', left: 800, top: 590, width: 380,
        textAlign: 'center', opacity: arrowP,
        fontFamily: FF.mono,
        fontSize: 14, letterSpacing: '0.26em', color: OR.gold,
        textTransform: 'uppercase',
      }}>
        12 months · simulations + training
      </div>

      {/* RIGHT bar — After 1 year 4.6% (luminous ridge-gold — reads as "good") */}
      <div style={{
        position: 'absolute', left: rightX, top: baseY - rightHeight,
        width: barW, height: rightHeight,
        background: `linear-gradient(180deg, ${OR.gold} 0%, ${OR.goldDim} 100%)`,
        boxShadow: `0 0 70px rgba(214,164,95,0.55), 0 0 20px rgba(214,164,95,0.4)`,
      }} />
      <div style={{
        position: 'absolute', left: rightX - 80, top: baseY - rightHeight - 110,
        width: barW + 160, textAlign: 'center', opacity: rightFill,
      }}>
        <div style={{
          fontFamily: FF.sans, fontWeight: 700,
          fontSize: 76, color: OR.gold, lineHeight: 1, letterSpacing: '-0.03em',
          fontVariantNumeric: 'tabular-nums',
          textShadow: '0 0 30px rgba(214,164,95,0.5)',
        }}>4.6%</div>
      </div>
      <div style={{
        position: 'absolute', left: rightX - 80, top: baseY + 22,
        width: barW + 160, textAlign: 'center', opacity: rightFill,
        fontFamily: FF.mono,
        fontSize: 15, color: OR.gold, letterSpacing: '0.24em',
        textTransform: 'uppercase',
      }}>
        After 1 year
      </div>

      {/* 86% reveal */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: 870,
        textAlign: 'center', opacity: eightyO,
      }}>
        <div style={{
          fontFamily: FF.display,
          fontWeight: 700, fontSize: 88, color: OR.gold,
          letterSpacing: '0.04em', lineHeight: 1,
          textTransform: 'uppercase',
          textShadow: '0 0 40px rgba(214,164,95,0.35)',
        }}>
          {Math.floor(eightyVal)}% fewer clicks.
        </div>
      </div>

      <SourceChip text="KnowBe4 Phishing by Industry Benchmark · 2024" x={120} y={1030} />
    </Sprite>
  );
}

// ═════════════════════════════════════════════════════════════════════════
// Scene 7 — Inside the program (82 → 94)
// Shows the actual training library: real phishing simulation templates
// (Microsoft / Adobe / LastPass / Anthropic / RingCentral / Slack) and the
// modern modules (AI Poisoning, Smishing simulator, Browser-in-the-Browser).
// ═════════════════════════════════════════════════════════════════════════
function Scene7Inside() {
  const start = 82.0, end = 94.0;
  const t = useTime();
  const local = t - start;

  const titleO = interpolate([0, 0.6, 11.2, 11.8], [0, 1, 1, 0], Easing.linear)(local);

  const sims = [
    { brand: 'Microsoft',    initials: 'M',   subject: 'Password expiring today',           kind: 'phishing' },
    { brand: 'Adobe',        initials: 'A',   subject: 'Invite to sign agreement',          kind: 'phishing' },
    { brand: 'LastPass',     initials: 'L',   subject: 'Vault backup recommended',          kind: 'phishing' },
    { brand: 'Anthropic',    initials: 'C',   subject: 'Claude subscription · receipt',     kind: 'phishing' },
    { brand: 'RingCentral',  initials: 'R',   subject: 'Missed audio message · BitB',       kind: 'bitb' },
    { brand: 'Slack',        initials: 'S',   subject: 'SSO enabled · sign-in required',    kind: 'bitb' },
  ];

  const cardShow = (i) => {
    const a = 1.0 + i * 0.55;
    return interpolate([a, a + 0.55, 10.8, 11.6], [0, 1, 1, 0], Easing.easeOutCubic)(local);
  };
  const cardLift = (i) => {
    const a = 1.0 + i * 0.55;
    return interpolate([a, a + 0.55], [24, 0], Easing.easeOutCubic)(local);
  };

  // 3x2 grid
  const cardW = 540, cardH = 200, gap = 24;
  const gridW = cardW * 3 + gap * 2;
  const gx = (1920 - gridW) / 2;
  const gy = 310;

  // module pills timing
  const pillsO = interpolate([5.0, 6.0, 10.8, 11.6], [0, 1, 1, 0], Easing.linear)(local);

  return (
    <Sprite start={start} end={end}>
      <div style={{ position: 'absolute', inset: 0, background: OR.bg }} />

      <div style={{ opacity: titleO }}>
        <Eyebrow x={120} y={140}>Inside the program · Obsidian Ridge</Eyebrow>
        <div style={{
          position: 'absolute', left: 120, top: 200,
          fontFamily: FF.display,
          fontWeight: 700, fontSize: 70, color: OR.ink,
          letterSpacing: '0.05em', lineHeight: 1,
          textTransform: 'uppercase',
        }}>
          Real threats · Real training
        </div>
      </div>

      {/* sim cards 3x2 */}
      {sims.map((s, i) => {
        const col = i % 3, row = Math.floor(i / 3);
        const x = gx + col * (cardW + gap);
        const y = gy + row * (cardH + gap);
        const op = cardShow(i);
        const lift = cardLift(i);
        return (
          <div key={s.brand} style={{
            position: 'absolute', left: x, top: y, width: cardW, height: cardH,
            background: OR.bgSlate,
            border: `1px solid ${OR.line}`,
            opacity: op,
            transform: `translateY(${lift}px)`,
            padding: 0,
            boxSizing: 'border-box',
            overflow: 'hidden',
          }}>
            {/* left brand chip column */}
            <div style={{
              position: 'absolute', left: 0, top: 0, bottom: 0, width: 96,
              borderRight: `1px solid ${OR.line}`,
              display: 'flex', alignItems: 'center', justifyContent: 'center',
              background: 'rgba(214,164,95,0.04)',
            }}>
              <div style={{
                width: 56, height: 56,
                display: 'flex', alignItems: 'center', justifyContent: 'center',
                background: OR.gold, color: '#0b0b0b',
                fontFamily: FF.display, fontWeight: 700, fontSize: 28,
                letterSpacing: '0.04em',
              }}>{s.initials}</div>
            </div>

            {/* content */}
            <div style={{
              position: 'absolute', left: 116, top: 22, right: 24, bottom: 22,
            }}>
              <div style={{
                fontFamily: FF.mono,
                fontSize: 12, color: OR.inkFaint, letterSpacing: '0.22em',
                textTransform: 'uppercase', marginBottom: 8,
                display: 'flex', alignItems: 'center', gap: 10,
              }}>
                {s.kind === 'bitb' ? (
                  <React.Fragment>
                    <span style={{ color: OR.gold }}>◆</span>
                    Browser-in-Browser · simulation
                  </React.Fragment>
                ) : (
                  <React.Fragment>
                    <span style={{ color: OR.gold }}>◆</span>
                    Phishing · simulation
                  </React.Fragment>
                )}
              </div>
              <div style={{
                fontFamily: FF.sans, fontWeight: 600,
                fontSize: 22, color: OR.ink, marginBottom: 8,
                letterSpacing: '-0.005em',
              }}>{s.brand}</div>
              <div style={{
                fontFamily: FF.sans, fontWeight: 400,
                fontSize: 20, color: OR.inkDim,
                letterSpacing: '-0.005em',
              }}>{s.subject}</div>
            </div>

            {/* corner tag (template number) */}
            <div style={{
              position: 'absolute', top: 16, right: 18,
              fontFamily: FF.mono,
              fontSize: 11, color: OR.inkFaint, letterSpacing: '0.2em',
              textTransform: 'uppercase',
            }}>
              T-0{i + 1}
            </div>
          </div>
        );
      })}

      {/* bottom: new module pills + practitioner note */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: 870,
        opacity: pillsO,
        display: 'flex', justifyContent: 'center', gap: 18,
      }}>
        {['AI Poisoning', 'Smishing simulator', 'Browser-in-the-Browser'].map((m, i) => (
          <div key={m} style={{
            padding: '12px 22px',
            border: `1px solid ${OR.gold}`,
            fontFamily: FF.mono,
            fontSize: 14, color: OR.gold, letterSpacing: '0.22em',
            textTransform: 'uppercase',
          }}>
            + {m}
          </div>
        ))}
      </div>

      <div style={{
        position: 'absolute', left: 0, right: 0, top: 950,
        textAlign: 'center',
        opacity: pillsO,
        fontFamily: FF.italic, fontStyle: 'italic',
        fontSize: 26, color: OR.inkDim,
      }}>
        CISSP-led · one-click reporting · metrics that matter
      </div>
    </Sprite>
  );
}

// ═════════════════════════════════════════════════════════════════════════
// Scene 8 — Obsidian Ridge CTA (94 → 100)
// ═════════════════════════════════════════════════════════════════════════
function Scene8CTA() {
  const start = 94.0, end = 100.0;
  const t = useTime();
  const local = t - start;

  // Global scene fade-out near the end
  const sceneO = interpolate([5.4, 5.95], [1, 0], Easing.easeInQuad)(local);

  const logoO  = interpolate([0, 0.9], [0, 1], Easing.easeOutCubic)(local) * sceneO;
  const lineO  = interpolate([1.0, 2.0], [0, 1], Easing.easeOutCubic)(local) * sceneO;
  const subO   = interpolate([2.2, 3.0], [0, 1], Easing.easeOutCubic)(local) * sceneO;
  const ctaO   = interpolate([3.2, 4.0], [0, 1], Easing.easeOutCubic)(local) * sceneO;
  const underlineP = interpolate([3.8, 5.4], [0, 1], Easing.easeOutCubic)(local);

  return (
    <Sprite start={start} end={end}>
      <div style={{ position: 'absolute', inset: 0, background: OR.bg }} />

      {/* Faceted obsidian backdrop — same low-poly language as the brand
          mountain, with gold seams catching imagined light. */}
      <svg width="1920" height="1080" style={{ position: 'absolute', inset: 0 }} viewBox="0 0 1920 1080" preserveAspectRatio="none">
        <defs>
          <linearGradient id="ctaFacet1" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0%"   stopColor="#1a1308"/>
            <stop offset="100%" stopColor="#080604"/>
          </linearGradient>
          <linearGradient id="ctaFacet2" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0%"   stopColor="#221a0d"/>
            <stop offset="100%" stopColor="#0a0805"/>
          </linearGradient>
          <linearGradient id="ctaFacet3" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0%"   stopColor="#0d0a06"/>
            <stop offset="100%" stopColor="#050402"/>
          </linearGradient>
          <radialGradient id="ctaGlow" cx="50%" cy="34%" r="42%">
            <stop offset="0%"   stopColor="rgba(214,164,95,0.22)"/>
            <stop offset="55%"  stopColor="rgba(214,164,95,0.06)"/>
            <stop offset="100%" stopColor="rgba(214,164,95,0)"/>
          </radialGradient>
        </defs>

        {/* base radial gold glow behind the mark */}
        <rect width="1920" height="1080" fill="url(#ctaGlow)" />

        {/* faceted plates */}
        <polygon fill="url(#ctaFacet2)" points="0,0 720,0 540,400 0,340" />
        <polygon fill="url(#ctaFacet1)" points="720,0 1920,0 1920,280 1280,440 540,400" />
        <polygon fill="url(#ctaFacet3)" points="0,340 540,400 480,700 0,620" />
        <polygon fill="url(#ctaFacet2)" points="540,400 1280,440 1200,800 480,700" />
        <polygon fill="url(#ctaFacet1)" points="1280,440 1920,280 1920,800 1200,800" />
        <polygon fill="url(#ctaFacet3)" points="0,620 480,700 540,1080 0,1080" />
        <polygon fill="url(#ctaFacet2)" points="480,700 1200,800 1300,1080 540,1080" />
        <polygon fill="url(#ctaFacet1)" points="1200,800 1920,800 1920,1080 1300,1080" />

        {/* faint seam network */}
        <g stroke={OR.gold} strokeWidth="1" fill="none" opacity="0.16">
          <path d="M 720,0 L 540,400 L 0,340" />
          <path d="M 1280,440 L 540,400" />
          <path d="M 1920,280 L 1280,440" />
          <path d="M 540,400 L 480,700" />
          <path d="M 1280,440 L 1200,800" />
          <path d="M 480,700 L 1200,800" />
          <path d="M 0,620 L 540,1080" />
          <path d="M 1200,800 L 1300,1080" />
        </g>
        {/* luminous seam down the center-left, the "light" through the obsidian */}
        <path d="M 720,0 L 540,400 L 480,700 L 540,1080"
          stroke={OR.gold} strokeWidth="1.6" fill="none" opacity="0.42" />
        <path d="M 1280,440 L 1200,800 L 1300,1080"
          stroke={OR.gold} strokeWidth="1.2" fill="none" opacity="0.28" />
      </svg>

      {/* Mountain-ridge silhouette in the lower third — same vocabulary as brand */}
      <svg width="1920" height="1080" style={{ position: 'absolute', inset: 0, opacity: 0.18 }} viewBox="0 0 1920 1080" preserveAspectRatio="none">
        <polygon fill="#1d1408" points="0,820 220,640 380,720 540,560 720,680 880,520 1080,660 1280,560 1420,700 1620,540 1780,680 1920,580 1920,1080 0,1080" />
        <polygon fill="#0a0703" points="0,900 200,820 340,860 500,760 660,840 820,720 980,820 1140,740 1320,820 1500,720 1660,820 1820,760 1920,810 1920,1080 0,1080" />
      </svg>

      {/* PCB ornaments */}
      <div style={{ position: 'absolute', left: 60, top: 60, opacity: logoO * 0.7 }}>
        <PCBTrace kind="top-left" size={180} />
      </div>
      <div style={{ position: 'absolute', right: 60, top: 60, opacity: logoO * 0.7 }}>
        <PCBTrace kind="top-right" size={180} />
      </div>
      <div style={{ position: 'absolute', left: 60, bottom: 60, opacity: logoO * 0.7 }}>
        <PCBTrace kind="bottom-left" size={180} />
      </div>
      <div style={{ position: 'absolute', right: 60, bottom: 60, opacity: logoO * 0.7 }}>
        <PCBTrace kind="bottom-right" size={180} />
      </div>

      {/* Soft radial halo behind the wordmark (intensifies on load) */}
      <div style={{
        position: 'absolute',
        left: '50%', top: 280, width: 1400, height: 400,
        transform: 'translateX(-50%)',
        background: 'radial-gradient(ellipse at center, rgba(214,164,95,0.20) 0%, rgba(214,164,95,0) 65%)',
        opacity: logoO,
        filter: 'blur(8px)',
        pointerEvents: 'none',
      }} />

      {/* HexMark + wordmark */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: 200,
        textAlign: 'center', opacity: logoO,
      }}>
        <div style={{
          display: 'inline-flex', alignItems: 'center', gap: 28,
          whiteSpace: 'nowrap',
        }}>
          <HexMark size={100} />
          <div style={{
            fontFamily: FF.display,
            fontWeight: 700, fontSize: 64, color: OR.gold,
            letterSpacing: '0.22em',
            whiteSpace: 'nowrap',
            textTransform: 'uppercase',
          }}>
            Obsidian Ridge
          </div>
        </div>
      </div>

      {/* tagline */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: 440,
        textAlign: 'center', opacity: lineO,
      }}>
        <div style={{
          fontFamily: FF.display,
          fontWeight: 600, fontSize: 84, color: OR.ink,
          letterSpacing: '0.06em', lineHeight: 1.18,
          textTransform: 'uppercase',
        }}>
          Train your people.<br/>
          <span style={{ color: OR.gold }}>Save your business.</span>
        </div>
      </div>

      {/* subtitle */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: 800,
        textAlign: 'center', opacity: subO,
      }}>
        <div style={{
          fontFamily: FF.mono,
          fontSize: 18, letterSpacing: '0.32em', color: OR.inkDim,
          textTransform: 'uppercase',
        }}>
          CISSP-led security-awareness training · built for SMB
        </div>
      </div>

      {/* CTA button + url */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: 880,
        textAlign: 'center', opacity: ctaO,
      }}>
        <div style={{
          display: 'inline-flex', alignItems: 'center', gap: 22,
        }}>
          <div style={{
            padding: '16px 28px',
            background: OR.gold,
            color: '#0b0b0b',
            fontFamily: FF.mono,
            fontSize: 16, fontWeight: 600, letterSpacing: '0.26em',
            textTransform: 'uppercase',
          }}>
            Book a briefing →
          </div>
          <div style={{
            position: 'relative',
            fontFamily: FF.sans,
            fontSize: 26, fontWeight: 500, color: OR.ink,
            letterSpacing: '-0.005em',
          }}>
            obsidianridge.io / briefing
            <div style={{
              position: 'absolute', left: 0, bottom: -8, height: 1,
              width: `${underlineP * 100}%`,
              background: OR.gold,
            }} />
          </div>
        </div>
      </div>
    </Sprite>
  );
}

Object.assign(window, { Scene4Vectors, Scene5OneIn3, Scene6Fix, Scene7Inside, Scene8CTA });
