/* ============================================================================
   Newsletter Popup — "30 Days. 30 Moves. 30% More Revenue."
   True glassmorphism — see-through backdrop + frosted-glass card.
   The page bleeds through; the card refracts; the headline is central + alive.
   Design tokens come from styles.css (--cyan, --purple, --emerald, --bg, ...).
   Behavior contract: see newsletter-popup.js.
   ============================================================================ */

/* ----- Overlay (backdrop — translucent, page visible) ----- */
.clz-newsletter-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* Soft tint, NOT a scrim — the page reads through */
  background:
    radial-gradient(ellipse at center, rgba(34, 211, 238, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 30% 70%, rgba(167, 139, 250, 0.04) 0%, transparent 55%),
    rgba(5, 5, 16, 0.32);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.clz-newsletter-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ----- Card shell (true glass — translucent + frosted) ----- */
.clz-newsletter-card {
  position: relative;
  width: min(560px, 100%);
  border-radius: 28px;
  padding: 48px clamp(28px, 4vw, 56px) 40px;
  /* layered glass: subtle color glints + 1-line top highlight + see-through tint */
  background:
    /* specular highlight at top edge */
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, transparent 18%),
    /* corner color glints */
    radial-gradient(ellipse at top right, rgba(34, 211, 238, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(167, 139, 250, 0.14) 0%, transparent 55%),
    /* base tint — see-through */
    rgba(20, 22, 44, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.55),
    0 0 70px rgba(34, 211, 238, 0.18),
    0 0 140px rgba(167, 139, 250, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  transform: translateY(28px) scale(0.94);
  opacity: 0;
  transition:
    transform 540ms cubic-bezier(0.18, 0.74, 0.27, 1.04),
    opacity 380ms ease-out;
  overflow: hidden;
  isolation: isolate;
  /* center everything inside */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.clz-newsletter-overlay.is-open .clz-newsletter-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ----- Animated gradient border (rotating conic) ----- */
.clz-newsletter-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -2;
  border-radius: inherit;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(34, 211, 238, 0.55) 60deg,
    transparent 130deg,
    transparent 220deg,
    rgba(167, 139, 250, 0.55) 290deg,
    transparent 360deg
  );
  animation: clz-rotate-border 11s linear infinite;
  filter: blur(0.5px);
}
@keyframes clz-rotate-border {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ----- Subtle dot grid texture inside the card (premium-tech feel) ----- */
.clz-newsletter-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: inherit;
  background-image:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.06) 1px, transparent 1.5px);
  background-size: 22px 22px;
  background-position: 0 0;
  opacity: 0.6;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ----- Ambient orb field (slow-drifting, blurred, depth) ----- */
.clz-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}
.clz-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: clz-orb-drift 14s ease-in-out infinite;
}
.clz-orb.clz-orb-cyan   { background: radial-gradient(circle, rgba(34, 211, 238, 0.7), transparent 65%); }
.clz-orb.clz-orb-purple { background: radial-gradient(circle, rgba(167, 139, 250, 0.7), transparent 65%); }
.clz-orb.clz-orb-emerald{ background: radial-gradient(circle, rgba(52, 211, 153, 0.45), transparent 65%); }
@keyframes clz-orb-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(var(--clz-dx, 24px), var(--clz-dy, -18px)) scale(1.08); }
  66%      { transform: translate(calc(var(--clz-dx, 24px) * -0.6), var(--clz-dy2, 22px)) scale(0.94); }
}

/* Tiny pin-prick stars on top of orbs */
.clz-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  opacity: 0;
  animation: clz-twinkle 4s ease-in-out infinite;
}
@keyframes clz-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50%      { opacity: 0.9; transform: scale(1.1); }
}

/* ----- Close button (glass disc) ----- */
.clz-newsletter-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 220ms ease;
  font-size: 16px;
  line-height: 1;
}
.clz-newsletter-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  color: rgba(255, 255, 255, 0.95);
  transform: rotate(90deg);
}
.clz-newsletter-close:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ----- FREE NEWSLETTER badge (centered) ----- */
.clz-free-badge-wrap {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px 7px 14px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(167, 139, 250, 0.16)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(34, 211, 238, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin: 0 auto 22px;
  box-shadow:
    0 4px 20px rgba(34, 211, 238, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.clz-free-badge-wrap::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan), 0 0 22px rgba(34, 211, 238, 0.5);
  animation: clz-pulse-dot 1.6s ease-in-out infinite;
}
@keyframes clz-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.4); }
}
.clz-free {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  position: relative;
  display: inline-block;
  color: rgba(255, 255, 255, 0.96);
  text-shadow:
    -1px 0 0 rgba(34, 211, 238, 0.7),
    1px 0 0 rgba(251, 113, 133, 0.5);
  animation: clz-chromatic 3s ease-in-out infinite;
}
@keyframes clz-chromatic {
  0%, 100% { text-shadow: -1px 0 0 rgba(34,211,238,0.7), 1px 0 0 rgba(251,113,133,0.5); }
  50%      { text-shadow: -2px 0 0 rgba(34,211,238,0.9), 2px 0 0 rgba(251,113,133,0.6); }
}

/* ----- Headline (central, modernistic, alive) ----- */
.clz-newsletter-headline {
  position: relative;
  z-index: 1;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(1.85rem, 3.4vw, 2.55rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: rgba(255, 255, 255, 0.96);
  margin: 0 0 18px;
  text-align: center;
}
.clz-headline-line {
  display: block;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(14px) scale(0.96);
  animation: clz-headline-in 720ms cubic-bezier(0.18, 0.74, 0.27, 1.04) forwards;
}
.clz-headline-line:nth-child(1) { animation-delay: 120ms; }
.clz-headline-line:nth-child(2) { animation-delay: 280ms; }
.clz-headline-line:nth-child(3) { animation-delay: 440ms; }
@keyframes clz-headline-in {
  to { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}

/* The emphasised final line — multi-stop gradient sweep + breathing scale + glow halo */
.clz-headline-emph {
  position: relative;
  display: inline-block;
  background: linear-gradient(
    90deg,
    var(--cyan) 0%,
    var(--purple) 28%,
    #fb7185 52%,
    var(--purple) 76%,
    var(--cyan) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 900;
  letter-spacing: -0.04em;
  /* combine the entry animation with a continuous sweep + breathing pulse */
  animation:
    clz-headline-in 720ms cubic-bezier(0.18, 0.74, 0.27, 1.04) 440ms forwards,
    clz-gradient-sweep 5.5s linear 1.2s infinite,
    clz-emph-breathe 4.5s ease-in-out 1.2s infinite;
}
@keyframes clz-gradient-sweep {
  0%   { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}
@keyframes clz-emph-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}
/* Glow halo behind the emph line */
.clz-headline-emph::after {
  content: "";
  position: absolute;
  inset: -8% -4%;
  background: radial-gradient(ellipse at center, rgba(34, 211, 238, 0.30) 0%, rgba(167, 139, 250, 0.18) 40%, transparent 70%);
  filter: blur(22px);
  z-index: -1;
  opacity: 0;
  animation: clz-halo-fade 5s ease-in-out 1.2s infinite;
}
@keyframes clz-halo-fade {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

/* ----- Subheadline ----- */
.clz-newsletter-sub {
  position: relative;
  z-index: 1;
  font-size: 0.98rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 auto 28px;
  max-width: 460px;
  text-align: center;
  opacity: 0;
  animation: clz-fade-up 520ms ease-out 600ms forwards;
}
@keyframes clz-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----- Form (centered) ----- */
.clz-newsletter-form {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  opacity: 0;
  animation: clz-fade-up 520ms ease-out 720ms forwards;
}
.clz-input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.clz-newsletter-input {
  flex: 1 1 260px;            /* grow + shrink + 260px basis */
  min-width: 260px;            /* "you@yourcompany.com" ≈ 20 chars + padding */
  padding: 14px 18px;
  font-size: 0.96rem;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  outline: none;
  transition: all 220ms ease;
}
.clz-newsletter-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.clz-newsletter-input:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); }
.clz-newsletter-input:focus {
  border-color: var(--cyan);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 4px rgba(34, 211, 238, 0.18),
    0 0 28px rgba(34, 211, 238, 0.22);
}
.clz-newsletter-input.is-error {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.18);
}

/* ----- Submit button (animated gradient + glassy sheen) ----- */
.clz-newsletter-submit {
  position: relative;
  flex: 0 0 auto;              /* don't compress when input grows */
  padding: 14px 24px;          /* slightly tighter so the input has room to breathe */
  font-size: 0.98rem;
  font-weight: 700;
  font-family: inherit;
  color: #050510;
  background: linear-gradient(135deg, var(--cyan), var(--purple), var(--cyan));
  background-size: 200% 200%;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
  animation: clz-shimmer-bg 5s ease infinite;
  box-shadow:
    0 8px 28px -6px rgba(34, 211, 238, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
@keyframes clz-shimmer-bg {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.clz-newsletter-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.45) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 700ms ease;
}
.clz-newsletter-submit:hover::before { transform: translateX(100%); }
.clz-newsletter-submit:hover {
  transform: translateY(-1px);
  box-shadow:
    0 14px 40px -6px rgba(34, 211, 238, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.clz-newsletter-submit:active { transform: translateY(0); }
.clz-newsletter-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}
.clz-newsletter-submit .clz-submit-label { position: relative; z-index: 1; }
.clz-newsletter-submit .clz-submit-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(5, 5, 16, 0.3);
  border-top-color: #050510;
  border-radius: 50%;
  animation: clz-spin 700ms linear infinite;
  position: relative;
  z-index: 1;
}
.clz-newsletter-submit.is-loading .clz-submit-label { display: none; }
.clz-newsletter-submit.is-loading .clz-submit-spinner { display: inline-block; }
@keyframes clz-spin {
  to { transform: rotate(360deg); }
}

/* ----- Social proof + disclaimer (centered) ----- */
.clz-newsletter-meta {
  position: relative;
  z-index: 1;
  margin: 22px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  opacity: 0;
  animation: clz-fade-up 520ms ease-out 840ms forwards;
}
.clz-proof {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}
.clz-proof-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: clz-pulse-dot 1.6s ease-in-out infinite;
}
.clz-newsletter-disclaimer {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.36);
  font-style: italic;
  line-height: 1.45;
}

/* ----- Error message ----- */
.clz-error-message {
  font-size: 0.85rem;
  color: var(--rose);
  margin-top: -2px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}
.clz-error-message.is-visible {
  display: flex;
  animation: clz-shake 380ms ease;
}
@keyframes clz-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* ----- Success state ----- */
.clz-success-state {
  display: none;
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 12px 0;
}
.clz-newsletter-card.is-success .clz-newsletter-form,
.clz-newsletter-card.is-success .clz-newsletter-meta,
.clz-newsletter-card.is-success .clz-newsletter-headline,
.clz-newsletter-card.is-success .clz-newsletter-sub,
.clz-newsletter-card.is-success .clz-free-badge-wrap {
  display: none;
}
.clz-newsletter-card.is-success .clz-success-state { display: block; }
.clz-success-check {
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 60px rgba(52, 211, 153, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: clz-check-pop 540ms cubic-bezier(0.18, 0.74, 0.27, 1.04);
}
@keyframes clz-check-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); }
}
.clz-success-check svg {
  width: 38px;
  height: 38px;
  stroke: #050510;
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: clz-check-draw 480ms cubic-bezier(0.65, 0, 0.45, 1) 240ms forwards;
}
@keyframes clz-check-draw {
  to { stroke-dashoffset: 0; }
}
.clz-success-title {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--emerald), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.clz-success-body {
  font-size: 0.96rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  margin-bottom: 8px;
}
.clz-success-detail {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
}

/* ----- Confetti (success burst) ----- */
.clz-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}
.clz-confetti-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
}
.clz-newsletter-card.is-success .clz-confetti-piece {
  animation: clz-confetti-fly 1100ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes clz-confetti-fly {
  0%   { transform: translate(-50%, -50%) rotate(0deg) scale(0.4); opacity: 1; }
  100% { transform: translate(var(--clz-cx), var(--clz-cy)) rotate(720deg) scale(1); opacity: 0; }
}

/* ----- Mobile ----- */
@media (max-width: 540px) {
  .clz-newsletter-card { border-radius: 22px; padding: 40px 22px 30px; }
  .clz-newsletter-headline { font-size: 1.7rem; line-height: 1.08; }
  .clz-input-row { flex-direction: column; gap: 10px; }
  .clz-newsletter-submit { width: 100%; }
  .clz-newsletter-overlay {
    backdrop-filter: blur(4px) saturate(110%);
    -webkit-backdrop-filter: blur(4px) saturate(110%);
  }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  .clz-newsletter-card::before,
  .clz-newsletter-submit,
  .clz-orb,
  .clz-particle,
  .clz-free,
  .clz-proof-dot,
  .clz-free-badge-wrap::before,
  .clz-headline-line,
  .clz-headline-emph,
  .clz-headline-emph::after,
  .clz-newsletter-sub,
  .clz-newsletter-form,
  .clz-newsletter-meta {
    animation: none !important;
    filter: none !important;
  }
  .clz-newsletter-card { transition: opacity 200ms ease; }
  .clz-headline-line { opacity: 1; transform: none; }
}
