import{j as e}from"./vendor-ui-CUslpDkL.js";import{L as i}from"./vendor-react-Dg0Tra3e.js";import{u as l}from"./vendor-query-CN1EccJz.js";import{u as c,j as o,s as d}from"./index-CJqEbhJN.js";import{f as m}from"./format-BrSaXzvW.js";import"./vendor-supabase-yzuDJZPy.js";import"./vendor-motion-CiNtJfg1.js";function N(){const{t}=c(),{data:a=[]}=l({queryKey:["latestNews"],queryFn:async()=>{const{data:s,error:r}=await d.from("articles").select("id, title, image_url, published_at, topics").order("published_at",{ascending:!1}).limit(3);if(r)throw r;return s||[]},staleTime:5*60*1e3});return e.jsx("section",{className:"px-4 py-12 md:py-16",children:e.jsxs("div",{className:"mx-auto max-w-7xl",children:[e.jsxs("div",{className:"mb-8 flex items-center gap-3",children:[e.jsx(o,{className:"w-8 h-8 text-secondary"}),e.jsx("h2",{className:"text-3xl font-bold",children:t("home.latestNews")})]}),e.jsx("div",{className:"grid gap-6 md:grid-cols-3",children:a.length===0?e.jsxs("div",{className:"col-span-3 text-center py-12 glass-card",children:[e.jsx(o,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:t("home.noNewsAvailable")})]}):a.map(s=>e.jsxs(i,{to:`/news/${s.id}`,className:"glass-card-hover overflow-hidden group cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary",children:[e.jsxs("div",{className:"relative h-48 overflow-hidden",children:[e.jsx("img",{src:s.image_url||"https://images.unsplash.com/photo-1578632767115-351597cf2477?w=800&h=400&fit=crop",alt:s.title,width:800,height:400,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-110",loading:"lazy",decoding:"async"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-card via-card/50 to-transparent"}),s.topics&&s.topics.length>0&&e.jsx("span",{className:"absolute top-3 left-3 px-3 py-1 text-xs font-semibold rounded-full bg-primary text-primary-foreground",children:s.topics[0]})]}),e.jsxs("div",{className:"p-6",children:[s.published_at&&e.jsx("time",{className:"text-xs text-muted-foreground",children:m(new Date(s.published_at),"MMM d, yyyy")}),e.jsx("h3",{className:"mt-2 text-lg font-semibold group-hover:text-primary transition-colors",children:s.title})]})]},s.id))})]})})}export{N as default};