/* =========================================================
   Bildergalerie – Stammbaum (Eiche mit Drachen im Abendrot)
   Farben und Größen zentral hier änderbar.
   ========================================================= */

:root {
  --gold:        #e3bd62;
  --gold-dunkel: #7a5a1c;
  --zoom:        1;                          /* wird von den +/- Knöpfen verändert */
  --baum-min:    960px;                      /* kleinste Breite des Baumbildes (darunter wird seitlich gescrollt) */
  --baum-max:    1700px;
}

body.galerie-seite { background: #1b2140; }

/* Hintergrund neben dem Baumbild: unscharfe, abgedunkelte Kopie desselben Bildes */
.galerie-hintergrund {
  position: fixed;
  inset: -40px;
  z-index: -1;
  background: #1b2140 url("../img/stammbaum.webp") center / cover no-repeat;
  filter: blur(26px) brightness(.75) saturate(1.1);
}

.galerie { position: relative; min-height: 100vh; min-height: 100dvh; }

/* Patch oben links: zurück zur Startseite */
.galerie__home {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 5;
  display: block;
  width: 64px;
}
.galerie__home .patch__bild { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .6)); }

/* Bühne: das quadratische Bild; Höhe ≈ Fensterhöhe, mindestens --baum-min */
.galerie__scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.galerie__buehne {
  width: 1100px; /* Rückfall für alte Browser */
  width: calc(var(--zoom) * min(100vh, var(--baum-max)));
  width: calc(var(--zoom) * min(100dvh, var(--baum-max)));
  margin: 0 auto;
}
.baum { display: block; width: 100%; height: auto; box-shadow: 0 0 60px rgba(0, 0, 0, .55); }

/* Zoom-Knöpfe */
.zoom {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.zoom button {
  width: 48px; height: 48px;
  padding: 0;
  font-size: 1.6rem; line-height: 1; font-weight: 700;
  color: #fff;
  background: rgba(16, 20, 30, .7);
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}
.zoom button:hover { border-color: #fff; }

/* Wappenschilde (Tartsche) */
.schild { cursor: pointer; outline: none; }
.s-seil      { stroke: #2b1d10; stroke-width: 2.2; stroke-linecap: round; }
.s-ring      { fill: #2b1d10; stroke: var(--gold); stroke-width: 2.4; }
.s-schatten  { fill: #0b0804; stroke: #0b0804; stroke-width: 6; stroke-linejoin: round; opacity: .55; transform: translate(2px, 4px); }
.s-rand      { fill: none; stroke: var(--gold); stroke-width: 3.2; stroke-linejoin: round; }
.s-glanz     { fill: none; stroke: #ffd98a; stroke-width: 11; stroke-linejoin: round; opacity: 0; transition: opacity .15s ease-out; }
.s-niete     { fill: var(--gold); stroke: var(--gold-dunkel); stroke-width: .7; }

.s-jahr, .s-name, .s-anzahl {
  font-family: Georgia, "Times New Roman", "DejaVu Serif", serif;
  fill: #ffffff;
  stroke: #14100a;
  stroke-linejoin: round;
  paint-order: stroke;
  pointer-events: none;
}
.s-jahr        { font-size: 27px; font-weight: 700; stroke-width: 3.6px; }
.s-jahr--gross { font-size: 34px; }
.s-name        { font-size: 13px; font-weight: 700; stroke-width: 3px; }
.s-anzahl      { font-size: 10.5px; font-weight: 600; stroke-width: 2.6px; }

/* Hover / Fokus / Antippen */
.schild:hover .s-glanz,
.schild:focus .s-glanz,
.schild:active .s-glanz { opacity: .65; }
.schild:hover .s-rand,
.schild:focus .s-rand   { stroke: #fff4cf; }
.schild:focus-visible .s-rand { stroke: #ffffff; stroke-width: 4.4; }

/* Liste älterer Ordner, wenn der Baum voll ist */
.galerie__rest {
  display: none;
  margin: 0 auto 90px;
  max-width: 640px;
  padding: 14px 20px;
  background: rgba(16, 20, 30, .78);
  border-radius: 12px;
  color: #fff;
}
.galerie__rest h2 { font-size: 1.05rem; margin: 0 0 8px; }
.galerie__rest ul { margin: 0; padding-left: 20px; }
.galerie__rest a { color: #fff; }

/* Zurück-Link auf der Ordnerseite */
.zurueck-baum {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 5;
  padding: .55em 1em;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  background: rgba(16, 20, 30, .65);
  border: 1px solid rgba(255, 255, 255, .35);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}

/* Ohne JavaScript: einfache Liste */
.galerie__liste { margin: 90px 16px 16px; padding: 14px 20px; background: rgba(16, 20, 30, .75); border-radius: 12px; }
.galerie__liste a { color: #fff; }


/* Smartphone: Baum vollständig breit und vertikal mittig */
@media screen and (max-width: 767px) {
  .galerie {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .galerie__scroll {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    transform: translateY(-50%);
  }

  .galerie__buehne {
    width: min(100vw, var(--baum-max));
    margin: 0 auto;
  }

  .galerie__buehne .baum {
    display: block;
    width: 100%;
    height: auto;
  }
}
