/* ============================================
   PUBLICATIONS PAGE — pages/publications.html
   Uses the same design tokens (--paper, --ink, etc.)
   already defined in style.css, loaded before this file.
   ============================================ */

/* ---- Page banner ---- */
.pub-banner {
    background: linear-gradient(160deg, #1A1A1A 0%, #000000 100%);
    color: #fff;
    padding: 90px 24px 70px;
    text-align: center;
}

.pub-banner-inner {
    max-width: 680px;
    margin: 0 auto;
}

.pub-banner-kicker {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #cccccc;
    margin-bottom: 14px;
}

.pub-banner h1 {
    font-family: 'Zilla Slab', serif;
    font-size: clamp(2rem, 4vw, 2.8rem);
    margin: 0 0 16px;
    color: #fff;
}

.pub-banner-sub {
    font-size: 1.05rem;
    line-height: 1.65;
    color: #e0e0e0;
    margin: 0 0 28px;
}

/* ---- Search / filter toolbar ---- */
.pub-toolbar-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 0;
}

.pub-toolbar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--paper, #fff);
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.pub-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e2ddd2;
    border-radius: 8px;
    padding: 9px 12px;
    background: #faf8f3;
}

.pub-search-box svg {
    color: #9a9284;
    flex-shrink: 0;
}

.pub-search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-family: 'Karla', sans-serif;
    font-size: 14.5px;
    color: var(--ink, #2a2420);
}

.pub-cat-select {
    border: 1px solid #e2ddd2;
    border-radius: 8px;
    padding: 9px 14px;
    background: #faf8f3;
    font-family: 'Karla', sans-serif;
    font-size: 14.5px;
    color: var(--ink, #2a2420);
    cursor: pointer;
}

/* ---- Grid section ---- */
.pub-list-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 90px;
}

.publications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 26px;
}

.publications-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted-2, #777);
    padding: 40px 0;
}

/* ---- Publication card (shared shape with the homepage teaser) ----
   Newspaper-style: no big banner image — a round author avatar sits
   in the byline instead, same treatment as the single article page. */
.publication-card {
    background: var(--paper, #fff);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* prevents flex children from forcing overflow */
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.publication-card:hover,
.publication-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    outline: none;
}

/* Legacy banner-image rules — no longer used by publications.js /
   publication-view.js (cards now use the round byline avatar below),
   kept here in case anything else on the site still renders one. */
.publication-card-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    height: auto;
    object-fit: cover;
    display: block;
    background: #eee;
}

.publication-card-img-placeholder {
    aspect-ratio: 16 / 10;
    width: 100%;
    background: linear-gradient(135deg, #f1ede4, #e6dfd0);
}

.publication-card-body {
    padding: 24px 20px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.publication-card-tag {
    display: inline-block;
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1A1A1A;
    background: rgba(0, 0, 0, 0.08);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.publication-card-body h3 {
    margin: 0 0 12px;
    font-family: 'Zilla Slab', serif;
    font-size: 1.15rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ---- Byline: round author avatar + name, newspaper op-ed style ---- */
.publication-card-byline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
}

.publication-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f1ede4, #e6dfd0);
    border: 2px solid #ece6d8;
}

.publication-card-author {
    font-size: 13px;
    color: var(--muted-2, #777);
    margin: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.publication-card-excerpt {
    font-size: 14px;
    line-height: 1.55;
    color: #444;
    margin: 0 0 14px;
    flex: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.publication-card-read {
    font-size: 13px;
    font-weight: 700;
    color: #1A1A1A;
    margin-top: auto;
}

.publication-card-read::after {
    content: " →";
}

/* ---- Load more button ---- */
.load-more-pub {
    display: block;
    margin: 40px auto 0;
    padding: 11px 32px;
    border: 1.5px solid #1A1A1A;
    border-radius: 999px;
    background: transparent;
    color: #1A1A1A;
    font-family: 'Karla', sans-serif;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.load-more-pub:hover {
    background: #1A1A1A;
    color: #fff;
}

/* ---- Reading modal (built dynamically by publications.js; currently
   unused since cards link straight to publication.html, kept for any
   future use) ---- */
.pub-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 14, 12, 0.55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    z-index: 1000;
    overflow-y: auto;
}

.pub-modal-overlay.open {
    display: flex;
}

.pub-modal-box {
    background: var(--paper, #fff);
    border-radius: 16px;
    max-width: 720px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: auto;
}

.pub-modal-scroll {
    padding: 40px 36px 44px;
    max-height: 85vh;
    overflow-y: auto;
}

.pub-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #444;
    cursor: pointer;
    z-index: 2;
}

.pub-modal-close:hover {
    background: rgba(0, 0, 0, 0.12);
}

.pub-modal-img {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 18px;
}

.pub-modal-scroll h2 {
    font-family: 'Zilla Slab', serif;
    font-size: 1.7rem;
    margin: 0 0 8px;
    line-height: 1.3;
}

.pub-modal-author {
    font-size: 14px;
    color: var(--muted-2, #777);
    margin: 0 0 22px;
}

.pub-modal-content {
    font-size: 15.5px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .pub-banner {
        padding: 70px 20px 50px;
    }

    .pub-modal-scroll {
        padding: 32px 22px 34px;
    }

    .pub-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pub-cat-select {
        width: 100%;
    }
}

/* ---- Cards are now links (publications.js / main.js / publication-view.js
   all render <a class="publication-card">) ---- */
a.publication-card {
    text-decoration: none;
    color: inherit;
}

/* ---- Single publication article page (pages/publication.html) ---- */
.pub-article-section {
    max-width: 760px;
    margin: 0 auto;
    padding: 60px 24px 20px;
}

.pub-back-link {
    display: inline-block;
    margin-bottom: 22px;
    font-size: 14px;
    font-weight: 700;
    color: #1A1A1A;
}

.pub-back-link:hover {
    text-decoration: underline;
}

.pub-article-inner h1 {
    font-family: 'Zilla Slab', serif;
    font-size: clamp(1.8rem, 3.6vw, 2.4rem);
    line-height: 1.3;
    margin: 12px 0 10px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pub-article-meta {
    font-size: 14px;
    color: var(--muted-2, #777);
    margin: 0 0 26px;
}

.pub-article-img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 30px;
    display: block;
}

/* ---- Byline with round author photo (newspaper style) ---- */
.pub-byline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 26px;
}

.pub-author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #ece6d8;
}

.pub-byline .pub-article-meta {
    margin: 0;
}

.pub-article-content {
    font-size: 16.5px;
    line-height: 1.85;
    color: #333;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Rich-text content (from the article/essay editor) arrives as HTML —
   <p>/<div> per paragraph. Give those visible spacing so paragraphs
   the author separated with Enter don't run together on the page. */
.pub-article-content p,
.pub-article-content div {
    margin: 0 0 1.1em;
}

.pub-article-content p:last-child,
.pub-article-content div:last-child {
    margin-bottom: 0;
}

.pub-article-content ul,
.pub-article-content ol {
    padding-left: 24px;
    margin: 0 0 1.1em;
}

/* ---- Share bar (below article content) ---- */
.pub-share-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid #ece6d8;
}

.pub-share-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-2, #777);
}

.pub-share-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pub-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1.5px solid #e2ddd2;
    background: #faf8f3;
    font-family: 'Karla', sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink, #2a2420);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pub-share-btn:hover {
    border-color: #1A1A1A;
    color: #1A1A1A;
}

.pub-share-whatsapp {
    background: #E9F9EF;
    border-color: #BFEBCB;
    color: #128C3E;
}

.pub-share-whatsapp:hover {
    background: #DFF5E6;
    border-color: #128C3E;
    color: #0f6f31;
}

.pub-share-copy.pub-share-copied {
    background: #EDEDED;
    border-color: #1A1A1A;
    color: #1A1A1A;
}

@media (max-width: 480px) {
    .pub-share-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.pub-article-loading,
.pub-article-error {
    text-align: center;
    color: var(--muted-2, #777);
    padding: 60px 20px;
    line-height: 1.8;
}

.pub-article-error a {
    color: #1A1A1A;
    font-weight: 700;
}

/* ---- Related publications (below the article) ---- */
.pub-related-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 24px 90px;
    border-top: 1px solid #ece6d8;
}

.pub-related-inner h2 {
    font-family: 'Zilla Slab', serif;
    font-size: 1.6rem;
    margin: 40px 0 26px;
    text-align: center;
}

@media (max-width: 640px) {
    .pub-article-section {
        padding: 40px 20px 10px;
    }
}

.pub-article-content.is-urdu {
    line-height: 2.1;
}

.publication-card-excerpt.is-urdu {
    line-height: 1.9;
}