/* ═══════════════════════════════════════════════════
   PARENTAL TRACKER — WhatsApp Style (Pinned Scroll-Driven)
   ═══════════════════════════════════════════════════ */

/* ═══════ OUTER SECTION ═══════ */
.tracker {
  position: relative;
}

.tracker-cinema {
  position: relative;
  height: 250vh;
}

.tracker-stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Custom property driven by JS — 0 → 1 over the pinned scroll */
  --p: 0;
}

/* ═══════ AMBIENT BACKGROUND ═══════ */
.tracker-aurora {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(ellipse 60% 40% at 30% 30%, rgba(37, 211, 102, 0.15), transparent 60%),
    radial-gradient(ellipse 50% 50% at 70% 70%, rgba(18, 140, 126, 0.15), transparent 60%),
    radial-gradient(circle at 50% 50%, rgba(7, 94, 84, 0.08), transparent 70%);
  filter: blur(60px);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

.tracker-grid-fx {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 30%, transparent 75%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ═══════ HEADER ═══════ */
.tracker-header {
  position: absolute;
  top: clamp(60px, 9vh, 110px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  width: min(720px, 92vw);
  pointer-events: none;
}

.tracker-headline {
  font-family: var(--font-ar);
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 12px 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  flex-wrap: wrap;
}

.tracker-headline-accent {
  display: inline-flex;
  align-items: baseline;
  background: linear-gradient(135deg, #25D366, #128C7E);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(37, 211, 102, 0.35));
}

.tracker-sub-swap {
  position: relative;
  height: 2.6em;
  max-width: 560px;
  margin: 0 auto;
}

.tracker-sub {
  position: absolute;
  inset: 0;
  font-size: clamp(0.92rem, 1.55vw, 1.05rem);
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.55s var(--ease-out-quart), transform 0.55s var(--ease-out-quart);
}

.tracker-sub.is-active {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════ PHONE MOCKUP ═══════ */
.tracker-phone-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: clamp(180px, 26vh, 240px);
  padding-bottom: 60px;
  pointer-events: none;
  z-index: 5;
}

.tracker-phone {
  position: relative;
  width: min(340px, 85vw);
  height: 580px;
  border-radius: 48px;
  background: #0b141a;
  box-shadow:
    0 0 0 4px #000,
    0 0 0 10px #2a2a30,
    0 0 0 11px rgba(255, 255, 255, 0.15),
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 0 2px rgba(255, 255, 255, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Dynamic Island */
.dynamic-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 105px;
  height: 32px;
  background: #000;
  border-radius: 16px;
  z-index: 20;
  box-shadow: 
    inset 0 0 2px rgba(255,255,255,0.1),
    0 0 0 1px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
}

.dynamic-island-camera {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0a0a0f;
  box-shadow: 
    inset 0 0 4px rgba(255,255,255,0.25), 
    0 0 1px rgba(0,0,0,0.8);
}

/* WA SCREEN */
.wa-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0b141a;
  /* WhatsApp chat background pattern simulation */
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}

.wa-header {
  display: flex;
  align-items: center;
  padding: 55px 16px 12px;
  background: #202c33;
  gap: 12px;
  z-index: 10;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wa-back {
  color: #8696a0;
  display: flex;
  align-items: center;
}

.wa-back svg {
  width: 24px;
  height: 24px;
}

.wa-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.wa-avatar img {
  width: 75%;
  height: 75%;
  object-fit: contain;
}

.wa-contact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.wa-name {
  color: #e9edef;
  font-family: var(--font-ar);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wa-verified-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.wa-status {
  color: #8696a0;
  font-family: var(--font-ar);
  font-size: 0.75rem;
}

.wa-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #e9edef;
  margin-right: auto;
}

.wa-actions svg {
  width: 20px;
  height: 20px;
}

.wa-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  position: relative;
}

.wa-date-badge {
  align-self: center;
  background: #182229;
  color: #8696a0;
  font-family: var(--font-ar);
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Messages */
.wa-msg {
  display: flex;
  justify-content: flex-start; /* Incoming messages */
  
  /* Reveal based on --p */
  --msg-threshold: 0.2;
  opacity: max(0, min(1, (var(--p) - var(--msg-threshold)) / 0.1));
  transform: translateY(calc((1 - max(0, min(1, (var(--p) - var(--msg-threshold)) / 0.1))) * 20px));
}

.wa-msg[data-msg="0"] { --msg-threshold: 0.2; }
.wa-msg[data-msg="1"] { --msg-threshold: 0.45; }
.wa-msg[data-msg="2"] { --msg-threshold: 0.7; }

.wa-msg-bubble {
  background: #202c33;
  color: #e9edef;
  padding: 8px 12px;
  border-radius: 12px;
  border-top-right-radius: 0;
  max-width: 90%;
  position: relative;
  font-family: var(--font-ar);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  border-left: 3px solid #25D366; /* Accent to make it look official */
}

/* Tail for incoming message */
.wa-msg-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 12px solid #202c33;
  border-right: 12px solid transparent;
}

.wa-msg-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #25D366;
  margin-bottom: 4px;
}

.wa-msg-text {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 4px;
}

.wa-msg-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.wa-msg-time {
  font-size: 0.65rem;
  color: #8696a0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .tracker-cinema {
    height: 200vh;
  }
  .tracker-phone {
    height: clamp(420px, 60vh, 500px);
  }
  .tracker-phone-container {
    padding-top: clamp(140px, 20vh, 180px);
    padding-bottom: 20px;
  }
  .wa-msg-title {
    font-size: 0.8rem;
  }
  .wa-msg-text {
    font-size: 0.85rem;
  }
}

@media (max-width: 380px) {
  .tracker-phone {
    height: clamp(380px, 55vh, 420px);
    border-radius: 36px;
  }
  .dynamic-island {
    width: 90px;
    height: 28px;
    top: 8px;
  }
  .dynamic-island-camera {
    width: 10px;
    height: 10px;
  }
  .wa-header {
    padding: 48px 12px 10px;
    gap: 8px;
  }
  .wa-actions {
    gap: 12px;
  }
  .wa-actions svg {
    width: 18px;
    height: 18px;
  }
  .tracker-headline {
    font-size: clamp(1.6rem, 8vw, 2rem);
  }
}
