<div class="container mx-auto px-4 py-16">
  <div class="text-center mb-16 space-y-4">
    <h1 class="text-4xl md:text-5xl font-display font-bold">Explore Cities</h1>
    <p class="text-xl text-base-content/70 max-w-2xl mx-auto">
      Discover AI-generated weather art from cities around the world
    </p>
  </div>

  <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
    <% @cities.each do |city| %>
      <% latest_art = city.weather_arts.last %>
      <div class="card bg-base-100 shadow-xl hover:shadow-2xl transition-all duration-300 group">
        <% if latest_art&.image&.attached? %>
          <figure class="relative aspect-[16/9] overflow-hidden">
            <%= image_tag latest_art.image,
                          class: "w-full h-full object-cover transform group-hover:scale-105 transition-transform duration-500" %>
            <div class="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
          </figure>
        <% end %>

        <div class="card-body relative">
          <h2 class="card-title font-display text-2xl"><%= city.localized_name %></h2>
          <div class="text-base-content/70">
            <p>Lat: <%= city.latitude %></p>
            <p>Long: <%= city.longitude %></p>
          </div>
          <div class="card-actions justify-end mt-4">
            <%= link_to "View Weather Art", city_path(city),
                        class: "btn btn-primary" %>
          </div>
        </div>
      </div>
    <% end %>
  </div>
</div>