/**
 * Component: Modal
 * Markup pattern (built by assets/js/components/modal.js):
 * <div class="modal" id="..." hidden>
 *   <div class="modal__backdrop" data-modal-close></div>
 *   <div class="modal__panel" role="dialog" aria-modal="true" aria-labelledby="...">
 *     <button class="modal__close" data-modal-close aria-label="Close">×</button>
 *     ...
 *   </div>
 * </div>
 */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--sf-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sf-space-4);
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 20, 28, 0.55);
  backdrop-filter: blur(2px);
  z-index: var(--sf-z-modal-backdrop);
  animation: sf-fade-in var(--sf-duration-base) var(--sf-ease);
}

.modal__panel {
  position: relative;
  z-index: var(--sf-z-modal);
  background: var(--sf-surface);
  border-radius: var(--sf-radius-lg);
  box-shadow: var(--sf-shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--sf-space-8);
  animation: sf-modal-in var(--sf-duration-base) var(--sf-ease);
}

.modal__close {
  position: absolute;
  top: var(--sf-space-4);
  right: var(--sf-space-4);
  background: none;
  border: none;
  width: 2rem; height: 2rem;
  border-radius: var(--sf-radius-full);
  color: var(--sf-slate-600);
  font-size: 1.25rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.modal__close:hover { background: var(--sf-border); color: var(--sf-ink); }

.modal__title { margin-bottom: var(--sf-space-3); padding-right: var(--sf-space-8); }

@keyframes sf-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sf-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .modal__backdrop, .modal__panel { animation: none; }
}

body.has-open-modal { overflow: hidden; }
