/* Dialog / Modal
 * Native <dialog> element styling with backdrop.
 * Pairs with confirmation_controller.js.
 * Entry/exit animation via @starting-style (no JavaScript).
 */

dialog {
  max-width: min(90vw, 32rem);
  padding: var(--block-space-l) var(--inline-space-l);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: 0 8px 32px oklch(0% 0 0 / 0.15);

  /* Entry animation */
  opacity: 1;
  scale: 1;
  transition:
    opacity 150ms ease,
    scale 150ms ease,
    overlay 150ms ease allow-discrete,
    display 150ms ease allow-discrete;

  @starting-style {
    opacity: 0;
    scale: 0.95;
  }

  /* Exit animation (when closing) */
  &:not([open]) {
    opacity: 0;
    scale: 0.95;
  }
}

dialog::backdrop {
  background: oklch(0% 0 0 / 0.4);
  transition:
    background 150ms ease,
    overlay 150ms ease allow-discrete,
    display 150ms ease allow-discrete;

  @starting-style {
    background: oklch(0% 0 0 / 0);
  }
}

/* Dialog header */
dialog header,
dialog .dialog__header {
  margin-block-end: var(--block-space);
  font-weight: 600;
  font-size: 1.125rem;
}

/* Dialog footer (action buttons) */
dialog footer,
dialog .dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--inline-space);
  margin-block-start: var(--block-space-l);
}
