/* ===== HTG POP-UPS — GLASSMORPHISM EDITION ===== */


/* ── BACKDROP ─────────────────────────────────────────────────────────────
   Covers the entire viewport. The blur happens HERE — the whole page behind
   the popup becomes frosted glass. The popup card then sits on top of that.
   ───────────────────────────────────────────────────────────────────────── */
.htg-popup-host {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: transparent;
  transition: background 400ms ease;
}

.htg-popup-host.has-visible {
  pointer-events: auto;
  background: rgba(4, 10, 6, 0.55);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}


/* ── POPUP CARD ───────────────────────────────────────────────────────────
   The card itself applies a second layer of blur (blurs the already-blurred
   backdrop), creating the classic frosted / etched-glass look. Shine and
   rim highlights are added via pseudo-elements and layered box-shadows.
   ───────────────────────────────────────────────────────────────────────── */
.htg-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 36px)) scale(0.90);

  width: min(440px, min(88vw, 88vh));
  aspect-ratio: 1 / 1;

  overflow: hidden;
  border-radius: 28px;
  padding: 0;

  /* Glass blur on the card itself */
  backdrop-filter: blur(52px) saturate(220%) brightness(1.07);
  -webkit-backdrop-filter: blur(52px) saturate(220%) brightness(1.07);

  isolation: isolate;
  display: flex;
  flex-direction: column;

  opacity: 0;
  pointer-events: none;

  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.htg-popup.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* Light reflection — top-left diagonal shine, simulates light hitting glass */
.htg-popup::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.32)  0%,
    rgba(255, 255, 255, 0.10) 28%,
    transparent                56%,
    rgba(0, 0, 0, 0.06)       100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Bottom rim highlight — ambient light bouncing back up from below */
.htg-popup::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8%;
  right: 8%;
  height: 1.5px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.40) 25%,
    rgba(255, 255, 255, 0.40) 75%,
    transparent
  );
  pointer-events: none;
  z-index: 2;
}


/* ── COLOUR VARIANTS ──────────────────────────────────────────────────────
   Backgrounds are semi-transparent so the backdrop-filter actually shows
   through. Each variant adds its own ambient colour glow in box-shadow.
   ───────────────────────────────────────────────────────────────────────── */

.htg-popup--glass_green {
  background: linear-gradient(
    158deg,
    rgba(74,  171,  72, 0.50)  0%,
    rgba(34,   85,  41, 0.68) 55%,
    rgba(16,   44,  20, 0.80) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow:
    0  0  0  1px rgba(255, 255, 255, 0.10),
    0 32px 72px -8px rgba(4, 28, 8, 0.80),
    0 12px 32px     rgba(0,  0,  0, 0.35),
    0  0  90px      rgba(74, 171, 72, 0.20),
    inset 0  1px 0  rgba(255, 255, 255, 0.55),
    inset 0 -1px 0  rgba(0,   0,   0, 0.22);
}

.htg-popup--glass_orange {
  background: linear-gradient(
    158deg,
    rgba(239, 150,  35, 0.50)  0%,
    rgba(178,  88,  15, 0.68) 55%,
    rgba(110,  50,   6, 0.80) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow:
    0  0  0  1px rgba(255, 255, 255, 0.10),
    0 32px 72px -8px rgba(40, 12,  0, 0.80),
    0 12px 32px     rgba(0,   0,  0, 0.35),
    0  0  90px      rgba(239, 150, 35, 0.22),
    inset 0  1px 0  rgba(255, 255, 255, 0.55),
    inset 0 -1px 0  rgba(0,   0,   0, 0.22);
}

/* ── GOLD — bright company sun-gold, fully orange → green, zero brown ── */
.htg-popup--glass_gold {
  background: linear-gradient(
    158deg,
    rgba(255, 218,  40, 0.62)  0%,
    rgba(239, 150,  35, 0.72) 50%,
    rgba(34,  85,   41, 0.78) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #0f1a06;
  box-shadow:
    0  0  0  1px rgba(255, 255, 255, 0.18),
    0 32px 72px -8px rgba(20,  40,  10, 0.65),
    0 12px 32px     rgba(0,   0,   0, 0.28),
    0  0  90px      rgba(255, 211,   2, 0.28),
    inset 0  1px 0  rgba(255, 255, 255, 0.68),
    inset 0 -1px 0  rgba(0,   0,   0, 0.12);
}

/* ── FOREST — deep jungle green, richer than glass_green ── */
.htg-popup--glass_forest {
  background: linear-gradient(
    158deg,
    rgba(22,  56,  26, 0.70)  0%,
    rgba(10,  28,  14, 0.84) 55%,
    rgba(4,   13,   6, 0.92) 100%
  );
  border: 1px solid rgba(74, 171, 72, 0.30);
  color: #d0ecc8;
  box-shadow:
    0  0  0  1px rgba(74, 171, 72, 0.14),
    0 32px 72px -8px rgba(0,   8,   2, 0.90),
    0 12px 32px     rgba(0,   0,   0, 0.55),
    0  0  90px      rgba(34,  85,  41, 0.22),
    inset 0  1px 0  rgba(255, 255, 255, 0.16),
    inset 0 -1px 0  rgba(0,   0,   0, 0.38);
}

/* ── SUN — brand sun yellow #FFD302 ── */
.htg-popup--glass_sun {
  background: linear-gradient(
    158deg,
    rgba(255, 215,   2, 0.62)  0%,
    rgba(255, 190,  20, 0.72) 55%,
    rgba(74,  171,  72, 0.72) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.48);
  color: #0f1a06;
  box-shadow:
    0  0  0  1px rgba(255, 255, 255, 0.22),
    0 32px 72px -8px rgba(20,  50,  10, 0.60),
    0 12px 32px     rgba(0,   0,   0, 0.22),
    0  0  90px      rgba(255, 211,   2, 0.35),
    inset 0  1px 0  rgba(255, 255, 255, 0.72),
    inset 0 -1px 0  rgba(0,   0,   0, 0.10);
}

/* ── EMBER — vivid brand orange, dark stop is forest green not brown ── */
.htg-popup--glass_ember {
  background: linear-gradient(
    158deg,
    rgba(239, 120,  18, 0.52)  0%,
    rgba(220,  80,  10, 0.68) 52%,
    rgba(34,   85,  41, 0.78) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow:
    0  0  0  1px rgba(255, 255, 255, 0.12),
    0 32px 72px -8px rgba(20,  40,  10, 0.80),
    0 12px 32px     rgba(0,   0,   0, 0.38),
    0  0  90px      rgba(239, 120,  18, 0.26),
    inset 0  1px 0  rgba(255, 255, 255, 0.52),
    inset 0 -1px 0  rgba(0,   0,   0, 0.22);
}

/* ── MINT — fresh bright mint green ── */
.htg-popup--glass_mint {
  background: linear-gradient(
    158deg,
    rgba(74,  200, 140, 0.50)  0%,
    rgba(34,  160,  90, 0.66) 55%,
    rgba(14,   90,  40, 0.78) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  box-shadow:
    0  0  0  1px rgba(255, 255, 255, 0.12),
    0 32px 72px -8px rgba(4,  30,  14, 0.80),
    0 12px 32px     rgba(0,   0,   0, 0.35),
    0  0  90px      rgba(74, 200, 140, 0.22),
    inset 0  1px 0  rgba(255, 255, 255, 0.48),
    inset 0 -1px 0  rgba(0,   0,   0, 0.20);
}

/* ── NIGHT — midnight glass, near-black with green shimmer ── */
.htg-popup--glass_night {
  background: linear-gradient(
    158deg,
    rgba(8,   20,  10, 0.82)  0%,
    rgba(4,   12,   6, 0.90) 55%,
    rgba(2,    6,   3, 0.96) 100%
  );
  border: 1px solid rgba(74, 171, 72, 0.22);
  color: #c8e8c0;
  box-shadow:
    0  0  0  1px rgba(74, 171, 72, 0.10),
    0 32px 72px -8px rgba(0,   0,   0, 1.00),
    0 12px 32px     rgba(0,   0,   0, 0.65),
    0  0  90px      rgba(74, 171, 72, 0.08),
    inset 0  1px 0  rgba(255, 255, 255, 0.10),
    inset 0 -1px 0  rgba(0,   0,   0, 0.50);
}

/* ── AMBER — pure company orange, no brown anywhere ── */
.htg-popup--glass_amber {
  background: linear-gradient(
    158deg,
    rgba(239, 150,  35, 0.56)  0%,
    rgba(239, 120,  15, 0.70) 52%,
    rgba(74,  171,  72, 0.72) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  box-shadow:
    0  0  0  1px rgba(255, 255, 255, 0.12),
    0 32px 72px -8px rgba(14,  40,  10, 0.78),
    0 12px 32px     rgba(0,   0,   0, 0.35),
    0  0  90px      rgba(239, 150,  35, 0.25),
    inset 0  1px 0  rgba(255, 255, 255, 0.50),
    inset 0 -1px 0  rgba(0,   0,   0, 0.20);
}

.htg-popup--glass_dark {
  background: linear-gradient(
    158deg,
    rgba(28,  46,  32, 0.72)  0%,
    rgba(13,  24,  16, 0.84) 55%,
    rgba(5,   12,   7, 0.92) 100%
  );
  border: 1px solid rgba(74, 171, 72, 0.28);
  color: #e8f5e4;
  box-shadow:
    0  0  0  1px rgba(74, 171, 72, 0.12),
    0 32px 72px -8px rgba(0,   0,  0, 0.90),
    0 12px 32px     rgba(0,   0,  0, 0.55),
    0  0  90px      rgba(74, 171, 72, 0.10),
    inset 0  1px 0  rgba(255, 255, 255, 0.14),
    inset 0 -1px 0  rgba(0,   0,   0, 0.35);
}


/* ── CLOSE BUTTON ─────────────────────────────────────────────────────────
   Glass pill button. Gets its own mini backdrop-filter so it reads clearly
   regardless of what colour is beneath it.
   ───────────────────────────────────────────────────────────────────────── */
.htg-popup__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 3;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
  transition: background 200ms, border-color 200ms, transform 200ms, box-shadow 200ms;
}
.htg-popup__close:hover {
  background: rgba(255, 255, 255, 0.30);
  border-color: rgba(255, 255, 255, 0.50);
  transform: scale(1.10);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.40);
}
.htg-popup__close:active {
  transform: scale(0.93);
}


/* ── MEDIA IMAGE ──────────────────────────────────────────────────────────
   Fills the top portion of the square card. A gradient scrim at the bottom
   fades the image into the body section naturally.
   ───────────────────────────────────────────────────────────────────────── */
.htg-popup__media {
  flex-shrink: 0;
  height: clamp(130px, 38%, 185px);
  overflow: hidden;
  border-radius: 28px 28px 0 0;
  position: relative;
}
.htg-popup__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.htg-popup__media::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.28));
  pointer-events: none;
}


/* ── BODY ─────────────────────────────────────────────────────────────────
   Fills remaining height below the image (or all the height if no image).
   z-index: 1 keeps it above the ::before shine layer.
   ───────────────────────────────────────────────────────────────────────── */
.htg-popup__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  padding: 24px 26px 24px;
  position: relative;
  z-index: 1;
}

/* When there is no media, push the body down so the close button doesn't overlap the title */
.htg-popup:not(:has(.htg-popup__media)) .htg-popup__body {
  padding-top: 50px;
}

.htg-popup__title {
  font-family: var(--ap-font-display, 'Fraunces', Georgia, serif);
  font-size: clamp(1.1rem, 2.5vw, 1.42rem);
  font-weight: 700;
  margin: 0 0 0.55rem;
  letter-spacing: -0.018em;
  padding-right: 40px;
  line-height: 1.22;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.20);
}

.htg-popup__message {
  font-size: clamp(0.875rem, 2vw, 0.95rem);
  line-height: 1.60;
  margin-bottom: 1.2rem;
  opacity: 0.92;
}
.htg-popup__message p:last-child { margin-bottom: 0; }


/* ── CTA BUTTON ───────────────────────────────────────────────────────────
   Pill-shaped glass button with its own blur layer and inset rim highlight.
   ───────────────────────────────────────────────────────────────────────── */
.htg-popup__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.62rem 1.35rem;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 100px;
  border: 1.5px solid rgba(255, 255, 255, 0.36);
  align-self: flex-start;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: all 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.htg-popup__cta:hover {
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(255, 255, 255, 0.55);
  transform: translateY(-2px);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.htg-popup__cta:active {
  transform: translateY(0px);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
}


/* ── MOBILE ───────────────────────────────────────────────────────────────*/
@media (max-width: 480px) {
  .htg-popup {
    width: min(92vw, 92vh);
    border-radius: 22px;
  }
  .htg-popup__media {
    border-radius: 22px 22px 0 0;
    height: clamp(110px, 35%, 160px);
  }
  .htg-popup__body {
    padding: 18px 20px 18px;
  }
  .htg-popup:not(:has(.htg-popup__media)) .htg-popup__body {
    padding-top: 44px;
  }
  .htg-popup__title { font-size: 1.06rem; }
}
