// about-graphics.jsx — small looping illustrations for the About page cards.
// Pure SVG + CSS keyframes (styles in editorial.css, "About card art").
// Reduced motion: each graphic shows its finished state, without movement.

// 1 · Clinician-built — a note is written, reviewed, and signed.
function ArtNoteSign() {
  const lines = [[86, 30, 150], [86, 42, 158], [86, 54, 146], [86, 66, 154]];
  return (
    <svg viewBox="0 0 240 120" className="art art-note" aria-hidden="true">
      <rect className="art-paper" x="70" y="14" width="100" height="94" rx="8" />
      <rect className="art-review" x="82" y="49" width="80" height="10" rx="3" />
      {lines.map(([x, y, x2], i) => (
        <line key={i} className="art-line" x1={x} y1={y} x2={x2} y2={y} pathLength="1"
          style={{ animationDelay: (i * 0.35) + 's' }} />
      ))}
      <path className="art-sign" pathLength="1"
        d="M88 92 C 92 82, 98 82, 98 90 S 104 98, 110 88 S 118 80, 120 90 S 128 96, 134 88 L 150 88" />
      <g className="art-check-badge" transform="translate(170 22)">
        <circle r="11" />
        <path d="M-4.5 0.5 L-1.2 3.8 L5 -3.2" />
      </g>
    </svg>
  );
}

// 2 · Why we're here — clinicians, engineers and founders converge.
function ArtConverge() {
  const nodes = [
    { x: 120, y: 22, k: 'clin' },   // clinician (medical cross)
    { x: 64, y: 98, k: 'eng' },     // engineer (code brackets)
    { x: 176, y: 98, k: 'found' }   // founder (rising arrow)
  ];
  return (
    <svg viewBox="0 0 240 120" className="art art-converge" aria-hidden="true">
      <g className="art-tri">
        <line x1="120" y1="22" x2="64" y2="98" pathLength="1" />
        <line x1="64" y1="98" x2="176" y2="98" pathLength="1" />
        <line x1="176" y1="98" x2="120" y2="22" pathLength="1" />
      </g>
      {nodes.map((n) => (
        <line key={'s' + n.k} className="art-spoke" x1={n.x} y1={n.y} x2="120" y2="72" pathLength="1" />
      ))}
      <circle className="art-core-ring" cx="120" cy="72" r="10" />
      <circle className="art-core" cx="120" cy="72" r="7" />
      {nodes.map((n, i) => (
        <g key={n.k} className={'art-node art-node-' + n.k} style={{ '--i': i }}>
          <g transform={`translate(${n.x} ${n.y})`}>
            <circle r="14" />
            {n.k === 'clin' && <path className="art-glyph" d="M-2.5 -7 h5 v4.5 h4.5 v5 h-4.5 v4.5 h-5 v-4.5 h-4.5 v-5 h4.5 z" />}
            {n.k === 'eng' && <path className="art-glyph-s" d="M-3 -5 L-8 0 L-3 5 M3 -5 L8 0 L3 5" />}
            {n.k === 'found' && <path className="art-glyph-s" d="M-7 5 L-2 0 L1 3 L7 -4 M2.5 -4 H7 V0.5" />}
          </g>
        </g>
      ))}
    </svg>
  );
}

// 3 · Our first product — a note checked against payer criteria; one gap is
// flagged, then addressed.
function ArtCriteria() {
  const rows = [30, 58, 86];
  return (
    <svg viewBox="0 0 240 120" className="art art-criteria" aria-hidden="true">
      <rect className="art-paper" x="22" y="14" width="78" height="94" rx="8" />
      {[32, 44, 56, 68, 80].map((y, i) => (
        <line key={y} className="art-line art-line-static" x1="34" y1={y} x2={i % 2 ? 84 : 90} y2={y} />
      ))}
      <rect className="art-scan" x="28" y="26" width="66" height="10" rx="3" />
      {rows.map((y, i) => (
        <g key={y} className={'art-row art-row-' + i}>
          <rect className="art-box" x="122" y={y - 9} width="18" height="18" rx="5" />
          <path className="art-tick" pathLength="1" d={`M126 ${y} l3.6 3.6 l6.4 -7`} />
          {i === 1 && <g className="art-flag"><circle cx="131" cy={y} r="9" /><path d={`M131 ${y - 4.5} v5 M131 ${y + 3.6} v0.4`} /></g>}
          <rect className="art-crit" x="148" y={y - 3} width={i === 1 ? 62 : 70 - i * 8} height="6" rx="3" />
        </g>
      ))}
    </svg>
  );
}

Object.assign(window, { ArtNoteSign, ArtConverge, ArtCriteria });
