// Sample events for May–Jul 2026 and shared helpers used by the events
// index and detail pages.
//
// `kind` drives in-palette chip styling on the calendar and the list:
//   ticketed   → pine anchor
//   open-call  → news pop yellow used in chip stroke (still inside Events
//                page → no — keep palette discipline; treat as Events anchor)
//   drop-in    → meadow (lighter pine)
//   class      → lifted (mid pine)
//   talk       → pine deep
//   opening    → pine anchor
// `featured` lifts a single hero event to use the Hot Pink pop accent.

const EVENTS = [
  { id: "ff-may",   date: "2026-05-01", weekday: "Fri", title: "First Friday at the Annex",  venue: "The Annex · Stockton",     time: "6 – 9 pm",  cost: "Free",          kind: "drop-in", medium: "Mixed",      short: "Open gallery, lemonade in the back room. Live music if Charlie remembers." },
  { id: "spring-os",date: "2026-05-16", weekday: "Sat", title: "Spring Open Studios",         venue: "12 sites · county-wide",   time: "10 am – 5 pm", cost: "Free · drop in", kind: "drop-in", medium: "Multi",      short: "Twelve barns and back rooms across Rooks County, one Saturday.", featured: true },
  { id: "ss-open",  date: "2026-05-22", weekday: "Fri", title: "Spring Senior Exhibit opens", venue: "The Annex · Stockton",     time: "6 pm",      cost: "Free",          kind: "opening", medium: "Mixed",      short: "Opening reception for eight high-school senior portfolios. Cake." },
  { id: "pn-may",   date: "2026-05-28", weekday: "Thu", title: "Printmaking night at the library", venue: "Stockton Library", time: "6 – 8 pm", cost: "Free · 8 spots", kind: "class",  medium: "Printmaking", short: "Drop-in linocut session. Materials provided. RSVP keeps a spot." },
  { id: "qw-party", date: "2026-06-07", weekday: "Sun", title: "Quilt Wall Block Party",      venue: "The Annex · Stockton",     time: "1 – 4 pm",  cost: "Pay what you can", kind: "drop-in", medium: "Mixed",      short: "Paint-along, brushes provided. Chili after. Bring kids." },
  { id: "pn-jun",   date: "2026-06-11", weekday: "Thu", title: "Printmaking night at the library", venue: "Stockton Library", time: "6 – 8 pm", cost: "Free · 8 spots", kind: "class",  medium: "Printmaking", short: "Same as last month, more ink." },
  { id: "songbook", date: "2026-06-19", weekday: "Fri", title: "Plains Songbook",             venue: "Old Methodist Church · Stockton", time: "7:30 pm", cost: "$12 · $6 students", kind: "ticketed", medium: "Music",  short: "Three songwriters, one fiddle, an honest pew. Charlie Otieno headlining.", featured: true },
  { id: "draw-ser", date: "2026-06-25", weekday: "Thu", title: "Drawing series begins (8 weeks)", venue: "The Annex · classroom", time: "6 – 8 pm", cost: "$80 sliding",   kind: "class",  medium: "Drawing",   short: "Eight Thursdays of figure and observational drawing. Sage Wallin teaching." },
  { id: "lp-demo",  date: "2026-06-27", weekday: "Sat", title: "Letterpress demo",            venue: "Plainville · Henry Plumb's shop", time: "1 – 3 pm", cost: "Free",   kind: "talk",   medium: "Letterpress", short: "Henry runs the press, you set a poster. Take it home." },
  { id: "ff-jul",   date: "2026-07-03", weekday: "Fri", title: "First Friday at the Annex",   venue: "The Annex · Stockton",     time: "6 – 9 pm",  cost: "Free",          kind: "drop-in", medium: "Mixed",      short: "Same as May. Lemonade still cold." },
  { id: "talk-jul", date: "2026-07-11", weekday: "Sat", title: "Annex talk: 'Why we keep coming back'", venue: "The Annex", time: "2 pm", cost: "Free",         kind: "talk",   medium: "Talk",      short: "Lillian Schaeffer on forty-eight years of piecing." },
  { id: "family",   date: "2026-07-18", weekday: "Sat", title: "Family day at the Annex",     venue: "The Annex · Stockton",     time: "10 am – 2 pm", cost: "Free",       kind: "drop-in", medium: "Family",    short: "Crafts in every corner. A puppet show at noon." },
  { id: "mic-jul",  date: "2026-07-25", weekday: "Sat", title: "Open Mic on the porch",       venue: "The Annex · front porch",  time: "7 pm",      cost: "Pay what you can", kind: "ticketed", medium: "Music",  short: "Bring three songs or one poem. Quiet by ten." },
  { id: "fall-os",  date: "2026-10-11", weekday: "Sat", title: "Fall Open Studios",           venue: "12 sites · county-wide",   time: "10 am – 5 pm", cost: "Free · drop in", kind: "drop-in", medium: "Multi",      short: "Same loop as May. Mums on the porches." },
];

// Map ISO date → list of events on that day, for fast calendar lookup.
const EVENTS_BY_DATE = (() => {
  const m = {};
  EVENTS.forEach(e => { (m[e.date] = m[e.date] || []).push(e); });
  return m;
})();

// Pine-palette colors per kind. Hot pink reserved for the page's one POP.
const KIND_STYLE = {
  "ticketed":  { dot: "#2F7A2E", chipBg: "#2F7A2E",  chipFg: "#FBF7EE", label: "Ticketed" },
  "drop-in":   { dot: "#78BE4D", chipBg: "#BFE0A5",  chipFg: "#0F2E10", label: "Drop-in" },
  "class":     { dot: "#4FA13A", chipBg: "#4FA13A",  chipFg: "#FBF7EE", label: "Class" },
  "talk":      { dot: "#1A461A", chipBg: "#1A461A",  chipFg: "#FBF7EE", label: "Talk" },
  "opening":   { dot: "#2F7A2E", chipBg: "#EBF3DF",  chipFg: "#0F2E10", label: "Opening" },
};

// Date helpers (no native Date math needed — calendar is pre-laid out)
function shortDate(iso) {
  const [y, m, d] = iso.split("-");
  const mo = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(m, 10) - 1];
  return { day: parseInt(d, 10), mo, year: y, monthFull: ["January","February","March","April","May","June","July","August","September","October","November","December"][parseInt(m, 10) - 1] };
}

window.EVENTS = EVENTS;
window.EVENTS_BY_DATE = EVENTS_BY_DATE;
window.KIND_STYLE = KIND_STYLE;
window.shortDate = shortDate;
