/*
 * Homepage article listing as cards.
 * Markup: include/sections/article-card.php (non-search branch, .pf-lc)
 * The DataTable (#example) keeps its paging; only its rows are laid out as a grid.
 * Search results keep their own list design (data-search-active="1").
 * Theme: navy #123f6d, blue #2b5b8a, orange #f78118.
 */

#example[data-search-active="0"],
#example[data-search-active="0"] tbody,
#example[data-search-active="0"] tr,
#example[data-search-active="0"] td {
    display: block;
    width: 100% !important;
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
}

#example[data-search-active="0"] thead {
    display: none;
}

#example[data-search-active="0"] tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

#example[data-search-active="0"] tbody tr,
#example[data-search-active="0"] tbody td {
    display: flex;
}

#example[data-search-active="0"] tbody td.dataTables_empty {
    grid-column: 1 / -1;
}

/* ---------- card ---------- */
.pf-lc {
    --pf-lc-accent: #123f6d; /* one colour for every article type */
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 22px 24px 20px;
    background: #ffffff;
    border: 1px solid #e1e8ef;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(18, 63, 109, 0.05);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

/* strip on top of every card */
.pf-lc::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pf-lc-accent), #2b5b8a);
}


.pf-lc:hover {
    transform: translateY(-4px);
    border-color: #c9d8e7;
    box-shadow: 0 14px 30px rgba(18, 63, 109, 0.13);
}

.pf-lc__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0 14px;
}

.pf-lc__type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--pf-lc-accent) 12%, #ffffff);
    color: var(--pf-lc-accent);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* fallback for browsers without color-mix */
@supports not (background: color-mix(in srgb, red 10%, white)) {
    .pf-lc__type { background: #eef3f8; }
}

.pf-lc__date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #7b8794;
    font-size: 12.5px;
    white-space: nowrap;
}

.pf-lc__title {
    margin: 0 0 12px;
    font-size: 18px !important;
    line-height: 1.35 !important;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pf-lc__title a {
    color: #16222e !important;
    text-decoration: none !important;
    background-image: linear-gradient(#2b5b8a, #2b5b8a);
    background-size: 0 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: color 0.15s ease, background-size 0.25s ease;
}

.pf-lc__title a:hover,
.pf-lc__title a:focus {
    color: #2b5b8a !important;
    background-size: 100% 1px;
}

.pf-lc__authors {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 0 0 16px;
    color: #66727e;
    font-size: 13px;
    font-style: italic;
    line-height: 1.45;
}

.pf-lc__authors svg {
    flex: 0 0 13px;
    margin-top: 3px;
    color: #9aa7b4;
}

.pf-lc__authors span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* bottom part always lines up at the bottom of the card */
.pf-lc__bottom {
    margin-top: auto;
}

.pf-lc__journal-box {
    padding: 12px 14px;
    border-radius: 10px;
    background: #f4f7fb;
    border: 1px solid #e6edf4;
}

.pf-lc__journal {
    color: #2b5b8a;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.pf-lc__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: 4px;
    color: #5f6b77;
    font-size: 12.5px;
}

.pf-lc__sep {
    color: #b3bfcb;
}

.pf-lc__doi {
    margin-top: 3px;
    color: #7b8794;
    font-size: 12px;
    line-height: 1.4;
    word-break: break-all;
}

.pf-lc__doi a {
    color: #7b8794 !important;
    text-decoration: none !important;
}

.pf-lc__doi a:hover {
    color: #2b5b8a !important;
    text-decoration: underline !important;
}

.pf-lc__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
}

.pf-lc__status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #c2620c;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.pf-lc__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f78118;
    box-shadow: 0 0 0 3px rgba(247, 129, 24, 0.18);
}

.pf-lc__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pf-lc__btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border: 1px solid #c9d6e3;
    border-radius: 7px;
    background: #ffffff;
    color: #2b5b8a !important;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pf-lc__btn:hover,
.pf-lc__btn:focus {
    background: #2b5b8a;
    border-color: #2b5b8a;
    color: #ffffff !important;
}

.pf-lc__btn--pdf {
    background: #123f6d;
    border-color: #123f6d;
    color: #ffffff !important;
}

.pf-lc__btn--pdf:hover,
.pf-lc__btn--pdf:focus {
    background: #f78118;
    border-color: #f78118;
}

/* paging under the grid */
#example_wrapper .dataTables_paginate {
    margin-top: 22px;
}

@media (max-width: 767px) {
    #example[data-search-active="0"] tbody {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .pf-lc {
        padding: 20px 18px 18px;
    }
    .pf-lc:hover {
        transform: none;
    }
}

/* "View all articles" next to the PREFLIGHT ARTICLES heading (homepage) */
/* The heading keeps its full width (so its orange line still runs across);
   the link sits on the right of the heading line. */
.pf-heading-row {
    position: relative;
}

.pf-heading-row h2 {
    margin-bottom: 0 !important;
    padding-right: 200px;
}

/* Same height as the heading's text line (below the orange line and the
   heading's top padding), so the button is centred on the heading text. */
.pf-heading-link-wrap {
    position: absolute;
    right: 0;
    top: 25px;   /* 4px orange line + 8px padding of the heading */
    /*top: 12px;   /* 4px orange line + 8px padding of the heading */*/
    bottom: 0;
    display: flex;
    align-items: center;
}

.pf-heading-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px;
    /*padding: 7px 16px;*/
    border: 1.5px solid #2b5b8a;
    border-radius: 7px;
    background: #ffffff;
    color: #2b5b8a !important;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.pf-heading-link:hover,
.pf-heading-link:focus {
    background: #2b5b8a;
    color: #ffffff !important;
}

.pf-heading-link svg {
    transition: transform 0.15s ease;
}

.pf-heading-link:hover svg {
    transform: translateX(3px);
}

.pf-heading-row + .preflight-section-heading__description {
    margin-top: 8px;
}

/* Mobile: the link goes under the heading */
@media (max-width: 575px) {
    .pf-heading-row h2 {
        padding-right: 0;
    }
    .pf-heading-link-wrap {
        position: static;
        display: block;
        margin-top: 10px;
    }
}

/* Status colours (value comes from Articles.ArticleProcessStatus) */
.pf-lc__status--done { color: #15803d; }
.pf-lc__status--done .pf-lc__dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
.pf-lc__status--stopped { color: #b91c1c; }
.pf-lc__status--stopped .pf-lc__dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18); }
.pf-lc__status--other { color: #2b5b8a; }
.pf-lc__status--other .pf-lc__dot { background: #2b5b8a; box-shadow: 0 0 0 3px rgba(43, 91, 138, 0.18); }
