/* my-gui dialogs: the yes / no question, and every modal as a bottom sheet on narrow screens (docs/spec.md 20).
   Behaviour: js/ui.js, js/dialog.js. data-m-sheet="off" on a .m-modal keeps the centred box. */

.m-confirm .m-modal-box { width: min(400px, 100%); }
.m-confirm-text { margin: 0; color: var(--m-text-2); line-height: 1.55; }

@media screen and (max-width: 600px) {
  .m-modal:not(.m-palette):not([data-m-sheet="off"]) { place-items: end stretch; padding: 24px 0 0; }
  .m-modal:not(.m-palette):not([data-m-sheet="off"]) > .m-modal-box {
    width: 100%;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-width: 1px 0 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .m-modal.is-open:not([data-m-sheet="off"]) > .m-modal-box { transform: none; }
  /* the head is also the grip that pulls the sheet down */
  .m-modal:not(.m-palette):not([data-m-sheet="off"]) > .m-modal-box > .m-modal-head { position: relative; padding-top: 20px; touch-action: none; }
  .m-modal:not(.m-palette):not([data-m-sheet="off"]) > .m-modal-box > .m-modal-head::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 2px;
    background: rgba(var(--m-ink), .24);
  }
  .m-modal:not(.m-palette):not([data-m-sheet="off"]) .m-modal-foot > .m-btn { flex: 1 1 0%; justify-content: center; }
}

@media screen and (max-width: 600px) and (prefers-reduced-motion: reduce) {
  .m-modal:not(.m-palette):not([data-m-sheet="off"]) > .m-modal-box { transform: none; }
}
