/* ==========================================================================
   GerhardBaeurle.org – shared site styles
   ========================================================================== */

body {
    background-color: #fafaf9;
}

::selection {
    background-color: #e5e7eb;
    color: #0A0E19;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #fafaf9; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* --- Leaflet map ---------------------------------------------------------- */
#map {
    width: 100%;
    height: 400px;
    border-radius: 0.75rem;
    z-index: 10;
}
.legend {
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    font-size: 0.8em;
    line-height: 1.5;
}

/* --- Scroll reveal -------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.22,1,0.36,1), transform 0.8s cubic-bezier(0.22,1,0.36,1);
    will-change: opacity, transform;
}
.reveal.is-visible {
    opacity: 1;
    transform: none;
}
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* --- Gallery -------------------------------------------------------------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}
.gallery-card {
    margin: 0;
    background: #fff;
    border: 0.5px solid #e5e7eb;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s, transform 0.3s;
}
.gallery-card:hover {
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    transform: translateY(-3px);
}
.gallery-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5f5f4;
    cursor: zoom-in;
    border: 0;
    padding: 0;
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.22,1,0.36,1);
}
.gallery-card:hover .gallery-thumb img { transform: scale(1.05); }
.gallery-card figcaption { padding: 0.85rem 1rem 1.05rem; }
.gallery-card .g-date {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.gallery-card .g-caption {
    font-size: 0.875rem;
    line-height: 1.45;
    color: #374151;
    margin: 0;
}

/* --- Lightbox ------------------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10,14,25,0.92);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1.25rem;
}
.lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox figure {
    margin: 0;
    max-width: min(1100px, 92vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lightbox img {
    max-width: 100%;
    max-height: 74vh;
    object-fit: contain;
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox figcaption {
    margin-top: 1rem;
    text-align: center;
    color: #e5e7eb;
    max-width: 640px;
}
.lightbox .lb-date {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.lightbox .lb-caption { font-size: 0.95rem; line-height: 1.6; }
.lb-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.lb-btn:hover { background: rgba(255,255,255,0.2); }
.lb-prev { left: 1.25rem; }
.lb-next { right: 1.25rem; }
.lb-close { top: 1.25rem; right: 1.25rem; transform: none; }
@media (max-width: 640px) {
    .lb-prev { left: 0.4rem; }
    .lb-next { right: 0.4rem; }
}

/* --- "Sein Leben" life journey ------------------------------------------- */
.life-chapter { position: relative; }
.life-year {
    font-family: '"Newsreader"', serif;
    font-weight: 300;
    line-height: 1;
    color: #0A0E19;
}

/* --- Stammbaum (family tree) --------------------------------------------- */
.tree-stage {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 1px 1px, #e5e7eb 1px, transparent 0) 0 0 / 22px 22px,
        #fafaf9;
    border: 0.5px solid #e5e7eb;
    border-radius: 1.25rem;
    min-height: 520px;
    cursor: grab;
    user-select: none;
}
.tree-stage.dragging { cursor: grabbing; }
.tree-canvas {
    position: absolute;
    top: 0; left: 0;
    transform-origin: 0 0;
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
    padding: 28px;
}

/* --- Layered layout with SVG connectors (drawn from measured positions) --- */
.tree-rows {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
}
.band {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 34px;
}
.band-sep { width: 26px; flex-shrink: 0; }   /* gap between two parent pairs */
.tree-links {
    position: absolute;
    top: 0; left: 0;
    z-index: 0;
    overflow: visible;
    pointer-events: none;
}
.tree-links path { fill: none; stroke: #cbd5e1; stroke-width: 2; stroke-linejoin: round; }
.tree-links path.marr { stroke: #cbd5e1; }
.tree-links circle { fill: #fafaf9; stroke: #cbd5e1; stroke-width: 2; }

.node {
    width: 172px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.9rem;
    padding: 0.85rem 0.9rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
    text-align: left;
}
.node:hover { box-shadow: 0 10px 26px rgba(0,0,0,0.10); transform: translateY(-2px); }
.node.is-focus { border-color: #0A0E19; box-shadow: 0 12px 30px rgba(10,14,25,0.16); }
.node.is-root { background: #0A0E19; color: #fff; border-color: #0A0E19; }
.node.is-root .node-years,
.node.is-root .node-role { color: #cbd5e1; }
.node-avatar {
    width: 38px; height: 38px; border-radius: 9999px;
    background: #f5f5f4; color: #9ca3af;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; margin-bottom: 0.55rem;
    border: 1px solid #e5e7eb;
}
.node.is-root .node-avatar { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.2); }
.node-name { font-weight: 600; font-size: 0.92rem; line-height: 1.2; }
.node-years { font-size: 0.72rem; color: #6b7280; margin-top: 0.15rem; }
.node-role { font-size: 0.72rem; color: #9ca3af; margin-top: 0.2rem; }
.tree-controls {
    position: absolute;
    bottom: 14px; right: 14px;
    display: flex; gap: 6px;
    z-index: 5;
}
.tree-controls button {
    width: 36px; height: 36px;
    border-radius: 0.6rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: background 0.2s;
}
.tree-controls button:hover { background: #f5f5f4; }
