/* ====== قسم فريقنا — سلايدر بطاقات مع Hover Animation مخصص لكل منصب ====== */
.team {
  padding-block: var(--space-7);
  background: var(--color-white);
  overflow: hidden;
}

.team-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  text-align: start;
  max-width: none;
  margin: 0 0 var(--space-5);
}
.team-header > div { max-width: 620px; }

.team-nav { display: flex; gap: 10px; flex-shrink: 0; }
.team-nav button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-gray-200);
  background: var(--color-white);
  color: var(--color-gray-900);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.team-nav button:hover { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-black); }
.team-nav button svg { width: 18px; height: 18px; }

.team-grid-wrap { position: relative; }

/* ====== شريط السلايدر ====== */
.team-grid {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.team-grid::-webkit-scrollbar { display: none; }

/* ====== بطاقة عضو الفريق ====== */
.team-item {
  scroll-snap-align: start;
  flex: 0 0 calc((100% - (var(--space-3) * 4.5)) / 5.5);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  opacity: 0.65;
  transform: scale(0.98);
  transition: opacity var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard);
}
.team-item.is-active { opacity: 1; transform: scale(1); }
@media (hover: hover) and (pointer: fine) {
  .team-item:hover { border-color: var(--color-gray-900); box-shadow: var(--shadow-sm); }
}

/* ====== إطار الصورة + المعلومات — خلفية رمادية موحّدة بلا فراغ ====== */
.team-visual {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-gray-100);
}

.team-photo {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 0.6;
  overflow: hidden;
}
.team-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform var(--duration-slow) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .team-item:hover .team-photo img { transform: scale(1.04); }
}

.team-info {
  position: relative;
  z-index: 2;
  padding: 4px 10px 12px;
}
.team-name { font-size: 15.5px; font-weight: 700; color: var(--color-black); margin: 0 0 2px; }
.team-role { display: block; font-size: 12px; font-weight: 700; color: var(--color-primary-dark); margin-bottom: 6px; }
.team-bio {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--color-gray-500);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ====== طبقة الـ Hover Animation المشتركة ====== */
.role-fx {
  position: absolute;
  top: 0; left: 0; right: 0;
  aspect-ratio: 0.6;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-standard);
}
@media (hover: hover) and (pointer: fine) {
  .team-item:hover .role-fx { opacity: 1; }
}
.team-item.is-fx-active .role-fx { opacity: 1; }

/* --- UI/UX Designer: شبكة + مؤشر + بلوكات لون --- */
.role-fx-design .fx-grid {
  position: absolute; inset: 10%;
  background-image:
    linear-gradient(var(--color-gray-200) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-gray-200) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.6;
}
.role-fx-design .fx-block {
  position: absolute; width: 26px; height: 26px; border-radius: 6px;
  transform: translateY(6px); opacity: 0;
  transition: transform var(--duration-slow) var(--ease-out), opacity var(--duration-slow) var(--ease-out);
}
.role-fx-design .b1 { top: 14%; right: 12%; background: var(--color-primary); transition-delay: 60ms; }
.role-fx-design .b2 { bottom: 16%; left: 14%; background: var(--color-black); transition-delay: 140ms; }
.team-item:hover .role-fx-design .fx-block,
.team-item.is-fx-active .role-fx-design .fx-block { transform: translateY(0); opacity: 1; }
.role-fx-design .fx-cursor {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: var(--color-primary-dark); top: 30%; left: 28%;
  animation: fxCursorMove 3.2s var(--ease-standard) infinite;
}
@keyframes fxCursorMove {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(30px, 14px); }
  60% { transform: translate(10px, 34px); }
}

/* --- Flutter/Mobile: إطار هاتف + نبض + أيقونات --- */
.role-fx-mobile .fx-phone {
  position: absolute; width: 46px; height: 78px; border-radius: 10px;
  border: 2px solid var(--color-gray-200); top: 10%; right: 10%;
  transform: translateY(6px); opacity: 0;
  transition: transform var(--duration-slow) var(--ease-out), opacity var(--duration-slow) var(--ease-out);
}
.team-item:hover .role-fx-mobile .fx-phone,
.team-item.is-fx-active .role-fx-mobile .fx-phone { transform: translateY(0); opacity: 1; }
.role-fx-mobile .fx-pulse {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: var(--color-primary); top: 16%; right: 20%;
  animation: fxPulse 2.4s var(--ease-standard) infinite;
}
@keyframes fxPulse {
  0% { transform: scale(0.7); opacity: 0.9; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { opacity: 0; }
}
.role-fx-mobile .fx-icon {
  position: absolute; width: 16px; height: 16px; border-radius: 4px;
  opacity: 0; transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
  transform: translateX(-6px);
}
.role-fx-mobile .i1 { bottom: 22%; left: 16%; background: var(--color-black); transition-delay: 80ms; }
.role-fx-mobile .i2 { bottom: 32%; left: 34%; background: var(--color-primary-dark); transition-delay: 160ms; }
.team-item:hover .role-fx-mobile .fx-icon,
.team-item.is-fx-active .role-fx-mobile .fx-icon { opacity: 1; transform: translateX(0); }

/* --- Backend: عقد بيانات متصلة + وسم كود --- */
.role-fx-backend .fx-node {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-primary-dark); opacity: 0;
  transition: opacity var(--duration-base) var(--ease-standard);
}
.role-fx-backend .n1 { top: 18%; left: 20%; animation: fxDrift 4s ease-in-out infinite; }
.role-fx-backend .n2 { top: 38%; left: 60%; animation: fxDrift 4.6s ease-in-out infinite 0.4s; }
.role-fx-backend .n3 { top: 60%; left: 30%; animation: fxDrift 3.6s ease-in-out infinite 0.8s; }
@keyframes fxDrift {
  0%, 100% { transform: translate(0,0); }
  50% { transform: translate(6px, -6px); }
}
.role-fx-backend .fx-line {
  position: absolute; height: 1.5px; background: var(--color-gray-200);
  opacity: 0; transform: scaleX(0); transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
}
.role-fx-backend .l1 { top: 24%; left: 22%; width: 44%; transform-origin: left; }
.role-fx-backend .l2 { top: 46%; left: 32%; width: 34%; transform-origin: left; transition-delay: 90ms; }
.team-item:hover .role-fx-backend .fx-node,
.team-item.is-fx-active .role-fx-backend .fx-node { opacity: 1; }
.team-item:hover .role-fx-backend .fx-line,
.team-item.is-fx-active .role-fx-backend .fx-line { opacity: 1; transform: scaleX(1); }
.role-fx-backend .fx-tag {
  position: absolute; bottom: 14%; right: 12%;
  font-family: var(--font-serif-display); font-weight: 700; font-size: 13px;
  color: var(--color-gray-200); opacity: 0; transition: opacity var(--duration-slow) var(--ease-out);
}
.team-item:hover .role-fx-backend .fx-tag,
.team-item.is-fx-active .role-fx-backend .fx-tag { opacity: 1; }

/* --- Software Developer: أقواس كود + نقاط --- */
.role-fx-software .fx-bracket {
  position: absolute; font-family: var(--font-serif-display); font-weight: 700;
  font-size: 40px; color: var(--color-gray-200); opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
}
.role-fx-software .left { top: 12%; left: 10%; transform: translateX(6px); }
.role-fx-software .right { bottom: 10%; right: 10%; transform: translateX(-6px); transition-delay: 80ms; }
.team-item:hover .role-fx-software .fx-bracket,
.team-item.is-fx-active .role-fx-software .fx-bracket { opacity: 1; transform: translateX(0); }
.role-fx-software .fx-dot { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--color-primary); opacity: 0; }
.role-fx-software .d1 { top: 45%; left: 30%; animation: fxBlink 1.8s ease-in-out infinite; }
.role-fx-software .d2 { top: 45%; left: 42%; animation: fxBlink 1.8s ease-in-out infinite 0.2s; }
.role-fx-software .d3 { top: 45%; left: 54%; animation: fxBlink 1.8s ease-in-out infinite 0.4s; }
@keyframes fxBlink { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.team-item:hover .role-fx-software .fx-dot,
.team-item.is-fx-active .role-fx-software .fx-dot { animation-play-state: running; }

/* --- Accounts Manager: فقاعات تواصل + خط اتصال --- */
.role-fx-accounts .fx-bubble {
  position: absolute; border-radius: var(--radius-full);
  background: var(--color-gray-100); border: 1.5px solid var(--color-gray-200);
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
}
.role-fx-accounts .b1 { width: 30px; height: 20px; top: 14%; right: 14%; }
.role-fx-accounts .b2 { width: 22px; height: 16px; top: 26%; right: 30%; transition-delay: 100ms; }
.team-item:hover .role-fx-accounts .fx-bubble,
.team-item.is-fx-active .role-fx-accounts .fx-bubble { opacity: 1; transform: translateY(0); }
.role-fx-accounts .fx-dotline {
  position: absolute; bottom: 18%; left: 14%; width: 46%; height: 1.5px;
  background-image: linear-gradient(90deg, var(--color-primary) 50%, transparent 50%);
  background-size: 8px 1.5px;
  opacity: 0; transform: scaleX(0); transform-origin: left;
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
  transition-delay: 120ms;
}
.team-item:hover .role-fx-accounts .fx-dotline,
.team-item.is-fx-active .role-fx-accounts .fx-dotline { opacity: 1; transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .role-fx * { animation: none !important; }
}

/* ====== استجابة الموبايل ====== */
@media (max-width: 720px) {
  .team-header { flex-direction: column; align-items: stretch; gap: var(--space-2); }
  .team-header > div { text-align: center; margin-inline: auto; }
  .team-nav { justify-content: center; }

  .team-grid { gap: var(--space-2); }
  .team-item { flex-basis: calc((100% - (var(--space-2) * 1.4)) / 2.4); padding: 6px; }
  .team-name { font-size: 13.5px; }
  .team-role { font-size: 10.5px; margin-bottom: 4px; }
  .team-bio { -webkit-line-clamp: 1; font-size: 11px; }
  .team-info { padding: 4px 6px 8px; }
}

@media (max-width: 480px) {
  .team { padding-block: var(--space-6); }
}
