:root{
  --nx-accent:#3b0a63;
  --nx-ink:#111;
  --nx-card:#fff;
  --nx-border:rgba(0,0,0,.06);
  --nx-shadow:0 18px 60px rgba(0,0,0,.08);
  --nx-meta-max:120px;
}

/* GRID */
.nx-team-grid{display:grid;gap:28px;}
.nx-team-grid.nx-cols-1{grid-template-columns:1fr}
.nx-team-grid.nx-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.nx-team-grid.nx-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.nx-team-grid.nx-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:980px){
  .nx-team-grid.nx-cols-3,.nx-team-grid.nx-cols-4{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:640px){
  .nx-team-grid.nx-cols-2,.nx-team-grid.nx-cols-3,.nx-team-grid.nx-cols-4{grid-template-columns:1fr}
}

/* ICONS */
.nx-ico{
  width:18px;
  height:18px;
  display:block;
  fill:currentColor;
}

/* CARD */
.nx-team-card{
  background:var(--nx-card);
  border:1px solid var(--nx-border);
  box-shadow:var(--nx-shadow);
  overflow:hidden;
  transition:transform .25s ease, background .25s ease;
}
.nx-team-card__hit{
  width:100%;
  cursor:pointer;
  display:block;
  position:relative;
}
.nx-team-photo{padding:28px 28px 0}
.nx-team-photo img{display:block;width:100%;height:auto}

.nx-name{
  margin:18px 18px 0;
  text-align:center;
  font-size:28px;
  line-height:1.15;
  color:var(--nx-ink);
  transition:color .25s ease;
}
.nx-cta{
  margin:10px 18px 0;
  text-align:center;
  font-size:22px;
  font-style:italic;
  font-weight:700;
  color:var(--nx-ink);
  transition:color .25s ease;
}
.nx-role{
  margin:6px 18px 0;
  text-align:center;
  font-size:13px;
  opacity:.72;
  color:var(--nx-ink);
  transition:color .25s ease, opacity .25s ease;
}

/* META with icons + scroll if long */
.nx-meta{
  margin:18px 18px 0;
  padding:0 6px 8px;
  max-height:var(--nx-meta-max);
  overflow:auto;
  text-align:left;
  color:var(--nx-ink);
  transition:color .25s ease;
  scrollbar-width:thin;
}
.nx-meta-row{
  display:flex;
  align-items:flex-start;
  gap:10px;
  font-size:16px;
  line-height:1.35;
  padding:5px 0;
}
.nx-meta-ico{
  flex:0 0 auto;
  opacity:.9;
  margin-top:1px;
}
.nx-meta-text{
  word-break:break-word;
  overflow-wrap:anywhere;
}

/* ACTION ICONS (appear on hover) */
.nx-actions{
  display:flex;
  justify-content:center;
  gap:14px;
  margin:10px 0 26px;
  opacity:0;
  transform:translateY(8px);
  transition:opacity .25s ease, transform .25s ease;
}
.nx-action{
  width:40px;height:40px;
  border-radius:50%;
  display:grid;
  place-items:center;
  text-decoration:none;
  background:rgba(255,255,255,.20);
  border:1px solid rgba(255,255,255,.22);
  color:#fff;
}

/* “no bio” badge */
.nx-nobio{
  margin:12px 18px 20px;
  text-align:center;
  font-size:12px;
  opacity:.7;
}

/* HOVER */
.nx-team-card:hover{
  background:var(--nx-accent);
  transform:translateY(-6px);
}
.nx-team-card:hover .nx-name,
.nx-team-card:hover .nx-cta,
.nx-team-card:hover .nx-role,
.nx-team-card:hover .nx-meta{
  color:#fff;
}
.nx-team-card:hover .nx-role{opacity:.92}
.nx-team-card:hover .nx-actions{
  opacity:1;
  transform:translateY(0);
}

/* MODAL */
.nx-modal{display:none}
.nx-modal.is-open{display:block}

.nx-modal__overlay{
  position:fixed;inset:0;
  background:rgba(0,0,0,.55);
  z-index:99998;
}

/* Desktop dialog */
.nx-modal__dialog{
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(980px, calc(100vw - 36px));
  max-height:calc(100vh - 36px);
  background:#fff;
  z-index:99999;
  box-shadow:0 40px 120px rgba(0,0,0,.35);
  border-radius:12px;
  overflow:hidden; /* desktop OK */
}

.nx-modal__close{
  position:absolute;
  top:12px;right:12px;
  width:40px;height:40px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  cursor:pointer;
  z-index:2;
}

.nx-modal__body{
  display:grid;
  grid-template-columns: 420px 1fr;
  height:100%;
}

.nx-modal__image{
  background:#f3f3f3;
  padding:22px;
  display:flex;
  align-items:flex-start;
  justify-content:center;
}
.nx-modal__image img{
  width:100%;
  height:auto;
  display:block;
}

.nx-modal__content{
  padding:22px;
  overflow:auto;
  max-height:calc(100vh - 36px);
  scrollbar-width:thin;
  -webkit-overflow-scrolling: touch;
}

.nx-modal__name{
  margin:0 0 6px 0;
  font-size:26px;
  line-height:1.2;
}
.nx-modal__role{
  opacity:.75;
  margin-bottom:14px;
}

/* contact rows with icons */
.nx-modal__contact{
  font-size:14px;
  opacity:.9;
  line-height:1.6;
  margin-bottom:14px;
  display:grid;
  gap:8px;
}
.nx-modal-row{
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.nx-modal-ico{
  margin-top:2px;
  opacity:.85;
}
.nx-modal-rowtext{
  overflow-wrap:anywhere;
  word-break:break-word;
}

.nx-modal-link{
  color:#111;
  text-decoration:underline;
}

/* BIO formatting */
.nx-modal__bio{
  font-size:15px;
  line-height:1.75;
}
.nx-modal__bio p{margin:0 0 12px 0}
.nx-modal__bio h2,.nx-modal__bio h3,.nx-modal__bio h4{margin:12px 0 8px}
.nx-modal__bio ul,.nx-modal__bio ol{margin:0 0 12px 18px}

/* ============================
   MOBILE FIX (FULLY SCROLLABLE + NO IMAGE CUT)
   - remove translate centering (causes cut)
   - use inset box (safe height)
   - image stays visible (contain)
   - content is reachable (scroll dialog)
   ============================ */
@media (max-width: 860px){
  .nx-modal__dialog{
    left:18px;
    right:18px;
    top:18px;
    bottom:18px;
    width:auto;
    max-height:none;
    transform:none;
    overflow:auto;                 /* allow full scroll */
    -webkit-overflow-scrolling:touch;
    border-radius:14px;
  }

  .nx-modal__body{
    display:flex;
    flex-direction:column;
    height:auto;
  }

  .nx-modal__image{
    padding:14px;
    align-items:center;
    justify-content:center;
  }

  /* IMPORTANT: contain to avoid cutting */
  .nx-modal__image img{
    width:100%;
    height:auto;
    max-height:38vh;               /* keeps image visible without stealing all height */
    object-fit:contain;            /* no crop */
  }

  .nx-modal__content{
    overflow:visible;              /* dialog scrolls instead */
    max-height:none;
    padding:16px 16px 22px;
  }
}
