/* Functional line-glyphs for tool affordances + status.
   Drawn in a consistent ink stroke; the brand PNG icons are used
   for section accents elsewhere. */
const S = ({ d, fill, vb = 24, sw = 2, extra }) => (
  <svg viewBox={`0 0 ${vb} ${vb}`} fill={fill ? 'currentColor' : 'none'} stroke={fill ? 'none' : 'currentColor'}
       strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
    {d}{extra}
  </svg>
);

const PCI = {
  drawPoly:  <S d={<><path d="M4 7l8-3 8 4-2 9-9 2-5-5z"/><circle cx="4" cy="7" r="1.6" fill="currentColor" stroke="none"/><circle cx="12" cy="4" r="1.6" fill="currentColor" stroke="none"/><circle cx="20" cy="8" r="1.6" fill="currentColor" stroke="none"/><circle cx="18" cy="17" r="1.6" fill="currentColor" stroke="none"/><circle cx="9" cy="19" r="1.6" fill="currentColor" stroke="none"/><circle cx="4" cy="14" r="1.6" fill="currentColor" stroke="none"/></>}/>,
  editPoly:  <S d={<><path d="M5 8l6-3 8 4-2 8-8 2-4-4z" opacity="0.9"/><path d="M14.5 14.5l5-5 2 2-5 5-2.6.6z" fill="currentColor" stroke="currentColor"/></>}/>,
  address:   <S d={<><path d="M12 21s7-6.3 7-11a7 7 0 1 0-14 0c0 4.7 7 11 7 11z"/><circle cx="12" cy="10" r="2.5"/></>}/>,
  ruler:     <S d={<><rect x="2.5" y="8" width="19" height="8" rx="1.5" transform="rotate(-2 12 12)"/><path d="M7 8.5v3M11 8v3M15 7.5v3M19 7v3"/></>}/>,
  area:      <S d={<><path d="M4 5h7M4 5v7M20 19h-7M20 19v-7"/><rect x="4" y="5" width="16" height="14" rx="1" strokeDasharray="2.5 2.5" opacity="0.85"/></>}/>,
  layers:    <S d={<><path d="M12 3l9 5-9 5-9-5 9-5z"/><path d="M3 13l9 5 9-5"/></>}/>,
  map:       <S d={<><path d="M9 4L3 6v14l6-2 6 2 6-2V4l-6 2-6-2z"/><path d="M9 4v14M15 6v14"/></>}/>,
  list:      <S d={<><path d="M8 6h12M8 12h12M8 18h12"/><circle cx="4" cy="6" r="1.3" fill="currentColor" stroke="none"/><circle cx="4" cy="12" r="1.3" fill="currentColor" stroke="none"/><circle cx="4" cy="18" r="1.3" fill="currentColor" stroke="none"/></>}/>,
  check:     <S d={<path d="M5 13l4 4L19 7"/> } sw={2.6}/>,
  alert:     <S d={<><path d="M12 8v5"/><circle cx="12" cy="16.5" r="0.4" fill="currentColor" stroke="currentColor" strokeWidth="1.6"/></>} sw={2.4}/>,
  cross:     <S d={<path d="M7 7l10 10M17 7L7 17"/>} sw={2.6}/>,
  dash:      <S d={<path d="M8 12h8"/>} sw={2.6}/>,
  chevron:   <S d={<path d="M9 6l6 6-6 6"/>} sw={2.2}/>,
  close:     <S d={<path d="M6 6l12 12M18 6L6 18"/>} sw={2.2}/>,
  search:    <S d={<><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></>}/>,
  download:  <S d={<><path d="M12 4v11M7 11l5 5 5-5"/><path d="M5 20h14"/></>}/>,
  sun:       <S d={<><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M19 5l-1.5 1.5M6.5 17.5L5 19"/></>} sw={1.8}/>,
  contour:   <S d={<><path d="M3 9c4-3 6 3 10 1s5-3 8-1"/><path d="M3 14c4-3 6 3 10 1s5-3 8-1"/><path d="M3 19c4-3 6 3 10 1s5-3 8-1"/></>} sw={1.8}/>,
  plus:      <S d={<path d="M12 5v14M5 12h14"/>} sw={2.2}/>,
  pin:       <S d={<><path d="M12 21s7-6.3 7-11a7 7 0 1 0-14 0c0 4.7 7 11 7 11z"/><circle cx="12" cy="10" r="2.5"/></>}/>,
  clock:     <S d={<><circle cx="12" cy="12" r="8"/><path d="M12 8v4l3 2"/></>} sw={1.9}/>,
};

// status → glyph + class
const PC_STATUS = {
  green:   { glyph: PCI.check, label: 'Pass',    cls: 'green' },
  amber:   { glyph: PCI.alert, label: 'Caution', cls: 'amber' },
  red:     { glyph: PCI.cross, label: 'Flag',    cls: 'red' },
  unknown: { glyph: PCI.dash,  label: 'Pending', cls: 'unknown' },
};

window.PCI = PCI;
window.PC_STATUS = PC_STATUS;
