import { ProgressBarLink } from '@/shared/components'
import { APP_NAME } from '@/shared/config/app'
import { ArrowRightIcon, CheckIcon } from 'lucide-react'
import { HeroPhone } from './hero-phone'
import { StoreButtons } from './store-buttons'

const TRUST_POINTS = [
  'Бесплатно',
  'Без ограничений по числу сайтов',
  'Доступы для всей команды'
]

// Above the fold the text animates with CSS only, so it never waits for JS
const enter =
  'motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-4 motion-safe:duration-700 motion-safe:fill-mode-both'

export const Hero = () => (
  <section className='relative isolate overflow-hidden pt-28 pb-20 sm:pt-32 lg:pt-36 lg:pb-28'>
    <div
      aria-hidden
      className='absolute inset-0 -z-10 bg-dot-grid opacity-70 mask-fade-radial'
    />
    <div
      aria-hidden
      className='absolute -top-48 left-1/2 -z-10 size-[42rem] -translate-x-1/2 rounded-full bg-primary/15 blur-3xl lg:left-3/4'
    />

    <div className='mx-auto grid max-w-7xl items-center gap-16 px-4 lg:grid-cols-[1.05fr_0.95fr] lg:gap-10 lg:px-6'>
      <div className='text-center lg:text-left'>
        <p
          className={`inline-flex items-center gap-2 rounded-full border bg-background/70 px-3 py-1 text-sm font-medium text-muted-foreground shadow-xs backdrop-blur ${enter}`}
        >
          <span className='relative flex size-2'>
            <span className='absolute inline-flex size-full rounded-full bg-primary opacity-75 motion-safe:animate-ping' />
            <span className='relative inline-flex size-2 rounded-full bg-primary' />
          </span>
          Бесплатно для iOS, Android и веб
        </p>

        <h1
          className={`mt-6 font-display text-4xl font-bold tracking-tight text-balance sm:text-5xl lg:text-6xl lg:leading-[1.05] ${enter} motion-safe:delay-100`}
        >
          <span className='mb-3 block text-lg font-semibold tracking-normal text-primary sm:text-xl'>
            {APP_NAME}:
          </span>{' '}
          Ваш сайт&nbsp;—{' '}
          <span className='text-gradient-brand motion-safe:animate-gradient-x'>
            под полным контролем
          </span>
          . В любом месте.
        </h1>

        <p
          className={`mx-auto mt-6 max-w-xl text-lg text-muted-foreground text-pretty sm:text-xl lg:mx-0 ${enter} motion-safe:delay-200`}
        >
          Мобильное приложение для владельцев бизнеса и администраторов сайтов.
          Новые заказы, заявки и события со всех ваших сайтов&nbsp;— мгновенно и
          в одном месте.
        </p>

        <div
          className={`mt-10 flex flex-col items-center gap-5 lg:items-start ${enter} motion-safe:delay-300`}
        >
          <StoreButtons />
          <ProgressBarLink
            href='/auth/signup'
            className='group inline-flex items-center gap-1.5 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground'
          >
            Или откройте веб-версию
            <ArrowRightIcon className='size-4 transition-transform group-hover:translate-x-0.5' />
          </ProgressBarLink>
        </div>

        <ul
          className={`mt-10 flex flex-wrap justify-center gap-x-6 gap-y-2 text-sm text-muted-foreground lg:justify-start ${enter} motion-safe:delay-500`}
        >
          {TRUST_POINTS.map((point) => (
            <li key={point} className='inline-flex items-center gap-2'>
              <span className='flex size-5 items-center justify-center rounded-full bg-primary/15 text-primary'>
                <CheckIcon className='size-3' strokeWidth={3} />
              </span>
              {point}
            </li>
          ))}
        </ul>
      </div>

      <div
        className={`relative ${enter} motion-safe:delay-200 motion-safe:duration-1000`}
      >
        <HeroPhone />
      </div>
    </div>
  </section>
)
