Museum — Events & Programs Calendar
A refined, gallery-toned events and programs calendar for a fictional art museum. A month grid marks each day with colored category dots, a chip filter narrows to talks, tours, workshops, family afternoons or members-only previews, and selecting a day reveals its programs in a sticky side panel. Each event card carries time, location, capacity, a live seat counter and an RSVP button, plus a calendar/list view toggle and month navigation — all self-contained vanilla JS.
MCP
Code
:root {
--paper: #f6f4ef;
--wall: #ffffff;
--charcoal: #1c1b19;
--ink: #2a2825;
--ink-2: #4a4640;
--muted: #8c857a;
--gold: #a98140;
--gold-d: #876631;
--gold-50: #f3ecdd;
--line: rgba(28, 27, 25, 0.12);
--line-2: rgba(28, 27, 25, 0.2);
--ok: #3f7d56;
--warn: #b8842c;
--danger: #b4493a;
--r-sm: 6px;
--r-md: 12px;
--r-lg: 18px;
--c-talk: #8c5a9e;
--c-tour: #3f7d8c;
--c-workshop: #b07a2e;
--c-family: #3f7d56;
--c-members: #a98140;
--serif: "Cormorant Garamond", Georgia, serif;
--sans: "Inter", system-ui, -apple-system, sans-serif;
--shadow: 0 1px 2px rgba(28, 27, 25, 0.04), 0 8px 28px rgba(28, 27, 25, 0.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
margin: 0;
background: var(--paper);
color: var(--ink);
font-family: var(--sans);
font-size: 15px;
line-height: 1.55;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.page {
max-width: 1180px;
margin: 0 auto;
padding: 28px clamp(16px, 4vw, 40px) 64px;
}
/* Masthead */
.masthead {
display: flex;
justify-content: space-between;
align-items: center;
gap: 24px;
padding-bottom: 22px;
border-bottom: 1px solid var(--line);
flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 16px; }
.mark { color: var(--gold-d); flex: none; }
.kicker {
margin: 0;
font-size: 11px;
letter-spacing: 0.22em;
text-transform: uppercase;
color: var(--muted);
font-weight: 600;
}
.brand-text h1 {
margin: 2px 0 0;
font-family: var(--serif);
font-weight: 600;
font-size: clamp(28px, 5vw, 40px);
line-height: 1.05;
color: var(--charcoal);
}
.masthead-nav { display: flex; gap: 22px; flex-wrap: wrap; }
.masthead-nav a {
text-decoration: none;
color: var(--ink-2);
font-size: 13px;
font-weight: 500;
padding: 4px 0;
border-bottom: 1px solid transparent;
transition: color 0.16s, border-color 0.16s;
}
.masthead-nav a:hover { color: var(--charcoal); }
.masthead-nav a.active { color: var(--charcoal); border-bottom-color: var(--gold); }
/* Intro */
.intro { padding: 26px 0 6px; max-width: 720px; }
.lead {
margin: 0;
font-family: var(--serif);
font-size: clamp(18px, 2.6vw, 23px);
font-weight: 500;
line-height: 1.45;
color: var(--ink-2);
}
/* Toolbar */
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 18px;
margin: 22px 0 16px;
flex-wrap: wrap;
}
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav h2 {
margin: 0;
font-family: var(--serif);
font-weight: 600;
font-size: 26px;
color: var(--charcoal);
min-width: 168px;
}
.icon-btn {
width: 38px;
height: 38px;
border: 1px solid var(--line-2);
background: var(--wall);
border-radius: var(--r-sm);
font-size: 20px;
line-height: 1;
color: var(--ink);
cursor: pointer;
transition: background 0.16s, border-color 0.16s;
}
.icon-btn:hover { background: var(--gold-50); border-color: var(--gold); }
.ghost-btn {
border: 1px solid var(--line-2);
background: transparent;
border-radius: var(--r-sm);
padding: 8px 14px;
font-family: var(--sans);
font-size: 13px;
font-weight: 500;
color: var(--ink);
cursor: pointer;
transition: background 0.16s, border-color 0.16s;
}
.ghost-btn:hover { background: var(--gold-50); border-color: var(--gold); }
.view-toggle {
display: inline-flex;
border: 1px solid var(--line-2);
border-radius: var(--r-sm);
overflow: hidden;
background: var(--wall);
}
.seg {
border: none;
background: transparent;
padding: 9px 18px;
font-family: var(--sans);
font-size: 13px;
font-weight: 500;
color: var(--ink-2);
cursor: pointer;
transition: background 0.16s, color 0.16s;
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg.active { background: var(--charcoal); color: #fff; }
/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
display: inline-flex;
align-items: center;
gap: 8px;
border: 1px solid var(--line-2);
background: var(--wall);
border-radius: 999px;
padding: 7px 15px;
font-family: var(--sans);
font-size: 13px;
font-weight: 500;
color: var(--ink-2);
cursor: pointer;
transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.chip:hover { border-color: var(--gold); }
.chip.active { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.chip.active .dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }
.dot {
width: 9px;
height: 9px;
border-radius: 50%;
flex: none;
background: var(--muted);
}
.dot-talk { background: var(--c-talk); }
.dot-tour { background: var(--c-tour); }
.dot-workshop { background: var(--c-workshop); }
.dot-family { background: var(--c-family); }
.dot-members { background: var(--c-members); }
/* Layout */
.layout {
display: grid;
grid-template-columns: minmax(0, 1fr) 350px;
gap: 26px;
align-items: start;
}
/* Calendar */
.weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 6px;
margin-bottom: 8px;
}
.weekdays span {
font-size: 11px;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--muted);
font-weight: 600;
text-align: center;
}
.grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 6px;
}
.cell {
position: relative;
min-height: 92px;
background: var(--wall);
border: 1px solid var(--line);
border-radius: var(--r-sm);
padding: 8px;
cursor: pointer;
text-align: left;
font-family: var(--sans);
display: flex;
flex-direction: column;
gap: 6px;
transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.cell:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.cell.empty {
background: transparent;
border-color: transparent;
cursor: default;
pointer-events: none;
}
.cell.today { border-color: var(--gold); background: var(--gold-50); }
.cell.selected { border-color: var(--charcoal); box-shadow: 0 0 0 1px var(--charcoal); }
.cell .num { font-size: 13px; font-weight: 600; color: var(--ink); }
.cell.today .num { color: var(--gold-d); }
.cell .dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.cell .more { font-size: 10px; color: var(--muted); font-weight: 500; }
.cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.legend {
display: flex;
flex-wrap: wrap;
gap: 16px;
margin-top: 18px;
font-size: 12px;
color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
/* List view */
.list-view { display: flex; flex-direction: column; gap: 22px; }
.list-day-head {
font-family: var(--serif);
font-size: 20px;
font-weight: 600;
color: var(--charcoal);
padding-bottom: 6px;
border-bottom: 1px solid var(--line);
}
.list-empty {
color: var(--muted);
font-family: var(--serif);
font-size: 19px;
padding: 40px 0;
text-align: center;
}
.list-card { margin-top: 12px; }
/* Day panel */
.day-panel {
background: var(--wall);
border: 1px solid var(--line);
border-radius: var(--r-md);
padding: 22px;
position: sticky;
top: 18px;
box-shadow: var(--shadow);
}
.panel-kicker {
margin: 0;
font-size: 11px;
letter-spacing: 0.18em;
text-transform: uppercase;
color: var(--muted);
font-weight: 600;
}
.panel-head h3 {
margin: 4px 0 0;
font-family: var(--serif);
font-weight: 600;
font-size: 24px;
color: var(--charcoal);
}
.panel-body { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-empty { color: var(--muted); font-size: 14px; margin: 0; }
/* Event card */
.event {
border: 1px solid var(--line);
border-radius: var(--r-md);
border-left: 3px solid var(--muted);
background: var(--wall);
padding: 14px 16px;
transition: box-shadow 0.16s;
}
.event:hover { box-shadow: var(--shadow); }
.event.cat-talk { border-left-color: var(--c-talk); }
.event.cat-tour { border-left-color: var(--c-tour); }
.event.cat-workshop { border-left-color: var(--c-workshop); }
.event.cat-family { border-left-color: var(--c-family); }
.event.cat-members { border-left-color: var(--c-members); }
.event-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.event-time { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.badge {
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
font-weight: 600;
padding: 3px 8px;
border-radius: 999px;
background: var(--gold-50);
color: var(--gold-d);
white-space: nowrap;
}
.event-title {
margin: 6px 0 2px;
font-family: var(--serif);
font-size: 19px;
font-weight: 600;
color: var(--charcoal);
line-height: 1.25;
}
.event-meta { font-size: 12.5px; color: var(--ink-2); margin: 2px 0; }
.event-meta .sep { color: var(--line-2); margin: 0 6px; }
.event-desc { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }
.event-foot {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
margin-top: 12px;
flex-wrap: wrap;
}
.seats { font-size: 12px; color: var(--ink-2); }
.seats strong { color: var(--ink); }
.seats.low strong { color: var(--warn); }
.seats.full strong { color: var(--danger); }
.seatbar {
height: 4px;
border-radius: 999px;
background: var(--line);
margin-top: 5px;
overflow: hidden;
width: 120px;
}
.seatbar > i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.seatbar.low > i { background: var(--warn); }
.seatbar.full > i { background: var(--danger); }
.rsvp-btn {
border: 1px solid var(--charcoal);
background: var(--charcoal);
color: #fff;
border-radius: var(--r-sm);
padding: 8px 16px;
font-family: var(--sans);
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: background 0.16s, opacity 0.16s;
}
.rsvp-btn:hover { background: var(--gold-d); border-color: var(--gold-d); }
.rsvp-btn.reserved { background: var(--ok); border-color: var(--ok); }
.rsvp-btn.reserved:hover { background: var(--danger); border-color: var(--danger); }
.rsvp-btn:disabled {
background: var(--paper);
border-color: var(--line-2);
color: var(--muted);
cursor: not-allowed;
}
.rsvp-btn:focus-visible,
.chip:focus-visible,
.seg:focus-visible,
.ghost-btn:focus-visible,
.icon-btn:focus-visible {
outline: 2px solid var(--gold);
outline-offset: 2px;
}
/* Footer */
.site-foot {
margin-top: 48px;
padding-top: 22px;
border-top: 1px solid var(--line);
font-size: 12.5px;
color: var(--ink-2);
}
.site-foot p { margin: 2px 0; }
.site-foot .muted { color: var(--muted); }
/* Toast */
.toast {
position: fixed;
left: 50%;
bottom: 26px;
transform: translateX(-50%) translateY(20px);
background: var(--charcoal);
color: #fff;
padding: 12px 20px;
border-radius: var(--r-sm);
font-size: 13.5px;
font-weight: 500;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
opacity: 0;
pointer-events: none;
transition: opacity 0.22s, transform 0.22s;
z-index: 50;
max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* Responsive */
@media (max-width: 880px) {
.layout { grid-template-columns: 1fr; }
.day-panel { position: static; }
}
@media (max-width: 520px) {
body { font-size: 14px; }
.page { padding: 20px 14px 48px; }
.masthead-nav { display: none; }
.toolbar { flex-direction: column; align-items: stretch; }
.month-nav { justify-content: space-between; }
.month-nav h2 { font-size: 22px; min-width: 0; flex: 1; }
.view-toggle { align-self: stretch; }
.seg { flex: 1; }
.cell { min-height: 62px; padding: 6px; }
.cell .num { font-size: 12px; }
.weekdays span { font-size: 9px; letter-spacing: 0.06em; }
.grid, .weekdays { gap: 4px; }
.seatbar { width: 100%; }
.event-foot { flex-direction: column; align-items: stretch; }
.rsvp-btn { width: 100%; }
}(function () {
"use strict";
// ---- Demo data: events keyed by ISO date (June 2026) ----
// Each event: id, time, title, cat, location, capacity, taken, desc
var CATS = {
talk: "Talk",
tour: "Tour",
workshop: "Workshop",
family: "Family",
members: "Members"
};
var EVENTS = {
"2026-06-02": [
{ id: "e1", time: "18:30", title: "Curator's Talk: Northern Light", cat: "talk", location: "Auditorium B", capacity: 120, taken: 86, desc: "Senior curator Dr. Iris Vahl on the luminist landscapes of Greta Søndergaard (1841–1903), cat. no. NL-217." },
{ id: "e2", time: "11:00", title: "Highlights Tour", cat: "tour", location: "Meet at Atrium", capacity: 18, taken: 14, desc: "A 60-minute walk through the permanent collection — twelve works, five centuries." }
],
"2026-06-05": [
{ id: "e3", time: "10:30", title: "Drawing from the Cast Hall", cat: "workshop", location: "Studio 3", capacity: 16, taken: 16, desc: "Graphite study session among the plaster casts. Materials provided. Led by artist-in-residence M. Okafor." }
],
"2026-06-07": [
{ id: "e4", time: "14:00", title: "Family Sunday: Color & Clay", cat: "family", location: "Learning Lab", capacity: 40, taken: 22, desc: "Hands-on making for ages 5–11 inspired by the ceramics gallery. Caregivers welcome." },
{ id: "e5", time: "16:00", title: "Gallery Talk: Reading a Still Life", cat: "talk", location: "Gallery 9", capacity: 30, taken: 11, desc: "Twenty minutes with one painting — Almeida's 'Quinces and Pewter,' 1672, cat. no. ST-044." }
],
"2026-06-11": [
{ id: "e6", time: "12:30", title: "Lunchtime Tour: Modern Wing", cat: "tour", location: "Meet at Gallery 14", capacity: 18, taken: 6, desc: "Postwar abstraction in forty minutes, from Reyes to the Verda Group." }
],
"2026-06-13": [
{ id: "e7", time: "19:00", title: "Members' Preview: After Dusk", cat: "members", location: "East Galleries", capacity: 90, taken: 71, desc: "First look at the summer exhibition with sparkling wine. Membership card required at entry." },
{ id: "e8", time: "10:00", title: "Watercolor Basics", cat: "workshop", location: "Studio 1", capacity: 14, taken: 9, desc: "An introduction to wet-on-wet technique. All levels. Aprons and paper supplied." }
],
"2026-06-15": [
{ id: "e9", time: "13:00", title: "Conservation in Focus", cat: "talk", location: "Auditorium B", capacity: 120, taken: 33, desc: "Head conservator Lena Brandt on relining a 17th-century canvas — before-and-after imaging." }
],
"2026-06-18": [
{ id: "e10", time: "11:00", title: "Architecture Walk", cat: "tour", location: "Front Steps", capacity: 20, taken: 18, desc: "The 1908 Beaux-Arts hall and its 2014 glass annex, with the building archivist." },
{ id: "e11", time: "15:30", title: "Print Workshop: Monotype", cat: "workshop", location: "Studio 3", capacity: 12, taken: 4, desc: "Pull a one-of-a-kind print on the studio press. Ages 16+." }
],
"2026-06-20": [
{ id: "e12", time: "14:00", title: "Family Saturday: Mask Making", cat: "family", location: "Learning Lab", capacity: 40, taken: 38, desc: "Inspired by the masks of the Oceania gallery. Drop-in, ages 4–10." }
],
"2026-06-22": [
{ id: "e13", time: "18:00", title: "Evening Lecture: The Painted Letter", cat: "talk", location: "Auditorium A", capacity: 200, taken: 124, desc: "Visiting scholar Prof. H. Marchetti on text and image in Renaissance portraiture." }
],
"2026-06-25": [
{ id: "e14", time: "19:30", title: "Members' Late Night", cat: "members", location: "Whole Museum", capacity: 150, taken: 60, desc: "Galleries open till 22:00, live cello in the Atrium, cash bar. Bring a guest." },
{ id: "e15", time: "11:30", title: "Sketching the Sculpture Court", cat: "workshop", location: "Sculpture Court", capacity: 16, taken: 7, desc: "Open-air drawing among the bronzes. Bring your own sketchbook; pencils available." }
],
"2026-06-28": [
{ id: "e16", time: "14:00", title: "Family Sunday: Story Trail", cat: "family", location: "Galleries 1–6", capacity: 50, taken: 19, desc: "A guided story trail through six galleries with our museum educators." },
{ id: "e17", time: "16:30", title: "Closing Tour: After Dusk", cat: "tour", location: "East Galleries", capacity: 18, taken: 10, desc: "A last look at the summer show before it travels onward." }
]
};
var MONTHS = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var WEEKDAYS_LONG = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
// ---- State ----
var view = new Date(2026, 5, 1); // June 2026
var today = new Date(2026, 5, 15); // demo "today"
var selectedKey = null;
var activeCat = "all";
var mode = "calendar";
// ---- DOM ----
var grid = document.getElementById("grid");
var monthLabel = document.getElementById("monthLabel");
var panelDate = document.getElementById("panelDate");
var panelBody = document.getElementById("panelBody");
var calendarView = document.getElementById("calendarView");
var listView = document.getElementById("listView");
var toastEl = document.getElementById("toast");
var toastTimer = null;
function key(y, m, d) {
return y + "-" + String(m + 1).padStart(2, "0") + "-" + String(d).padStart(2, "0");
}
function pad(n) { return String(n).padStart(2, "0"); }
function eventsFor(k) {
var list = EVENTS[k] || [];
if (activeCat === "all") return list;
return list.filter(function (e) { return e.cat === activeCat; });
}
function toast(msg) {
toastEl.textContent = msg;
toastEl.classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(function () { toastEl.classList.remove("show"); }, 2600);
}
// ---- Render calendar grid ----
function renderGrid() {
var y = view.getFullYear();
var m = view.getMonth();
monthLabel.textContent = MONTHS[m] + " " + y;
grid.innerHTML = "";
var first = new Date(y, m, 1).getDay();
var days = new Date(y, m + 1, 0).getDate();
for (var i = 0; i < first; i++) {
var blank = document.createElement("div");
blank.className = "cell empty";
grid.appendChild(blank);
}
for (var d = 1; d <= days; d++) {
var k = key(y, m, d);
var list = eventsFor(k);
var cell = document.createElement("button");
cell.type = "button";
cell.className = "cell";
cell.setAttribute("role", "gridcell");
var isToday = (y === today.getFullYear() && m === today.getMonth() && d === today.getDate());
if (isToday) cell.classList.add("today");
if (k === selectedKey) cell.classList.add("selected");
cell.setAttribute("aria-label", WEEKDAYS_LONG[new Date(y, m, d).getDay()] + " " + MONTHS[m] + " " + d + ", " + list.length + " events");
var num = document.createElement("span");
num.className = "num";
num.textContent = d;
cell.appendChild(num);
if (list.length) {
var dots = document.createElement("span");
dots.className = "dots";
var shown = list.slice(0, 4);
shown.forEach(function (e) {
var dot = document.createElement("span");
dot.className = "dot dot-" + e.cat;
dot.title = CATS[e.cat];
dots.appendChild(dot);
});
if (list.length > 4) {
var more = document.createElement("span");
more.className = "more";
more.textContent = "+" + (list.length - 4);
dots.appendChild(more);
}
cell.appendChild(dots);
}
(function (kk) {
cell.addEventListener("click", function () { selectDay(kk); });
})(k);
grid.appendChild(cell);
}
}
// ---- Select a day -> panel ----
function selectDay(k) {
selectedKey = k;
renderGrid();
var parts = k.split("-").map(Number);
var dt = new Date(parts[0], parts[1] - 1, parts[2]);
panelDate.textContent = WEEKDAYS_LONG[dt.getDay()] + ", " + MONTHS[dt.getMonth()] + " " + parts[2];
var list = eventsFor(k);
panelBody.innerHTML = "";
if (!list.length) {
var empty = document.createElement("p");
empty.className = "panel-empty";
empty.textContent = activeCat === "all"
? "No public programs scheduled this day. The galleries are open 10–6."
: "No " + CATS[activeCat].toLowerCase() + " programs this day. Try “All programs.”";
panelBody.appendChild(empty);
return;
}
list.slice().sort(function (a, b) { return a.time.localeCompare(b.time); })
.forEach(function (e) { panelBody.appendChild(eventCard(e)); });
}
// ---- Event card ----
function eventCard(e) {
var left = e.capacity - e.taken;
var card = document.createElement("article");
card.className = "event cat-" + e.cat;
var top = document.createElement("div");
top.className = "event-top";
var time = document.createElement("span");
time.className = "event-time";
time.textContent = e.time;
var badge = document.createElement("span");
badge.className = "badge";
badge.textContent = CATS[e.cat];
top.appendChild(time);
top.appendChild(badge);
card.appendChild(top);
var title = document.createElement("h4");
title.className = "event-title";
title.textContent = e.title;
card.appendChild(title);
var meta = document.createElement("p");
meta.className = "event-meta";
meta.innerHTML = "📍 " + escapeHtml(e.location) + " <span class='sep'>·</span> " + e.capacity + " seats";
card.appendChild(meta);
var desc = document.createElement("p");
desc.className = "event-desc";
desc.textContent = e.desc;
card.appendChild(desc);
var foot = document.createElement("div");
foot.className = "event-foot";
var seatsWrap = document.createElement("div");
var seats = document.createElement("div");
seats.className = "seats";
var bar = document.createElement("div");
bar.className = "seatbar";
var fill = document.createElement("i");
bar.appendChild(fill);
var btn = document.createElement("button");
btn.type = "button";
btn.className = "rsvp-btn";
function refreshSeats() {
var rem = e.capacity - e.taken;
var pct = Math.round((e.taken / e.capacity) * 100);
fill.style.width = pct + "%";
var lvl = rem === 0 ? "full" : rem <= Math.max(3, e.capacity * 0.15) ? "low" : "";
seats.className = "seats" + (lvl ? " " + lvl : "");
bar.className = "seatbar" + (lvl ? " " + lvl : "");
seats.innerHTML = rem === 0
? "<strong>Fully booked</strong> · " + e.capacity + " seats"
: "<strong>" + rem + "</strong> of " + e.capacity + " seats left";
}
function refreshBtn() {
if (e.reserved) {
btn.textContent = "Reserved ✓";
btn.classList.add("reserved");
btn.disabled = false;
btn.setAttribute("aria-label", "Cancel reservation for " + e.title);
} else if (e.capacity - e.taken === 0) {
btn.textContent = "Join waitlist";
btn.classList.remove("reserved");
btn.disabled = false;
} else {
btn.textContent = "Reserve seat";
btn.classList.remove("reserved");
btn.disabled = false;
}
}
btn.addEventListener("click", function () {
if (e.reserved) {
e.reserved = false;
e.taken = Math.max(0, e.taken - 1);
toast("Reservation cancelled — " + e.title);
} else if (e.capacity - e.taken === 0) {
toast("Added to the waitlist for " + e.title);
return;
} else {
e.reserved = true;
e.taken += 1;
toast("Seat reserved — " + e.title + " at " + e.time);
}
refreshSeats();
refreshBtn();
renderGrid();
});
refreshSeats();
refreshBtn();
seatsWrap.appendChild(seats);
seatsWrap.appendChild(bar);
foot.appendChild(seatsWrap);
foot.appendChild(btn);
card.appendChild(foot);
return card;
}
// ---- List view ----
function renderList() {
var y = view.getFullYear();
var m = view.getMonth();
listView.innerHTML = "";
var keys = Object.keys(EVENTS).filter(function (k) {
var p = k.split("-").map(Number);
return p[0] === y && p[1] - 1 === m && eventsFor(k).length;
}).sort();
if (!keys.length) {
var empty = document.createElement("p");
empty.className = "list-empty";
empty.textContent = "No programs match this filter in " + MONTHS[m] + ".";
listView.appendChild(empty);
return;
}
keys.forEach(function (k) {
var p = k.split("-").map(Number);
var dt = new Date(p[0], p[1] - 1, p[2]);
var head = document.createElement("div");
head.className = "list-day-head";
head.textContent = WEEKDAYS_LONG[dt.getDay()] + ", " + MONTHS[dt.getMonth()] + " " + p[2];
listView.appendChild(head);
eventsFor(k).slice().sort(function (a, b) { return a.time.localeCompare(b.time); })
.forEach(function (e) {
var c = eventCard(e);
c.classList.add("list-card");
listView.appendChild(c);
});
});
}
function rerender() {
if (mode === "calendar") {
renderGrid();
if (selectedKey) selectDay(selectedKey);
} else {
renderList();
}
}
function escapeHtml(s) {
return s.replace(/[&<>"']/g, function (c) {
return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c];
});
}
// ---- Wiring ----
document.getElementById("prevMonth").addEventListener("click", function () {
view = new Date(view.getFullYear(), view.getMonth() - 1, 1);
selectedKey = null;
resetPanel();
rerender();
});
document.getElementById("nextMonth").addEventListener("click", function () {
view = new Date(view.getFullYear(), view.getMonth() + 1, 1);
selectedKey = null;
resetPanel();
rerender();
});
document.getElementById("todayBtn").addEventListener("click", function () {
view = new Date(today.getFullYear(), today.getMonth(), 1);
rerender();
selectDay(key(today.getFullYear(), today.getMonth(), today.getDate()));
});
function resetPanel() {
panelDate.textContent = "Select a day";
panelBody.innerHTML = '<p class="panel-empty">Choose a date on the calendar to see talks, tours and workshops scheduled that day.</p>';
}
var calBtn = document.getElementById("calViewBtn");
var listBtn = document.getElementById("listViewBtn");
calBtn.addEventListener("click", function () {
mode = "calendar";
calBtn.classList.add("active"); listBtn.classList.remove("active");
calBtn.setAttribute("aria-selected", "true"); listBtn.setAttribute("aria-selected", "false");
calendarView.hidden = false; listView.hidden = true;
rerender();
});
listBtn.addEventListener("click", function () {
mode = "list";
listBtn.classList.add("active"); calBtn.classList.remove("active");
listBtn.setAttribute("aria-selected", "true"); calBtn.setAttribute("aria-selected", "false");
calendarView.hidden = true; listView.hidden = false;
rerender();
});
Array.prototype.forEach.call(document.querySelectorAll(".chip"), function (chip) {
chip.addEventListener("click", function () {
Array.prototype.forEach.call(document.querySelectorAll(".chip"), function (c) { c.classList.remove("active"); });
chip.classList.add("active");
activeCat = chip.getAttribute("data-cat");
rerender();
});
});
// ---- Init ----
renderGrid();
selectDay(key(today.getFullYear(), today.getMonth(), today.getDate()));
})();<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Meridian Museum of Art — Events & Programs</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="page">
<header class="masthead">
<div class="brand">
<div class="mark" aria-hidden="true">
<svg viewBox="0 0 40 40" width="40" height="40">
<rect x="2" y="2" width="36" height="36" rx="3" fill="none" stroke="currentColor" stroke-width="1.2"/>
<path d="M8 30 L20 10 L32 30" fill="none" stroke="currentColor" stroke-width="1.2"/>
<line x1="14" y1="30" x2="14" y2="20" stroke="currentColor" stroke-width="1.2"/>
<line x1="20" y1="30" x2="20" y2="16" stroke="currentColor" stroke-width="1.2"/>
<line x1="26" y1="30" x2="26" y2="20" stroke="currentColor" stroke-width="1.2"/>
</svg>
</div>
<div class="brand-text">
<p class="kicker">Meridian Museum of Art</p>
<h1>Events & Programs</h1>
</div>
</div>
<nav class="masthead-nav" aria-label="Sections">
<a href="#" class="active">Calendar</a>
<a href="#">Exhibitions</a>
<a href="#">Membership</a>
<a href="#">Visit</a>
</nav>
</header>
<section class="intro">
<p class="lead">Talks, guided tours, studio workshops and family afternoons across our galleries. Browse the month, filter by program, and reserve a seat — admission to public programs is included with membership.</p>
</section>
<div class="toolbar">
<div class="month-nav">
<button id="prevMonth" class="icon-btn" aria-label="Previous month">‹</button>
<h2 id="monthLabel" aria-live="polite">June 2026</h2>
<button id="nextMonth" class="icon-btn" aria-label="Next month">›</button>
<button id="todayBtn" class="ghost-btn">Today</button>
</div>
<div class="view-toggle" role="tablist" aria-label="View mode">
<button id="calViewBtn" class="seg active" role="tab" aria-selected="true">Calendar</button>
<button id="listViewBtn" class="seg" role="tab" aria-selected="false">List</button>
</div>
</div>
<div class="filters" id="filters" role="group" aria-label="Filter by category">
<button class="chip active" data-cat="all">All programs</button>
<button class="chip" data-cat="talk"><span class="dot dot-talk"></span>Talks</button>
<button class="chip" data-cat="tour"><span class="dot dot-tour"></span>Tours</button>
<button class="chip" data-cat="workshop"><span class="dot dot-workshop"></span>Workshops</button>
<button class="chip" data-cat="family"><span class="dot dot-family"></span>Family</button>
<button class="chip" data-cat="members"><span class="dot dot-members"></span>Members</button>
</div>
<main class="layout">
<section class="calendar-region" aria-label="Events calendar">
<!-- Calendar view -->
<div id="calendarView">
<div class="weekdays" aria-hidden="true">
<span>Sun</span><span>Mon</span><span>Tue</span><span>Wed</span><span>Thu</span><span>Fri</span><span>Sat</span>
</div>
<div class="grid" id="grid" role="grid" aria-label="Month grid"></div>
<div class="legend">
<span><span class="dot dot-talk"></span>Talk</span>
<span><span class="dot dot-tour"></span>Tour</span>
<span><span class="dot dot-workshop"></span>Workshop</span>
<span><span class="dot dot-family"></span>Family</span>
<span><span class="dot dot-members"></span>Members</span>
</div>
</div>
<!-- List view -->
<div id="listView" class="list-view" hidden></div>
</section>
<aside class="day-panel" id="dayPanel" aria-label="Selected day events">
<div class="panel-head">
<p class="panel-kicker">Selected date</p>
<h3 id="panelDate">Select a day</h3>
</div>
<div id="panelBody" class="panel-body">
<p class="panel-empty">Choose a date on the calendar to see talks, tours and workshops scheduled that day.</p>
</div>
</aside>
</main>
<footer class="site-foot">
<p>Meridian Museum of Art · 14 Lantern Court · Open Tue–Sun, 10–6</p>
<p class="muted">Illustrative UI only — demo data; not a real museum system.</p>
</footer>
</div>
<div id="toast" class="toast" role="status" aria-live="polite"></div>
<script src="script.js"></script>
</body>
</html>Events & Programs Calendar
A curatorial public-programs calendar for the fictional Meridian Museum of Art. The month grid gives each day generous wall space, marking scheduled programs with small colored dots keyed to five categories — talks, tours, workshops, family afternoons and members-only previews. A row of filter chips narrows the whole calendar to a single program type; an overflow indicator (+2) appears on busy days.
Selecting any day surfaces its events in a sticky side panel. Each event card pairs a serif title with a real-feeling artifact — a curator’s talk on luminist landscapes, a monotype print workshop, a members’ late night with live cello — and shows time, location, total capacity and a live seat counter with a progress bar that shifts to amber when seats run low and red when fully booked. The RSVP button reserves a seat, decrements remaining capacity, can be cancelled, and offers a waitlist when an event is full; a small toast confirms each action.
A Calendar / List toggle swaps the grid for a chronological agenda of the visible month, month navigation steps through past and future, and a Today button jumps back. The layout collapses gracefully to a single column on narrow screens, with keyboard-usable controls, visible focus rings and AA-contrast text throughout.
Illustrative UI only — demo data; not a real museum system.