/* ============================================
   Ecosystem Explorer — Michaelism Metaverse
   Deep space aesthetic with glass morphism
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #050510;
  color: #e2e8f0;
  overflow: hidden;
  height: 100vh;
}

/* Navigation — ecosystem page keeps minimal nav */
.mm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(5, 5, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212, 165, 116, 0.1);
  padding: 0.75rem 5%;
}
.mm-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}
.mm-logo {
  font-weight: 700;
  color: #d4a574;
  text-decoration: none;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.mm-logo img {
  vertical-align: middle;
  margin-right: 0.4rem;
  height: 32px;
  width: auto;
}

.mm-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-left: auto;
}
.mm-links a {
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 0.3s;
}
.mm-links a:hover, .mm-links a.active {
  opacity: 1;
}
.mm-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #d4a574;
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: auto;
}

/* Dropdown nav */
.mm-dropdown { position: relative; display: inline-block; }
.mm-dropdown-toggle {
  background: none; border: none; color: inherit;
  font-family: inherit; font-size: inherit; cursor: pointer;
  padding: 0; opacity: 0.8; transition: opacity 0.3s;
}
.mm-dropdown-toggle:hover,
.mm-dropdown.active .mm-dropdown-toggle { opacity: 1; }
.mm-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 0.5rem);
  left: 50%; transform: translateX(-50%);
  background: rgba(10, 10, 26, 0.98);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 8px; padding: 0.5rem 0; min-width: 160px; z-index: 1001;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.mm-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: 0;
  right: 0;
  height: 0.5rem;
}
.mm-dropdown:hover .mm-dropdown-menu,
.mm-dropdown.open .mm-dropdown-menu { display: flex; flex-direction: column; }
.mm-dropdown-menu a { padding: 0.5rem 1.2rem; white-space: nowrap; }
.mm-dropdown-menu a:hover { background: rgba(255,255,255,0.05); }
.mm-ecosystem-link { opacity: 0.6; font-size: 0.85em; }
.mm-ecosystem-link:hover, .mm-ecosystem-link.active { opacity: 1; }

/* Graph container - full viewport */
#graph-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

/* Info Panel — glass morphism */
.info-panel {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  min-width: 320px;
  max-width: 480px;
  z-index: 50;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(212, 165, 116, 0.03);
}
.info-panel.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}
.info-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
}
.info-close:hover { opacity: 1; }
.info-type {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.info-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #f8fafc;
}
.info-desc {
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}
.info-connections {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-bottom: 0.75rem;
}
.info-visit {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  background: rgba(212, 165, 116, 0.15);
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 8px;
  color: #d4a574;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.3s;
}
.info-visit:hover {
  background: rgba(212, 165, 116, 0.25);
}

/* Legend */
.legend {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  background: rgba(10, 10, 26, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  z-index: 50;
  font-size: 0.8rem;
}
.legend h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  opacity: 0.7;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Filter Buttons */
.filters {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  z-index: 50;
  max-width: 300px;
  justify-content: flex-end;
}
.filter-btn {
  background: rgba(10, 10, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  min-height: 32px;
}
.filter-btn:hover {
  border-color: rgba(212, 165, 116, 0.3);
}
.filter-btn.active {
  background: rgba(212, 165, 116, 0.2);
  border-color: rgba(212, 165, 116, 0.5);
  color: #d4a574;
}

/* Loading */
.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 200;
  color: #d4a574;
}
.loading.hidden { display: none; }
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(212, 165, 116, 0.2);
  border-top-color: #d4a574;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile */
@media (max-width: 768px) {
  .mm-links { display: none; }
  .mm-menu-toggle { display: block; }
  .legend { top: auto; bottom: 5rem; right: 0.75rem; left: 0.75rem; }
  .filters { right: 0.75rem; left: 0.75rem; max-width: none; justify-content: center; }
  .info-panel { left: 0.75rem; right: 0.75rem; transform: none; min-width: auto; bottom: auto; top: 50%; }
  .info-panel.hidden { transform: translateY(20px); }
  .mm-dropdown { width: 100%; }
  .mm-dropdown-toggle { display: none; }
  .mm-dropdown-menu {
    display: flex !important; flex-direction: column; position: static;
    transform: none; background: none; border: none; padding: 0;
    backdrop-filter: none; -webkit-backdrop-filter: none; min-width: auto;
  }
  .mm-dropdown-menu a { padding: 0.75rem 1rem; }
}

/* Print - hide graph entirely */
@media print {
  #graph-container, .legend, .filters { display: none; }
  .info-panel { position: static; transform: none; }
}
