/* ========== GRID & MEMBER STYLING ========== */
.tbm-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.tbm-member {
  text-align: center;
  cursor: pointer;
  width: 200px;
  transition: transform 0.2s ease;
}

.tbm-member img {
  width: 200px;
  border-radius: 8px;
  height: auto;
}

.tbm-member:hover img {
  transform: scale(1.05);
}

.tbm-member h3 {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}

.tbm-member p {
  margin: 0;
  color: #555;
}

/* Section title */
.tbm-section-title {
  text-align: center;
  font-size: 1.4rem;
  margin: 3rem 0 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== BOARD GRID (Centered Rows) ===== */
.tbm-grid.tbm-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* centers final row */
  gap: 2rem;
}

.tbm-grid.tbm-board .tbm-member {
  flex: 0 1 200px;
  text-align: center;
}

/* ===== CONSULTANTS GRID (Centered Rows) ===== */
.tbm-grid.tbm-consultant {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.tbm-grid.tbm-consultant .tbm-member {
  flex: 0 1 140px;
  text-align: center;
}

.tbm-grid.tbm-consultant .tbm-member img {
  width: 140px;
}

.tbm-grid.tbm-consultant .tbm-member h3 {
  font-size: 1rem;
}

/* Responsive adjustments */
@media (max-width: 1100px) {
  .tbm-grid.tbm-board .tbm-member { flex: 0 1 180px; }
  .tbm-grid.tbm-consultant .tbm-member { flex: 0 1 130px; }
}

@media (max-width: 800px) {
  .tbm-grid.tbm-board .tbm-member { flex: 0 1 160px; }
  .tbm-grid.tbm-consultant .tbm-member { flex: 0 1 120px; }
}

@media (max-width: 560px) {
  .tbm-grid.tbm-board .tbm-member { flex: 0 1 100%; }
  .tbm-grid.tbm-consultant .tbm-member { flex: 0 1 45%; }
}

/* ========== MODAL STYLING ========== */
.tbm-modal {
  display: none;
  position: fixed;
  inset: 0; /* shorthand for top, right, bottom, left = 0 */
  z-index: 2147483647; /* ensures it's above all elements */
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  overflow-y: auto; /* scroll inside modal if long */
  isolation: isolate; /* breaks free of theme stacking contexts */
}

/* --- Modal content container --- */
.tbm-modal-content {
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
  max-width: 700px;
  width: 80%;
  margin: 5% auto;
  padding: 2rem;
  background: #fff;
  border-radius: 10px;
  position: relative;
  display: block;
}

/* --- Prevent inner content from bleeding out --- */
.tbm-modal-content * {
  max-width: 100%;
  box-sizing: border-box;
}

/* --- Modal image --- */
.tbm-modal-img {
  width: 150px;
  border-radius: 50%;
  margin-bottom: 1rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* --- Close button --- */
.tbm-close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #555;
}

.tbm-close:hover {
  color: #000;
}

/* --- Modal body text normalization --- */
.tbm-modal-body,
.tbm-modal-body p {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.6;
  text-align: left;
}

/* --- Fade-in effect --- */
.tbm-modal {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.tbm-modal[style*="display: block"] {
  opacity: 1;
  visibility: visible;
}

/* --- Always stay above footer and theme overlays --- */
body .tbm-modal {
  position: fixed !important;
  z-index: 2147483647 !important;
}

/* --- Lock background scroll while modal open --- */
html.tbm-modal-open,
body.tbm-modal-open {
  overflow: hidden;
  height: 100%;
}

/* --- Push footer below modal when open --- */
html.tbm-modal-open .site-footer,
html.tbm-modal-open footer,
html.tbm-modal-open #footer {
  z-index: 0 !important;
  position: static !important;
}

/* --- Mobile-friendly modal layout --- */
@media (max-width: 600px) {
  .tbm-modal-content {
    width: 90%;
    padding: 1.5rem;
  }
}

.tbm-bio p {
  margin-bottom: 1em;
  text-align: left;   /* was justify — fixed */
  line-height: 1.7;
  font-size: 1rem;
  color: #222;
  word-spacing: normal;
  letter-spacing: normal;
  white-space: normal;
}

.tbm-modal-body h2 {
  font-weight: 600;
  margin-bottom: 0.25em;
}

.tbm-modal-body em {
  display: block;
  margin-bottom: 1em;
  font-style: italic;
  color: #444;
}