import{c as w,r as l,k as x,j as e,m as p,l as N,b as h}from"./index-CW-Vb8Jq.js";import{P as v}from"./PageHero-CjPCs-1o.js";import{C}from"./clock-BUjeepe_.js";import{A as u}from"./arrow-right-D3SJ-8y6.js";import{S as k}from"./search-Bk7QauM-.js";const S=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],f=w("calendar",S),c=4;function _(){const[a,g]=l.useState(""),[n,y]=l.useState("All"),[o,i]=l.useState(1),d=l.useMemo(()=>x.filter(t=>{const r=!a||t.title.toLowerCase().includes(a.toLowerCase())||t.excerpt.toLowerCase().includes(a.toLowerCase()),j=n==="All"||t.category===n;return r&&j}),[a,n]),s=x.find(t=>t.featured),m=Math.max(1,Math.ceil(d.length/c)),b=d.slice((o-1)*c,o*c);return e.jsxs(e.Fragment,{children:[e.jsx(v,{eyebrow:"Blog",title:"Writing on the craft",subtitle:"Practical articles on web development, performance, freelancing, and leading engineering teams."}),e.jsx("section",{className:"py-16",children:e.jsxs("div",{className:"container-px mx-auto max-w-6xl",children:[s&&e.jsxs(p.article,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},className:"mb-12 overflow-hidden rounded-3xl border border-border bg-gradient-card p-8 shadow-elegant md:p-12",children:[e.jsx("span",{className:"inline-block rounded-full bg-primary px-3 py-1 text-xs font-semibold uppercase tracking-wider text-primary-foreground",children:"Featured"}),e.jsx("h2",{className:"mt-4 text-3xl font-bold md:text-4xl",children:s.title}),e.jsx("p",{className:"mt-4 max-w-2xl text-muted-foreground",children:s.excerpt}),e.jsxs("div",{className:"mt-4 flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(f,{className:"h-4 w-4"}),s.date]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(C,{className:"h-4 w-4"}),s.readTime]})]}),e.jsxs("a",{href:"#",className:"mt-6 inline-flex items-center font-medium text-primary hover:underline",children:["Read article ",e.jsx(u,{className:"ml-1.5 h-4 w-4"})]})]}),e.jsxs("div",{className:"mb-8 flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"relative w-full md:max-w-sm",children:[e.jsx(k,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{value:a,onChange:t=>{g(t.target.value),i(1)},placeholder:"Search articles...",className:"w-full rounded-full border border-border bg-card py-2.5 pl-10 pr-4 text-sm outline-none transition-colors focus:border-primary"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:N.map(t=>e.jsx("button",{onClick:()=>{y(t),i(1)},className:h("rounded-full border px-3 py-1.5 text-xs font-medium transition-all",n===t?"border-transparent bg-gradient-hero text-primary-foreground":"border-border hover:border-primary/40"),children:t},t))})]}),e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:b.map((t,r)=>e.jsxs(p.article,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-50px"},transition:{delay:r*.05},className:"group rounded-2xl border border-border bg-card p-6 shadow-card transition-all hover:-translate-y-1 hover:shadow-elegant",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"rounded-full bg-primary/10 px-3 py-1 text-xs font-medium text-primary",children:t.category}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.readTime})]}),e.jsx("h3",{className:"mt-4 text-xl font-semibold group-hover:text-primary",children:t.title}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:t.excerpt}),e.jsxs("div",{className:"mt-4 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(f,{className:"h-3.5 w-3.5"}),t.date]}),e.jsxs("a",{href:"#",className:"inline-flex items-center font-medium text-primary hover:underline",children:["Read ",e.jsx(u,{className:"ml-1 h-3.5 w-3.5"})]})]})]},t.slug))}),d.length===0&&e.jsx("div",{className:"py-16 text-center text-muted-foreground",children:"No articles found."}),m>1&&e.jsx("div",{className:"mt-10 flex justify-center gap-2",children:Array.from({length:m}).map((t,r)=>e.jsx("button",{onClick:()=>i(r+1),className:h("h-9 w-9 rounded-md border text-sm font-medium transition-colors",o===r+1?"border-transparent bg-gradient-hero text-primary-foreground":"border-border hover:border-primary/40"),children:r+1},r))})]})})]})}export{_ as component};
