/* ============================================
 * Magic Darkroom · Modal
 *
 * Blob clip-path shape matching animal-island-ui.
 * Body text uses typewriter effect (data-typing attr).
 *
 * Structure (generated by modal.js):
 *   .md-modal-mask[data-open]
 *     .md-modal[data-typing]
 *       .md-modal__clip
 *         .md-modal__header
 *           .md-modal__title
 *           .md-modal__close
 *         .md-modal__body
 *         .md-modal__footer
 *
 * The SVG clipPath must be present in the page:
 *   <svg aria-hidden="true" style="position:absolute;width:0;height:0">
 *     <defs><clipPath id="md-modal-clip" clipPathUnits="objectBoundingBox">
 *       <path d="M0.501,0.005 ... " />
 *     </clipPath></defs>
 *   </svg>
 * ============================================ */

/* ---- Mask overlay ---- */
.md-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  animation: md-fade-in var(--dur-normal) ease;
}
.md-modal-mask[data-open="true"] {
  display: flex;
}

/* ---- Modal container ---- */
.md-modal {
  position: relative;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  animation: md-zoom-in 0.3s var(--ease-pop);
}

/* ---- Clipped blob shape ---- */
.md-modal__clip {
  clip-path: url(#md-modal-clip);
  padding: 48px 48px 32px;
  background: var(--c-bg-content);
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Header ---- */
.md-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
}

.md-modal__title {
  font-size: 26px;
  font-weight: 800;
  color: var(--c-text-h);
}

.md-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--c-text-3);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.md-modal__close:hover {
  background: rgba(114, 93, 66, 0.1);
  color: var(--c-text-h);
}

/* ---- Body ---- */
.md-modal__body {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--c-text-2);
  min-height: 72px;
  margin-bottom: 22px;
  overflow-y: auto;
  flex: 1;
}

/* Typewriter caret */
.md-modal__body::after {
  content: "\2588"; /* ▊ */
  display: inline-block;
  margin-left: 2px;
  animation: md-caret 0.7s steps(1) infinite;
  opacity: 0;
  color: var(--c-text-3);
  font-weight: 400;
}
.md-modal[data-typing="true"] .md-modal__body::after {
  opacity: 1;
}

/* ---- Footer ---- */
.md-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Width variants ---- */
.md-modal--sm { width: 380px; }
.md-modal--lg { width: 600px; }

/* ---- Responsive ---- */
@media (max-width: 520px) {
  .md-modal__clip {
    padding: 36px 28px 24px;
  }
  .md-modal__title {
    font-size: 22px;
  }
  .md-modal__body {
    font-size: 16px;
  }
}
