/* Modal de proyecto */
.modal-project {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-project.open {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.75);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s;
}

.modal-project.open .modal-overlay {
  opacity: 1;
}

.modal-content {
  position: relative;
  width: min(90vw, 800px);
  max-height: 90vh;
  background: var(--surface);
  border-radius: 1rem;
  padding: 2rem;
  overflow-y: auto;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
}

.modal-project.open .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--surface-alt);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  color: var(--text);
  transition: background-color 0.2s;
}

.modal-close:hover {
  background: var(--surface-hover);
}

.modal-title {
  font-size: 1.75rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.modal-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

.modal-tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.tech-tag {
  padding: 0.35rem 0.75rem;
  background: var(--surface-alt);
  border-radius: 2rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.modal-gallery {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin: 0 0 2rem;
}

.gallery-img {
  width: 100%;
  border-radius: 0.5rem;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.modal-links {
  display: flex;
  gap: 1rem;
}

.modal-demo,
.modal-source {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.2s;
}

.modal-demo:hover,
.modal-source:hover {
  background: var(--surface-hover);
}

/* Panel de ajustes */
.settings-panel {
  position: fixed;
  right: 1rem;
  bottom: 5rem;
  z-index: 90;
  transform: translateX(calc(100% + 1rem));
  transition: transform 0.3s;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-toggle {
  position: absolute;
  left: -3.5rem;
  bottom: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.2s;
}

.settings-toggle:hover {
  background: var(--surface-hover);
}

.settings-content {
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.settings-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.settings-close:hover {
  background: var(--surface-hover);
}

.settings-title {
  font-size: 1.1rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-group + .settings-group {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.settings-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-option label {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.settings-option select {
  width: 5rem;
  padding: 0.25rem;
  border-radius: 0.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Animaciones */
@media (prefers-reduced-motion: no-preference) {
  .modal-project .modal-content {
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
      opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .modal-project.open .modal-content {
    transform: scale(1) translateY(0);
  }

  .settings-panel {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}
