/* Residency Value Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  height: 100vh;
  background: rgba(10, 14, 20, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  opacity: 1;
}

.modal-card {
  background: var(--glass-bg-solid);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  margin: 40px auto;
  padding: 3rem;
  position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--glass-border);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-fast);
  line-height: 1;
  font-family: var(--font-mono);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(90deg);
  color: var(--primary);
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.modal-subtitle {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: #aac0c7;
  margin-bottom: 2rem;
  text-align: center;
}

.modal-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-section {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 1.5rem;
  border-left: 4px solid var(--glass-border);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-normal);
}

.modal-section:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border-hover);
}

.modal-section.research {
  border-left-color: var(--philosophy);
}

.modal-section.business {
  border-left-color: var(--web3);
}

.modal-section.transdisciplinary {
  border-left-color: var(--transdisciplinary);
}

.modal-section h3 {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-section.research h3 {
  color: var(--philosophy);
}

.modal-section.business h3 {
  color: var(--web3);
}

.modal-section.transdisciplinary h3 {
  color: var(--transdisciplinary);
}

.modal-section h4 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.modal-section p {
  margin-bottom: 1rem;
  line-height: 1.7;
  color: #d0dde2;
}

.modal-section ul {
  margin: 0.5rem 0 1rem 1.5rem;
  line-height: 1.7;
  color: #d0dde2;
}

.modal-section strong {
  color: var(--white);
  font-weight: 700;
}


/* Responsive */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 10px;
    height: 100dvh; /* Use dynamic viewport height on mobile */
  }
  
  .modal-card {
    padding: 2rem 1.5rem;
    margin: 10px auto;
    max-height: calc(100dvh - 20px); /* Account for padding */
  }
  
  .modal-title {
    font-size: 1.5rem;
  }
  
  .modal-section {
    padding: 1rem;
  }
  
  .modal-section h3 {
    font-size: 1.2rem;
  }
}

