:root {
  --paper: #eef1ec; --surface: #f9fbf7; --ink: #1c2a3a; --muted: #5a6774; --line: #d2d9d0;
  --signal: #ffd23f; --signal-ink: #1c2a3a;
  --road: #2f5bd3; --gravel: #9a7a1f; --mtb: #b4501e; --cx: #3d7a39;
  --shadow: 0 10px 40px rgba(28, 42, 58, .18);
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121920; --surface: #1a232c; --ink: #e7ebe4; --muted: #97a3ad; --line: #2c3742;
    --road: #7c9bff; --gravel: #d6b552; --mtb: #ee8a57; --cx: #7cbf6d;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121920; --surface: #1a232c; --ink: #e7ebe4; --muted: #97a3ad; --line: #2c3742;
  --road: #7c9bff; --gravel: #d6b552; --mtb: #ee8a57; --cx: #7cbf6d;
  --shadow: 0 10px 40px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--road); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Header + season strip */
.top { max-width: 1180px; margin: 0 auto; padding: 28px 16px 8px; }
.brand { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.logo { font: 800 clamp(44px, 8vw, 76px)/.9 var(--cond); letter-spacing: -.02em; text-decoration: none; }
.logo span { display: inline-block; background: var(--signal); color: var(--signal-ink); padding: 0 .1em; margin-left: .03em; transform: skewX(-8deg); }
.tagline { margin: 0; color: var(--muted); max-width: 46ch; flex: 1 1 260px; }
.lang { margin-left: auto; align-self: center; }
.lang button { font: 700 15px var(--cond); padding: 5px 10px; }

.season { display: grid; grid-template-columns: repeat(var(--n, 15), minmax(0, 1fr)); gap: 3px; margin-top: 22px; align-items: end; }
.season button { all: unset; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; border-radius: 4px; padding: 2px 1px 0; }
.season .bars { display: flex; flex-direction: column-reverse; height: 64px; gap: 1px; justify-content: flex-start; }
.season .bars i { display: block; border-radius: 1px; min-height: 2px; }
.season .lbl { font: 600 13px/1.2 var(--cond); color: var(--muted); text-align: center; padding: 4px 0 3px; border-top: 2px solid var(--line); white-space: nowrap; overflow: hidden; }
.season .lbl b { display: block; font-weight: 500; font-size: 11px; opacity: .8; }
.season button:hover .lbl { color: var(--ink); }
.season button[aria-pressed="true"] .lbl { color: var(--ink); border-top-color: var(--ink); }
.season button:focus-visible { outline: 3px solid var(--road); }

/* Filters */
.filters { position: sticky; top: 0; z-index: 500; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 10px 16px; }
.filters > * { max-width: 1148px; margin-left: auto; margin-right: auto; }
.disc { display: flex; gap: 8px; flex-wrap: wrap; }
.disc button { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--c); background: transparent; color: var(--ink);
  font: 700 17px/1 var(--cond); padding: 7px 12px 6px; border-radius: 999px; cursor: pointer; }
.disc button[aria-pressed="true"] { background: var(--c); color: #fff; }
.disc button small { font: 600 13px var(--cond); opacity: .75; }
.row { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
select, input[type=search] { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; min-width: 0; }
input[type=search] { flex: 1 1 200px; }
.views { display: flex; gap: 4px; margin-top: 10px; }
.views button { border: 0; background: none; padding: 4px 2px; margin-right: 16px; cursor: pointer; font: 700 19px var(--cond); color: var(--muted); border-bottom: 3px solid transparent; }
.views button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); }

main { max-width: 1180px; margin: 0 auto; padding: 8px 16px 40px; }
.summary { color: var(--muted); margin: 10px 0 0; font-size: 15px; }

/* Calendar list */
.month { margin-top: 26px; }
.month h2 { font: 800 34px/1 var(--cond); margin: 0 0 6px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 12px; }
.month h2 small { font: 600 16px var(--cond); color: var(--muted); }
.ev { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 12px 0;
  border-top: 1px solid var(--line); cursor: pointer; text-decoration: none; }
.ev:hover .name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.date { border-left: 4px solid var(--c, var(--ink)); padding-left: 10px; font-family: var(--cond); line-height: 1; }
.date .d { font-weight: 800; font-size: 30px; display: block; }
.date .w { font-weight: 600; font-size: 13px; color: var(--muted); }
.date.tbc .d { font-size: 18px; padding-top: 6px; color: var(--muted); }
.ev .name { font: 700 21px/1.15 var(--cond); margin: 0; }
.ev .meta { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.ev .meta .facts { color: var(--ink); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.tag { font: 600 13px/1 var(--cond); padding: 4px 7px 3px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag.dis { border: 0; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.tag.warn { border-style: dashed; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 8px 14px 7px; font: 700 16px/1 var(--cond);
  text-decoration: none; border: 1px solid var(--line); background: var(--surface); cursor: pointer; white-space: nowrap; }
.btn.go { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn.go:hover { filter: brightness(.95); }
.star { border: 0; background: none; cursor: pointer; font-size: 22px; line-height: 1; padding: 2px 4px; color: var(--muted); }
.star[aria-pressed="true"] { color: #e0a800; }
.regnote { font-size: 13px; color: var(--muted); }
.empty { padding: 40px 0; color: var(--muted); }
.empty button { margin-top: 10px; }

.map { height: calc(100vh - 260px); min-height: 420px; margin-top: 14px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.leaflet-popup-content { font: 15px/1.4 var(--sans); }
.leaflet-popup-content b { font: 700 18px var(--cond); }

/* Detail sheet */
.scrim { position: fixed; inset: 0; background: rgba(10, 16, 22, .45); z-index: 900; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--surface); z-index: 1000; overflow-y: auto;
  box-shadow: var(--shadow); animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-inner { padding: 0 0 40px; }
.hero { position: relative; min-height: 120px; background: var(--c); color: #fff; padding: 56px 24px 20px; background-size: cover; background-position: center; }
.hero.img::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.72)); }
.hero > * { position: relative; }
.hero h1 { font: 800 clamp(34px, 6vw, 46px)/.95 var(--cond); margin: 0; }
.hero .where { margin-top: 8px; font-weight: 500; }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.35);
  color: #fff; font-size: 24px; cursor: pointer; }
.body { padding: 18px 24px; }
.when { font: 700 24px/1.1 var(--cond); }
.when small { display: block; font: 500 14px var(--sans); color: var(--muted); margin-top: 4px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.cta .btn { font-size: 18px; padding: 11px 16px 10px; }
.desc { font-size: 17px; line-height: 1.6; max-width: 62ch; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; margin: 18px 0; }
.facts-grid div { background: var(--surface); padding: 10px 12px; }
.facts-grid dt { font-size: 13px; color: var(--muted); }
.facts-grid dd { margin: 2px 0 0; font: 700 19px/1.2 var(--cond); }
.body h3 { font: 700 20px var(--cond); margin: 22px 0 8px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 500; }
.links a svg { width: 18px; height: 18px; }
.links a.strava { border-color: #fc4c02; color: #fc4c02; }
.src { font-size: 14px; color: var(--muted); padding-left: 18px; }
.src li { margin: 3px 0; }
.small { font-size: 13px; color: var(--muted); }

.foot { max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }

@media (max-width: 640px) {
  .season { gap: 1px; }
  .season .lbl { font-size: 11px; }
  .season .lbl b { display: none; }
  .season .bars { height: 44px; }
  .ev { grid-template-columns: 58px minmax(0, 1fr); }
  .ev .side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
  .date .d { font-size: 26px; }
  .month h2 { font-size: 28px; }
  .hero { padding: 56px 16px 18px; }
  .body { padding: 16px; }
  .views button { margin-right: 10px; }
}

/* Server-rendered content (lib/seo.mjs): page heading, intro, event page before app.js takes over */
.page-title { font: 800 clamp(28px, 4.4vw, 40px)/1.05 var(--cond); margin: 18px 0 4px; letter-spacing: -.01em; }
.intro { color: var(--muted); max-width: 70ch; margin: 6px 0 0; }
.ssr-event { max-width: 70ch; padding: 10px 0 30px; }
.ssr-event h1 { font: 800 clamp(34px, 6vw, 48px)/1 var(--cond); margin: 10px 0 8px; }
.ssr-event .when { font: 700 20px/1.3 var(--cond); }
.discnav { line-height: 1.9; }
.discnav a { color: var(--muted); }

/* A–Z site index (/alle-events, /en/all-events) */
.az { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 14px 0; font: 700 18px var(--cond); }
.az-group h2 { font: 800 30px/1 var(--cond); margin: 22px 0 6px; }
.az-group ul { list-style: none; padding: 0; margin: 0; columns: 2 320px; column-gap: 28px; }
.az-group li { break-inside: avoid; padding: 4px 0; border-top: 1px solid var(--line); }
.az-group li > a { font-weight: 600; }

/* Reports & articles (detail sheet and server-rendered event page) */
.articles { list-style: none; padding: 0; margin: 0; }
.articles li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.articles li:first-child { border-top: 0; }
.articles img { width: 84px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; background: var(--line); }
.articles a { font-weight: 600; text-decoration: none; display: block; line-height: 1.3; }
.articles a:hover { text-decoration: underline; }
.articles .small { display: block; margin-top: 2px; }
.art-h { font: 700 22px var(--cond); margin: 26px 0 6px; }
