// brand-cards.jsx — OnboardIQ brand foundations
// Each export below is a self-contained artboard body.

// ───────────────────────────────────────────────────────────
// LOGO PRIMITIVES — small SVG components reused everywhere
// ───────────────────────────────────────────────────────────

const StepMark = ({ size = 40, color = "currentColor", strokeWidth = 2.2 }) => (
  // Three nested chevrons — visual metaphor for staged onboarding steps.
  // Square terminals, no rounded joins.
  <svg width={size} height={size} viewBox="0 0 40 40" fill="none" aria-hidden="true">
    <path d="M6 14 L20 6 L34 14" stroke={color} strokeWidth={strokeWidth} strokeLinecap="square" />
    <path d="M6 22 L20 14 L34 22" stroke={color} strokeWidth={strokeWidth} strokeLinecap="square" />
    <path d="M6 30 L20 22 L34 30" stroke={color} strokeWidth={strokeWidth} strokeLinecap="square" />
  </svg>
);

const SealMark = ({ size = 56, color = "currentColor" }) => (
  // Square credential seal — OIQ monogram + inscription rule.
  <svg width={size} height={size} viewBox="0 0 56 56" fill="none" aria-hidden="true">
    <rect x="2" y="2" width="52" height="52" stroke={color} strokeWidth="1.5" />
    <rect x="6" y="6" width="44" height="44" stroke={color} strokeWidth="0.5" opacity="0.5" />
    <text x="28" y="29" textAnchor="middle"
      fontFamily="IBM Plex Mono, monospace" fontSize="13" fontWeight="600"
      fill={color} letterSpacing="1">OIQ</text>
    <line x1="14" y1="35" x2="42" y2="35" stroke={color} strokeWidth="0.5" />
    <text x="28" y="44" textAnchor="middle"
      fontFamily="IBM Plex Mono, monospace" fontSize="6" fontWeight="500"
      fill={color} letterSpacing="1.5" opacity="0.7">CERT · NY</text>
  </svg>
);

const Wordmark = ({ size = 24, color = "currentColor", weight = 600 }) => (
  <span style={{
    fontFamily: 'IBM Plex Sans',
    fontWeight: weight,
    fontSize: size,
    letterSpacing: '-0.025em',
    color,
    lineHeight: 1,
    whiteSpace: 'nowrap',
  }}>
    <span style={{ fontWeight: 500 }}>Onboard</span>
    <span style={{ fontWeight: 700 }}>IQ</span>
  </span>
);

const Lockup = ({ size = 24, color = "currentColor" }) => (
  <span style={{ display: 'inline-flex', alignItems: 'center', gap: size * 0.4 }}>
    <StepMark size={size * 1.3} color={color} strokeWidth={2.2} />
    <Wordmark size={size} color={color} />
  </span>
);

// ───────────────────────────────────────────────────────────
// CARD 1 — LOGO SYSTEM
// ───────────────────────────────────────────────────────────

function LogoCard() {
  return (
    <div className="oiq" style={{ padding: 32, height: '100%', background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 18, overflow: 'hidden' }}>
      <Header eyebrow="01 · Identity" title="Two marks, two roles" subtitle="Stepmark = the brand. Seal = what the brand issues." />

      {/* ───── Role A — BRAND IDENTITY ───── */}
      <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
        <div style={{ display: 'flex', alignItems: 'baseline', gap: 10 }}>
          <span className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-900)', background: 'var(--paper-200)', padding: '2px 7px', letterSpacing: '0.08em' }}>ROLE A</span>
          <span style={{ fontSize: 13, fontWeight: 500, color: 'var(--ink-900)' }}>Brand identity — represents OnboardIQ</span>
          <span className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-500)' }}>app · marketing · email sender · social · business cards</span>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: '1.4fr 1fr 0.9fr', gap: 10 }}>
          <Panel label="Primary lockup">
            <div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: 8 }}>
              <Lockup size={32} color="var(--ink-900)" />
            </div>
          </Panel>
          <Panel label="Knockout" dark>
            <div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: 8 }}>
              <Lockup size={24} color="var(--paper-50)" />
            </div>
          </Panel>
          <Panel label="Stepmark · favicon scale">
            <div style={{ display: 'flex', alignItems: 'center', gap: 14, flex: 1, paddingLeft: 4 }}>
              <StepMark size={44} color="var(--ink-900)" />
              <StepMark size={24} color="var(--ink-900)" />
              <StepMark size={16} color="var(--ink-900)" />
            </div>
          </Panel>
        </div>
      </div>

      {/* ───── Role B — ATTESTATION DEVICE ───── */}
      <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
        <div style={{ display: 'flex', alignItems: 'baseline', gap: 10 }}>
          <span className="oiq-mono" style={{ fontSize: 10, color: 'var(--paper-50)', background: 'var(--ink-900)', padding: '2px 7px', letterSpacing: '0.08em' }}>ROLE B</span>
          <span style={{ fontSize: 13, fontWeight: 500, color: 'var(--ink-900)' }}>Attestation device — what OnboardIQ issues</span>
          <span className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-500)' }}>audit certificates · signature completion · compliance exports · document footers</span>
        </div>
        <div style={{
          display: 'grid', gridTemplateColumns: '180px 1fr', gap: 14,
          border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', padding: 14, background: 'var(--paper-100)',
        }}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
            <SealMark size={104} color="var(--ink-900)" />
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 8, justifyContent: 'center' }}>
            <div style={{ fontFamily: 'var(--serif)', fontSize: 16, color: 'var(--ink-900)', fontWeight: 400 }}>
              Certificate of Audit · Daniel Okafor · I-9 Section 2
            </div>
            <div className="oiq-mono" style={{ fontSize: 10.5, color: 'var(--ink-700)', lineHeight: 1.55 }}>
              executed under hash-chain custody · 0x7a1f…c402<br/>
              countersigned by T. Bramwell · 2026-05-13 · 09:42 ET<br/>
              tsa-rfc3161 · timestamped <span style={{ color: 'var(--ink-500)' }}>1747146126</span>
            </div>
            <div style={{ display: 'flex', gap: 8, alignItems: 'center', marginTop: 4 }}>
              <span className="oiq-mono" style={{ fontSize: 9.5, color: 'var(--ink-900)', background: 'var(--accent-100)', padding: '2px 6px', borderRadius: 3 }}>NOT FOR SCREEN UI</span>
              <span className="oiq-mono" style={{ fontSize: 9.5, color: 'var(--ink-600)' }}>used only on documents the brand issues</span>
            </div>
          </div>
        </div>
      </div>

      {/* Construction strip */}
      <div style={{ display: 'flex', alignItems: 'center', gap: 16, paddingTop: 12, borderTop: '1px solid var(--paper-300)' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
          <div style={{ position: 'relative' }}>
            <StepMark size={44} color="var(--ink-900)" strokeWidth={2.2} />
            <div className="oiq-grid-bg" style={{ position: 'absolute', inset: 0, mixBlendMode: 'multiply', pointerEvents: 'none' }} />
          </div>
          <div className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-600)', lineHeight: 1.5 }}>
            <div>3 chevrons · 8px grid</div>
            <div>2.2px stroke · square caps</div>
            <div>step rhythm = onboarding cadence</div>
          </div>
        </div>
        <div style={{ flex: 1 }} />
        <div className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-500)', textAlign: 'right', lineHeight: 1.5 }}>
          <div>stepmark min · 16px (digital)</div>
          <div>seal min · 56px (print only)</div>
          <div>clear space · 1× chevron height</div>
        </div>
      </div>
    </div>
  );
}

// ───────────────────────────────────────────────────────────
// CARD 2 — COLOR SYSTEM
// ───────────────────────────────────────────────────────────

function ColorCard() {
  const neutrals = [
    { label: "Paper",  values: [
      { name: "paper-50",  hex: "#FBF9F4" },
      { name: "paper-100", hex: "#F4F1EA", role: "default surface" },
      { name: "paper-200", hex: "#ECE7DC" },
      { name: "paper-300", hex: "#DDD6C6", role: "1px borders" },
      { name: "paper-400", hex: "#C5BDA9" },
    ]},
    { label: "Ink",  values: [
      { name: "ink-900",   hex: "#16140F", role: "foreground" },
      { name: "ink-700",   hex: "#3D3930", role: "body" },
      { name: "ink-600",   hex: "#5F5A4E", role: "secondary" },
      { name: "ink-500",   hex: "#807A6C" },
      { name: "ink-400",   hex: "#A5A091", role: "placeholder" },
    ]},
  ];

  const palettes = [
    { name: "A · amber",     desc: "default \u00b7 industrial credential \u00b7 torque", swatches: [
      { name: "accent-700", hex: "#8B6017" },
      { name: "accent-500", hex: "#D49A3A", role: "primary" },
      { name: "accent-200", hex: "#F1DAA1" },
      { name: "accent-100", hex: "#F8ECCB", role: "tint bg" },
    ]},
    { name: "B · verdigris", desc: "alt \u00b7 oxidized patina \u00b7 institutional", swatches: [
      { name: "accent-700", hex: "#1F4A3F" },
      { name: "accent-500", hex: "#437D6D", role: "primary" },
      { name: "accent-200", hex: "#B5D2C8" },
      { name: "accent-100", hex: "#D6E5DF", role: "tint bg" },
    ]},
  ];

  const slate = [
    { name: "slate-700", hex: "#2F3D49" },
    { name: "slate-500", hex: "#647686", role: "info text" },
    { name: "slate-300", hex: "#B6C0CA" },
    { name: "slate-100", hex: "#E2E7EC" },
  ];

  const status = [
    { name: "success", hex: "#3F7A5A" },
    { name: "warn",    hex: "#B07B1F" },
    { name: "danger",  hex: "#98353F" },
    { name: "info",    hex: "#3D5878" },
  ];

  return (
    <div className="oiq" style={{ padding: 32, height: '100%', background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 14 }}>
      <Header eyebrow="02 \u00b7 Color" title="Two palette directions, one neutral system" subtitle="Paper + ink shared. Two non-obvious accents on offer. Both routed to the same accent role." />

      {/* Neutrals */}
      {neutrals.map((g) => (
        <div key={g.label}>
          <div className="oiq-eyebrow" style={{ marginBottom: 6 }}>{g.label}</div>
          <div style={{ display: 'grid', gridTemplateColumns: `repeat(${g.values.length}, 1fr)`, gap: 6 }}>
            {g.values.map((s) => (
              <Swatch key={s.name} s={s} />
            ))}
          </div>
        </div>
      ))}

      {/* Two accent directions */}
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 }}>
        {palettes.map((p, idx) => (
          <div key={p.name} style={{ border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', padding: 12, background: idx === 0 ? 'var(--paper-50)' : 'transparent' }}>
            <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', marginBottom: 8 }}>
              <span className="oiq-eyebrow">Accent {p.name}</span>
              {idx === 0 && <span className="oiq-mono" style={{ fontSize: 9.5, color: 'var(--ink-900)', background: 'var(--paper-200)', padding: '1px 6px', borderRadius: 3 }}>DEFAULT</span>}
            </div>
            <div style={{ fontSize: 11, color: 'var(--ink-600)', marginBottom: 8 }}>{p.desc}</div>
            <div style={{ display: 'grid', gridTemplateColumns: `repeat(${p.swatches.length}, 1fr)`, gap: 6 }}>
              {p.swatches.map((s) => <Swatch key={s.name} s={s} />)}
            </div>
          </div>
        ))}
      </div>

      {/* Slate + status compact */}
      <div style={{ display: 'grid', gridTemplateColumns: '1.4fr 1fr', gap: 16 }}>
        <div>
          <div className="oiq-eyebrow" style={{ marginBottom: 6 }}>Slate · support</div>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 6 }}>
            {slate.map((s) => <Swatch key={s.name} s={s} />)}
          </div>
        </div>
        <div>
          <div className="oiq-eyebrow" style={{ marginBottom: 6 }}>Status</div>
          <div style={{ display: 'flex', gap: 6 }}>
            {status.map((s) => (
              <div key={s.name} style={{ flex: 1, border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', padding: '6px 8px', display: 'flex', alignItems: 'center', gap: 6 }}>
                <span className="oiq-dot" style={{ background: s.hex }} />
                <span style={{ fontSize: 11.5, color: 'var(--ink-900)' }}>{s.name}</span>
              </div>
            ))}
          </div>
        </div>
      </div>

      <div className="oiq-mono" style={{ fontSize: 10.5, color: 'var(--ink-500)', paddingTop: 10, borderTop: '1px solid var(--paper-300)' }}>
        Third option · oxblood (#98353F) available as a tweak preset. All three are non-obvious choices that read credentialed, not corporate.
      </div>
    </div>
  );
}

function Swatch({ s }) {
  return (
    <div style={{
      border: '1px solid var(--paper-300)',
      borderRadius: 'var(--r-2)',
      overflow: 'hidden',
      background: 'var(--paper-50)',
    }}>
      <div style={{ height: 36, background: s.hex }} />
      <div style={{ padding: '5px 7px' }}>
        <div className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-900)' }}>{s.name}</div>
        <div className="oiq-mono" style={{ fontSize: 9, color: 'var(--ink-500)' }}>{s.hex}</div>
        {s.role && <div style={{ fontSize: 9.5, color: 'var(--ink-600)', marginTop: 1 }}>{s.role}</div>}
      </div>
    </div>
  );
}

// ───────────────────────────────────────────────────────────
// CARD · THEME · LIGHT + DARK (dark is its own design, not a recolor)
// ───────────────────────────────────────────────────────────

function ThemeCard() {
  return (
    <div className="oiq" style={{ padding: 32, height: '100%', background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 14 }}>
      <Header eyebrow="0X \u00b7 Theme" title="Dark is not a recolor" subtitle="Different surface elevations, body weight, accent step, border treatment." />

      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12, flex: 1 }}>
        <ThemeSpecimen mode="light" />
        <ThemeSpecimen mode="dark" />
      </div>

      <div style={{ paddingTop: 12, borderTop: '1px solid var(--paper-300)' }}>
        <div className="oiq-eyebrow" style={{ marginBottom: 8 }}>What changes</div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 10, fontSize: 11.5, color: 'var(--ink-700)', lineHeight: 1.4 }}>
          <DiffRow tag="surface" light="paper 50/100 (2 levels)" dark="paper 100/200/300 (3 levels)" />
          <DiffRow tag="body weight" light="500 semibold for titles" dark="400 regular for titles" />
          <DiffRow tag="accent step" light="accent-500" dark="accent-400 (one stop up)" />
          <DiffRow tag="separators" light="hairline + soft shadow" dark="hairline only, no shadow" />
        </div>
      </div>
    </div>
  );
}

function DiffRow({ tag, light, dark }) {
  return (
    <div style={{ border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', padding: '8px 10px', background: 'var(--paper-50)' }}>
      <div className="oiq-mono" style={{ fontSize: 9.5, color: 'var(--ink-500)', textTransform: 'uppercase', letterSpacing: '0.06em', marginBottom: 4 }}>{tag}</div>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
        <span><span style={{ color: 'var(--ink-500)' }}>light</span> {light}</span>
        <span><span style={{ color: 'var(--ink-500)' }}>dark</span> {dark}</span>
      </div>
    </div>
  );
}

function ThemeSpecimen({ mode }) {
  // A tiny chunk of the dashboard rendered explicitly in the given theme.
  // Both demonstrate the rule that dark surfaces stack 3 deep.
  const isDark = mode === "dark";
  const bg     = isDark ? '#14120E' : '#FBF9F4';
  const surf1  = isDark ? '#221F19' : '#FFFFFF';
  const surf2  = isDark ? '#2E2A22' : '#F4F1EA';
  const border = isDark ? '#3A372E' : '#DDD6C6';
  const text   = isDark ? '#F6F2E6' : '#16140F';
  const muted  = isDark ? '#8E8A7E' : '#5F5A4E';
  const tertiary = isDark ? '#6F6C62' : '#807A6C';
  const accent = isDark ? '#E2B25F' : '#D49A3A';
  const headerWeight = isDark ? 500 : 600;

  return (
    <div style={{ background: bg, border: `1px solid ${border}`, borderRadius: 'var(--r-2)', padding: 14, display: 'flex', flexDirection: 'column', gap: 10 }}>
      <div className="oiq-mono" style={{ fontSize: 9.5, color: tertiary, letterSpacing: '0.08em', textTransform: 'uppercase' }}>
        {mode} · specimen
      </div>

      <div style={{ background: surf1, border: `1px solid ${border}`, borderRadius: 6, padding: '10px 12px', boxShadow: isDark ? 'none' : '0 1px 0 rgba(22,20,15,.04)' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
          <span style={{ width: 7, height: 7, borderRadius: '50%', background: accent }} />
          <span style={{ fontFamily: 'var(--sans)', fontWeight: headerWeight, fontSize: 13, color: text, letterSpacing: '-0.005em' }}>Today's queue</span>
          <span style={{ marginLeft: 'auto', fontFamily: 'var(--mono)', fontSize: 10, color: tertiary }}>6 open</span>
        </div>
        <div style={{ marginTop: 8, padding: '8px 10px', background: surf2, borderRadius: 4, display: 'flex', alignItems: 'center', gap: 8 }}>
          <span style={{ width: 16, height: 16, border: `1.4px solid ${muted}`, display: 'inline-block' }} />
          <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
            <span style={{ fontSize: 11.5, color: text, fontWeight: isDark ? 400 : 500 }}>Countersign I-9 Section 2</span>
            <span style={{ fontFamily: 'var(--mono)', fontSize: 9.5, color: muted, marginTop: 1 }}>Daniel Okafor · due 17:00 ET</span>
          </div>
          <span style={{
            fontFamily: 'var(--mono)', fontSize: 9.5, padding: '2px 6px',
            background: isDark ? '#3A2A0E' : '#F8ECCB',
            color: isDark ? '#E2B25F' : '#8B6017',
            borderRadius: 999,
          }}>warn · sla 4h</span>
        </div>
      </div>

      <div style={{ background: surf1, border: `1px solid ${border}`, borderRadius: 6, padding: '10px 12px' }}>
        <div style={{ display: 'flex', justifyContent: 'space-between' }}>
          <span style={{ fontSize: 11, color: muted }}>I-9 currency</span>
          <span style={{ fontFamily: 'var(--mono)', fontSize: 11, color: text }}>142 / 148</span>
        </div>
        <div style={{ marginTop: 6, height: 3, background: surf2, borderRadius: 999 }}>
          <div style={{ width: '96%', height: '100%', background: text, borderRadius: 999 }} />
        </div>
      </div>
    </div>
  );
}

function TypeCard() {
  return (
    <div className="oiq" style={{ padding: 32, height: '100%', background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 16 }}>
      <Header eyebrow="03 · Type" title="IBM Plex" subtitle="Sans · Mono · Serif" />

      <div style={{ display: 'flex', flexDirection: 'column', gap: 18, flex: 1 }}>
        <TypeRow tag="Display · 48 / 1.02 / -2%" weight="600" sample="From offer accepted to Day-1 ready in 11 days." size={42} />
        <TypeRow tag="Title · 24 / 1.15 / -1%" weight="600" sample="Compliance posture, 90-day window" size={22} />
        <TypeRow tag="Body · 14 / 1.5" weight="400" sample="Daniel uploaded Form I-9 Section 1 at 09:42 ET. Section 2 is owed by Theo Bramwell." size={14} ink="var(--ink-700)" />
        <TypeRow tag="Mono · 12 / 1.4" weight="500" mono sample="case_e-verify · 2026-05-13T14:02:11Z · tier-3" size={12} ink="var(--ink-700)" />
        <TypeRow tag="Eyebrow · 10.5 / 12% tracking" weight="500" mono sample="WORKFLOW · TEMPLATES · COMPLIANCE" size={10.5} ink="var(--ink-600)" />
        <TypeRow tag="Serif · 22 · certificates only" weight="400" serif sample="Certificate of Audit · executed under hash-chain custody" size={22} ink="var(--ink-800)" />
      </div>

      <div style={{ paddingTop: 12, borderTop: '1px solid var(--paper-300)', display: 'grid', gridTemplateColumns: 'repeat(3,1fr)', gap: 12 }}>
        <WeightChip name="Regular · 400" weight={400} />
        <WeightChip name="Medium · 500" weight={500} />
        <WeightChip name="Semibold · 600" weight={600} />
      </div>
    </div>
  );
}

function TypeRow({ tag, sample, size, weight, mono, serif, ink = "var(--ink-900)" }) {
  const fam = mono ? "var(--mono)" : serif ? "var(--serif)" : "var(--sans)";
  return (
    <div style={{ display: 'grid', gridTemplateColumns: '160px 1fr', alignItems: 'baseline', gap: 16 }}>
      <div className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-500)', letterSpacing: '0.04em' }}>{tag}</div>
      <div style={{
        fontFamily: fam, fontWeight: weight, fontSize: size, color: ink,
        letterSpacing: size > 24 ? '-0.02em' : (mono ? 0 : '-0.005em'),
        lineHeight: 1.15,
      }}>{sample}</div>
    </div>
  );
}

function WeightChip({ name, weight }) {
  return (
    <div style={{ border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', padding: '10px 12px' }}>
      <div className="oiq-mono" style={{ fontSize: 9.5, color: 'var(--ink-500)', marginBottom: 4 }}>{name}</div>
      <div style={{ fontFamily: 'var(--sans)', fontWeight: weight, fontSize: 22, color: 'var(--ink-900)' }}>Aa Bb Gg 0123</div>
    </div>
  );
}

// ───────────────────────────────────────────────────────────
// CARD 4 — VOICE & TONE
// ───────────────────────────────────────────────────────────

function VoiceCard() {
  const pairs = [
    { state: "Empty state · no onboardings yet", bad: "Looks like you haven't started anything yet! ✨", good: "No active onboardings. Start one from a template, or import a roster from CSV." },
    { state: "Success toast · I-9 verified", bad: "Awesome! Your form was submitted successfully.", good: "I-9 Section 2 countersigned by T. Bramwell at 09:42. E-Verify case opened. Result expected within the hour." },
    { state: "Destructive confirm · delete template", bad: "Are you sure you want to delete this template? This action cannot be undone.", good: "Delete \u201cContractor · 1099 · CA\u201d? 7 onboardings reference this template. They keep running. New onboardings can no longer use it." },
    { state: "Pricing line · what you're paying for", bad: "Unleash powerful, scalable, mission-critical onboarding.", good: "$8 per onboarding, billed at completion. No seat fees. Cancel without exit toll." },
  ];
  return (
    <div className="oiq" style={{ padding: 32, height: '100%', background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 16 }}>
      <Header eyebrow="04 · Voice" title="Specific, declarative, no marketing fluff" subtitle="Real names, real numbers, real times" />

      <div style={{ display: 'flex', flexDirection: 'column', gap: 10, flex: 1 }}>
        {pairs.map((p, i) => (
          <div key={i} style={{ border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', overflow: 'hidden', background: 'var(--paper-50)' }}>
            <div className="oiq-mono" style={{ padding: '6px 12px', background: 'var(--paper-100)', fontSize: 10, color: 'var(--ink-600)', letterSpacing: '0.06em', textTransform: 'uppercase', borderBottom: '1px solid var(--paper-300)' }}>{p.state}</div>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr' }}>
              <div style={{ padding: '10px 12px', borderRight: '1px solid var(--paper-300)' }}>
                <div className="oiq-mono" style={{ fontSize: 9.5, color: 'var(--red-500)', marginBottom: 4 }}>✕ AVOID</div>
                <div style={{ fontSize: 13, color: 'var(--ink-600)', lineHeight: 1.45, textDecoration: 'line-through', textDecorationColor: 'var(--red-100)' }}>{p.bad}</div>
              </div>
              <div style={{ padding: '10px 12px' }}>
                <div className="oiq-mono" style={{ fontSize: 9.5, color: 'var(--green-700)', marginBottom: 4 }}>✓ USE</div>
                <div style={{ fontSize: 13, color: 'var(--ink-900)', lineHeight: 1.45 }}>{p.good}</div>
              </div>
            </div>
          </div>
        ))}
      </div>

      <div style={{ paddingTop: 12, borderTop: '1px solid var(--paper-300)' }}>
        <div className="oiq-eyebrow" style={{ marginBottom: 8 }}>Banned · house style</div>
        <div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
          {["unleash","supercharge","seamless","mission-critical","world-class","robust","next-generation","✨ sparkle","em-dash —","AI-powered","best-in-class"].map(w => (
            <span key={w} className="oiq-mono" style={{ fontSize: 11, padding: '4px 8px', background: 'var(--paper-100)', border: '1px solid var(--paper-300)', borderRadius: 'var(--r-1)', color: 'var(--ink-600)', textDecoration: 'line-through' }}>{w}</span>
          ))}
        </div>
      </div>
    </div>
  );
}

// ───────────────────────────────────────────────────────────
// CARD 5 — ICONOGRAPHY
// ───────────────────────────────────────────────────────────

const Icon = ({ name, size = 20, stroke = 1.6 }) => {
  // 24-grid, square caps, no rounded joins. Custom for OnboardIQ.
  const props = {
    width: size, height: size, viewBox: "0 0 24 24", fill: "none",
    stroke: "currentColor", strokeWidth: stroke,
    strokeLinecap: "square", strokeLinejoin: "miter",
    "aria-hidden": "true",
  };
  switch (name) {
    case "dashboard": return (<svg {...props}><rect x="3" y="3" width="8" height="10" /><rect x="3" y="15" width="8" height="6" /><rect x="13" y="3" width="8" height="6" /><rect x="13" y="11" width="8" height="10" /></svg>);
    case "onboardings": return (<svg {...props}><path d="M3 7h6l3 3h9" /><path d="M3 13h6l3 3h9" /><path d="M3 19h18" /></svg>);
    case "templates": return (<svg {...props}><rect x="3" y="3" width="18" height="18" /><path d="M3 9h18M9 3v18" /></svg>);
    case "people": return (<svg {...props}><circle cx="9" cy="8" r="3" /><path d="M3 21c0-3.3 2.7-6 6-6s6 2.7 6 6" /><circle cx="17" cy="6" r="2.5" /><path d="M21 18c0-2.5-1.7-4.5-4-5" /></svg>);
    case "documents": return (<svg {...props}><path d="M6 3h9l4 4v14H6z" /><path d="M15 3v4h4M9 12h7M9 16h7M9 8h3" /></svg>);
    case "signature": return (<svg {...props}><path d="M3 18c2-1 4-5 6-5s2 4 4 4 2-7 4-7 2 3 4 3" /><path d="M3 21h18" /></svg>);
    case "shield": return (<svg {...props}><path d="M12 3l8 3v6c0 5-3.5 8.3-8 9-4.5-.7-8-4-8-9V6l8-3z" /><path d="M9 12l2 2 4-4" /></svg>);
    case "clearance": return (<svg {...props}><rect x="5" y="3" width="14" height="18" /><circle cx="12" cy="10" r="2.5" /><path d="M9 15h6M9 18h6" /></svg>);
    case "audit": return (<svg {...props}><rect x="3" y="3" width="18" height="18" /><path d="M7 8h10M7 12h10M7 16h6" /><circle cx="18" cy="17" r="2.5" /><path d="M19.8 18.8L21.5 20.5" /></svg>);
    case "equipment": return (<svg {...props}><rect x="3" y="5" width="18" height="11" /><path d="M2 19h20M9 16v3M15 16v3" /></svg>);
    case "training": return (<svg {...props}><path d="M3 6l9-3 9 3-9 3z" /><path d="M3 6v6M21 6v6M7 8v6c0 1.5 2.2 3 5 3s5-1.5 5-3V8" /></svg>);
    case "integration": return (<svg {...props}><rect x="3" y="3" width="7" height="7" /><rect x="14" y="3" width="7" height="7" /><rect x="3" y="14" width="7" height="7" /><rect x="14" y="14" width="7" height="7" /><path d="M10 6.5h4M6.5 10v4M17.5 10v4M10 17.5h4" /></svg>);
    case "search": return (<svg {...props}><circle cx="11" cy="11" r="6" /><path d="M16 16l5 5" /></svg>);
    case "bell": return (<svg {...props}><path d="M6 16V11a6 6 0 1112 0v5l2 2H4l2-2z" /><path d="M10 21h4" /></svg>);
    case "plus": return (<svg {...props}><path d="M12 5v14M5 12h14" /></svg>);
    case "filter": return (<svg {...props}><path d="M3 5h18l-7 9v6l-4-2v-4z" /></svg>);
    case "chevron-r": return (<svg {...props}><path d="M9 5l7 7-7 7" /></svg>);
    case "chevron-d": return (<svg {...props}><path d="M5 9l7 7 7-7" /></svg>);
    case "check": return (<svg {...props}><path d="M4 12l5 5L20 6" /></svg>);
    case "x": return (<svg {...props}><path d="M5 5l14 14M19 5L5 19" /></svg>);
    case "clock": return (<svg {...props}><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 3" /></svg>);
    case "external": return (<svg {...props}><path d="M14 5h5v5" /><path d="M19 5L11 13" /><path d="M19 14v5H5V5h5" /></svg>);
    case "calendar": return (<svg {...props}><rect x="3" y="5" width="18" height="16" /><path d="M3 10h18M8 3v4M16 3v4" /></svg>);
    case "lock": return (<svg {...props}><rect x="5" y="11" width="14" height="10" /><path d="M8 11V7a4 4 0 018 0v4" /></svg>);
    case "flag": return (<svg {...props}><path d="M5 3v18M5 4h13l-2 4 2 4H5" /></svg>);
    case "pause": return (<svg {...props}><rect x="6" y="5" width="4" height="14"/><rect x="14" y="5" width="4" height="14"/></svg>);
    case "more": return (<svg {...props}><circle cx="6" cy="12" r="1.2" fill="currentColor"/><circle cx="12" cy="12" r="1.2" fill="currentColor"/><circle cx="18" cy="12" r="1.2" fill="currentColor"/></svg>);
    case "send": return (<svg {...props}><path d="M3 12L21 4l-7 17-3-7z" /></svg>);
    case "upload": return (<svg {...props}><path d="M12 16V4M6 10l6-6 6 6" /><path d="M4 20h16" /></svg>);
    case "alert": return (<svg {...props}><path d="M12 3L2 21h20z" /><path d="M12 10v5M12 18v0.5" /></svg>);
    case "branch": return (<svg {...props}><circle cx="6" cy="5" r="2" /><circle cx="6" cy="19" r="2" /><circle cx="18" cy="12" r="2" /><path d="M6 7v10M6 12h10" /></svg>);
    case "settings": return (<svg {...props}><circle cx="12" cy="12" r="3" /><path d="M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M19 5l-2 2M7 17l-2 2"/></svg>);
    default: return null;
  }
};

function IconCard() {
  const set = [
    "dashboard","onboardings","templates","people","documents","signature",
    "shield","clearance","audit","equipment","training","integration",
    "search","bell","filter","calendar","clock","lock","flag","branch",
    "upload","send","alert","external","chevron-r","chevron-d","check","x",
    "plus","more","pause","settings",
  ];
  return (
    <div className="oiq" style={{ padding: 32, height: '100%', background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 16 }}>
      <Header eyebrow="05 · Iconography" title="32 icons · 24-grid" subtitle="1.6px stroke · square caps · miter joins" />

      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(8, 1fr)', gap: 8, flex: 1, alignContent: 'start' }}>
        {set.map(n => (
          <div key={n} style={{
            display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
            padding: '14px 8px', border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', gap: 8,
            background: 'var(--paper-50)',
          }}>
            <Icon name={n} size={22} />
            <div className="oiq-mono" style={{ fontSize: 9, color: 'var(--ink-500)', letterSpacing: '0.04em' }}>{n}</div>
          </div>
        ))}
      </div>

      <div style={{ paddingTop: 12, borderTop: '1px solid var(--paper-300)', display: 'flex', gap: 16, alignItems: 'center' }}>
        <div className="oiq-eyebrow">Construction</div>
        <div style={{ display: 'flex', alignItems: 'center', gap: 12, fontSize: 11, color: 'var(--ink-600)' }}>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6 }}><Icon name="dashboard" size={32} /> 24px grid</span>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6 }}><Icon name="shield" size={32} stroke={1.6} /> 1.6 stroke</span>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6 }}><Icon name="signature" size={32} /> square caps</span>
        </div>
      </div>
    </div>
  );
}

// ───────────────────────────────────────────────────────────
// CARD 6 — MOTION
// ───────────────────────────────────────────────────────────

function MotionCard() {
  return (
    <div className="oiq" style={{ padding: 32, height: '100%', background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 16 }}>
      <Header eyebrow="06 · Motion" title="Considered, never decorative" subtitle="120ms · cubic-bezier(0.4, 0.0, 0.2, 1)" />

      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12, flex: 1 }}>
        <MotionRow label="State change · 120ms" subtitle="hover · focus · pressed" demoKey="state" />
        <MotionRow label="Reveal · 180ms" subtitle="dropdown · popover · toast" demoKey="reveal" />
        <MotionRow label="Page seam · 240ms" subtitle="route · drawer · sheet" demoKey="page" />
        <MotionRow label="Reduced motion" subtitle="prefers-reduced-motion · disable all easing" demoKey="reduce" />
      </div>

      <div style={{ paddingTop: 12, borderTop: '1px solid var(--paper-300)' }}>
        <div className="oiq-eyebrow" style={{ marginBottom: 6 }}>Principles</div>
        <div style={{ fontSize: 12, color: 'var(--ink-700)', lineHeight: 1.55, maxWidth: 720 }}>
          Motion announces state, never decorates it. No parallax, no autoplay video, no spring overshoot.
          A button has 3 states, not 7. A drawer slides in 240ms; the same drawer slides out 240ms.
          If a user has reduced-motion on, every animation collapses to opacity or nothing.
        </div>
      </div>
    </div>
  );
}

function MotionRow({ label, subtitle, demoKey }) {
  const [tick, setTick] = React.useState(0);
  React.useEffect(() => {
    const t = setInterval(() => setTick(x => x + 1), 1800);
    return () => clearInterval(t);
  }, []);
  const dur = demoKey === "state" ? 120 : demoKey === "reveal" ? 180 : demoKey === "page" ? 240 : 0;
  const phase = tick % 2;

  return (
    <div style={{ border: '1px solid var(--paper-300)', borderRadius: 'var(--r-2)', padding: 14, background: 'var(--paper-50)', display: 'flex', flexDirection: 'column', gap: 8 }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
        <div style={{ fontSize: 13, fontWeight: 500, color: 'var(--ink-900)' }}>{label}</div>
        <div className="oiq-mono" style={{ fontSize: 10, color: 'var(--ink-500)' }}>{subtitle}</div>
      </div>
      <div style={{
        height: 56,
        background: 'var(--paper-100)',
        border: '1px dashed var(--paper-300)',
        borderRadius: 'var(--r-2)',
        position: 'relative',
        overflow: 'hidden',
      }}>
        <div style={{
          position: 'absolute', top: 12, left: phase ? '60%' : '8%',
          width: 32, height: 32, background: 'var(--amber-500)',
          transition: `left ${dur}ms cubic-bezier(0.4, 0, 0.2, 1), background ${dur}ms`,
          borderRadius: 'var(--r-2)',
        }} />
        <div className="oiq-mono" style={{ position: 'absolute', bottom: 4, right: 8, fontSize: 9, color: 'var(--ink-500)' }}>
          {dur}ms
        </div>
      </div>
    </div>
  );
}

// ───────────────────────────────────────────────────────────
// SHARED — header + panel
// ───────────────────────────────────────────────────────────

function Header({ eyebrow, title, subtitle }) {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
      <div className="oiq-eyebrow">{eyebrow}</div>
      <div style={{ fontFamily: 'var(--sans)', fontWeight: 600, fontSize: 24, letterSpacing: '-0.02em', color: 'var(--ink-900)' }}>{title}</div>
      <div style={{ fontSize: 13, color: 'var(--ink-600)' }}>{subtitle}</div>
    </div>
  );
}

function Panel({ label, children, dark }) {
  return (
    <div style={{
      border: dark ? 'none' : '1px solid var(--paper-300)',
      borderRadius: 'var(--r-2)',
      background: dark ? 'var(--ink-900)' : 'var(--paper-50)',
      padding: 16,
      display: 'flex',
      flexDirection: 'column',
      gap: 12,
      minHeight: 160,
    }}>
      <div className="oiq-mono" style={{ fontSize: 9.5, color: dark ? 'rgba(255,255,255,.5)' : 'var(--ink-500)', letterSpacing: '0.08em', textTransform: 'uppercase' }}>
        {label}
      </div>
      {children}
    </div>
  );
}

// Export to window so other files can use
Object.assign(window, {
  StepMark, SealMark, Wordmark, Lockup, Icon,
  LogoCard, ColorCard, TypeCard, ThemeCard, VoiceCard, IconCard, MotionCard,
  OiqHeader: Header,
});
