/**
 * INATGI Theme Six — Editorial Leadership repair 2026-08-24
 *
 * This layer activates only when JS detects real editor portrait images
 * inside .inatgi-eic-managed-content.
 *
 * Goal:
 * - remove the redundant generic EIC circle when real portraits are present;
 * - turn the managed editor profiles into balanced academic profile cards;
 * - use the full content width instead of a narrow vertical stack;
 * - keep the journal-wide shared template safe for journals that still rely
 *   on /public/journals/{id}/EIC.png.
 */

/* =========================================================
   REAL MANAGED EDITOR PROFILES
   ========================================================= */

body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles {
    display: block !important;
    min-height: 0 !important;
    padding: 20px 4px 10px !important;
}

/* The large generic EIC circle is redundant when the managed content
   already contains actual portrait photographs. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
> .inatgi-eic-photo {
    display: none !important;
}

body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
> .inatgi-eic-details {
    width: 100% !important;
    max-width: none !important;
    flex: none !important;
    min-width: 0 !important;
}

/* Keep the role as a compact academic label rather than a second large
   heading competing with "Editorial Leadership". */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
> .inatgi-eic-details > h3 {
    margin: 0 0 20px !important;
    color: var(--journal-accent, #b11226) !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    letter-spacing: .10em !important;
    text-align: center !important;
    text-transform: uppercase !important;
}

/* The managed area becomes a two-column leadership grid. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-eic-managed-content {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 24px !important;
    width: 100% !important;
    max-width: 1040px !important;
    margin: 0 auto 26px !important;
    padding: 0 !important;
    color: #383838 !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
}

/* Each profile block is classified by the companion JS. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card {
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 104px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 18px !important;
    min-width: 0 !important;
    min-height: 152px !important;
    margin: 0 !important;
    padding: 18px 20px !important;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-top: 3px solid var(--journal-accent, #b11226) !important;
    border-radius: 5px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .04) !important;
    text-align: left !important;
}

/* Portraits become equal-sized, professional rectangles. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card img {
    grid-column: 1 !important;
    grid-row: 1 / span 20 !important;
    display: block !important;
    float: none !important;
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
    height: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: cover !important;
    object-position: center top !important;
    border: 1px solid #d8d8d8 !important;
    border-radius: 5px !important;
    box-shadow: none !important;
}

/* Neutralise editor-entered paragraph spacing inside profile cards. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card p,
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card div {
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    text-align: left !important;
}

/* Name line. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card strong,
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card b {
    color: #151515 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
}

/* Smaller qualification suffixes remain visually secondary. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card em {
    color: #666 !important;
    font-style: normal !important;
}

/* Remove inherited image-link underlines/backgrounds. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-card a {
    text-decoration: none !important;
}

/* Buttons sit together beneath the leadership grid. */
body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-panel-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin: 8px auto 0 !important;
    padding: 0 !important;
}

/* =========================================================
   TABLE-BASED MANAGED CONTENT FALLBACK
   ========================================================= */

body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-table {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 1040px !important;
    margin: 0 auto !important;
    border-collapse: separate !important;
    border-spacing: 18px !important;
}

body.pkp_page_index.pkp_op_index
.inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
.inatgi-managed-editor-table td {
    vertical-align: middle !important;
}

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

@media (max-width: 960px) {
    body.pkp_page_index.pkp_op_index
    .inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
    .inatgi-eic-managed-content {
        grid-template-columns: 1fr !important;
        max-width: 720px !important;
    }
}

@media (max-width: 600px) {
    body.pkp_page_index.pkp_op_index
    .inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles {
        padding-top: 14px !important;
    }

    body.pkp_page_index.pkp_op_index
    .inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
    .inatgi-managed-editor-card {
        grid-template-columns: 82px minmax(0, 1fr) !important;
        gap: 14px !important;
        min-height: 126px !important;
        padding: 14px !important;
    }

    body.pkp_page_index.pkp_op_index
    .inatgi-editorial-leadership-card.inatgi-eic-has-managed-profiles
    .inatgi-managed-editor-card img {
        width: 82px !important;
        min-width: 82px !important;
        max-width: 82px !important;
        height: 100px !important;
        min-height: 100px !important;
        max-height: 100px !important;
    }
}
