/*
 * Popup (weplay_popup CPT)
 */

/* ============================================
   Dialog reset & backdrop
   ============================================ */

dialog.weplay-popup {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100%;
  max-height: 100%;
  overflow: visible;
}

dialog.weplay-popup::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ============================================
   Sizes
   ============================================ */

.weplay-popup--small .weplay-popup__inner { max-width: 480px; }
.weplay-popup--medium .weplay-popup__inner { max-width: 640px; }
.weplay-popup--large .weplay-popup__inner { max-width: 800px; }

/* ============================================
   Inner container
   ============================================ */

.weplay-popup__inner {
  position: relative;
  background: var(--white, #fff);
  border-radius: var(--radius-l, 12px);
  padding: var(--space-l, 2rem);
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ============================================
   Close button
   ============================================ */

.weplay-popup__close {
  position: absolute;
  top: var(--space-s, 0.75rem);
  right: var(--space-s, 0.75rem);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 50%;
  background: var(--bg-light, #f0f0f0);
  color: var(--base, #1a1a2e);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  z-index: 1;
}

.weplay-popup__close svg {
  width: 24px;
  height: 24px;
}

.weplay-popup__close:hover {
  background: var(--base, #1a1a2e);
  color: var(--white, #fff);
}

/* ============================================
   Body
   ============================================ */

.weplay-popup__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-m, 1.5rem);
}

.weplay-popup__image {
  margin: calc(var(--space-l, 2rem) * -1);
  margin-bottom: 0;
  overflow: hidden;
  border-radius: var(--radius-l, 12px) var(--radius-l, 12px) 0 0;
}

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

.weplay-popup__heading {
  margin: 0;
  padding-right: 2rem;
}

.weplay-popup__content > *:first-child {
  margin-top: 0;
}

.weplay-popup__content > *:last-child {
  margin-bottom: 0;
}

/* ============================================
   Animation
   ============================================ */

dialog.weplay-popup[open] {
  animation: weplay-popup-in 0.25s ease-out forwards;
}

dialog.weplay-popup[open]::backdrop {
  animation: weplay-popup-backdrop-in 0.25s ease-out forwards;
}

dialog.weplay-popup.is-closing {
  animation: weplay-popup-out 0.2s ease-in forwards;
}

dialog.weplay-popup.is-closing::backdrop {
  animation: weplay-popup-backdrop-out 0.2s ease-in forwards;
}

@keyframes weplay-popup-in {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes weplay-popup-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(1rem) scale(0.96);
  }
}

@keyframes weplay-popup-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes weplay-popup-backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
