.rg-popup {
  --rg-popup-verde: #039a46;
  --rg-popup-verde-dark: #027a37;
  --rg-popup-verdino: #dde5da;
  --rg-popup-rosso: #d81b24;
  --rg-popup-nero: #1a1a1a;
  --rg-popup-muted: #4a4a4a;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: "Niramit", sans-serif;
  pointer-events: auto;
  isolation: isolate;
}

.rg-popup[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.rg-popup__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.rg-popup.is-open .rg-popup__backdrop {
  opacity: 1;
}

.rg-popup__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(90vh, 760px);
  overflow: auto;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  pointer-events: auto;
  transition:
    transform 0.28s ease,
    opacity 0.28s ease;
}

.rg-popup.is-open .rg-popup__dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.rg-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--rg-popup-nero);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  line-height: 0;
}

.rg-popup__close-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.rg-popup__close:hover,
.rg-popup__close:focus {
  background: #fff;
  color: var(--rg-popup-rosso);
  outline: none;
}

.rg-popup__media {
  background: var(--rg-popup-verdino);
  pointer-events: auto;
}

.rg-popup__media img,
.rg-popup__media-link img {
  display: block;
  width: 100%;
  height: auto;
}

.rg-popup__media--only {
  background: transparent;
}

.rg-popup__body {
  padding: 28px 28px 24px;
  background:
    linear-gradient(
      180deg,
      rgba(3, 154, 70, 0.05) 0%,
      rgba(255, 255, 255, 0) 48%
    ),
    #fff;
  pointer-events: auto;
}

.rg-popup__brand {
  font-family: "Niramit", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rg-popup-verde);
  margin-bottom: 12px;
}

.rg-popup__title {
  margin: 0 0 16px;
  font-family: "Niramit", sans-serif;
  font-size: clamp(1.55rem, 2.8vw, 1.95rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--rg-popup-nero);
}

.rg-popup__content {
  color: var(--rg-popup-muted);
  font-size: 1.125rem;
  line-height: 1.65;
}

.rg-popup__content p {
  margin: 0 0 0.85em;
}

.rg-popup__content p:last-child {
  margin-bottom: 0;
}

.rg-popup__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.rg-popup__cta,
.rg-popup__dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 2px;
  font-family: "Niramit", sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.rg-popup__cta {
  background: var(--rg-popup-verde);
  color: #fff;
  border-color: var(--rg-popup-verde);
}

.rg-popup__cta:hover,
.rg-popup__cta:focus {
  background: var(--rg-popup-verde-dark);
  border-color: var(--rg-popup-verde-dark);
  color: #fff;
}

.rg-popup__dismiss {
  background: #fff;
  color: var(--rg-popup-verde);
  border-color: var(--rg-popup-verde);
}

.rg-popup__dismiss:hover,
.rg-popup__dismiss:focus {
  background: var(--rg-popup-verdino);
  color: var(--rg-popup-verde-dark);
}

body.rg-popup-lock {
  overflow: hidden;
}

/* Temporary layer to absorb ghost-clicks after close */
.rg-popup-click-shield {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: transparent;
  pointer-events: auto;
  cursor: default;
}

@media (max-width: 560px) {
  .rg-popup {
    padding: 12px;
    align-items: flex-end;
  }

  .rg-popup__dialog {
    width: 100%;
    max-height: 88vh;
    border-radius: 8px 8px 0 0;
  }

  .rg-popup__body {
    padding: 22px 18px 18px;
  }

  .rg-popup__actions {
    flex-direction: column;
  }

  .rg-popup__cta,
  .rg-popup__dismiss {
    width: 100%;
  }
}
