:root {
    --navy-darkest: #03142a;
    --navy-darker: #041a38;
    --navy-dark: #06234b;
    --navy-blue: #0a3164;
    --teal-bright: #00d2c4;
    --teal-primary: #0d9488;
    --teal-hover: #0f766e;
    --teal-light: #e6fffa;
    --teal-glow: rgba(0, 210, 196, 0.25);
    --blue-accent: #0284c7;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #0f294a;
    --text-body: #334155;
    --text-muted: #64748b;
    --border-light: rgba(226, 232, 240, 0.9);
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 30px rgba(13, 148, 136, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* overflow-x: clip does NOT create a scroll container (unlike hidden),
   so position: sticky on children keeps working correctly. */
html {
    overflow-x: clip;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    max-width: 100%;
}

.container {
    width: 100%;
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   1. HERO BANNER
   ========================================================================== */
.pub-hero-banner {
    position: relative;
    min-height: 230px;
    background-color: var(--navy-dark);
    background-image: linear-gradient(to right, rgba(3, 20, 42, 0.94) 0%, rgba(6, 35, 75, 0.82) 48%, rgba(6, 35, 75, 0.25) 100%),
                      url('../images/publications_banner.jpg');
    background-size: cover;
    background-position: center right;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    padding: 45px 0 55px;
    overflow: hidden;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

.pub-hero-content {
    position: relative;
    z-index: 2;
    max-width: 720px;
}

.pub-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.pub-breadcrumb a {
    color: var(--teal-bright);
    text-decoration: none;
    transition: color 0.2s;
}

.pub-breadcrumb a:hover {
    text-decoration: underline;
}

.pub-hero-title {
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.pub-hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 20px;
    font-weight: 300;
}

.pub-stats-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pub-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 5px 14px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 500;
}

.pub-stat-pill strong {
    color: var(--teal-bright);
    font-weight: 700;
}

/* ==========================================================================
   2. MAIN LAYOUT (2 Columns: Left Tabs, Right Content)
   ========================================================================== */
.pub-main-section {
    padding: 40px 0 80px;
}

.pub-layout-grid {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 30px;
    align-items: start;
}

/* ==========================================================================
   3. LEFT SIDEBAR TABS
   ========================================================================== */
.pub-sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);

    /* Sticky: sticks below the fixed header while scrolling.
       Naturally stops at the bottom of .pub-layout-grid
       (which sits above the footer) because sticky is
       bounded by its grid-cell / scroll parent. */
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;

    /* JS adds this class when footer enters viewport → release sticky */
    transition: position 0s;
}

/* When footer is visible, let sidebar scroll naturally */
.pub-sidebar-card.at-footer {
    position: relative;
    top: auto;
}

.pub-sidebar-heading {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 12px;
    font-weight: 600;
}

.pub-tabs-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pub-tab-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-body);
    font-size: 0.94rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pub-tab-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pub-tab-left i {
    font-size: 1.05rem;
    color: #94a3b8;
    width: 20px;
    text-align: center;
    transition: color 0.2s;
}

.pub-tab-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    transition: all 0.2s;
}

.pub-tab-btn:hover {
    background: #f8fafc;
    color: var(--teal-hover);
}

.pub-tab-btn:hover .pub-tab-left i {
    color: var(--teal-primary);
}

/* Active Tab Style (matching user reference) */
.pub-tab-btn.active {
    background: var(--teal-light);
    color: var(--teal-hover);
    font-weight: 600;
}

.pub-tab-btn.active .pub-tab-left i {
    color: var(--teal-primary);
}

.pub-tab-btn.active .pub-tab-count {
    background: rgba(13, 148, 136, 0.18);
    color: var(--teal-hover);
}

/* ==========================================================================
   4. RIGHT CONTENT AREA & CONTROLS
   ========================================================================== */
.pub-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.pub-active-title-wrap h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.45rem;
    color: var(--text-dark);
    font-weight: 700;
}

.pub-active-title-wrap p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pub-search-wrap {
    position: relative;
    min-width: 280px;
}

.pub-search-input {
    width: 100%;
    padding: 10px 16px 10px 38px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.88rem;
    color: var(--text-body);
    outline: none;
    transition: all 0.2s;
}

.pub-search-input:focus {
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.pub-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

/* ==========================================================================
   5. PUBLICATION CARDS (Matching Reference Design)
   ========================================================================== */
/* Category Divider (Shown on All Publications Tab) */
.pub-cat-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0 8px 0;
    margin-top: 14px;
    margin-bottom: 2px;
    border-bottom: 2px solid #e2e8f0;
}

.pub-cat-divider.is-hidden {
    display: none !important;
}

.pub-cat-divider:first-of-type {
    margin-top: 0;
}

.pub-cat-divider-label {
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--navy-dark);
    letter-spacing: -0.2px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pub-cat-divider-label::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, var(--teal-primary), var(--teal-hover));
    border-radius: 2px;
}

.pub-cat-divider-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 8px;
    border-radius: 12px;
    background: #e6f6f4;
    color: var(--teal-hover);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
}

/* View All Publications Button */
.pub-view-all-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px 0 16px 0;
    margin-top: 6px;
}

.pub-view-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-hover) 100%);
    color: #ffffff;
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.32);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.2px;
}

.pub-view-all-btn:hover {
    background: linear-gradient(135deg, #14b8a6 0%, var(--teal-primary) 100%);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.42);
    transform: translateY(-2px);
    color: #ffffff;
}

.pub-view-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.pub-view-all-btn i {
    font-size: 0.92rem;
    transition: transform 0.25s ease;
}

.pub-view-all-btn:hover i {
    transform: scale(1.15);
}

.pub-view-all-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
}

.pub-cards-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pub-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    transition: all 0.25s ease;
}

.pub-card:hover {
    border-color: rgba(13, 148, 136, 0.3);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Thumbnail — square */
.pub-thumb-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #e2e8f0;
    flex-shrink: 0;
}

.pub-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.pub-card:hover .pub-thumb-img {
    transform: scale(1.05);
}

/* Paper Type Badge overlaid directly on the thumbnail */
.pub-type-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 6px;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    text-transform: uppercase;
    z-index: 2;
}

/* Specific Quartile Badge Color Schemes */
.badge-q1 {
    background: linear-gradient(135deg, #059669, #10b981);
}

.badge-q2 {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.badge-q3 {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.badge-q4 {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

.badge-book {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
}

.badge-conf, .badge-paper {
    background: linear-gradient(135deg, #0f766e, #0d9488);
}

/* ==========================================================================
   CSS THUMBNAIL (Rendered when no database image exists)
   ========================================================================== */
.pub-css-thumb {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 12px 6px 10px;
    border-radius: 9px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 4px 12px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    user-select: none;
    transition: transform 0.3s ease;
}

.pub-card:hover .pub-css-thumb {
    transform: scale(1.03);
}

.pub-css-thumb-spine {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: rgba(0, 0, 0, 0.28);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.25);
}

.pub-css-thumb-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: 6px;
    z-index: 2;
}

.pub-css-thumb-badge {
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.pub-css-thumb-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.95);
    margin-top: 5px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 4px;
    white-space: nowrap;
}

.pub-css-thumb-lines {
    width: 72%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 2;
    opacity: 0.38;
}

.pub-css-thumb-lines span {
    height: 1.5px;
    background: #ffffff;
    border-radius: 1px;
}

/* Specific CSS Thumbnail Gradients by Type */
.css-thumb-q1 {
    background: linear-gradient(145deg, #064e3b 0%, #047857 55%, #059669 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.css-thumb-q2 {
    background: linear-gradient(145deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.css-thumb-q3 {
    background: linear-gradient(145deg, #78350f 0%, #b45309 55%, #d97706 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.css-thumb-q4 {
    background: linear-gradient(145deg, #4c1d95 0%, #6d28d9 55%, #7c3aed 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.css-thumb-book {
    background: linear-gradient(145deg, #881337 0%, #be123c 55%, #e11d48 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.css-thumb-conf, .css-thumb-paper {
    background: linear-gradient(145deg, #042f2e 0%, #0f766e 55%, #0d9488 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* Middle Info Block */
.pub-info-middle {
    min-width: 0;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
}

.pub-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.pub-citation-text {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pub-citation-text strong {
    color: var(--navy-dark);
}

.pub-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 0;
    overflow: hidden;
}

.pub-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pub-meta-divider {
    color: #cbd5e1;
    font-weight: 300;
}

.pub-doi-link {
    color: var(--teal-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    max-width: min(240px, 60vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
}

.pub-doi-link:hover {
    color: var(--teal-hover);
}

.pub-if-badge {
    background: rgba(13, 148, 136, 0.1);
    color: var(--teal-hover);
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Inline Actions (Details + PDF) inside meta row */
.pub-inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pub-inline-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--teal-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.pub-inline-details-btn:hover {
    color: var(--teal-hover);
    text-decoration: underline;
}

.pub-inline-details-btn i {
    font-size: 0.78rem;
    color: var(--teal-primary);
}

.pub-inline-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #ef4444;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.pub-inline-pdf-btn:hover {
    color: #dc2626;
    text-decoration: underline;
}

.pub-inline-pdf-btn i {
    font-size: 0.82rem;
}

/* Keep old .pub-card-actions hidden if any remain */
.pub-card-actions {
    display: none;
}

.pub-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: transparent;
    color: var(--teal-primary);
    border: 1.5px solid var(--teal-primary);
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.pub-view-btn:hover {
    background: var(--teal-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.25);
    transform: translateX(2px);
}

.pub-view-btn i {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.pub-view-btn:hover i {
    transform: translateX(3px);
}

.pub-quick-dl {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.pub-quick-dl:hover {
    color: var(--teal-hover);
    text-decoration: underline;
}

/* Empty State */
.pub-empty-state {
    background: var(--card-bg);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 50px 20px;
    text-align: center;
    color: var(--text-muted);
}

.pub-empty-state i {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

/* ==========================================================================
   6. INTERACTIVE PAPER DETAILS MODAL
   ========================================================================== */
.pub-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 20, 42, 0.7);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.pub-modal-backdrop.open {
    display: flex;
    opacity: 1;
}

.pub-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.25s ease;
}

.pub-modal-backdrop.open .pub-modal-box {
    transform: translateY(0) scale(1);
}

.pub-modal-header {
    padding: 22px 26px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.pub-modal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pub-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 6px;
    transition: color 0.2s;
}

.pub-modal-close-btn:hover {
    color: #0f172a;
}

.pub-modal-body {
    padding: 24px 26px;
    overflow-y: auto;
    flex: 1;
}

.pub-modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    line-height: 1.4;
}

.pub-modal-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.pub-modal-citation-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--text-body);
    line-height: 1.5;
    margin-bottom: 20px;
}

.pub-modal-grid-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    font-size: 0.86rem;
}

.pub-modal-meta-box {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    padding: 10px 14px;
    border-radius: 10px;
}

.pub-modal-footer {
    padding: 16px 26px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.pub-btn-modal-dl {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--teal-primary);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.2s;
}

.pub-btn-modal-dl:hover {
    background: var(--teal-hover);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.pub-btn-modal-online {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    color: var(--navy-dark);
    border: 1px solid #cbd5e1;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.2s;
}

.pub-btn-modal-online:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* ==========================================================================
   7. RESPONSIVE MEDIA QUERIES — Pixel Perfect
   ========================================================================== */

/* --- Large Tablet (≤ 1100px) — keep sidebar but narrower --- */
@media (max-width: 1100px) {
    .pub-layout-grid {
        grid-template-columns: 230px 1fr;
        gap: 22px;
    }
}

/* --- Tablet Portrait (≤ 900px) — sidebar collapses to scrollable pill row --- */
@media (max-width: 900px) {

    .container {
        padding: 0 16px;
    }

    .pub-layout-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Sidebar → horizontal pill tab bar */
    .pub-sidebar-card {
        position: static;
        border-radius: var(--radius-md);
        padding: 8px 12px;
        margin-bottom: 20px;
        box-shadow: none;
        border: 1px solid var(--border-light);
        background: #fff;
        /* Prevent sidebar from causing horizontal scroll */
        overflow: hidden;
    }

    .pub-sidebar-heading {
        display: none;
    }

    .pub-tabs-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding: 4px 0;
    }

    .pub-tabs-list::-webkit-scrollbar {
        display: none;
    }

    .pub-tabs-list li {
        flex-shrink: 0;
    }

    .pub-tab-btn {
        white-space: nowrap;
        width: auto;
        padding: 8px 14px;
        font-size: 0.85rem;
        border-radius: 999px;
        flex-shrink: 0;
        border: 1.5px solid transparent;
    }

    .pub-tab-btn.active {
        border-color: var(--teal-primary);
    }

    .pub-tab-count {
        font-size: 0.68rem;
        padding: 1px 6px;
    }

    .pub-hero-title {
        font-size: 1.9rem;
    }

    /* Content header: title full-width, search full-width below */
    .pub-content-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .pub-search-wrap {
        width: 100%;
        min-width: unset;
    }

    /* Cards stay 3-column grid but tighter */
    .pub-card {
        grid-template-columns: 100px minmax(0, 1fr) auto;
        gap: 16px;
        padding: 16px 18px;
    }
}

/* --- Mobile (≤ 640px) — cards switch to 2-col thumbnail+info, actions below --- */
@media (max-width: 640px) {

    .container {
        padding: 0 12px;
    }

    /* Hero */
    .pub-hero-banner {
        padding: 28px 0 36px;
        min-height: auto;
    }

    .pub-hero-title {
        font-size: 1.55rem;
        letter-spacing: -0.3px;
    }

    .pub-hero-subtitle {
        font-size: 0.88rem;
        margin-bottom: 14px;
    }

    .pub-stats-pills {
        gap: 6px;
    }

    .pub-stat-pill {
        font-size: 0.74rem;
        padding: 4px 10px;
        gap: 6px;
    }

    /* Main section */
    .pub-main-section {
        padding: 18px 0 48px;
    }

    /* Cards: thumbnail | info stacked, actions below full-width */
    .pub-card {
        grid-template-columns: 80px minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 10px 14px;
        padding: 14px 14px;
        align-items: start;
    }

    .pub-thumb-wrap {
        width: 80px;
        height: 100px;
        grid-row: 1;
        grid-column: 1;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .pub-info-middle {
        grid-row: 1;
        grid-column: 2;
        min-width: 0;
        max-width: 100%;
    }

    .pub-card-title {
        font-size: 0.92rem;
        line-height: 1.3;
        -webkit-line-clamp: 3;
    }

    .pub-citation-text {
        font-size: 0.78rem;
        line-height: 1.35;
        -webkit-line-clamp: 2;
        margin-bottom: 7px;
    }

    .pub-meta-row {
        font-size: 0.72rem;
        gap: 5px 8px;
    }

    .pub-meta-divider {
        display: none; /* cleaner on small screens */
    }

    .pub-if-badge {
        font-size: 0.68rem;
    }

    /* Actions: below, spanning both columns */
    .pub-card-actions {
        grid-row: 2;
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        width: 100%;
        flex-shrink: 0;
    }

    .pub-view-btn {
        padding: 7px 16px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .pub-quick-dl {
        font-size: 0.75rem;
    }

    /* DOI link max-width tighter on mobile */
    .pub-doi-link {
        max-width: 55vw;
    }

    /* CSS Thumbnails */
    .pub-css-thumb-badge {
        font-size: 1.2rem;
    }

    .pub-css-thumb-label {
        font-size: 0.52rem;
    }

    /* Content header */
    .pub-content-header {
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    .pub-active-title-wrap h2 {
        font-size: 1.2rem;
    }

    .pub-active-title-wrap p {
        font-size: 0.78rem;
    }

    /* Modal → bottom sheet */
    .pub-modal-backdrop {
        padding: 0;
        align-items: flex-end;
    }

    .pub-modal-box {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .pub-modal-backdrop.open .pub-modal-box {
        transform: translateY(0);
    }

    .pub-modal-header {
        padding: 16px 18px 14px;
    }

    .pub-modal-body {
        padding: 16px 18px;
    }

    .pub-modal-title {
        font-size: 1.05rem;
    }

    .pub-modal-footer {
        padding: 12px 18px;
        gap: 8px;
    }

    .pub-btn-modal-dl,
    .pub-btn-modal-online {
        padding: 9px 14px;
        font-size: 0.82rem;
        flex: 1;
        justify-content: center;
    }

    .pub-modal-grid-meta {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* --- Extra Small (≤ 400px) --- */
@media (max-width: 400px) {

    .container {
        padding: 0 10px;
    }

    .pub-hero-title {
        font-size: 1.35rem;
    }

    .pub-hero-subtitle {
        font-size: 0.82rem;
    }

    .pub-stat-pill {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .pub-card {
        grid-template-columns: 68px minmax(0, 1fr);
        gap: 8px 10px;
        padding: 12px 12px;
    }

    .pub-thumb-wrap {
        width: 68px;
        height: 86px;
    }

    .pub-card-title {
        font-size: 0.87rem;
    }

    .pub-view-btn {
        padding: 6px 14px;
        font-size: 0.78rem;
    }

    .pub-tab-btn {
        padding: 7px 12px;
        font-size: 0.8rem;
    }

    .pub-sidebar-card {
        padding: 6px 8px;
    }
}

