:root {
  --modalPadding: 3.75em;
}

*,*:after,*:before{box-sizing:border-box;}

/**
 * Including the at-only style with the dialog CSS as it is required
 * to visually hide a dialog's heading if desired.
 */
.at-only:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(100%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap; width: 1px;
}

/**
 * Trigger styling
 */
[data-modal-open][hidden] {
  display: none;
}

/**
 * When a modal dialog is open, don't allow scrolling of content
 * beneath (on desktop). Also useful in negating instances of
 * double scroll bars.
 * (browser window + dialog if long enough content)
 */
body.modal-open {
  overflow: hidden;
}

[data-modal-document] {
  height: 100%;
}

/**
 * Modal Dialog base styling
 */
.js [data-modal],
.a11y-modal {
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 4px;
  bottom: 0;
  box-shadow: 0 0 1800px 1000px rgba(243,243,243,.8);
  left: 0;
  margin: auto;
  max-height: 80vh;
  max-width: 570px;
  opacity: 1;
  outline: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: var(--modalPadding);
  position: fixed;
  right: 0;
  top: 0;
  transform: translateY(0%);
  visibility: visible;
  width: 90vw;
  z-index: 10; /* this should be more than enough... */
}

.a11y-modal h1 {
  margin-top: 0;
}

.a11y-modal--wide {
  max-width: 720px;
}

.a11y-modal h1 {
    font-weight: bold;
}



@media screen and ( min-height: 440px ) and ( min-width: 500px ) {
  .js [data-modal],
  .a11y-modal {
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity .2s ease-in-out, transform .2s ease-in-out;
  }
}


/**
 * To allow for CSS animations, hidden modal dialogs are
 * not set to display: none, but rather the following rule
 * set, in combination with the dialog's default
 * position: fixed, will keep dialogs hidden from
 * all users until opened.
 *
 * This also solves an issue with iOS VO + Safari not allowing
 * modal dialogs to be focused, if the dialog is initially
 * set to "display: none".
 */
.js [data-modal][hidden]
.a11y-modal[hidden] {
  display: block;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15vh);
  visibility: hidden;
}

.a11y-modal__close-btn {
  border: none;
}

.is-icon-btn {
  background: none;
  border: none;
  height: 2em;
  padding: 0;
  position: absolute;
  right: 2em;
  top: 2.5em;
  width: 2em;
}

.is-icon-btn:hover [data-modal-x],
.is-icon-btn:focus [data-modal-x] {
  transform: scale(1.3) rotate(45deg);
  transition: transform .2s ease-in-out;
}

[data-modal-x] {
  border-right: 2px solid;
  bottom: 0;
  display: block;
  height: 2em;
  left: 0;
  margin: auto;
  pointer-events: none;
  position: relative;
  right: 0;
  top: 0;
  transform: rotate(45deg);
  width: 2px;
}

[data-modal-x]:after {
  border-right: 2px solid;
  content: "";
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  transform: rotate(-90deg);
  width: 100%;
}

@media screen and (max-width: 900px) {
  :root {
     --modalPadding: 1.5rem;
   }
 }