:root {
  --paper: #f3efe6;
  --paper-2: #ebe6da;
  --card: #fbf9f4;
  --ink: #1c1b18;
  --ink-2: #45423b;
  --muted: #66625a;
  --line: #ddd6c7;
  --accent: #e5482a;
  --accent-ink: #b9361b;
  --panel: 472px;
  --ch: 0px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Schibsted Grotesk", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: grid; grid-template-columns: var(--panel) 1fr; height: 100dvh; }
.panel { overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); background: var(--paper); }
.mapwrap { position: relative; }
#map { position: absolute; inset: 0; }

/* Masthead: wordmark, one quiet line, then a sentence that summarises the current selection. */
.masthead { padding: 26px 28px 16px; }
.brand { margin: 0; font: 650 26px/1 var(--serif); letter-spacing: -0.025em; font-variation-settings: "opsz" 72; }
.brand a { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 1.5px dashed var(--accent);
  background: radial-gradient(circle, var(--accent) 0 4px, transparent 4.5px);
}
.kicker { margin: 6px 0 0 33px; font-size: 12.5px; color: var(--muted); }
.summary { margin: 16px 0 0; font-size: 16px; line-height: 1.45; color: var(--ink-2); min-height: 46px; text-wrap: pretty; }
.summary b { color: var(--ink); font-weight: 650; }
.summary button {
  border: 0; background: none; padding: 0; font-weight: 600; color: var(--ink);
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.summary button:hover { text-decoration-color: var(--accent); }
.summary .n { color: var(--muted); font-weight: 500; }

/* Controls stay visible while the list scrolls. */
.controls {
  position: sticky; top: 0; z-index: 6;
  background: color-mix(in srgb, var(--paper) 95%, transparent); backdrop-filter: blur(8px);
  padding: 4px 28px 12px; border-bottom: 1px solid var(--line);
}
.presets { display: flex; gap: 18px; }
.preset { background: none; border: 0; padding: 8px 0 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.preset:hover { color: var(--ink); }
.preset[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Day strip: bar height is the number of events that day, on a shared baseline. */
.strip-wrap { margin: 0 -28px; padding: 0 28px; overflow-x: auto; scrollbar-width: none; }
.strip-wrap::-webkit-scrollbar { display: none; }
.strip { display: flex; padding-top: 12px; border-bottom: 1px solid var(--line); min-width: 100%; }
.day {
  position: relative; flex: 1 1 0; min-width: 28px; padding: 0; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.day .bar { order: 1; width: 100%; height: 30px; padding: 0 5px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.day .bar i { display: block; width: 100%; background: color-mix(in srgb, var(--ink) 26%, transparent); border-radius: 2px 2px 0 0; }
.day .cnt { font-size: 10px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 3px; visibility: hidden; }
.day:hover .cnt, .day.sel .cnt { visibility: visible; }
.day .wd { order: 2; margin-top: 6px; font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.day.we .wd { color: var(--accent-ink); }
.day .dn { order: 3; font: 600 15px/1.25 var(--serif); font-variant-numeric: lining-nums; padding-bottom: 6px; }
.day .mo { position: absolute; top: -11px; left: 3px; font-size: 9.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.day:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.day.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.day.sel .bar i { background: var(--accent); }
.day.sel .cnt { color: var(--accent-ink); }

.chips-wrap { margin: 10px -28px 0; padding: 0 28px; overflow-x: auto; scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 36px), transparent); }
.chips-wrap::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 6px; width: max-content; padding: 2px 8px 2px 0; }
.chip {
  --g: var(--ink);
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 550; color: var(--ink-2); white-space: nowrap;
}
.chip:hover:not(:disabled) { border-color: var(--g); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--g); }
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--g) 15%, var(--card)); border-color: var(--g); color: var(--ink); }
.chip.all[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip.all[aria-pressed="true"] .n { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.chip:disabled { opacity: .4; cursor: default; }

.row-controls { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; border-bottom: 1.5px solid var(--line); padding: 5px 0; min-width: 0; }
.search:focus-within { border-bottom-color: var(--ink); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; flex: none; }
.search input { border: 0; background: none; font-size: 14px; width: 100%; outline: none; }
.search input::placeholder { color: var(--muted); }
.radius select {
  appearance: none; border: 0; border-bottom: 1.5px solid var(--line); background: transparent; padding: 5px 18px 5px 0;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: right 5px center, right 0 center; background-size: 5px 5px; background-repeat: no-repeat;
}

.placebar[hidden] { display: none; }
.placebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 28px 0; padding: 10px 14px; background: var(--ink); color: var(--paper); border-radius: 10px; font-size: 13.5px; }
.placebar-label strong { font-weight: 650; }
.placebar button { background: none; border: 0; color: var(--paper); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 0; white-space: nowrap; }

/* Picks: village events lead the page. */
.picks[hidden] { display: none; }
.picks { padding: 18px 0 0; }
.picks h2 { margin: 0 28px 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.picks-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 28px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.picks-row::-webkit-scrollbar { display: none; }
.pick {
  flex: none; width: 196px; scroll-snap-align: start; text-align: left; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); padding: 12px 13px 13px; display: grid; gap: 4px; align-content: start;
}
.pick:hover { border-color: var(--ink-2); }
.pick .town { font: 650 21px/1.05 var(--serif); letter-spacing: -0.02em; display: flex; align-items: center; gap: 7px; }
.pick .town i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pick .what { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick .when { font-size: 12.5px; color: var(--muted); }

/* List */
.list { padding: 0 28px 40px; }
.list section + section { margin-top: 26px; }
.dayhead {
  position: sticky; top: var(--ch); z-index: 4; background: var(--paper);
  display: flex; align-items: baseline; gap: 12px; margin: 0; padding: 16px 0 6px; border-bottom: 2px solid var(--ink);
}
.dayhead .num { font: 600 44px/0.9 var(--serif); letter-spacing: -0.035em; font-variation-settings: "opsz" 144; }
.dayhead .lab { display: grid; line-height: 1.2; }
.dayhead .lab b { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dayhead .lab span { font-size: 13px; color: var(--muted); }
.dayhead .cnt { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.place { display: flex; align-items: baseline; gap: 8px; margin: 20px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--ink); }
.place .ba, .place .km { font-weight: 500; color: var(--muted); font-size: 12.5px; }

.ev { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 0 10px; padding: 10px 8px 11px; margin: 0 -8px; cursor: pointer; }
.ev + .ev { border-top: 1px solid var(--line); }
.ev:hover, .ev.hl { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.ev.sel { background: var(--card); }
.ev.sel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.ev .tm { font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; padding-top: 1px; }
.ev .tm.day { font-size: 11.5px; font-weight: 600; color: var(--muted); padding-top: 3px; }
.ev .ti { font-size: 15.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.ev .me { margin-top: 3px; font-size: 13px; color: var(--muted); }
.ev .me .v { color: var(--ink-2); }
.ev .me .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.ev .warn { color: var(--accent-ink); font-weight: 600; }
.ev .more { grid-column: 2; display: none; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.ev.sel .more { display: block; }
.ev .more p { margin: 0 0 8px; }
.ev .links { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: baseline; font-size: 13px; font-weight: 600; }
.ev .links a, .ev .links button { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; background: none; border: 0; padding: 0; }
.ev .links a:hover, .ev .links button:hover { text-decoration-color: var(--ink); }
.ev .links .src { color: var(--muted); font-weight: 500; }

.empty { padding: 48px 0; color: var(--ink-2); }
.empty h3 { font: 600 24px/1.2 var(--serif); margin: 0 0 6px; color: var(--ink); }
.loading { padding: 48px 0; color: var(--muted); }
.colophon { padding: 22px 28px 90px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.colophon b { color: var(--ink-2); font-weight: 600; }

/* Map chrome */
.legend {
  position: absolute; top: 16px; left: 16px; z-index: 2; pointer-events: none;
  background: rgba(251, 249, 244, .94); backdrop-filter: blur(6px); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 12px; font-size: 13px; color: var(--ink-2); box-shadow: 0 2px 10px rgba(28, 27, 24, .07);
}
.legend:empty { display: none; }
.legend b { color: var(--ink); font-weight: 650; }
.maplibregl-ctrl-attrib { font-size: 10.5px; background: rgba(243, 239, 230, .85) !important; }
.maplibregl-ctrl-group { border-radius: 9px !important; box-shadow: 0 1px 4px rgba(28, 27, 24, .15) !important; }
.maplibregl-popup-content { font: 13px/1.35 var(--sans); padding: 9px 12px; border-radius: 10px; box-shadow: 0 8px 24px rgba(28, 27, 24, .18); background: var(--card); max-width: 260px; }
.maplibregl-popup-tip { border-top-color: var(--card) !important; border-bottom-color: var(--card) !important; }
.pop b { display: block; font-weight: 650; color: var(--ink); }
.pop span { color: var(--muted); }
.pop button { margin-top: 8px; border: 0; border-radius: 8px; background: var(--ink); color: var(--paper); padding: 7px 10px; font-weight: 600; font-size: 13px; width: 100%; }

.toggle { display: none; }

/* Phone and small tablet: list first, the map opens full screen. */
@media (max-width: 900px) {
  :root { --panel: 100%; }
  .app { grid-template-columns: 1fr; }
  .panel { border-right: 0; }
  .masthead { padding: 18px 16px 6px; }
  .brand { font-size: 22px; }
  .brand-mark { width: 19px; height: 19px; }
  .kicker { margin-left: 30px; }
  .summary { font-size: 15px; margin-top: 12px; min-height: 0; }
  .controls { position: static; padding: 2px 16px 12px; backdrop-filter: none; }
  .presets { gap: 14px; }
  .strip-wrap { margin: 0 -16px; padding: 0 16px; mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .strip { width: max-content; }
  .day { flex: none; width: 34px; }
  .chips-wrap { margin: 10px -16px 0; padding: 0 16px; }
  .list { padding: 0 16px 40px; }
  .picks h2 { margin: 0 16px 10px; }
  .picks-row { padding: 0 16px 4px; }
  .placebar { margin: 12px 16px 0; }
  .colophon { padding: 22px 16px 110px; }
  .mapwrap { position: fixed; inset: 0; z-index: 20; }
  /* Hidden but sized, so the map renders before it is opened; its controls must hide too. */
  .app:not(.show-map) .mapwrap { visibility: hidden; }
  .app:not(.show-map) .maplibregl-control-container, .app:not(.show-map) .legend { display: none; }
  .maplibregl-ctrl-top-right { display: none; }
  .toggle {
    display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 30; left: 50%;
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 14px));
    transform: translateX(-50%); padding: 11px 18px; border: 0; border-radius: 999px; background: var(--ink); color: var(--paper);
    font-weight: 650; font-size: 14px; box-shadow: 0 6px 22px rgba(28, 27, 24, .3);
  }
  .toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
  .toggle .i-list { display: none; }
  .app.show-map .toggle .i-list { display: block; }
  .app.show-map .toggle .i-map { display: none; }
}
