/* =============================================================
   Mitra360 — FX layer 3 (flagship+)
     - particle constellation canvas in hero
     - coverage NETWORK MAP (SVG arcs between cities)
     - live activity feed toast
     - light / dark mode toggle (brand-preserving)
   ============================================================= */

/* ===================================================
   COLOR TOKENS — light (default) + dark mode override
   =================================================== */
:root {
  --t-bg:        #FFFFFF;
  --t-bg-alt:    #F1F3F5;
  --t-surface:   #FFFFFF;
  --t-ink:       #212529;
  --t-ink-soft:  #3A444E;
  --t-ink-mute:  #6B7480;
  --t-rule:      #E4E7EB;
  --t-rule-soft: #ECEFF3;
  --t-shadow-lg: 0 26px 60px -30px rgba(13, 27, 42, .25);
}
[data-theme="dark"] {
  --t-bg:        #0B1624;
  --t-bg-alt:    #0F2034;
  --t-surface:   #142840;
  --t-ink:       #E6EEF6;
  --t-ink-soft:  #B6C6D6;
  --t-ink-mute:  #8AA0B6;
  --t-rule:      rgba(255,255,255,.08);
  --t-rule-soft: rgba(255,255,255,.06);
  --t-shadow-lg: 0 28px 70px -28px rgba(0, 0, 0, .8);
}

/* Smooth color crossfade everywhere except the perma-dark sections */
body,
.section,
.card,
.essence__pillar,
.voice,
.stats,
.stat,
.faq__item,
.fx-feed__inner,
.fx-theme,
.phone__chat .bubble--in {
  transition:
    background-color .55s ease,
    color .55s ease,
    border-color .55s ease,
    box-shadow .55s ease;
}

/* Apply tokens — light mode picks up automatically */
body { background: var(--t-bg); color: var(--t-ink); }
.section--alt { background: var(--t-bg-alt); }
.section--essence { background: var(--t-bg); }
.section--voices  { background: var(--t-bg-alt); }
.section--stats   { background: var(--t-bg); }

[data-theme="dark"] .section--cta {
  background:
    radial-gradient(60% 80% at 50% 30%, rgba(25,118,210,.35) 0%, transparent 70%),
    var(--t-bg-alt);
}

/* Card-like surfaces */
[data-theme="dark"] .card,
[data-theme="dark"] .essence__pillar,
[data-theme="dark"] .voice,
[data-theme="dark"] .stats,
[data-theme="dark"] .step,
[data-theme="dark"] .nav,
[data-theme="dark"] .vcard__cta {
  background-color: var(--t-surface);
}
[data-theme="dark"] .card,
[data-theme="dark"] .essence__pillar,
[data-theme="dark"] .voice,
[data-theme="dark"] .stats,
[data-theme="dark"] .step {
  border-color: var(--t-rule);
}
[data-theme="dark"] .stat { border-right-color: var(--t-rule-soft); }
[data-theme="dark"] .stat:nth-child(-n+2) { border-bottom-color: var(--t-rule-soft); }
[data-theme="dark"] .voice__by,
[data-theme="dark"] .step__msg { border-top-color: var(--t-rule); border-color: var(--t-rule); }

/* Re-color text in dark */
[data-theme="dark"] body { color: var(--t-ink); }
[data-theme="dark"] .display,
[data-theme="dark"] .vcard__title,
[data-theme="dark"] .step h3,
[data-theme="dark"] .essence__pillar h3,
[data-theme="dark"] .voice__body,
[data-theme="dark"] .nav__brand,
[data-theme="dark"] .nav__links a,
[data-theme="dark"] .stat__label,
[data-theme="dark"] .voice__by strong,
[data-theme="dark"] .vcard__cta { color: var(--t-ink); }
[data-theme="dark"] .lede,
[data-theme="dark"] .vcard__body,
[data-theme="dark"] .vcard__tasks,
[data-theme="dark"] .essence__pillar p,
[data-theme="dark"] .step p,
[data-theme="dark"] .faq__a,
[data-theme="dark"] .footer__cols a,
[data-theme="dark"] .footer__mission { color: var(--t-ink-soft); }
[data-theme="dark"] .vcard__tag,
[data-theme="dark"] .vcard__status,
[data-theme="dark"] .step__msg,
[data-theme="dark"] .stat__label,
[data-theme="dark"] .voice__by em,
[data-theme="dark"] .cta__hint { color: var(--t-ink-mute); }
[data-theme="dark"] .eyebrow { color: #8FBCEC; }

/* Code / bubble adjustments */
[data-theme="dark"] code {
  background: var(--t-surface);
  border-color: var(--t-rule);
  color: var(--t-ink);
}
[data-theme="dark"] .phone__chat {
  background: repeating-linear-gradient(135deg, #11243A 0 6px, #0F2034 6px 12px);
}
[data-theme="dark"] .phone__chat .bubble--in {
  background: #1A3656;
  color: #E6EEF6;
}
[data-theme="dark"] .bubble__choices span {
  background: var(--t-surface);
  border-color: var(--t-rule);
  color: var(--t-ink);
}

/* Nav glass effect for dark */
[data-theme="dark"] .nav {
  background: color-mix(in oklab, #0B1624 75%, transparent);
  border-bottom-color: var(--t-rule);
}
[data-theme="dark"] .nav__menu span { background: var(--t-ink); }

/* FAQ icon in dark */
[data-theme="dark"] .faq__icon { color: var(--t-ink-mute); }

/* Light-mode hero ::before glow was tuned for light bg — dim in dark */
[data-theme="dark"] .hero::before { opacity: .25; }
[data-theme="dark"] .fx-grain { opacity: .15; }

/* CTA section radial in dark */
[data-theme="dark"] .section--cta { background:
  radial-gradient(60% 80% at 50% 30%, rgba(25,118,210,.4) 0%, transparent 70%),
  var(--t-bg-alt);
}

/* Stats numbers stay gradient — already crisp on both bg */

/* ===================================================
   THEME TOGGLE — pill at top-right
   =================================================== */
.fx-theme {
  position: fixed;
  top: 86px;
  right: 22px;
  z-index: 60;
  padding: 6px;
  border-radius: 999px;
  background: var(--t-surface);
  border: 1px solid var(--t-rule);
  box-shadow: 0 8px 24px -12px rgba(13,27,42,.25);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, background-color .55s ease, border-color .55s ease;
}
[data-theme="dark"] .fx-theme {
  box-shadow: 0 8px 24px -10px rgba(0,0,0,.6);
}
.fx-theme:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -10px rgba(25,118,210,.45); }
.fx-theme__track {
  position: relative;
  width: 52px; height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  display: inline-flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
  color: #0D47A1;
  transition: background .35s ease;
}
[data-theme="dark"] .fx-theme__track {
  background: linear-gradient(135deg, #0D47A1, #1976D2);
  color: #fff;
}
.fx-theme__knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px -2px rgba(0,0,0,.3);
  transition: transform .35s cubic-bezier(.2,.9,.25,1.2), background .35s ease;
}
[data-theme="dark"] .fx-theme__knob {
  transform: translateX(26px);
  background: #0B1624;
  box-shadow: 0 3px 8px -2px rgba(0,0,0,.6);
}
.fx-theme__icon { z-index: 1; }
.fx-theme__icon--sun  { opacity: 1; transition: opacity .3s; }
.fx-theme__icon--moon { opacity: .35; transition: opacity .3s; }
[data-theme="dark"] .fx-theme__icon--sun  { opacity: .35; }
[data-theme="dark"] .fx-theme__icon--moon { opacity: 1; }
@media (max-width: 540px) { .fx-theme { top: 80px; right: 14px; } }

/* ===================================================
   HERO CONSTELLATION CANVAS
   =================================================== */
.fx-constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .55;
  mix-blend-mode: normal;
}
[data-theme="dark"] .fx-constellation { opacity: .75; }
@media (max-width: 640px) { .fx-constellation { opacity: .35; } }

/* Make grid less prominent now that we have a particle web */
[data-theme="dark"] .fx-grid {
  background-image:
    linear-gradient(to right, rgba(187,222,251,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(187,222,251,.08) 1px, transparent 1px);
}

/* ===================================================
   COVERAGE NETWORK MAP
   =================================================== */
.fx-map {
  position: relative;
  margin: 0 auto 36px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 28px;
  background:
    radial-gradient(60% 80% at 30% 60%, rgba(25,118,210,.18) 0%, transparent 70%),
    linear-gradient(180deg, rgba(20,40,64,.65), rgba(11,22,36,.85));
  overflow: hidden;
  aspect-ratio: 1200 / 520;
  max-height: 480px;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,.6);
}
.fx-map__svg {
  width: 100%; height: 100%;
  display: block;
}

/* Animated arc flow */
.fx-map .arc {
  stroke-dasharray: 6 10;
  stroke-dashoffset: 0;
  animation: fxArcFlow 6s linear infinite;
}
.fx-map .arc--live {
  stroke-dasharray: 4 8;
  animation: fxArcFlow 3.5s linear infinite, fxArcGlow 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(25,118,210,.7));
}
@keyframes fxArcFlow {
  to { stroke-dashoffset: -120; }
}
@keyframes fxArcGlow {
  0%, 100% { opacity: .65; }
  50%      { opacity: 1; }
}

/* Pins */
.fx-map .pin .pin__ring {
  fill: none;
  stroke: #1976D2;
  stroke-width: 1.5;
  opacity: .35;
  transform-origin: center;
  animation: fxPinPulse 2.4s ease-out infinite;
}
.fx-map .pin--queued .pin__ring {
  stroke: #BBDEFB;
  opacity: .25;
  animation-duration: 3.2s;
}
.fx-map .pin .pin__dot {
  fill: #1976D2;
  filter: drop-shadow(0 0 8px rgba(25,118,210,.85));
}
.fx-map .pin--queued .pin__dot { fill: #BBDEFB; filter: drop-shadow(0 0 6px rgba(187,222,251,.6)); }
.fx-map .pin .pin__label {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 14px;
  fill: #fff;
  letter-spacing: -0.005em;
}
.fx-map .pin--queued .pin__label { fill: #BBDEFB; opacity: .85; }
@keyframes fxPinPulse {
  0%   { transform: scale(.55); opacity: .55; }
  100% { transform: scale(1.6);  opacity: 0; }
}

.fx-map__legend {
  position: absolute;
  bottom: 18px; left: 22px;
  display: inline-flex; gap: 18px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #C9D3DD;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.fx-map__legend-item { display: inline-flex; align-items: center; gap: 8px; }
.fx-map__legend-item i {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.fx-map__legend-item i.is-live  {
  background: #1976D2;
  box-shadow: 0 0 0 3px rgba(25,118,210,.25), 0 0 10px rgba(25,118,210,.7);
}
.fx-map__legend-item i.is-queue { background: #BBDEFB; opacity: .7; }

/* ===================================================
   LIVE ACTIVITY FEED — bottom-left toast
   =================================================== */
.fx-feed {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 60;
  width: min(320px, calc(100vw - 44px));
  transform: translateY(140%) scale(.95);
  opacity: 0;
  transition: transform .55s cubic-bezier(.2,.9,.25,1.2), opacity .4s ease;
  pointer-events: none;
}
.fx-feed.is-on {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.fx-feed__inner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 12px;
  background: var(--t-surface);
  border: 1px solid var(--t-rule);
  border-radius: 16px;
  box-shadow: 0 18px 40px -16px rgba(13,27,42,.35), 0 0 0 1px rgba(25,118,210,.12);
}
[data-theme="dark"] .fx-feed__inner {
  box-shadow: 0 22px 40px -10px rgba(0,0,0,.7), 0 0 0 1px rgba(187,222,251,.06);
}
.fx-feed__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1976D2, #0D47A1);
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 auto;
  position: relative;
}
.fx-feed__avatar::after {
  content: "";
  position: absolute;
  right: -2px; bottom: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #2ee37b;
  border: 2px solid var(--t-surface);
  box-shadow: 0 0 6px rgba(46,227,123,.7);
}
.fx-feed__body { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.fx-feed__line {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--t-ink);
}
.fx-feed__meta {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--t-ink-mute);
}
@media (max-width: 540px) {
  /* on mobile the floating-CTA at bottom-right wins screen estate */
  .fx-feed { left: 14px; bottom: 86px; }
}

/* ===================================================
   Headline em — SOLID brand blue (foolproof).
   The gradient + background-clip:text approach was
   fragile across browsers when nested through the
   .fx-word child span scripts-fx.js creates, so we
   render it as a solid colour instead.
   =================================================== */
.fx-headline em,
.fx-headline em .fx-word {
  color: #1976D2 !important;
  background: none !important;
  -webkit-background-clip: initial !important;
          background-clip: initial !important;
  -webkit-text-fill-color: currentColor !important;
}
[data-theme="dark"] .fx-headline em,
[data-theme="dark"] .fx-headline em .fx-word {
  color: #6BB6FF !important;
}

/* ===================================================
   Reduced motion + small screen carve-outs
   =================================================== */
@media (prefers-reduced-motion: reduce) {
  .fx-map .arc, .fx-map .pin .pin__ring { animation: none !important; }
}

@media (max-width: 640px) {
  .fx-map { max-height: 360px; }
  .fx-map__legend { font-size: 10px; bottom: 12px; left: 14px; gap: 12px; }
  .fx-map .pin .pin__label { font-size: 11px; }
}
