/* =========================================================
   شرکت‌های ما — چیدمان مطابق طرح (کمان طلایی، شش پنل، هاب)
   داده و کلاس‌های nm-* همان نمودار فعلی است.
   ========================================================= */
:root {
  --nm-blue: #0e3d86;
  --nm-blue-deep: #082a62;
  --nm-blue-mid: #1a56b0;
  --nm-blue-soft: #7eb6f0;
  --nm-gold: #e2b34d;
  --nm-gold-deep: #c4922a;
  --nm-gold-soft: #f6e2a8;
  --nm-text: #123056;
  --nm-muted: #4d6484;
  --nm-white: #ffffff;
  --nm-ease: cubic-bezier(.22, 1, .36, 1);
}

.companies-page {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 18px 0 36px;
  color: var(--nm-text);
  background:
    radial-gradient(ellipse 48% 36% at 50% 46%, rgba(120, 176, 240, .34), transparent 68%),
    radial-gradient(ellipse 28% 22% at 8% 72%, rgba(255, 255, 255, .75), transparent 70%),
    radial-gradient(ellipse 26% 20% at 94% 18%, rgba(255, 255, 255, .7), transparent 72%),
    linear-gradient(180deg, #d7ebfb 0%, #eaf5fd 22%, #f7fbff 58%, #e4f2fc 100%);
}

.nm-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.nm-bg__wave {
  position: absolute;
  left: -4%;
  width: 108%;
  height: 180px;
}
.nm-bg__wave--top { top: -10px; height: 160px; }
.nm-bg__wave--bottom { bottom: -8px; height: 210px; }

.companies-page > .container {
  position: relative;
  z-index: 1;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: .78rem;
  color: var(--nm-muted);
  height: auto !important;
  width: auto !important;
  max-width: none !important;
  inset: auto !important;
  right: auto !important;
  left: auto !important;
  top: auto !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
}
.breadcrumb a { color: var(--nm-muted); transition: color .2s ease; }
.breadcrumb a:hover { color: var(--nm-blue); }
.breadcrumb span:last-child { color: var(--nm-blue); font-weight: 700; }

.companies-header {
  text-align: center;
  max-width: 760px;
  margin: 4px auto 22px;
}
.companies-header h1 {
  color: #102a56;
  font-size: clamp(1.45rem, 2.5vw, 2.05rem);
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -.02em;
  margin: 0 0 10px;
}
.companies-header p {
  color: #3e5678;
  font-size: .95rem;
  line-height: 1.95;
  text-align: center;
  margin: 0 auto;
  max-width: 680px;
}

.orgchart-image-wrap { text-align: center; margin: 12px 0 24px; }
.orgchart-image { width: 100%; max-width: 1400px; margin: 0 auto; border-radius: 12px; }

.orgchart-area {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 4px 0 8px;
}

.oc-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.nm-funds,
.nm-body,
.nm-subs {
  position: relative;
  z-index: 3;
}

/* ---- ردیف بالا: دایره‌ها روی کمان طلایی ---- */
.nm-funds {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 4px 18px;
  overflow: visible;
}
.nm-funds__group,
.nm-funds__chips { display: contents; }
.nm-group-label {
  display: none;
  margin: 0;
  padding: 0;
  font-size: .78rem;
  font-weight: 800;
  color: var(--nm-blue);
  text-align: center;
  line-height: 1.4;
}

.nm-fund {
  flex: 1 1 0;
  width: auto;
  max-width: 96px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  padding: 0;
  margin: 0;
}
.nm-fund--paydar {
  width: auto;
  max-width: 96px;
  margin: 0;
  order: 0;
  padding: 0;
}
.nm-fund--paydar .nm-fund__circle,
.nm-fund__circle {
  width: clamp(52px, 4.8vw, 72px);
  height: clamp(52px, 4.8vw, 72px);
}
.nm-fund--bus::after { display: none; }

.nm-fund__circle,
.nm-sub__circle,
.nm-co img {
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(20, 50, 100, .1);
  border: 1px solid #e6eef8;
}

.nm-fund__circle {
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  z-index: 4;
  transition: transform .28s var(--nm-ease), box-shadow .28s ease;
}
.nm-fund:hover .nm-fund__circle {
  transform: translateY(-2px);
  box-shadow: 0 8px 14px rgba(20, 50, 100, .14);
}
.nm-fund__circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 16%;
  transform: scale(1.22);
  transform-origin: center 18%;
}

/* نام‌ها زیر دایره و زیر سرتیتر بخش — نه شناور */
.nm-fund span,
.nm-co span,
.nm-sub > span {
  position: static;
  display: block;
  width: 100%;
  max-width: 92px;
  margin-top: 8px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #1a3a66;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
  z-index: 5;
  box-shadow: none;
  transform: none;
}
.nm-fund span { margin-top: 16px; }

/* ---- بدنه: سه پنل | هاب | سه پنل ---- */
.nm-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px) minmax(0, 1fr);
  gap: 0 18px;
  align-items: stretch;
}

.nm-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-height: 100%;
}

.nm-hub-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  position: relative;
  z-index: 4;
  width: 100%;
  padding-bottom: 36px;
}
.nm-hub-wrap::before {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 185, 255, .28) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.nm-hub-wrap::after { content: none; }

.nm-hub {
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  width: 228px;
  height: 228px;
  min-width: 228px;
  min-height: 228px;
  max-width: 228px;
  max-height: 228px;
  border-radius: 50%;
  border: 0;
  background:
    radial-gradient(circle at 42% 36%, #1d62c4 0%, #0d418f 46%, #071a44 100%);
  box-shadow:
    0 0 0 8px rgba(255, 244, 214, .72),
    0 0 0 14px rgba(255, 214, 120, .42),
    0 0 22px 4px rgba(255, 226, 150, .85),
    0 0 36px 8px rgba(90, 170, 255, .7),
    0 0 64px 16px rgba(40, 120, 255, .38),
    inset 0 0 30px rgba(8, 30, 80, .35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
  text-align: center;
  overflow: visible;
}
.nm-hub::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid rgba(190, 225, 255, .35);
  box-shadow:
    inset 0 0 24px rgba(120, 190, 255, .28),
    0 0 12px rgba(255, 255, 255, .25);
  pointer-events: none;
  z-index: 1;
}
.nm-hub::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 7px solid rgba(255, 232, 176, .42);
  box-shadow:
    0 0 16px rgba(255, 220, 140, .95),
    0 0 28px rgba(120, 190, 255, .55),
    inset 0 0 10px rgba(255, 255, 255, .65);
  pointer-events: none;
  z-index: 1;
}
.nm-flare {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .95) 0%, rgba(186, 224, 255, .72) 28%, rgba(80, 160, 255, 0) 70%);
  filter: blur(.4px);
  pointer-events: none;
  z-index: 6;
}
.nm-flare--n { top: -22px; left: 50%; transform: translateX(-50%); }
.nm-flare--e { right: -26px; top: 42%; }
.nm-flare--w { left: -26px; top: 42%; }
.nm-hub .hub-logo {
  position: relative;
  z-index: 2;
  width: 58%;
  max-width: 118px;
  max-height: 118px;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.nm-hub .hub-label,
#oc-hub-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.nm-hub-stand {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 210px;
  margin-top: 2px;
  pointer-events: none;
}
.nm-hub-stand span { display: block; border-radius: 50%; }
.nm-hub-stand span:nth-child(1) {
  width: 96px;
  height: 12px;
  background: linear-gradient(180deg, #fff7df, #e8c56a);
  box-shadow: 0 5px 0 #d7b15a;
}
.nm-hub-stand span:nth-child(2) {
  width: 150px;
  height: 14px;
  margin-top: 7px;
  background: #fff;
  border: 1px solid #e3eef8;
  box-shadow: 0 6px 0 #d5e4f5;
}
.nm-hub-stand span:nth-child(3) {
  width: 196px;
  height: 16px;
  margin-top: 8px;
  background: linear-gradient(180deg, #f7fbff, #d7e7f8);
  border: 1px solid #e7c56a;
  box-shadow: 0 10px 16px rgba(20, 50, 110, .1);
}

/* ---- پنل‌ها ---- */
.nm-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 118px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  position: relative;
  z-index: 3;
}
.nm-card__head {
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center !important;
  position: relative !important;
  top: auto !important;
  inset: auto !important;
  height: auto !important;
  width: auto;
  box-sizing: border-box;
  min-height: 44px;
  margin: 0 20px;
  padding: 9px 14px;
  border-radius: 16px;
  color: #fff !important;
  background: linear-gradient(180deg, #2a6ec8 0%, #123f86 58%, #0b316c 100%) !important;
  font-size: clamp(.74rem, .92vw, .86rem);
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(6, 24, 60, .2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .35),
    0 6px 12px rgba(16, 50, 110, .16);
  z-index: 4 !important;
  overflow: visible;
}
.nm-card__head::after { content: none; }
.nm-card__body {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 10px 12px;
  margin-top: -18px;
  padding: 30px 12px 14px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid #e5eef8;
  box-shadow: 0 8px 18px rgba(20, 50, 110, .05);
  min-height: 0;
  position: relative;
  z-index: 1;
}
.nm-card__body::before,
.nm-card__body::after {
  content: "";
  position: absolute;
  top: -13px;
  width: 20px;
  height: 28px;
  background: #fff;
  z-index: 0;
  pointer-events: none;
}
.nm-card__body::before {
  left: 0;
  border-radius: 16px 0 0 0;
  box-shadow: -1px -1px 0 rgba(255, 255, 255, .7);
}
.nm-card__body::after {
  right: 0;
  border-radius: 0 16px 0 0;
  box-shadow: 1px -1px 0 rgba(255, 255, 255, .7);
}
.nm-card__body--wide {
  flex-wrap: nowrap;
  justify-content: space-evenly;
  gap: 6px;
  padding-inline: 2px;
}
.nm-card__body--one { justify-content: center; }

.nm-co {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex-shrink: 0;
  position: relative;
}
.nm-co::before { display: none; }
.nm-card__body--wide .nm-co { width: auto; flex: 1 1 0; max-width: 72px; }

.nm-co img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  padding: 8px;
  position: relative;
  z-index: 4;
  transition: transform .28s var(--nm-ease), box-shadow .28s ease;
}
.nm-card__body--wide .nm-co img {
  width: clamp(42px, 3.6vw, 56px);
  height: clamp(42px, 3.6vw, 56px);
  padding: 7px;
}
.nm-co:hover img {
  transform: translateY(-2px) scale(1.05);
}

/* ---- پایین: دو گروه جدا، راهبر و دی ---- */
.nm-subs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px) minmax(0, 1fr);
  gap: 18px 18px;
  align-items: start;
  position: relative;
  z-index: 3;
  margin-top: 26px;
  padding: 0 0 12px;
  min-height: 0;
}
.nm-subs::before,
.nm-subs::after { content: none; }
.nm-subs__spacer { display: block; }
.nm-subs__col {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}
.nm-subs__group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 440px);
  padding: 12px 14px 22px;
  background: #fff;
  border: 1px solid #e5eef8;
  border-radius: 20px;
  box-shadow: 0 10px 20px rgba(20, 50, 110, .05);
  position: relative;
}
.nm-subs__group::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -10px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e7c56a;
  box-shadow: 0 6px 0 #e7f1fb;
}
.nm-subs .nm-group-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 0;
  padding: 6px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #2464b8, #0d3874);
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
  order: -1;
}
.nm-subs__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 12px 14px;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 2;
}
.nm-sub {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}
.nm-sub__circle {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  z-index: 4;
  font-size: .7rem;
  font-weight: 800;
  color: var(--nm-blue);
  transition: transform .28s var(--nm-ease);
}
.nm-sub:hover .nm-sub__circle { transform: translateY(-2px) scale(1.05); }
.nm-sub__circle img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

/* =========================================================
   موبایل
   ========================================================= */
@media (max-width: 980px) {
  .companies-page { padding-bottom: 48px; }
  .orgchart-area {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 12px;
  }
  .nm-funds,
  .nm-body,
  .nm-col,
  .nm-subs,
  .nm-subs__col {
    display: contents;
  }
  .nm-hub-wrap,
  .nm-funds__group,
  .nm-card,
  .nm-subs__group {
    order: var(--m-order, 100);
  }
  .nm-funds__group,
  .nm-subs__group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 12px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .9);
    background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(244, 249, 255, .78));
    box-shadow: 0 10px 22px rgba(20, 60, 120, .08);
  }
  .nm-funds__chips,
  .nm-subs__chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 12px;
    padding-top: 0;
  }
  .nm-group-label {
    display: block;
    order: -1;
    width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(14, 61, 134, .1);
    color: #0e3d86;
  }
  .nm-fund,
  .nm-fund--paydar {
    flex: 0 0 auto;
    width: 84px;
    max-width: none;
    margin: 0;
  }
  .nm-fund span,
  .nm-co span,
  .nm-sub > span {
    position: static;
    transform: none;
    opacity: 1;
    width: auto;
    max-width: 84px;
    margin-top: 6px;
    padding: 0;
    background: transparent;
    color: var(--nm-text);
    box-shadow: none;
    font-size: .68rem;
    font-weight: 700;
    pointer-events: auto;
  }
  .nm-card {
    flex: none;
    min-height: 0;
  }
  .nm-card__body,
  .nm-card__body--wide {
    flex-wrap: wrap;
    justify-content: center;
  }
  .nm-hub-wrap { padding: 8px 0 18px; }
  .nm-hub-wrap::before { width: 240px; height: 240px; }
  .nm-hub {
    width: 168px;
    height: 168px;
    min-width: 168px;
    min-height: 168px;
    max-width: 168px;
    max-height: 168px;
  }
  .nm-hub .hub-logo { max-width: 112px; max-height: 120px; }
  .nm-card__body::before,
  .nm-card__body::after { display: none; }
  .nm-hub-wrap::after { width: 220px; height: 220px; }
  .nm-hub-stand { width: 180px; margin-top: 4px; }
  .nm-hub-stand span:nth-child(1) { width: 90px; }
  .nm-hub-stand span:nth-child(2) { width: 126px; }
  .nm-hub-stand span:nth-child(3) { width: 164px; }
  .oc-svg { display: none; }
  .nm-subs::before,
  .nm-subs::after { display: none; }
  .companies-header h1 { font-size: clamp(1.25rem, 5.4vw, 1.7rem); }
  .companies-header p { font-size: .9rem; line-height: 1.75; }
}

/* ورود نرم — محتوا اگر اسکریپت نرسد پنهان نمی‌ماند */
.orgchart-area .nm-fund,
.orgchart-area .nm-card,
.orgchart-area .nm-hub,
.orgchart-area .nm-sub {
  animation: nmIn .55s var(--nm-ease) both;
}
@keyframes nmIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.orgchart-area.is-ready .nm-hub {
  animation: nmIn .55s var(--nm-ease) both, nmHubPulse 4.8s ease-in-out .7s infinite;
}
@keyframes nmHubPulse {
  0%, 100% {
    box-shadow:
      0 0 0 8px rgba(255, 244, 214, .7),
      0 0 0 14px rgba(255, 214, 120, .4),
      0 0 22px 4px rgba(255, 226, 150, .8),
      0 0 36px 8px rgba(90, 170, 255, .62);
  }
  50% {
    box-shadow:
      0 0 0 10px rgba(255, 248, 224, .85),
      0 0 0 18px rgba(255, 214, 120, .5),
      0 0 30px 8px rgba(255, 230, 160, .95),
      0 0 52px 14px rgba(90, 170, 255, .78);
  }
}
@media (prefers-reduced-motion: reduce) {
  .orgchart-area .nm-fund,
  .orgchart-area .nm-card,
  .orgchart-area .nm-hub,
  .orgchart-area .nm-sub,
  .orgchart-area.is-ready .nm-hub {
    animation: none !important;
  }
}
