{{ define "main" }}
<!-- layouts/author/list.html - Author posts listing -->
<div class="min-h-screen bg-white">
    
    <!-- Hero Section with Author Title -->
    <section class="gradient-bg py-12 md:py-16 lg:py-20">
        <div class="container mx-auto px-4 sm:px-6 lg:px-8">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="text-4xl md:text-5xl lg:text-6xl font-bold text-gray-900 mb-6">Tous les auteurs</h1>
            </div>
        </div>
    </section>

    <!-- Author Bio Section -->
    {{ if .Data.Term }}
    {{ $authorSlug := .Data.Term }}
    {{ $authors := site.Data.wordpress.authors }}
    {{ $author := index $authors $authorSlug }}
    
    {{ if $author }}
    <section class="py-12 bg-gray-50">
        <div class="container mx-auto px-4 sm:px-6 lg:px-8">
            <div class="max-w-3xl mx-auto">
                <div class="flex items-start space-x-6">
                    <div class="flex-1">
                        <h3 class="text-2xl font-semibold text-gray-900">{{ $author.name }}</h3>
                        {{ with $author.description }}
                        <p class="text-gray-700 mt-2">{{ . }}</p>
                        {{ end }}
                    </div>
                </div>
            </div>
        </div>
    </section>
    {{ end }}
    {{ end }}

    <!-- Author's Articles Section -->
    <section id="latest-articles" class="py-12 md:py-16">
        <div class="container mx-auto px-4 sm:px-6 lg:px-8">
            {{ $paginator := .Paginate .Pages 9 }}
            
            {{ if gt (len $paginator.Pages) 0 }}
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mb-12">
                {{ range $paginator.Pages }}
                <div class="bg-white rounded-xl overflow-hidden shadow-md article-card">
                    <div class="p-6">
                        <div class="flex flex-wrap gap-2 mb-3">
                            {{ if .Params.categories }}
                                {{ range first 1 .Params.categories }}
                                <a href="/categories/{{ . | urlize }}" class="bg-blue-100 text-blue-800 text-xs font-medium px-2 py-1 rounded hover:underline">{{ . }}</a>
                                {{ end }}
                            {{ end }}
                        </div>
                        <h3 class="text-lg font-bold text-gray-900 mb-3"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
                        <p class="text-gray-600 text-sm mb-4">
                            {{ if .Params.excerpt }}
                            {{ .Params.excerpt }}
                            {{ else if .Summary }}
                            {{ .Summary }}
                            {{ else }}
                            {{ truncate 200 .Content }}
                            {{ end }}
                        </p>
                        <div class="flex items-center justify-between text-sm text-gray-500">
                            <a href="{{ .RelPermalink }}" class="text-blue-600 hover:text-blue-800 font-medium text-sm">Lire la suite →</a>
                        </div>
                    </div>
                </div>
                {{ end }}
            </div>
            
            <!-- Pagination -->
            <div class="flex justify-center mt-12">
                {{ if gt .Paginator.TotalPages 1 }}
                    {{ partial "pagination-tailwind.html" .Paginator }}
                {{ end }}
            </div>
            {{ else }}
            <div class="text-center py-12">
                <p class="text-xl text-gray-600">Aucun article trouvé pour cet auteur.</p>
            </div>
            {{ end }}
        </div>
    </section>
</div>
{{ end }}
