/* ==========================================================================
   PROMO POPUP - ifieldsmart.com (v1.0, light theme)
   Event / campaign popup that opens at 10% page scroll (how often: CONFIG.remember in promo-popup.js).
   Self-contained: works on any page with only this file and promo-popup.js (no jQuery or Bootstrap needed).
   All text, links, dates and images are set in the CONFIG block at the top of promo-popup.js.
   Desktop / tablet: centred card, photo left, content right. Phones (<= 640px): bottom sheet, photo on top.
   Colours follow ifieldsmart.com: amber #F6B93B on white, warm charcoal text.
   ========================================================================== */

.ifs-promo {
  --ifsp-amber: #F6B93B;
  --ifsp-amber-hover: #EAA826;
  --ifsp-amber-deep: #B7791F; /* amber for icons and small text: readable on white */
  --ifsp-amber-soft: #FFF6E2;
  --ifsp-ink: #1C1917;
  --ifsp-body: #57534E;
  --ifsp-muted: #8A817A;
  --ifsp-line: #EEE7DA;
  --ifsp-ease: cubic-bezier(0.16, 1, 0.3, 1);

  position: fixed;
  inset: 0;
  z-index: 1000001; /* above the site's floating "Schedule a Meeting" / "Get a Quote" buttons (999999) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Outfit', 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(28, 25, 23, 0.42);
  -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-ink);
  background:
    radial-gradient(110% 80% at 100% 0%, rgba(246, 185, 59, 0.16) 0%, rgba(246, 185, 59, 0) 55%),
    linear-gradient(180deg, #FFFFFF 0%, #FFFBF2 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 40px 100px -28px rgba(28, 25, 23, 0.45),
    0 12px 30px -12px rgba(28, 25, 23, 0.18);
  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;
}

.ifs-promo__card:focus {
  outline: none;
}

/* faint grid behind the content */
.ifs-promo__card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(28, 25, 23, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 25, 23, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(90% 80% at 85% 15%, #000 0%, transparent 70%);
  mask-image: radial-gradient(90% 80% at 85% 15%, #000 0%, transparent 70%);
}

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

.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 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 50%, rgba(0, 0, 0, 0.6) 72%, rgba(0, 0, 0, 0.18) 90%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 50%, rgba(0, 0, 0, 0.6) 72%, rgba(0, 0, 0, 0.18) 90%, transparent 100%);
}

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

/* No image set: a branded amber panel instead */
.ifs-promo__media--fallback {
  display: flex;
  align-items: flex-end;
  padding: 32px;
  background:
    radial-gradient(80% 70% at 20% 10%, rgba(246, 185, 59, 0.75) 0%, rgba(246, 185, 59, 0) 65%),
    linear-gradient(200deg, #3A2F25 0%, #1C1917 100%);
}

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

/* big booth number: crisp white outline over a light frosted fill, on the dark corner shade */
.ifs-promo__mark {
  position: absolute;
  left: 30px;
  bottom: 26px;
  z-index: 2;
  font-weight: 700;
  font-size: clamp(64px, 9vw, 100px);
  line-height: 0.9;
  letter-spacing: -0.035em;
  color: rgba(255, 255, 255, 0.16);
  -webkit-text-stroke: 2px #FFFFFF;
  paint-order: stroke fill;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* "— BOOTH" label: amber dash + white caps */
.ifs-promo__mark small {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #FFFFFF;
  -webkit-text-stroke: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.ifs-promo__mark small::before {
  content: "";
  width: 22px;
  height: 3px;
  border-radius: 3px;
  background: var(--ifsp-amber);
  box-shadow: none;
}

/* ---------- content (right) ---------- */
.ifs-promo__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 44px 44px 36px;
  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". "in" is light and muted; "Orlando" gets an amber
   marker stroke behind it (amber text on white would be too pale to read). */
.ifs-promo__title {
  margin: 12px 0 0;
  font-size: clamp(32px, 3.8vw, 44px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.035em;
  color: var(--ifsp-ink);
  text-wrap: balance;
}

.ifs-promo__title small {
  font-size: inherit;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ifsp-muted);
}

.ifs-promo__title em {
  font-style: normal;
  padding: 0 0.06em;
  background: linear-gradient(180deg, transparent 60%, rgba(246, 185, 59, 0.6) 60%, rgba(246, 185, 59, 0.6) 92%, transparent 92%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Subheading: darker warm grey, a touch larger and more open; the lead sentence is bold in the headline colour */
.ifs-promo__text {
  margin: 16px 0 0;
  max-width: 44ch;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.62;
  letter-spacing: 0.002em;
  color: #44403C;
  text-wrap: pretty;
}

.ifs-promo__text strong {
  font-weight: 600;
  color: var(--ifsp-ink);
}

/* 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: #FFFFFF;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
}

.ifs-promo__fact-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ifsp-amber-soft);
  color: var(--ifsp-amber-deep);
}

.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-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ifsp-ink);
  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;
}

/* amber button with dark text (white on #F6B93B is too low-contrast to read) */
.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-amber);
  box-shadow: 0 10px 24px -10px rgba(214, 150, 20, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-size: 16px;
  font-weight: 600;
  color: var(--ifsp-ink);
  text-decoration: none;
  transition: transform 0.2s var(--ifsp-ease), box-shadow 0.2s, background 0.2s;
}

.ifs-promo__cta:hover {
  color: var(--ifsp-ink);
  background: var(--ifsp-amber-hover);
  box-shadow: 0 14px 30px -10px rgba(214, 150, 20, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  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: 14.5px;
  color: var(--ifsp-muted);
  text-decoration: none;
}

.ifs-promo__link span {
  color: var(--ifsp-ink);
  font-weight: 600;
  border-bottom: 1.5px solid var(--ifsp-amber);
  transition: border-color 0.2s, color 0.2s;
}

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

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

/* close button. Size is !important because the page has "button { width: auto !important }" */
.ifs-promo__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px !important;
  min-width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--ifsp-line);
  background: #FFFFFF;
  color: var(--ifsp-ink);
  box-shadow: 0 4px 12px -4px rgba(28, 25, 23, 0.15);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.3s var(--ifsp-ease);
}

.ifs-promo__close:hover {
  background: var(--ifsp-amber-soft);
  transform: rotate(90deg);
}

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

/* While the popup is open: hide the site's floating buttons and cookie bar, and stop the page scrolling */
html.ifs-promo-open .schedule-btn,
html.ifs-promo-open .get-quote,
html.ifs-promo-open #cookie-banner {
  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 30px; }
  .ifs-promo__logo { height: 48px; }
  .ifs-promo__mark { left: 24px; font-size: 64px; }
}

/* ---------- 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; }
  .ifs-promo__media img { object-position: 30% 22%; } /* keep the crane and the top of the building in the strip */
  .ifs-promo__media--fallback { padding: 22px 24px; }

  /* phones: the photo strip dissolves downwards into the white content */
  .ifs-promo__media:not(.ifs-promo__media--fallback) {
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, rgba(0, 0, 0, 0.5) 75%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 45%, rgba(0, 0, 0, 0.5) 75%, transparent 100%);
  }

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

  /* the booth number is already in the Booth tile; the outlined mark would sit on the faded white area */
  .ifs-promo__media:not(.ifs-promo__media--fallback) .ifs-promo__mark { display: none; }

  .ifs-promo__mark {
    left: auto;
    right: 20px;
    bottom: 16px;
    font-size: 44px;
    text-align: right;
  }

  .ifs-promo__mark small {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .ifs-promo__body { margin-top: -24px; } /* content starts inside the faded part of the photo */

  .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.75);
  }

  .ifs-promo__close {
    top: 14px;
    right: 14px;
    width: 36px !important;
    min-width: 36px;
    height: 36px;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .ifs-promo__body {
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  }

  .ifs-promo__logo { height: 42px; }
  .ifs-promo__title { font-size: 30px; }
  .ifs-promo__text { margin-top: 12px; font-size: 15px; line-height: 1.58; }
  .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;
  }
}
