/* =========================================================
   SECURE TEAM PROFILES – FRONTEND CSS (List + Popup)
   v1.3.1 – Popup true center fix (safe)
========================================================= */
:root{
  --stp-accent:#7fb300;
  --stp-dark:#111;
  --stp-muted:rgba(0,0,0,0.65);
  --stp-shadow:0 18px 40px rgba(0,0,0,0.15);
}

/* Grid */
.stp-wrap{width:100%;}
.stp-grid{display:grid;gap:30px;align-items:start;}

/* Card */
.stp-card{
  text-align:center;
  cursor:pointer;
  padding:10px 8px;
  border-radius:16px;
  transition:transform .35s ease, box-shadow .35s ease;
}
.stp-card:hover{transform:translateY(-6px);box-shadow:var(--stp-shadow);}
.stp-card:focus-visible{outline:3px solid rgba(127,179,0,0.35);outline-offset:6px;}

/* Circle image */
.stp-avatar{
  width:220px;max-width:90%;
  aspect-ratio:1/1;
  margin:0 auto 18px;
  border-radius:999px;
  overflow:hidden;
  background:#f2f2f2;
}
.stp-avatar img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .45s ease;}
.stp-card:hover .stp-avatar img{transform:scale(1.06);}

/* Name reduced */
.stp-name{
  margin:0 0 6px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--stp-dark);
  font-size:26px;
  line-height:1.15;
}

/* Designation Title Case */
.stp-role{
  margin:0;
  color:var(--stp-accent);
  font-weight:600;
  font-size:18px;
  letter-spacing:.02em;
  text-transform:capitalize;
}

/* Responsive */
@media (max-width:980px){
  .stp-avatar{width:190px;}
  .stp-name{font-size:24px;}
  .stp-role{font-size:17px;}
  .stp-grid{gap:22px;}
}
@media (max-width:640px){
  .stp-avatar{width:170px;}
  .stp-name{font-size:22px;}
  .stp-role{font-size:16px;}
}

/* Backdrop (kept hidden until .is-open is added by JS) */
.stp-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:999999;
}
.stp-modal-backdrop.is-open{display:flex;}

/* Host simply centers its child */
#stp-modal-host{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Modal */
.stp-modal{
  width:min(980px,100%);
  background:#fff;
  border-radius:6px;
  box-shadow:0 22px 60px rgba(0,0,0,0.25);
  overflow:hidden;
  position:relative;
}

/* TRUE CENTER FIX:
   Force the visible modal to be viewport-centered regardless of page/container layout.
   (Works only when backdrop is open.)
*/
.stp-modal-backdrop.is-open .stp-modal{
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  margin:0;
  width:min(980px, calc(100% - 36px));
  max-height:calc(100vh - 36px);
}

/* Close button */
.stp-modal-close{
  position:absolute;top:10px;right:12px;
  width:38px;height:38px;
  border:0;background:transparent;
  cursor:pointer;
  color:rgba(0,0,0,0.55);
  border-radius:6px;
  display:flex;align-items:center;justify-content:center;
}
.stp-modal-close:hover{background:rgba(0,0,0,0.06);color:rgba(0,0,0,0.75);}
.stp-modal-close svg{width:22px;height:22px;fill:currentColor;}

/* Modal layout like reference */
.stp-modal-grid{display:grid;grid-template-columns:42% 58%;min-height:340px;}
.stp-modal-photo{background:#eaeaea;min-height:340px;overflow:hidden;}
.stp-modal-photo img{width:100%;height:100%;object-fit:cover;display:block;}
.stp-modal-body{padding:26px;}
.stp-modal-name{margin:0 0 4px;font-size:28px;font-weight:800;color:var(--stp-dark);}
.stp-modal-role{margin:0 0 14px;font-size:15px;color:rgba(0,0,0,0.55);font-weight:600;text-transform:capitalize;}
.stp-modal-text{font-size:14px;line-height:1.7;color:var(--stp-muted);}

/* Buttons */
.stp-btnrow{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0 14px;}
.stp-btn{
  padding:10px 14px;border-radius:4px;
  font-size:13px;font-weight:700;text-decoration:none;
  border:1px solid rgba(0,0,0,0.12);
  color:#111;background:#fff;
  display:inline-flex;align-items:center;justify-content:center;
}
.stp-btn:hover{background:rgba(0,0,0,0.04);}
.stp-btn.primary{background:var(--stp-accent);border-color:var(--stp-accent);color:#fff;}
.stp-btn.primary:hover{filter:brightness(.95);}

/* Social */
.stp-social{display:flex;gap:10px;margin-top:8px;}
.stp-social a{width:42px;height:42px;display:flex;align-items:center;justify-content:center;color:#fff;text-decoration:none;}
.stp-social a svg{width:18px;height:18px;fill:currentColor;}
.stp-s-facebook{background:#3b5998;}
.stp-s-twitter{background:#1da1f2;}
.stp-s-linkedin{background:#0077b5;}
.stp-s-instagram{background:#e1306c;}

/* Modal responsive */
@media (max-width:820px){
  .stp-modal-grid{grid-template-columns:1fr;}
  .stp-modal-photo{min-height:240px;}
  .stp-modal-body{padding:18px 16px;}
  .stp-modal-name{font-size:24px;}
}

/* If content is long, allow scrolling inside popup body */
.stp-modal-backdrop.is-open .stp-modal-body{
  overflow:auto;
  max-height:calc(100vh - 36px - 52px); /* leave room for padding/header */
}


/* =========================================================
   MOBILE FIXES (Popup + Grid)
   - On small screens, center-translate causes popup to go off-screen.
   - Use top-aligned fixed popup with internal scrolling.
========================================================= */
@media (max-width: 640px){
  .stp-modal-backdrop.is-open{
    align-items:flex-start;
    padding:12px;
  }
  .stp-modal-backdrop.is-open .stp-modal{
    top:12px;
    left:50%;
    transform:translateX(-50%);
    width:calc(100% - 24px);
    max-height:calc(100vh - 24px);
  }
  .stp-modal-photo{
    min-height:220px;
  }
  .stp-modal-body{
    padding:14px 14px 16px;
  }
  .stp-btn{
    width:100%;
  }
  .stp-btnrow{
    gap:8px;
  }
  .stp-social a{
    width:40px;height:40px;
  }
}


/* =========================================================
   FIX: MOBILE GRID (avoid overlap)
========================================================= */
@media (max-width: 820px){
  /* Force 2 columns on tablet */
  .stp-grid{grid-template-columns:repeat(2, minmax(0,1fr)) !important;}
  .stp-name{font-size:20px;}
  .stp-role{font-size:15px;}
}
@media (max-width: 540px){
  /* Force 1 column on phones */
  .stp-grid{grid-template-columns:1fr !important;}
  .stp-avatar{width:150px;}
  .stp-name{font-size:22px;letter-spacing:.04em;}
  .stp-role{font-size:16px;}
}

/* =========================================================
   FIX: MOBILE POPUP (scroll + close button)
========================================================= */
@media (max-width: 640px){
  /* Make modal use almost full height, scroll inside body */
  .stp-modal-backdrop.is-open{
    align-items:flex-start;
    padding:12px;
  }

  .stp-modal-backdrop.is-open .stp-modal{
    position:fixed;
    top:12px;
    left:50%;
    transform:translateX(-50%);
    width:calc(100% - 24px);
    height:calc(100vh - 24px);
    max-height:calc(100vh - 24px);
    overflow:hidden;
  }

  .stp-modal-grid{
    grid-template-columns:1fr;
    grid-template-rows:220px 1fr;
    min-height:0;
    height:100%;
  }

  .stp-modal-photo{
    min-height:220px;
    height:220px;
  }

  .stp-modal-body{
    padding:14px 14px 16px;
    overflow:auto;
    -webkit-overflow-scrolling:touch;
    max-height:none;
  }

  .stp-btn{width:100%;}
  .stp-btnrow{gap:8px;}
}

/* Ensure close button always clickable */
.stp-modal-close{
  z-index: 50;
  touch-action: manipulation;
}
