/*
 * Past Publications (issue #1248)
 * Scoped under .ppx. Sites override the brand variables on .ppx in their page.
 * Card illustrations are inline SVG from pp-art.php, coloured by these variables.
 */
.ppx {
    --ppx-heading: #000;            /* section heading */
    --ppx-title-accent: #12a3a6;    /* highlighted word in the section heading */
    --ppx-accent: #0e8c8f;          /* CTA, eyebrow text */
    --ppx-accent-ink: #fff;         /* text on the CTA */
    --ppx-soft: #e8f7f8;            /* eyebrow background */
    --ppx-line: #d7eef0;            /* card border */
    --ppx-muted: #66708a;
    --ppx-art-from: #082d45;        /* illustration field, darkest corner */
    --ppx-art-mid: #0d4c73;
    --ppx-art-to: #0b6a7e;
    --ppx-art-line: #7fe3e2;        /* illustration lines and particles */
    --ppx-art-glow: #19c3c6;        /* soft glow behind the drawing */
    --ppx-art-ink: #fff;            /* title on the illustration */
    --ppx-art-sub: #c4ecec;         /* date on the illustration */
    --ppx-radius: 12px;

    color: #13213c;
    font-size: 15px;
    line-height: 1.5;
}

.ppx *, .ppx *::before, .ppx *::after { box-sizing: border-box; }

.ppx-wrap { max-width: 1170px; margin: 0 auto; padding: 32px 15px 40px; }

/* Theme stylesheets restyle bare h2/h3/p; reset them inside the section. */
.ppx .ppx-wrap h2, .ppx .ppx-wrap h3 {
    margin: 0; padding: 0; border: 0; background: none; color: inherit;
    text-transform: none; letter-spacing: normal; text-shadow: none;
    font-family: inherit; line-height: 1.3; float: none; width: auto;
}
.ppx h2::before, .ppx h2::after, .ppx h3::before, .ppx h3::after { content: none; }
.ppx .ppx-wrap p { margin: 0; padding: 0; font-size: inherit; }

/* Heading */
.ppx .ppx-head { text-align: center; margin-bottom: 28px; }
.ppx-eyebrow {
    display: inline-block; padding: 5px 14px; border-radius: 4px;
    background: var(--ppx-soft); color: var(--ppx-accent);
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.ppx .ppx-head .ppx-title { font-size: 32px; font-weight: 800; color: var(--ppx-heading); margin-top: 12px; text-align: center; }
.ppx .ppx-title span { color: var(--ppx-title-accent); }
.ppx .ppx-head .ppx-intro { max-width: 680px; margin: 10px auto 0; color: var(--ppx-muted); text-align: center; }

/* Cards */
.ppx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.ppx-grid:has(> .ppx-card:only-child) { grid-template-columns: minmax(0, 380px); justify-content: center; }
.ppx-grid:has(> .ppx-card:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 380px)); justify-content: center; }

.ppx-card {
    position: relative; display: flex; flex-direction: column; min-width: 0; cursor: pointer;
    background: #fff; border: 1px solid var(--ppx-line); border-radius: var(--ppx-radius);
    overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.ppx-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(13, 76, 115, .16); }
.ppx-card:has(.ppx-cta:focus-visible) { outline: 3px solid var(--ppx-accent); outline-offset: 2px; }

/* Illustration: the drawing sits on the right, the title and author on a fade at the left */
.ppx-art {
    position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 12px;
    aspect-ratio: 16 / 11; max-width: 100%; padding: 20px; overflow: hidden;
    background: linear-gradient(145deg, var(--ppx-art-from) 0%, var(--ppx-art-mid) 52%, var(--ppx-art-to) 100%);
}
.ppx-art::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(100deg, var(--ppx-art-from) 0%, color-mix(in srgb, var(--ppx-art-from) 60%, transparent) 40%, transparent 62%);
}
.ppx-art .ppa { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.ppx-art .ppa .glow-in { stop-color: var(--ppx-art-glow); stop-opacity: .38; }
.ppx-art .ppa .glow-out { stop-color: var(--ppx-art-glow); stop-opacity: 0; }
.ppx-art .ppa .spark { fill: var(--ppx-art-line); }
.ppx-art .ppa .draw { fill: none; stroke: var(--ppx-art-line); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ppx-art .ppa .draw .thin { stroke-width: 1.6; opacity: .85; }
.ppx-art .ppa .draw .faint { stroke-width: 1.1; opacity: .5; }
.ppx-art .ppa .draw .dot { fill: #fff; stroke: none; }
.ppx-art .ppa .draw .fill { fill: color-mix(in srgb, var(--ppx-art-line) 22%, transparent); stroke: var(--ppx-art-line); stroke-width: 1.4; }

.ppx .ppx-art .ppx-card-title {
    color: var(--ppx-art-ink); font-size: 20px; line-height: 1.28; font-weight: 800; max-width: 64%;
    text-shadow: 0 1px 14px rgba(8, 45, 69, .6); overflow-wrap: anywhere; text-wrap: balance;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.ppx-meta { margin-top: auto; display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 72%; }
.ppx-who { display: grid; min-width: 0; }
.ppx-avatar {
    flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: #fff; color: var(--ppx-art-mid); font-size: 12px; font-weight: 800;
}
.ppx-by { color: var(--ppx-art-ink); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ppx-date { color: var(--ppx-art-sub); font-size: 12px; }

.ppx-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--ppx-line); }
.ppx-src {
    font-size: 12px; color: var(--ppx-muted);
    flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;   /* the label gives way, never the button */
}
/* width/height/flex reset: some themes size every button (e.g. Research Leagues: button { width: 9% }) */
.ppx .ppx-cta {
    display: inline-block; margin: 0; padding: 8px 14px; border: 0; border-radius: 6px; cursor: pointer;
    width: auto; min-width: max-content; max-width: none; height: auto; flex: 0 0 auto;
    background: var(--ppx-accent); color: var(--ppx-accent-ink);
    font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1.4;
    text-transform: none; letter-spacing: normal; white-space: nowrap;
}
/* stretch the button's click area over the whole card */
.ppx .ppx-cta::after { content: ""; position: absolute; inset: 0; z-index: 1; }
/* darken with a colour, not filter: a filter would shrink the ::after click area back to the button */
.ppx-card:hover .ppx-cta, .ppx .ppx-cta:focus-visible { background: color-mix(in srgb, var(--ppx-accent) 86%, #000); }
.ppx .ppx-cta:focus-visible { outline: none; }   /* the card shows the focus ring */
.ppx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* View More – below the cards, to the Academic Research Library home page */
.ppx-more { display: flex; justify-content: center; margin-top: 28px; }
.ppx .ppx-more-link {
    display: inline-flex; align-items: center; gap: 8px; padding: 11px 26px; border-radius: 6px;
    border: 2px solid var(--ppx-accent); background: transparent; color: var(--ppx-accent);
    font-size: 14px; font-weight: 700; text-decoration: none; transition: background .2s, color .2s;
}
.ppx .ppx-more-link:hover, .ppx .ppx-more-link:focus-visible { background: var(--ppx-accent); color: var(--ppx-accent-ink); text-decoration: none; }
.ppx .ppx-more-link:focus-visible { outline: 2px solid var(--ppx-accent); outline-offset: 3px; }

/* View Article modal (native <dialog>) */
html.ppx-lock { overflow: hidden; }
.ppx-modal {
    width: min(760px, calc(100vw - 32px)); max-height: min(86vh, 900px); padding: 0; border: 0;
    border-radius: var(--ppx-radius); box-shadow: 0 24px 70px rgba(8, 45, 69, .35); color: #13213c; background: #fff;
}
.ppx-modal::backdrop { background: rgba(8, 45, 69, .55); }
.ppx-m-inner { position: relative; max-height: inherit; overflow-y: auto; padding: 30px 32px 24px; }
.ppx-m-close {
    position: sticky; top: 0; float: right; margin: -14px -16px 0 12px; width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--ppx-line); background: #fff; color: var(--ppx-art-mid); font-size: 22px; line-height: 1; cursor: pointer;
}
.ppx-m-close:hover, .ppx-m-close:focus-visible { background: var(--ppx-soft); outline: 2px solid var(--ppx-accent); outline-offset: 1px; }
/* the pop-up sits outside .ppx-wrap, so reset the theme's heading styles (borders, bars, transforms) here too */
.ppx .ppx-modal .ppx-m-title {
    margin: 0 0 18px; padding: 0; border: 0; background: none; text-transform: none; letter-spacing: normal; text-shadow: none;
    color: var(--ppx-art-mid); font-size: 22px; font-weight: 800; line-height: 1.3; text-align: left; text-wrap: balance;
}
.ppx .ppx-modal .ppx-m-title::before, .ppx .ppx-modal .ppx-m-title::after { content: none; display: none; }
.ppx-m-fields { margin: 0; display: grid; gap: 14px; }
.ppx-m-fields > div { display: grid; gap: 4px; }
.ppx-m-fields > div[hidden] { display: none; }   /* display:grid above would otherwise override [hidden] */
.ppx-m-fields dt { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ppx-accent); }
.ppx-m-fields dd { margin: 0; font-size: 15px; line-height: 1.6; color: #24323f; overflow-wrap: anywhere; }
.ppx-m-abstract dd { text-align: justify; hyphens: auto; }

/* Tablet: 3 narrower columns */
@media (max-width: 991px) {
    .ppx-grid { gap: 16px; }
    .ppx-art { padding: 16px; }
    .ppx .ppx-art .ppx-card-title { font-size: 16px; max-width: 78%; -webkit-line-clamp: 3; }
    .ppx-meta { max-width: 90%; }
    .ppx-src { display: none; }
    .ppx-foot { justify-content: center; }
    .ppx .ppx-head .ppx-title { font-size: 28px; }
}

/* Narrow cards on a wide screen (the section sits in a narrow column, e.g. CSGAC):
   the tablet sizes, chosen by the card's own width so the title never runs into the author */
.ppx-card { container-type: inline-size; }
@container (max-width: 300px) {
    .ppx-art { padding: 16px; }
    .ppx .ppx-art .ppx-card-title { font-size: 16px; max-width: 78%; -webkit-line-clamp: 3; }
    .ppx-meta { max-width: 90%; }
    .ppx-src { display: none; }
    .ppx-foot { justify-content: center; }
}

/* Mobile: 1 column */
@media (max-width: 767px) {
    .ppx-wrap { padding: 24px 16px 32px; }
    .ppx-grid, .ppx-grid:has(> .ppx-card:nth-child(2):last-child),
    .ppx-grid:has(> .ppx-card:only-child) { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .ppx-art { padding: 20px; }
    .ppx .ppx-art .ppx-card-title { font-size: 19px; max-width: 66%; -webkit-line-clamp: 4; }
    .ppx-meta { max-width: 74%; }
    .ppx-src { display: inline; }
    .ppx-foot { justify-content: space-between; }
    .ppx .ppx-head .ppx-title { font-size: 24px; }
    .ppx-m-inner { padding: 24px 20px 20px; }
    .ppx .ppx-modal .ppx-m-title { font-size: 19px; }
    .ppx-m-abstract dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) { .ppx-card { transition: none; } .ppx-card:hover { transform: none; } }
