/* ---------------------------------------------------------------------
   Stammbaum-Startseite. Baut auf person.css auf (Schrift, Farben,
   Abstaende) und bleibt in derselben Welt: Papier, Haarlinien, keine
   Schatten. Die Fokusansicht ist fuer das Telefon gedacht, die
   Uebersicht fuer grosse Bildschirme, beide funktionieren ueberall.
   --------------------------------------------------------------------- */

.baum {
  max-width: var(--breite);
  margin-inline: auto;
  padding: 0.5rem var(--rand) var(--luft);
}

/* Statt der zahl1-Kopfzeile nur ein kleiner Weg zurueck. */
.baum__heim {
  display: inline-block;
  padding: 0.25rem 0;
  font-size: var(--t-mini);
  letter-spacing: 0.04em;
  color: var(--leise);
  text-decoration: none;
  transition: color var(--anim);
}
.baum__heim:hover { color: var(--tinte); }

/* ------------------------------------------------------------- Leiste */

.baum__leiste {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--linie-2);
}
.baum__titel {
  margin: 0;
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.75rem);
  font-weight: 200;
  letter-spacing: -0.03em;
  line-height: 1;
}

.suche { position: relative; max-width: 26rem; justify-self: end; width: 100%; }
.suche__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.suche__feld {
  width: 100%;
  font: inherit; font-size: 1rem; /* 16px: iOS zoomt sonst beim Tippen */
  color: var(--tinte);
  background: var(--papier);
  border: 0; border-bottom: 1px solid var(--linie-2);
  border-radius: 0;
  padding: 0.55rem 0;
  outline: none;
  transition: border-color var(--anim);
}
.suche__feld:focus { border-bottom-color: var(--tinte); }
.suche__feld::placeholder { color: var(--leise); }
.suche__treffer {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 10;
  margin: 0; padding: 0.25rem 0; list-style: none;
  background: var(--papier);
  border: 1px solid var(--linie-2); border-top: 0;
  font-size: var(--t-klein);
}
.suche__treffer a {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.75rem; text-decoration: none;
}
.suche__treffer a span { color: var(--leise); font-variant-numeric: tabular-nums; white-space: nowrap; }
.suche__treffer a:hover, .suche__treffer a.aktiv { background: var(--flaeche); }
.suche__nichts { padding: 0.6rem 0.75rem; color: var(--leise); }

.ansichten { display: flex; gap: 0; border: 1px solid var(--linie-2); }
.ansichten__knopf {
  display: inline-flex; align-items: center; gap: 0.45rem;
  height: 2.5rem; padding: 0 0.9rem;
  font-size: var(--t-klein);
  text-decoration: none;
  color: var(--leise);
  transition: color var(--anim), background-color var(--anim);
}
.ansichten__knopf + .ansichten__knopf { border-left: 1px solid var(--linie-2); }
.ansichten__knopf:hover { color: var(--tinte); }
.ansichten__knopf[aria-current] { background: var(--tinte); color: var(--papier); }
.ansichten svg, .zoom svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.25; flex: none; }

.zoom { display: flex; border: 1px solid var(--linie-2); }
.zoom[hidden] { display: none; }
.zoom button {
  width: 2.5rem; height: 2.5rem;
  font: inherit; font-size: 1.1rem; color: var(--tinte);
  background: none; border: 0; cursor: pointer;
  transition: background-color var(--anim);
}
.zoom button + button { border-left: 1px solid var(--linie-2); }
.zoom button:hover { background: var(--flaeche); }

/* Telefon: Titel nur fuer Screenreader, Suche und Umschalter in einer
   Zeile. So bleibt fast der ganze Bildschirm fuer den Baum. */
@media (max-width: 44rem) {
  .baum__leiste { grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.5rem; padding-bottom: 0.5rem; }
  .baum__titel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .suche { max-width: none; }
  .suche__feld { padding: 0.4rem 0; }
  .ansichten__knopf { padding: 0; width: 2.5rem; height: 2.5rem; justify-content: center; }
  .ansichten__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ------------------------------------------------------------- Knoepfe */

.knopf {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  font-size: var(--t-klein);
  font-weight: 400;
  text-decoration: none;
  background: var(--tinte); color: var(--papier);
  border: 1px solid var(--tinte);
  transition: background-color var(--anim), color var(--anim);
}
.knopf:hover { background: var(--papier); color: var(--tinte); }
.knopf--leise { background: none; color: var(--tinte); border-color: var(--linie-2); }
.knopf--leise:hover { border-color: var(--tinte); }
button.knopf { font: inherit; font-size: var(--t-klein); cursor: pointer; }
.knopf__zahl { color: var(--leise); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- Person */

.fokus { max-width: 44rem; margin-inline: auto; animation: rein 320ms cubic-bezier(0.22, 0.61, 0.36, 1); }
@keyframes rein { from { opacity: 0; transform: translateY(6px); } }

.gruppe { padding-top: 1.75rem; }
.gruppe__titel {
  margin: 0 0 0.6rem;
  font-size: var(--t-mini); font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--leise);
}
.gruppe__unter { margin: 0.9rem 0 0.4rem; font-size: var(--t-klein); color: var(--leise); }
.gruppe__unter:first-of-type { margin-top: 0; }

.reihe {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0; margin: 0; padding: 0; list-style: none;
  border-top: 1px solid var(--linie);
}
.reihe--zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.kachel {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; align-items: center; gap: 0.85rem;
  min-height: 4.5rem;
  padding: 0.6rem 0.5rem 0.6rem 0;
  border-bottom: 1px solid var(--linie);
  text-decoration: none;
  transition: background-color var(--anim);
}
a.kachel:hover { background: var(--flaeche); }
.reihe--zwei li + li .kachel { padding-left: 0.75rem; border-left: 1px solid var(--linie); }
.kachel__bild {
  width: 3rem; aspect-ratio: 4 / 5; object-fit: cover;
  filter: grayscale(0.15);
}
.kachel__bild--leer, .mitte__bild--leer {
  display: grid; place-items: center;
  background: var(--flaeche);
  color: var(--leise);
  font-size: var(--t-mini); letter-spacing: 0.06em;
}
.kachel__text { display: grid; min-width: 0; }
.kachel__name { font-weight: 400; line-height: 1.3; overflow-wrap: anywhere; }
.kachel__jahre { font-size: var(--t-klein); color: var(--leise); font-variant-numeric: tabular-nums; }
.kachel__mehr {
  font-size: var(--t-mini); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--leise);
  padding: 0.1rem 0.4rem; border: 1px solid var(--linie-2);
}
.kachel--leer { color: var(--leise); }
.kachel--leer .kachel__bild--leer { background: none; border: 1px dashed var(--linie-2); }
.kachel--leer .kachel__name { font-weight: 300; }

.mitte {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.5rem;
  align-items: end;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--tinte);
}
.mitte__bild { width: clamp(7rem, 5rem + 8vw, 10rem); aspect-ratio: 4 / 5; object-fit: cover; filter: grayscale(0.15); }
.mitte__bild--leer { font-size: 1.75rem; font-weight: 200; letter-spacing: 0; }
.mitte__name {
  margin: 0;
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3.25rem);
  font-weight: 200; line-height: 1.05; letter-spacing: -0.03em;
  text-wrap: balance;
}
.mitte__titel { margin: 0.4rem 0 0; font-size: var(--t-klein); }
.mitte__daten { margin: 0.9rem 0 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1.75rem; font-size: var(--t-klein); }
.mitte__daten div { display: flex; gap: 0.5rem; }
.mitte__daten dt { color: var(--leise); }
.mitte__daten dd { margin: 0; font-variant-numeric: tabular-nums; }
.mitte__aktionen { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 0; }
.mitte__aktionen:empty { display: none; }

/* Telefon: Name ueber dem Bild, Lebensdaten rechts daneben, Knoepfe darunter.
   .mitte__text loest sich auf, damit seine Teile im Raster von .mitte stehen. */
@media (max-width: 44rem) {
  .mitte {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "name name" "titel titel" "bild daten" "aktionen aktionen";
    gap: 0 1.25rem;
    padding: 1.25rem 0;
  }
  .mitte__text { display: contents; }
  .mitte__name { grid-area: name; margin-bottom: 1rem; }
  .mitte__titel { grid-area: titel; margin: -0.6rem 0 1rem; }
  .mitte__bild { grid-area: bild; width: 7.5rem; }
  .mitte__daten { grid-area: daten; align-self: end; margin: 0; flex-direction: column; gap: 0.75rem; }
  .mitte__daten div { flex-direction: column; gap: 0; }
  .mitte__daten dt { font-size: var(--t-mini); letter-spacing: 0.06em; text-transform: uppercase; }
  .mitte__daten dd { font-size: 1rem; }
  .mitte__aktionen { grid-area: aktionen; }
}

@media (max-width: 30rem) {
  .reihe--zwei { grid-template-columns: 1fr; }
  .reihe--zwei li + li .kachel { padding-left: 0; border-left: 0; }
}

/* ------------------------------------------------------------- Uebersicht */

.uebersicht { padding-top: 1.25rem; }

/* Uebersicht: die Seite ist genau so hoch wie das Fenster, der Baum
   nimmt die ganze Breite und alles unterhalb der Leiste ein. */
body.ansicht-uebersicht { overflow-x: clip; }
.ansicht-uebersicht .baum { height: 100svh; display: flex; flex-direction: column; padding-bottom: 0; }
.ansicht-uebersicht .uebersicht { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ansicht-uebersicht .baum__leiste { border-bottom: 0; }
.ansicht-uebersicht .uebersicht { padding-top: 0; }
.uebersicht__rahmen {
  flex: 1; min-height: 16rem;
  margin-inline: calc(50% - 50vw);
  overflow: auto;
  overscroll-behavior: contain;
  /* Wischen scrollt den Baum, zwei Finger zoomt stammbaum.js, nicht der Browser. */
  touch-action: pan-x pan-y;
  border-top: 1px solid var(--linie-2);
  border-bottom: 1px solid var(--linie-2);
  background: var(--flaeche);
  cursor: grab;
}
.uebersicht__rahmen.zieht { cursor: grabbing; user-select: none; }

.sanduhr__buehne { width: max-content; }
.sanduhr { display: block; font-family: var(--schrift); }
.sanduhr__linie { fill: none; stroke: rgba(0, 0, 0, 0.35); stroke-width: 1; }
.knoten { cursor: pointer; outline: none; }
.knoten__flaeche { fill: var(--papier); stroke: var(--linie-2); stroke-width: 1; transition: stroke var(--anim); }
.knoten:hover .knoten__flaeche, .knoten:focus-visible .knoten__flaeche { stroke: var(--tinte); }
/* Die gewaehlte Person: kraeftiger roter Rahmen, auch klein gezoomt gut zu sehen. */
.knoten--fokus .knoten__flaeche, .knoten--fokus:hover .knoten__flaeche { stroke: #d7141a; stroke-width: 4; }
.knoten__leer { fill: var(--flaeche); }
.knoten__init { font-size: 11px; letter-spacing: 0.06em; fill: var(--leise); }
.knoten__vor { font-size: 12px; font-weight: 300; fill: var(--tinte); }
.knoten__nach { font-size: 14px; font-weight: 500; fill: var(--tinte); }
.knoten__jahre { font-size: 11px; fill: var(--leise); font-variant-numeric: tabular-nums; }
.knoten__flor { fill: var(--tinte); }

/* Telefon: die Grafik fuellt den Rest des Bildschirms. */
@media (max-width: 44rem) {
  .uebersicht { padding-top: 0.5rem; }
}


@media (prefers-reduced-motion: reduce) {
  .fokus { animation: none; }
}
