:root {
  --bg: #fbfaf7; --panel: #ffffff; --text: #24231f; --muted: #6d6a60; --line: #e4e1d8; --accent: #1f6f5c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171815; --panel: #20221e; --text: #ecebe5; --muted: #a5a399; --line: #34362f; --accent: #6cc4ae; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 system-ui, sans-serif; }
a { color: var(--accent); }
h1 { line-height: 1.2; font-size: 1.8rem; margin: 1rem 0 .5rem; }
.top { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between;
  padding: .75rem 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1100; }
/* Header bleibt stehen: Sprungziele und Monatsmarken darunter einreihen (--hh setzt site.js) */
html { scroll-padding-top: calc(var(--hh, 0px) + .5rem); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
/* MoKa logo (12/2026): has its own dark frame, so no extra tile */
.brand img { width: 38px; height: 38px; border-radius: 4px; }
.top nav a { margin-left: 1rem; }
.top nav a:first-child { margin-left: 0; }
main { max-width: 860px; margin: 0 auto; padding: 0 16px 2rem; }
/* Ehemaliger Footer, jetzt klein im Header (die Liste lädt endlos nach) */
.hx { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.hx a { color: inherit; }
.hx .admin { text-decoration: none; cursor: default; }
.hx .moka { text-decoration: none; }
.meta { color: var(--muted); font-size: .9rem; }
.meta a { margin-left: .6rem; }
.tags a { font-size: .9rem; margin-right: .4rem; }
figure { margin: 1.2rem 0; }
.hero { position: relative; max-width: 860px; margin: 1rem auto 0; padding: 0 16px; }
.hero img { width: 100%; height: clamp(160px, 34vw, 300px); object-fit: cover; object-position: 40% 35%; border-radius: 8px; }
.hero-small img { height: clamp(90px, 18vw, 160px); }
.hero h1 { position: absolute; left: calc(16px + 1.2rem); bottom: .9rem; margin: 0; color: #fff; font-size: clamp(1.6rem, 5vw, 2.6rem);
  text-shadow: 0 1px 3px rgba(0,0,0,.6), 0 0 18px rgba(0,0,0,.35); }
figcaption { color: var(--muted); font-size: .9rem; margin-top: .3rem; }
img, video { max-width: 100%; height: auto; display: block; border-radius: 6px; }
video { width: 100%; max-height: 85vh; background: #000; }
.gallery { position: relative; }
.track { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.track figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; }
.track img { width: 100%; max-height: 72vh; object-fit: contain; background: rgba(0,0,0,.06); }
.gallery button { position: absolute; top: 40%; border: 0; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 1.3rem; cursor: pointer; }
.gallery .prev { left: 8px; } .gallery .next { right: 8px; }
.gallery .count { position: absolute; top: 8px; right: 8px; padding: 0 .5rem; border-radius: 4px;
  background: rgba(0,0,0,.55); color: #fff; font-size: .85rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 1rem; }
.card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; color: var(--text); text-decoration: none; }
.card img, .noimg { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 0; background: var(--line); display: block; }
.card .body { padding: .6rem .75rem; display: flex; flex-direction: column; gap: .2rem; }
.card small { color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 1.5rem 0; color: var(--muted); }
.terms { list-style: none; padding: 0; } .terms li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.terms span { color: var(--muted); margin-left: .4rem; }
.map { height: 70vh; min-height: 360px; border-radius: 8px; border: 1px solid var(--line); margin: 1rem 0; }
.map.small { height: 260px; min-height: 0; }
.filter label { margin-right: 1rem; }
.comments { margin-top: 2rem; border-top: 1px solid var(--line); }
.comment { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.comment p { margin: .2rem 0; }
details { margin: 1rem 0; } summary { cursor: pointer; font-weight: 600; }
table { border-collapse: collapse; display: block; overflow-x: auto; } td, th { border: 1px solid var(--line); padding: .3rem .6rem; }

/* Suchfeld im Header */
.hsearch { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 999px;
  padding: .2rem .7rem; background: var(--bg); color: var(--muted); }
.hsearch input { border: 0; background: transparent; color: var(--text); font: inherit; font-size: .95rem; width: 9rem; outline: none; }
.hsearch:focus-within { border-color: var(--accent); }

/* Im Beitrag: älter / neuer */
.postnav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2rem 0 1rem; }
.postnav a { display: flex; align-items: center; gap: .6rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); text-decoration: none; min-width: 0; }
.postnav a.newer { justify-content: flex-end; text-align: right; }
.postnav img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; flex: none; }
.postnav span { display: flex; flex-direction: column; min-width: 0; }
.postnav small { color: var(--muted); }
.postnav strong { font-weight: 600; font-size: .95rem; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 520px) { .postnav img { display: none; } .hsearch { flex: 1; } .hsearch input { width: 100%; } }

/* Beitragsliste: Monatsmarken, Zeitstrahl, endloses Nachladen */
.cards .month { grid-column: 1 / -1; position: sticky; top: var(--hh, 0px); z-index: 5; margin: .6rem 0 -.2rem; padding: .35rem 0;
  font-size: 1rem; font-weight: 600; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); scroll-margin-top: 0; }
.cards .month:first-child { margin-top: 0; }
.newer-link { margin: 1rem 0 0; }
.feed-status { text-align: center; color: var(--muted); padding: 1.5rem 0; font-size: .9rem; }
.js-feed .pager, .js-feed .newer-link { display: none; }
.rail { display: none; }
@media (min-width: 1100px) {
  .rail { display: flex; flex-direction: column; gap: .15rem; position: fixed; top: 50%; transform: translateY(-50%);
    left: calc(50% + 430px + 1.5rem); padding-left: .9rem; border-left: 2px solid var(--line); font-size: .85rem; }
  .rail a { position: relative; color: var(--muted); text-decoration: none; padding: .05rem 0; }
  .rail a::before { content: ""; position: absolute; left: calc(-.9rem - 6px); top: 50%; width: 8px; height: 8px; margin-top: -4px;
    border-radius: 50%; background: var(--bg); border: 2px solid var(--line); }
  .rail a:hover { color: var(--text); }
  .rail a[aria-current] { color: var(--accent); font-weight: 600; }
  .rail a[aria-current]::before { background: var(--accent); border-color: var(--accent); }
}

/* Wege zurück: Titelbild als Link, "‹ Alle Beiträge" im Beitrag */
.hero-link { display: block; }
.back { margin: .8rem 0 0; font-size: .95rem; }
.back a { text-decoration: none; }
.back a:hover { text-decoration: underline; }
article + .back, .postnav + .back { margin: 0 0 1rem; }

/* Foto-Ansicht: Foto gross auf der gleichen Seite, mit ✕ zum Schliessen */
html.lb-open { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.92); }
.lb[hidden] { display: none; }
.lb-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-track figure { flex: 0 0 100%; margin: 0; padding: 3.4rem .5rem 1rem; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lb-track img { flex: 0 1 auto; min-height: 0; max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: 0; }
.lb-track figcaption { color: #ddd; text-align: center; margin-top: .5rem; }
.lb button { position: absolute; border: 0; width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.18); color: #fff; font-size: 1.4rem; line-height: 1; }
.lb button:hover { background: rgba(255,255,255,.3); }
.lb-close { top: 8px; right: 8px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lb-count { position: absolute; top: 18px; left: 16px; color: #ddd; font-size: .9rem; }
.lb.single .lb-prev, .lb.single .lb-next, .lb.single .lb-count { display: none; }
@media (hover: none) { .lb-prev, .lb-next { display: none; } }
