/* Organigrama interactivo — Grupo AS5 */
:root {
  --org-navy: #082a4f;
  --org-navy-light: #0d3a6a;
  --org-line: rgba(8, 42, 79, 0.35);
  --org-accent: #18d26e;
}

.organigrama-section {
  background: linear-gradient(180deg, #f6f8fb 0%, #eef2f7 100%);
  overflow: visible;
}

.organigrama-section .container {
  overflow: visible;
}

.organigrama-section .section-header p {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.org-chart {
  max-width: 1180px;
  margin: 2rem auto 0;
  padding: 1rem 0 3.5rem;
  overflow: visible;
}

.org-chart__top {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.org-chart__node {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(145deg, var(--org-navy-light) 0%, var(--org-navy) 55%, #061e38 100%);
  color: #fff;
  border-radius: 10px;
  box-shadow:
    0 10px 28px rgba(8, 42, 79, 0.22),
    0 2px 0 rgba(255, 255, 255, 0.08) inset;
  padding: 14px 20px;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease;
}

.org-chart.is-visible .org-chart__node {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.org-chart__node--root {
  min-width: 220px;
  max-width: 280px;
  font-size: 15px;
  letter-spacing: 0.06em;
  transition-delay: 0.05s;
}

.org-chart__node--mid {
  min-width: 200px;
  max-width: 260px;
  font-size: 14px;
  letter-spacing: 0.05em;
  transition-delay: 0.2s;
}

.org-chart__node--leaf {
  width: 100%;
  min-height: 72px;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.03em;
  padding: 12px 10px;
}

.org-chart__branch--wide .org-chart__node--leaf {
  min-height: 80px;
}

.org-chart__label {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
}

.org-chart__node:hover,
.org-chart__node:focus-within {
  box-shadow:
    0 14px 32px rgba(8, 42, 79, 0.28),
    0 0 0 2px rgba(24, 210, 110, 0.45);
  transform: translateY(-2px) scale(1.02);
}

.org-chart.is-visible .org-chart__node:hover {
  transform: translateY(-2px) scale(1.02);
}

.org-chart__vline {
  width: 2px;
  background: var(--org-line);
  transform-origin: top center;
  transform: scaleY(0);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

.org-chart__vline--root {
  height: 36px;
  transition-delay: 0.15s;
}

.org-chart__vline--mid {
  height: 40px;
  transition-delay: 0.3s;
}

.org-chart__vline--branch {
  height: 28px;
  margin-bottom: 0;
  transition-delay: 0.55s;
}

.org-chart.is-visible .org-chart__vline {
  transform: scaleY(1);
  opacity: 1;
}

.org-chart__branches-wrap {
  position: relative;
  margin-top: 0;
  padding-top: 2px;
  padding-bottom: 2.5rem;
  overflow: visible;
}

/* Scroll horizontal sin recortar sombras de las cajas inferiores */
.org-chart__branches-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 3.25rem;
}

.org-chart__hline {
  position: absolute;
  top: 0;
  left: 6%;
  right: 6%;
  height: 2px;
  background: var(--org-line);
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0;
  transition:
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.4s,
    opacity 0.4s ease 0.4s;
}

.org-chart.is-visible .org-chart__hline {
  transform: scaleX(1);
  opacity: 1;
}

.org-chart__branches {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 28px 0 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.org-chart__branch {
  flex: 1 1 0;
  min-width: 108px;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 5px 8px;
}

.org-chart__branch:nth-child(1) .org-chart__node { transition-delay: 0.65s; }
.org-chart__branch:nth-child(1) .org-chart__vline--branch { transition-delay: 0.58s; }
.org-chart__branch:nth-child(2) .org-chart__node { transition-delay: 0.72s; }
.org-chart__branch:nth-child(2) .org-chart__vline--branch { transition-delay: 0.65s; }
.org-chart__branch:nth-child(3) .org-chart__node { transition-delay: 0.79s; }
.org-chart__branch:nth-child(3) .org-chart__vline--branch { transition-delay: 0.72s; }
.org-chart__branch:nth-child(4) .org-chart__node { transition-delay: 0.86s; }
.org-chart__branch:nth-child(4) .org-chart__vline--branch { transition-delay: 0.79s; }
.org-chart__branch:nth-child(5) .org-chart__node { transition-delay: 0.93s; }
.org-chart__branch:nth-child(5) .org-chart__vline--branch { transition-delay: 0.86s; }
.org-chart__branch:nth-child(6) .org-chart__node { transition-delay: 1s; }
.org-chart__branch:nth-child(6) .org-chart__vline--branch { transition-delay: 0.93s; }
.org-chart__branch:nth-child(7) .org-chart__node { transition-delay: 1.07s; }
.org-chart__branch:nth-child(7) .org-chart__vline--branch { transition-delay: 1s; }
.org-chart__branch:nth-child(8) .org-chart__node { transition-delay: 1.14s; }
.org-chart__branch:nth-child(8) .org-chart__vline--branch { transition-delay: 1.07s; }
.org-chart__branch:nth-child(9) .org-chart__node { transition-delay: 1.21s; }
.org-chart__branch:nth-child(9) .org-chart__vline--branch { transition-delay: 1.14s; }

@media (max-width: 991px) {
  .org-chart__branches {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 12px;
  }

  .org-chart__branches-scroll {
    padding-left: 4px;
    padding-right: 4px;
  }

  .org-chart__branch {
    flex: 0 0 120px;
    min-width: 120px;
  }

  .org-chart__hline {
    left: 24px;
    right: 24px;
  }
}

@media (max-width: 575px) {
  .org-chart__node--root {
    min-width: 200px;
    font-size: 13px;
  }

  .org-chart__node--mid {
    min-width: 180px;
    font-size: 12px;
  }

  .org-chart__branch {
    flex: 0 0 110px;
    min-width: 110px;
  }

  .org-chart__node--leaf {
    font-size: 10px;
    min-height: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .org-chart__node,
  .org-chart__vline,
  .org-chart__hline {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
