/* ===== Modal base ===== */
.mx-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: rgba(0, 0, 0, 0.85);
  transition: opacity 0.2s ease;
}

.mx-modal.mx-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Dialog box ===== */
.mx-modal__dialog {
  background: #111;
  padding: 1rem;
  border-radius: 8px;
  max-width: 90%;
  max-height: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Close button (X) ===== */
.mx-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.mx-modal__close:hover {
  color: #f33;
}

/* ===== Image ===== */
.mx-modal__img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 6px;
  margin-bottom: 1rem;
}

/* ===== Metadata under image ===== */
.mx-modal__meta {
  color: #eee;
}

.mx-modal__title {
  margin: 0.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

/* ===== Close button (bottom) ===== */
.mx-modal__actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
}
.mx-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background: #333;
  color: #eee;
  text-decoration: none;
  border: 1px solid #555;
  cursor: pointer;
  transition: background 0.2s;
}
.mx-btn:hover {
  background: #444;
}
.mx-btn--ghost {
  background: transparent;
  border: 1px solid #aaa;
}
.mx-btn--ghost:hover {
  background: #f5f5f5;
}

.mx-modal[data-loading] .mx-modal__img { opacity: 0.35; }
.mx-modal[data-loading] .mx-modal__dialog::after {
  content: "Loading…";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 600 1rem/1 system-ui, sans-serif;
}
body.mx-modal-open { overflow: hidden; }
