// eixo-symbols.jsx — The Eixo Pharma symbol family.
// Four variants of the mark, each riffing on the HPTA axis idea (vertical
// spine with three nodes = hypothalamus, pituitary, gonads). All marks are
// renderable in any color via the `fg` prop, and any size via `size`.

const EixoHPTA = ({ size = 64, fg = "currentColor", thick = false }) => {
  // Vertical spine with three nodes. Top node (small) = hypothalamus,
  // middle (medium) = pituitary, bottom (large) = gonads/HPTA endpoint.
  const sw = thick ? 7 : 5;
  return (
    <svg width={size} height={size} viewBox="0 0 64 64" fill="none">
      <line x1="32" y1="6" x2="32" y2="58" stroke={fg} strokeWidth={sw} strokeLinecap="square" />
      <circle cx="32" cy="14" r={thick ? 5.5 : 4.5} fill={fg} />
      <circle cx="32" cy="32" r={thick ? 8.5 : 7.5} fill={fg} />
      <circle cx="32" cy="52" r={thick ? 6.5 : 5.5} fill={fg} />
    </svg>
  );
};

const EixoDelta = ({ size = 64, fg = "currentColor", thick = false }) => {
  // Solid triangle (delta = change) with the HPTA spine bisecting it.
  const sw = thick ? 6 : 4;
  return (
    <svg width={size} height={size} viewBox="0 0 64 64" fill="none">
      <path d="M32 6 L58 56 L6 56 Z" stroke={fg} strokeWidth={sw} strokeLinejoin="miter" fill="none" />
      <line x1="32" y1="14" x2="32" y2="56" stroke={fg} strokeWidth={sw} strokeLinecap="square" />
      <circle cx="32" cy="32" r={thick ? 5 : 4} fill={fg} />
      <circle cx="32" cy="48" r={thick ? 3.5 : 3} fill={fg} />
    </svg>
  );
};

const EixoEMark = ({ size = 64, fg = "currentColor", thick = false }) => {
  // Bold "E" built from the axis idea — single vertical bar, three rungs of
  // varying length. Reads as both 'E' and as the HPTA spine.
  const sw = thick ? 9 : 7;
  return (
    <svg width={size} height={size} viewBox="0 0 64 64" fill="none">
      <line x1="14" y1="6" x2="14" y2="58" stroke={fg} strokeWidth={sw} strokeLinecap="square" />
      <line x1="14" y1="12" x2="46" y2="12" stroke={fg} strokeWidth={sw} strokeLinecap="square" />
      <line x1="14" y1="32" x2="38" y2="32" stroke={fg} strokeWidth={sw} strokeLinecap="square" />
      <line x1="14" y1="52" x2="54" y2="52" stroke={fg} strokeWidth={sw} strokeLinecap="square" />
    </svg>
  );
};

const EixoSelo = ({ size = 64, fg = "currentColor", thick = false }) => {
  // Stamp / seal — circle with the HPTA mark centered and "EIXO" microcopy
  // arcing along the top edge of the inner ring.
  const sw = thick ? 3 : 2;
  return (
    <svg width={size} height={size} viewBox="0 0 64 64" fill="none">
      <circle cx="32" cy="32" r="29" stroke={fg} strokeWidth={sw} fill="none" />
      <circle cx="32" cy="32" r="23" stroke={fg} strokeWidth={sw * 0.6} fill="none" opacity="0.45" />
      <line x1="32" y1="18" x2="32" y2="46" stroke={fg} strokeWidth={sw * 1.8} strokeLinecap="square" />
      <circle cx="32" cy="22" r="2" fill={fg} />
      <circle cx="32" cy="32" r="3.2" fill={fg} />
      <circle cx="32" cy="42" r="2.6" fill={fg} />
    </svg>
  );
};

const EixoSymbol = ({ variant = "hpta", size = 64, fg = "currentColor", thick = false }) => {
  const Map = { hpta: EixoHPTA, delta: EixoDelta, emark: EixoEMark, selo: EixoSelo };
  const Cmp = Map[variant] || EixoHPTA;
  return <Cmp size={size} fg={fg} thick={thick} />;
};

// Pictograms used across all three directions. Drawn at 32x32, line-based.
const Pictograms = {
  pill: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <rect x="3" y="11" width="26" height="10" rx="5" stroke={c} strokeWidth="2" />
      <line x1="16" y1="11" x2="16" y2="21" stroke={c} strokeWidth="2" />
    </svg>
  ),
  syringe: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <line x1="6" y1="26" x2="20" y2="12" stroke={c} strokeWidth="2" strokeLinecap="square" />
      <rect x="17" y="9" width="9" height="9" rx="0" transform="rotate(45 21.5 13.5)" stroke={c} strokeWidth="2" />
      <line x1="2" y1="30" x2="6" y2="26" stroke={c} strokeWidth="2" strokeLinecap="square" />
      <line x1="12" y1="16" x2="16" y2="20" stroke={c} strokeWidth="2" />
    </svg>
  ),
  flask: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <path d="M12 3 L12 13 L6 27 H26 L20 13 L20 3 Z" stroke={c} strokeWidth="2" strokeLinejoin="miter" />
      <line x1="10" y1="3" x2="22" y2="3" stroke={c} strokeWidth="2" />
      <line x1="8.5" y1="20" x2="23.5" y2="20" stroke={c} strokeWidth="2" />
    </svg>
  ),
  dumbbell: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <rect x="2" y="11" width="4" height="10" stroke={c} strokeWidth="2" />
      <rect x="26" y="11" width="4" height="10" stroke={c} strokeWidth="2" />
      <line x1="6" y1="16" x2="26" y2="16" stroke={c} strokeWidth="2" />
      <rect x="8" y="13" width="4" height="6" stroke={c} strokeWidth="2" />
      <rect x="20" y="13" width="4" height="6" stroke={c} strokeWidth="2" />
    </svg>
  ),
  hormone: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <path d="M6 22 L12 12 L20 22 L26 12" stroke={c} strokeWidth="2" strokeLinejoin="miter" fill="none" />
      <circle cx="12" cy="12" r="2" fill={c} />
      <circle cx="20" cy="22" r="2" fill={c} />
    </svg>
  ),
  chart: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <polyline points="4,24 12,16 18,20 28,8" stroke={c} strokeWidth="2" fill="none" strokeLinejoin="miter" />
      <line x1="3" y1="28" x2="29" y2="28" stroke={c} strokeWidth="2" />
      <line x1="4" y1="4" x2="4" y2="28" stroke={c} strokeWidth="2" />
    </svg>
  ),
  shield: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <path d="M16 3 L27 7 V16 C27 22 22 27 16 29 C10 27 5 22 5 16 V7 Z" stroke={c} strokeWidth="2" />
      <line x1="16" y1="11" x2="16" y2="20" stroke={c} strokeWidth="2" />
      <line x1="12" y1="15" x2="20" y2="15" stroke={c} strokeWidth="2" />
    </svg>
  ),
  people: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <circle cx="11" cy="11" r="4" stroke={c} strokeWidth="2" />
      <circle cx="22" cy="13" r="3.5" stroke={c} strokeWidth="2" />
      <path d="M3 27 C3 22 7 19 11 19 C15 19 19 22 19 27" stroke={c} strokeWidth="2" fill="none" />
      <path d="M18 27 C18 23 21 21 22 21 C24 21 29 22 29 27" stroke={c} strokeWidth="2" fill="none" />
    </svg>
  ),
  book: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <path d="M5 5 H14 C16 5 16 7 16 9 V28 C16 26 15 24 13 24 H5 Z" stroke={c} strokeWidth="2" strokeLinejoin="miter" />
      <path d="M27 5 H18 C16 5 16 7 16 9 V28 C16 26 17 24 19 24 H27 Z" stroke={c} strokeWidth="2" strokeLinejoin="miter" />
    </svg>
  ),
  spine: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <line x1="16" y1="3" x2="16" y2="29" stroke={c} strokeWidth="2" />
      <circle cx="16" cy="8" r="2" fill={c} />
      <circle cx="16" cy="16" r="3" fill={c} />
      <circle cx="16" cy="24" r="2.5" fill={c} />
    </svg>
  ),
  target: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <circle cx="16" cy="16" r="12" stroke={c} strokeWidth="2" />
      <circle cx="16" cy="16" r="7" stroke={c} strokeWidth="2" />
      <circle cx="16" cy="16" r="2" fill={c} />
    </svg>
  ),
  cycle: (s = 24, c = "currentColor") => (
    <svg width={s} height={s} viewBox="0 0 32 32" fill="none">
      <path d="M6 12 A10 10 0 0 1 26 14" stroke={c} strokeWidth="2" fill="none" />
      <path d="M26 20 A10 10 0 0 1 6 18" stroke={c} strokeWidth="2" fill="none" />
      <polyline points="22,8 26,14 20,14" stroke={c} strokeWidth="2" fill="none" strokeLinejoin="miter" />
      <polyline points="10,24 6,18 12,18" stroke={c} strokeWidth="2" fill="none" strokeLinejoin="miter" />
    </svg>
  ),
};

// A reusable placeholder image — striped diagonal with a tiny mono label.
const PhotoSlot = ({ w = "100%", h = 180, label = "PHOTO", fg = "#999", bg = "#eee", radius = 0 }) => (
  <div style={{
    width: w, height: h, borderRadius: radius, position: "relative", overflow: "hidden",
    backgroundColor: bg,
    backgroundImage: `repeating-linear-gradient(135deg, ${fg}22 0 1px, transparent 1px 9px)`,
    border: `1px solid ${fg}33`,
    display: "flex", alignItems: "flex-end", justifyContent: "flex-start",
    fontFamily: "ui-monospace, 'JetBrains Mono', SFMono-Regular, monospace",
    fontSize: 9, letterSpacing: "0.12em", textTransform: "uppercase",
    color: fg, padding: "8px 10px",
  }}>
    <span>↳ {label}</span>
  </div>
);

Object.assign(window, { EixoSymbol, EixoHPTA, EixoDelta, EixoEMark, EixoSelo, Pictograms, PhotoSlot });
