import { useId } from 'react';

import { useTheme } from '@mui/material';

import { type HumandLogoProps } from './types';

/**
 * Humand brand logo as an inline SVG.
 *
 * By default, the logo is theme-aware:
 * - Light mode: brand navy (`palette.new.text.neutral.brand`).
 * - Dark mode: pure white (`palette.new.text.neutral.inverted`, which
 *   resolves to white in both modes; we apply it only in dark on purpose
 *   because design wants a pure white logo on dark surfaces — the standard
 *   inverted brand shade `brand[100]` reads as off-white blue).
 *
 * To override the color, pass `style={{ color: '#xxx' }}`. The component
 * renders all paths with `fill="currentColor"` so any CSS `color` value
 * propagates to the strokes.
 *
 * Do not pass `fill` directly — it has no effect because each path declares
 * its own `fill="currentColor"`.
 *
 * Accessibility: when `title` is provided, the SVG renders a `<title>`
 * element as its first child and is exposed to assistive tech via
 * `role="img"` + `aria-labelledby`. When omitted, the SVG is decorative
 * (`aria-hidden`).
 */
const HumandLogo = ({ title, style, ...props }: HumandLogoProps) => {
  const theme = useTheme();
  const titleId = useId();
  const defaultColor =
    theme.palette.mode === 'dark'
      ? theme.palette.new?.text?.neutral?.inverted
      : theme.palette.new?.text?.neutral?.brand;

  return (
    <svg
      viewBox="100 464 880 153"
      role={title ? 'img' : undefined}
      aria-hidden={title ? undefined : true}
      aria-labelledby={title ? titleId : undefined}
      focusable="false"
      style={{ color: defaultColor, ...style }}
      {...props}
    >
      {title && <title id={titleId}>{title}</title>}
      <path
        fill="currentColor"
        d="M109.22,572.21c-2.48,0-4.44-.75-5.87-2.23-1.43-1.49-2.14-3.35-2.14-5.59v-89.39c0-2.48.71-4.44,2.14-5.87,1.43-1.43,3.38-2.14,5.87-2.14,2.36,0,4.25.72,5.68,2.14,1.43,1.43,2.14,3.38,2.14,5.87v89.39c0,2.23-.72,4.1-2.14,5.59-1.43,1.49-3.32,2.23-5.68,2.23ZM109.22,612.44c-2.48,0-4.44-.71-5.87-2.14-1.43-1.43-2.14-3.32-2.14-5.68v-86.04c0-2.48.71-4.44,2.14-5.87,1.43-1.43,3.38-2.14,5.87-2.14,2.36,0,4.25.72,5.68,2.14,1.43,1.43,2.14,3.38,2.14,5.87v86.04c0,2.36-.72,4.25-2.14,5.68-1.43,1.43-3.32,2.14-5.68,2.14ZM188.19,612.44c-2.36,0-4.28-.74-5.77-2.23-1.49-1.49-2.24-3.35-2.24-5.59v-47.49c0-7.57-1.4-13.75-4.19-18.53-2.79-4.78-6.61-8.38-11.45-10.8-4.84-2.42-10.37-3.63-16.58-3.63-5.84,0-11.08,1.15-15.74,3.45-4.65,2.3-8.35,5.4-11.08,9.31-2.73,3.91-4.1,8.41-4.1,13.5h-10.8c.25-7.82,2.33-14.81,6.24-20.95,3.91-6.15,9.15-11.02,15.74-14.62,6.58-3.6,13.9-5.4,21.98-5.4,8.69,0,16.48,1.83,23.37,5.49,6.89,3.66,12.35,9.03,16.39,16.11,4.03,7.08,6.05,15.77,6.05,26.07v47.49c0,2.24-.74,4.1-2.23,5.59-1.49,1.49-3.35,2.23-5.59,2.23Z"
      />
      <path
        fill="currentColor"
        d="M291.17,613.56c-8.82,0-16.67-1.83-23.56-5.49-6.89-3.66-12.32-9.03-16.3-16.11-3.97-7.08-5.96-15.77-5.96-26.07v-47.49c0-2.23.75-4.1,2.24-5.59,1.49-1.49,3.35-2.23,5.59-2.23s4.1.74,5.59,2.23c1.49,1.49,2.24,3.35,2.24,5.59v47.49c0,7.57,1.43,13.75,4.28,18.53,2.85,4.78,6.71,8.38,11.55,10.8,4.84,2.42,10.3,3.63,16.39,3.63s11.11-1.15,15.83-3.45c4.72-2.3,8.44-5.4,11.18-9.31,2.73-3.91,4.1-8.41,4.1-13.5h10.61c-.25,7.82-2.3,14.81-6.15,20.95-3.85,6.15-9.06,11.02-15.64,14.62-6.58,3.6-13.91,5.4-21.97,5.4ZM332.14,612.44c-2.36,0-4.26-.71-5.68-2.14-1.43-1.43-2.14-3.38-2.14-5.87v-86.04c0-2.36.71-4.25,2.14-5.68,1.42-1.43,3.32-2.14,5.68-2.14s4.28.72,5.77,2.14c1.49,1.43,2.23,3.32,2.23,5.68v86.04c0,2.48-.74,4.44-2.23,5.87-1.49,1.43-3.42,2.14-5.77,2.14Z"
      />
      <path
        fill="currentColor"
        d="M401.23,612.44c-2.48,0-4.44-.71-5.87-2.14-1.43-1.43-2.14-3.32-2.14-5.68v-86.04c0-2.36.71-4.28,2.14-5.77,1.43-1.49,3.38-2.23,5.87-2.23,2.36,0,4.25.74,5.68,2.23,1.43,1.49,2.14,3.42,2.14,5.77v86.04c0,2.36-.72,4.25-2.14,5.68-1.43,1.43-3.32,2.14-5.68,2.14ZM465.48,612.44c-2.24,0-4.1-.71-5.59-2.14-1.49-1.43-2.24-3.32-2.24-5.68v-53.45c0-8.57-2.2-15.21-6.61-19.93-4.41-4.72-10.03-7.08-16.86-7.08-7.33,0-13.35,2.42-18.06,7.26-4.72,4.84-7.08,11.17-7.08,19h-10.8c.25-8.07,1.98-15.18,5.21-21.32,3.23-6.15,7.7-10.96,13.41-14.43,5.71-3.47,12.23-5.21,19.55-5.21s13.6,1.68,19.18,5.03c5.59,3.35,9.93,8.17,13.04,14.43,3.1,6.27,4.66,13.69,4.66,22.26v53.45c0,2.36-.72,4.25-2.14,5.68-1.43,1.43-3.32,2.14-5.68,2.14ZM529.74,612.44c-2.36,0-4.28-.71-5.77-2.14-1.49-1.43-2.24-3.32-2.24-5.68v-53.45c0-8.57-2.17-15.21-6.52-19.93-4.35-4.72-10-7.08-16.95-7.08-7.33,0-13.32,2.48-17.97,7.45-4.65,4.97-6.98,11.49-6.98,19.55h-13.6c.12-8.32,1.92-15.61,5.4-21.88,3.48-6.27,8.29-11.14,14.43-14.62,6.15-3.47,13.13-5.21,20.95-5.21,7.2,0,13.6,1.68,19.18,5.03,5.59,3.35,9.96,8.17,13.13,14.43,3.17,6.27,4.75,13.69,4.75,22.26v53.45c0,2.36-.75,4.25-2.24,5.68-1.49,1.43-3.35,2.14-5.59,2.14Z"
      />
      <path
        fill="currentColor"
        d="M632.72,613.37c-9.44,0-17.88-2.26-25.33-6.8-7.45-4.53-13.35-10.71-17.69-18.53-4.35-7.82-6.52-16.64-6.52-26.45s2.26-18.81,6.8-26.63c4.53-7.82,10.71-14,18.53-18.53,7.82-4.53,16.64-6.8,26.44-6.8s18.41,2.27,26.17,6.8c7.76,4.53,13.9,10.71,18.44,18.53,4.53,7.82,6.86,16.7,6.98,26.63l-6.33,3.17c0,9.19-2.08,17.45-6.24,24.77-4.16,7.33-9.81,13.13-16.95,17.41-7.14,4.28-15.24,6.43-24.3,6.43ZM634.96,599.22c6.95,0,13.13-1.64,18.53-4.94,5.4-3.29,9.68-7.79,12.85-13.5,3.17-5.71,4.75-12.11,4.75-19.18s-1.58-13.62-4.75-19.28c-3.17-5.65-7.45-10.15-12.85-13.5-5.4-3.35-11.58-5.03-18.53-5.03s-13.01,1.68-18.53,5.03c-5.53,3.35-9.9,7.85-13.13,13.5-3.23,5.65-4.84,12.08-4.84,19.28s1.61,13.47,4.84,19.18c3.23,5.71,7.6,10.21,13.13,13.5,5.52,3.29,11.7,4.94,18.53,4.94ZM678.54,612.44c-2.24,0-4.13-.71-5.68-2.14-1.55-1.43-2.33-3.32-2.33-5.68v-30.73l3.54-16.2,12.48,3.91v43.02c0,2.36-.75,4.25-2.24,5.68-1.49,1.43-3.42,2.14-5.77,2.14Z"
      />
      <path
        fill="currentColor"
        d="M742.04,612.44c-2.48,0-4.44-.71-5.87-2.14-1.43-1.43-2.14-3.32-2.14-5.68v-86.04c0-2.48.71-4.44,2.14-5.87,1.43-1.43,3.38-2.14,5.87-2.14,2.36,0,4.25.72,5.68,2.14,1.43,1.43,2.14,3.38,2.14,5.87v86.04c0,2.36-.72,4.25-2.14,5.68-1.43,1.43-3.32,2.14-5.68,2.14ZM821.01,612.44c-2.36,0-4.28-.74-5.77-2.23-1.49-1.49-2.24-3.35-2.24-5.59v-47.49c0-7.57-1.4-13.75-4.19-18.53-2.79-4.78-6.61-8.38-11.45-10.8-4.84-2.42-10.37-3.63-16.58-3.63-5.84,0-11.08,1.15-15.74,3.45-4.65,2.3-8.35,5.4-11.08,9.31-2.73,3.91-4.1,8.41-4.1,13.5h-10.8c.25-7.82,2.33-14.81,6.24-20.95,3.91-6.15,9.15-11.02,15.74-14.62,6.58-3.6,13.9-5.4,21.98-5.4,8.69,0,16.48,1.83,23.37,5.49,6.89,3.66,12.35,9.03,16.39,16.11,4.03,7.08,6.05,15.77,6.05,26.07v47.49c0,2.24-.74,4.1-2.23,5.59-1.49,1.49-3.35,2.23-5.59,2.23Z"
      />
      <path
        fill="currentColor"
        d="M926.41,613.37c-9.81,0-18.62-2.26-26.44-6.8-7.82-4.53-14-10.71-18.53-18.53-4.53-7.82-6.8-16.7-6.8-26.63s2.17-18.62,6.52-26.45c4.34-7.82,10.24-14,17.69-18.53,7.45-4.53,15.89-6.8,25.33-6.8,8.07,0,15.36,1.71,21.88,5.12,6.52,3.42,11.83,7.92,15.92,13.5v-53.26c0-2.48.77-4.44,2.33-5.87,1.55-1.43,3.45-2.14,5.68-2.14,2.36,0,4.28.72,5.77,2.14,1.49,1.43,2.24,3.38,2.24,5.87v86.97c-.25,9.68-2.64,18.41-7.17,26.17-4.53,7.76-10.65,13.91-18.34,18.44-7.7,4.53-16.39,6.8-26.07,6.8ZM926.41,599.22c6.95,0,13.13-1.68,18.53-5.03,5.4-3.35,9.68-7.85,12.85-13.5,3.17-5.65,4.75-12.07,4.75-19.28s-1.58-13.47-4.75-19.18c-3.17-5.71-7.45-10.21-12.85-13.5-5.4-3.29-11.58-4.94-18.53-4.94s-13.01,1.65-18.53,4.94c-5.53,3.29-9.9,7.79-13.13,13.5-3.23,5.71-4.84,12.11-4.84,19.18s1.61,13.63,4.84,19.28c3.23,5.65,7.6,10.15,13.13,13.5,5.52,3.35,11.7,5.03,18.53,5.03Z"
      />
    </svg>
  );
};

export default HumandLogo;
