/*
 * Scholar profile: sidebar + header toolbar.
 * Only Scholar-specific bits live here; the layout, panel box, collapsible headers,
 * TOC link and toolbar styles are shared with the Library (see fixed-sidebar.css,
 * library-sidebar-toggle.css and search-strategy-export.css).
 */

/* ---------- Panels ---------- */
#scholar-profile .scholar-sidebar-panel {
    text-align: left;
}

#scholar-profile .scholar-sidebar-panel + .scholar-sidebar-panel {
    margin-top: 16px;
}

#scholar-profile .scholar-sidebar-panel .library-panel-header {
    padding: 0 2px 12px;
    margin-bottom: 12px;
    border-bottom: 1px dashed #e2e8f0;
}

/* ---------- Template selector ---------- */
#scholar-profile .scholar-template-dropdown {
    position: relative;
}

#scholar-profile .scholar-template-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    border-radius: 8px;
    font-size: 13px;
    text-align: left;
    white-space: normal;
}

#scholar-profile .scholar-template-btn:hover,
#scholar-profile .scholar-template-btn:focus,
#scholar-profile .scholar-template-dropdown.open .scholar-template-btn {
    border-color: var(--main-color, #278f89);
    background-color: #fff;
}

#scholar-profile .scholar-template-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
}

#scholar-profile .scholar-template-current {
    font-size: 13px;
}

#scholar-profile .scholar-template-menu {
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
}

#scholar-profile .scholar-template-menu > li > a {
    white-space: normal;
}

#scholar-profile .scholar-template-menu > li.active > a,
#scholar-profile .scholar-template-menu > li.active > a > i {
    color: var(--main-color, #278f89);
    background-color: rgba(39, 143, 137, 0.08);
    font-weight: 600;
}

/* ---------- Section index (built by js/profile-toc.js) ---------- */
#scholar-profile #profile-toc,
#scholar-profile #profile-toc ul {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

#scholar-profile #profile-toc ul {
    margin: 1px 0 4px 8px;
    border-left: 2px solid #e2e8f0;
}

#scholar-profile #profile-toc li {
    margin: 1px 0;
    padding-left: 0;
}

/* ---------- Heading + toolbar ---------- */
#scholar-profile .scholar-profile-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 14px;
}

#scholar-profile .scholar-profile-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    margin: 0;
}

#scholar-profile .scholar-profile-toolbar {
    position: relative;
    z-index: 20;
    justify-content: flex-end;
}

/* Indicator cards: the main column is narrower next to the sidebar, so show two
   cards per row on desktop (four in a row squeezes the legends onto the numbers). */
@media (min-width: 992px) {
    #scholar-profile .well.profile:has(> .col-md-3 > .indicators-panel) {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    #scholar-profile .well.profile > .col-md-3:has(> .indicators-panel) {
        flex: 0 0 50%;
        width: 50%;
    }

    #scholar-profile .well.profile:has(> .col-md-3 > .indicators-panel) > .col-md-12 {
        flex: 0 0 100%;
    }
}

/* Keep anchored section headings clear of the top navbar.
   IMPORTANT: keep in sync with OFFSET_PROFILE in js/scrollToAnchor.js. */
#profile-content .section-divider h1,
#profile-content .section-divider h2,
#profile-content .section-divider h3 {
    scroll-margin-top: 70px;
}

@media (max-width: 991px) {
    #scholar-profile .scholar-profile-toolbar {
        justify-content: flex-start;
    }
}

/* ---------- Template panel: template details (category, language, description) ---------- */
#scholar-profile .scholar-template-info {
    margin-top: 10px;
    font-size: 12.5px;
    color: #666;
}

#scholar-profile .scholar-template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

#scholar-profile .scholar-template-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 2px 9px;
    border-radius: 999px;
    background: #f3f5f7;
    color: #555;
    font-size: 11.5px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#scholar-profile .scholar-template-chip i {
    color: #999;
    font-size: 10.5px;
}

#scholar-profile .scholar-template-desc {
    line-height: 1.45;
    overflow-wrap: anywhere;
}

#scholar-profile .scholar-template-desc > :first-child {
    margin-top: 0;
}

#scholar-profile .scholar-template-desc > :last-child {
    margin-bottom: 0;
}

#scholar-profile .scholar-template-desc p {
    margin: 0 0 6px;
}

/* Clamped: first 3 lines only */
#scholar-profile .scholar-template-desc.is-clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

#scholar-profile .scholar-template-desc-toggle {
    margin-top: 3px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--main-color, #439d44);
    font-size: 12px;
}

#scholar-profile .scholar-template-desc-toggle:hover,
#scholar-profile .scholar-template-desc-toggle:focus-visible {
    text-decoration: underline;
}

#scholar-profile .scholar-template-desc-toggle[hidden] {
    display: none;
}

/* ORCiD toolbar button: the iD icon keeps the ORCiD green */
#scholar-profile .scholar-orcid-btn i {
    color: #a6ce39;
}
