/* ===================== Base ===================== */
.nm-archive-wrap, .nm-single-wrap {
    /* Fresh blue → green palette, matched to the site's reference
       gradient, so the whole News experience reads as one coherent
       identity — clean, academic/research-center feel. */
    --nm-ink: #16262A;
    --nm-muted: #5B7370;
    --nm-border: #DCEDE7;
    --nm-bg-soft: #EAF6F2;
    --nm-paper: #FFFFFF;

    --nm-accent: #2E86C7;
    --nm-accent-dark: #1C5E86;
    --nm-accent-soft: #E1F2EE;
    --nm-gradient-vivid: linear-gradient(120deg, #3B9FD9 0%, #2FBE8B 100%);
    /* Exact match to the brand reference image — used sparingly for
       small accent panels (e.g. the article masthead top bar), never
       as a full-page wash. */
    --nm-gradient-photo: linear-gradient(135deg, #AADCF1 0%, #C8F2D4 100%);

    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 20px 80px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--nm-ink);
}

.nm-archive-wrap *, .nm-single-wrap * { box-sizing: border-box; }
.nm-archive-wrap img, .nm-single-wrap img { max-width: 100%; height: auto; }

.nm-archive-wrap h1, .nm-single-wrap h1,
.nm-archive-wrap h2, .nm-single-wrap h2 {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

/* ===================== Archive hero ===================== */
.nm-archive-hero {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 32px;
}
.nm-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--nm-accent-dark);
    background: var(--nm-accent-soft);
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    font-family: 'Inter', sans-serif;
}
.nm-archive-hero h1 {
    font-size: clamp(30px, 6.5vw, 44px) !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
    line-height: 1.15;
}
.nm-archive-hero p {
    color: var(--nm-muted);
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
}

/* ===================== Filter bar ===================== */
.nm-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 8px;
    justify-content: center;
    margin: 0 auto 40px;
    max-width: 900px;
    row-gap: 10px;
}
.nm-filter-icon {
    color: var(--nm-muted);
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
}
.nm-filter-icon svg { width: 16px; height: 16px; }
.nm-filter-btn {
    -webkit-appearance: none;
    appearance: none;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--nm-ink) !important;
    background: var(--nm-paper) !important;
    border: 1.5px solid var(--nm-border) !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.nm-filter-btn:hover {
    border-color: var(--nm-accent) !important;
    color: var(--nm-accent-dark) !important;
}
.nm-filter-btn:focus-visible {
    box-shadow: 0 0 0 3px var(--nm-accent-soft) !important;
}
.nm-filter-btn.is-active {
    background: var(--nm-gradient-vivid) !important;
    color: #fff !important;
    border-color: transparent !important;
}
.nm-filter-btn { flex-shrink: 0; }

/* On narrow screens a wrapped multi-row tag list gets messy fast once
   there are many tags — a single scrollable row stays tidy no matter
   how many tags exist. */
@media (max-width: 700px) {
    .nm-filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 8px;
        margin-left: -14px;
        margin-right: -14px;
        padding-left: 14px;
        padding-right: 14px;
        max-width: none;
        mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    }
    .nm-filter-icon { display: none; }
}

/* ===================== Card grid ===================== */
.nm-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.nm-news-card {
    display: flex;
    flex-direction: column;
    background: var(--nm-paper);
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--nm-border);
    box-shadow: 0 1px 2px rgba(22,38,42,0.05);
    transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, border-color .3s ease;
}
.nm-news-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 24px 48px -14px rgba(28,94,134,0.28);
    border-color: transparent;
}
.nm-news-card-pinned {
    border-color: transparent;
    box-shadow: 0 0 0 2px #2FBE8B, 0 10px 26px -12px rgba(28,94,134,0.35);
}
.nm-news-card-pinned:hover {
    box-shadow: 0 0 0 2px #2FBE8B, 0 24px 48px -14px rgba(28,94,134,0.32);
}

.nm-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #eee;
}
.nm-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.nm-news-card:hover .nm-card-image img { transform: scale(1.08); }
.nm-card-placeholder {
    width: 100%;
    height: 100%;
    background: var(--nm-gradient-vivid);
}
.nm-card-image-fade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(12,20,22,0.5) 0%, rgba(12,20,22,0) 45%);
}
.nm-card-badge-date {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(4px);
    color: var(--nm-accent-dark);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.nm-card-badge-pinned {
    position: absolute;
    top: 14px;
    left: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--nm-gradient-vivid);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 5px 12px 5px 9px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 4px 10px -2px rgba(28,94,134,0.4);
}
.nm-card-badge-pinned svg { width: 11px; height: 11px; }

.nm-card-body {
    padding: 20px 22px 4px;
    flex-grow: 1;
}
.nm-card-body h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.nm-card-excerpt {
    font-size: 14px;
    color: var(--nm-muted);
    line-height: 1.7;
    margin: 0 0 14px;
    text-align: justify;
}
.nm-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px;
}
.nm-card-tag-pill {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--nm-accent-dark);
    background: var(--nm-accent-soft);
    padding: 4px 11px;
    border-radius: 20px;
}

.nm-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-top: 1px solid var(--nm-border);
    gap: 10px;
}
.nm-card-source {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--nm-ink);
    min-width: 0;
}
.nm-card-source span:last-child { overflow-wrap: anywhere; }
.nm-source-icon {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--nm-bg-soft);
    color: var(--nm-accent-dark);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.nm-source-icon svg { width: 13px; height: 13px; }

.nm-card-arrow {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--nm-bg-soft);
    display: flex; align-items: center; justify-content: center;
    color: var(--nm-accent);
    transition: background .2s ease, transform .2s ease;
    flex-shrink: 0;
}
.nm-card-arrow svg { width: 15px; height: 15px; }
.nm-news-card:hover .nm-card-arrow {
    background: var(--nm-gradient-vivid);
    color: #fff;
    transform: translateX(3px);
}

.nm-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--nm-muted);
    padding: 60px 0;
}

/* ===================== Single: article masthead ===================== */
/* Image and text sit side by side in a clean white card — the kind of
   layout used on university / research-center news detail pages —
   instead of stacking, and instead of text ever sitting on top of
   the photo. Generous top/bottom margin keeps the whole article from
   crowding the site's own header and footer. */
.nm-single-wrap {
    margin-top: 32px;
    margin-bottom: 32px;
    padding-top: 24px;
    padding-bottom: 100px;
}

.nm-article-masthead {
    position: relative;
    max-width: 1080px;
    margin: 0 auto 48px;
    background: var(--nm-paper);
    border: 1px solid var(--nm-border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 48px -30px rgba(28,94,134,0.28);
    transition: box-shadow .35s ease;
}
.nm-article-masthead:hover {
    box-shadow: 0 32px 60px -26px rgba(28,94,134,0.36);
}
.nm-article-masthead::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--nm-gradient-vivid);
    z-index: 1;
}
.nm-article-masthead-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: stretch;
}
.nm-article-masthead-noimage .nm-article-masthead-grid {
    grid-template-columns: 1fr;
}
.nm-article-masthead-text {
    padding: 48px 46px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.nm-article-masthead-noimage .nm-article-masthead-text {
    text-align: center;
    align-items: center;
    padding: 52px 46px;
}
.nm-article-masthead-media {
    position: relative;
    min-height: 320px;
    overflow: hidden;
}
.nm-article-masthead-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.nm-article-masthead:hover .nm-article-masthead-media img { transform: scale(1.04); }

/* Date badge — floats over the photo's top-right corner. A darker,
   glassy pill (rather than the plain white one on archive cards) so
   it reads as its own, slightly more editorial treatment. */
.nm-article-date-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(18,38,44,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 7px 14px 7px 11px;
    border-radius: 20px;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.25);
}
.nm-article-date-badge svg { width: 13px; height: 13px; flex-shrink: 0; }
@media (max-width: 860px) {
    .nm-article-masthead-grid { grid-template-columns: 1fr; }
    .nm-article-masthead-media { order: -1; min-height: 220px; }
    .nm-article-masthead-text { padding: 34px 26px; }
}

.nm-article-masthead h1 {
    font-size: clamp(24px, 3vw, 34px) !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em;
    line-height: 1.25 !important;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--nm-ink);
}

.nm-meta-row {
    margin: 16px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.nm-article-masthead-noimage .nm-meta-row { justify-content: center; }
.nm-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--nm-bg-soft);
    color: var(--nm-accent-dark);
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 13px 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.nm-meta-pill a { color: var(--nm-accent-dark); text-decoration: underline; text-underline-offset: 2px; }
.nm-meta-pill svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ===================== Lede + tags ===================== */
.nm-lede {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: clamp(16px, 1.6vw, 18px);
    line-height: 1.6;
    color: var(--nm-muted);
    margin: 14px 0 0;
}

.nm-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 0;
}
.nm-article-masthead-noimage .nm-tags-row { justify-content: center; }
.nm-tag-pill {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--nm-accent-dark) !important;
    background: var(--nm-accent-soft) !important;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}
.nm-tag-pill:hover {
    background: var(--nm-gradient-vivid) !important;
    color: #fff !important;
}
/* Non-first tags are plain labels (not links), so they don't react on hover */
span.nm-tag-pill { cursor: default; }
span.nm-tag-pill:hover {
    background: var(--nm-accent-soft) !important;
    color: var(--nm-accent-dark) !important;
}

/* ===================== Article body ===================== */
.nm-article-body {
    max-width: 760px;
    margin: 0 auto 44px;
    font-size: 17px;
    line-height: 1.85;
    color: #223236;
    overflow-wrap: anywhere;
    text-align: justify;
}
.nm-article-body p { margin: 0 0 1.3em; text-align: justify; }
.nm-article-body img { max-width: 100%; height: auto; border-radius: 12px; }

/* ===================== Sections (Gallery / Files) ===================== */
.nm-section {
    max-width: 760px;
    margin: 0 auto 40px;
}
.nm-section h2 {
    font-size: clamp(21px, 2.1vw, 26px) !important;
    font-weight: 700 !important;
    margin: 0 0 18px;
    letter-spacing: 0;
    color: var(--nm-ink);
}

/* ===================== Gallery ===================== */
.nm-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.nm-gallery-item {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    cursor: zoom-in;
    border: 1px solid var(--nm-border);
    background: #eee;
}
.nm-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.nm-gallery-item:hover img { transform: scale(1.08); }
.nm-gallery-item-zoom {
    position: absolute;
    top: 8px; right: 8px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: var(--nm-accent-dark);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .2s ease, transform .2s ease;
}
.nm-gallery-item-zoom svg { width: 13px; height: 13px; }
.nm-gallery-item:hover .nm-gallery-item-zoom { opacity: 1; transform: translateY(0); }

.nm-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10,18,20,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    z-index: 99999;
}
.nm-lightbox.nm-lightbox-open { display: flex; }
.nm-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.nm-lightbox-close {
    position: absolute;
    top: 24px; right: 24px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: none;
}
.nm-lightbox-close svg { width: 18px; height: 18px; }
.nm-lightbox-close:hover { background: rgba(255,255,255,0.22); }

/* ===================== Files ===================== */
.nm-files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}
.nm-file-download {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 7px;
    padding: 16px 8px 10px;
    background: var(--nm-paper);
    border: 1px solid var(--nm-border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--nm-ink);
    overflow: hidden;
    transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, border-color .25s ease;
}
.nm-file-download:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 28px -14px rgba(22,38,42,0.28);
    border-color: transparent;
}
.nm-file-icon {
    color: var(--nm-accent);
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 11px;
    background: var(--nm-bg-soft);
    display: flex; align-items: center; justify-content: center;
}
.nm-file-icon svg { width: 18px; height: 18px; }
.nm-file-name {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    width: 100%;
    overflow-wrap: anywhere;
}
.nm-file-ext {
    font-size: 9.5px;
    font-weight: 800;
    color: var(--nm-muted);
    letter-spacing: 0.04em;
}
.nm-file-download-icon {
    position: absolute;
    top: 7px; right: 7px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 8px rgba(22,38,42,0.15);
    color: var(--nm-muted);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .2s ease, transform .2s ease, color .2s ease;
}
.nm-file-download-icon svg { width: 11px; height: 11px; }
.nm-file-download:hover .nm-file-download-icon { opacity: 1; transform: translateY(0); color: var(--nm-accent); }

.nm-ext-pdf .nm-file-icon { background: #FDECEC; color: #D93636; }
.nm-ext-doc .nm-file-icon, .nm-ext-docx .nm-file-icon { background: #E8F0FE; color: #2F6FE0; }
.nm-ext-ppt .nm-file-icon, .nm-ext-pptx .nm-file-icon { background: #FFF1E3; color: #E0812F; }
.nm-ext-xls .nm-file-icon, .nm-ext-xlsx .nm-file-icon, .nm-ext-csv .nm-file-icon { background: #E9FBEF; color: #1E9A50; }
.nm-ext-zip .nm-file-icon, .nm-ext-rar .nm-file-icon, .nm-ext-7z .nm-file-icon { background: #F1EEFD; color: #6547B8; }
.nm-ext-mp4 .nm-file-icon, .nm-ext-mov .nm-file-icon, .nm-ext-avi .nm-file-icon { background: #FDECF3; color: #D6368F; }
.nm-ext-jpg .nm-file-icon, .nm-ext-jpeg .nm-file-icon, .nm-ext-png .nm-file-icon { background: var(--nm-accent-soft); color: var(--nm-accent-dark); }

@media (max-width: 620px) {
    .nm-files-list { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
    .nm-file-download { padding: 12px 6px 8px; }
}
@media (max-width: 360px) {
    .nm-files-list { grid-template-columns: repeat(3, 1fr); }
}

/* ===================== Back link ===================== */
.nm-back-link { max-width: 760px; margin: 44px auto 0; }
.nm-back-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--nm-accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color .2s ease, gap .2s ease;
}
.nm-back-link a:hover { color: var(--nm-accent-dark); }
.nm-back-link a svg { width: 16px; height: 16px; }

/* ===================== Tablet polish ===================== */
@media (max-width: 860px) and (min-width: 481px) {
    .nm-cards-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
    .nm-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 700px) {
    .nm-archive-wrap, .nm-single-wrap { padding: 36px 16px 70px; }
    .nm-section, .nm-article-body, .nm-back-link { max-width: 100%; }
    .nm-lightbox { padding: 20px; }
}

/* ===================== Extra small-screen polish ===================== */
@media (max-width: 480px) {
    .nm-archive-wrap, .nm-single-wrap { padding: 32px 14px 60px; }
    .nm-cards-grid { grid-template-columns: 1fr; gap: 20px; }
    .nm-card-body { padding: 16px 16px 4px; }
    .nm-card-footer { padding: 14px 16px; flex-wrap: wrap; }
    .nm-back-link { margin-top: 32px; }
    .nm-archive-hero { margin-bottom: 26px; }
    .nm-filter-bar { margin-bottom: 30px; }
    .nm-article-masthead-media { min-height: 200px; }
    .nm-article-masthead-text { padding: 28px 20px; }
    .nm-article-masthead-noimage .nm-article-masthead-text { padding: 34px 20px; }
    .nm-article-body { font-size: 15.5px; }
    .nm-section h2 { margin-bottom: 14px; }
    .nm-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .nm-lightbox { padding: 12px; }
    .nm-lightbox-close { top: 14px; right: 14px; width: 36px; height: 36px; }
}

@media (max-width: 340px) {
    .nm-gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
