/* =============================================
   Team Directory – Frontend v5.3
   ============================================= */

.mistd-directory *,
.mistd-directory *::before,
.mistd-directory *::after { box-sizing: border-box; }

/* ══════════════════════════════════════════════
   TABS
══════════════════════════════════════════════ */
.mistd-tabs-wrapper { margin-bottom: 0; }
.mistd-tabs {
    display: flex; list-style: none !important;
    margin: 0 0 32px !important; padding: 0 !important;
    border-bottom: 2px solid #e0e0e0; gap: 0;
}
.mistd-tab {
    flex: 1; text-align: center; padding: 14px 16px !important;
    font-size: 14px; font-weight: 600; color: #999; cursor: pointer;
    border-bottom: 3px solid transparent; margin: 0 0 -2px !important;
    transition: color .2s, border-color .2s; user-select: none;
    line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    list-style: none !important;
}
.mistd-tab:hover { color: #444; }
.mistd-tab.mistd-tab-active { color: #111; border-bottom-color: #111; }
.mistd-panel { display: none; }
.mistd-panel.mistd-panel-active { display: block; }

/* ══════════════════════════════════════════════
   GRID — equal-height cards
══════════════════════════════════════════════ */
.mistd-grid {
    display: grid;
    gap: 24px;
    width: 100%;
    /* align-items:stretch (default) makes all cells same height */
    align-items: stretch;
}
.mistd-cols-1 .mistd-grid,
.mistd-directory.mistd-cols-1 .mistd-grid { grid-template-columns: 1fr; }
.mistd-cols-2 .mistd-grid,
.mistd-directory.mistd-cols-2 .mistd-grid { grid-template-columns: repeat(2, 1fr); }
.mistd-cols-3 .mistd-grid,
.mistd-directory.mistd-cols-3 .mistd-grid { grid-template-columns: repeat(3, 1fr); }
.mistd-cols-4 .mistd-grid,
.mistd-directory.mistd-cols-4 .mistd-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 960px) { .mistd-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 600px) { .mistd-grid { grid-template-columns: 1fr !important; } }

/* ══════════════════════════════════════════════
   CARD — equal height, consistent layout
══════════════════════════════════════════════ */
.mistd-card {
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;          /* fill the grid cell so all cards same height */
    transition: box-shadow .2s;
}
.mistd-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.10); }

/* ── Card image ── */
.mistd-card-img {
    width: 100%;
    height: 220px;         /* default — overridden by Settings inline CSS */
    max-height: 220px;     /* hard cap — prevents video/embed from stretching */
    background: #e2e2e2;
    overflow: hidden;      /* clips any overflowing media */
    display: block;
    flex-shrink: 0;
    position: relative;
}
.mistd-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform .35s ease;
}
.mistd-card:hover .mistd-card-img img { transform: scale(1.04); }

/* Placeholder SVG */
.mistd-no-img {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #e2e2e2;
}
.mistd-no-img svg { display: block; width: 72px; height: 54px; opacity: .7; }

/* ── Card body — grows to fill remaining height ── */
.mistd-card-body {
    padding: 18px 20px 20px;
    background: #fff;
    transition: background .22s;
    flex: 1;               /* fill remaining card height */
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.mistd-card-name {
    font-size: 15px; font-weight: 700;
    margin: 0 0 6px; color: #1a1a1a;
    line-height: 1.3; transition: color .2s;
}
.mistd-card-pos {
    font-size: 13px; color: #666;
    margin: 0 0 14px; line-height: 1.4;
    /* When position text is absent this element has zero height.
       flex:1 makes it consume all leftover space so CTA stays at bottom. */
    flex: 1;
    min-height: 0;
    transition: color .2s;
}
.mistd-open-btn, .mistd-cta-btn, .mistd-cta-link {
    background: none; border: none;
    padding: 4px 8px; border-radius: 4px;
    margin-left: -8px; margin-right: -8px; margin-bottom: -4px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 3px;
    color: #333; text-decoration: none; line-height: 1;
    transition: color .2s, background-color .2s; font-family: inherit;
    align-self: flex-start;
    margin-top: auto;      /* always pinned to bottom of flex column */
}
.mistd-open-btn:hover, .mistd-cta-btn:hover, .mistd-cta-link:hover { color: #000; }
.mistd-arrow { font-size: 15px; line-height: 1; }

/* ── Hover & active states (overridden by Settings inline CSS) ── */
.mistd-card:hover .mistd-card-body,
.mistd-card.mistd-card-open .mistd-card-body { background: #111; }
.mistd-card:hover .mistd-card-name,
.mistd-card.mistd-card-open .mistd-card-name { color: #fff; }
.mistd-card:hover .mistd-card-pos,
.mistd-card.mistd-card-open .mistd-card-pos  { color: rgba(255,255,255,.72); }
.mistd-card:hover .mistd-open-btn,
.mistd-card:hover .mistd-cta-btn,
.mistd-card:hover .mistd-cta-link,
.mistd-card.mistd-card-open .mistd-open-btn  { color: #fff; }
.mistd-card:hover .mistd-open-btn *,
.mistd-card.mistd-card-open .mistd-open-btn * { color: inherit !important; }

/* ══════════════════════════════════════════════
   INLINE EXPAND
══════════════════════════════════════════════ */
.mistd-expand-area {
    background: #f7f7f7; padding: 36px 40px;
    position: relative; margin-top: 0;
    border-top: 3px solid #111;
    animation: mistd-slide-down .22s ease; width: 100%;
    /* Establishes a new block formatting context so this panel's rendered
       height always fully contains its content's height — including any
       floated or margin-collapsing elements a theme's global styles might
       introduce — instead of depending on ancestor layout behavior we
       don't control. This is what guarantees the background always
       extends to cover the full content, no matter how tall it is. */
    display: flow-root;
}
.mistd-expand-area.mistd-expand-closing {
    opacity: 0;
    transition: opacity .18s ease;
}
/* When JS moves the panel inside .mistd-grid (to sit right after the clicked
   row), it becomes a grid item — span the full row width instead of
   collapsing into a single column. */
.mistd-grid > .mistd-expand-area { grid-column: 1 / -1; }
@keyframes mistd-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mistd-expand-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none; font-size: 20px;
    cursor: pointer; color: #555;
    display: flex; align-items: center; gap: 4px;
    font-weight: 700; line-height: 1;
    padding: 4px 8px; border-radius: 4px;
    transition: color .2s, background-color .2s;
}
.mistd-expand-close span { font-size: 13px; font-weight: 700; }
.mistd-expand-close:hover { color: #000; }
.mistd-expand-inner { display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-start; }
.mistd-expand-photo {
    width: 180px; min-width: 180px; height: 230px;
    background: #ddd; overflow: hidden; flex-shrink: 0;
}
.mistd-expand-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.mistd-expand-info { flex: 1; min-width: 200px; }
.mistd-expand-name { font-size: 22px; font-weight: 800; margin: 0 0 6px; color: #111; }
.mistd-expand-pos  { font-size: 14px; color: #666; margin: 0 0 14px; }

/* ══════════════════════════════════════════════
   SOCIAL ICONS
══════════════════════════════════════════════ */
.mistd-social { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.mistd-social a {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    color: #333; text-decoration: none; border-radius: 50%;
    transition: background .15s, color .15s;
}
.mistd-social a:hover { background: #ebebeb; color: #000; }
.mistd-social svg { width: 17px; height: 17px; }
.mistd-social a[href^="mailto:"] { color: #444; }
.mistd-social a[href^="mailto:"]:hover { background: #e8f0fe; color: #1a56db; }
.mistd-expand-content { font-size: 14px; line-height: 1.75; color: #333; margin-top: 14px; }
.mistd-expand-content p { margin: 0 0 12px; }
.mistd-expand-loading { font-size: 14px; color: #888; padding: 8px 0; }

/* ══════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════ */
.mistd-modal-wrap {
    position: fixed; inset: 0; z-index: 99990;
    display: flex; align-items: center; justify-content: center;
}
.mistd-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.mistd-modal {
    position: relative; z-index: 1; background: #fff;
    width: 90%; max-width: 760px; max-height: 88vh;
    overflow-y: auto; padding: 40px 44px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.mistd-modal-x {
    position: absolute; top: 12px; right: 14px;
    width: 30px; height: 30px;
    border: 1px solid #ddd; background: #fff; font-size: 18px;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; color: #555; line-height: 1; transition: background .15s;
}
.mistd-modal-x:hover { background: #f2f2f2; }
.mistd-modal-head { display: flex; gap: 28px; margin: 10px 0 22px; align-items: flex-start; }
.mistd-modal-photo {
    width: 160px; min-width: 160px; height: 200px;
    background: #e5e5e5; overflow: hidden; flex-shrink: 0;
}
.mistd-modal-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.mistd-modal-info { flex: 1; padding-top: 4px; }
.mistd-modal-name { font-size: 22px; font-weight: 800; margin: 0 0 4px; color: #111; }
.mistd-modal-position { font-size: 14px; color: #666; margin: 0 0 14px; }
.mistd-modal-content { font-size: 14px; line-height: 1.75; color: #333; }
.mistd-modal-content p { margin: 0 0 12px; }
.mistd-modal-nav {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee;
}
.mistd-nav-prev, .mistd-nav-next {
    background: #111; color: #fff; border: none;
    width: 36px; height: 36px; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.mistd-nav-prev:hover, .mistd-nav-next:hover { background: #333; }
.mistd-nav-prev:disabled, .mistd-nav-next:disabled { background: #ccc; cursor: default; }

/* ══════════════════════════════════════════════
   SLIDER
══════════════════════════════════════════════ */
.mistd-slider-outer { position: relative; }
.mistd-slider-viewport { overflow: hidden; margin: 0 50px; }
.mistd-slider-track {
    display: flex;
    gap: 24px;
    transition: transform .35s ease;
    will-change: transform;
    align-items: stretch;  /* ALL cards in the row same height as the tallest */
}

/* Slider cards — must fill their track cell height */
.mistd-slider-track .mistd-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: auto;           /* let stretch drive height, not a fixed value */
    align-self: stretch;    /* belt + suspenders: fill row height */
}

/* Card body inside slider must still push CTA to bottom */
.mistd-slider-track .mistd-card .mistd-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.mistd-slider-track .mistd-card .mistd-card-pos {
    flex: 1;               /* grows to fill gap when position is absent */
    min-height: 0;
}
.mistd-slider-track .mistd-card .mistd-open-btn {
    margin-top: auto;      /* always stuck to bottom of body */
}

/* Slider arrow buttons */
.mistd-slider-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: #111; color: #fff; border: none;
    width: 40px; height: 64px; font-size: 26px; cursor: pointer; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, opacity .2s;
}
.mistd-slider-btn:hover { background: #333; }
.mistd-slider-btn:disabled,
.mistd-slider-btn.mistd-btn-hidden { opacity: 0; pointer-events: none; }
.mistd-slider-prev { left: 0; }
.mistd-slider-next { right: 0; }

/* Empty state */
.mistd-slider-empty {
    text-align: center; padding: 40px 0;
    color: #aaa; font-size: 14px;
}

/* ══════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════ */
.mistd-pagination {
    display: flex; gap: 4px; justify-content: center;
    margin-top: 32px; flex-wrap: wrap; align-items: center;
}
.mistd-page-btn {
    min-width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #ddd; background: #fff;
    font-size: 13px; color: #333; cursor: pointer;
    padding: 0 8px; transition: background .15s, border-color .15s;
    font-family: inherit;
}
.mistd-page-btn:hover  { background: #f5f5f5; border-color: #bbb; }
.mistd-page-current    { background: #111 !important; color: #fff !important; border-color: #111 !important; }
.mistd-page-prev,
.mistd-page-next       { font-size: 18px; font-weight: 700; padding: 0 10px; }
.mistd-page-ellipsis   { display: inline-flex; align-items: center; padding: 0 4px; font-size: 13px; color: #aaa; height: 34px; }

.mistd-grid-wrap {
    transition: opacity .2s;
    /* New block formatting context for the whole widget instance — see the
       matching comment on .mistd-expand-area for why this matters. This
       also guarantees .mistd-pagination (a normal-flow sibling that comes
       right after .mistd-grid in the DOM) is always positioned based on
       this wrapper's true, fully-contained height rather than a height a
       theme's global styles might otherwise cause to be miscalculated. */
    display: flow-root;
}
.mistd-empty     { color: #aaa; font-size: 14px; padding: 24px 0; }

/* ══════════════════════════════════════════════
   PHOTO SHAPE STYLES
══════════════════════════════════════════════ */
/* Circle */
.mistd-directory[data-photo-style="circle"] .mistd-card-img {
    border-radius: 50% !important; overflow: hidden !important;
    width: 180px !important; height: 180px !important;
    margin: 20px auto 14px !important;
}
.mistd-directory[data-photo-style="circle"] .mistd-card-img img {
    border-radius: 50% !important; object-position: center top !important;
}
/* Rounded */
.mistd-directory[data-photo-style="round"] .mistd-card-img,
.mistd-directory[data-photo-style="round"] .mistd-card-img img { border-radius: 12px !important; }
/* Square — force 1:1 crop */
.mistd-directory[data-photo-style="square"] .mistd-card-img {
    border-radius: 0 !important;
    /* height already set via inline CSS; force equal width for square */
    aspect-ratio: 1 / 1 !important;
}
.mistd-directory[data-photo-style="square"] .mistd-card-img img { border-radius: 0 !important; }

/* ══════════════════════════════════════════════
   WIDTH SYSTEM
══════════════════════════════════════════════ */
.mistd-directory.mistd-width-full,
.mistd-directory.alignfull {
    width: 100vw !important; max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    box-sizing: border-box; position: relative;
}
.mistd-directory.mistd-width-wide,
.mistd-directory.alignwide {
    width: calc(100% + 160px) !important; max-width: none !important;
    margin-left: -80px !important; margin-right: -80px !important;
    box-sizing: border-box;
}
.mistd-directory.mistd-width-narrow {
    max-width: 760px !important; width: 100% !important;
    margin-left: auto !important; margin-right: auto !important;
    box-sizing: border-box;
}
.mistd-directory.mistd-width-block {
    max-width: var(--wp--style--global--content-size, 100%) !important;
    width: 100% !important;
    margin-left: auto !important; margin-right: auto !important;
    box-sizing: border-box;
}
/* "Default (follows theme content width)" is meant to defer to whatever
   width the theme's own content wrapper already provides. But if the page
   template doesn't have such a wrapper (a full-width template, a block
   pattern, a page builder canvas, etc.), there is nothing to defer to and
   the directory would render edge-to-edge with no visible constraint at
   all. This fallback mirrors the Block Layout rule: it prefers the theme's
   own global content-width CSS variable when a block theme provides one,
   and otherwise falls back to a sensible readable max-width instead of
   silently applying no constraint. */
.mistd-directory.mistd-width-default {
    max-width: var(--wp--style--global--content-size, 1200px);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Scrollbar suppression */
html.mistd-no-hscroll,
body.mistd-no-hscroll { overflow-x: hidden !important; max-width: 100% !important; }