/*
 * Solutek – Popups (front). BEM under .stk-popup, no Bootstrap dependency (Classic = BS4, Hummingbird = BS5),
 * theme font and colours inherited unless the merchant sets popup colours (custom properties, inline).
 *
 * @author    Solutek
 * @copyright Solutek
 * @license   Proprietary
 */
.stk-popup {
  --stk-popup-width: 560px;
  --stk-popup-gap: 1rem;
  --stk-popup-radius: 12px;
  position: fixed;
  inset: 0;
  z-index: var(--stk-popup-z, 1050);
  box-sizing: border-box;
  width: calc(100% - 2 * var(--stk-popup-gap));
  max-width: var(--stk-popup-width);
  max-height: calc(100% - 2 * var(--stk-popup-gap));
  height: fit-content;
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--stk-popup-text, inherit);
  font: inherit;
  background: var(--stk-popup-bg, #fff);
  border: 0;
  border-radius: var(--stk-popup-radius);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25), 0 2px 8px rgba(15, 23, 42, 0.12);
}
.stk-popup:not([open]) { display: none; }
.stk-popup *,
.stk-popup *::before,
.stk-popup *::after { box-sizing: border-box; }

.stk-popup::backdrop { background: rgba(15, 23, 42, 0.55); }
.stk-popup--no-overlay::backdrop { background: transparent; }

html.stk-popup-lock { overflow: hidden; }

/* ---- Box ---------------------------------------------------------- */
.stk-popup__box { position: relative; }

.stk-popup__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 1.75rem;
  line-height: 1;
  color: inherit;
  background: rgba(255, 255, 255, 0.85);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.stk-popup__close:hover { background: #fff; }
.stk-popup__close:focus-visible,
.stk-popup__cta:focus-visible,
.stk-popup__submit:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.stk-popup__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #0F4C81;
  border-radius: 999px;
}

.stk-popup__media { display: block; }
.stk-popup__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 45vh;
  object-fit: cover;
  border-radius: var(--stk-popup-radius) var(--stk-popup-radius) 0 0;
}

.stk-popup__body { padding: 1.5rem; }
.stk-popup__title {
  margin: 0 2.5rem 0.75rem 0;
  font-size: 1.5rem;
  line-height: 1.25;
  color: inherit;
}
.stk-popup__media + .stk-popup__body .stk-popup__title { margin-right: 0; }
.stk-popup__content > :first-child { margin-top: 0; }
.stk-popup__content > :last-child { margin-bottom: 0; }
.stk-popup__content img { max-width: 100%; height: auto; }

.stk-popup__actions { margin: 1.25rem 0 0; }
/* Button colours only when the merchant set them; otherwise the theme's .btn-primary applies. */
.stk-popup[style*="--stk-popup-cta-bg"] .stk-popup__cta,
.stk-popup[style*="--stk-popup-cta-bg"] .stk-popup__submit {
  background-color: var(--stk-popup-cta-bg);
  border-color: var(--stk-popup-cta-bg);
}
.stk-popup[style*="--stk-popup-cta-text"] .stk-popup__cta,
.stk-popup[style*="--stk-popup-cta-text"] .stk-popup__submit {
  color: var(--stk-popup-cta-text);
}
.stk-popup__cta:hover,
.stk-popup__submit:hover { filter: brightness(0.92); }

/* ---- Newsletter --------------------------------------------------- */
.stk-popup__form { margin: 1.25rem 0 0; }
.stk-popup__label {
  text-align: left; /* Classic right-aligns labels */
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.stk-popup__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.stk-popup__input {
  flex: 1 1 14rem;
  min-width: 0;
  width: auto;
}
.stk-popup__submit { flex: 0 0 auto; }
.stk-popup__gdpr {
  text-align: left;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  font-weight: normal;
  line-height: 1.4;
}
.stk-popup__gdpr input { flex: 0 0 auto; margin-top: 0.2rem; }
.stk-popup__gdpr p { margin: 0; }
.stk-popup__msg { margin: 0.75rem 0 0; font-weight: 600; }
.stk-popup__msg--error { color: #b91c1c; }
.stk-popup__msg--success { color: #047857; }
.stk-popup [hidden] { display: none !important; } /* theme display rules would otherwise win (standards §10) */
.stk-popup__hp {
  position: absolute !important; /* honeypot: off-screen, never displayed */
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Layouts ------------------------------------------------------ */
.stk-popup--slidein {
  inset: auto var(--stk-popup-gap) calc(var(--stk-popup-gap) + env(safe-area-inset-bottom, 0px)) auto;
  max-width: min(var(--stk-popup-width), 400px);
  margin: 0;
}
.stk-popup--slidein.stk-popup--bottom-left { inset: auto auto calc(var(--stk-popup-gap) + env(safe-area-inset-bottom, 0px)) var(--stk-popup-gap); }
.stk-popup--slidein.stk-popup--top-right { inset: var(--stk-popup-gap) var(--stk-popup-gap) auto auto; }
.stk-popup--slidein.stk-popup--top-left { inset: var(--stk-popup-gap) auto auto var(--stk-popup-gap); }
.stk-popup--slidein .stk-popup__title { font-size: 1.2rem; }
.stk-popup--slidein .stk-popup__body { padding: 1.25rem; }

.stk-popup--bar_top,
.stk-popup--bar_bottom {
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
}
/* Top bar = announcement bar in the page flow, above the header (front.js moves it to the top of <body>):
   it pushes the page down instead of covering the header, and scrolls away with the page. */
.stk-popup--bar_top {
  position: relative;
  inset: auto;
  z-index: auto;
  max-height: none;
  box-shadow: none;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.stk-popup--bar_bottom { inset: auto 0 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.stk-popup--bar_top .stk-popup__box,
.stk-popup--bar_bottom .stk-popup__box {
  display: flex;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding-right: 3rem;
}
.stk-popup--bar_top .stk-popup__media,
.stk-popup--bar_bottom .stk-popup__media { flex: 0 0 auto; display: none; }
.stk-popup--bar_top .stk-popup__body,
.stk-popup--bar_bottom .stk-popup__body {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  align-items: center;
  padding: 0.75rem 1rem;
}
.stk-popup--bar_top .stk-popup__title,
.stk-popup--bar_bottom .stk-popup__title { margin: 0; font-size: 1.05rem; }
.stk-popup--bar_top .stk-popup__actions,
.stk-popup--bar_bottom .stk-popup__actions,
.stk-popup--bar_top .stk-popup__form,
.stk-popup--bar_bottom .stk-popup__form { margin: 0; }
.stk-popup--bar_top .stk-popup__close,
.stk-popup--bar_bottom .stk-popup__close {
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
}
.stk-popup--bar_top .stk-popup__badge,
.stk-popup--bar_bottom .stk-popup__badge { position: static; margin-left: 1rem; }

.stk-popup--fullscreen {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border-radius: 0;
}
.stk-popup--fullscreen .stk-popup__box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  max-width: var(--stk-popup-width);
  margin: 0 auto;
}
.stk-popup--fullscreen .stk-popup__img { border-radius: var(--stk-popup-radius); }

@media (min-width: 768px) {
  .stk-popup__body { padding: 2rem; }
  .stk-popup--bar_top .stk-popup__media,
  .stk-popup--bar_bottom .stk-popup__media { display: block; }
  .stk-popup--bar_top .stk-popup__img,
  .stk-popup--bar_bottom .stk-popup__img {
    width: auto;
    height: 3.5rem;
    margin-left: 1rem;
    border-radius: 6px;
  }
}

@media (max-width: 575.98px) {
  /* Compact bars on phones: title and button share one line when they fit. */
  .stk-popup--bar_top .stk-popup__box,
  .stk-popup--bar_bottom .stk-popup__box { padding-right: 2.75rem; }
  .stk-popup--bar_top .stk-popup__body,
  .stk-popup--bar_bottom .stk-popup__body { gap: 0.4rem 0.75rem; padding: 0.5rem 0.75rem; }
  .stk-popup--bar_top .stk-popup__title,
  .stk-popup--bar_bottom .stk-popup__title { font-size: 0.95rem; }
  /* Without a form: the text wraps next to the button instead of pushing it to a second row. */
  .stk-popup--bar_top .stk-popup__body:not(:has(form)),
  .stk-popup--bar_bottom .stk-popup__body:not(:has(form)) { flex-wrap: nowrap; }
  .stk-popup--bar_top .stk-popup__body:not(:has(form)) > :not(.stk-popup__actions),
  .stk-popup--bar_bottom .stk-popup__body:not(:has(form)) > :not(.stk-popup__actions) { flex: 1 1 auto; min-width: 0; }
  .stk-popup--bar_top .stk-popup__actions,
  .stk-popup--bar_bottom .stk-popup__actions { flex: 0 0 auto; }
  .stk-popup--bar_top .stk-popup__cta,
  .stk-popup--bar_bottom .stk-popup__cta { padding: 0.3rem 0.75rem; font-size: 0.875rem; }
  .stk-popup--bar_top .stk-popup__content,
  .stk-popup--bar_bottom .stk-popup__content { font-size: 0.875rem; }
  .stk-popup--slidein,
  .stk-popup--slidein.stk-popup--bottom-left {
    inset: auto 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) 0.75rem;
    width: auto;
    max-width: none;
  }
  .stk-popup--slidein.stk-popup--top-right,
  .stk-popup--slidein.stk-popup--top-left {
    inset: 0.75rem 0.75rem auto 0.75rem;
    width: auto;
    max-width: none;
  }
  .stk-popup__title { font-size: 1.25rem; }
}

/* ---- Animations --------------------------------------------------- */
.stk-popup--anim-fade[open] { animation: stk-popup-fade 0.25s ease-out; }
.stk-popup--anim-zoom[open] { animation: stk-popup-zoom 0.25s ease-out; }
.stk-popup--anim-slide[open] { animation: stk-popup-slide-up 0.3s ease-out; }
.stk-popup--anim-slide.stk-popup--top-right[open],
.stk-popup--anim-slide.stk-popup--top-left[open] { animation-name: stk-popup-slide-down; }
.stk-popup[open]::backdrop { animation: stk-popup-fade 0.25s ease-out; }

@keyframes stk-popup-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes stk-popup-zoom { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes stk-popup-slide-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
/* In-flow top bar: grows from 0 height whatever the animation, so the page slides down instead of jumping. */
.stk-popup--bar_top[open] { animation: stk-popup-reveal 0.35s ease-out; }
.stk-popup--bar_top.stk-popup--anim-none[open] { animation: none; }
@keyframes stk-popup-reveal { from { max-height: 0; opacity: 0; } to { max-height: 12rem; opacity: 1; } }

/* Bottom bar and bottom slide-ins step aside while the footer is on screen (front.js toggles .is-tucked). */
.stk-popup--bar_bottom,
.stk-popup--slidein.stk-popup--bottom-right,
.stk-popup--slidein.stk-popup--bottom-left {
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0s;
}
.stk-popup.is-tucked {
  transform: translateY(calc(100% + 2rem));
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s;
}

@keyframes stk-popup-slide-down { from { opacity: 0; transform: translateY(-24px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .stk-popup[open],
  .stk-popup[open]::backdrop { animation: none !important; } /* user preference beats the merchant setting */
  .stk-popup,
  .stk-popup.is-tucked { transition: none !important; }
}
