/* Oberhaugstett – Website-Design */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #ece8df;
  --ink: #1e2622;
  --ink-2: #46524b;
  --muted: #6a776f;
  --line: #dad5ca;
  --accent: #2d5a43;
  --accent-ink: #ffffff;
  --accent-soft: #e2ece5;
  --clay: #a8452a;
  --chart: #2d5a43;
  --chart-fill: rgba(45, 90, 67, .12);
  --shadow: 0 1px 2px rgba(30, 38, 34, .06), 0 6px 20px rgba(30, 38, 34, .06);
  --radius: 10px;
  --wrap: 1120px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121714;
    --surface: #1a211d;
    --surface-2: #222a25;
    --ink: #e7ece9;
    --ink-2: #c3ccc6;
    --muted: #9aa69f;
    --line: #2e3832;
    --accent: #86c3a0;
    --accent-ink: #0f1a14;
    --accent-soft: #1f3128;
    --clay: #e08a6c;
    --chart: #86c3a0;
    --chart-fill: rgba(134, 195, 160, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.65 var(--sans);
  display: flex; flex-direction: column; min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--clay); }
:focus-visible { outline: 3px solid var(--clay); outline-offset: 2px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* Kopf */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand img { width: 40px; height: auto; }
.brand strong { display: block; font: 600 1.3rem/1.1 var(--serif); letter-spacing: .01em; }
.brand small { display: block; white-space: nowrap; color: var(--muted); font-size: .8rem; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.nav-list a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.nav-list a:hover { background: var(--surface-2); color: var(--ink); }
.nav-list a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; width: 44px; height: 40px; position: relative; cursor: pointer; color: var(--ink); }
.nav-toggle span:first-child, .nav-toggle span:first-child::before, .nav-toggle span:first-child::after {
  position: absolute; left: 11px; width: 20px; height: 2px; background: currentColor; content: ""; transition: transform .2s;
}
.nav-toggle span:first-child { top: 19px; }
.nav-toggle span:first-child::before { left: 0; top: -6px; }
.nav-toggle span:first-child::after { left: 0; top: 6px; }
.nav-toggle[aria-expanded="true"] span:first-child { background: transparent; }
.nav-toggle[aria-expanded="true"] span:first-child::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:first-child::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1080px) {
  .nav-toggle { display: block; }
  .main-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); display: none; }
  .main-nav.open { display: block; }
  .nav-list { flex-direction: column; padding: 8px 16px 16px; }
  .nav-list a { padding: 12px; }
}

/* Kopfbild */
.hero {
  position: relative; min-height: clamp(220px, 38vw, 420px); background: #2b3a31 center/cover no-repeat;
  display: flex; align-items: flex-end; color: #fff;
}
.hero.is-draggable { cursor: grab; user-select: none; }
.hero.is-dragging { cursor: grabbing; }
.hero-hint { position: absolute; top: 12px; right: 16px; z-index: 2; background: rgba(0,0,0,.55); color: #fff; font-size: .8rem; padding: 4px 10px; border-radius: 99px; opacity: 0; transition: opacity .25s; pointer-events: none; }
.hero.is-draggable:hover .hero-hint { opacity: 1; }
.hero.is-dragging .hero-hint { opacity: 0; }
.hero::before { pointer-events: none; content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(10,20,14,.72)); }
.hero .wrap { position: relative; padding-bottom: 28px; }
.hero-kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; opacity: .9; }
.hero-title { margin: 4px 0 0; font: 600 clamp(1.8rem, 4.5vw, 3rem)/1.1 var(--serif); text-shadow: 0 2px 12px rgba(0,0,0,.35); }

/* Inhalt */
.content { flex: 1; padding-top: 36px; padding-bottom: 56px; }
.content > h1 { font: 600 clamp(1.7rem, 3.6vw, 2.4rem)/1.15 var(--serif); margin: 0 0 20px; }
.prose { max-width: 76ch; }
.prose h2, .content h2 { font: 600 1.45rem/1.25 var(--serif); margin: 1.8em 0 .5em; }
.prose h3 { font: 600 1.15rem/1.3 var(--sans); margin: 1.5em 0 .4em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .25em 0; }
.prose li h3 { margin-top: .8em; }
.prose blockquote { margin: 1.4em 0; padding: 12px 20px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.prose img { border-radius: 6px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose table { border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--line); padding: 6px 10px; }
.outro { margin-top: 32px; }
.content > .prose:first-of-type > :first-child { margin-top: 0; }
small { color: var(--muted); }
@media (max-width: 600px) {
  .prose img[style*="float"] { float: none !important; display: block; margin: 0 auto 16px !important; }
}

/* Chronik */
.chronik-heading { margin-top: 1.2em; }
.chronik { list-style: none; margin: 24px 0; padding: 0; position: relative; max-width: 860px; }
.chronik::before { content: ""; position: absolute; left: 104px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.chronik-item { display: grid; grid-template-columns: 92px 1fr; gap: 28px; padding: 10px 0; position: relative; }
.chronik-item::before { content: ""; position: absolute; left: 99px; top: 19px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.chronik-year { font: 600 1.05rem/1.6 var(--serif); color: var(--accent); text-align: right; }
.chronik-text p { margin: 0 0 .5em; }
@media (max-width: 600px) {
  .chronik::before { left: 6px; }
  .chronik-item { grid-template-columns: 1fr; gap: 2px; padding-left: 28px; }
  .chronik-item::before { left: 1px; top: 16px; }
  .chronik-year { text-align: left; }
}

/* Tabelle */
.table-blocks { display: grid; gap: 16px; margin: 24px 0; }
.table-blocks.is-split { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-items: start; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); padding: 8px 12px; }
.data-table td { padding: 6px 12px; border-top: 1px solid var(--line); }
.data-table td.num, .data-table th:not(:first-child) { text-align: right; }
.data-table tbody tr:hover { background: var(--accent-soft); }

/* Diagramm */
.chart { margin: 24px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 8px; }
.chart-title { font: 600 1.05rem/1.3 var(--sans); margin-bottom: 8px; }
.chart-box { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 12px var(--sans); }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-fill); }
.chart circle.dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; r: 4; transition: r .1s; }
.chart circle.dot.on { r: 6; }
.chart rect.bar { fill: var(--chart); }
.chart rect.bar.on { opacity: .75; }
.chart .crosshair { stroke: var(--muted); stroke-dasharray: 3 3; opacity: 0; }
.chart .crosshair.on { opacity: 1; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 6px; font-size: .85rem; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }
.chart-tip b { font-variant-numeric: tabular-nums; }
.chart-note { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }

/* Galerie */
.gallery { display: grid; gap: 20px; margin: 24px 0; }
.gallery.cols-1 { grid-template-columns: 1fr; }
.gallery.cols-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.gallery.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.gallery.cols-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.gallery-item { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.gallery-link { display: block; position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.gallery-link img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.gallery-link:hover img { transform: scale(1.04); }
.gallery-badge { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: .78rem; padding: 4px 10px; border-radius: 99px; }
.gallery-item figcaption { padding: 12px 14px 14px; font-size: .92rem; }
.gallery-item figcaption strong { display: block; font-size: 1rem; }
.gallery-item figcaption span { color: var(--ink-2); display: block; margin-top: 2px; }
.cols-3 .gallery-link, .cols-4 .gallery-link { aspect-ratio: 3 / 4; }
.cols-3 .gallery-link img, .cols-4 .gallery-link img { object-position: top; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8,12,10,.94); display: flex; align-items: center; justify-content: center; padding: 48px 56px; touch-action: pan-y; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 4px; }
.lightbox figcaption { color: #e9eee9; text-align: center; margin-top: 12px; font-size: .95rem; }
.lightbox figcaption small { color: #a8b3ac; display: block; }
.lightbox button { position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 30px; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255,255,255,.22); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lightbox { padding: 56px 8px; } .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; } }

/* Video */
.video { margin: 24px 0 32px; }
.video h2 { margin-top: 0; }
.video-box { background: #000; border-radius: var(--radius); overflow: hidden; }
.video-box video { display: block; width: 100%; max-height: 80vh; }

/* Bild mit Markierungen */
.markers { margin: 20px 0; }
.markers-tools { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin-bottom: 10px; font-size: .92rem; }
.markers-hint { color: var(--muted); }
.switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.markers-stage { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.markers-stage img { display: block; width: 100%; height: auto; }
.markers-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mk { fill: transparent; stroke: transparent; stroke-width: 4; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .15s, stroke .15s; }
.mk:hover, .mk.on, .show-all .mk { fill: rgba(255, 214, 102, .22); stroke: #ffd666; }
.mk.on { fill: rgba(255, 214, 102, .38); }
.markers-tip { position: absolute; pointer-events: none; background: rgba(15,20,17,.9); color: #fff; padding: 5px 10px; border-radius: 6px; font-size: .9rem; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.markers-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.markers-list button { font: inherit; font-size: .88rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; cursor: pointer; }
.markers-list button:hover, .markers-list button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.markers-orig { font-size: .88rem; color: var(--muted); }

/* Karte / Einbettungen mit Zustimmung */
.map { margin-top: 40px; }
.consent-embed { position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; text-align: center; }
.consent-embed.is-video { aspect-ratio: 16 / 9; }
.consent-inner { max-width: 420px; padding: 20px; }
.consent-inner p { margin: 0 0 10px; }
.consent-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-link { font-size: .9rem; }

/* Formular */
.contact { max-width: 640px; margin: 24px 0; display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
.field input, .field textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.field.check label { font-weight: 400; display: flex; gap: 10px; align-items: flex-start; }
.field.check input { width: auto; margin-top: 6px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn { display: inline-block; font: 600 1rem var(--sans); background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 11px 20px; cursor: pointer; text-decoration: none; justify-self: start; }
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); }
.notice { padding: 14px 18px; border-radius: var(--radius); margin: 20px 0; }
.notice ul { margin: 0; padding-left: 1.2em; }
.notice.ok { background: var(--accent-soft); border: 1px solid var(--accent); }
.notice.err { background: #fbe9e4; border: 1px solid var(--clay); color: #6d2412; }
@media (prefers-color-scheme: dark) { .notice.err { background: #3a1f17; color: #f4c8b8; } }

/* Fuß */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 24px 0 28px; font-size: .9rem; color: var(--muted); }
.footer-nav { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-nav a { color: var(--ink-2); }
.footer-meta, .footer-note { margin: 0; }
.top-anchor { position: absolute; top: 0; left: 0; }

/* Redaktions-/Vorschau-Leiste */
.editor-bar, .preview-bar { background: #1e2622; color: #fff; font-size: .85rem; display: flex; gap: 16px; align-items: center; padding: 6px 16px; }
.editor-bar a { color: #b9e3c9; }
.editor-bar span { font-weight: 600; }
.preview-bar { background: var(--clay); justify-content: space-between; flex-wrap: wrap; font-weight: 600; position: sticky; top: 0; z-index: 40; padding: 8px 16px; }
.preview-back { background: #fff; color: #1e2622; padding: 6px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.preview-back:hover { background: #f1e5df; color: #1e2622; }
.prose table { margin: 1.2em 0; max-width: 100%; display: block; overflow-x: auto; background: var(--surface); }
.prose th { background: var(--surface-2); text-align: left; }

@media print {
  .site-header, .site-footer, .editor-bar, .nav-toggle, .consent-embed, .markers-tools { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Sprungziele nicht unter dem festen Kopfbereich verstecken */
.content [id] { scroll-margin-top: 84px; }

/* Zeitungsfundstellen */
.finds { margin: 16px 0 32px; }
.finds-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; top: 68px; z-index: 5; background: var(--bg); padding: 10px 0; }
.finds-tools input, .finds-tools select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.finds-tools input { flex: 1 1 240px; min-width: 0; }
.finds-tools select { max-width: 100%; }
.finds-count { color: var(--muted); font-size: .9rem; }
.finds-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.chip { font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 4px 12px; cursor: pointer; }
.chip span { color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on span { color: inherit; opacity: .8; }
.finds-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.find { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.find-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.find-head time { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.find-paper { color: var(--ink-2); font-size: .92rem; }
.find-tag { font-size: .72rem; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 1px 8px; }
.find-text { font-family: var(--serif); font-size: .95rem; margin: 6px 0; color: var(--ink-2); overflow-wrap: anywhere; }
.find-text mark { background: #ffe9a8; color: #1e2622; padding: 0 2px; border-radius: 2px; }
.finds-more { margin-top: 14px; }
.finds-source { margin-top: 12px; }
.chronik-text em { color: var(--muted); font-style: normal; font-size: .9rem; }

/* Popup (Datenschutz im Kontaktformular) */
.popup { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.popup[open] { display: flex; flex-direction: column; }
.popup::backdrop { background: rgba(10, 16, 12, .6); }
.popup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.popup-head h2 { margin: 0; font: 600 1.3rem/1.2 var(--serif); }
.popup-close { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); width: 40px; height: 40px; border-radius: 8px; }
.popup-close:hover { background: var(--surface-2); color: var(--ink); }
.popup-body { overflow-y: auto; padding: 16px 20px; max-width: none; font-size: .95rem; overscroll-behavior: contain; }
.popup-body h2 { font-size: 1.15rem; }
.popup-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

/* Bildausrichtung aus dem Editor */
.prose .img-left { float: left; margin: 4px 24px 12px 0; max-width: 50%; }
.prose .img-right { float: right; margin: 4px 0 12px 24px; max-width: 50%; }
.prose .img-center { display: block; margin: 16px auto; }
.prose .img-full { display: block; width: 100%; }
.prose::after { content: ""; display: table; clear: both; }
@media (max-width: 600px) { .prose .img-left, .prose .img-right { float: none; max-width: 100%; margin: 0 0 16px; } }

/* dichte Zeitreihen: Punkte nur beim Überfahren */
.chart svg.dense circle.dot { opacity: 0; }
.chart svg.dense circle.dot.on { opacity: 1; }
