1import{r as l,k as M,j as e,S as T,p as x,l as $,H as B,Q as d,L as y,P as w,o as _,T as A,w as k,f as S,F as D,s as F,i as P}from"./index-CEqNdWMB.js";import{A as Q}from"./AnimatedHeroBackground-ydyF_hUU.js";import{S as C}from"./smart-image-Y6syYqSp.js";import{S as G}from"./search-Ct4PNFf0.js";const O=["All","Prophetic","Faith","Leadership","Life"],K=()=>{const[c,L]=l.useState([]),[n,z]=l.useState(!0),[i,E]=l.useState("All"),[o,I]=l.useState(""),[m,u]=l.useState(6),R=l.useRef(null),{locale:h}=M();l.useEffect(()=>{(async()=>{const{data:t,error:a}=await F.from("articles").select("id, title, excerpt, content_html, publish_date, author_name, category, featured_image_url, featured_video_url, slug, authors:author_profile_id(name, avatar_url)").eq("status","published").eq("locale",h).order("publish_date",{ascending:!1});!a&&t&&L(t),z(!1)})()},[h]),l.useEffect(()=>{const s=new IntersectionObserver(t=>{t.forEach(a=>{a.isIntersecting&&a.target.classList.add("visible")})},{threshold:.1});return document.querySelectorAll(".reveal").forEach(t=>s.observe(t)),()=>s.disconnect()},[i,m,n]);const q=(()=>{const s=new Set(c.map(t=>t.category).filter(Boolean));return["All",...Array.from(s)]})(),r=c.length>0?c[0]:null,f=c.slice(1).filter(s=>i==="All"||s.category===i).filter(s=>o===""||s.title.toLowerCase().includes(o.toLowerCase())||(s.excerpt||"").toLowerCase().includes(o.toLowerCase())),p=f.slice(0,m),H=m<f.length,g=s=>s?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"",b=s=>{var t;return((t=s.authors)==null?void 0:t.name)||s.author_name||"CI Team"},j=s=>{if(s.featured_video_url){const t=P(s.featured_video_url);if(t)return t}return s.featured_image_url||"https://images.unsplash.com/photo-1504052434569-70ad5836ab65?w=800&q=80"},v=s=>!!s.featured_video_url,N=s=>{if(s.excerpt)return s.excerpt;const t=s.content_html;if(!t)return"Read this article to learn more.";const a=t.replace(/<[^>]+>/g,"").trim();return a.length>160?a.slice(0,160)+"â¦":a};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(T,{title:x.articles.title,description:x.articles.description,path:x.articles.path,schemas:[$([{name:"Home",url:"/"},{name:"Articles",url:"/articles"}])]}),e.jsx(B,{}),e.jsxs("section",{className:"relative min-h-[55vh] flex items-center justify-center overflow-hidden",children:[e.jsx(Q,{}),e.jsx("div",{className:"absolute inset-0 bg-[hsl(var(--ci-blue-dark))]/85 z-[1]"}),e.jsxs("div",{className:"relative z-10 text-center px-6 pt-32 pb-20",children:[e.jsx("h1",{className:"font-display text-5xl md:text-7xl lg:text-8xl font-bold tracking-tight text-white mb-4",children:"Articles"}),e.jsx("p",{className:"text-lg md:text-xl text-white/80 max-w-xl mx-auto font-light",children:"Insights, stories & teachings from the Christian International family"})]})]}),e.jsx("section",{className:"sticky top-[72px] z-30 bg-background/90 backdrop-blur-md border-b border-border/50",children:e.jsxs("div",{className:"container-wide py-4 flex flex-col sm:flex-row items-center gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:(n?O:q).map(s=>e.jsx("button",{onClick:()=>{E(s),u(6)},className:`px-4 py-2 rounded-full text-sm font-medium transition-all duration-200 ${i===s?"bg-primary text-primary-foreground shadow-md":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:s},s))}),e.jsxs("div",{className:"relative sm:ml-auto w-full sm:w-64",children:[e.jsx(G,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search articles...",value:o,onChange:s=>I(s.target.value),className:"w-full pl-9 pr-4 py-2 rounded-full bg-secondary text-sm text-foreground placeholder:text-muted-foreground border border-border/50 focus:outline-none focus:ring-2 focus:ring-primary/30 transition-all"})]})]})}),n&&e.jsx("section",{className:"container-wide py-16",children:e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-8",children:[...Array(6)].map((s,t)=>e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-card border border-border/30",children:[e.jsx(d,{className:"aspect-video w-full"}),e.jsxs("div",{className:"p-6 space-y-3",children:[e.jsx(d,{className:"h-5 w-3/4"}),e.jsx(d,{className:"h-4 w-full"}),e.jsx(d,{className:"h-4 w-1/2"})]})]},t))})}),!n&&r&&i==="All"&&o===""&&e.jsx("section",{className:"container-wide py-16",children:e.jsx(y,{to:`/articles/${r.slug}`,className:"block",children:e.jsxs("div",{className:"reveal rounded-2xl overflow-hidden bg-card shadow-lg border border-border/30 grid md:grid-cols-[3fr_2fr] gap-0",children:[e.jsxs("div",{className:"relative aspect-video md:aspect-auto md:h-full min-h-[250px] overflow-hidden",children:[e.jsx(C,{src:j(r),preset
1:"hero",sizes:"(min-width: 1024px) 1100px, 100vw",alt:r.title,className:"absolute inset-0 w-full h-full object-cover transition-transform duration-700 hover:scale-105"}),v(r)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"bg-black/50 backdrop-blur-sm rounded-full p-4",children:e.jsx(w,{className:"h-8 w-8 text-white fill-white"})})})]}),e.jsxs("div",{className:"p-8 md:p-12 flex flex-col justify-center",children:[e.jsx(_,{className:"w-fit mb-4 bg-primary/10 text-primary border-primary/20",children:r.category||"General"}),e.jsx("h2",{className:"text-2xl md:text-3xl lg:text-4xl font-display font-bold tracking-tight text-foreground mb-4 leading-tight",children:r.title}),e.jsx("p",{className:"text-muted-foreground mb-6 leading-relaxed",children:N(r)}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-6",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(A,{size:14}),b(r)]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(k,{size:14}),g(r.publish_date)]})]}),e.jsxs("span",{className:"btn-primary w-fit text-sm flex items-center gap-2",children:["Read Article ",e.jsx(S,{size:16})]})]})]})})}),!n&&e.jsxs("section",{className:"container-wide pb-20",ref:R,children:[i!=="All"||o!==""?e.jsx("div",{className:"pt-12"}):null,p.length===0?e.jsx("div",{className:"text-center py-20",children:e.jsx("p",{className:"text-muted-foreground text-lg",children:"No articles found matching your criteria."})}):e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-8",children:p.map((s,t)=>e.jsx(y,{to:`/articles/${s.slug}`,children:e.jsxs("article",{className:`reveal reveal-delay-${t%4+1} group rounded-2xl overflow-hidden bg-card border border-border/30 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all duration-500 cursor-pointer h-full`,children:[e.jsxs("div",{className:"relative aspect-video overflow-hidden",children:[e.jsx(C,{src:j(s),preset:"card",sizes:"(min-width: 1024px) 33vw, 100vw",alt:s.title,className:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/30 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),e.jsx(_,{className:"absolute top-4 left-4 bg-white/90 text-foreground border-0 backdrop-blur-sm text-xs",children:s.category||"General"}),v(s)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"bg-black/50 backdrop-blur-sm rounded-full p-3",children:e.jsx(w,{className:"h-6 w-6 text-white fill-white"})})})]}),e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-lg font-display font-semibold text-foreground mb-2 leading-snug line-clamp-2 group-hover:text-primary transition-colors duration-300",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4 line-clamp-2 leading-relaxed",children:N(s)}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(A,{size:12}),b(s)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(k,{size:12}),g(s.publish_date)]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border/30",children:e.jsxs("span",{className:"text-sm font-medium text-primary flex items-center gap-1.5 group-hover:gap-3 transition-all duration-300",children:["Read More ",e.jsx(S,{size:14})]})})]})]})},s.id))}),H&&e.jsx("div",{className:"flex justify-center mt-12",children:e.jsx("button",{onClick:()=>u(s=>s+6),className:"btn-secondary text-sm",children:"Load More Articles"})})]}),e.jsx(D,{})]})};export{K as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.