/* ============================================================
   WHATSAPP & EMAIL MARKETING AUTOMATION PAGE — page-specific parts.
   Builds on ai-agent-modern.css, qa-modern.css,
   digital-marketing-modern.css, seo-modern.css and ppc-modern.css.
   ============================================================ */

.ema-page {
  --ema-wa: #16a34a;
  --ema-wa-soft: #dcfce7;
  --ema-mail: #4f46e5;
  --ema-mail-soft: #e0e7ff;
}
.ema-hero h1 {
  max-width: 660px;
}

/* ── Hero visual: trigger → WhatsApp + email ─────────── */
.ema-visual {
  position: relative;
  display: grid;
  width: min(100%, 520px);
  justify-self: center;
  padding: 18px 0 70px;
}
.ema-trigger {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 330px);
  justify-self: center;
  padding: 14px 16px;
  border: 1px solid var(--ag-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 50px -24px rgba(79, 70, 229, 0.45);
}
.ema-trigger-ico {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #fff;
}
.ema-trigger small {
  display: block;
  color: var(--ag-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ema-trigger strong {
  color: var(--ag-ink);
  font-size: 14.5px;
}
.ema-live {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
}
.ema-live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
  animation: emaPulse 1.6s ease-in-out infinite;
}

/* Branch connectors with travelling dots */
.ema-branches {
  position: relative;
  height: 46px;
}
.ema-branches i {
  position: absolute;
  top: 0;
  left: 50%;
  width: 25%;
  height: 100%;
  border-top: 0;
  border-bottom: 2px dashed #c7cdfb;
}
.ema-branches i:first-child {
  transform: translateX(-100%);
  border-left: 2px dashed #86efac;
  border-bottom-color: #86efac;
  border-bottom-left-radius: 18px;
}
.ema-branches i:last-child {
  border-right: 2px dashed #c7cdfb;
  border-bottom-right-radius: 18px;
}
.ema-branches::before {
  content: "";
  position: absolute;
  top: -2px;
  left: calc(50% - 1px);
  width: 2px;
  height: calc(100% + 2px);
  background: linear-gradient(#c7cdfb, transparent);
}

.ema-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.ema-chat,
.ema-mail {
  padding: 14px;
  border: 1px solid var(--ag-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 60px -30px rgba(15, 23, 42, 0.35);
}
.ema-chat {
  background: linear-gradient(180deg, #f0fdf4, #fff 60%);
}
.ec-motion .ema-visual.is-in .ema-chat {
  animation: emaRise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.5s both;
}
.ec-motion .ema-visual.is-in .ema-mail {
  animation: emaRise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.8s both;
}
.ema-chat-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--ag-ink);
  font-size: 12.5px;
  font-weight: 700;
}
.ema-chat .ema-chat-top svg {
  color: var(--ema-wa);
}
.ema-mail .ema-chat-top svg {
  color: var(--ema-mail);
}
.ema-bubble {
  margin: 0 0 8px !important;
  padding: 9px 11px;
  border-radius: 4px 14px 14px 14px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  color: var(--ag-ink);
  font-size: 12.5px;
  line-height: 1.45;
}
.ema-bubble--me {
  margin-left: 22px !important;
  border-radius: 14px 4px 14px 14px;
  background: #d9fdd3;
}
.ec-motion .ema-visual.is-in .ema-bubble--me {
  animation: emaRise 0.6s ease 1.6s both;
}
.ema-ticks {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #0ea5e9;
  font-size: 11px;
  font-weight: 600;
}
.ema-mail strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ag-ink);
  font-size: 13.5px;
  line-height: 1.35;
}
.ema-mail > i {
  display: block;
  height: 7px;
  margin-bottom: 7px;
  border-radius: 6px;
  background: #eef0f7;
}
.ema-mail > i:nth-of-type(2) {
  width: 85%;
}
.ema-mail > i:nth-of-type(3) {
  width: 60%;
}
.ema-mail-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--ema-mail);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}
.ema-float {
  left: -20px;
  bottom: 0;
  align-items: center;
  animation-delay: -1.5s;
}
.ema-float > svg {
  padding: 6px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ema-mail-soft);
  color: var(--ema-mail);
}
.ema-float strong {
  display: block;
  font-size: 13.5px;
}
.ema-float small {
  color: var(--ag-muted);
  font-size: 11.5px;
  font-weight: 500;
}

@keyframes emaRise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes emaPulse {
  50% {
    opacity: 0.3;
  }
}

/* Four highlights in a 2 × 2 grid */
.ema-highlights {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ema-note-dark {
  margin-top: 22px !important;
  color: #cbd5e1 !important;
}
.ema-note-dark svg {
  color: #a5b4fc;
}

/* ── Email services bento ────────────────────────────── */
.ema-email-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.ema-email-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ema-email-card h3 {
  font-size: 18px;
}
.ema-email-card > p:not(.qa-note):not(.qa-mini-title) {
  color: var(--ag-muted);
  font-size: 14.5px;
  line-height: 1.65;
}
.ema-email-card .qa-checks {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.ema-email-card .qa-note {
  margin-top: auto !important;
  font-size: 13px;
}
.ema-email-card--list {
  grid-row: span 2;
}

/* ── Combined journeys ───────────────────────────────── */
.ema-flows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.ema-flow {
  padding: 24px;
  border: 1px solid var(--ag-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 20px 50px -36px rgba(15, 23, 42, 0.35);
}
.ema-flow > header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.ema-flow h3 {
  font-size: 17.5px;
}
.ema-flow ol {
  position: relative;
  display: grid;
  gap: 16px;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}
.ema-flow ol::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 14px;
  width: 2px;
  background: linear-gradient(#a5b4fc, #86efac);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s;
}
.ema-flow.is-in ol::before,
.ag-main:not(.ec-motion) .ema-flow ol::before {
  transform: scaleY(1);
}
.ema-flow li {
  position: relative;
  display: flex;
  gap: 14px;
}
.ec-motion .ema-flow li {
  opacity: 0;
  transform: translateX(-8px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  transition-delay: calc(var(--d, 0ms) + 300ms);
}
.ec-motion .ema-flow.is-in li {
  opacity: 1;
  transform: none;
}
.ema-node {
  position: relative;
  z-index: 1;
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--ema-mail);
  box-shadow: 0 6px 14px -6px rgba(79, 70, 229, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.ema-node--wa {
  background: var(--ema-wa);
}
.ema-node--crm {
  background: #0891b2;
}
.ema-node--web,
.ema-node--data {
  background: #7c3aed;
}
.ema-node--team {
  background: #d97706;
}
.ema-ch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ema-mail-soft);
  color: var(--ema-mail);
  font-size: 11px;
  font-weight: 700;
}
.ema-ch--wa {
  background: var(--ema-wa-soft);
  color: #15803d;
}
.ema-ch--crm {
  background: #cffafe;
  color: #0e7490;
}
.ema-ch--web,
.ema-ch--data {
  background: #ede9fe;
  color: #6d28d9;
}
.ema-ch--team {
  background: #fef3c7;
  color: #b45309;
}
.ema-flow li p {
  margin-top: 5px !important;
  color: var(--ag-ink);
  font-size: 14px;
  line-height: 1.55;
}

/* ── Integration hub ─────────────────────────────────── */
.ema-int-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ema-hub {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1;
  justify-self: center;
}
.ema-hub-core {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow:
    0 0 0 10px rgba(99, 102, 241, 0.12),
    0 30px 60px -20px rgba(79, 70, 229, 0.7);
  color: #fff;
  transform: translate(-50%, -50%);
}
.ema-hub-core small {
  font-size: 12px;
  font-weight: 700;
}
.ema-hub-ring {
  position: absolute;
  inset: 12%;
  border: 2px dashed #c7cdfb;
  border-radius: 50%;
  animation: emaSpin 40s linear infinite;
}
.ema-hub-ring--2 {
  inset: 28%;
  border-color: #bbf7d0;
  animation-direction: reverse;
  animation-duration: 28s;
}
.ema-hub-node {
  --r: 38%;
  --a: calc(var(--i) * 45deg - 90deg);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border: 1px solid var(--ag-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 30px -16px rgba(15, 23, 42, 0.45);
  color: var(--ema-mail);
  transform: rotate(var(--a)) translateX(min(160px, 38vw)) rotate(calc(var(--a) * -1));
}
.ema-hub-node:nth-of-type(odd) {
  color: var(--ema-wa);
}
.ec-motion .ema-hub .ema-hub-node {
  opacity: 0;
  transition: opacity 0.5s ease;
  transition-delay: calc(var(--i) * 90ms + 200ms);
}
.ec-motion .ema-hub.is-in .ema-hub-node {
  opacity: 1;
}
@keyframes emaSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Tech stack ──────────────────────────────────────── */
.ema-stack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.ema-stack-card h3 {
  margin-top: 14px !important;
  font-size: 17px;
}
.ema-stack-card ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0 !important;
  padding: 0 !important;
  list-style: none;
}
.ema-stack-card li {
  padding: 6px 11px;
  border: 1px solid #dcdcfb;
  border-radius: 999px;
  background: #f5f6ff;
  color: #3730a3;
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.25s,
    color 0.25s;
}
.ema-stack-card li:hover {
  background: #4f46e5;
  color: #fff;
}

/* ── Segmentation + KPIs ─────────────────────────────── */
.ema-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.ema-metrics .qa-mini-title {
  margin-top: 14px !important;
}
.ema-metrics .qa-checks {
  grid-template-columns: minmax(0, 1fr);
}
.ema-kpi-card {
  border-color: #c7cdfb;
  background: linear-gradient(135deg, #f5f3ff, #eef2ff);
}

/* ── Compliance ──────────────────────────────────────── */
.ema-comply {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 48px;
  align-items: center;
}
.ema-comply-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  list-style: none;
}
.ema-comply-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid #d1fae5;
  border-radius: 14px;
  background: #f0fdf4;
  color: var(--ag-ink);
  font-size: 13.5px;
  line-height: 1.45;
}
.ema-comply-list svg {
  flex: none;
  margin-top: 1px;
  color: var(--ema-wa);
}
.ec-motion .ema-comply-card li {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
  transition-delay: calc(var(--d, 0ms) + 250ms);
}
.ec-motion .ema-comply-card.is-in li {
  opacity: 1;
  transform: none;
}

/* ── Engagement ──────────────────────────────────────── */
.ema-engage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .ema-email-grid,
  .ema-flows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ema-stack,
  .ema-engage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .ema-comply,
  .ema-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
  .ema-comply {
    gap: 28px;
  }
  .ema-float {
    left: 0;
  }
}
@media (max-width: 640px) {
  .ema-email-grid,
  .ema-flows,
  .ema-stack,
  .ema-engage-grid,
  .ema-comply-list,
  .ema-int-list,
  .ema-highlights {
    grid-template-columns: minmax(0, 1fr);
  }
  .ema-email-card--list {
    grid-row: auto;
  }
  .ema-cards {
    gap: 10px;
  }
  .ema-visual {
    padding-bottom: 86px;
  }
  .ema-float {
    bottom: 6px;
  }
  .ema-hub-node {
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    transform: rotate(var(--a)) translateX(37vw) rotate(calc(var(--a) * -1));
  }
}
@media (prefers-reduced-motion: reduce) {
  .ema-hub-ring,
  .ema-live::before {
    animation: none !important;
  }
}
