/* First-visit promo banner — fills viewport on phone / tablet / desktop, no side gutters */

body.promo-banner-open {
  overflow: hidden;
}

.promo-banner {
  --promo-pad: max(0.35rem, env(safe-area-inset-top, 0px), env(safe-area-inset-left, 0px));
  --promo-pad-x: max(0.35rem, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --promo-pad-y: max(0.35rem, env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px));
  /* Space reserved for CTA bar under the square banner */
  --promo-actions: 5.1rem;
  --promo-max: 920px;

  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--promo-pad-y) var(--promo-pad-x);
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.promo-banner.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.promo-banner__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0, 61, 163, 0.55), transparent 70%),
    rgba(0, 18, 55, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/*
  Square banner (1:1): size the dialog to the largest square that fits
  beside the CTA bar — image is always width:100% so no left/right empty space.
*/
.promo-banner__dialog {
  position: relative;
  z-index: 1;
  /* Largest square that fits beside the CTA — image is width:100%, no side gaps */
  width: min(
    100%,
    var(--promo-max),
    calc(100vw - (var(--promo-pad-x) * 2)),
    calc(100vh - var(--promo-actions) - (var(--promo-pad-y) * 2))
  );
  max-height: calc(100vh - (var(--promo-pad-y) * 2));
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #001a4d;
  border: 2px solid rgba(252, 208, 6, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 24px 64px rgba(0, 12, 40, 0.55),
    0 0 40px rgba(252, 208, 6, 0.12);
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

@supports (height: 100svh) {
  .promo-banner__dialog {
    width: min(
      100%,
      var(--promo-max),
      calc(100vw - (var(--promo-pad-x) * 2)),
      calc(100svh - var(--promo-actions) - (var(--promo-pad-y) * 2))
    );
    max-height: calc(100svh - (var(--promo-pad-y) * 2));
  }
}

.promo-banner.open .promo-banner__dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.promo-banner__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 3;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  color: #001a4d;
  background: #fcd006;
  box-shadow: 0 4px 14px rgba(0, 20, 60, 0.35);
  transition: transform 0.2s ease, background 0.2s ease;
}

.promo-banner__close:hover {
  transform: scale(1.06);
  background: #ffe566;
}

.promo-banner__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.promo-banner__media {
  display: block;
  width: 100%;
  line-height: 0;
  flex: 0 0 auto;
  background: #001a4d;
}

.promo-banner__img {
  display: block;
  width: 100%;
  height: auto;
}

.promo-banner__actions {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.7rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(180deg, #002b7f 0%, #001a4d 100%);
  border-top: 1px solid rgba(252, 208, 6, 0.25);
}

.promo-banner__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.85rem;
  padding: 0.65rem 1rem;
  border-radius: 11px;
  border: 0;
  text-decoration: none;
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(0.88rem, 2.8vw, 1.05rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #001a4d;
  background: linear-gradient(180deg, #ffe566 0%, #fcd006 55%, #e6b800 100%);
  box-shadow:
    0 2px 0 #c9a000,
    0 8px 22px rgba(252, 208, 6, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.promo-banner__cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow:
    0 3px 0 #c9a000,
    0 12px 28px rgba(252, 208, 6, 0.45);
  color: #001a4d;
}

.promo-banner__cta:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.promo-banner__cta-arrow {
  display: inline-flex;
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
}

.promo-banner__cta-arrow svg {
  width: 100%;
  height: 100%;
}

.promo-banner__hint {
  margin: 0;
  font-family: Manrope, system-ui, sans-serif;
  font-size: clamp(0.7rem, 2.2vw, 0.78rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.01em;
  text-align: center;
}

/* Short landscape phones / small height: compact CTA, drop hint */
@media (max-height: 560px) {
  .promo-banner {
    --promo-actions: 3.6rem;
  }

  .promo-banner__hint {
    display: none;
  }

  .promo-banner__actions {
    padding: 0.4rem 0.55rem 0.5rem;
  }

  .promo-banner__cta {
    min-height: 2.5rem;
    padding: 0.5rem 0.85rem;
  }
}

/* Very narrow phones */
@media (max-width: 380px) {
  .promo-banner {
    --promo-actions: 4.6rem;
  }

  .promo-banner__dialog {
    border-radius: 10px;
  }

  .promo-banner__close {
    top: 0.35rem;
    right: 0.35rem;
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
  }
}

/* Large desktop monitors — keep banner readable, not tiny in the middle */
@media (min-width: 1100px) and (min-height: 900px) {
  .promo-banner {
    --promo-max: 980px;
    --promo-actions: 5.4rem;
  }

  .promo-banner__cta {
    min-height: 3.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .promo-banner,
  .promo-banner__dialog,
  .promo-banner__cta,
  .promo-banner__close {
    transition: none;
  }

  .promo-banner.open .promo-banner__dialog {
    transform: none;
  }
}
