/* ============================================================
   MODAL — base com <dialog> nativo (foco, Esc e inert grátis)
   O painel do projeto (trilha 1B) estende esta base.
   <dialog class="modal" data-js="modal" aria-labelledby="…">
     <div class="modal__panel">
       <button class="modal__close" data-js="modal-close" aria-label="Fechar">…</button>
       …
     </div>
   </dialog>
============================================================ */
.modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-ink);
  overflow: hidden;
}
.modal::backdrop {
  background: rgb(28 27 25 / .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal[open] { display: flex; align-items: stretch; justify-content: center; }

.modal__panel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--color-bg);
}
@media (min-width: 1024px) {
  .modal[open] { align-items: center; padding: var(--space-6); }
  .modal__panel {
    max-width: var(--container);
    height: auto;
    max-height: calc(100svh - var(--space-6) * 2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
  }
}

.modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-1);
  transition: background-color var(--dur-1) var(--ease);
}
.modal__close:hover { background: var(--color-sand); }

/* Entrada */
.modal[open] .modal__panel { animation: modal-in var(--dur-2) var(--ease); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
