:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --ink: #1d2433;
  --muted: #5d6475;
  --line: #e3ded3;
  --brand: #17375e;       /* Chemung River blue */
  --brand-ink: #ffffff;
  --accent: #d9822b;      /* glass-furnace amber */
  --accent-ink: #1d1206;
  --chip: #ece7dc;
  --chip-on: #17375e;
  --chip-on-ink: #ffffff;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 14px rgba(20, 30, 50, .06);
  --cat-music: #8a3ffc; --cat-arts: #0f7b8a; --cat-family: #d0457a; --cat-learning: #3a6fd8;
  --cat-sports: #2e8540; --cat-food: #c0611b; --cat-community: #6b6f7b;
  color-scheme: light;
}
/* Dark mode applies to the Classic theme only; the other themes (data-skin) set their own palettes. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-skin]) {
    --bg: #12161f; --surface: #1b212d; --ink: #e9ecf2; --muted: #a2a9b8; --line: #2b3342;
    --brand: #2b5486; --chip: #252d3b; --chip-on: #e9ecf2; --chip-on-ink: #12161f;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --cat-music: #b38cff; --cat-arts: #4cc3d1; --cat-family: #f07aa5; --cat-learning: #7fa6f5;
    --cat-sports: #6cc47e; --cat-food: #f0a060; --cat-community: #a5aab6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161f; --surface: #1b212d; --ink: #e9ecf2; --muted: #a2a9b8; --line: #2b3342;
  --brand: #2b5486; --chip: #252d3b; --chip-on: #e9ecf2; --chip-on-ink: #12161f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* e.g. "Show more" when there's nothing more; .btn's display would otherwise win */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.masthead { background: var(--brand); color: var(--brand-ink); padding: 28px 0 24px; position: relative; overflow: hidden; }
.masthead-inner { position: relative; z-index: 1; }
.dateline, .masthead-art { display: none; }            /* hooks for themes */
@media (max-width: 560px) {
  .dateline .dl-places { display: none; }              /* phones: just the date */
  :root[data-skin] .masthead { padding-top: 26px; }    /* themed headers: less top space on phones */
}
.masthead-inner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.masthead h1 { font: 700 clamp(28px, 5vw, 40px)/1.1 Fraunces, Georgia, serif; margin: 0; letter-spacing: -.01em; }
.tagline { margin: 6px 0 0; opacity: .85; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 15px Inter, sans-serif; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-accent:hover { filter: brightness(1.06); border-color: transparent; }
.btn-primary { background: var(--brand); color: #fff; border-color: transparent; }

/* Filters */
.filters {
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 12px 0 4px;
}
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 260px; position: relative; display: flex; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input, select {
  width: 100%; padding: 10px 12px 10px 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit;
}
select { width: auto; padding-left: 12px; flex: 0 0 auto; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 15px; color: var(--muted); white-space: nowrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: 0 0 auto; border: 0; border-radius: 999px; padding: 7px 14px; background: var(--chip); color: var(--ink);
  font: 500 14px Inter, sans-serif; cursor: pointer;
}
.chips button[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); }
.chips-cat { padding-top: 0; }

/* List */
.count { color: var(--muted); font-size: 14px; margin: 16px 0 4px; }
.day h2 {
  font: 600 20px/1.2 Fraunces, Georgia, serif; margin: 26px 0 10px; display: flex; gap: 10px; align-items: baseline;
}
.day h2 .rel { font: 600 12px Inter, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.card {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: start; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  margin-bottom: 10px; box-shadow: var(--shadow); text-align: left; color: inherit; font: inherit; cursor: pointer;
}
.card:hover { border-color: var(--muted); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.time { font-weight: 600; font-size: 14px; color: var(--muted); padding-top: 2px; }
.card h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.3; }
.where { margin: 0; color: var(--muted); font-size: 14px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--chip); }
.tag.cat { color: #fff; background: var(--c, var(--cat-community)); }
.tag.free { background: #e1f3e5; color: #1f6b33; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-skin]) .tag.free { background: #1f3a27; color: #8fdc9f; } }
.thumb { width: 88px; height: 88px; border-radius: 10px; object-fit: cover; background: var(--chip); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.more { text-align: center; margin: 20px 0 40px; }

/* Dialog */
dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(10, 15, 25, .55); }
dialog .close {
  position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; z-index: 1;
}
.d-img { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.d-content { padding: 20px 22px 24px; }
.d-content h2 { font: 700 24px/1.2 Fraunces, Georgia, serif; margin: 0 0 12px; padding-right: 30px; }
.d-meta { display: grid; gap: 6px; margin: 0 0 14px; color: var(--muted); }
.d-meta strong { color: var(--ink); font-weight: 600; }
.d-desc { white-space: pre-line; margin: 0 0 18px; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.d-source { font-size: 13px; color: var(--muted); margin-top: 16px; }

.footer { color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); padding-top: 20px; padding-bottom: 40px; }
.sources a { color: var(--muted); }

@media (max-width: 560px) {
  .card { grid-template-columns: 1fr auto; }
  .time { grid-column: 1 / -1; padding: 0; }
  .thumb { width: 64px; height: 64px; }
  .masthead .btn { width: 100%; justify-content: center; }
  select { flex: 1 1 auto; }
}

/* Forms (submit + admin pages) */
.page { max-width: 680px; margin: 0 auto; padding: 24px 16px 60px; }
.page h1 { font: 700 30px/1.2 Fraunces, Georgia, serif; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.form input, .form select, .form textarea {
  font: 400 16px Inter, sans-serif; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); width: 100%;
}
.form textarea { min-height: 140px; resize: vertical; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.hp { position: absolute; left: -9999px; }
.notice { padding: 12px 14px; border-radius: 10px; background: #e1f3e5; color: #1f6b33; }
.notice.err { background: #fbe3e3; color: #8a1f1f; }
table.admin { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin td, table.admin th { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.inline { display: inline; }
