// Shared content for Resources pages.
// In production, all of this comes from Sanity via a GraphQL/GROQ query.
// Images are placeholder Unsplash URLs, swap for real client/editorial photos at integration.

const RESOURCES = [
  {
    id: 'attention-threshold',
    type: 'article',
    category: 'Learning Science',
    title: 'The Attention Threshold: Why Learning Fails Before It Begins',
    dek: 'Most learning programs lose the learner within the first few minutes. The issue is simpler and more structural than content quality.',
    author: 'Karen Uriah',
    role: 'Head of Learning Design',
    readTime: '10 min read',
    publishedAt: '2025-11-05',
    featured: true,
    image: 'assets/insights/modern-learner.jpg',
  },
{
    id: '5-cognitive-triggers-webinar',
    type: 'webinar',
    category: 'Learning Science',
    title: 'Webinar - 5 Cognitive Triggers That Drive Behavior Change',
    dek: 'Recorded at the ATD DemoCast series. Noam, founder of Knowaa, breaks down the five cognitive triggers that make the brain keep one piece of content, and delete the rest.',
    author: 'Noam Herz',
    role: 'Founder & Creative Director',
    readTime: '25 min watch',
    publishedAt: '2026-07-06T12:00:00',
    featured: false,
    image: 'assets/webinars/democast-cover.png',
  },
{
    id: 'personalized-safety-environment',
    type: 'insight',
    category: 'Methodology',
    title: 'Safety Training Finally Set Where the Hazard Actually Lives',
    dek: 'Generic safety content teaches the rule. Personalized safety content makes the learner recognize the risk, because it\u2019s their floor, their machine, their exit.',
    author: 'Noam Herz',
    role: 'Founder & Creative Director',
    readTime: '9 min read',
    publishedAt: '2026-01-22',
    featured: true,
    image: 'assets/articles/cover-personalized-safety.png',
  },
{
    id: 'generic-training-production-ai-strategy',
    type: 'article',
    category: 'AI & Strategy',
    title: 'Generic Training Was a Production Problem. AI Solved It. Now It Is a Strategy Problem.',
    dek: 'For twenty years, the honest answer to \u201Cwhy is our training so abstract?\u201D was a production constraint. That constraint is gone. The question has changed.',
    author: 'Noam Herz',
    role: 'Founder & Creative Director',
    readTime: '12 min read',
    publishedAt: '2025-11-14',
    featured: true,
    image: 'assets/articles/cover-generic-training.jpg',
  },
{
    id: 'zim-dare-to-ai',
    type: 'case',
    category: 'AI Adoption',
    title: 'A global workforce unlearned its AI habits. Then rebuilt them from scratch.',
    dek: 'Enterprise AI training teaches the tool. ZIM bet on the capability, and watched it spread beyond any single platform.',
    client: 'ZIM Integrated Shipping Services',
    outcomeHeadline: '$822,740 in 4 weeks',
    outcomeSub: 'Microsoft-attested productivity value',
    readTime: 'Case study',
    publishedAt: '2025-12-04',
    featured: true,
    image: 'assets/case-studies/zim/portal-cover.png',
  },
{
    id: 'signature-aviation-ergonomics',
    type: 'case',
    category: 'Aviation',
    title: 'Ergonomics Training That Employees Actually Finished, and Remembered',
    dek: 'Compliance modules get clicked through and forgotten. The injury risk they were meant to prevent doesn\u2019t go away, it just stops being tracked.',
    client: 'Signature Aviation',
    outcomeHeadline: '4 languages, 1 month',
    outcomeSub: 'shipped end-to-end with custom animation',
    readTime: 'Case study',
    publishedAt: '2025-11-20',
    featured: true,
    image: 'assets/case-studies/signature/portal-cover.png',
  },
{
    id: 'netafim-kaizen-prework',
    type: 'case',
    category: 'Manufacturing',
    title: 'Before the Event Starts, the Work Is Already Lost',
    dek: 'A documentary-style video and interactive module that prepared Netafim employees to participate in kaizen events, so the events could start working from minute one.',
    client: 'Netafim',
    outcomeHeadline: 'Day 1, not Day 2',
    outcomeSub: 'pre-event prep built from real kaizen footage',
    readTime: 'Case study',
    publishedAt: '2023-09-12',
    featured: false,
    image: 'assets/case-studies/netafim/cover.jpg',
  },
{
    id: 'teva-privacy-episodes',
    type: 'case',
    category: 'Pharma',
    title: 'Eight Episodes. One Habit. How Teva Made Data Privacy Stick.',
    dek: 'Pharma employees aren\u2019t ignoring compliance training because they don\u2019t care. They\u2019re ignoring it because nobody made it worth watching.',
    client: 'Teva',
    outcomeHeadline: '8 episodes, 60s each',
    outcomeSub: 'animated microlearning + WhatsApp stickers + posters',
    readTime: 'Case study',
    publishedAt: '2024-06-04',
    featured: false,
    image: 'assets/case-studies/teva-privacy/cover.jpg',
  },
{
    id: 'kornit-digital-onboarding',
    type: 'case',
    category: 'Manufacturing',
    title: 'The Shirt That Taught the Company',
    dek: 'A cinematic onboarding program for Kornit Digital, starring a printed shirt as the learning agent, that turned scattered Zoom recordings and folders into a coherent, high-craft new-hire experience.',
    client: 'Kornit Digital',
    outcomeHeadline: '4 assets, one onboarding arc',
    outcomeSub: 'cinematic flagship + buddy + platform intro + interactive modules',
    readTime: 'Case study',
    publishedAt: '2024-03-18',
    featured: false,
    image: 'assets/case-studies/kornit/cover.jpg',
  },
            ];

const CATEGORIES = ['All', 'AI & Strategy', 'Learning Science', 'Methodology', 'Design', 'Measurement', 'Pharma', 'SaaS', 'Cybersecurity', 'Telecom'];
// 'Insight' is a real card type with its own badge, but the filter UI groups
// insights under the 'Articles' tab. The Insights filter button is therefore
// removed; insights surface via 'All' and 'Articles'.
const TYPES = [
  { key: 'all', label: 'All', plural: 'All' },
  { key: 'article', label: 'Article', plural: 'Articles' },
  { key: 'insight', label: 'Insight', plural: 'Insights' },
  { key: 'case', label: 'Case study', plural: 'Case studies' },
  // Webinars surface via 'All' only, no dedicated filter tab yet.
  { key: 'webinar', label: 'Webinar', plural: 'Webinars' },
];

function formatDate(iso) {
  const d = new Date(iso);
  return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
}

Object.assign(window, { RESOURCES, CATEGORIES, TYPES, formatDate });


// Dedicated page filename per resource id. Anything not listed falls back to the
// generic dispatcher (Knowaa Article.html or Knowaa Case Study.html with ?id=).
const RESOURCE_PAGES = {
  'attention-threshold': 'Knowaa Article - Attention Threshold.html',
  'generic-training-production-ai-strategy': 'Knowaa Article - Generic Training.html',
  'personalized-safety-environment': 'Knowaa Article - Personalized Safety.html',
  '5-cognitive-triggers-webinar': 'Knowaa Webinar - 5 Cognitive Triggers.html',
  'zim-dare-to-ai': 'Knowaa Case Study - ZIM.html',
  'signature-aviation-ergonomics': 'Knowaa Case Study - Signature Aviation.html',
  'netafim-kaizen-prework': 'Knowaa Case Study - Netafim.html',
  'teva-privacy-episodes': 'Knowaa Case Study - Teva.html',
  'kornit-digital-onboarding': 'Knowaa Case Study - Kornit.html',
};
window.RESOURCE_PAGES = RESOURCE_PAGES;
function resourceHref(r) {
  if (!r) return '#';
  const dedicated = RESOURCE_PAGES[r.id];
  if (dedicated) return dedicated;
  // Insights and articles share the same template (article page); only case studies differ.
  const base = r.type === 'case' ? 'Knowaa Case Study.html' : 'Knowaa Article.html';
  return base + '?id=' + r.id;
}
window.resourceHref = resourceHref;
