:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #17201b;
  --muted: #5d6a62;
  --line: #e1e6e0;
  --accent: #0f5132;
  --accent-ink: #ffffff;
  --chip: #e9efe9;
  --indoor: #2f5d8a;
  --outdoor: #8a6a1f;
  --free: #1d7a46;
  --l1: #dcefe2;
  --l2: #9fd3b0;
  --l3: #2e8b57;
  --l3-ink: #ffffff;
  --warn: #c77700;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1510;
    --card: #131f19;
    --ink: #e7eee9;
    --muted: #93a39a;
    --line: #23332a;
    --accent: #5cc58a;
    --accent-ink: #062012;
    --chip: #1b2a22;
    --indoor: #8cb8e6;
    --outdoor: #e2c06c;
    --free: #6fdc9b;
    --l1: #1f4532;
    --l2: #2f7650;
    --l3: #52c487;
    --l3-ink: #04140b;
    --warn: #f0a63a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: max(10px, env(safe-area-inset-top)) 0 8px;
}
.title { padding: 0 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }

.dayhead {
  display: flex; align-items: center; gap: 6px; padding: 8px 16px 0;
}
.dh-step {
  flex: 0 0 auto; width: 36px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); font-size: 20px; line-height: 1; cursor: pointer;
}
.dh-step:disabled { opacity: .35; cursor: default; }
.dh-mid { flex: 1 1 auto; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-day { font-weight: 700; }
.dh-n { color: var(--muted); font-size: 13px; }
.dh-cal {
  flex: 0 0 auto; border: 0; border-radius: 10px; padding: 7px 10px; cursor: pointer;
  background: var(--chip); font-size: 13px; font-weight: 600;
}

/* The month grid. Colour levels: l0 nothing free, l1-l3 thirds of the
   busiest day. Dashed corner: some venues do not publish that day yet. */
.cal, #list { scroll-margin-top: calc(var(--top, 150px) + 4px); }
.cal-title { font-size: 15px; margin: 8px 0 6px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { font-size: 11px; color: var(--muted); text-align: center; text-transform: uppercase; padding-bottom: 2px; }
.cal-day {
  position: relative; min-height: 50px; padding: 4px 2px 3px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.cal-day.out { border-color: transparent; background: transparent; color: var(--muted); opacity: .45; cursor: default; }
.cal-day .cd { font-weight: 600; font-size: 15px; line-height: 1.1; display: flex; flex-direction: column; align-items: center; }
.cal-day .cm { font-size: 9px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.cal-day .cn { font-size: 12px; }
.cal-day.l0 .cn { color: var(--muted); }
.cal-day.l1 { background: var(--l1); border-color: var(--l1); }
.cal-day.l2 { background: var(--l2); border-color: var(--l2); }
.cal-day.l3 { background: var(--l3); border-color: var(--l3); color: var(--l3-ink); }
.cal-day.l3 .cm { color: var(--l3-ink); }
.cal-day.on { outline: 3px solid var(--ink); outline-offset: 1px; }
.cal-day.partial::after, .sw.partial::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--warn);
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.sw { position: relative; display: inline-block; width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--line); background: var(--card); }
.sw.l1 { background: var(--l1); border-color: var(--l1); }
.sw.l2 { background: var(--l2); border-color: var(--l2); }
.sw.l3 { background: var(--l3); border-color: var(--l3); }
.sw.partial::after { top: 4px; right: 4px; }
.cal-note { margin: 6px 0 4px; }
.reach { margin: 12px 0 0; }
.reach details { border-left: 4px solid var(--warn); font-size: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 0; }
.filters::-webkit-scrollbar { display: none; }
.seg { display: flex; flex: 0 0 auto; background: var(--chip); border-radius: 10px; padding: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 9px; border-radius: 8px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.seg button.on { background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.15); font-weight: 600; }

main { padding: 6px 16px 24px; max-width: 720px; margin: 0 auto; }
.loading, .empty { color: var(--muted); padding: 24px 0; text-align: center; }
.hint { color: var(--muted); font-size: 13px; }

.hour { margin-top: 10px; }
.hh {
  position: sticky; top: var(--top, 150px); z-index: 1;
  font-size: 14px; margin: 0 0 4px; padding: 4px 0;
  background: var(--bg); color: var(--muted); font-variant-numeric: tabular-nums;
}
.slot {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 6px;
}
.info { min-width: 0; }
.vn { font-weight: 600; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tag.indoor { color: var(--indoor); }
.tag.outdoor { color: var(--outdoor); }
.time { font-variant-numeric: tabular-nums; }
.courts { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.price { font-size: 14px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price.free { color: var(--free); }
.price.unknown { font-weight: 400; color: var(--muted); font-size: 12px; }
.book {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 6px 14px; border-radius: 9px;
}

.extra { margin-top: 18px; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
summary { font-weight: 600; cursor: pointer; }
ul.plain { list-style: none; padding: 0; margin: 6px 0 0; }
ul.plain li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
ul.plain .area { color: var(--muted); font-size: 13px; }
.links { display: flex; gap: 14px; font-size: 14px; }

.foot { color: var(--muted); font-size: 12px; padding: 0 16px 32px; max-width: 720px; margin: 0 auto; }

table.venues { width: 100%; border-collapse: collapse; font-size: 13px; }
table.venues th, table.venues td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
table.venues th { color: var(--muted); font-weight: 600; }
.status-live { color: var(--free); font-weight: 600; }
.status-phone { color: var(--muted); }

/* A shared link the page had to correct: a past day, a day not yet
   published, an unknown value. */
.notice {
  position: relative; margin: 10px 0 0; padding: 8px 34px 8px 12px; font-size: 14px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 8px;
}
.notice p { margin: 2px 0; }
.notice-x {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; background: transparent;
  font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted);
}
.venue-chip {
  display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0;
  background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 2px 2px 2px 10px; font-size: 13px;
}
.venue-chip[hidden] { display: none; }
.venue-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venue-chip button { border: 0; background: transparent; color: inherit; font-size: 18px; line-height: 1; width: 28px; height: 26px; cursor: pointer; }
.venue-link { color: inherit; text-decoration: none; }
.venue-link:hover { text-decoration: underline; }
.share-said { margin: 6px 16px 0; font-size: 13px; color: var(--free); text-align: right; }

/* The crawlable pages (src/pages.mjs): venue, city and venue list. */
.sitenav { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 16px 0; font-size: 14px; }
.sitenav a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; }
.page h2 { font-size: 17px; margin: 22px 0 4px; }
.page h2 a { color: inherit; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none;
  font-weight: 600; font-size: 15px; border-radius: 10px; padding: 10px 14px; min-height: 44px;
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 12px 0; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip {
  font-size: 13px; font-variant-numeric: tabular-nums; background: var(--l1); border-radius: 6px; padding: 2px 6px;
}
.chip small { color: inherit; opacity: .8; }
.chip.more { background: var(--chip); }
.foot nav a { margin-right: 12px; }
/* The calendar fills in after slots.json loads: keep the footer below the
   first screen meanwhile, or it jumps down (Lighthouse CLS 0.15). */
#main { min-height: 100svh; }
