/* =========================================================
   ESChE DIGITAL MEMBERS DIRECTORY
   Member cards + full-screen member profile
   ========================================================= */

.esche-directory {
    --esche-directory-primary: #6a00ff;
    --esche-directory-accent: #9d4cff;
    --esche-directory-text: #171717;
    --esche-directory-muted: #6b7280;
    --esche-directory-border: #e5e7eb;
    --esche-directory-surface: #ffffff;

    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    color: var(--esche-directory-text);
    font-family: inherit;
    box-sizing: border-box;
}

.esche-directory *,
.esche-directory *::before,
.esche-directory *::after {
    box-sizing: border-box;
}

.esche-directory [hidden] {
    display: none !important;
}

/* =========================================================
   DIRECTORY TOOLBAR
   ========================================================= */

.esche-directory__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.esche-directory__search {
    flex: 1 1 260px;
    min-width: 0;
}

.esche-directory__search input,
.esche-directory__search-input,
.esche-directory__toolbar select {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid var(--esche-directory-border);
    border-radius: 10px;
    background: #fff;
    color: var(--esche-directory-text);
    font: inherit;
}

.esche-directory__toolbar input:focus,
.esche-directory__toolbar select:focus {
    outline: 2px solid var(--esche-directory-accent);
    outline-offset: 2px;
}

/* =========================================================
   MEMBER GRID AND CARDS
   ========================================================= */

.esche-directory__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
}

.esche-directory__card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--esche-directory-border);
    border-radius: 16px;
    background: var(--esche-directory-surface);
    box-shadow: 0 3px 14px rgb(0 0 0 / 4%);
}

.esche-directory__card[hidden] {
    display: none !important;
}

/* =========================================================
   MEMBER CARD COVER
   ========================================================= */

.esche-directory__card-cover {
    position: relative;
    isolation: isolate;
    width: 100%;
    height: 150px;
    overflow: hidden;
    background:
        radial-gradient(
            ellipse at 82% 15%,
            rgb(255 255 255 / 16%),
            transparent 42%
        ),
        radial-gradient(
            ellipse at 10% 110%,
            #0b2850,
            transparent 58%
        ),
        linear-gradient(
            120deg,
            #123d72,
            #1560bd,
            #329bff
        );
}

.esche-directory__card-cover::after {
    content: "";
    position: absolute;
    z-index: 1;
    right: -55px;
    bottom: -115px;
    width: 250px;
    height: 250px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 50%;
    box-shadow:
        0 0 0 22px rgb(255 255 255 / 5%),
        0 0 0 48px rgb(255 255 255 / 4%);
    pointer-events: none;
}

.esche-directory__card-cover > img {
    position: relative;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
}

.esche-directory__cover-placeholder {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: rgb(255 255 255 / 92%);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.6px;
    line-height: 1.6;
    text-align: center;
}

/* =========================================================
   MEMBER CARD CONTENT
   ========================================================= */

.esche-directory__card-content {
    position: relative;
    min-width: 0;
    padding: 0 20px 20px;
}

/* Card avatar */
.esche-directory__card-content .esche-directory__profile-avatar,
.esche-directory__card-content .esche-directory__member-avatar,
.esche-directory__card-content .esche-directory__avatar {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 96px;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin-top: -48px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 50%;
    background: linear-gradient(145deg, #eaf4ff, #d8eafe);
    box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
}

.esche-directory__card-content .esche-directory__profile-avatar img,
.esche-directory__card-content .esche-directory__member-avatar img,
.esche-directory__card-content .esche-directory__avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.esche-directory__avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(145deg, #eaf4ff, #d8eafe);
    color: #123d72;
    font-size: 34px;
    font-weight: 750;
    line-height: 1;
}

/* Member name */
.esche-directory__member-name {
    margin: 0 0 8px;
    color: var(--esche-directory-text);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

/* Specialization */
.esche-directory__member-specialization {
    margin: 0 0 6px;
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Institution */
.esche-directory__member-institution {
    margin: 0 0 12px;
    color: var(--esche-directory-muted);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* About preview */
.esche-directory__bio-preview {
    margin: 12px 0 16px;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* View Details button */
.esche-directory__view-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    background: var(--esche-directory-primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 160ms ease;
}

.esche-directory__view-button:hover {
    background: var(--esche-directory-accent);
}

.esche-directory__view-button:focus-visible {
    outline: 3px solid var(--esche-directory-accent);
    outline-offset: 3px;
}

/* =========================================================
   FULL-SCREEN PROFILE MODAL
   ========================================================= */

.esche-directory__profile.is-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;

    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;

    border: 0 !important;
    border-radius: 0 !important;
    background: #f8fafc !important;
    color: var(--esche-directory-text);

    box-shadow: none !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.esche-directory__profile[hidden] {
    display: none !important;
}

/* =========================================================
   FULL-SCREEN PROFILE COVER
   IMPORTANT:
   JavaScript moves the profile into document.body.
   These rules therefore do not depend on .esche-directory.
   ========================================================= */

.esche-directory__profile-banner {
    position: relative;
    width: 100%;
    height: clamp(180px, 25vw, 300px);
    min-height: 180px;
    max-height: 300px;
    overflow: hidden;
    background: linear-gradient(
        135deg,
        var(--esche-directory-primary),
        var(--esche-directory-accent)
    );
}

.esche-directory__profile.is-modal .esche-directory__profile-banner {
    position: relative;
    isolation: isolate;
    width: 100%;
    height: clamp(180px, 25vw, 300px);
    min-height: 180px;
    max-height: 300px;
    overflow: hidden;
    background:
        radial-gradient(
            ellipse at 82% 15%,
            rgb(255 255 255 / 16%),
            transparent 42%
        ),
        radial-gradient(
            ellipse at 10% 110%,
            #0b2850,
            transparent 58%
        ),
        linear-gradient(
            120deg,
            #123d72,
            #1560bd,
            #329bff
        );
}

.esche-directory__profile-banner img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: cover;
    object-position: center;
}

.esche-directory__profile.is-modal .esche-directory__profile-banner::after {
    content: "";
    position: absolute;
    z-index: 1;
    right: -55px;
    bottom: -115px;
    width: 250px;
    height: 250px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 50%;
    box-shadow:
        0 0 0 22px rgb(255 255 255 / 5%),
        0 0 0 48px rgb(255 255 255 / 4%);
    pointer-events: none;
}

.esche-directory__profile.is-modal .esche-directory__profile-banner > img {
    position: relative;
    z-index: 0;
}

/* Expanded profile cover placeholder */
.esche-directory__profile-cover-placeholder {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: rgb(255 255 255 / 92%);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.6px;
    line-height: 1.6;
    text-align: center;
}

.esche-directory__profile-cover-placeholder::after {
    content: "";
    position: absolute;
    z-index: -1;
    right: -55px;
    bottom: -115px;
    width: 250px;
    height: 250px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 50%;
    box-shadow:
        0 0 0 22px rgb(255 255 255 / 5%),
        0 0 0 48px rgb(255 255 255 / 4%);
    pointer-events: none;
}

/* =========================================================
   FULL-SCREEN PROFILE HEADER
   ========================================================= */

.esche-directory__profile-header {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    width: min(1100px, calc(100% - 48px));
    margin: 0 auto;
    padding: 0 0 28px;
    border-bottom: 1px solid var(--esche-directory-border);
    background: #fff;
}

.esche-directory__profile.is-modal .esche-directory__profile-header {
    padding-bottom: 28px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

/* Expanded profile avatar */
.esche-directory__profile-header > .esche-directory__profile-avatar {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 144px;
    align-items: center;
    justify-content: center;
    width: 144px;
    height: 144px;
    margin-top: -72px;
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 50%;
    background: linear-gradient(145deg, #eaf4ff, #d8eafe);
    box-shadow: 0 2px 12px rgb(0 0 0 / 10%);
}

.esche-directory__profile-header > .esche-directory__profile-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.esche-directory__profile-header > .esche-directory__profile-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(145deg, #eaf4ff, #d8eafe);
    color: #123d72;
    font-size: 42px;
    font-weight: 750;
    line-height: 1;
}

.esche-directory__profile-identity {
    flex: 1 1 auto;
    min-width: 0;
    padding: 18px 72px 0 0;
}

.esche-directory__profile-identity h3 {
    margin: 0 0 8px;
    color: var(--esche-directory-text);
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 600;
    letter-spacing: -0.4px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.esche-directory__profile-identity p {
    margin: 5px 0;
    color: var(--esche-directory-muted);
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* =========================================================
   PROFILE CLOSE BUTTON
   ========================================================= */

.esche-directory__close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    background: #f9fafb;
    color: #111827;
    font-family: Arial, sans-serif;
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 180ms ease,
        color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.esche-directory__profile.is-modal .esche-directory__close-button {
    position: fixed !important;
    z-index: 1000000 !important;
    top: 20px;
    right: 24px;

    width: 42px;
    height: 42px;

    border: 1px solid rgb(255 255 255 / 70%);
    background: rgb(255 255 255 / 94%);
    color: #374151;

    font-size: 27px;
    box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
    transform: none;
}

.esche-directory__close-button:hover,
.esche-directory__profile.is-modal .esche-directory__close-button:hover {
    background: #fff;
    color: var(--esche-directory-primary);
    border-color: #fff;
    box-shadow: 0 4px 14px rgb(0 0 0 / 18%);
    transform: none;
}

.esche-directory__close-button:focus-visible,
.esche-directory__profile.is-modal .esche-directory__close-button:focus-visible {
    outline: 3px solid var(--esche-directory-accent);
    outline-offset: 3px;
}

/* =========================================================
   FULL-SCREEN PROFILE BODY
   ========================================================= */

.esche-directory__profile-body {
    width: min(1100px, calc(100% - 48px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.esche-directory__profile.is-modal .esche-directory__profile-body {
    padding-top: 32px;
    padding-bottom: 64px;
}

.esche-directory__profile-body h4 {
    margin: 0 0 14px;
    color: var(--esche-directory-text);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.2px;
    line-height: 1.4;
}

.esche-directory__profile-body p {
    color: #4b5563;
    font-size: 15px;
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.esche-directory__profile-body section {
    margin-bottom: 28px;
}

.esche-directory__profile-body a {
    color: var(--esche-directory-primary);
    text-decoration: none;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.esche-directory__profile-body a:hover {
    color: var(--esche-directory-accent);
    text-decoration: underline;
}

.esche-directory__profile-body ul {
    margin: 0;
    padding-left: 20px;
}

.esche-directory__profile-body li {
    margin-bottom: 10px;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

/* =========================================================
   EMPTY RESULTS
   ========================================================= */

.esche-directory__no-results {
    padding: 40px 20px;
    color: var(--esche-directory-muted);
    text-align: center;
}

/* =========================================================
   RESPONSIVE LAYOUT
   ========================================================= */

@media (max-width: 1024px) {
    .esche-directory__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .esche-directory__profile-banner,
    .esche-directory__profile.is-modal .esche-directory__profile-banner {
        height: 240px;
        min-height: 180px;
        max-height: 260px;
    }
}

@media (max-width: 640px) {
    .esche-directory__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .esche-directory__toolbar {
        gap: 10px;
    }

    .esche-directory__card-cover {
        height: 135px;
    }

    .esche-directory__card-content {
        padding-right: 16px;
        padding-left: 16px;
    }

    .esche-directory__card-content .esche-directory__profile-avatar,
    .esche-directory__card-content .esche-directory__member-avatar,
    .esche-directory__card-content .esche-directory__avatar {
        flex-basis: 84px;
        width: 84px;
        height: 84px;
        margin-top: -42px;
        margin-bottom: 10px;
    }

    .esche-directory__avatar-placeholder {
        font-size: 30px;
    }

    .esche-directory__member-name {
        font-size: 20px;
        font-weight: 500;
    }

    .esche-directory__profile-banner,
    .esche-directory__profile.is-modal .esche-directory__profile-banner {
        height: 180px;
        min-height: 180px;
        max-height: 180px;
    }

    .esche-directory__profile-cover-placeholder {
        padding: 16px;
        font-size: 12px;
    }

    .esche-directory__profile-header {
        gap: 14px;
        width: calc(100% - 32px);
        padding-bottom: 22px;
    }

    .esche-directory__profile-header > .esche-directory__profile-avatar {
        flex-basis: 92px;
        width: 92px;
        height: 92px;
        margin-top: -46px;
        border-width: 3px;
    }

    .esche-directory__profile-header > .esche-directory__profile-avatar > span {
        font-size: 30px;
    }

    .esche-directory__profile-identity {
        padding: 8px 42px 0 0;
    }

    .esche-directory__profile-identity h3 {
        margin-bottom: 6px;
        font-size: 22px;
        line-height: 1.25;
    }

    .esche-directory__profile-identity p {
        margin: 4px 0;
        font-size: 13px;
        line-height: 1.5;
    }

    .esche-directory__profile.is-modal .esche-directory__close-button {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 25px;
    }

    .esche-directory__profile-body,
    .esche-directory__profile.is-modal .esche-directory__profile-body {
        width: calc(100% - 32px);
        padding: 24px 0 40px;
    }

    .esche-directory__profile-body h4 {
        font-size: 18px;
    }

    .esche-directory__profile-body p {
        font-size: 14px;
    }
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .esche-directory__view-button,
    .esche-directory__close-button {
        transition: none;
        transform: none;
    }
}

/* Restore the profile modal close button */
.esche-directory__profile.is-modal .esche-directory__close-button {
    position: fixed !important;
    top: 20px;
    right: 24px;
    z-index: 1000000 !important;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    padding: 0;

    border: 1px solid rgb(255 255 255 / 70%);
    border-radius: 50%;

    background: rgb(255 255 255 / 94%);
    color: #374151;

    font-family: Arial, sans-serif;
    font-size: 27px;
    font-weight: 400;
    line-height: 1;

    box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
    cursor: pointer;

    transform: none;
    transition:
        background-color 180ms ease,
        color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.esche-directory__profile.is-modal .esche-directory__close-button:hover {
    background: #fff;
    color: var(--esche-directory-primary);
    border-color: #fff;
    box-shadow: 0 4px 14px rgb(0 0 0 / 18%);
    transform: none;
}

.esche-directory__profile.is-modal .esche-directory__close-button:focus-visible {
    outline: 3px solid var(--esche-directory-accent);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .esche-directory__profile.is-modal .esche-directory__close-button {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 25px;
    }
}

/* Reduce member name size on directory cards */
.esche-directory .esche-directory__member-name {
    font-size: 17px !important;
    line-height: 1.3;
}