/* =========================================================
   FAMILY TREE  –  tree_style.css
   ========================================================= */

body { background: #808080; margin: 0; padding: 0; }

/* ── pan/zoom viewport ── */
.tree-viewport {
  position: fixed;
  top: 60px; left: 0; right: 0; bottom: 0;
  overflow: hidden;        /* panning is handled by JS translate */
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;      /* we handle touch ourselves */
}
.tree-viewport.grabbing { cursor: grabbing; }

/* ── the actual tree canvas (JS transforms this) ── */
.tree-canvas {
  display: inline-flex;
  align-items: flex-start;
  padding: 40px 60px 80px;
  transform-origin: 0 0;
  will-change: transform;
}

/* ── connector lines (CSS tree layout) ── */
.tree ul {
  padding-top: 20px;
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  transition: all 0.3s;
}
.tree li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  list-style: none;
  position: relative;
  padding: 20px 8px 0;
}
.tree li::before, .tree li::after {
  content: '';
  position: absolute; top: 0; right: 50%;
  border-top: 1px solid rgba(255,255,255,0.4);
  width: 50%; height: 20px;
}
.tree li::after { right: auto; left: 50%; border-left: 1px solid rgba(255,255,255,0.4); }
.tree li:only-child::before,
.tree li:only-child::after { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: none; }
.tree li:last-child::before {
  border-right: 1px solid rgba(255,255,255,0.4);
  border-radius: 0 5px 0 0;
}
.tree li:first-child::after { border-radius: 5px 0 0 0; }
.tree ul ul::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  border-left: 1px solid rgba(255,255,255,0.4);
  width: 0; height: 20px;
}

/* ── family group: couples side by side ── */
.family-group {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

/* ── individual member card ── */
.member {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 110px;
  margin: 4px;
}

.profile {
  width: 80px; height: 80px;
  border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* gender colours */
.male   .profile { background: #3a7bd5; border: 2px solid #2c5fa8; }
.female .profile { background: #e05c9a; border: 2px solid #b5437a; }

/* clickable profiles */
.clickable-profile {
  width: 80px; height: 80px;
  border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.clickable-profile:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.6);
}
.clickable-profile img { width: 100%; height: 100%; object-fit: cover; }
.male   .clickable-profile { background: #3a7bd5; border: 2px solid #2c5fa8; }
.female .clickable-profile { background: #e05c9a; border: 2px solid #b5437a; }

/* spouse connector line */
.spouse-line {
  width: 24px; height: 2px;
  background: rgba(255,255,255,0.45);
  align-self: center;
  margin-top: -20px;   /* line up with the circle centres */
  flex-shrink: 0;
}

/* name label */
.name {
  font-family: "Pathway Gothic One", sans-serif;
  color: #f0f0f0;
  font-size: 12px;
  line-height: 1.3;
  margin-top: 6px;
  text-align: center;
  max-width: 110px;
  word-break: break-word;
  white-space: normal;
}
.name a { color: #a8d8f0; text-decoration: none; }
.name a:hover { text-decoration: underline; }

/* ── zoom & reset buttons ── */
.tree-zoom-buttons {
  position: fixed;
  left: 12px;
  bottom: 20px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tree-zoom-buttons button {
  background: rgba(0,100,220,0.65);
  color: #fff;
  font-size: 22px; font-weight: bold;
  border: none; border-radius: 50%;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tree-zoom-buttons button:hover { background: rgba(0,70,190,0.9); transform: scale(1.1); }
.tree-zoom-buttons button:focus { outline: none; }

/* reset / center button */
.tree-zoom-buttons .reset-btn {
  font-size: 14px; border-radius: 8px;
  width: auto; padding: 0 10px;
}

@media (max-width: 640px) {
  .tree-zoom-buttons {
    flex-direction: row;
    left: 50%; bottom: 16px;
    transform: translateX(-50%);
  }
}
