section.ul-popup-overlay.is-visible {
  background: rgba(0, 0, 0, 0.6) !important;
}

.ul-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  /* FIX: Use display: none to prevent any faint rendering on load */
  display: none; 
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  padding: var(--space-md);
}

.ul-popup-overlay.is-visible {
  /* FIX: Switch to flex only when active */
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* --- BASE CARD (Shared) --- */
.ul-popup-card {
  position: relative;
  border-radius: 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  overflow: hidden;
  transform: translateY(30px);
  transition: transform 0.4s ease;
}

.ul-popup-overlay.is-visible .ul-popup-card {
  transform: translateY(0);
}

/* --- CLICK LAYER --- */
.ul-popup-click-layer {
  display: flex;
  width: 100%;
  height: 100%;
  text-decoration: none !important;
  border: none;
  color: inherit;
  cursor: pointer;
}

.ul-popup-click-layer:hover,
.ul-popup-click-layer:focus,
.ul-popup-click-layer:active {
  text-decoration: none !important;
  border: none;
  color: inherit;
}

/* --- MODE: STANDARD (Text + Image) --- */
.ul-popup-card.mode-standard {
  width: 100%;
  max-width: 600px;
  background-color: rgba(26, 43, 74, 0.95);
  flex-direction: row;
  min-height: 500px;
}

.ul-popup-card.mode-standard .ul-popup-click-layer {
  flex-direction: row;
}

.ul-popup-bg,
.ul-popup-bg-default {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.6;
}

.ul-popup-bg-default {
  background: radial-gradient(circle at 70% 50%, #273a65 0%, #111b2b 70%);
}

.ul-popup-content {
  position: relative;
  z-index: 2;
  flex: 0 0 70%; 
  max-width: 70%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

.ul-popup-image {
  position: relative;
  z-index: 1;
  flex: 0 0 45%;
  max-width: 45%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.ul-popup-image img {
  width: 110%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: bottom center;
  transform: translateY(10px);
}

/* --- MODE: IMAGE ONLY --- */
.ul-popup-card.mode-image {
  background-color: transparent;
  width: auto;
  max-width: 60vw;
  max-height: 60vh;
  min-height: 0;
  flex-direction: column;
  box-shadow: none; 
}

.ul-popup-card.mode-image .ul-popup-click-layer {
  display: block;
}

.ul-popup-card.mode-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh; 
  object-fit: contain;
  border-radius: 30px; 
}

/* --- SHARED ELEMENTS --- */
.ul-popup-card h3 {
  font-family: var(--font-primary);
  font-size: 3rem;
  line-height: 1.1;
  margin-bottom: var(--space-md);
  font-weight: 800;
  color: #ffffff;
  text-decoration: none !important;
}

.ul-popup-subhead {
  font-family: var(--font-primary);
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  color: #fbbf24;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: var(--space-sm);
  width: fit-content;
  text-decoration: none !important;
}

.ul-popup-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 25px;
}

.ul-popup-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.25); 
  padding: 8px 16px;
  border-radius: 50px;
  width: fit-content;
  backdrop-filter: blur(4px);
  text-decoration: none !important;
}

.ul-popup-feature-item i {
  color: #fbbf24;
  font-size: 1.6rem;
}

.ul-popup-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.ul-popup-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 14px 20px;
  font-size: 1.6rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  text-decoration: none !important;
}

.ul-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.ul-popup-close:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* --- MOBILE --- */
@media (max-width: 768px) {
  .ul-popup-overlay {
    padding: 15px;
  }
  
  .ul-popup-card.mode-standard {
    flex-direction: column;
    max-width: 400px;
    min-height: auto;
  }
  
  .ul-popup-card.mode-standard .ul-popup-click-layer {
    flex-direction: column;
  }

  .ul-popup-card.mode-image {
    max-width: 90vw; 
    max-height: 80vh;
  }

  .ul-popup-content {
    flex: 1 1 auto;
    max-width: 100%;
    padding: 30px 25px;
  }

  .ul-popup-image {
    display: none; 
  }

  .ul-popup-card h3 {
    font-size: 2.4rem;
  }
}