/* Initial class - creates grid for size/positioning of popup and dims the page content beneath */
.popup {
  /* display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: 30px auto 30px; */
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.65);
  opacity: 0;
  visibility: hidden;
  transform: scale(1.1);
  transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
  z-index: 500;
}

/* .popup::after {
  content: '';
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.65);
  z-index: -1;
} */

/* Popup width classes */
.small-pop { grid-column: 5/9; }
.med-pop { grid-column: 4/10; }
.lrg-pop { grid-column: 2/12; }

/* Anchor the popup to the top, middle, or bottom of the screen? */
.anchor-top { align-items: start; }
.anchor-mid { align-items: center; }
.anchor-bot { align-items: end; }

/* The container for the popup's content */
.popup-content {
  grid-row: 2/3;
  position: relative;
  width: 1200px;
  max-width: 80%;
  /* max-height: calc(100vh - 5%); */
  margin: 20px auto 0;
  padding: 0.75rem;
  background-color: white;
  border-radius: 0.5rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr;
  grid-auto-flow: dense;
  /* align-items: start; */
}

.popup-content.stacked {
  display: flex;
  flex-direction: column;
}

.popup-content.stacked-reverse {
  display: flex;
  flex-direction: column-reverse;
}

/* Container for the text/CTA */
.pop-text {
  position: relative;
  grid-row-start: 1;
  margin: 10px;
  padding: 1rem;
  font-weight: 400;
  border-radius: 0.25rem;
  z-index: 50;
  color: #262626;
  /* background: rgba(255,255,255, 0.75); */
}

.pop-text.dark:after, .pop-text.light:after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0.25rem;
  z-index: -5;
}

.pop-text.dark { color: #fff; }
.pop-text.dark:after {
  background-color: #000;
}

.pop-text.light:after {
  background-color: #fff;
}

.pop-text.bg0:after { opacity: 0; }
.pop-text.bg25:after { opacity: 0.25; }
.pop-text.bg50:after { opacity: 0.5; }
.pop-text.bg75:after { opacity: 0.75; }
.pop-text.bg100:after { opacity: 1; }

.popup-content.stacked .pop-text { margin: 0 0 10px; }
.popup-content.stacked-reverse .pop-text { margin: 10px 0 0; }

.pop-text.inset-border:before {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  bottom: 5px;
  left: 5px;
  border: 1px solid #5c068c;
  border-radius: 0.25rem;
  z-index: -1;
}

.pop-text.dark.inset-border:before {
  border-color: #fff;
}

.pop-text.light.border { border: 1px solid #5c068c; }
.pop-text.dark.border { border: 1px solid #fff; }

.pop-text.dark .minor-ask > a {
  color: #fff;
  text-decoration: underline;
}

.pop-text.dark .minor-ask > a:hover { color: #b089c6; }

/* styles handling the different "pin" options */
.pin--north { align-items: start; }
.pin--north .pop-text { grid-column: 2/4; }

.pin--north-east { align-items: start; }
.pin--north-east .pop-text { grid-column: 3/5; }

.pin--east { align-items: center; }
.pin--east .pop-text { grid-column: 3/5; }

.pin--south-east { align-items: end; }
.pin--south-east .pop-text { grid-column: 3/5; }

.pin--south { align-items: end; }
.pin--south .pop-text { grid-column: 2/4; }

.pin--south-west { align-items: end; }
.pin--south-west .pop-text { grid-column: 1/3; }

.pin--west { align-items: center; }
.pin--west .pop-text { grid-column: 1/3; }

.pin--north-west { align-items: start; }
.pin--north-west .pop-text { grid-column: 1/3; }

.pin--center { align-items: center; }
.pin--center .pop-text { grid-column: 2/4; }

.pop-text.wide { grid-column: 1/5; }

.cover-bg .pop-text {
  grid-column: 1/5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

.cover-bg .pop-text > * {
  width: 80%;
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

/* Smaller container specifically for the popup's CTA button(s) */
.btn-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
}

.pop-img {
  width: 100%;
  /* max-height: calc(100vh - 5%); */
}

.force-height { height: 100%; }

.pop-img.background-img, a.bg-imageLink {
  grid-column: 1/5;
  grid-row: 1/2;
  border-radius: 0.25rem;
  align-self: center;
}

.pop-img.img-right {
  grid-column: 3/5;
  grid-row-start: 1;
}

.pop-img.img-left {
  grid-column: 1/3;
  grid-row-start: 1;
}

/* For those who do not wish to simply click/tap outside the popup to close it */
.close-button {
  display: flex;
  justify-content: center;
  position: absolute;
  top: -15px;
  right: -15px;
  width: 40px;
  height: 40px;
  text-align: center;
  cursor: pointer;
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  border-radius: 50%;
  background-color: #5c068c;
  z-index: 51;
  transition: background-color 250ms ease-out;
}

.close-button:hover {
  background-color: #000;
}

/* The class that reveals the popup on page load */
.show-popup {
  opacity: 1;
  visibility: visible;
  transform: scale(1.0);
  transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}

/* Here starteth the media queries */
@media only screen and (max-width: 799px) {
  /* .popup-content {
    display: flex;
    flex-direction: column-reverse;
    width: 90vw;
    max-height: 85vh;
    margin: 20px auto 0;
  } */

  .pin--north .pop-text, .pin--north-east .pop-text, .pin--east .pop-text, .pin--south-east .pop-text, .pin--south .pop-text, .pin--south-west .pop-text, .pin--west .pop-text, .pin--north-west .pop-text, .pin--center .pop-text {
    grid-column: 1/5;
    grid-row: 1/3;
    height: 100%;
    margin: 0;
  }

  .pop-text {
    margin-right: 0;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .pop-img {
    /* width: 78%; */
    height: unset;
  }

  .pin--north .pop-text, .pin--north-east .pop-text, .pin--north-west .pop-text { order: 1; }

  .popup-content.cover-bg { display: grid; }
}

@media only screen and (max-width: 640px) {
  /* .popup { grid-template-columns: repeat(5, 1fr) 45vw 45vw repeat(5, 1fr); } */
  .popup {
    display: flex;
    flex-direction: column;
  }

  .popup-content {
    width: 90vw;
    max-height: 90vh;
    margin: 20px auto 0;
  }

  .pop-img {
    width: unset;
    height: unset;
  }
}

@media only screen and (max-width: 500px) {
  .btn-box {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-box .button--purple {
    padding: 15px;
    /* font-size: 14px; */
  }
}

@media only screen and (max-height: 460px) and (orientation: landscape) {
  .popup-content {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    max-height: calc(100vh - 5%);
  }

  .popup-content .pop-text, .popup-content .pop-img {
    grid-column: 1/2;
    grid-row: 1/2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0 auto;
  }
}