/* JEC Speaker Manager v1.1.0 — Frontend Styles */

.jec-speakers {
    --jec-primary:    #6B3FA0;
    --jec-accent:     #9B6FC8;
    --jec-text:       #1d2327;
    --jec-meta-color: #646970;
    --jec-bg:         #fafafa;
    --jec-border:     #ebebeb;
    --jec-radius:     8px;
    --jec-gap:        24px;
}

/* ============================================================
   BASE — solo speaker card
   ============================================================ */

.jec-speaker {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.jec-speaker-photo {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--jec-primary);
}

.jec-speaker-photo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* No-photo → filled initials avatar in the brand colour */
.jec-speaker-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--jec-primary);
}

.jec-speaker-initials {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.35em;
    color: #fff;
    letter-spacing: .03em;
    line-height: 1;
}

.jec-speaker-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2px 0;
}

.jec-talk-title {
    color: var(--jec-primary);
    font-weight: 700;
    margin: 0 0 5px;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Session role, inline after the name (e.g. "Name · MODERATOR") */
.jec-speaker-role {
    display: inline-block;
    vertical-align: middle;
    margin: 0 0 2px 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--jec-accent);
    color: #fff;
    font-weight: 800;
    font-size: 0.66em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.5;
    white-space: nowrap;
}

.jec-speaker-name {
    font-weight: 700;
    margin: 0 0 3px;
    color: var(--jec-text);
    font-size: 1em;
    line-height: 1.3;
}

.jec-speaker-meta {
    color: var(--jec-meta-color);
    margin: 0;
    font-size: 0.85em;
    line-height: 1.4;
}

.jec-sep { margin: 0 2px; }

/* ============================================================
   GROUPED SPEAKERS — shared talk card
   ============================================================ */

/* Outer card — full width, same visual style as a solo card */
.jec-speaker-group {
    width: 100%;
    flex: 0 0 100%;
    min-width: 0;
    background: var(--jec-bg);
    border: 1px solid var(--jec-border);
    border-radius: var(--jec-radius);
    padding: 18px 20px;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jec-speaker-group:hover {
    box-shadow: 0 4px 14px rgba(107, 63, 160, 0.1);
    border-color: var(--jec-primary);
}

/* Shared talk title */
.jec-group-title {
    color: var(--jec-primary);
    font-weight: 700;
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--jec-border);
}

/* Flex row of speakers inside the group */
.jec-group-speakers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

/* Individual speaker inside a group — NO card style */
.jec-gspeaker {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 24px 4px 0;
}

.jec-gspeaker + .jec-gspeaker {
    padding: 4px 0 4px 24px;
    border-left: 1px solid var(--jec-border);
}

.jec-gspeaker .jec-speaker-photo {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--jec-primary);
}

.jec-gspeaker .jec-speaker-photo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jec-gspeaker .jec-speaker-body {
    flex: 1;
    min-width: 0;
    padding: 0;
}

/* ============================================================
   LAYOUT: GRID  [layout="grid"]
   Flex-based — avoids grid-column issues
   ============================================================ */

.jec-layout-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--jec-gap);
    align-items: stretch;
}

/* Default: 2 columns */
.jec-layout-grid > .jec-speaker {
    flex: 0 0 calc(50% - 12px);
    background: var(--jec-bg);
    border: 1px solid var(--jec-border);
    border-radius: var(--jec-radius);
    padding: 16px;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jec-layout-grid > .jec-speaker:hover {
    box-shadow: 0 4px 14px rgba(107, 63, 160, 0.1);
    border-color: var(--jec-primary);
}

/* Column overrides */
.jec-layout-grid.jec-cols-1 > .jec-speaker { flex: 0 0 100%; }
.jec-layout-grid.jec-cols-3 > .jec-speaker { flex: 0 0 calc(33.333% - 16px); }
.jec-layout-grid.jec-cols-4 > .jec-speaker { flex: 0 0 calc(25% - 18px); }

/* ============================================================
   LAYOUT: LIST  [layout="list"]
   ============================================================ */

.jec-layout-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.jec-layout-list > .jec-speaker {
    padding: 14px 0;
    border-bottom: 1px solid var(--jec-border);
    align-items: center;
}

.jec-layout-list > .jec-speaker:last-child,
.jec-layout-list > .jec-speaker-group:last-child {
    border-bottom: none;
}

/* Groups in list: no card bg, flush with content */
.jec-layout-list > .jec-speaker-group {
    background: none;
    border: none;
    border-bottom: 1px solid var(--jec-border);
    border-radius: 0;
    padding: 14px 0;
    box-shadow: none !important;
}

.jec-layout-list > .jec-speaker-group:hover {
    border-color: var(--jec-border) !important;
}

/* In list: speakers in a group stack vertically */
.jec-layout-list .jec-group-speakers {
    flex-direction: column;
    gap: 10px;
}

.jec-layout-list .jec-gspeaker {
    flex: none;
    padding: 0;
}

.jec-layout-list .jec-gspeaker + .jec-gspeaker {
    padding: 10px 0 0;
    border-left: none;
    border-top: 1px solid var(--jec-border);
}

/* ============================================================
   LAYOUT: CARDS  [layout="cards"]
   ============================================================ */

.jec-layout-cards {
    display: flex;
    flex-wrap: wrap;
    gap: var(--jec-gap);
    align-items: stretch;
}

/* Default: 3 columns */
.jec-layout-cards > .jec-speaker {
    flex: 0 0 calc(33.333% - 16px);
    min-width: 0;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--jec-bg);
    border: 1px solid var(--jec-border);
    border-radius: var(--jec-radius);
    padding: 24px 16px 20px;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jec-layout-cards > .jec-speaker:hover {
    box-shadow: 0 6px 18px rgba(107, 63, 160, 0.12);
    border-color: var(--jec-primary);
}

.jec-layout-cards > .jec-speaker .jec-speaker-photo {
    width: 100px;
    height: 100px;
    margin-bottom: 14px;
}

.jec-layout-cards > .jec-speaker .jec-speaker-body {
    align-items: center;
}

.jec-layout-cards > .jec-speaker .jec-talk-title {
    font-size: 0.82em;
}

/* Column overrides */
.jec-layout-cards.jec-cols-1 > .jec-speaker { flex: 0 0 100%; }
.jec-layout-cards.jec-cols-2 > .jec-speaker { flex: 0 0 calc(50% - 12px); }
.jec-layout-cards.jec-cols-4 > .jec-speaker { flex: 0 0 calc(25% - 18px); }
.jec-layout-cards.jec-cols-5 > .jec-speaker { flex: 0 0 calc(20% - 19.2px); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    .jec-layout-grid.jec-cols-3 > .jec-speaker,
    .jec-layout-grid.jec-cols-4 > .jec-speaker,
    .jec-layout-cards.jec-cols-4 > .jec-speaker,
    .jec-layout-cards.jec-cols-5 > .jec-speaker {
        flex: 0 0 calc(50% - 12px);
    }
}

@media (max-width: 640px) {
    .jec-layout-grid > .jec-speaker,
    .jec-layout-grid.jec-cols-3 > .jec-speaker,
    .jec-layout-grid.jec-cols-4 > .jec-speaker,
    .jec-layout-cards > .jec-speaker,
    .jec-layout-cards.jec-cols-2 > .jec-speaker,
    .jec-layout-cards.jec-cols-3 > .jec-speaker,
    .jec-layout-cards.jec-cols-4 > .jec-speaker,
    .jec-layout-cards.jec-cols-5 > .jec-speaker {
        flex: 0 0 100%;
    }

    /* Cards → horizontal on mobile */
    .jec-layout-cards > .jec-speaker {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
        padding: 14px 12px;
    }

    .jec-layout-cards > .jec-speaker .jec-speaker-photo {
        width: 64px;
        height: 64px;
        margin-bottom: 0;
    }

    .jec-layout-cards > .jec-speaker .jec-speaker-body {
        align-items: flex-start;
    }

    /* Groups on mobile: speakers stack */
    .jec-speaker-group {
        padding: 14px;
    }

    .jec-group-speakers {
        flex-direction: column;
        gap: 0;
    }

    .jec-gspeaker {
        flex: none;
        padding: 8px 0;
    }

    .jec-gspeaker + .jec-gspeaker {
        padding: 8px 0 0;
        border-left: none;
        border-top: 1px solid var(--jec-border);
    }
}

/* Speaker's own talk title, shown under the name in the program timeline */
.jec-speaker-talk {
    display: block;
    color: var(--jec-primary);
    font-weight: 600;
    font-size: 0.85em;
    line-height: 1.4;
    margin: 3px 0 0;
}

/* ============================================================
   BIO — clickable profiles and the bio dialog
   The selectors are doubled (.jec-speakers / .jec-program) so a theme or
   page-builder rule on "button" (Elementor kits: .elementor-kit-N button)
   cannot restyle the bio link.
   ============================================================ */

.jec-has-bio { cursor: pointer; }

.jec-speakers .jec-bio-btn,
.jec-program .jec-bio-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    min-height: 0;
    margin: 7px 0 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: none;
    box-shadow: none;
    color: var(--jec-primary);
    font: inherit;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    cursor: pointer;
}

.jec-speakers .jec-bio-btn::after,
.jec-program .jec-bio-btn::after {
    content: "\2192";
    transition: transform 0.18s ease;
}

.jec-speakers .jec-bio-btn:hover,
.jec-speakers .jec-bio-btn:focus,
.jec-program .jec-bio-btn:hover,
.jec-program .jec-bio-btn:focus {
    background: none;
    color: var(--jec-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.jec-speakers .jec-bio-btn:focus-visible,
.jec-program .jec-bio-btn:focus-visible {
    outline: 2px solid var(--jec-accent);
    outline-offset: 3px;
}

.jec-has-bio:hover .jec-bio-btn::after { transform: translateX(3px); }

.jec-has-bio:hover .jec-speaker-name { color: var(--jec-primary); }

.jec-layout-cards > .jec-speaker .jec-bio-btn { align-self: center; }

/* The dialog covers the viewport; its own backdrop and panel animate. */
.jec-bio-dialog {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1d2327;
    overflow: hidden;
    z-index: 999999;
}

.jec-bio-dialog:not([open]) { display: none; }

.jec-bio-dialog[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.jec-bio-dialog::backdrop { background: transparent; }

.jec-bio-dialog .jec-bio-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.jec-bio-dialog .jec-bio-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(640px, calc(100% - 32px));
    max-height: min(86vh, 760px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24), 0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.jec-bio-dialog .jec-bio-panel:focus { outline: none; }

.jec-bio-dialog.is-open .jec-bio-backdrop { opacity: 1; }
.jec-bio-dialog.is-open .jec-bio-panel { opacity: 1; transform: none; }

.jec-bio-dialog .jec-bio-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 32px 32px 30px;
}

.jec-bio-dialog .jec-bio-close {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f2f4;
    box-shadow: none;
    color: #3c434a;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.jec-bio-dialog .jec-bio-close:hover { background: #e3e5e9; color: #1d2327; }

.jec-bio-dialog .jec-bio-close:focus-visible {
    outline: 2px solid var(--jec-accent, #9B6FC8);
    outline-offset: 2px;
}

.jec-bio-dialog .jec-bio-head {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0 40px 22px 0;
}

.jec-bio-dialog .jec-bio-photo {
    position: relative;
    flex-shrink: 0;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--jec-primary, #6B3FA0);
    background: var(--jec-primary, #6B3FA0);
    box-sizing: border-box;
}

.jec-bio-dialog .jec-bio-photo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    display: block;
}

.jec-bio-dialog .jec-bio-initials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jec-on-primary, #fff);
    font-weight: 800;
    font-size: 1.9em;
    letter-spacing: 0.03em;
}

.jec-bio-dialog .jec-bio-name {
    margin: 0 0 6px;
    padding: 0;
    color: #1d2327;
    font-family: inherit;
    font-size: 1.35em;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: normal;
    text-transform: none;
}

.jec-bio-dialog .jec-bio-position {
    margin: 0;
    color: #3c434a;
    font-size: 0.95em;
    line-height: 1.45;
}

.jec-bio-dialog .jec-bio-company {
    margin: 2px 0 0;
    color: var(--jec-primary, #6B3FA0);
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.45;
}

.jec-bio-dialog .jec-bio-text {
    padding-top: 20px;
    border-top: 1px solid #ebebeb;
    color: #2c3338;
    font-size: 1em;
    line-height: 1.65;
}

.jec-bio-dialog .jec-bio-text p { margin: 0 0 0.9em; }
.jec-bio-dialog .jec-bio-text p:last-child { margin-bottom: 0; }
.jec-bio-dialog .jec-bio-text a { color: var(--jec-primary, #6B3FA0); text-decoration: underline; text-underline-offset: 2px; }
.jec-bio-dialog .jec-bio-text strong,
.jec-bio-dialog .jec-bio-text b { font-weight: 700; }
.jec-bio-dialog .jec-bio-text em,
.jec-bio-dialog .jec-bio-text i { font-style: italic; }
.jec-bio-dialog .jec-bio-text ul { list-style: disc outside; margin: 0 0 0.9em; padding: 0 0 0 1.3em; }
.jec-bio-dialog .jec-bio-text ol { list-style: decimal outside; margin: 0 0 0.9em; padding: 0 0 0 1.4em; }
.jec-bio-dialog .jec-bio-text li { list-style: inherit; margin: 0 0 0.3em; padding: 0; }

/* No native <dialog> (very old browsers): plain fixed layer. */
.jec-bio-nomodal { display: flex; }

/* Phones: a sheet that slides up from the bottom edge. */
@media (max-width: 600px) {
    .jec-bio-dialog[open] { align-items: flex-end; }

    .jec-bio-dialog .jec-bio-panel {
        width: 100%;
        max-height: 88vh;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
        transition: opacity 0.2s ease, transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .jec-bio-dialog .jec-bio-body { padding: 26px 20px 28px; }

    .jec-bio-dialog .jec-bio-head { gap: 16px; margin-bottom: 18px; }

    .jec-bio-dialog .jec-bio-photo { width: 84px; height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
    .jec-bio-dialog .jec-bio-backdrop,
    .jec-bio-dialog .jec-bio-panel,
    .jec-speakers .jec-bio-btn::after,
    .jec-program .jec-bio-btn::after {
        transition: none;
    }

    .jec-bio-dialog .jec-bio-panel { transform: none; }
}
