/*
 * Promo popup.
 *
 * Colours, width and artwork are injected as custom properties on .ken-popup
 * by template-parts/components/promo-popup.php, so this file never hard codes
 * a brand value.
 */

.ken-popup {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ken-popup[hidden] {
  /* display:flex above would otherwise beat the UA rule for [hidden]. */
  display: none;
}

.ken-popup.is-open {
  opacity: 1;
  visibility: visible;
}

.ken-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.ken-popup__dialog {
  position: relative;
  width: 100%;
  max-width: var(--popup-width, 520px);
  max-height: calc(100vh - 2rem);
  /*
   * The dialog clips but never scrolls. The close button is positioned against
   * it, and a scrolling dialog would carry it up with the copy. The scrolling
   * lives on __scroll below.
   */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--popup-bg, #fff);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

/*
 * Artwork. Painted on the dialog's own box, so it always covers exactly the
 * dialog and nothing else -- no element to be knocked out of place by the
 * scroll container, the flex column or the stacking order.
 *
 * background-attachment stays at its default: on a box that does not scroll,
 * that pins the picture to the border box while the card scrolls over it.
 */
.ken-popup__dialog.has-artwork {
  background-image: var(--popup-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.ken-popup__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #1a1a1a;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ken-popup__close:hover,
.ken-popup__close:focus-visible {
  background: rgba(0, 0, 0, 0.08);
}

/* The scroller sits above the artwork and takes whatever height is left. */
.ken-popup__scroll {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ken-popup__card {
  position: relative;
  z-index: 1;
  margin: 3.75rem 1.5rem;
  padding: 1.75rem;
  border-radius: 6px;
  background: var(--popup-card-bg, #0b2239);
  color: var(--popup-text, #fff);
}

.ken-popup__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.ken-popup__icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--popup-accent, #3ddc97);
  color: var(--popup-accent, #3ddc97);
  font-size: 0.9rem;
}

.ken-popup__eyebrow-text {
  color: var(--popup-accent, #3ddc97);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ken-popup__title {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--popup-text, #fff);
}

.ken-popup__text {
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--popup-accent, #3ddc97);
}

.ken-popup__text p:last-child {
  margin-bottom: 0;
}

.ken-popup__text strong {
  color: var(--popup-text, #fff);
}

.ken-popup__text a {
  color: var(--popup-text, #fff);
  text-decoration: underline;
}

.ken-popup__offer {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1rem;
  border-radius: 6px;
  background: var(--popup-offer-bg, #22b455);
  color: #fff;
  text-align: center;
}

.ken-popup__offer-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.95;
}

.ken-popup__offer-value {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.ken-popup__offer-note {
  font-size: 0.82rem;
}

.ken-popup__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  border-radius: 4px;
  background: var(--popup-btn-bg, #22b455);
  color: var(--popup-btn-text, #fff);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.ken-popup__btn:hover,
.ken-popup__btn:focus-visible {
  color: var(--popup-btn-text, #fff);
  filter: brightness(0.92);
  transform: translateY(-1px);
}

@media (max-width: 575.98px) {
  .ken-popup__card {
    margin: 3.25rem 1rem 1.25rem;
    padding: 1.35rem;
  }

  .ken-popup__title {
    font-size: 1.15rem;
  }

  .ken-popup__offer-value {
    font-size: 1.5rem;
  }

  .ken-popup__btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ken-popup,
  .ken-popup__dialog,
  .ken-popup__btn {
    transition: none;
  }
}
