/* ─── ecosistema.css — Interactive Orgchart Page ────────────────────────── */

/* ── Page reset: fullscreen, no scroll ─────────────────────────────────── */
body.eco-fullscreen {
  overflow: hidden;
  height: 100vh;
  background: #022914;
  position: relative;
}

/* ── Background glow blobs ─────────────────────────────────────────────── */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
  animation: glow-drift 28s ease-in-out infinite alternate;
}

.bg-glow-1 {
  width: 600px; height: 600px;
  top: -100px; left: -80px;
  background: rgba(123, 150, 105, 0.12);
  animation-duration: 32s;
}

.bg-glow-2 {
  width: 500px; height: 500px;
  bottom: -80px; right: 0;
  background: rgba(3, 60, 28, 0.35);
  animation-duration: 24s;
  animation-direction: alternate-reverse;
}

@keyframes glow-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-20px, 50px) scale(0.94); }
}

/* ── Background leaf SVGs ──────────────────────────────────────────────── */
.bg-leaf {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.04;
  filter: blur(2px);
  fill: #7B9669;
}

.bg-leaf-1 {
  width: 300px; height: 600px;
  top: -80px; left: -60px;
  animation: leaf-float 38s ease-in-out infinite;
}

.bg-leaf-2 {
  width: 240px; height: 480px;
  top: -60px; right: -40px;
  transform: rotate(90deg);
  animation: leaf-float 44s ease-in-out infinite reverse;
}

.bg-leaf-3 {
  width: 200px; height: 400px;
  bottom: -40px; left: 10%;
  transform: rotate(-45deg);
  animation: leaf-float 36s ease-in-out infinite 4s;
}

.bg-leaf-4 {
  width: 260px; height: 520px;
  bottom: -60px; right: 15%;
  transform: rotate(45deg);
  animation: leaf-float 42s ease-in-out infinite reverse 8s;
}

@keyframes leaf-float {
  0%, 100% { transform-origin: center; translate: 0 0; }
  33%       { translate: 12px -18px; }
  66%       { translate: -8px 14px; }
}

/* ── Canvas ─────────────────────────────────────────────────────────────── */
#orgchart-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  cursor: grab;
}

/* ── Navbar override (dark glass on eco page) ───────────────────────────── */
body.eco-fullscreen #navbar {
  background: rgba(2, 41, 20, 0.85) !important;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border-bottom: 1px solid rgba(123, 150, 105, 0.15);
  z-index: 100;
}

body.eco-fullscreen #navbar .nav-links a {
  color: rgba(240, 235, 224, 0.75);
}

body.eco-fullscreen #navbar .nav-links a:hover,
body.eco-fullscreen #navbar .nav-links a.active {
  color: #F0EBE0;
}

body.eco-fullscreen #navbar .nav-links a.active::after {
  background: #7B9669;
}

body.eco-fullscreen #navbar .nav-lang {
  color: rgba(240, 235, 224, 0.5);
}

body.eco-fullscreen #navbar .btn-primary {
  background: rgba(123, 150, 105, 0.25);
  border-color: rgba(123, 150, 105, 0.4);
  color: #F0EBE0;
}

body.eco-fullscreen #navbar .btn-primary:hover {
  background: rgba(123, 150, 105, 0.4);
}

body.eco-fullscreen .nav-hamburger span {
  background: rgba(240, 235, 224, 0.8);
}

body.eco-fullscreen #scroll-progress { display: none; }

/* ── Orgchart header (fixed below navbar) ───────────────────────────────── */
.orgchart-header {
  position: fixed;
  top: 72px;
  left: 0; right: 0;
  padding: 18px max(24px, calc((100vw - 1280px) / 2 + 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  z-index: 100;
  pointer-events: none;
}

.orgchart-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 300;
  color: rgba(240, 235, 224, 0.9);
  line-height: 1;
  letter-spacing: 0.01em;
}

.orgchart-title span {
  color: #7B9669;
}

.orgchart-hint {
  display: flex;
  gap: 20px;
  align-items: center;
  pointer-events: none;
}

.orgchart-hint span {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(240, 235, 224, 0.35);
  display: flex;
  align-items: center;
  gap: 6px;
}

.orgchart-hint kbd {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  color: rgba(240, 235, 224, 0.55);
}

/* ── Back button ────────────────────────────────────────────────────────── */
#back-btn {
  position: fixed;
  top: 80px;
  left: max(24px, calc((100vw - 1280px) / 2 + 24px));
  display: none;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(240, 235, 224, 0.7);
  background: rgba(2, 41, 20, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(123, 150, 105, 0.25);
  border-radius: 9999px;
  padding: 8px 18px;
  cursor: pointer;
  z-index: 200;
  transition: all 0.3s ease;
}

#back-btn:hover {
  color: #F0EBE0;
  border-color: rgba(123, 150, 105, 0.5);
  background: rgba(10, 90, 46, 0.6);
}

/* ── Detail panel ───────────────────────────────────────────────────────── */
#org-panel {
  position: fixed;
  top: 0; right: -480px;
  width: min(460px, 100vw);
  height: 100vh;
  padding: 48px 36px 48px 40px;
  background: rgba(2, 33, 16, 0.92);
  backdrop-filter: blur(28px) saturate(130%);
  -webkit-backdrop-filter: blur(28px) saturate(130%);
  border-left: 1px solid rgba(123, 150, 105, 0.2);
  z-index: 150;
  overflow-y: auto;
  transition: right 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  scrollbar-width: none;
}

#org-panel::-webkit-scrollbar { display: none; }

#org-panel.open {
  right: 0;
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.35);
}

.panel-close {
  position: absolute;
  top: 20px; right: 24px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(123, 150, 105, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(240, 235, 224, 0.6);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  padding-bottom: 1px;
}

.panel-close:hover {
  border-color: rgba(123, 150, 105, 0.6);
  color: #F0EBE0;
  background: rgba(123, 150, 105, 0.12);
}

.panel-badge {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(240, 235, 224, 0.85);
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 14px;
}

.panel-country {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(240, 235, 224, 0.45);
  margin-bottom: 12px;
}

.panel-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 300;
  color: #F0EBE0;
  line-height: 1.15;
  margin-bottom: 16px;
}

.panel-pct {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(40px, 5vw, 60px);
  font-weight: 300;
  color: #7B9669;
  line-height: 1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.panel-desc {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: rgba(240, 235, 224, 0.6);
  line-height: 1.7;
  margin-bottom: 24px;
}

.panel-parent {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: rgba(240, 235, 224, 0.4);
  border-top: 1px solid rgba(123, 150, 105, 0.15);
  padding-top: 16px;
  margin-bottom: 24px;
}

.panel-parent strong {
  color: rgba(240, 235, 224, 0.7);
  font-weight: 500;
}

.panel-subs-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(240, 235, 224, 0.35);
  margin-bottom: 12px;
  border-top: 1px solid rgba(123, 150, 105, 0.15);
  padding-top: 20px;
}

.panel-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid rgba(123, 150, 105, 0.12);
  background: rgba(123, 150, 105, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.panel-sub-item:hover {
  border-color: rgba(123, 150, 105, 0.35);
  background: rgba(123, 150, 105, 0.1);
}

.panel-sub-flag {
  font-size: 16px;
  flex-shrink: 0;
}

.panel-sub-name {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: rgba(240, 235, 224, 0.8);
  flex: 1;
}

.panel-sub-pct {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #7B9669;
  font-weight: 500;
  flex-shrink: 0;
}

/* ── Zoom controls ──────────────────────────────────────────────────────── */
.zoom-controls {
  position: fixed;
  bottom: 32px;
  right: max(28px, calc((100vw - 1280px) / 2 + 28px));
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
}

.zoom-controls button {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(123, 150, 105, 0.3);
  background: rgba(2, 41, 20, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(240, 235, 224, 0.75);
  font-size: 16px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.zoom-controls button:hover {
  border-color: rgba(123, 150, 105, 0.6);
  color: #F0EBE0;
  background: rgba(10, 90, 46, 0.6);
}

#zoom-reset {
  font-size: 8px !important;
  color: #7B9669 !important;
}

/* ── Legend ─────────────────────────────────────────────────────────────── */
.orgchart-legend {
  position: fixed;
  bottom: 32px;
  left: max(28px, calc((100vw - 1280px) / 2 + 28px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.9;
}

.legend-item span:last-child {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: rgba(240, 235, 224, 0.35);
}

/* ── Mobile overlay nav ─────────────────────────────────────────────────── */
body.eco-fullscreen .nav-overlay {
  background: rgba(2, 33, 16, 0.97);
  backdrop-filter: blur(24px);
}

body.eco-fullscreen .nav-overlay a {
  color: rgba(240, 235, 224, 0.75);
}

body.eco-fullscreen .nav-overlay a:hover {
  color: #F0EBE0;
}

/* ── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .orgchart-hint { display: none; }
  .orgchart-header { padding: 12px 20px; }
  .orgchart-title { font-size: 18px; }
  #org-panel { padding: 48px 24px 32px; }
  .zoom-controls { bottom: 20px; right: 20px; }
  .orgchart-legend { display: none; }
}
