/* Inline SVG icons — original drawings, simple line style */
const Icon = ({ d, size = 20, stroke = 1.75, className = '', style = {}, children }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
    strokeWidth={stroke} strokeLinecap="round" strokeLinejoin="round" className={className} style={style}>
    {d ? <path d={d} /> : children}
  </svg>
);

const IconCheck = (p) => <Icon {...p} d="M4 12.5l5 5L20 6.5" />;
const IconDash = (p) => <Icon {...p} d="M5 12h14" />;
const IconArrowRight = (p) => <Icon {...p} d="M5 12h14M13 5l7 7-7 7" />;
const IconArrowDown = (p) => <Icon {...p} d="M12 5v14M5 13l7 7 7-7" />;
const IconArrowUpRight = (p) => <Icon {...p} d="M7 17L17 7M9 7h8v8" />;
const IconMic = (p) => (
  <Icon {...p}>
    <rect x="9" y="3" width="6" height="12" rx="3" />
    <path d="M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6" />
  </Icon>
);
const IconStop = (p) => <Icon {...p}><rect x="6" y="6" width="12" height="12" rx="2" /></Icon>;
const IconSparkle = (p) => <Icon {...p} d="M12 3l2 5 5 2-5 2-2 5-2-5-5-2 5-2zM19 14l1 2 2 1-2 1-1 2-1-2-2-1 2-1z" />;
const IconBell = (p) => <Icon {...p} d="M6 16V11a6 6 0 1 1 12 0v5l1.5 2H4.5L6 16zM10 21a2 2 0 0 0 4 0" />;
const IconSun = (p) => (
  <Icon {...p}>
    <circle cx="12" cy="12" r="4" />
    <path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.5 4.5l1.5 1.5M18 18l1.5 1.5M4.5 19.5L6 18M18 6l1.5-1.5" />
  </Icon>
);
const IconMail = (p) => (
  <Icon {...p}>
    <rect x="3" y="5" width="18" height="14" rx="2" />
    <path d="M3 7l9 7 9-7" />
  </Icon>
);
const IconBolt = (p) => <Icon {...p} d="M13 2L4 14h7l-1 8 9-12h-7l1-8z" />;
const IconUser = (p) => <Icon {...p}><circle cx="12" cy="8" r="4" /><path d="M4 21a8 8 0 0 1 16 0" /></Icon>;
const IconUsers = (p) => (
  <Icon {...p}>
    <circle cx="9" cy="8" r="4" />
    <path d="M2 21a7 7 0 0 1 14 0" />
    <path d="M16 3.5a4 4 0 0 1 0 7.5M22 21a7 7 0 0 0-5-6.7" />
  </Icon>
);
const IconCalendar = (p) => (
  <Icon {...p}>
    <rect x="3" y="5" width="18" height="16" rx="2" />
    <path d="M3 10h18M8 3v4M16 3v4" />
  </Icon>
);
const IconChat = (p) => <Icon {...p} d="M4 5h16v11H8l-4 4z" />;
const IconList = (p) => <Icon {...p} d="M4 6h16M4 12h16M4 18h10" />;
const IconKanban = (p) => (
  <Icon {...p}>
    <rect x="3" y="4" width="5" height="16" rx="1.5" />
    <rect x="10" y="4" width="5" height="11" rx="1.5" />
    <rect x="17" y="4" width="4" height="8" rx="1.5" />
  </Icon>
);
const IconSearch = (p) => <Icon {...p}><circle cx="11" cy="11" r="7" /><path d="M20 20l-4-4" /></Icon>;
const IconChevDown = (p) => <Icon {...p} d="M6 9l6 6 6-6" />;
const IconClose = (p) => <Icon {...p} d="M6 6l12 12M18 6L6 18" />;
const IconLock = (p) => <Icon {...p}><rect x="4" y="11" width="16" height="10" rx="2" /><path d="M8 11V8a4 4 0 0 1 8 0v3" /></Icon>;
const IconStar = (p) => <Icon {...p} d="M12 3l3 6 6.5 1-4.7 4.6 1.1 6.5L12 18l-5.9 3 1.1-6.5L2.5 10 9 9z" />;
const IconHome = (p) => <Icon {...p} d="M4 11l8-7 8 7v9a1 1 0 0 1-1 1h-5v-6h-4v6H5a1 1 0 0 1-1-1z" />;
const IconPNM = (p) => <Icon {...p}><circle cx="9" cy="9" r="3" /><circle cx="17" cy="11" r="2" /><path d="M3 19a6 6 0 0 1 12 0M14 19a4 4 0 0 1 7-1" /></Icon>;
const IconFunnel = (p) => <Icon {...p} d="M3 5h18l-7 9v5l-4 1v-6z" />;
const IconBarChart = (p) => <Icon {...p} d="M4 20V10M10 20V4M16 20v-7M22 20H2" />;
const IconCog = (p) => (
  <Icon {...p}>
    <circle cx="12" cy="12" r="3" />
    <path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.6V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.6 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.6-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.6-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.6V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.6 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.4.6 1 1 1.6 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z" />
  </Icon>
);
const IconKeyboard = (p) => (
  <Icon {...p}>
    <rect x="2" y="6" width="20" height="12" rx="2" />
    <path d="M6 10h.01M10 10h.01M14 10h.01M18 10h.01M7 14h10" />
  </Icon>
);
const IconWarn = (p) => <Icon {...p} d="M12 4l10 17H2zM12 10v5M12 18v.5" />;
const IconClock = (p) => <Icon {...p}><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></Icon>;
/* App-icon mark — italic serif "R" + period dot on the site's
   primary blue gradient. Mirrors the LockupAppIcon / AppIcon artboards
   from the Claude Design handoff, recolored to the site palette
   (primary #1E3A8A → accent #3B82F6 — same stops as .text-gradient). */
const AppIconMark = ({ size = 28 }) => {
  const radius = size * (30 / 130);
  const padBottom = size * (18 / 130);
  const rFontSize = size * (124 / 130);
  const dotSize = Math.max(3, size * (14 / 130));
  const dotMarginBottom = size * (26 / 130);
  const dotMarginLeft = Math.max(1, size * (2 / 130));
  const shadowY = size * (12 / 130);
  const shadowBlur = size * (32 / 130);
  return (
    <div
      aria-hidden
      style={{
        width: size,
        height: size,
        borderRadius: radius,
        background: 'linear-gradient(160deg, #3B82F6 0%, #1E3A8A 100%)',
        boxShadow: `0 ${shadowY}px ${shadowBlur}px rgba(30,58,138,0.30)`,
        display: 'flex',
        alignItems: 'baseline',
        justifyContent: 'center',
        paddingBottom: padBottom,
        position: 'relative',
        overflow: 'hidden',
        flexShrink: 0,
      }}>
      <div style={{
        position: 'absolute', inset: 0,
        background: 'radial-gradient(circle at 30% 25%, rgba(191,219,254,0.55), transparent 50%)',
      }} />
      <span style={{
        fontFamily: '"Instrument Serif", Georgia, serif',
        fontStyle: 'italic',
        color: '#fff',
        fontSize: rFontSize,
        lineHeight: 1,
        letterSpacing: '-0.04em',
        position: 'relative',
      }}>R</span>
      <span style={{
        width: dotSize, height: dotSize, borderRadius: '50%',
        background: '#fff',
        marginLeft: dotMarginLeft,
        alignSelf: 'flex-end',
        marginBottom: dotMarginBottom,
        position: 'relative',
      }} />
    </div>
  );
};

/* Back-compat alias — anything still importing IconPaperPlane gets
   the new mark instead of the retired paper-plane glyph. */
const IconPaperPlane = ({ size = 22 }) => <AppIconMark size={size} />;

const Logo = ({ small = false, light = false }) => {
  const iconSize = small ? 24 : 30;
  const wordSize = small ? 20 : 24;
  return (
    <div className="flex items-center gap-2.5 select-none">
      <AppIconMark size={iconSize} />
      <span
        className="font-serif-display"
        style={{
          fontSize: wordSize,
          lineHeight: 0.95,
          letterSpacing: '-0.03em',
          color: light ? '#fff' : '#0E0E16',
        }}>
        Rush<span style={{ fontStyle: 'italic', color: light ? '#93C5FD' : '#1E3A8A' }}>Pilot</span>
      </span>
    </div>
  );
};

Object.assign(window, {
  Icon, IconCheck, IconDash, IconArrowRight, IconArrowDown, IconArrowUpRight,
  IconMic, IconStop, IconSparkle, IconBell, IconSun, IconMail, IconBolt,
  IconUser, IconUsers, IconCalendar, IconChat, IconList, IconKanban,
  IconSearch, IconChevDown, IconClose, IconLock, IconStar, IconHome,
  IconPNM, IconFunnel, IconBarChart, IconCog, IconKeyboard, IconWarn, IconClock,
  IconPaperPlane, Logo, AppIconMark,
});
