/* ------------------------------------------------------------------------
   Xmas-Pop-up „Champagner Abo verschenken" — Trello #2807
   Figma „Pop-up XMAS B Desktop" (card 960×560) / „Pop-up XMAS B Mobil"
   (card 343×679). Loaded only on pages that render the pop-up
   (ew_template.php → ew_xmas_popup_render()).

   Scaling. Peter's background images already contain the photo, the stars and
   the copper dots, so heading, text, button, × position and hint have to stay
   locked to the photo. The card therefore keeps the Figma aspect ratio and
   every length is written in Figma pixels × --u (= card width / Figma width):
   at full size --u is 1px, on a smaller screen everything shrinks together.
   The card is as wide as the Figma frame, but never wider than the viewport
   minus a margin and never taller than the viewport (short laptop screens,
   phones with browser bars) — then it shrinks instead of scrolling.

   Figma trims the text boxes to cap height / baseline (text-box-trim), which
   not every browser supports. Poppins has ascent 1.05em, descent .35em and a
   cap height of .698em, so a line box of line-height L carries (L/2 − .35)em
   above the caps and below the baseline: .4em at 1.5, .3em at 1.3, .425em at
   1.55. The margins/paddings below subtract exactly that, which puts every
   text where Figma has it.

   Tokens: the start page's sp-* custom properties are scoped to .sp-home, so
   the button's .sp-btn / .sp-btn--primary get the same values here.
   ------------------------------------------------------------------------ */

.xmas-popup {
  --sp-text-primary: #363636;
  --sp-text-inverse: #ffffff;
  --sp-accent-primary: #FF6969;
  --sp-accent-primary-hover: #ff4d4d;
  --sp-radius-lg: 30px;
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: none;
  align-items: center;
  justify-content: center;
}

.xmas-popup.is-visible {
  display: flex;
}

/* Figma „Abdunklung Seite": #141414 at 45 % (= .newsletter-modal-overlay). */
.xmas-popup__dim {
  position: absolute;
  inset: 0;
  background-color: rgba(20, 20, 20, 0.45);
}

.xmas-popup__card {
  --w: min(960px, calc(100vw - 40px), calc((100vh - 40px) * 960 / 560));
  --u: calc(var(--w) / 960);
  position: relative;
  width: var(--w);
  aspect-ratio: 960 / 560;
  overflow: hidden;
  border-radius: calc(24 * var(--u));
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.22);
  background-color: #8a8987;
  font-family: "Poppins", sans-serif;
}

@supports (height: 100dvh) {
  .xmas-popup__card {
    --w: min(960px, calc(100vw - 40px), calc((100dvh - 40px) * 960 / 560));
  }
}

/* The picture covers the card 1:1 on desktop (1920×1120 = 2×). On phones the
   picture is 343×684 for a 679 card: Peter's frame is bottom-aligned (RMSE
   against the Figma render: best match with the top 5px cut off). */
.xmas-popup__img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

/* Bettina 19.11.: „zusätzlich zum Button auch das Bild verlinken". The picture
   fills the card, so its link does too. Heading, line and hint let clicks
   through to it (pointer-events: none); button and × sit above. */
.xmas-popup__link {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  cursor: pointer;
}

/* ---- Desktop (Figma 6963:19618) -------------------------------------- */

.xmas-popup__content {
  position: absolute;
  left: calc(58 * var(--u));
  top: calc(259 * var(--u));
  width: calc(476 * var(--u));
  box-sizing: border-box;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
}

.xmas-popup .xmas-popup__heading {
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
  font-size: calc(52 * var(--u));
  /* style.css sets h1/h2/h3 { font-weight: 400 !important } site-wide;
     Figma's H2 is Poppins Light. */
  font-weight: 300 !important;
  line-height: 1.2;
  letter-spacing: calc(-1 * var(--u));
  white-space: nowrap;
  text-transform: none;
  color: #ffffff;
}

/* 18 below the heading, trimmed (.4em at line-height 1.5). */
.xmas-popup .xmas-popup__lead {
  margin: calc(18 * var(--u) - 0.4em) 0 -0.4em;
  padding: 0;
  font-size: calc(20 * var(--u));
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: nowrap;
  color: #ffffff;
}

.xmas-popup__br-m {
  display: none;
}

/* Figma button: padding 18/35, label 18px SemiBold, trimmed (.3em at 1.3). */
.xmas-popup .xmas-popup__btn {
  margin-top: calc(30 * var(--u));
  padding: calc(18 * var(--u) - 0.3em) calc(35 * var(--u));
  font-family: "Poppins", sans-serif;
  font-size: calc(18 * var(--u));
  line-height: 1.3;
  text-decoration: none;
  pointer-events: auto;
}

.xmas-popup .xmas-popup__btn:hover,
.xmas-popup .xmas-popup__btn:focus {
  text-decoration: none;
}

/* 44×44 like the Figma × frame; the tap target does not shrink with the card. */
.xmas-popup__close {
  position: absolute;
  top: calc(14 * var(--u));
  right: calc(14 * var(--u));
  z-index: 3;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.xmas-popup__close:hover {
  opacity: 0.6;
}

.xmas-popup__close img {
  display: block;
}

/* Right edge at x 927, cap top at y 526; 12px Regular, trimmed (.425em). */
.xmas-popup .xmas-popup__note {
  position: absolute;
  right: calc(33 * var(--u));
  top: calc(526 * var(--u) - 0.425em);
  z-index: 2;
  margin: 0;
  pointer-events: none;
  font-size: calc(12 * var(--u));
  font-weight: 400;
  line-height: 1.55;
  white-space: nowrap;
  text-align: right;
  color: #ffffff;
}

/* ---- Phone (Figma 6955:15342) ---------------------------------------- */

@media (max-width: 767.98px) {
  /* Figma „Abdunklung Seite" (Mobil): #141414 at 50 %. */
  .xmas-popup__dim {
    background-color: rgba(20, 20, 20, 0.5);
  }

  .xmas-popup__card {
    --w: min(343px, calc(100vw - 32px), calc((100vh - 32px) * 343 / 679));
    --u: calc(var(--w) / 343);
    aspect-ratio: 343 / 679;
    background-color: #d0cfd0;
  }

  @supports (height: 100dvh) {
    .xmas-popup__card {
      --w: min(343px, calc(100vw - 32px), calc((100dvh - 32px) * 343 / 679));
    }
  }

  /* Inhalt: padding 65 top / 24 sides, centred; Kopf gap 12, Aktion gap 20. */
  .xmas-popup__content {
    left: 0;
    top: 0;
    width: 100%;
    padding: calc(65 * var(--u)) calc(24 * var(--u)) 0;
    align-items: center;
    text-align: center;
  }

  .xmas-popup .xmas-popup__heading {
    font-size: calc(32 * var(--u));
    color: #363636;
  }

  .xmas-popup .xmas-popup__lead {
    margin-top: calc(12 * var(--u) - 0.4em);
    font-size: calc(16 * var(--u));
    color: #363636;
  }

  .xmas-popup__br-m {
    display: inline;
  }

  .xmas-popup .xmas-popup__btn {
    margin-top: calc(20 * var(--u));
    font-size: calc(16 * var(--u));
  }

  /* 11px, right edge at x 298 (box 46–298, text right-aligned), cap top 648. */
  .xmas-popup .xmas-popup__note {
    right: calc(45 * var(--u));
    top: calc(648 * var(--u) - 0.425em);
    font-size: calc(11 * var(--u));
  }
}
