/**
 * 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;
}

/**
 * Modal Dialog base styling
 */
.js [data-modal],
.a11y-modal {
  -webkit-overflow-scrolling: touch;
  border: 2px solid;
  border-radius: 0.55rem;
  bottom: 0;
  box-shadow: 0 0 1800px 400px rgba(0,0,0,.4);
  left: 0;
  margin: auto;
  max-height: 100%;
  max-width: 660px;
  opacity: 1;
  overflow: auto;
  padding: 1.25rem;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateY(0%);
  visibility: visible;
  width: 100%;
  z-index: 1000; /* this should be more than enough... */
}

@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;
  }
}

/* keep first element from running into close button */
.js [data-modal] > *:first-child,
.a11y-modal > *:first-child {
  margin-right: 2.5rem;
}

.js [data-modal] h1,
.a11y-modal h1 {
  font-size: 1.2rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.js [data-modal] .content,
.a11y-modal .content {
  margin-bottom: 1.5rem;
}


/**
 * 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;
}

.is-icon-btn {
  height: 2em;
  position: absolute;
  right: 0;
  top: 0.5rem;
  width: 2em;
}