/*
 * [bn_publications] module styling — ported verbatim from
 * hello-elementor-child/style.css (the theme where this design was
 * already built and proven), scoped entirely under .bn-publications-module
 * so it can never collide with any other theme CSS. The only additions vs
 * the original are the `.hidden-publication` / `.view-all-btn` rules for
 * the new "View All" behaviour, added at the end.
 */

.bn-publications-module {
    --surface: #ffffff;
    --border: #e4e1d8;
    --text-primary: #1a1814;
    --text-secondary: #6b6760;
    --accent: #3a7d44;
    --accent-light: #e8f4ea;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.10);

    max-width: 1704px;
    margin: 0 auto;

    font-family: 'Sora', sans-serif;
}

.bn-publications-module * {
    font-family: 'Sora', sans-serif;
}

/* Header */
.bn-publications-module .header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.bn-publications-module .header label {
    font-size: 20px;
    line-height: 30px;
    font-weight: 500;
    text-transform: uppercase;
    color: #030712;
}

/* Dropdown */
.bn-publications-module .select-wrapper {
    position: relative;
    width: 158px;
    height: 55px;
}

.bn-publications-module .year-select {
    appearance: none;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    background: var(--surface);
    border: 1px solid #7FB04F;
    border-radius: 12px;
    padding: 14px 44px 14px 20px;
    font-size: 18px;
    line-height: 24px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.bn-publications-module .year-select:focus {
    border-color: var(--accent);
}

.bn-publications-module .select-arrow {
    pointer-events: none;
    position: absolute;
    right: 25px;
    width: 20px;
    height: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #7FB04F;
}

/* Empty state */
.bn-publications-module .bn-publication-empty {
    padding: 40px 20px;
    text-align: center;
    color: #57534D;
    font-size: 16px;
}

/* List */
.bn-publications-module .pub-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Grid (Edited Books / Popular Publications) */
.bn-publications-module .pub-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 30px;
}

.bn-publications-module .pub-grid-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid #F1F1F3;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    animation: bnPubFadeUp 0.4s ease both;
}

/* Invertebrate Taxonomy page only (.publications-list-block is that page's
   own section wrapper — see template-parts/taxonomy/taxonomy-publications.php;
   Edited Books/Popular Publications use .publications-grid-block instead, so
   this never touches those). That page's Figma card is light grey, unlike
   the white cards elsewhere this component is reused for. */
.publications-list-block .pub-grid-card {
    background: #F7F7F8;
}

.bn-publications-module .pub-grid-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.bn-publications-module .pub-grid-card__icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background: #FFFFFF;
    border: 1px solid #F7F7F8;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.bn-publications-module .pub-grid-card__icon img {
    width: 28px;
    height: 28px;
}

.bn-publications-module .pub-grid-card__badge {
    display: inline-block;
    background: #F7F7F8;
    color: #364153;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    border-radius: 999px;
    padding: 4px 14px;
    margin-bottom: 24px;
}

.bn-publications-module .pub-grid-card__title {
    font-size: 20px;
    font-weight: 700;
    line-height: 28px;
    color: #1B250E;
    margin: 0 0 16px;
}

.bn-publications-module .pub-grid-card__authors {
    font-size: 18px;
    line-height: 24px;
    color: #57534D;
    font-weight: 400;
    margin: 0 0 60px;
}

/* At least 60px above the Download button (from the authors line's own
   margin-bottom above); on a card stretched taller than its content by the
   grid row (align-items: stretch), the auto margin still pushes the button
   the rest of the way to the card's bottom edge, keeping every button in a
   row aligned. */
.bn-publications-module .pub-grid-card .download-btn {
    margin-top: auto;
}

/* "Now more" link — the Invertebrate Taxonomy page's own card CTA variant
   (cta_style="link" on the shortcode), a plain arrow-link in place of the
   bordered Download button the other grid sections use. */
.bn-publications-module .pub-grid-card .pub-now-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    color: #7FB04F;
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 24px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.bn-publications-module .pub-grid-card .pub-now-more svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.bn-publications-module .pub-grid-card .pub-now-more:hover {
    color: #5f8f3a;
}

/* Card */
.bn-publications-module .pub-card {
    background: #F7F7F8;
    border: 1px solid #F1F1F3;
    border-radius: 14px;
    display: grid;
    grid-template-columns: 92px 1fr auto;
    align-items: center;
    padding: 0;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    overflow: hidden;
    animation: bnPubFadeUp 0.4s ease both;
}

.bn-publications-module .pub-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: #c8c4bb;
    transform: translateY(-2px);
}

/* Icon */
.bn-publications-module .pub-icon-col {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 0 20px 20px;
}

.bn-publications-module .pub-icon {
    width: 52px;
    height: 52px;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bn-publications-module .pub-icon svg,
.bn-publications-module .pub-icon img {
    width: 28px;
    height: 28px;
    color: #219FD6;
}

/* Content */
.bn-publications-module .pub-body {
    padding: 30px 145px 30px 30px;
    min-width: 0;
}

.bn-publications-module .pub-number {
    font-size: 28px;
    font-weight: 600;
    color: #030712;
    margin-bottom: 10px;
    line-height: 35px;
}

.bn-publications-module .pub-title {
    font-size: 20px;
    font-weight: 500;
    line-height: 30px;
    color: #1B250E;
    margin-bottom: 10px;
}

.bn-publications-module .pub-title a.pub-entry-link {
    color: inherit;
    text-decoration: none;
}

.bn-publications-module .pub-title a.pub-entry-link:hover {
    text-decoration: underline;
}

.bn-publications-module .pub-authors {
    font-size: 18px;
    color: #57534D;
    font-weight: 400;
    line-height: 24px;
}

.bn-publications-module .pub-authors .highlight {
    color: #7FB04F;
    font-weight: 500;
}

.bn-publications-module .pub-authors .pub-meta-sep {
    margin: 0 4px;
    color: #57534D;
}

.bn-publications-module .pub-journal {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Button */
.bn-publications-module .pub-action {
    padding: 14px 20px 14px 8px;
    flex-shrink: 0;
}

.bn-publications-module .download-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #7FB04F;
    color: #7FB04F;
    font-size: 18px;
    line-height: 24px;
    font-weight: 500;
    padding: 14px 24px 14px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-family: 'Poppins';
    transition: all 0.2s ease;
    white-space: nowrap;
}


.bn-publications-module .download-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.bn-publications-module .download-btn:hover {
    background: #7FB04F;
    color: #ffffff;
    transform: scale(1.03);
}

/* Loading spinner */
.bn-publications-module .bn-publications-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0;
}

.bn-publications-module .bn-publications-loading[hidden] {
    display: none;
}

.bn-publications-module .bn-pub-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e4e1d8;
    border-top-color: #7FB04F;
    border-radius: 50%;
    animation: bnPubSpin 0.65s linear infinite;
}

@keyframes bnPubSpin {
    to { transform: rotate(360deg); }
}

/* Results fade transition */
.bn-publications-module .bn-publications-results {
    transition: opacity 0.2s ease;
}

/* Animation */
@keyframes bnPubFadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .bn-publications-module .pub-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile */
@media (max-width: 767px) {
    .bn-publications-module .pub-card {
        grid-template-columns: 1fr;
    }

    .bn-publications-module .pub-grid {
        grid-template-columns: 1fr;
    }

    .bn-publications-module .pub-grid-card {
        padding: 20px;
    }

    .bn-publications-module .pub-grid-card__authors {
        margin-bottom: 24px;
    }

    .bn-publications-module .pub-icon-col {
        display: none;
    }

    /* Desktop reserves 145px on the right of .pub-body for the sibling
       .pub-action grid column (button sits beside the text); once the card
       stacks to a single column above, the button moves below the text
       instead, so that reserved space is dead space here — equalise to a
       plain 30px on every side. */
    .bn-publications-module .pub-body {
        padding: 30px;
    }

    .bn-publications-module .pub-action {
        width: 100%;
        padding: 16px;
    }

    .bn-publications-module .download-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 16px;
    }

    .bn-publications-module .view-all-btn,
    .bn-publications-module .load-more-btn {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* =============================================================================
   "View All" — new addition on top of the ported design above.
   ============================================================================= */

.bn-publications-module .hidden-publication {
    display: none;
}

.bn-publications-module .view-all-btn {
    display: block;
    margin: 20px auto 0;
    padding: 14px 32px;
    background: #7FB04F;
    color: #ffffff;
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.bn-publications-module .view-all-btn:hover {
    background: #6a9942;
    transform: translateY(-1px);
}


/* Same pill as above, as a LINK — the "Staff Publications" button that
   closes the Invertebrate Taxonomy / Service Publications grid (the slot
   the "View All" button used to occupy). No new button design: only the
   two things an <a> needs that a <button> gets for free — no underline,
   and a shrink-to-content width so `display:block; margin:auto` still
   centres it instead of stretching it edge to edge. */
.bn-publications-module a.view-all-btn {
    width: -moz-fit-content;
    width: fit-content;
    text-align: center;
    text-decoration: none;
}

.bn-publications-module .load-more-btn {
    display: block;
    margin: 20px auto 0;
    padding: 14px 32px;
    background: #7FB04F;
    color: #ffffff;
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.bn-publications-module .load-more-btn:hover {
    background: #6a9942;
    transform: translateY(-1px);
}

/* =============================================================================
   Figma alignment fixes — deviations from the ported design above.
   ============================================================================= */

/* Figma pins the file icon to the top of the card, not vertically centred
   with the (often taller, multi-line) title/authors text next to it. */
.bn-publications-module .pub-icon-col {
    align-self: flex-start;
}
