/* ===== TEIL 1: CSS  (Elementor: Seiteneinstellungen > Eigenes CSS, oder Customizer > Zusätzliches CSS) ===== */
:root{
  --sp-bg:#ffffff;           /* Seitenhintergrund (Textrand der Beschriftungen) */
  --sp-line:#5F5E5A;         /* Linienfarbe */
}

/* Raster. Spaltenzahl und Abstände hier ändern; die Position jeder Person steht in den Daten (pos). */
.sp-tree{
  position:relative; display:grid;
  grid-template-columns:repeat(var(--sp-cols,5),minmax(0,1fr));
  column-gap:14px; row-gap:64px;
  margin:0 auto; padding:8px;
}
/* Breite: je Stammbaum im Backend einstellbar (erhöhte Genauigkeit, damit Theme-Vorgaben wie die Inhaltsbreite sie nicht überstimmen) */
.sp-tree[data-daten]{max-width:var(--sp-w,760px);box-sizing:border-box}

/* Personenkasten: Grundform */
.sp-tree .sp-box{
  position:relative; z-index:1;
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  padding:8px 6px; box-sizing:border-box;
  border:1px solid var(--sp-edge,#5F5E5A); border-radius:6px;
  background:var(--sp-fill,#F1EFE8); color:var(--sp-text,#5F5E5A);
  text-align:center; font:13px/1.35 system-ui,-apple-system,"Segoe UI",sans-serif;
}
.sp-tree .sp-name{display:block;font-size:14px;font-weight:500;color:var(--sp-name,inherit)}
.sp-tree .sp-text{display:block}

/* Farbgruppen werden aus den Plugin-Einstellungen erzeugt (Menü Stammbaum > Einstellungen). */

/* Zusatzklassen für einzelne Kästen (in den Daten bei "klasse" eintragen) */
.sp-tree .sp-box.sp-main{border-width:2px}          /* hervorgehoben */
.sp-tree .sp-box.sp-rund{border-radius:100px}       /* z. B. Kloster */
.sp-tree .sp-box.sp-gestrichelt{border-style:dashed}

/* Sonderzeichen ⚭ (in Poppins nicht vorhanden) */
.ehe{font-size:1.5em;line-height:1;vertical-align:-0.05em}

/* Linien. Jede Linie trägt die Klasse "edge", bei gestrichelt zusätzlich "dashed",
   und "typ-NAME" (NAME = Beziehungstyp aus den Daten). Beispiel: .sp-lines path.typ-ehe{stroke-width:2.5} */
.sp-lines{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:0}
.sp-lines path.edge{fill:none;stroke:var(--sp-line);stroke-width:1.5}
.sp-lines path.dashed{stroke-dasharray:5 4}
.sp-lines text{
  font:12px system-ui,-apple-system,"Segoe UI",sans-serif; fill:var(--sp-line);
  paint-order:stroke; stroke:var(--sp-bg); stroke-width:4px; stroke-linejoin:round;
}

/* Schmale Bildschirme. Standard "scroll": Diagramm seitlich verschiebbar. "stack": untereinander mit Beziehungssätzen. */
.sp-hint{display:none}
@media (max-width:767px){
  .sp-tree.sp-scroll{
    overflow-x:auto; -webkit-overflow-scrolling:touch; overscroll-behavior-x:contain;
    grid-template-columns:repeat(var(--sp-cols,5),minmax(var(--sp-colmin,118px),1fr));    /* Mindestbreite je Spalte = Größe des Diagramms (im Backend einstellbar) */
    max-width:100%; padding-bottom:70px;
  }
  /* Zwei-Finger-Zoom (Gesamtansicht): Wischen mit einem Finger scrollt weiter, zwei Finger skalieren über --sp-z (1 = eingestellte Größe) */
  .sp-tree.sp-scroll{touch-action:none}   /* Verschieben und Zwei-Finger-Zoom übernimmt das Skript */
  .sp-tree.sp-scroll.sp-klein{
    grid-template-columns:repeat(var(--sp-cols,5),minmax(calc(var(--sp-colmin,118px) * var(--sp-z,1)),1fr));
    column-gap:calc(14px * var(--sp-z,1)); row-gap:calc(64px * var(--sp-z,1)); padding:calc(8px * var(--sp-z,1));
  }
  .sp-tree.sp-scroll.sp-klein .sp-box{padding:calc(8px * var(--sp-z,1)) calc(6px * var(--sp-z,1)); font-size:calc(13px * var(--sp-z,1)); border-radius:calc(6px * var(--sp-z,1))}
  .sp-tree.sp-scroll.sp-klein .sp-name{font-size:calc(14px * var(--sp-z,1))}
  .sp-tree.sp-scroll.sp-klein .sp-jahr{font-size:calc(11px * var(--sp-z,1)); padding:0 calc(6px * var(--sp-z,1))}
  .sp-tree.sp-scroll.sp-klein .sp-lines text{font-size:calc(12px * var(--sp-z,1)); stroke-width:calc(4px * var(--sp-z,1))}
  .sp-tree.sp-scroll.sp-klein .sp-lines path.edge{stroke-width:calc(1.5px * max(var(--sp-z,1), .6))}
  .sp-hint{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px 8px;margin:0 0 6px;font:12px system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--sp-line)}
  .sp-hint .sp-hint-btn,.sp-hint .sp-hint-btn:hover,.sp-hint .sp-hint-btn:focus{
    font:12px/1 system-ui,-apple-system,"Segoe UI",sans-serif; text-transform:none; letter-spacing:normal; cursor:pointer;
    padding:5px 10px; min-height:0; height:auto; width:auto; border-radius:14px; box-shadow:none;
    background:#fff; color:#503f2f; border:1px solid #b9ae93}
  .sp-hint .sp-hint-btn:active{background:var(--sp-hl); border-color:var(--sp-hl); color:#fff}
  .sp-tree.sp-stack{display:flex;flex-direction:column;align-items:stretch;row-gap:0;max-width:var(--sp-wm,100%)}
  .sp-tree.sp-stack .sp-box{width:100%}
  .sp-tree.sp-stack .sp-lines{display:none}
  .sp-link{align-self:center;text-align:center;padding:8px 0;font:13px/1.3 system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--sp-line)}
  .sp-link .sp-link-d{font-style:italic}
}

/* ===== Ereignisse: Plaketten in den Kästen, Ereignisleiste, Textfeld, Hervorhebung ===== */
:root{ --sp-hl:#c9962b; --sp-dim:.65; --sp-dim-line:.5; --sp-dim-mobil:.9; --sp-dim-line-mobil:.8; }   /* Farbe der Hervorhebung; Deckkraft der nicht beteiligten Kästen bzw. Linien (1 = nicht abgeschwächt) */

/* Plaketten in den Kästen */
.sp-tree .sp-jahr.sp-mehr{font-weight:600}
.sp-tree .sp-jahre{display:flex;flex-wrap:wrap;justify-content:center;gap:3px;margin-top:6px}
.sp-tree .sp-jahr{
  font:11px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif; cursor:pointer;
  padding:0 6px; border-radius:10px; color:inherit;
  background:rgba(255,255,255,.65); border:1px solid var(--sp-edge,#5F5E5A);
}
.sp-tree .sp-jahr.sp-vermutet{border-style:dashed}
/* Schutz vor Hover-/Fokusfarben des Themes (z. B. Elementor-Kit: button:hover / button:focus): Plaketten behalten ihre Farbe, solange sie nicht aktiv sind */
.sp-tree .sp-jahr:focus:not(.sp-an),.sp-tree .sp-jahr.sp-ruhe:not(.sp-an){background:rgba(255,255,255,.65);color:inherit;border-color:var(--sp-edge,#5F5E5A)}
.sp-tree .sp-jahr:hover:not(.sp-ruhe),.sp-tree .sp-jahr.sp-an{background:var(--sp-hl);border-color:var(--sp-hl);color:#fff}
.sp-tree .sp-box{cursor:pointer}

/* Hervorhebung im Stammbaum: Beteiligte bleiben, alle anderen treten zurück */
.sp-tree .sp-box,.sp-lines .edge,.sp-lines .lbl{transition:opacity .2s}
.sp-tree.sp-aktiv .sp-box{opacity:var(--sp-dim)}
.sp-tree.sp-aktiv .sp-box.sp-beteiligt{opacity:1;box-shadow:0 0 0 3px var(--sp-hl)}
.sp-tree.sp-sperre.sp-aktiv .sp-box:not(.sp-beteiligt){pointer-events:none;cursor:default}
.sp-tree.sp-aktiv .sp-box.sp-beteiligt.sp-vermutet-b{box-shadow:none;outline:2px dashed var(--sp-hl);outline-offset:2px}
.sp-tree.sp-aktiv .sp-lines .edge,.sp-tree.sp-aktiv .sp-lines .lbl{opacity:var(--sp-dim-line)}
.sp-tree.sp-aktiv .sp-lines .edge.sp-hl,.sp-tree.sp-aktiv .sp-lines .lbl.sp-hl{opacity:1}
.sp-tree.sp-aktiv .sp-lines .edge.sp-hl{stroke-width:2.5}

/* Handy bzw. Textfeld im Seitenfluss (keine Linien zum Textfeld): eigene, meist schwächere Abschwächung */
.sp-tree.sp-handy.sp-aktiv .sp-box:not(.sp-beteiligt){opacity:var(--sp-dim-mobil)}
.sp-tree.sp-handy.sp-aktiv .sp-lines .edge:not(.sp-hl),.sp-tree.sp-handy.sp-aktiv .sp-lines .lbl:not(.sp-hl){opacity:var(--sp-dim-line-mobil)}

/* Tastaturfokus gut sichtbar */
.sp-tree .sp-box:focus-visible,.sp-strip .sp-pille:focus-visible,.sp-tree .sp-jahr:focus-visible,.sp-info button:focus-visible,.sp-liste summary:focus-visible,.sp-liste li[data-e]:focus-visible{outline:3px solid var(--sp-hl);outline-offset:2px}
.sp-info .sp-info-titel:focus{outline:none}
.sp-info .sp-info-titel:focus-visible{outline:2px solid var(--sp-hl);outline-offset:2px;border-radius:3px}

/* kurzes Aufleuchten der Beteiligten beim Öffnen */
@keyframes sp-puls{0%{box-shadow:0 0 0 3px var(--sp-hl),0 0 0 0 var(--sp-hl)}100%{box-shadow:0 0 0 3px var(--sp-hl),0 0 0 16px transparent}}
.sp-tree .sp-box.sp-puls{animation:sp-puls .9s ease-out 1}
@media (prefers-reduced-motion:reduce){.sp-tree .sp-box.sp-puls{animation:none}}

/* Textfeld: schwebende, verschiebbare Ebene (wird vom Skript an das Seitenende gehängt) */
.sp-info{
  display:none; position:absolute; z-index:99999; box-sizing:border-box;
  width:var(--sp-info-w,440px); max-width:calc(100vw - 16px); max-height:min(70vh,560px);
  flex-direction:column; overflow:hidden;
  border:1px solid var(--sp-info-border,#b9ae93); border-radius:var(--sp-info-radius,8px); background:var(--sp-info-bg,#faf8f1); color:var(--sp-info-fg,#3b3226);
  box-shadow:0 8px 28px rgba(0,0,0,.28);
  font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;
}
.sp-info.sp-offen{display:flex}
/* Desktop: Größe per Ziehpunkt unten rechts veränderbar; Inhalt scrollt im Textbereich */
.sp-info:not(.sp-inline){resize:both;min-width:200px;min-height:70px}
.sp-info .sp-nav button.sp-reset{font-size:13px;line-height:1;display:none}
.sp-info.sp-gross .sp-nav button.sp-reset{display:inline-block}
.sp-info.sp-fix{position:fixed}
.sp-info .sp-griff{
  flex:0 0 auto; display:flex; justify-content:space-between; align-items:center;
  padding:4px 6px 4px 12px; background:var(--sp-info-head,#e9e1c8); border-bottom:1px solid #cfc5a6;
  cursor:move; touch-action:none; user-select:none; -webkit-user-select:none;
}
.sp-info .sp-grip{font-size:12px;color:#6a5f48}
.sp-info .sp-body{flex:1 1 auto; overflow:auto; padding:10px 14px 12px}
.sp-info .sp-info-datum{font-weight:600;margin-right:8px}
.sp-info .sp-badge{font-size:11px;padding:0 7px;border-radius:10px;border:1px solid #8a7e63;color:#6a5f48}
.sp-info .sp-badge.sp-vermutet{border-style:dashed}
.sp-info .sp-info-titel{font-weight:600;margin:3px 0 6px}
.sp-info .sp-typ{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:#7a7060}
.sp-info .sp-beschr p{margin:0 0 .6em}
.sp-info .sp-beschr ul,.sp-info .sp-beschr ol{margin:0 0 .6em 1.2em;padding:0}
.sp-info .sp-beschr :last-child{margin-bottom:0}
.sp-tree .sp-box.sp-stumm{cursor:default}
.sp-info p{margin:0 0 6px}
.sp-info .sp-lab{font-weight:600;color:#6a5f48}
.sp-info .sp-info-pers{font-size:13px}
.sp-info .sp-nav{display:flex;gap:4px}
.sp-info .sp-nav button,.sp-info .sp-jahr{
  font:13px/1 system-ui,sans-serif;cursor:pointer;min-width:26px;height:26px;padding:0 7px;
  border:1px solid #b9ae93;border-radius:13px;background:#fff;color:#503f2f}
.sp-info .sp-nav button:focus:not(.sp-an),.sp-info .sp-jahr:focus:not(.sp-an),.sp-info .sp-jahr.sp-ruhe:not(.sp-an){background:#fff;color:#503f2f;border-color:#b9ae93}
.sp-info .sp-nav button:hover,.sp-info .sp-jahr:hover:not(.sp-ruhe){background:var(--sp-hl);border-color:var(--sp-hl);color:#fff}
.sp-info .sp-jahr{margin:2px 3px 2px 0}
.sp-info .sp-jahr.sp-vermutet{border-style:dashed}
.sp-hinweis{max-width:100%;margin:0 auto 4px;font:13px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;color:#7a7060}

/* Ereignisleiste: einzeilig und seitlich scrollbar (Einstellung "Ereignisleiste") */
.sp-strip.sp-strip-scroll{flex-wrap:nowrap;gap:0;overflow-x:auto;overflow-y:hidden;scroll-behavior:auto;-webkit-overflow-scrolling:touch;padding-bottom:10px;scrollbar-width:thin}
/* Leiste mit der Maus ziehen */
.sp-strip.sp-zieh-ok,.sp-strip.sp-zieh-ok .sp-pille{cursor:grab}
.sp-strip.sp-ziehen,.sp-strip.sp-ziehen .sp-pille{cursor:grabbing;user-select:none;-webkit-user-select:none}
/* Ereignisleiste mit Abständen nach Zeitabstand: die Lücke steht je Eintrag in --sp-gap, die Linie läuft durch die Lücke weiter */
.sp-strip.sp-strip-zeit .sp-pille{margin-left:var(--sp-gap,0px)}
.sp-strip.sp-strip-zeit .sp-pille::after{left:calc(var(--sp-gap,0px) * -1)}
/* Ereignisleiste */
.sp-strip{
  box-sizing:border-box; max-width:100%; margin:0 auto 12px;
  display:flex; flex-wrap:wrap; gap:16px 0; padding:10px 0 2px;
  position:relative;
}
.sp-strip .sp-pille{
  flex:0 0 auto; width:88px; cursor:pointer; text-align:center;
  font:11px/1.25 system-ui,-apple-system,"Segoe UI",sans-serif; color:var(--sp-line);
  background:none; border:0; padding:6px 2px 2px; position:relative;
}
/* Schutz vor Button-Vorgaben des Themes (z. B. kein Umbruch, Großschreibung, feste Höhe) */
.sp-strip button.sp-pille{
  white-space:normal !important; overflow-wrap:anywhere; word-break:normal; hyphens:auto;
  box-sizing:border-box !important; width:88px !important; height:auto !important; min-width:0 !important; max-width:88px;
  overflow:visible; text-transform:none !important; letter-spacing:normal !important; text-decoration:none;
  background:none !important; border:0 !important; border-radius:0 !important; box-shadow:none !important;
  padding:6px 2px 2px !important; margin:0; font-weight:400; text-align:center !important; line-height:1.25 !important;
}
.sp-strip button.sp-pille b{white-space:normal;text-transform:none;letter-spacing:normal}
.sp-strip .sp-pille::after{content:"";position:absolute;top:-5px;left:0;right:0;height:2px;background:var(--sp-line)}
.sp-strip .sp-pille::before{
  content:""; position:absolute; top:-9px; left:50%; width:10px; height:10px; margin-left:-5px;
  border-radius:50%; background:#fff; border:2px solid var(--sp-line); box-sizing:border-box; z-index:1;
}
.sp-strip .sp-pille.sp-vermutet::before{border-style:dashed}
.sp-strip .sp-pille b{display:block;font-size:13px;font-weight:600;color:#503f2f}
.sp-strip .sp-pille:hover:not(.sp-ruhe)::before,.sp-strip .sp-pille.sp-an::before{background:var(--sp-hl);border-color:var(--sp-hl)}
.sp-strip .sp-pille.sp-an b{color:var(--sp-hl)}

/* Textfeld fest eingebettet (schmale Bildschirme oder eigener Textbereich) */
.sp-info.sp-inline{position:relative;width:auto;max-width:100%;max-height:60vh;margin:0 0 12px;box-shadow:none;z-index:auto}
.sp-info.sp-inline .sp-griff{cursor:default;touch-action:auto}
.sp-info.sp-inline .sp-grip{visibility:hidden}
.sp-info .sp-resize{display:none}
.sp-info.sp-inline .sp-resize,.sp-info.sp-frei .sp-resize{display:block;position:absolute;right:0;bottom:0;width:28px;height:28px;cursor:ns-resize;touch-action:none;
  background:linear-gradient(135deg,transparent 55%,#8a7e63 55%,#8a7e63 62%,transparent 62%,transparent 72%,#8a7e63 72%,#8a7e63 79%,transparent 79%)}
.sp-info.sp-inline,.sp-info.sp-frei{resize:none}
.sp-info.sp-frei .sp-resize{cursor:nwse-resize}
.sp-info.sp-frei .sp-body{touch-action:none;overscroll-behavior:contain}

/* Linien vom Textfeld zu den beteiligten Kästen (Ebene über dem Fenster, ohne Mausfang) */
.sp-link-svg{position:fixed;left:0;top:0;width:100vw;height:100vh;pointer-events:none;z-index:99998;overflow:visible}
.sp-link-svg line{stroke:var(--sp-hl);stroke-width:var(--sp-link-w,2);stroke-linecap:round;opacity:.85}
.sp-link-svg line.sp-vermutet{stroke-dasharray:5 4}
.sp-link-svg circle{fill:var(--sp-hl)}
.sp-link-svg .sp-lab-bg{fill:var(--sp-lab-bg,#faf8f1);stroke:var(--sp-hl);stroke-width:1}
.sp-link-svg .sp-lab-bg.sp-vermutet{stroke-dasharray:3 2}
.sp-link-svg text{font:var(--sp-lab-size,11px)/1 system-ui,-apple-system,"Segoe UI",sans-serif;fill:var(--sp-lab-fg,#3b3226);text-anchor:middle;dominant-baseline:central}
.sp-info .sp-nav button.sp-link-btn{font-size:15px;line-height:1}
.sp-info .sp-nav button.sp-share{font-size:11px;line-height:1;width:auto;padding:0 8px;border-radius:12px}
.sp-info .sp-nav button.sp-link-btn{width:auto;padding:0 8px;border-radius:12px}
.sp-info .sp-tipp{margin:8px 0 0;font-size:12px;color:#6a5f48}
.sp-info .sp-nav button.sp-back{font-size:11px;line-height:1;visibility:hidden}
.sp-info.sp-weit .sp-nav button.sp-back{visibility:visible}
.sp-info.sp-inline .sp-nav button.sp-back{display:none}
.sp-info .sp-nav button.sp-link-btn.sp-an{background:var(--sp-hl);border-color:var(--sp-hl);color:#fff}

/* Liste aller Ereignisse (auch für den Druck) */
.sp-liste{max-width:100%;margin:14px auto 0;font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif}
.sp-liste summary{cursor:pointer;font-weight:600}
.sp-liste ol{margin:8px 0 0;padding-left:1.2em}
.sp-liste li{margin-bottom:8px}
.sp-liste .sp-vermutet{font-style:italic}
.sp-liste li[data-e]{cursor:pointer;border-radius:4px;padding:2px 4px}
.sp-liste li.sp-an{background:#f5efdd;outline:1px solid var(--sp-hl)}

@media (max-width:767px){
  .sp-strip{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
  .sp-tree .sp-jahr{padding:3px 8px;font-size:12px}
}
@media print{
  .sp-info,.sp-strip,.sp-hint,.sp-link-svg{display:none}
  .sp-tree.sp-aktiv .sp-box{opacity:1;box-shadow:none;outline:0}
  .sp-liste li{break-inside:avoid}
}

/* Ersatzliste ohne Skript: ausblenden, sobald das Diagramm aufgebaut ist */
.sp-tree[data-sp-init] + .sp-noscript{display:none}
.sp-noscript ul{margin:1em 0;padding-left:1.2em}

/* Gesperrte Knöpfe im Textfeld (nur ein Ereignis; Linien-Knopf bei eingebettetem Textfeld): ausgegraut, auch bei Hover und Fokus */
.sp-info .sp-nav button:disabled,.sp-info .sp-nav button:disabled:hover,.sp-info .sp-nav button:disabled:focus,.sp-info .sp-nav button.sp-link-btn.sp-an:disabled{background:#fff;border-color:#b9ae93;color:#503f2f;opacity:.35;cursor:not-allowed}

/* ===== Legende ([fkkk_legende]) ===== */
.sp-legende{margin:1em 0;font:14px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;color:inherit}
.sp-legende .sp-legende-titel{margin:0 0 .5em;font-weight:600}
.sp-legende ul{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px 24px}
.sp-legende .sp-lg-bloecke{display:flex;flex-direction:column;gap:10px}
.sp-legende.sp-lg-spalte ul,.sp-legende.sp-lg-spalten ul{flex-direction:column}
.sp-legende.sp-lg-spalten .sp-lg-bloecke{flex-direction:row;flex-wrap:wrap;align-items:flex-start;gap:10px 48px}
.sp-legende li{display:flex;align-items:center;gap:8px;margin:0;padding:0}
.sp-legende li::marker{content:""}
.sp-legende svg.sp-lines.sp-lg-linie{position:static;inset:auto;width:46px;height:14px;flex:none;overflow:visible;z-index:auto}
.sp-legende .sp-lg-farbe{display:inline-block;flex:none;width:24px;height:14px;box-sizing:border-box;border:1.5px solid;border-radius:3px}
