---
import PageLayout from '@/layouts/PageLayout.astro';
import Icon from '@/components/ui/primitives/Icon/Icon.astro';
import Badge from '@/components/ui/data-display/Badge/Badge.astro';
import Card from '@/components/ui/data-display/Card/Card.astro';
import Button from '@/components/ui/form/Button/Button.astro';
import { Hero } from '@/components/hero';
import { Image } from 'astro:assets';
import aboutPhoto from '@/assets/about_photo.jpg';
import { useTranslations } from '@/i18n/utils';
import type { Locale } from '@/i18n/ui';

interface Props {
  locale: Locale;
}

const { locale } = Astro.props;
const t = useTranslations(locale);
---

<PageLayout
  title={`${t('about.title.pre')}${t('about.title.accent')} — Armarium`}
  description={t('about.desc')}
  locale={locale}
>
  <Hero layout="centered" size="sm">
    <h1 slot="title">
      <span class="text-foreground [-webkit-text-fill-color:currentColor]">{t('about.title.pre')}</span>
      <span class="text-brand-500 [-webkit-text-fill-color:var(--color-brand-500)]">{t('about.title.accent')}</span>
    </h1>
    <p slot="description">{t('about.desc')}</p>
  </Hero>

  <!-- Team -->
  <section class="bg-white dark:bg-gray-900 border-t border-border">
    <div class="grid gap-16 py-8 px-4 mx-auto max-w-screen-xl lg:grid-cols-2 lg:py-16 lg:px-6">
      <div class="text-foreground-muted sm:text-lg">
        <h2 class="mb-4 text-4xl tracking-tight font-extrabold text-foreground dark:text-white">{t('about.team.title')}</h2>
        <p class="mb-2 md:text-lg">{t('about.team.desc1')}</p>
        <p class="font-light md:text-lg">{t('about.team.desc2')}</p>
      </div>
      <div class="divide-y divide-gray-200 dark:divide-gray-700">
        <div class="flex flex-col items-center pb-8 sm:flex-row">
          <Image src={aboutPhoto} alt="Daniel Krähenbühl" class="mx-auto mb-4 w-36 h-36 rounded-full object-cover sm:ml-0 sm:mr-6" />
          <div class="text-center sm:text-left">
            <h3 class="text-xl font-bold tracking-tight text-foreground dark:text-white">Daniel Krähenbühl</h3>
            <span class="text-foreground-muted dark:text-gray-400">{t('about.founder.role')}</span>
            <p class="mt-3 mb-4 max-w-sm font-light text-foreground-muted dark:text-gray-400">{t('about.founder.bio')}</p>
            <ul class="flex justify-center space-x-4 sm:justify-start">
              <li>
                <a href="https://www.linkedin.com/company/armarium-suite" target="_blank" rel="noopener noreferrer" aria-label="LinkedIn" class="text-foreground-muted hover:text-foreground dark:hover:text-white">
                  <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"/></svg>
                </a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- FAQ -->
  <section class="bg-white dark:bg-gray-900 border-t border-border">
    <div class="py-8 px-4 mx-auto max-w-screen-xl sm:py-16 lg:px-6">
      <h2 class="mb-6 lg:mb-8 text-3xl lg:text-4xl tracking-tight font-extrabold text-center text-foreground dark:text-white">{t('about.faq.title')}</h2>
      <div class="mx-auto max-w-screen-md divide-y divide-gray-200 dark:divide-gray-700">
        {([1,2,3,4] as const).map((n) => (
          <details class="group">
            <summary class="flex justify-between items-center py-5 w-full font-medium text-left text-foreground cursor-pointer list-none">
              <span>{t(`about.faq.q${n}` as any)}</span>
              <svg class="w-6 h-6 shrink-0 transition-transform group-open:rotate-180" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>
            </summary>
            <div class="py-5 border-b border-gray-200 dark:border-gray-700">
              <p class="text-foreground-muted dark:text-gray-400">{t(`about.faq.a${n}` as any)}</p>
            </div>
          </details>
        ))}
      </div>
    </div>
  </section>

  <!-- CTA -->
  <section class="py-[var(--space-section-md)] bg-background">
    <div class="mx-auto max-w-2xl px-6 text-center" data-reveal>
      <h2 class="font-display text-4xl font-bold text-foreground mb-4 text-balance">{t('about.cta.title')}</h2>
      <p class="text-lg text-foreground-muted mb-8 text-balance">{t('about.cta.desc')}</p>
      <div class="flex flex-col sm:flex-row gap-4 justify-center">
        <Button size="lg" href="https://app.armarium.ch/register">
          {t('cta.register')}
          <Icon name="arrow-right" size="sm" />
        </Button>
        <Button size="lg" variant="outline" href={locale === 'de' ? '/' : `/${locale}/`}>
          {t('about.cta.back')}
        </Button>
      </div>
    </div>
  </section>
</PageLayout>
