:root {
  --bg: #ffffff;
  --soft: #f4f4f5;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-2: #d4d4d8;
  --accent: #c2410c;
  --accent-ink: #9a3412;
  --accent-soft: #fff7ed;
  --on-accent: #ffffff;
  --new: #115e59;
  --new-soft: #ccfbf1;
  --warn: #854d0e;
  --warn-soft: #fef3c7;
  --changed: #3730a3;
  --changed-soft: #e0e7ff;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --soft: #1f1f23;
    --text: #f4f4f5;
    --text-2: #d4d4d8;
    --muted: #a1a1aa;
    --line: #2e2e33;
    --line-2: #3f3f46;
    --accent: #fb923c;
    --accent-ink: #fdba74;
    --accent-soft: #3a1f0f;
    --on-accent: #1c0a00;
    --new: #5eead4;
    --new-soft: #133b37;
    --warn: #fcd34d;
    --warn-soft: #3a2e0c;
    --changed: #a5b4fc;
    --changed-soft: #23264a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ------------------------------------------------------------ navigace */
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
/* „kdesedemonstruje.cz / Praha“ – první část vede na rozcestník měst */
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand-home { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-home:hover span { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.brand-home b { color: var(--accent); }
.brand-sep { color: var(--line-2); font-weight: 500; }
.brand-city { color: var(--text); }
@media (max-width: 480px) { .brand-home span { display: none; } }
.sync { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.sync.err { color: var(--accent-ink); }
.btn-dark {
  height: 40px; padding: 0 16px; border: 0; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600;
}
.btn-dark:hover { opacity: .88; }
.btn-dark:disabled { opacity: .55; cursor: progress; }
.btn-line {
  height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--bg); font-size: 14px;
}
.btn-line:hover { border-color: var(--text); }

/* ------------------------------------------------------------ hero */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px 48px; padding: 44px 0 32px; }
.hero-text { flex: 999 1 520px; min-width: 0; }
.eyebrow { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.hero h1 {
  margin: 0; font-family: var(--display); font-weight: 700;
  font-size: clamp(32px, 5vw, 56px); line-height: 1.05; letter-spacing: -0.03em;
}
.source { margin: 16px 0 0; color: var(--muted); font-size: 14px; }

.strip { flex: 1 1 440px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.strip button {
  min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 10px; border: 0; border-radius: 14px; background: var(--soft); text-align: left;
}
.hero-text, .strip { min-width: 0; }
@media (max-width: 560px) {
  .strip { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 68px; overflow-x: auto; padding-bottom: 4px; }
}
.strip button:hover { background: var(--line); }
.strip button.on { background: var(--accent); color: var(--on-accent); }
.strip .dow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.strip .num { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1.1; }
.strip .cnt { font-size: 12px; opacity: .8; white-space: nowrap; }
.strip button.zero .num, .strip button.zero .cnt { opacity: .45; }

/* ------------------------------------------------------------ rozložení */
.layout { display: flex; flex-wrap: wrap; gap: 32px 48px; padding-bottom: 80px; }
.filters {
  flex: 1 1 280px; max-width: 320px; min-width: 0; align-self: flex-start;
  display: flex; flex-direction: column; gap: 28px;
  /* posouvá se se stránkou a drží na místě; vyšší panel než okno dorovnává JS (stickySidebar v app.js) */
  position: sticky; top: 20px;
}
.filters > * { flex-shrink: 0; }
.results { flex: 999 1 600px; min-width: 0; }
@media (max-width: 960px) {
  .filters { max-width: none; position: static; }
}

/* ------------------------------------------------------------ filtry */
/* vyhledávání zůstává vždy vidět, zbytek panelu pod ním podjíždí */
.search-wrap {
  position: sticky; top: 0; z-index: 2;
  margin: -12px 0; padding: 12px 0; background: var(--bg);
}
@media (max-width: 960px) { .search-wrap { position: static; } }
/* „Zrušit filtry“ hned pod vyhledáváním, jen když je něco nastavené */
.reset-side { display: flex; justify-content: flex-end; padding: 8px 4px 0; }
.reset-side[hidden] { display: none; }
.reset-side .link-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--accent-ink); text-decoration-color: currentColor; }
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px;
  border: 1.5px solid var(--text); border-radius: 999px;
}
.search input { border: 0; outline: none; background: transparent; width: 100%; min-width: 0; }
.search:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

.group { display: flex; flex-direction: column; gap: 10px; }
.group h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button {
  height: 34px; padding: 0 13px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--bg); font-size: 14px; font-weight: 500; color: var(--text-2);
}
.pills button:hover { border-color: var(--text); }
.pills button.on { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }

.dates { display: flex; align-items: center; gap: 6px; }
.dates span { color: var(--muted); }
input[type=date], select {
  width: 100%; min-width: 0; height: 40px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg);
}

.bars { display: flex; flex-direction: column; gap: 2px; }
.bars button {
  display: grid; grid-template-columns: 74px minmax(0, 1fr) 32px; align-items: center; gap: 10px;
  min-height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent;
  font-size: 14px; text-align: left;
}
.bars button:hover { background: var(--soft); }
.bars button.on { background: var(--soft); box-shadow: inset 0 0 0 1.5px var(--text); }
.bars button.zero { color: var(--muted); }
.bars .name { font-weight: 600; white-space: nowrap; }
.bars .track { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.bars button:hover .track, .bars button.on .track { background: var(--bg); }
.bars .fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bars .n { text-align: right; font-variant-numeric: tabular-nums; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.field .pills { margin-top: 2px; }
.hint { font-size: 12px; line-height: 1.45; color: var(--muted); }

/* témata */
.topics button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; font-size: 13px; }
.topics button small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.topics button.on small { color: var(--line-2); }
.topics button.zero { opacity: .5; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  height: 24px; padding: 0 9px; border: 0; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600;
}
.tag:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.resinfo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.active-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.active-topics:empty { display: none; }
.reset-top { font-size: 14px; }
.reset-top[hidden] { display: none; }
.active-topics button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 12px; border: 0;
  border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
}
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }

/* ------------------------------------------------------------ výsledky */
.resbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.summary { margin: 0; color: var(--muted); font-size: 14px; }
.summary b { color: var(--text); }
.views { display: inline-flex; border: 1.5px solid var(--text); border-radius: 999px; padding: 3px; }
.views button { height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font-size: 14px; font-weight: 500; }
.views button.on { background: var(--text); color: var(--bg); font-weight: 600; }

#map { height: calc(100vh - 120px); min-height: 440px; border-radius: 16px; border: 1px solid var(--line); }
.leaflet-popup-content { margin: 10px 12px; font: 13px/1.4 "Inter", system-ui, sans-serif; max-height: 320px; overflow-y: auto; }
.pop-item + .pop-item { border-top: 1px solid #ddd; margin-top: 8px; padding-top: 8px; }
.pop-item .when { font-weight: 600; color: #c2410c; }
.pop-item .what { font-weight: 600; }
.pop-item .muted { color: #666; }
.pop-approx { color: #854d0e; font-size: 12px; margin-bottom: 6px; }

/* den */
.dayblock + .dayblock { margin-top: 40px; }
.day { margin: 0; padding-bottom: 14px; border-bottom: 2px solid var(--text); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.day .t { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.day .t::first-letter { text-transform: uppercase; }
.day .rel { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--soft); }
.day .rel.today { background: var(--accent); color: var(--on-accent); }
.day .n { margin-left: auto; font-size: 14px; color: var(--muted); }

/* akce na časové ose */
.ev { display: grid; grid-template-columns: 76px 20px minmax(0, 1fr); column-gap: 12px; }
.ev.missing { opacity: .6; }
.ev-time { padding-top: 20px; text-align: right; font-variant-numeric: tabular-nums; }
.ev-time b { display: block; font-family: var(--display); font-size: 20px; font-weight: 700; line-height: 1.3; }
.ev-time small { display: block; font-size: 13px; color: var(--muted); }
.ev-rail { position: relative; display: flex; justify-content: center; }
.ev-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line); }
.ev-rail span { position: relative; margin-top: 28px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.ev.missing .ev-rail span { border-color: var(--muted); border-style: dashed; }
.ev-body { padding: 18px 0 22px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px 24px; min-width: 0; }
.ev:last-child .ev-body { border-bottom: 0; }
.ev-main { flex: 999 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.purpose { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; }
.desc { margin: 0; font-size: 14px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.desc.open { -webkit-line-clamp: unset; display: block; }
.place { margin: 0; font-size: 14px; color: var(--text-2); }
.place a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.place a:hover { text-decoration-color: currentColor; }
.place strong { font-weight: 600; color: var(--text); }
.route { margin: 0; font-size: 14px; }
.route a { color: var(--accent-ink); font-weight: 600; }
.route .muted { color: var(--muted); font-size: 13px; }
.meta { margin: 0; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 2px 8px; }
.meta b { color: var(--text-2); font-weight: 600; }
.ev-side { flex: 1 0 110px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.ev-n { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ev-side small { font-size: 12px; color: var(--muted); }
.ev-date { font-size: 12px; font-weight: 600; color: var(--accent-ink); }
@media (max-width: 560px) {
  .ev { grid-template-columns: 56px 16px minmax(0, 1fr); column-gap: 8px; }
  .ev-time b { font-size: 17px; }
  .ev-side { flex-direction: row; flex-wrap: wrap; align-items: baseline; text-align: left; gap: 4px 8px; }
  .ev-n { font-size: 20px; }
}

.badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.badge.new { background: var(--new-soft); color: var(--new); }
.badge.gone { background: var(--warn-soft); color: var(--warn); }
.badge.changed { background: var(--changed-soft); color: var(--changed); }
.was { margin: 0; font-size: 13px; color: var(--changed); }
.was s { color: var(--muted); }

mark { background: #fde68a; color: inherit; border-radius: 2px; }
@media (prefers-color-scheme: dark) { mark { background: #6b5a12; } }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); background: var(--soft); border-radius: 16px; }

/* ------------------------------------------------------------ patička a „O webu“ */
.link-btn {
  border: 0; background: transparent; padding: 0; font-size: 14px; font-weight: 500;
  color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: currentColor; }
.nav .link-btn { font-size: 14px; }

.foot {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 32px;
  padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.foot p { margin: 0; flex: 1 1 420px; max-width: 760px; }
.foot strong { color: var(--text-2); font-weight: 600; }
.foot .link-btn { font-size: 13px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot-links a { font-size: 13px; color: var(--text); text-decoration-color: var(--line-2); }
.hint .link-btn { font-size: inherit; color: inherit; }

.about {
  width: min(640px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 32px 32px 28px;
  border: 0; border-radius: 20px; background: var(--bg); color: var(--text);
  box-shadow: 0 24px 64px rgba(0,0,0,.25); font-size: 15px; line-height: 1.6;
}
.about::backdrop { background: rgba(24,24,27,.45); }
.about h2 { margin: 0 40px 12px 0; font-family: var(--display); font-size: 26px; letter-spacing: -0.02em; }
.about h3 { margin: 20px 0 4px; font-size: 15px; font-weight: 700; }
.about p, .about ul { margin: 0 0 8px; color: var(--text-2); }
.about ul { padding-left: 20px; }
.about-src { margin-top: 16px !important; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.about-close { position: absolute; top: 16px; right: 16px; margin: 0; }
.about-close button {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; background: var(--soft); color: var(--text);
}
.about-close button:hover { background: var(--line); }
@media (max-width: 560px) { .about { padding: 24px 20px 20px; } }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px);
}
