/**
 * Drupal dialogs rendered by biopama_libraries/dialog as Bootstrap modal /
 * offcanvas. Colours default to the theme preset; a page re-skins by setting
 * the --akp-dialog-* tokens (css/ct_override.css does this for the CT greys).
 *
 * Selector note: the generated akp_config presets declare their modal tokens
 * under `html body .modal`, so anything that must win over a preset needs the
 * same specificity. Spacing and radius stay with the preset.
 */
html body .modal,
html body .offcanvas {
  --bs-modal-bg: var(--akp-dialog-bg, var(--bs-body-bg));
  --bs-offcanvas-bg: var(--akp-dialog-bg, var(--bs-body-bg));
  --bs-modal-color: var(--akp-dialog-color, var(--bs-body-color));
  --bs-offcanvas-color: var(--akp-dialog-color, var(--bs-body-color));
  --bs-modal-border-color: var(--akp-dialog-border-color, var(--bs-link-color));
  --bs-modal-header-border-color: var(--akp-dialog-border-color, var(--bs-link-color));
  --bs-modal-footer-border-color: var(--akp-dialog-border-color, var(--bs-link-color));
  --bs-offcanvas-border-color: var(--akp-dialog-border-color, var(--bs-link-color));
}

.modal .modal-title,
.offcanvas .offcanvas-title {
  color: var(--akp-dialog-title-color, var(--bs-link-color));
}

.modal .btn-close,
.offcanvas .btn-close {
  --bs-btn-close-filter: var(--akp-dialog-close-filter, invert(1) grayscale(100%) brightness(200%));
}

.offcanvas.biopama-offcanvas-wide {
  --bs-offcanvas-width: min(600px, 100vw);
}

/* Offcanvas has no footer component; the engine's button bar sits below the
   scrolling body (the offcanvas is already a flex column). */
.offcanvas .biopama-dialog-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem;
  border-top: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
}

/* The content element core hands us is a plain div; let it fill and scroll. */
.offcanvas .offcanvas-body.ui-dialog-content {
  flex: 1 1 auto;
  overflow-y: auto;
}
