/* Nextfit hero: "Software Development Digital Twin" (CSS 3D, no WebGL).
   Everything is laid out on a 1200×700 design canvas and scaled to the card with --s.
   Animations only touch transform / opacity and pause when the card is off-screen. */

.nx {
  --s: 1;
  --rise: #ff8a5b; /* the site's "new / rising" orange */
  --rise-soft: rgb(255 138 91 / .16);
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 700;
  margin: 4px 0 22px;
  border: 1px solid #1e2850;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(55% 45% at 58% 38%, rgb(90 110 255 / .14), transparent 70%),
    radial-gradient(120% 100% at 50% 40%, #0c1328 0%, #080c1b 70%);
  color: #eef2ff;
  font-family: var(--font, "Manrope", "IBM Plex Sans Arabic", system-ui, sans-serif);
  direction: ltr; /* the diagram doesn't mirror; Arabic text inside still reads right-to-left */
  isolation: isolate;
  contain: layout paint;
}
.nx-off { display: none; }
/* below the minWidth option the module adds .nx-off and renders nothing */
.nx-off { display: none; }

.nx-fit { position: absolute; left: 0; top: 0; width: 1200px; height: 700px; transform: scale(var(--s)); transform-origin: 0 0; }
.nx-persp { position: absolute; inset: 0; perspective: 2400px; perspective-origin: 52% 38%; }
.nx-world {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateY(-46px) rotateX(-11deg) rotateY(11deg) scale(.93);
  transform-origin: 640px 380px;
  animation: nx-in .7s ease-out backwards;  /* "backwards", not "both": once it ends the planes are drawn sharp again */
}

/* ---------- a 3D block: front + top + left side ---------- */
.nx-b {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
  transform: translateZ(var(--z));
  transition: transform .22s ease;
}
.nx-front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1.5px solid color-mix(in srgb, var(--c) 80%, #fff);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--c) 40%, #141b3a) 0%,
    #131a38 36%,
    #111834 72%,
    color-mix(in srgb, var(--c) 24%, #111834) 100%);
  box-shadow: 0 0 22px color-mix(in srgb, var(--c) 38%, transparent), inset 0 0 16px color-mix(in srgb, var(--c) 22%, transparent);
  color: #fff;
  cursor: pointer;
  outline: none;
}
.nx-top, .nx-side { position: absolute; left: 0; top: 0; pointer-events: none; }
.nx-top {
  width: 100%;
  height: var(--d);
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: linear-gradient(0deg, color-mix(in srgb, var(--c) 34%, #1a2350), #141b40);
}
.nx-side {
  width: var(--d);
  height: 100%;
  transform-origin: 0 50%;
  transform: rotateY(90deg);
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: linear-gradient(90deg, #0c1230, color-mix(in srgb, var(--c) 22%, #0f1536));
}
.nx-b[data-k]:hover, .nx-b[data-k]:focus-within { transform: translateZ(calc(var(--z) + 16px)); }
.nx-b[data-k]:hover .nx-front, .nx-front:focus-visible {
  border-color: #fff;
  box-shadow: 0 0 30px color-mix(in srgb, var(--c) 70%, transparent), inset 0 0 22px color-mix(in srgb, var(--c) 35%, transparent);
}

/* labels on the faces */
.nx-head { display: flex; align-items: center; gap: 10px; max-width: 100%; min-width: 0; padding: 0 6px; box-sizing: border-box; }
.nx-head > span:last-child, .nx-head .nx-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nx-ico { flex: none; }
.nx-ico { display: inline-grid; color: color-mix(in srgb, var(--c) 45%, #fff); }
.nx-ico svg { width: 30px; height: 30px; }
.nx-pink { color: #f47ad9; }
.nx-name { font-weight: 800; font-size: 19px; letter-spacing: -.01em; white-space: nowrap; text-shadow: 0 0 12px color-mix(in srgb, var(--c) 70%, transparent); }
.nx-meta { display: flex; align-items: center; gap: 8px; min-height: 14px; max-width: 100%; min-width: 0; padding: 0 8px; box-sizing: border-box; }
.nx-meta .nx-dots { flex: 0 1 auto; min-width: 8px; }
.nx-count { font: 700 12px/1 var(--mono, ui-monospace, Consolas, monospace); color: #cdd6ff; white-space: nowrap; }
.nx-count small { font: 600 10px/1 var(--font, system-ui); color: #8e9ad0; }
.nx-dots { /* one dot ≈ a doubling of repos: a quick "how full is this part" read */
  width: calc(var(--n) * 4px);
  max-width: 120px;
  height: 4px;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 55%, #fff) 1.1px, transparent 1.5px) 0 0 / 4px 4px repeat-x;
  opacity: .85;
}

.nx-b--xl .nx-ico svg { width: 34px; height: 34px; }
.nx-b--xl .nx-name { font-size: 25px; }
.nx-b--xl .nx-head { gap: 12px; }
.nx-b--xl .nx-front { flex-direction: column; }
.nx-b--xl .nx-front > .nx-head { margin-top: -2px; }
.nx-b--xl[data-k] .nx-head + .nx-meta { position: absolute; left: 14px; top: 9px; }
.nx-b--lg .nx-name { font-size: 16px; }
.nx-b--lg .nx-ico svg { width: 22px; height: 22px; }
.nx-b--lg .nx-head { gap: 6px; padding: 0 4px; }
.nx-b--md .nx-head { flex-direction: column; gap: 3px; }
.nx-b--md .nx-ico svg { width: 30px; height: 30px; }
.nx-b--md .nx-name { font-size: 16px; }
.nx-b--client .nx-ico svg { width: 30px; height: 30px; }
.nx-b--plate .nx-front { flex-direction: row; gap: 5px; padding: 0 6px; border-radius: 6px; cursor: pointer; }
.nx-b--plate .nx-name { font-size: 12px; font-weight: 700; }
.nx-b--plate em { font: 600 10px/1 var(--mono, monospace); font-style: normal; color: #aab6ee; }

.nx-badge {
  position: absolute;
  right: 14px;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 58px;
  height: 46px;
  border-radius: 8px;
  border: 1.5px solid #d3b4ff;
  background: linear-gradient(160deg, rgb(176 107 255 / .38), rgb(80 90 255 / .18));
  box-shadow: 0 0 14px rgb(176 107 255 / .55);
  color: #ead9ff;
}
.nx-badge svg { width: 44px; height: 36px; stroke-width: 1.4; }
.nx-svcs { display: flex; gap: 10px; margin-top: 4px; }
.nx-svcs i {
  font: 600 11.5px/1 var(--font, system-ui);
  font-style: normal;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgb(140 150 255 / .55);
  background: linear-gradient(180deg, rgb(70 84 170 / .55), rgb(36 46 104 / .55));
  white-space: nowrap;
}

/* ---------- rising this week: pulsing chips inside their component ---------- */
.nx-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: 100%; max-width: 100%; min-width: 0; padding: 0 4px; box-sizing: border-box; }
.nx-rise {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  max-width: min(132px, 100%);
  min-width: 0;
  box-sizing: border-box;
  padding: 0 8px 0 3px;
  border-radius: 999px;
  border: 1px solid rgb(255 138 91 / .75);
  background: var(--rise-soft);
  color: #fff;
  font: 700 11px/1 var(--font, system-ui);
  cursor: pointer;
}
.nx-rise b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-rise em { flex: none; font: 700 10px/1 var(--mono, monospace); font-style: normal; color: #ffb895; }
.nx-rise img, .nx-av { position: relative; width: 16px; height: 16px; border-radius: 50%; flex: none; }
.nx-av { display: grid; place-items: center; background: #ff8a5b; color: #1a0f08; font: 800 9px/1 var(--font, system-ui); }
.nx-rise:hover, .nx-rise:focus-visible { background: rgb(255 138 91 / .32); outline: none; }
.nx-ring {
  position: absolute;
  left: 3px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--rise);
  animation: nx-ring 1.8s ease-out infinite;
  pointer-events: none;
}
.nx-more { font: 700 11px/22px var(--font, system-ui); color: #ffb895; padding: 0 4px; }
/* the whole component breathes when something in it is rising */
.nx-b.is-rising .nx-front::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 2px solid var(--rise);
  box-shadow: 0 0 18px rgb(255 138 91 / .6);
  animation: nx-breathe 2.4s ease-in-out infinite;
  pointer-events: none;
}
.nx-ping { position: absolute; top: -5px; right: -5px; width: 11px; height: 11px; border-radius: 50%; background: var(--rise); box-shadow: 0 0 8px var(--rise); }
.nx-ping::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--rise); animation: nx-ring 1.8s ease-out infinite; }

/* ---------- scenery ---------- */
.nx-b--panel .nx-front { background: linear-gradient(180deg, #121a36, #0d1430); border-color: rgb(111 125 255 / .35); box-shadow: none; cursor: default; }
.nx-b--panel .nx-top, .nx-b--panel .nx-side { border-color: rgb(111 125 255 / .25); background: #10173a; }
.nx-b--base .nx-front, .nx-b--base2 .nx-front { border-radius: 4px; background: #141b3d; box-shadow: none; cursor: default; }
.nx-b--base .nx-front::after, .nx-b--base2 .nx-front::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -2px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #b06bff, #4c7dff 45%, #46c8ff);
  box-shadow: 0 0 14px #7a7dff, 0 0 4px #fff;
}
.nx-b--base .nx-top { background: linear-gradient(0deg, #1a2252, #10163a); border-color: rgb(111 125 255 / .35); }
.nx-b--base2 .nx-top { background: #0c1130; border-color: rgb(76 125 255 / .25); }
.nx-b--base2 .nx-front { background: #0e1434; border-color: rgb(76 125 255 / .5); }

.nx-wires, .nx-flows { position: absolute; left: 0; top: 0; width: 1200px; height: 700px; transform: translateZ(40px); pointer-events: none; overflow: visible; }
.nx-wires path { fill: none; stroke: #d6e2ff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nx-wires { filter: drop-shadow(0 0 3px #7d9dff); }
.nx-flow {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px 3px rgb(140 175 255 / .8);
  offset-rotate: 0deg;
  animation: nx-flow 2.6s linear infinite;
}

/* digital twin: wireframe copy of the stack */
.nx-twin { position: absolute; left: 150px; top: 70px; width: 240px; height: 520px; transform-style: preserve-3d; transform: translateZ(-210px) rotateY(16deg); pointer-events: none; }
.nx-grid {
  position: absolute;
  left: 0;
  top: 18px;
  width: 214px;
  height: 474px;
  overflow: hidden;
  border: 1px solid rgb(70 200 255 / .5);
  background-image: linear-gradient(rgb(70 200 255 / .2) 1px, transparent 1px), linear-gradient(90deg, rgb(70 200 255 / .2) 1px, transparent 1px);
  background-size: 21px 21px;
  transform: translateZ(-50px);
}
.nx-scan { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: #6fd8ff; box-shadow: 0 0 12px 2px #46c8ff; animation: nx-scan 4.5s linear infinite; }
.nx-w {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  border: 1.5px solid rgb(90 210 255 / .9);
  border-radius: 6px;
  background: rgb(70 200 255 / .07);
  box-shadow: 0 0 10px rgb(70 200 255 / .4), inset 0 0 10px rgb(70 200 255 / .15);
  animation: nx-shimmer 3s ease-in-out infinite;
}
.nx-w--sm { border-width: 1px; box-shadow: none; }
.nx-w--base { border-radius: 3px; }
.nx-up { position: absolute; left: var(--x); top: 60px; width: 2px; height: 46px; background: #6fd8ff; box-shadow: 0 0 6px #46c8ff; }
.nx-up::before { content: ""; position: absolute; left: -5px; top: -8px; border: 6px solid transparent; border-bottom: 9px solid #6fd8ff; border-top: 0; }

/* ---------- flat overlays ---------- */
.nx-title { position: absolute; left: 26px; top: 16px; margin: 0; display: flex; flex-direction: column; font-size: 34px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: #fff; text-shadow: 0 2px 16px rgb(0 0 0 / .6); pointer-events: none; }
.nx-life {
  position: absolute;
  left: 16px;
  top: 168px;
  width: 194px;
  padding: 10px;
  border-radius: 13px;
  border: 1.5px solid rgb(70 200 255 / .45);
  background: linear-gradient(180deg, rgb(20 30 64 / .9), rgb(12 18 40 / .9));
  box-shadow: 0 0 20px rgb(70 200 255 / .15);
}
.nx-life p { margin: 0 0 8px; font-size: 16px; font-weight: 800; }
.nx-life ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.nx-life li, .nx-infra li { position: relative; display: flex; align-items: center; cursor: pointer; outline: none; }
.nx-life li {
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid rgb(120 140 220 / .25);
  background: linear-gradient(90deg, rgb(40 54 104 / .7), rgb(26 36 74 / .55));
  font-size: 15px;
  font-weight: 700;
}
.nx-li-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 1.5px solid rgb(62 230 168 / .65); background: rgb(62 230 168 / .12); color: #3ee6a8; flex: none; }
.nx-li-ico svg { width: 17px; height: 17px; }
.nx-life li:nth-child(n+3) .nx-li-ico { border-color: rgb(70 200 255 / .65); background: rgb(70 200 255 / .12); color: #46c8ff; }
.nx-life li em, .nx-infra li em { margin-inline-start: auto; font: 600 11px/1 var(--mono, monospace); font-style: normal; color: #9eaae0; }
.nx-life li:hover, .nx-life li:focus-visible { border-color: #46c8ff; background: linear-gradient(90deg, rgb(52 70 140 / .85), rgb(30 42 90 / .7)); }
.nx-life li.is-rising, .nx-infra li.is-rising { border-color: rgb(255 138 91 / .7); }

.nx-infra {
  position: absolute;
  left: 110px;
  right: 110px;
  bottom: 10px;
  padding: 7px 18px 8px;
  border-radius: 16px;
  border: 1.5px solid rgb(140 120 255 / .55);
  background: linear-gradient(180deg, rgb(26 30 70 / .94), rgb(14 18 44 / .94));
  box-shadow: 0 0 24px rgb(140 100 255 / .3);
}
.nx-infra p { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.nx-infra p svg { width: 26px; height: 26px; color: #dfe6ff; }
.nx-infra p em { font: 600 11px/1 var(--mono, monospace); font-style: normal; color: #9eaae0; }
.nx-legend { margin-inline-start: auto; position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: #ffb895; }
.nx-legend .nx-ping { position: relative; top: 0; right: 0; width: 9px; height: 9px; }
.nx-infra ul { display: flex; justify-content: space-between; margin: 0; padding: 0 0 0 24px; list-style: none; }
.nx-infra li { gap: 7px; padding: 3px 8px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.nx-infra li + li::before { content: ""; position: absolute; left: -1px; top: 4px; bottom: 4px; width: 1px; background: rgb(140 150 220 / .3); }
.nx-infra li .nx-li-ico { width: auto; height: auto; border: 0; background: none; color: #6fb6ff; }
.nx-infra li .nx-li-ico svg { width: 22px; height: 22px; }
.nx-infra li em { margin-inline-start: 2px; }
.nx-infra li:hover, .nx-infra li:focus-visible { border-color: rgb(140 150 255 / .5); background: rgb(80 90 180 / .2); }
:root[lang="ar"] .nx-life, :root[lang="ar"] .nx-infra, :root[lang="ar"] .nx-title { direction: rtl; }

/* ---------- hover card ---------- */
.nx-tip { /* on <body>, fixed, placed beside the hovered component */
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  font-family: var(--font, "Manrope", "IBM Plex Sans Arabic", system-ui, sans-serif);
  line-height: 1.3;
  width: 290px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #2f3d7c;
  background: rgb(13 19 42 / .97);
  box-shadow: 0 18px 44px rgb(0 0 0 / .55);
  color: #e8edff;
  font-size: 12px;
}
.nx-tip[hidden] { display: none; }
.nx-tip-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; }
.nx-tip-h svg { width: 18px; height: 18px; color: #8fb0ff; }
.nx-tip-h em { margin-inline-start: auto; font: 600 11px/1 var(--mono, monospace); font-style: normal; color: #9eaae0; }
.nx-tip-s { margin: 8px 0 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8e9ad0; }
.nx-tip-s--rise { color: #ffb895; }
:root[lang="ar"] .nx-tip { direction: rtl; }
:root[lang="ar"] .nx-tip-s { letter-spacing: 0; }
.nx-tip-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  text-align: start;
  cursor: pointer;
  font: inherit;
}
.nx-tip-row:hover, .nx-tip-row:focus-visible { background: rgb(90 110 220 / .18); outline: none; }
.nx-tip-row img, .nx-tip-row .nx-av { width: 24px; height: 24px; border-radius: 6px; flex: none; }
.nx-tip-row .nx-av { background: #2a3770; color: #fff; font-size: 11px; }
.nx-ring--row { left: 6px; top: 50%; width: 24px; height: 24px; margin-top: -12px; border-radius: 7px; }
.nx-tip-txt { display: grid; min-width: 0; }
.nx-tip-txt b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-tip-txt small { color: #a8b3dd; font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nx-tip-row em { margin-inline-start: auto; font: 700 10.5px/1 var(--mono, monospace); font-style: normal; color: #ffb895; white-space: nowrap; }
.nx-tip-top { padding: 6px; color: #8e9ad0; }
.nx-tip-more { margin: 0; padding: 2px 6px 0; font-size: 11px; font-weight: 700; color: #ffb895; }
.nx-tip-all { margin-top: 6px; width: 100%; padding: 7px; border-radius: 8px; border: 1px solid #3a4a94; background: rgb(76 125 255 / .16); color: #cfe0ff; font: 700 12px var(--font, system-ui); cursor: pointer; }
.nx-tip-all:hover { background: rgb(76 125 255 / .3); }

/* ---------- motion ---------- */
@keyframes nx-in { from { opacity: 0; transform: translateY(-30px) rotateX(-11deg) rotateY(11deg) scale(.93); } }
@keyframes nx-ring { from { transform: scale(.7); opacity: .95; } to { transform: scale(2.3); opacity: 0; } }
@keyframes nx-breathe { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes nx-flow { 0% { offset-distance: 0%; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
@keyframes nx-scan { from { transform: translateY(0); } to { transform: translateY(470px); } }
@keyframes nx-shimmer { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
.nx-paused * { animation-play-state: paused !important; }
.nx-paused .nx-world { animation-play-state: running !important; }  /* the intro always finishes, or the map would stay hidden */
@media (prefers-reduced-motion: reduce) {
  .nx *, .nx *::before, .nx *::after { animation: none !important; transition: none !important; }
  .nx-b.is-rising .nx-front::after { opacity: 1; }
}
