/* ============================================================
   ALIFY — popups.css · cookie bar, modals (exit-intent /
   newsletter), live chat. CSS owns container transitions;
   GSAP staggers inner content (animations-popups.js).
   ============================================================ */

/* ---------- Cookie consent bar ---------- */
.cookiebar {
  position: fixed;
  z-index: var(--z-cookie);
  inset-inline: clamp(.75rem, 3vw, 2rem);
  bottom: clamp(.75rem, 3vw, 2rem);
  transform: translateY(calc(100% + 3rem));
  transition: transform .65s cubic-bezier(.22, .61, .36, 1);
}
.cookiebar.show { transform: translateY(0); }

.cookiebar__inner {
  max-width: 880px;
  margin-inline: auto;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  background: #14151D;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--green);
  border-radius: var(--r);
  padding: 1.1rem 1.4rem;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
}
.cookiebar__text { flex: 1 1 340px; font-size: .85rem; color: var(--muted); line-height: 1.55; }
.cookiebar__text strong { color: var(--off); }
.cookiebar__text a { color: var(--sand); }
.cookiebar__actions { display: flex; gap: .7rem; flex-wrap: wrap; }

/* ---------- Modals (exit intent + newsletter) ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 1.25rem;
  visibility: hidden;
  pointer-events: none;
}
.modal.open { visibility: visible; pointer-events: auto; }

.modal__bg {
  position: absolute; inset: 0;
  background: rgba(5, 6, 10, .74);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .45s ease;
}
.modal.open .modal__bg { opacity: 1; }

.modal__panel {
  position: relative;
  width: min(600px, 94vw);
  max-height: min(88vh, 780px);
  overflow-y: auto;
  background: linear-gradient(160deg, #171927, #12131C 60%);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: clamp(1.75rem, 5vw, 3rem);
  opacity: 0;
  transform: translateY(28px) scale(.98);
  transition: opacity .5s ease, transform .55s cubic-bezier(.22, .61, .36, 1);
}
.modal.open .modal__panel { opacity: 1; transform: none; }

.modal--exit .modal__panel { border-top: 3px solid var(--green); }
.modal--news .modal__panel { border-top: 3px solid var(--sand); }

.modal__x {
  position: absolute;
  top: 1rem; right: 1rem;
  z-index: 2;
  background: transparent;
}

.modal__eyebrow { margin-bottom: 1.1rem; }
.modal__title { margin-bottom: 1rem; padding-right: 2rem; }
.modal__text { color: var(--muted); margin-bottom: 1.5rem; max-width: 44ch; }
.modal__list { list-style: none; display: grid; gap: .6rem; margin-bottom: 1.75rem; }
.modal__list li { display: flex; gap: .7rem; align-items: baseline; font-size: .93rem; color: var(--text); }
.modal__list .ph { color: var(--green); flex: none; transform: translateY(2px); }

.modal__quote {
  font-family: var(--ff-accent); font-style: italic;
  color: var(--sand); font-size: 1.15rem; line-height: 1.5;
  border-left: 2px solid var(--teal-2);
  padding-left: 1.1rem;
  margin: 0 0 1.75rem;
}

/* ---------- Live chat widget ---------- */
.chatw {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: var(--z-chat);
}

.chatw__fab {
  width: 62px; height: 62px;
  display: grid; place-items: center;
  background: var(--green); color: var(--ink);
  border: 1px solid var(--green);
  border-radius: 50%;
  font-size: 1.6rem;
  box-shadow: 0 14px 40px -10px rgba(12, 220, 42, .5);
  transition: transform .35s cubic-bezier(.34, 1.4, .5, 1), background .3s;
  position: relative;
}
.chatw__fab:hover { transform: translateY(-3px) scale(1.04); background: #2BEA45; }
.chatw__ping {
  position: absolute; top: 4px; right: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--navy);
  border: 2px solid var(--green);
}
.chatw__fab .ph-x { display: none; }
.chatw.open .chatw__fab .ph-chats { display: none; }
.chatw.open .chatw__fab .ph-x { display: block; }
.chatw.open .chatw__fab { background: var(--panel-2); color: var(--off); border-color: var(--line-2); box-shadow: none; }

.chatw__panel {
  position: absolute;
  right: 0; bottom: 78px;
  width: min(384px, calc(100vw - 2.5rem));
  height: min(560px, 72vh);
  display: flex; flex-direction: column;
  background: #12131C;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .65);
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transform-origin: bottom right;
  visibility: hidden;
  transition: opacity .4s ease, transform .45s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .45s;
}
.chatw.open .chatw__panel {
  opacity: 1; transform: none; visibility: visible;
  transition-delay: 0s;
}

.chatw__head {
  padding: 1.1rem 1.25rem;
  background: linear-gradient(120deg, var(--navy), var(--navy-2));
  border-bottom: 1px solid rgba(236, 236, 228, .12);
  display: flex; gap: .9rem; align-items: center;
}
.chatw__avatar {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  background: var(--green); color: var(--ink);
  border-radius: 50%;
  font-size: 1.2rem;
}
.chatw__head-title { font-family: var(--ff-display); font-weight: 600; font-size: 1rem; color: var(--off); }
.chatw__head-sub { font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(156, 196, 166, .9); display: flex; align-items: center; gap: .45rem; }
.chatw__head-sub::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.chatw__msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: .8rem;
}
.chatw__msg {
  max-width: 85%;
  padding: .75rem 1rem;
  border-radius: 12px;
  font-size: .9rem; line-height: 1.55;
}
.chatw__msg--bot {
  align-self: flex-start;
  background: #1B1E2D;
  border: 1px solid var(--line);
  border-left: 2px solid var(--teal-2);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.chatw__msg--user {
  align-self: flex-end;
  background: var(--green); color: var(--ink);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.chatw__typing { display: inline-flex; gap: 5px; padding: .4rem .2rem; }
.chatw__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--sage-2); animation: chatdot 1.1s infinite; }
.chatw__typing i:nth-child(2) { animation-delay: .18s; }
.chatw__typing i:nth-child(3) { animation-delay: .36s; }
@keyframes chatdot { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.chatw__chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1.25rem .9rem; }
.chatw__chip {
  font-family: var(--ff-mono); font-size: .72rem; letter-spacing: .06em;
  color: var(--teal-2);
  border: 1px solid rgba(65, 169, 143, .45);
  background: rgba(11, 115, 95, .12);
  border-radius: 99px;
  padding: .45em 1em;
  transition: color .3s, border-color .3s, background .3s;
}
.chatw__chip:hover { color: var(--green); border-color: var(--green); background: rgba(12, 220, 42, .07); }

.chatw__inputrow { display: flex; gap: .6rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line); }
.chatw__input {
  flex: 1;
  background: rgba(247, 247, 245, .06);
  color: var(--off);
  caret-color: var(--green);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: .7rem 1rem;
  font-size: .9rem;
  transition: border-color .3s, box-shadow .3s, background .3s;
}
.chatw__input::placeholder { color: rgba(236, 236, 228, .3); }
.chatw__input:focus { outline: none; border-color: rgba(12, 220, 42, .7); background: rgba(247, 247, 245, .09); box-shadow: 0 0 0 3px rgba(12, 220, 42, .14); }
.chatw__send {
  width: 44px; flex: none;
  display: grid; place-items: center;
  background: var(--green); color: var(--ink);
  border-radius: 10px;
  font-size: 1.15rem;
  transition: background .3s, transform .3s;
}
.chatw__send:hover { background: #2BEA45; transform: translateY(-1px); }

/* ---------- toast (copy link etc.) ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 2rem;
  z-index: 1250;
  transform: translate(-50%, 200%);
  background: var(--sand); color: #17170E;
  font-family: var(--ff-mono); font-size: .8rem; font-weight: 600; letter-spacing: .08em;
  padding: .8rem 1.5rem;
  border-radius: 99px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .5);
  transition: transform .5s cubic-bezier(.34, 1.3, .5, 1);
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

/* when cookie bar is visible it takes the bottom edge on mobile —
   keep the chat fab above it */
@media (max-width: 768px) {
  body:has(.cookiebar.show) .chatw { bottom: 6.5rem; }
}
