/* ============ Farben & Grundwerte ============ */
:root {
  --bg: #f7f3ea;
  --bg-alt: #efe8da;
  --surface: #fffdf8;
  --ink: #1f1b16;
  --muted: #6b6257;
  --line: #d9cfbd;
  --accent: #8a1c1c;
  --accent-ink: #ffffff;

  --g-organisation: #8a1c1c;
  --g-gruender: #b0701a;
  --g-kern: #2c6a6f;
  --g-spaeter: #5b4a92;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(40, 25, 10, .12);
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f;
    --bg-alt: #1d1915;
    --surface: #24201b;
    --ink: #eee6d8;
    --muted: #a99d8c;
    --line: #3a332b;
    --accent: #e0615a;
    --accent-ink: #1a0e0c;
    --g-organisation: #e0615a;
    --g-gruender: #e0a54a;
    --g-kern: #5fb3b3;
    --g-spaeter: #9c8ce0;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

/* ============ Basis ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.65 var(--sans);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; font-weight: 600; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 760px; }
.container.wide { max-width: 1320px; }
@media (min-width: 720px) { .container { padding: 0 32px; } }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ============ Header ============ */
.site-header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 1.1rem; }
.main-nav { display: flex; gap: 4px; }
.main-nav a { color: var(--ink); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-size: .95rem; }
.main-nav a:hover { background: var(--bg-alt); }
.nav-toggle { display: none; }

@media (max-width: 719px) {
  .nav-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 10px; background: none; border: 0; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .main-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    display: none;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 14px 8px; border-radius: 8px; font-size: 1.05rem; }
}

/* ============ Hero ============ */
.hero { position: relative; overflow: hidden; padding: 72px 0 80px; border-bottom: 1px solid var(--line); }
.hero-inner { position: relative; z-index: 1; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; color: var(--accent); font-weight: 600; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 5rem); margin-bottom: .3em; }
.lead { font-size: clamp(1.1rem, 2.4vw, 1.35rem); max-width: 36ch; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-year {
  position: absolute; right: -2vw; bottom: -6vw; z-index: 0;
  font-family: var(--serif); font-weight: 700; font-size: clamp(8rem, 26vw, 22rem); line-height: 1;
  color: var(--accent); opacity: .07; user-select: none; pointer-events: none;
}
.btn { display: inline-flex; align-items: center; min-height: 46px; padding: 0 22px; border-radius: 999px; text-decoration: none; font-weight: 600; border: 1.5px solid var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { color: var(--accent); }
.btn:hover { filter: brightness(1.08); }

/* ============ Sektionen ============ */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
.section-intro { color: var(--muted); max-width: 62ch; margin-bottom: 32px; }

/* ============ Chronik ============ */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: 6px; bottom: 6px; left: 7px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 32px 36px; }
.tl-item::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-alt); border: 3px solid var(--accent);
}
.tl-year { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.tl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 8px; }
.tl-card h3 { font-size: 1.25rem; margin-bottom: .35em; }
.tl-card p { margin-bottom: .6em; }
.tl-card:target, .tl-item.flash .tl-card { box-shadow: 0 0 0 3px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); font-size: .85rem; cursor: pointer; text-align: left;
}
.chip:hover { border-color: var(--accent); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip small { color: var(--muted); }

@media (min-width: 820px) {
  .timeline::before { left: calc(9rem + 7px); }
  .tl-item { display: grid; grid-template-columns: 9rem 1fr; gap: 0 36px; padding-left: 0; }
  .tl-item::before { left: 9rem; }
  .tl-year { text-align: right; padding-right: 24px; padding-top: 14px; font-size: 1.8rem; }
  .tl-card { margin-top: 0; }
}

/* ============ Netzwerk ============ */
.network {
  position: relative; height: min(78vh, 720px); min-height: 420px;
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.network.is-panning { cursor: grabbing; }
@media (max-width: 719px) { .network { height: 68vh; border-radius: 10px; } }
.net-svg { display: block; width: 100%; height: 100%; }
.net-link { stroke: var(--muted); stroke-opacity: .35; stroke-width: 1.3; transition: stroke-opacity .2s, stroke .2s; }
.net-node { cursor: pointer; transition: opacity .2s; }
.net-node circle.body { fill: var(--c); stroke: var(--surface); stroke-width: 3; transition: r .2s; }
.net-node circle.ring { fill: none; stroke: var(--c); stroke-width: 2; stroke-dasharray: 3 4; opacity: .7; }
.net-node circle.halo { fill: var(--c); opacity: 0; transition: opacity .2s; }
.net-node .initials { fill: #fff; font: 600 11px var(--sans); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.net-node .label {
  fill: var(--ink); font: 500 12px var(--sans); text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round;
}
.net-node:focus { outline: none; }
.net-node:focus-visible circle.halo { opacity: .35; }

/* Hervorhebung beim Überfahren / Auswahl */
.net-svg.has-focus .net-node { opacity: .22; }
.net-svg.has-focus .net-node.is-near { opacity: 1; }
.net-svg.has-focus .net-link { stroke-opacity: .07; }
.net-svg.has-focus .net-link.is-near { stroke: var(--accent); stroke-opacity: .85; stroke-width: 2; }
.net-node.is-hover circle.halo, .net-node.is-selected circle.halo { opacity: .22; }
.net-node.is-selected circle.body { stroke: var(--ink); }
.net-node.is-hover .label, .net-node.is-selected .label { font-weight: 700; }

.network-controls { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.network-controls button {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); font-size: 1.2rem; cursor: pointer;
}
.network-controls button:hover { border-color: var(--accent); }
.network-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 2; margin: 0;
  padding: 6px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .85rem;
  opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px);
  overflow: hidden; text-overflow: ellipsis;
}
.network-hint.show { opacity: .9; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; }

/* ============ Personen ============ */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filters button {
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: .92rem;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.person-card {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.person-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--c); }
.person-card[hidden] { display: none; }
.avatar {
  flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--c); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .95rem; overflow: hidden;
}
.avatar.org { border-radius: 12px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-card h3 { font-size: 1.1rem; margin: 0 0 2px; }
.person-card .meta { color: var(--muted); font-size: .85rem; margin: 0 0 6px; }
.person-card .short { font-size: .92rem; margin: 0; }

/* ============ Detailansicht ============ */
.detail {
  position: fixed; z-index: 60; top: var(--header-h); right: 0; bottom: 0;
  width: min(420px, 100%); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow); transform: translateX(105%); transition: transform .3s ease;
  display: flex; flex-direction: column; visibility: hidden;
}
.detail.open { transform: none; visibility: visible; }
.detail-body { overflow-y: auto; padding: 28px 24px 32px; -webkit-overflow-scrolling: touch; }
.detail-close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); font-size: 1.6rem; line-height: 1; cursor: pointer; z-index: 1;
}
.detail-close:hover { border-color: var(--accent); }
.detail-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; padding-right: 44px; }
.detail-head .avatar { width: 64px; height: 64px; font-size: 1.1rem; }
.detail-type { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--c); font-weight: 700; margin: 0; }
.detail h2 { font-size: 1.6rem; margin: 2px 0 0; }
.detail .meta { color: var(--muted); margin-bottom: 18px; }
.detail h3 { font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 26px 0 10px; }
.detail .tl-links { list-style: none; padding: 0; margin: 0; }
.detail .tl-links a { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.detail .tl-links b { color: var(--accent); min-width: 3.2em; }

@media (max-width: 719px) {
  .detail {
    top: auto; left: 0; right: 0; width: 100%; max-height: 78vh;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
    transform: translateY(105%);
  }
  .detail::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 0; flex: none; }
  .detail-body { padding: 16px 16px 28px; }
}

/* ============ Footer & Unterseiten ============ */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 20px; }
.footer-inner a { color: var(--muted); }
.legal { padding: 48px 0 64px; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.legal h2 { font-size: 1.3rem; margin-top: 1.8em; }
.note { background: var(--bg-alt); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
