/*
 * pb-modal.css
 * Page builder modal component. Uses its own pb-modal-* namespace so the global
 * .modal / .modal-dialog / .modal-content overrides in styles.css (used by the
 * Official Rules modal) never apply here, and vice versa.
 *
 * Visual defaults are wrapped in :where() (zero specificity) so a block's
 * Custom CSS and responsive settings always win.
 */

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

.pb-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1031;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s linear;
}

.pb-modal[hidden] {
  display: none !important;
}

.pb-modal.pb-modal-show {
  opacity: 1;
}

.pb-modal-dialog {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100%;
  padding: 1.75rem 1rem;
  box-sizing: border-box;
}

.pb-modal-centered .pb-modal-dialog {
  align-items: center;
}

.pb-modal-content {
  position: relative;
  width: 100%;
  outline: 0;
  transform: translateY(-16px);
  transition: transform 0.2s ease-out;
}

.pb-modal-show .pb-modal-content {
  transform: none;
}

:where(.pb-modal .pb-modal-content) {
  max-width: 600px;
  padding: 2rem;
  background-color: #fff;
  color: #212529;
  border-radius: 0.3rem;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3);
}

:where(.pb-modal-sm .pb-modal-content)   { max-width: 400px; }
:where(.pb-modal-lg .pb-modal-content)   { max-width: 900px; }
:where(.pb-modal-xl .pb-modal-content)   { max-width: 1140px; }
:where(.pb-modal-full .pb-modal-content) { max-width: none; }

:where(.pb-modal-title) {
  margin: 0 2rem 1rem 0;
}

.pb-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.75rem;
  line-height: 1;
  opacity: 0.6;
  cursor: pointer;
}

.pb-modal-close:hover,
.pb-modal-close:focus {
  opacity: 1;
}

.pb-modal-close:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

@media (max-width: 575.98px) {
  .pb-modal-dialog {
    padding: 1rem 0.5rem;
  }

  :where(.pb-modal .pb-modal-content) {
    padding: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pb-modal,
  .pb-modal-content {
    transition: none;
  }
}
