/* ==========================================================================
   PROMO POPUP (v1.0)
   Event / campaign popup that opens at 10% page scroll (how often: CONFIG.remember in promo-popup.js). Self-contained: works on any page of the
   site with only this file and promo-popup.js (no Bootstrap, GSAP or Lenis needed). All text, links, dates and the
   image are set in the CONFIG block at the top of promo-popup.js.
   Desktop / tablet: centred card, image left, content right. Phones (<= 640px): bottom sheet, image on top.
   ========================================================================== */

.ifs-promo {
  --ifsp-orange: #F67214;
  --ifsp-orange-hover: #E05F03;
  --ifsp-navy: #0B1120;
  --ifsp-navy-2: #111A2E;
  --ifsp-text: #F8FAFC;
  --ifsp-muted: #94A3B8;
  --ifsp-line: rgba(255, 255, 255, 0.09);
  --ifsp-ease: cubic-bezier(0.16, 1, 0.3, 1);

  position: fixed;
  inset: 0;
  z-index: 99000; /* above the header and the Try card, below the Book a Demo popup (100000) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  visibility: hidden;
  pointer-events: none;
}

.ifs-promo.is-open {
  visibility: visible;
  pointer-events: auto;
}

.ifs-promo *,
.ifs-promo *::before,
.ifs-promo *::after {
  box-sizing: border-box;
}

/* ---------- backdrop ---------- */
.ifs-promo__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 18, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.45s var(--ifsp-ease);
}

.ifs-promo.is-open .ifs-promo__backdrop {
  opacity: 1;
}

/* ---------- card ---------- */
.ifs-promo__card {
  position: relative;
  display: grid;
  grid-template-columns: 44% 56%;
  width: min(900px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: 24px;
  color: var(--ifsp-text);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(246, 114, 20, 0.20) 0%, rgba(246, 114, 20, 0) 55%),
    linear-gradient(160deg, var(--ifsp-navy-2) 0%, var(--ifsp-navy) 70%);
  border: 1px solid var(--ifsp-line);
  box-shadow:
    0 40px 100px -24px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateY(24px) scale(0.965);
  transition: opacity 0.5s var(--ifsp-ease), transform 0.6s var(--ifsp-ease);
}

.ifs-promo.is-open .ifs-promo__card {
  opacity: 1;
  transform: none;
}

/* faint blueprint grid behind the content */
.ifs-promo__card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(90% 80% at 80% 20%, #000 0%, transparent 75%);
  mask-image: radial-gradient(90% 80% at 80% 20%, #000 0%, transparent 75%);
}

/* ---------- media (left) ---------- */
.ifs-promo__media {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: #070B14;
}

.ifs-promo__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  transition: transform 1.4s var(--ifsp-ease);
}

.ifs-promo.is-open .ifs-promo__media img {
  transform: scale(1);
}

/* Faded merge: the photo itself fades out (mask) on its right edge and the navy card shows through, so photo and
   content read as one surface with no seam. */
.ifs-promo__media:not(.ifs-promo__media--fallback) {
  background: transparent;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 58%, rgba(0, 0, 0, 0.78) 71%, rgba(0, 0, 0, 0.45) 83%, rgba(0, 0, 0, 0.15) 93%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 58%, rgba(0, 0, 0, 0.78) 71%, rgba(0, 0, 0, 0.45) 83%, rgba(0, 0, 0, 0.15) 93%, transparent 100%);
}

/* soft shade in the bottom-left corner keeps the booth number readable */
.ifs-promo__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(85% 55% at 0% 100%, rgba(6, 9, 18, 0.7) 0%, rgba(6, 9, 18, 0.35) 45%, rgba(6, 9, 18, 0) 78%),
    linear-gradient(0deg, rgba(6, 9, 18, 0.4) 0%, rgba(6, 9, 18, 0) 30%);
}

/* No image set: a branded panel instead (orange glow, grid, big booth number) */
.ifs-promo__media--fallback {
  display: flex;
  align-items: flex-end;
  padding: 32px;
  background:
    radial-gradient(80% 70% at 20% 10%, rgba(246, 114, 20, 0.55) 0%, rgba(246, 114, 20, 0) 60%),
    linear-gradient(200deg, #1A2338 0%, #070B14 100%);
}

.ifs-promo__media--fallback::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}

.ifs-promo__fallback-mark {
  position: relative;
  z-index: 1;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(64px, 9vw, 104px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.55);
}

.ifs-promo__fallback-mark small {
  display: block;
  margin-bottom: 10px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  -webkit-text-stroke: 0;
}

/* on the photo: pinned bottom-left, above the darkening overlay */
.ifs-promo__media:not(.ifs-promo__media--fallback) .ifs-promo__fallback-mark {
  position: absolute;
  left: 32px;
  bottom: 28px;
  z-index: 2;
  -webkit-text-stroke-color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.ifs-promo__media:not(.ifs-promo__media--fallback) .ifs-promo__fallback-mark small {
  color: rgba(255, 255, 255, 0.85);
}

/* ---------- content (right) ---------- */
.ifs-promo__card:focus {
  outline: none;
}

.ifs-promo__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center; /* equal space above and below the content */
  padding: 44px 48px 40px 32px; /* less on the left (next to the photo), room for the close button on the right */
  overflow-y: auto;
}

/* children rise in one after another */
.ifs-promo__body > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ifsp-ease), transform 0.6s var(--ifsp-ease);
}

.ifs-promo.is-open .ifs-promo__body > * {
  opacity: 1;
  transform: none;
}

.ifs-promo.is-open .ifs-promo__body > :nth-child(1) { transition-delay: 0.12s; }
.ifs-promo.is-open .ifs-promo__body > :nth-child(2) { transition-delay: 0.18s; }
.ifs-promo.is-open .ifs-promo__body > :nth-child(3) { transition-delay: 0.24s; }
.ifs-promo.is-open .ifs-promo__body > :nth-child(4) { transition-delay: 0.30s; }
.ifs-promo.is-open .ifs-promo__body > :nth-child(5) { transition-delay: 0.36s; }

/* event logo (or the event name as text when no logo is set) */
.ifs-promo__logo {
  display: block;
  align-self: flex-start;
  width: auto;
  height: 56px;
  max-width: calc(100% - 48px); /* clear of the close button */
  margin: 0 0 8px;
  object-fit: contain;
  object-position: left center;
}

.ifs-promo__event {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ifsp-muted);
}

/* Two deliberate lines: "Meet iFieldSmart AI" / "in Orlando" - the small word "in" is light and muted so the eye
   goes from the brand name straight to the orange place name. */
.ifs-promo__title {
  margin: 12px 0 0;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: clamp(32px, 3.8vw, 44px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ifsp-text);
  text-wrap: balance;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

.ifs-promo__title small {
  font-size: inherit;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: rgba(248, 250, 252, 0.62);
}

.ifs-promo__title em {
  font-style: normal;
  font-weight: 800;
  color: var(--ifsp-orange);
}

.ifs-promo__text {
  margin: 14px 0 0;
  max-width: 42ch;
  font-size: 15px;
  line-height: 1.6;
  color: #CBD5E1;
}

/* date + booth tiles */
.ifs-promo__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.ifs-promo__fact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--ifsp-line);
  background: rgba(255, 255, 255, 0.035);
}

.ifs-promo__fact-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(246, 114, 20, 0.14);
  color: var(--ifsp-orange);
}

.ifs-promo__fact-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ifsp-muted);
}

.ifs-promo__fact-value {
  display: block;
  margin-top: 2px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ifsp-text);
  white-space: nowrap;
}

.ifs-promo__fact--booth .ifs-promo__fact-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* buttons */
.ifs-promo__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 28px;
}

.ifs-promo__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 24px;
  border-radius: 12px;
  background: var(--ifsp-orange);
  box-shadow: 0 10px 28px -10px rgba(246, 114, 20, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  transition: transform 0.2s var(--ifsp-ease), box-shadow 0.2s, background 0.2s;
}

.ifs-promo__cta:hover {
  color: #fff;
  background: var(--ifsp-orange-hover);
  box-shadow: 0 14px 34px -10px rgba(246, 114, 20, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.ifs-promo__cta:active {
  transform: translateY(0) scale(0.98);
}

.ifs-promo__cta svg {
  transition: transform 0.2s var(--ifsp-ease);
}

.ifs-promo__cta:hover svg {
  transform: translateX(3px);
}

.ifs-promo__link {
  font-size: 14px;
  color: var(--ifsp-muted);
  text-decoration: none;
}

.ifs-promo__link span {
  color: var(--ifsp-text);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  transition: border-color 0.2s, color 0.2s;
}

.ifs-promo__link:hover span {
  color: var(--ifsp-orange);
  border-color: var(--ifsp-orange);
}

.ifs-promo__cta:focus-visible,
.ifs-promo__link:focus-visible,
.ifs-promo__close:focus-visible {
  outline: 2px solid var(--ifsp-orange);
  outline-offset: 3px;
}

/* close button */
.ifs-promo__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #E2E8F0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.3s var(--ifsp-ease);
}

.ifs-promo__close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: rotate(90deg);
}

/* drag handle: phones only */
.ifs-promo__grabber {
  display: none;
}

/* Keep the "Try it now" card (homepage, phones) out of the way while the popup is open */
html.ifs-promo-open .try-toast,
html.ifs-promo-open .try-tab {
  visibility: hidden !important;
}

html.ifs-promo-open,
html.ifs-promo-open body {
  overflow: hidden;
}

/* ---------- tablets ---------- */
@media (max-width: 860px) {
  .ifs-promo__card { grid-template-columns: 38% 62%; }
  .ifs-promo__body { padding: 40px 32px 32px 24px; }
  .ifs-promo__logo { height: 48px; }
}

/* ---------- phones: bottom sheet ---------- */
@media (max-width: 640px) {
  .ifs-promo {
    align-items: flex-end;
    padding: 0;
  }

  .ifs-promo__card {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
    opacity: 1;
    transform: translateY(100%);
    transition: transform 0.55s var(--ifsp-ease);
  }

  .ifs-promo.is-open .ifs-promo__card { transform: translateY(var(--ifsp-drag, 0px)); }
  .ifs-promo__card.is-dragging { transition: none; }

  .ifs-promo__media { height: 176px; min-height: 0; }

  /* phones: the photo strip dissolves downwards into the navy content */
  .ifs-promo__media:not(.ifs-promo__media--fallback) {
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 56%, rgba(0, 0, 0, 0.7) 74%, rgba(0, 0, 0, 0.3) 88%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 56%, rgba(0, 0, 0, 0.7) 74%, rgba(0, 0, 0, 0.3) 88%, transparent 100%);
  }

  .ifs-promo__media::after { display: none; }

  .ifs-promo__media--fallback { padding: 22px 24px; }
  .ifs-promo__fallback-mark { font-size: 64px; }

  /* phones: smaller, bottom-right of the photo strip (the bottom-left is covered by the content) */
  .ifs-promo__media:not(.ifs-promo__media--fallback) .ifs-promo__fallback-mark {
    left: auto;
    right: 20px;
    bottom: 40px;
    font-size: 44px;
    text-align: right;
  }

  .ifs-promo__media:not(.ifs-promo__media--fallback) .ifs-promo__fallback-mark small {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .ifs-promo__grabber {
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 3;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.55);
  }

  .ifs-promo__close {
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    background: rgba(6, 9, 18, 0.55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .ifs-promo__body {
    margin-top: -28px; /* content overlaps the bottom of the photo */
    padding: 0 20px calc(22px + env(safe-area-inset-bottom));
  }

  .ifs-promo__logo { height: 42px; margin-top: 16px; }
  .ifs-promo__title { font-size: 30px; }
  .ifs-promo__text { font-size: 14.5px; }
  .ifs-promo__facts { margin-top: 18px; }
  .ifs-promo__fact { padding: 10px 12px; gap: 10px; }
  .ifs-promo__fact-icon { width: 32px; height: 32px; }
  .ifs-promo__fact-value { font-size: 15px; }
  .ifs-promo__fact--booth .ifs-promo__fact-value { font-size: 19px; }

  .ifs-promo__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-top: 20px;
  }

  .ifs-promo__cta { width: 100%; }
  .ifs-promo__link { text-align: center; }
}

@media (max-width: 360px) {
  .ifs-promo__facts { grid-template-columns: 1fr; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ifs-promo__backdrop,
  .ifs-promo__card,
  .ifs-promo__media img,
  .ifs-promo__body > *,
  .ifs-promo__close,
  .ifs-promo__cta {
    transition: opacity 0.2s linear !important;
    transform: none !important;
  }
}
