.sp-overlay {
  position: fixed; inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  animation: sp-overlay-in .25s ease forwards;
  -webkit-tap-highlight-color: transparent;
}
.sp-overlay--top    { align-items: flex-start; padding: 0; }
.sp-overlay--bottom { align-items: flex-end; padding: 0; }
.sp-overlay--corner { align-items: flex-end; justify-content: flex-end; padding: 24px; }
.sp-overlay--full   { padding: 0; background: rgba(0,0,0,0.85); }

@keyframes sp-overlay-in { from { opacity: 0 } to { opacity: 1 } }

.sp-pop {
  position: relative;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: #fff;
  color: #18181b;
  overflow: auto;
  box-sizing: border-box;
  min-height: var(--sp-min-h, auto);
}
.sp-pop--bottom-bar,
.sp-pop--top-bar      { max-height: none; overflow: hidden; }
.sp-pop--fullscreen   { max-height: 100vh; }
.sp-pop * { box-sizing: border-box; }

.sp-pop--size-small   { width: 380px; }
.sp-pop--size-medium  { width: 520px; }
.sp-pop--size-large   { width: 720px; }
.sp-pop--size-xlarge  { width: 920px; }
.sp-pop[style*="--sp-w:"] { width: var(--sp-w) !important; max-width: 100%; }

.sp-close {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px;
  border: 0; background: rgba(0,0,0,0.06);
  color: inherit; opacity: 0.7;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s, background .15s;
  z-index: 10;
}
.sp-close:hover { opacity: 1; background: rgba(0,0,0,0.12); }
.sp-close--hidden { display: none; }
.sp-pop--hero .sp-close,
.sp-pop--fullscreen .sp-close {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.sp-pop__content { padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.sp-pop__headline {
  margin: 0;
  font-size: var(--h-size, 1.6rem);
  font-weight: var(--h-weight, 700);
  color: var(--h-color, inherit);
  text-align: var(--h-align, inherit);
  line-height: var(--h-lh, 1.15);
}
.sp-pop__subhead  {
  margin: 0; opacity: 0.75;
  font-size: var(--s-size, 1rem);
  font-weight: var(--s-weight, 400);
  color: var(--s-color, inherit);
  text-align: var(--s-align, inherit);
  line-height: var(--s-lh, inherit);
}
.sp-pop__body     {
  font-size: var(--b-size, inherit);
  font-weight: var(--b-weight, inherit);
  color: var(--b-color, inherit);
  text-align: var(--b-align, inherit);
  line-height: var(--b-lh, 1.5);
}

@media (max-width: 1023px) {
  .sp-pop__headline {
    font-size:   var(--h-size-tab,   var(--h-size, 1.6rem));
    font-weight: var(--h-weight-tab, var(--h-weight, 700));
    color:       var(--h-color-tab,  var(--h-color, inherit));
    text-align:  var(--h-align-tab,  var(--h-align, inherit));
    line-height: var(--h-lh-tab,     var(--h-lh, 1.15));
  }
  .sp-pop__subhead {
    font-size:   var(--s-size-tab,   var(--s-size, 1rem));
    font-weight: var(--s-weight-tab, var(--s-weight, 400));
    color:       var(--s-color-tab,  var(--s-color, inherit));
    text-align:  var(--s-align-tab,  var(--s-align, inherit));
    line-height: var(--s-lh-tab,     var(--s-lh, inherit));
  }
  .sp-pop__body {
    font-size:   var(--b-size-tab,   var(--b-size, inherit));
    font-weight: var(--b-weight-tab, var(--b-weight, inherit));
    color:       var(--b-color-tab,  var(--b-color, inherit));
    text-align:  var(--b-align-tab,  var(--b-align, inherit));
    line-height: var(--b-lh-tab,     var(--b-lh, 1.5));
  }
}
.sp-pop__body p:first-child { margin-top: 0; }
.sp-pop__body p:last-child  { margin-bottom: 0; }
.sp-pop__disclaimer { margin: 8px 0 0; font-size: 11px; opacity: 0.6; line-height: 1.4; }

.sp-pop__img,
.sp-pop__img picture { display: block; }
.sp-pop__img img { display: block; width: 100%; height: 100%; object-fit: var(--sp-img-fit, cover); }

.sp-pop--card .sp-pop__img-top { width: 100%; max-height: var(--sp-img-h, 220px); height: var(--sp-img-h, auto); overflow: hidden; }
.sp-pop--card .sp-pop__img-top img { width: 100%; height: 100%; max-height: var(--sp-img-h, 220px); object-fit: var(--sp-img-fit, cover); }

.sp-pop--split-left,
.sp-pop--split-right { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; min-height: var(--sp-min-h, 380px); }
.sp-pop--split-left  > .sp-pop__img,
.sp-pop--split-right > .sp-pop__img {
  position: relative; min-height: 100%; height: auto; overflow: hidden;
}
.sp-pop--split-left  > .sp-pop__img img,
.sp-pop--split-right > .sp-pop__img img {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.sp-pop--split-left  > .sp-pop__content,
.sp-pop--split-right > .sp-pop__content { padding: 36px 32px; justify-content: center; }
.sp-pop--hero       .sp-pop__content,
.sp-pop--fullscreen .sp-pop__content { justify-content: center; }
.sp-pop--split-left.sp-pop--size-small,
.sp-pop--split-right.sp-pop--size-small  { width: 600px; }
.sp-pop--split-left.sp-pop--size-medium,
.sp-pop--split-right.sp-pop--size-medium { width: 760px; }
.sp-pop--split-left.sp-pop--size-large,
.sp-pop--split-right.sp-pop--size-large  { width: 920px; }

.sp-pop--hero { color: #fff; min-height: var(--sp-min-h, 360px); display: flex; align-items: center; justify-content: center; }
.sp-pop--hero .sp-pop__bg {
  position: absolute; inset: 0;
  background-size: var(--sp-img-fit, cover); background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}
.sp-pop--hero .sp-pop__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.65) 100%);
  z-index: 1;
}
.sp-pop--hero .sp-pop__content {
  position: relative; z-index: 2;
  text-align: center; padding: 60px 40px;
}
.sp-pop--hero .sp-pop__headline { font-size: 2rem; }
.sp-pop--hero .sp-form__input { background: rgba(255,255,255,0.95); }

.sp-pop--bottom-bar,
.sp-pop--top-bar {
  width: 100%; max-width: 100%;
  border-radius: 0 !important;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1) !important;
}
.sp-pop--top-bar { box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important; }
.sp-pop--bottom-bar .sp-pop__content--bar,
.sp-pop--top-bar    .sp-pop__content--bar {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
}
.sp-pop--bottom-bar .sp-pop__headline,
.sp-pop--top-bar    .sp-pop__headline { font-size: 1rem; flex: 0 0 auto; }
.sp-pop--bottom-bar .sp-pop__subhead,
.sp-pop--top-bar    .sp-pop__subhead  { font-size: 0.875rem; flex: 1 1 200px; margin: 0; }
.sp-pop--bottom-bar .sp-pop__body,
.sp-pop--top-bar    .sp-pop__body     { display: none; }
.sp-pop--bottom-bar .sp-pop__action,
.sp-pop--top-bar    .sp-pop__action   { flex: 0 0 auto; }
.sp-pop--bottom-bar .sp-pop__disclaimer,
.sp-pop--top-bar    .sp-pop__disclaimer { display: none; }

.sp-pop--slide-corner { width: 360px; }
.sp-pop--slide-corner .sp-pop__img-top { max-height: 140px; }
.sp-pop--slide-corner .sp-pop__content { padding: 20px 22px; gap: 10px; }
.sp-pop--slide-corner .sp-pop__headline { font-size: 1.1rem; }

.sp-pop--fullscreen {
  width: 100%; height: 100%; min-height: var(--sp-min-h, 100vh);
  border-radius: 0 !important; box-shadow: none !important;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.sp-pop--fullscreen .sp-pop__bg {
  position: absolute; inset: 0;
  background-size: var(--sp-img-fit, cover); background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}
.sp-pop--fullscreen .sp-pop__overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 1;
}
.sp-pop--fullscreen .sp-pop__content {
  position: relative; z-index: 2; text-align: center; padding: 60px;
  max-width: 720px;
}
.sp-pop--fullscreen .sp-pop__headline { font-size: 2.5rem; }

.sp-pop__action { margin-top: 4px; }
.sp-form { width: 100%; }
.sp-form__row { display: flex; gap: 8px; flex-wrap: nowrap; }

@media (max-width: 1023px) {
  .sp-pop,
  .sp-pop--split-left,
  .sp-pop--split-right { min-height: var(--sp-min-h-tab, var(--sp-min-h, auto)) !important; }
  .sp-pop[style*="--sp-w-tab:"] { width: var(--sp-w-tab) !important; max-width: 100%; }
  .sp-pop__img img { object-fit: var(--sp-img-fit-tab, var(--sp-img-fit, cover)) !important; }
  .sp-pop--card .sp-pop__img-top {
    max-height: var(--sp-img-h-tab, var(--sp-img-h, 220px)) !important;
    height:     var(--sp-img-h-tab, var(--sp-img-h, auto)) !important;
  }
  .sp-pop--card .sp-pop__img-top img {
    max-height: var(--sp-img-h-tab, var(--sp-img-h, 220px)) !important;
    object-fit: var(--sp-img-fit-tab, var(--sp-img-fit, cover)) !important;
  }
}

@media (max-width: 768px) {
  .sp-overlay { padding: 16px !important; }
  .sp-overlay--bottom,
  .sp-overlay--top { padding: 0 !important; }

  .sp-pop,
  .sp-pop--size-small,
  .sp-pop--size-medium,
  .sp-pop--size-large,
  .sp-pop--size-xlarge { width: 100% !important; max-width: 100% !important; min-height: var(--sp-min-h-mob, 0) !important; }
  .sp-pop[style*="--sp-w-mob:"] { width: var(--sp-w-mob) !important; max-width: 100% !important; }
  .sp-pop__img img { object-fit: var(--sp-img-fit-mob, var(--sp-img-fit-tab, var(--sp-img-fit, cover))) !important; }
  .sp-pop--card .sp-pop__img-top {
    max-height: var(--sp-img-h-mob, var(--sp-img-h-tab, var(--sp-img-h, 220px))) !important;
    height:     var(--sp-img-h-mob, var(--sp-img-h-tab, var(--sp-img-h, auto))) !important;
  }
  .sp-pop--card .sp-pop__img-top img {
    max-height: var(--sp-img-h-mob, var(--sp-img-h-tab, var(--sp-img-h, 220px))) !important;
    object-fit: var(--sp-img-fit-mob, var(--sp-img-fit-tab, var(--sp-img-fit, cover))) !important;
  }

  .sp-pop--split-left,
  .sp-pop--split-right {
    grid-template-columns: 1fr !important;
    grid-template-rows: var(--sp-img-h-mob, 200px) auto !important;
    min-height: var(--sp-min-h-mob, 0) !important;
  }
  .sp-pop--split-right > .sp-pop__img { order: -1 !important; }
  .sp-pop--split-left  > .sp-pop__img,
  .sp-pop--split-right > .sp-pop__img { min-height: var(--sp-img-h-mob, 200px) !important; }
  .sp-pop--split-left  > .sp-pop__img img,
  .sp-pop--split-right > .sp-pop__img img { position: relative !important; }

  .sp-pop__content { padding: 24px 20px !important; }
  .sp-pop__headline {
    font-size:   var(--h-size-mob,   var(--h-size-tab,   var(--h-size, 1.4rem))) !important;
    font-weight: var(--h-weight-mob, var(--h-weight-tab, var(--h-weight, 700))) !important;
    color:       var(--h-color-mob,  var(--h-color-tab,  var(--h-color, inherit))) !important;
    text-align:  var(--h-align-mob,  var(--h-align-tab,  var(--h-align, inherit))) !important;
    line-height: var(--h-lh-mob,     var(--h-lh-tab,     var(--h-lh, 1.15))) !important;
  }
  .sp-pop__subhead {
    font-size:   var(--s-size-mob,   var(--s-size-tab,   var(--s-size, 0.95rem))) !important;
    font-weight: var(--s-weight-mob, var(--s-weight-tab, var(--s-weight, 400))) !important;
    color:       var(--s-color-mob,  var(--s-color-tab,  var(--s-color, inherit))) !important;
    text-align:  var(--s-align-mob,  var(--s-align-tab,  var(--s-align, inherit))) !important;
    line-height: var(--s-lh-mob,     var(--s-lh-tab,     var(--s-lh, inherit))) !important;
  }
  .sp-pop__body {
    font-size:   var(--b-size-mob,   var(--b-size-tab,   var(--b-size, inherit))) !important;
    font-weight: var(--b-weight-mob, var(--b-weight-tab, var(--b-weight, inherit))) !important;
    color:       var(--b-color-mob,  var(--b-color-tab,  var(--b-color, inherit))) !important;
    text-align:  var(--b-align-mob,  var(--b-align-tab,  var(--b-align, inherit))) !important;
    line-height: var(--b-lh-mob,     var(--b-lh-tab,     var(--b-lh, 1.5))) !important;
  }
  .sp-pop--hero .sp-pop__headline,
  .sp-pop--fullscreen .sp-pop__headline { font-size: var(--h-size-mob, var(--h-size-tab, var(--h-size, 1.6rem))) !important; }

  .sp-pop--mobile-card {
    display: block !important;
    width: 100% !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15) !important;
  }
  .sp-pop--mobile-card .sp-pop__content--bar {
    flex-direction: column !important; align-items: stretch !important; padding: 24px 20px !important;
  }
  .sp-pop--mobile-card .sp-pop__body { display: block !important; }
  .sp-pop--mobile-card .sp-pop__disclaimer { display: block !important; }

  .sp-pop--mobile-bottom-bar,
  .sp-pop--mobile-top-bar {
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  .sp-pop--mobile-bottom-bar .sp-pop__img,
  .sp-pop--mobile-top-bar    .sp-pop__img,
  .sp-pop--mobile-bottom-bar .sp-pop__img-top,
  .sp-pop--mobile-top-bar    .sp-pop__img-top { display: none !important; }
  .sp-pop--mobile-bottom-bar .sp-pop__content,
  .sp-pop--mobile-top-bar    .sp-pop__content {
    padding: 12px 16px !important; gap: 8px !important;
  }
  .sp-pop--mobile-bottom-bar .sp-pop__body,
  .sp-pop--mobile-top-bar    .sp-pop__body,
  .sp-pop--mobile-bottom-bar .sp-pop__disclaimer,
  .sp-pop--mobile-top-bar    .sp-pop__disclaimer { display: none !important; }

  .sp-pop--mobile-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .sp-pop--mobile-slide-corner {
    width: 92% !important;
    margin: 12px !important;
    border-radius: 12px !important;
  }

  .sp-pop--mobile-hero {
    width: 100% !important;
    aspect-ratio: 9/16;
    min-height: 0 !important;
    background-image: var(--sp-img-url) !important;
    background-size: var(--sp-img-fit-mob, var(--sp-img-fit-tab, var(--sp-img-fit, cover))) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    border-radius: 12px !important;
  }
  .sp-pop--mobile-hero > .sp-pop__img,
  .sp-pop--mobile-hero > .sp-pop__img-top,
  .sp-pop--mobile-hero > picture { display: none !important; }
  .sp-pop--mobile-hero .sp-pop__content {
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.55) 50%, rgba(0,0,0,0.85) 100%) !important;
    text-align: center !important;
    padding: 60px 28px 32px !important;
  }
  /* Default to white on the dark gradient if user didn't override; user
     overrides via Typography color cascade through the var chain. */
  .sp-pop--mobile-hero .sp-pop__headline   { color: var(--h-color-mob, var(--h-color-tab, var(--h-color, #fff))) !important; }
  .sp-pop--mobile-hero .sp-pop__subhead    { color: var(--s-color-mob, var(--s-color-tab, var(--s-color, #fff))) !important; }
  .sp-pop--mobile-hero .sp-pop__body       { color: var(--b-color-mob, var(--b-color-tab, var(--b-color, #fff))) !important; }
  .sp-pop--mobile-hero .sp-pop__disclaimer { color: #fff !important; }

  /* Mobile-layout overrides also reposition the overlay so the box ends up
     in the right place regardless of where popup.js initially anchored it. */
  .sp-overlay:has(.sp-pop--mobile-bottom-bar)   { align-items: flex-end !important; padding: 0 !important; }
  .sp-overlay:has(.sp-pop--mobile-top-bar)      { align-items: flex-start !important; padding: 0 !important; }
  .sp-overlay:has(.sp-pop--mobile-fullscreen)   { align-items: stretch !important; justify-content: stretch !important; padding: 0 !important; background: rgba(0,0,0,0.85) !important; }
  .sp-overlay:has(.sp-pop--mobile-slide-corner) { align-items: flex-end !important; justify-content: flex-end !important; padding: 12px !important; }

  .sp-pop--no-img-mob .sp-pop__img,
  .sp-pop--no-img-mob .sp-pop__img-top,
  .sp-pop--no-img-mob .sp-pop__bg { display: none !important; }

  .sp-form__row { flex-direction: column !important; }
  .sp-form__btn { width: 100% !important; }
}

.sp-pop[data-popup-anim="fade"]        { animation: sp-fade .35s ease forwards; }
.sp-pop[data-popup-anim="fade-up"]     { animation: sp-fade-up .35s ease forwards; }
.sp-pop[data-popup-anim="fade-down"]   { animation: sp-fade-down .35s ease forwards; }
.sp-pop[data-popup-anim="scale"]       { animation: sp-scale .25s ease forwards; }
.sp-pop[data-popup-anim="slide-up"]    { animation: sp-slide-up .35s ease forwards; }
.sp-pop[data-popup-anim="slide-down"]  { animation: sp-slide-down .35s ease forwards; }
.sp-pop[data-popup-anim="slide-left"]  { animation: sp-slide-left .35s ease forwards; }
.sp-pop[data-popup-anim="slide-right"] { animation: sp-slide-right .35s ease forwards; }
.sp-pop[data-popup-anim="bounce"]      { animation: sp-bounce .5s cubic-bezier(0.5,1.5,0.5,1) forwards; }

@keyframes sp-fade        { from { opacity: 0 } to { opacity: 1 } }
@keyframes sp-fade-up     { from { opacity: 0; transform: translateY(20px) } to { opacity: 1; transform: none } }
@keyframes sp-fade-down   { from { opacity: 0; transform: translateY(-20px) } to { opacity: 1; transform: none } }
@keyframes sp-scale       { from { opacity: 0; transform: scale(0.92) } to { opacity: 1; transform: scale(1) } }
@keyframes sp-slide-up    { from { transform: translateY(100%) } to { transform: none } }
@keyframes sp-slide-down  { from { transform: translateY(-100%) } to { transform: none } }
@keyframes sp-slide-left  { from { opacity: 0; transform: translateX(-30px) } to { opacity: 1; transform: none } }
@keyframes sp-slide-right { from { opacity: 0; transform: translateX(30px) } to { opacity: 1; transform: none } }
@keyframes sp-bounce      { 0% { opacity: 0; transform: scale(0.7) } 60% { transform: scale(1.05) } 100% { opacity: 1; transform: scale(1) } }
@keyframes sp-pulse       { 0% { opacity: 1 } 50% { opacity: 0.3 } 100% { opacity: 1 } }
