:root {
  --bg: #faf5ee;
  --surface: #ffffff;
  --surface-2: #f2ebe1;
  --ink: #221b17;
  --muted: #74675d;
  --line: #e6dccf;
  --accent: #c8385e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3e9;
  --shadow: 0 1px 2px rgb(60 40 20 / .06), 0 6px 20px rgb(60 40 20 / .07);
  --radius: 16px;
  /* one colour per member, in data.json order */
  --c0: #c8385e; --c1: #2f7d6d; --c2: #d98a1f; --c3: #4a62c4; --c4: #8a4fb8;
  --c-none: #9a8f86;
  --display: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1512;
    --surface: #241e1a;
    --surface-2: #2e2622;
    --ink: #f3ece4;
    --muted: #b3a597;
    --line: #3a302a;
    --accent: #f06d8f;
    --accent-ink: #1a1512;
    --accent-soft: #3d2229;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    --c0: #f06d8f; --c1: #4fb8a2; --c2: #f0a945; --c3: #7f95f0; --c4: #b884e0;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h, 160px) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
/* Member initials: "Ja" renders as J with a raised a */
.ini { white-space: nowrap; }
.ini sup { font-size: .6em; line-height: 0; vertical-align: .55em; margin-left: .03em; font-weight: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 16px; }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { width: 56px; height: 56px; border-radius: 50%; box-shadow: var(--shadow); }
h1 {
  margin: 0;
  font: 900 clamp(2rem, 8vw, 3.4rem)/1 var(--display);
  letter-spacing: -0.02em;
}
.tagline { margin: 4px 0 0; color: var(--muted); }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 20px 0 0;
}
.stats div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stats dd { margin: 2px 0 0; font: 700 1.6rem/1.1 var(--display); }
.stats .next { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stats .next dt { color: inherit; opacity: .85; }

/* ---------- Filters ---------- */
.filters {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 6px;
}
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }

.row-top { justify-content: space-between; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; flex: none; }
.seg button {
  border: 0; background: none; border-radius: 999px; padding: 0 11px; height: 34px;
  font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.chips { overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips .label { font-size: 12px; color: var(--muted); white-space: nowrap; margin-right: 2px; }
.chip {
  --c: var(--c-none);
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px 0 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-weight: 700; cursor: pointer;
}
.chip::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c); opacity: .9;
}
.chip small { font-weight: 500; color: var(--muted); font-size: 12px; }
.chip[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.chip[aria-pressed="true"]::before { background: #fff; opacity: .9; }
.chip[aria-pressed="true"] small { color: rgb(255 255 255 / .85); }

.selects { display: none; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters.open .selects { display: grid; }
.toggle {
  flex: none; height: 40px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.toggle b {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
}
.toggle b:empty { display: none; }
.filters.open .toggle { border-color: var(--ink); }
.selects label { min-width: 0; }
.selects select {
  width: 100%; height: 38px; padding: 0 30px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
  font-size: 14px; cursor: pointer;
}
.selects select.on { border-color: var(--accent); background-color: var(--accent-soft); font-weight: 600; }
.status { justify-content: space-between; min-height: 24px; margin: 0; }
#count { margin: 0; font-size: 13px; color: var(--muted); }
#count strong { color: var(--ink); }
.clear {
  border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 0;
}

/* ---------- Layout ---------- */
.layout { padding-top: 16px; padding-bottom: 24px; }
.layout[data-view="list"] .map-pane { display: none; }
.layout[data-view="map"] .list { display: none; }
.map-pane { position: relative; }
#map {
  height: calc(100dvh - var(--bar-h, 160px) - 32px); min-height: 320px;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}

/* ---------- Cards ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card[hidden], .interlude[hidden] { display: none; }
.card.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--accent); } 100% { box-shadow: var(--shadow); } }
.media { position: relative; aspect-ratio: 2 / 1; background: var(--surface-2); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.card.is-closed .media img { filter: grayscale(.85); }
.ph { display: grid; place-items: center; height: 100%; font: 900 3rem var(--display); color: var(--line); }
.num {
  position: absolute; right: 10px; bottom: 10px;
  font: 700 13px/1 var(--sans); color: #fff; background: rgb(0 0 0 / .45);
  padding: 5px 8px; border-radius: 999px; backdrop-filter: blur(4px);
}
.chooser {
  --c: var(--c-none);
  position: absolute; left: 10px; top: 10px;
  min-width: 40px; height: 40px; padding: 0 8px; display: grid; place-items: center;
  background: var(--c); color: #fff; border-radius: 999px; border: 2px solid #fff;
  font: 900 18px/1 var(--display); box-shadow: 0 2px 6px rgb(0 0 0 / .25);
}
.body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.when { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.card h3 { margin: 2px 0 6px; font: 700 1.45rem/1.15 var(--display); letter-spacing: -0.01em; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.meta { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 14px; color: var(--muted); }
.tag { background: var(--surface-2); color: var(--ink); padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.area a { text-decoration: none; }
.area a:hover { text-decoration: underline; }
.area::before { content: "📍"; margin-right: 3px; font-size: 12px; }
.notes { margin: 10px 0 0; font-size: 14px; color: var(--muted); font-style: italic; }
.foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.who { list-style: none; margin: 0; padding: 0; display: flex; }
.who li {
  width: 28px; height: 28px; margin-right: -6px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--surface-2); border: 2px solid var(--surface);
}
.pin {
  margin-left: auto; border: 1px solid var(--line); background: none; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.pin:hover { color: var(--accent); border-color: var(--accent); }
.interlude {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted);
  font: 700 1.2rem var(--display);
}
.interlude small { font: 500 13px var(--sans); }
.empty { text-align: center; color: var(--muted); padding: 48px 0; font: 500 1.1rem var(--display); }
.foot-note { color: var(--muted); font-size: 13px; text-align: center; padding-bottom: 32px; }

/* ---------- Map bits ---------- */
.marker {
  --c: var(--c-none);
  width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--c); border: 2px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .3);
  display: grid; place-items: center;
}
.marker span { transform: rotate(45deg); color: #fff; font: 800 11px/1 var(--sans); }
.marker.closed { opacity: .55; }
.leaflet-container { font: 14px/1.4 var(--sans); background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; }
.pop strong { display: block; font: 700 1.1rem/1.2 var(--display); }
.pop span { color: var(--muted); font-size: 13px; }
.pop button { margin-top: 8px; border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.leaflet-control-attribution { font-size: 10px; }

/* Member colours: after .chip/.chooser/.marker so they win */
.c0 { --c: var(--c0); } .c1 { --c: var(--c1); } .c2 { --c: var(--c2); } .c3 { --c: var(--c3); } .c4 { --c: var(--c4); }

/* ---------- Bigger screens ---------- */
@media (min-width: 640px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .selects, .filters .selects { display: grid; grid-template-columns: repeat(4, 1fr); }
  .toggle { display: none; }
  .chips { overflow: visible; flex-wrap: wrap; margin-inline: 0; padding-inline: 0; }
}
@media (min-width: 1024px) {
  .hero { padding: 40px 0 24px; }
  .hero .wrap { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 32px; }
  .stats { margin: 0; grid-template-columns: repeat(4, minmax(100px, auto)); }
  .brand img { width: 72px; height: 72px; }
  .seg { display: none; }
  .row-top { display: none; }
  .filters .wrap { display: grid; grid-template-columns: auto 1fr; gap: 10px 24px; align-items: center; }
  .filters .selects { grid-template-columns: repeat(4, minmax(0, 200px)); }
  .row { margin-bottom: 0; }
  .row-top, .chips { margin-bottom: 0; }
  .status { grid-column: 1 / -1; margin-top: -4px; }
  .layout, .layout[data-view] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 42%); gap: 24px; align-items: start; }
  .layout[data-view] .list, .layout[data-view] .map-pane { display: block; }
  .map-pane { position: sticky; top: calc(var(--bar-h, 120px) + 16px); }
  #map { height: calc(100vh - var(--bar-h, 120px) - 32px); }
}
@media (min-width: 1280px) {
  .layout, .layout[data-view] { grid-template-columns: minmax(0, 1fr) minmax(420px, 38%); }
}
@media (min-width: 1600px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgb(60 40 20 / .08), 0 12px 32px rgb(60 40 20 / .12); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
