/* ============================================================
   news.css — News & Updates page styles
   Covers: listing mode (hero, tag bar, card grid, load more)
           and detail mode (featured image, article body, footer)
   ============================================================ */

/* ── Page Hero ─────────────────────────────────────────────── */

.news-page-hero {
    background-color: var(--dark-bg);
    margin-top: 70px; /* clear fixed navbar */
    padding: 72px 24px 56px;
    text-align: center;
    border-bottom: 1px solid #2a2a2a;
}

.news-page-hero-inner {
    max-width: 680px;
    margin: 0 auto;
}

.news-page-hero-inner h1 {
    font-family: 'Aboreto', serif;
    font-size: 3.6rem;
    color: var(--accent-gold);
    margin: 0 0 20px;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

.news-page-hero-inner p {
    font-family: 'Lato', sans-serif;
    font-size: 1.15rem;
    color: var(--text-gray);
    margin: 18px 0 0;
    line-height: 1.6;
}

/* Gold ornament divider in hero */
.news-hero-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0 auto;
    width: 240px;
}

.news-hero-line {
    flex: 1;
    height: 1px;
    background-color: var(--accent-gold);
    opacity: 0.7;
}

.news-hero-diamond {
    width: 8px;
    height: 8px;
    background-color: var(--accent-gold);
    transform: rotate(45deg);
    margin: 0 12px;
    flex-shrink: 0;
}

/* ── Admin bar (listing mode, admin-only) ─────────────────── */

.news-admin-bar {
    background-color: #111;
    border-bottom: 1px solid var(--accent-gold);
    padding: 10px 0;
}

.news-admin-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: flex-end;
}

.news-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    min-height: 44px;
}

.news-admin-link:hover,
.news-admin-link:focus-visible {
    background-color: var(--accent-gold);
    color: #000;
    outline: none;
}

/* ── Main content area — viewport floor before JS hydration ──────────────
   #newsListingView starts hidden (display:none, height 0). When the listing
   is revealed, #newsMain grows and pushes #newsCta / footer.footer down → CLS.
   min-height: 100vh places #newsCta at (hero-height + 100vh) from the document
   top — always below the fold regardless of viewport size or post count.
     • listing-height > 100vh (≥2 posts on typical screens): #newsMain grows to
       content height; both CTA positions (before and after reveal) are off-screen
       → 0 CLS impact for any post count.
     • listing-height ≤ 100vh (0–1 posts): min-height prevents any shrink; CTA
       stays put → 0 shift at all. */

#newsMain {
    min-height: 100vh;
}

/* ── Listing layout container ─────────────────────────────── */

#newsListingView {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ── Loading spinner ──────────────────────────────────────── */

.news-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 220px;
    color: var(--accent-gold);
    font-size: 2rem;
}

/* #newsListingSpinner is a sibling of #newsListingView (not nested inside it).
   padding-top matches the visual position the spinner had when it was nested
   inside #newsListingView, which contributed 40px top padding at this breakpoint. */
#newsListingSpinner {
    padding-top: 40px;
}

.news-spinner-label {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    color: var(--text-gray);
}

/* ── Tag filter bar ───────────────────────────────────────── */

.news-tag-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}

.news-tag-pill {
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-gray);
    background: transparent;
    border: 1px solid #444;
    border-radius: 100px;
    padding: 8px 18px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.news-tag-pill:hover,
.news-tag-pill:focus-visible {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    outline: none;
}

.news-tag-pill--active {
    border-color: var(--accent-gold);
    color: #000;
    background-color: var(--accent-gold);
}

.news-tag-pill--active:hover,
.news-tag-pill--active:focus-visible {
    background-color: var(--accent-gold-hover);
    border-color: var(--accent-gold-hover);
    color: #000;
}

/* ── Post card grid ───────────────────────────────────────── */

.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 40px;
}

@media (min-width: 640px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
}

/* ── Post card ────────────────────────────────────────────── */

.news-card {
    display: flex;
    flex-direction: column;
    background-color: var(--dark-gray);
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s;
}

.news-card:hover,
.news-card:focus-visible {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    outline: none;
}

.news-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    background-color: #111;
}

.news-card-img-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #111;
    color: #3a3a3a;
    font-size: 3rem;
}

.news-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px 22px 22px;
    gap: 8px;
}

.news-card-meta {
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    color: #888;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.news-card-author {
    color: #888;
}

.news-card-title {
    font-family: 'Lato', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-white);
    margin: 4px 0 0;
    line-height: 1.35;
}

.news-card-excerpt {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    color: var(--text-gray);
    line-height: 1.6;
    margin: 0;
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.news-card-tag {
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 100px;
    padding: 2px 10px;
}

.news-card-readmore {
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    color: var(--accent-gold);
    font-weight: 600;
    margin-top: auto;
    padding-top: 10px;
}

/* ── Empty state ──────────────────────────────────────────── */

.news-empty {
    font-family: 'Lato', sans-serif;
    font-size: 1.05rem;
    color: #888;
    text-align: center;
    padding: 60px 24px;
}

/* ── Load more ────────────────────────────────────────────── */

.news-load-more-wrap {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.news-load-more-btn {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-gold);
    background: transparent;
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    padding: 12px 36px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    min-height: 44px;
    min-width: 180px;
}

.news-load-more-btn:hover,
.news-load-more-btn:focus-visible {
    background-color: var(--accent-gold);
    color: #000;
    outline: none;
}

/* ── Detail view container ────────────────────────────────── */

#newsDetailView {
    /* no max-width — hero image is full bleed; article is constrained inside */
    min-height: 80vh;
}

/* ── Featured image hero (detail mode) ───────────────────── */

.news-detail-hero {
    width: 100%;
    max-height: 480px;
    overflow: hidden;
    margin-top: 70px; /* clear fixed navbar */
    background-color: #0a0a0a;
}

.news-detail-hero-img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    display: block;
}

/* ── Article layout ───────────────────────────────────────── */

.news-article {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 24px 72px;
}

#newsDetailHero[hidden] ~ .news-article {
    padding-top: 80px; /* extra top padding when no hero image (clears navbar) */
    margin-top: 0;
}

/* ── Article header ───────────────────────────────────────── */

.news-article-header {
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid #2a2a2a;
}

/* Admin edit shortcut in article header */
.news-article-admin-bar {
    margin-bottom: 16px;
}

.news-admin-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-decoration: none;
    padding: 7px 14px;
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    min-height: 44px;
}

.news-admin-edit-link:hover,
.news-admin-edit-link:focus-visible {
    background-color: var(--accent-gold);
    color: #000;
    outline: none;
}

.news-article-title {
    font-family: 'Aboreto', serif;
    font-size: 2.4rem;
    color: var(--text-white);
    line-height: 1.2;
    margin: 0 0 16px;
    word-break: break-word;
}

.news-article-byline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    color: #888;
    margin-bottom: 14px;
}

.news-byline-author {
    color: var(--text-gray);
    font-weight: 600;
}

.news-byline-date {
    color: #888;
}

.news-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.news-article-tag {
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 100px;
    padding: 4px 14px;
    text-decoration: none;
    transition: background-color 0.15s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.news-article-tag:hover,
.news-article-tag:focus-visible {
    background-color: rgba(212, 175, 55, 0.2);
    outline: none;
}

/* ── Article body (Markdown typography) ───────────────────── */

/* max-width from .governance-document (800px) must not fight the article column */
.news-article .governance-document {
    max-width: none;
}

.news-article-body {
    font-family: 'Lato', sans-serif;
    /* font-size is inherited from .governance-document (1.125rem) so that
       GovDocViewer.applyFontScale() scales all article text correctly */
    color: var(--text-gray);
    line-height: 1.8;
}

.news-article-body h1,
.news-article-body h2,
.news-article-body h3,
.news-article-body h4,
.news-article-body h5,
.news-article-body h6 {
    font-family: 'Lato', sans-serif;
    color: var(--text-white);
    margin: 1.8em 0 0.6em;
    line-height: 1.3;
    font-weight: 700;
}

/* em units so headings scale with GovDocViewer font-size changes */
.news-article-body h2 { font-size: 1.38em; }
.news-article-body h3 { font-size: 1.16em; }
.news-article-body h4 { font-size: 0.98em; }
.news-article-body h5,
.news-article-body h6 { font-size: 0.89em; }

.news-article-body p {
    margin: 0 0 1.3em;
}

.news-article-body a {
    color: var(--accent-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.news-article-body a:hover,
.news-article-body a:focus-visible {
    color: var(--accent-gold-hover);
    outline: none;
}

.news-article-body ul,
.news-article-body ol {
    margin: 0 0 1.3em 1.6em;
    padding: 0;
}

.news-article-body li {
    margin-bottom: 0.4em;
}

.news-article-body blockquote {
    margin: 1.5em 0;
    padding: 16px 20px;
    border-left: 4px solid var(--accent-gold);
    background-color: rgba(212, 175, 55, 0.05);
    color: var(--text-gray);
    font-style: italic;
}

.news-article-body blockquote p {
    margin: 0;
}

.news-article-body code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 3px;
    padding: 2px 6px;
    color: #e0e0e0;
}

.news-article-body pre {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 18px 20px;
    overflow-x: auto;
    margin-bottom: 1.3em;
}

.news-article-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.95em;
}

.news-article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 1.5em auto;
}

.news-article-body hr {
    border: none;
    border-top: 1px solid #2a2a2a;
    margin: 2em 0;
}

.news-article-body strong {
    color: var(--text-white);
    font-weight: 700;
}

.news-article-body em {
    font-style: italic;
}

.news-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.3em;
    font-size: 0.98rem;
}

.news-article-body th,
.news-article-body td {
    border: 1px solid #333;
    padding: 10px 14px;
    text-align: left;
}

.news-article-body th {
    background-color: #1a1a1a;
    color: var(--text-white);
    font-weight: 700;
}

/* Detail spinner (inside article body while fetching) */
.news-detail-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--accent-gold);
    font-size: 2rem;
}

/* ── Article footer ───────────────────────────────────────── */

.news-article-footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #2a2a2a;
}

.news-article-updated {
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    color: #666;
    margin: 0 0 24px;
    font-style: italic;
}

/* Archive link callout box */
.news-archive-callout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background-color: rgba(212, 175, 55, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-left: 4px solid var(--accent-gold);
    border-radius: 0 6px 6px 0;
    padding: 18px 20px;
    margin-top: 8px;
}

.news-archive-callout > .fa-archive,
.news-archive-callout > [class^="fa-"] {
    color: var(--accent-gold);
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.news-archive-callout strong {
    display: block;
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    color: var(--text-white);
    font-weight: 700;
    margin-bottom: 6px;
}

.news-archive-callout p {
    font-family: 'Lato', sans-serif;
    font-size: 0.98rem;
    color: var(--text-gray);
    margin: 0;
    line-height: 1.5;
}

.news-archive-link {
    color: var(--accent-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
}

.news-archive-link:hover,
.news-archive-link:focus-visible {
    color: var(--accent-gold-hover);
    outline: none;
}

/* ── Detail error / not-found state ──────────────────────── */

.news-detail-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 24px;
    text-align: center;
    min-height: 300px;
    margin-top: 70px; /* clear navbar */
}

.news-detail-error-icon {
    font-size: 3rem;
    color: #444;
}

.news-detail-error p {
    font-family: 'Lato', sans-serif;
    font-size: 1.1rem;
    color: #888;
    max-width: 420px;
}

.news-back-link {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-decoration: none;
    padding: 10px 24px;
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.news-back-link:hover,
.news-back-link:focus-visible {
    background-color: var(--accent-gold);
    color: #000;
    outline: none;
}

/* ── Responsive adjustments ───────────────────────────────── */

@media (max-width: 767px) {
    .news-page-hero {
        padding: 52px 20px 44px;
    }

    .news-page-hero-inner h1 {
        font-size: 2.4rem;
    }

    .news-article-title {
        font-size: 1.8rem;
    }

    .news-article {
        padding: 36px 20px 56px;
    }

    .news-detail-hero {
        max-height: 260px;
    }

    .news-detail-hero-img {
        height: 260px;
    }

    .news-archive-callout {
        flex-direction: column;
        gap: 10px;
    }

    #newsListingView {
        padding: 28px 16px 48px;
    }

    #newsListingSpinner {
        padding-top: 28px;
    }
}

@media (max-width: 480px) {
    .news-page-hero-inner h1 {
        font-size: 2rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    #newsListingView {
        padding: 48px 40px 72px;
    }

    #newsListingSpinner {
        padding-top: 48px;
    }

    .news-article {
        padding: 56px 0 80px;
    }
}

/* Hide the floating accessibility cluster when the page footer scrolls into view.
   Prevents the cluster from overlapping the footer when reading to the bottom of a post.
   is-footer-visible is added/removed by the IntersectionObserver in news.js. */
.dash-gov-float-ctrl.is-footer-visible {
    opacity: 0;
    pointer-events: none;
}
