// Albanna Conwood — custom hairline SVG icons (luxe, editorial)

const Icon = ({ name, size = 28, stroke = 1.25, className = "", color = "currentColor" }) => {
  const s = size;
  const cx = 12, cy = 12;
  const common = {
    width: s, height: s, viewBox: "0 0 24 24",
    fill: "none", stroke: color, strokeWidth: stroke,
    strokeLinecap: "round", strokeLinejoin: "round",
    className: `icon icon--${name} ${className}`, "aria-hidden": "true",
  };

  // Most icons sit inside a hairline circle frame for a coin-medallion feel
  const Frame = () => <circle cx={cx} cy={cy} r="10.5" opacity="0.35" />;

  switch (name) {
    case "phone":
      return (
        <svg {...common}>
          <Frame />
          <path d="M9 8.5 c0 3.6 2.9 6.5 6.5 6.5 l1.2 -1.6 -2.3 -1 -1 1 a5.5 5.5 0 0 1 -2.8 -2.8 l1 -1 -1 -2.3 -1.6 1.2 z" />
        </svg>
      );
    case "whatsapp":
      // Actual WhatsApp glyph — solid, brand-recognisable
      return (
        <svg
          width={s}
          height={s}
          viewBox="0 0 32 32"
          fill={color}
          className={`icon icon--${name} ${className}`}
          aria-hidden="true"
        >
          <path d="M16.001 3.2c-7.07 0-12.8 5.73-12.8 12.8 0 2.262.595 4.473 1.727 6.42L3.2 28.8l6.55-1.706a12.78 12.78 0 0 0 6.25 1.611h.001c7.07 0 12.8-5.73 12.8-12.8s-5.731-12.705-12.8-12.705zm0 23.376a10.59 10.59 0 0 1-5.396-1.478l-.386-.23-4.066 1.061 1.082-3.962-.252-.41a10.55 10.55 0 0 1-1.62-5.616c0-5.876 4.781-10.654 10.66-10.654 2.846 0 5.521 1.108 7.534 3.122a10.56 10.56 0 0 1 3.12 7.536c-.005 5.876-4.787 10.631-10.676 10.631zm5.846-7.972c-.32-.16-1.895-.935-2.188-1.042-.294-.107-.508-.16-.722.16-.213.32-.828 1.041-1.015 1.255-.187.214-.374.24-.694.08-.32-.16-1.352-.498-2.575-1.589-.952-.85-1.594-1.898-1.781-2.218-.187-.32-.02-.493.14-.652.144-.143.32-.374.48-.561.16-.187.213-.32.32-.534.107-.214.053-.4-.027-.561-.08-.16-.722-1.742-.99-2.387-.26-.626-.524-.541-.722-.55-.187-.01-.4-.012-.614-.012-.214 0-.561.08-.855.4-.294.32-1.122 1.097-1.122 2.677 0 1.58 1.149 3.107 1.309 3.32.16.214 2.262 3.453 5.477 4.842.766.33 1.363.527 1.829.675.768.244 1.467.21 2.02.127.616-.092 1.895-.775 2.163-1.523.267-.748.267-1.39.187-1.523-.08-.133-.293-.213-.614-.373z"/>
        </svg>
      );
    case "mail":
      return (
        <svg {...common}>
          <Frame />
          <rect x="6.5" y="9" width="11" height="7" rx="0.5" />
          <path d="M6.8 9.5 L12 13.2 L17.2 9.5" />
        </svg>
      );
    case "pin":
      return (
        <svg {...common}>
          <Frame />
          <path d="M12 6.8 c-2.2 0 -4 1.8 -4 4 0 3.2 4 6.4 4 6.4 s4 -3.2 4 -6.4 c0 -2.2 -1.8 -4 -4 -4 z" />
          <circle cx="12" cy="10.8" r="1.4" />
        </svg>
      );
    // Disciplines
    case "structure":
      // Column / classical pillar — capital, shaft with flutes, base
      return (
        <svg {...common}>
          <Frame />
          <path d="M7.5 17.5 H16.5" />
          <path d="M7.5 17.5 V16.2 H16.5 V17.5" />
          <path d="M8.4 16.2 V8.4 H15.6 V16.2" />
          <path d="M10 8.4 V16.2 M12 8.4 V16.2 M14 8.4 V16.2" opacity="0.55" />
          <path d="M7.5 8.4 H16.5" />
          <path d="M7.5 8.4 V7.1 H16.5 V8.4" />
        </svg>
      );
    case "finish":
      // Trowel / mason — diamond blade with handle
      return (
        <svg {...common}>
          <Frame />
          <path d="M6.8 13.4 L11 9.2 L17.2 15.4 L13 19.6 z" transform="translate(0,-2.5)"/>
          <path d="M14.5 9 L16.6 6.9" />
          <circle cx="17" cy="6.5" r="0.8" />
        </svg>
      );
    case "mep":
      // Compass / dividers — engineer's tool
      return (
        <svg {...common}>
          <Frame />
          <circle cx="12" cy="7.5" r="1.1" />
          <path d="M12 8.6 L8.5 16.5" />
          <path d="M12 8.6 L15.5 16.5" />
          <path d="M9.6 13.8 a3.5 3.5 0 0 0 4.8 0" />
        </svg>
      );
    case "joinery":
      // Cross-cut joinery — interlocking lines (dovetail mark)
      return (
        <svg {...common}>
          <Frame />
          <path d="M7 9 H17" />
          <path d="M7 15 H17" />
          <path d="M9 9 L11 15" />
          <path d="M13 9 L15 15" />
          <path d="M11 9 L13 15" opacity="0.4"/>
          <path d="M9 15 L11 9" opacity="0.4"/>
        </svg>
      );
    // Values
    case "heritage":
      // Two overlapping rings — generations
      return (
        <svg {...common}>
          <Frame />
          <circle cx="10" cy="12" r="3.2" />
          <circle cx="14" cy="12" r="3.2" />
        </svg>
      );
    case "precision":
      // Plumb-line
      return (
        <svg {...common}>
          <Frame />
          <path d="M12 6.5 V14.5" />
          <path d="M10.5 14.5 H13.5 L12 17.5 z" />
          <path d="M9.5 6.5 H14.5" />
        </svg>
      );
    case "excellence":
      // Tiny rosette / 4-point compass star
      return (
        <svg {...common}>
          <Frame />
          <path d="M12 6.5 L13 11 L17.5 12 L13 13 L12 17.5 L11 13 L6.5 12 L11 11 z" />
        </svg>
      );
    case "ownership":
      // Single seal — circle with monogram-bar
      return (
        <svg {...common}>
          <Frame />
          <circle cx="12" cy="12" r="4.2" />
          <path d="M9.5 12 H14.5" />
        </svg>
      );
    case "knowhow":
      // Drafting dividers — two legs from a pivot, with a small arc
      return (
        <svg {...common}>
          <Frame />
          <circle cx="12" cy="7.5" r="0.9" />
          <path d="M12 8.2 L9 16.5" />
          <path d="M12 8.2 L15 16.5" />
          <path d="M9.8 14.2 Q12 15.4 14.2 14.2" />
        </svg>
      );
    case "balance":
      // Scales — fairness
      return (
        <svg {...common}>
          <Frame />
          <path d="M12 6.5 V17" />
          <path d="M7 9 H17" />
          <path d="M7 9 L5.5 12.5 Q7 13.8 8.5 12.5 Z" />
          <path d="M17 9 L15.5 12.5 Q17 13.8 18.5 12.5 Z" />
          <path d="M10 17 H14" />
        </svg>
      );
    case "speed":
      // Forward chevrons — speed
      return (
        <svg {...common}>
          <Frame />
          <path d="M8 8 L12 12 L8 16" />
          <path d="M13 8 L17 12 L13 16" />
        </svg>
      );
    case "navigate":
      return (
        <svg {...common}>
          <path d="M5 18.5 L12 5 L19 18.5 L12 15 z" />
          <path d="M12 15 L12 5" strokeWidth={stroke * 0.6} opacity="0.4" />
        </svg>
      );
    // Misc
    case "arrow":
      return (
        <svg {...common}>
          <path d="M5 12 H19" />
          <path d="M14 7 L19 12 L14 17" />
        </svg>
      );
    case "rosette":
      // Mini-rosette glyph
      return (
        <svg {...common} viewBox="0 0 40 40">
          {Array.from({length: 8}).map((_, i) => {
            const a = (i / 8) * Math.PI * 2 - Math.PI / 2;
            const x = 20 + Math.cos(a) * 8;
            const y = 20 + Math.sin(a) * 8;
            return <circle key={i} cx={x} cy={y} r="6" fill="none" stroke={color} strokeWidth={stroke} />;
          })}
          <circle cx="20" cy="20" r="4" fill="none" stroke={color} strokeWidth={stroke} />
        </svg>
      );
    case "key":
      // Handover — bow + shaft + teeth
      return (
        <svg {...common}>
          <Frame />
          <circle cx="9.4" cy="12" r="2.5" />
          <path d="M11.9 12 H17.2" />
          <path d="M15.3 12 V14.3" />
          <path d="M17.2 12 V14.7" />
        </svg>
      );
    case "document":
      // Written record — page with folded corner + lines
      return (
        <svg {...common}>
          <Frame />
          <path d="M8.8 7.6 H13.4 L15.4 9.6 V16.4 H8.8 Z" />
          <path d="M13.4 7.6 V9.6 H15.4" />
          <path d="M10.3 11.8 H13.9 M10.3 13.3 H13.9 M10.3 14.8 H12.6" opacity="0.55" />
        </svg>
      );
    case "stamp":
      // Sign-off / approval — seal with check + base
      return (
        <svg {...common}>
          <Frame />
          <circle cx="12" cy="10.6" r="3.3" />
          <path d="M10.5 10.6 L11.6 11.7 L13.6 9.4" />
          <path d="M8.4 16.1 H15.6" />
        </svg>
      );
    case "camera":
      // Progress photos — body, hump, lens
      return (
        <svg {...common}>
          <Frame />
          <rect x="6.8" y="9.6" width="10.4" height="6.6" rx="1" />
          <path d="M9.4 9.6 L10.3 8.2 H13.7 L14.6 9.6" />
          <circle cx="12" cy="12.9" r="2" />
        </svg>
      );
    case "flag":
      // Early warning — pennant on a pole
      return (
        <svg {...common}>
          <Frame />
          <path d="M9 7.4 V16.6" />
          <path d="M9 8 H15.4 L13.7 10.2 L15.4 12.4 H9" />
        </svg>
      );
    case "verify":
      // Quality check — tick in the medallion
      return (
        <svg {...common}>
          <Frame />
          <path d="M8.8 12.2 L11 14.4 L15.4 9.4" />
        </svg>
      );
    case "manage":
      // Project management — clipboard checklist
      return (
        <svg {...common}>
          <Frame />
          <rect x="7.8" y="8" width="8.4" height="9" rx="1" />
          <path d="M10.3 8 V7 H13.7 V8" />
          <path d="M9.6 11 L10.2 11.6 L11.4 10.4" />
          <path d="M12.4 11 H14.4" opacity="0.6" />
          <path d="M9.6 14 L10.2 14.6 L11.4 13.4" />
          <path d="M12.4 14 H14.4" opacity="0.6" />
        </svg>
      );
    case "villa":
      // The outcome — a single home / roof
      return (
        <svg {...common}>
          <Frame />
          <path d="M7.2 12.2 L12 8 L16.8 12.2" />
          <path d="M8.7 11 V16.4 H15.3 V11" />
          <path d="M11 16.4 V13.2 H13 V16.4" />
        </svg>
      );
    default:
      return <svg {...common}><Frame /></svg>;
  }
};

window.Icon = Icon;
