/* Popups. Always on chalk paper, whichever zone the page underneath is in,
   so a flyer looks the same on Home as on Donate. */

.popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.popup[hidden] { display: none; }

.popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 17, 15, .72);
  opacity: 0;
  transition: opacity .25s ease;
}

.popup__card {
  position: relative;
  width: min(30rem, 100%);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  display: flex;
  background: #faf5ec;
  color: #191510;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(.98);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
  outline: none;
}

.popup.is-open .popup__backdrop { opacity: 1; }
.popup.is-open .popup__card { opacity: 1; transform: none; }

/* The close button sits on the card, outside the part that scrolls, so it
   stays in the corner however tall the flyer is. Dark disc with a light ring
   so it reads on a white flyer and a black one alike. */
.popup__x {
  position: absolute;
  top: .6rem;
  right: .6rem;
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid rgba(250, 245, 236, .9);
  border-radius: 50%;
  background: rgba(19, 17, 15, .82);
  color: #faf5ec;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  transition: background .2s, transform .15s;
}
.popup__x:hover { background: #d4432f; }
.popup__x:active { transform: scale(.94); }
.popup__x:focus-visible { outline: 3px solid #d4432f; outline-offset: 2px; }

.popup__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  width: 100%;
}

.popup__imglink { display: block; }
.popup__img {
  display: block;
  width: 100%;
  height: auto;
}

.popup__words {
  padding: 1.4rem 1.5rem 1.6rem;
  font-family: var(--body, system-ui, sans-serif);
}
/* With no image, leave room so the heading doesn't run under the X. */
.popup__words--solo { padding-top: 1.8rem; padding-right: 3.8rem; }

.popup__title {
  font-family: var(--display, Georgia, serif);
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1.1;
  margin: 0 0 .6rem;
  color: #191510;
}
.popup__text { color: #5d544a; font-size: .98rem; line-height: 1.6; }
.popup__text p { margin: 0 0 .75rem; }
.popup__text p:last-child { margin-bottom: 0; }

.popup__btn {
  display: inline-block;
  margin-top: 1.1rem;
  padding: .75rem 1.4rem;
  border-radius: 999px;
  background: #d4432f;
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: background .2s;
}
.popup__btn:hover { background: #a93524; }

/* Keep the page underneath still while a popup is open. */
html.popup-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .popup__backdrop, .popup__card { transition: none; }
}
