/* ── Community Newsletters page ── */

.nl-page {
    max-width: 1225px;
    margin: 30px auto 60px;
    padding: 0 24px;
}

.nl-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.nl-new-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: #0d1526;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.nl-new-btn:hover {
    background: #1e2f52;
    color: #fff;
}

/* Layout */
.nl-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    position: relative;
}

.nl-layout.is-collapsed {
    grid-template-columns: minmax(0, 1fr);
}

.nl-layout.is-collapsed .nl-sidebar {
    display: none;
}

/* ── Sidebar ── */
.nl-sidebar {
    background: #fff;
    border: 1px solid #c4c3c3;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}

.nl-sidebar-head {
    background: linear-gradient(135deg, #0d1526 0%, #1e2f52 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.nl-sidebar-head h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.nl-collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.nl-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.nl-search {
    position: relative;
    padding: 12px 14px 8px;
}

.nl-search-icon {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-38%);
    font-size: 0.8rem;
    opacity: 0.55;
    pointer-events: none;
}

.nl-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px 9px 34px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.88rem;
    background: #f9fafb;
}

.nl-search input:focus {
    outline: 2px solid #1e40af;
    outline-offset: -1px;
    background: #fff;
}

.nl-count {
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding: 4px 16px 8px;
}

.nl-list {
    overflow-y: auto;
    flex: 1;
    padding-bottom: 8px;
}

.nl-year {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #6b7280;
    background: #f3f4f6;
    padding: 6px 16px;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1;
}

.nl-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f1f3;
    padding: 12px 16px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

/* The display rule above outranks the UA [hidden] rule, so search filtering
   would have no visible effect without this. */
.nl-item[hidden] {
    display: none;
}

.nl-item:hover {
    background: #f8faff;
}

.nl-item.is-active {
    background: #eef2ff;
    box-shadow: inset 3px 0 0 #1e40af;
}

.nl-item-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2d3d;
    line-height: 1.35;
}

.nl-item.is-active .nl-item-title {
    color: #1e40af;
}

.nl-item-meta {
    display: block;
    font-size: 0.74rem;
    color: #6b7280;
    margin-top: 3px;
}

.nl-item-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.45;
    margin-top: 4px;
}

.nl-no-results {
    color: #6b7280;
    font-size: 0.88rem;
    padding: 16px;
    margin: 0;
}

/* Floating expand button (collapsed state).
   Fixed, not sticky: as a grid item its sticky containing block is its own row,
   which is exactly its height, so it would never actually stick. */
.nl-expand-btn {
    position: fixed;
    left: 16px;
    bottom: 24px;
    z-index: 40;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0d1526;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease;
}

.nl-expand-btn:hover {
    background: #1e2f52;
}

.nl-expand-btn[hidden] {
    display: none;
}

/* ── Reader ── */
.nl-reader {
    background: #fff;
    border: 1px solid #c4c3c3;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    min-width: 0;
    overflow: hidden;
}

.nl-reader-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    background: #f8f9fb;
    border-bottom: 1px solid #e5e7eb;
}

.nl-reader-nav {
    display: flex;
    gap: 8px;
}

.nl-nav-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1f2d3d;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.nl-nav-btn:hover:not(:disabled) {
    background: #eef2ff;
    border-color: #1e40af;
}

.nl-nav-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.nl-position {
    font-size: 0.78rem;
    color: #6b7280;
    font-weight: 600;
}

.nl-reader-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nl-tool-link {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e40af;
    text-decoration: none;
}

.nl-tool-link:hover {
    text-decoration: underline;
}

/* Article */
.nl-article {
    padding: 28px 36px 44px;
}

.nl-article-head {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
}

.nl-article-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.25;
    margin: 0 0 10px;
}

.nl-article-meta {
    font-size: 0.85rem;
    color: #6b7280;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.nl-meta-dot {
    color: #d1d5db;
}

.nl-meta-link {
    color: #1e40af;
    text-decoration: none;
}

.nl-meta-link:hover {
    text-decoration: underline;
}

.nl-cover {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    margin-bottom: 24px;
    display: block;
}

.nl-content {
    max-width: 720px;
}

/* Empty state */
.nl-empty-state {
    background: #fff;
    border: 1px solid #c4c3c3;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    text-align: center;
    padding: 60px 24px;
}

.nl-empty-state h2 {
    font-family: 'Montserrat', sans-serif;
    color: #1f2d3d;
    margin: 0 0 8px;
}

.nl-empty-state p {
    color: #6b7280;
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 880px) {
    .nl-layout {
        grid-template-columns: 1fr;
    }

    .nl-sidebar {
        position: static;
        max-height: 420px;
    }

    .nl-expand-btn {
        position: static;
        width: 100%;
        justify-content: center;
    }

    .nl-article {
        padding: 20px 18px 36px;
    }

    .nl-article-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .nl-page {
        padding: 0 12px;
        margin-top: 16px;
    }

    .nl-reader-toolbar {
        padding: 10px 12px;
    }

    .nl-position {
        display: none;
    }
}

/* ── Dark mode ──
   Only elements on the page background need overrides; the sidebar and reader are
   white cards that theme.css deliberately leaves alone. */
[data-theme="dark"] .nl-new-btn,
[data-theme="dark"] .nl-expand-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

[data-theme="dark"] .nl-new-btn:hover,
[data-theme="dark"] .nl-expand-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

[data-theme="dark"] .nl-empty-state h2 {
    color: #ffffff;
}
