/* Modal — HTMX-driven. Swapped into #modal-root; modal.js wires focus trap,
   ESC close, backdrop click. Self-animated via CSS transitions. */

body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 19, 15, .42);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  padding: 24px;
  animation: modal-fade .12s ease-out;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  width: 100%;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: modal-pop .14s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal--sm { max-width: 360px; }
.modal--md { max-width: 520px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 960px; }

.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head-text { flex: 1; min-width: 0; }
.modal-title {
  margin: 0;
  font-size: 16px; font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
}
.modal-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}
.modal-close {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-3);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.modal-close:hover {
  background: var(--bg-sunk);
  border-color: var(--line-3);
  color: var(--ink);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1; min-height: 0;
}

@media (max-width: 640px) {
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: var(--r-md) var(--r-md) 0 0; }
}
