/* =========================================================
   AREA PRINCIPALE
========================================================= */

#ft-wrapper {
  position: relative;
  height: 90vh;
  background: #f4f4f4;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

#ft-stage {
  width: 100%;
  height: 100%;
  cursor: grab;
  overflow: hidden;
  position: relative;
}

#ft-stage:active {
  cursor: grabbing;
}

#ft-tree {
  position: absolute;
  transform-origin: 0 0;
}

/* =========================================================
   CONTROLLI ZOOM
========================================================= */

#ft-controls {
  position: absolute;
  right: 20px;
  top: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#ft-controls button {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
  font-size: 22px;
  line-height: 1;
  transition: background .15s;
}

#ft-controls button:hover {
  background: #f0f0f0;
}

/* =========================================================
   CARD
========================================================= */

.person-card {
  position: absolute;
  background: #ffffff;
  border-radius: 14px;
  padding: 10px 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: opacity .2s, box-shadow .2s, transform .15s;
  z-index: 1;
  cursor: default;
  height:255px;
}

.person-card:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
}

/* =========================================================
   IMMAGINI
========================================================= */

.person-card img,
.parents-card .parent img,
.child-card img {
  width: 160px;
  height: 160px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  border: 2px solid #ddd;
  display: block;
}

/* =========================================================
   TESTO
========================================================= */

.person-card h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: #222;
}

.person-card .dates {
  font-size: 14px;
  color: #888;
  letter-spacing: .3px;
}

/* =========================================================
   COPPIA
========================================================= */

.parents-card {
  display: flex;
  flex-direction: row;
  gap: 16px;
  justify-content: center;
  align-items: flex-start;
  height:255px;
}

.parents-card .parent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 160px;
}

/* =========================================================
   FIGLIO
========================================================= */

.child-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 160px;
}

/* =========================================================
   LINEE SVG
========================================================= */

.tree-lines {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.tree-line {
  stroke: #b0b8c8;
  stroke-width: 2px;
  fill: none;
  transition: stroke .2s, stroke-width .2s, opacity .2s;
}

/* =========================================================
   HIGHLIGHT / DIMMED
========================================================= */

.person-card.dimmed {
  opacity: .25;
}

.person-card.highlight {
  opacity: 1;
  box-shadow: 0 0 0 2px #2C4340, 0 8px 20px rgba(74,144,217,.25);
}

.tree-line.dimmed-line {
  stroke: #d0d8e8;
  opacity: .2;
}

.tree-line.highlight-line {
  /*stroke: #4a90d9;*/
  stroke: #2C4340;
  stroke-width: 2.5px;
  opacity: 1;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 700px) {
  .person-card img,
  .parents-card .parent img,
  .child-card img {
    width: 100px;
    height: 100px;
  }
  .parents-card .parent,
  .child-card {
    width: 100px;
  }
}
