/* News-specific styles. Inherits site.css for nav, footer, colors, fonts. */

/* ── PAGE HERO ── */
.news-page-hero {
    background: var(--darker);
    padding: 5rem 5% 3rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.news-page-hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}
.news-page-hero h1 .green { color: var(--green); }
.news-page-hero p {
    color: var(--text-mid);
    font-size: 1.05rem;
    max-width: 640px;
    margin: 0 auto;
}

/* ── LISTING GRID ── */
.news-listing {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 5%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.75rem;
    box-sizing: content-box; /* so max-width caps the inner grid at 1200px, matching nav-content */
}
@media (max-width: 900px) {
    .news-listing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .news-listing { grid-template-columns: 1fr; }
}

.news-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}
.news-card:hover {
    transform: translateY(-4px);
    border-color: var(--green);
    box-shadow: 0 12px 35px rgba(121,185,73,0.15);
}
.news-card-img {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--surface);
    display: block;
}
.news-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.4s;
}
.news-card:hover .news-card-img img { transform: scale(1.04); }
.news-card-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.news-card-body time {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
.news-card-body h2 { font-size: 1.4rem; margin: 0.6rem 0 0.8rem; line-height: 1.2; }
.news-card-body h2 a { color: var(--white); transition: color 0.3s; }
.news-card-body h2 a:hover { color: var(--green); }
.news-card-body p { color: var(--text-mid); font-size: 0.95rem; line-height: 1.6; flex: 1; }
.news-card-readmore {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    color: var(--green);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: gap 0.2s;
}
.news-card:hover .news-card-readmore { gap: 0.7rem; }

.news-empty {
    max-width: 640px;
    margin: 6rem auto;
    padding: 0 5%;
    text-align: center;
    color: var(--text-mid);
}
.news-empty h2 { margin-bottom: 1rem; }
.news-empty a { color: var(--green); }

/* ── INDIVIDUAL POST ── */
.news-back {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 5% 0;
}
.news-back a {
    color: var(--text-mid);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}
.news-back a:hover { color: var(--green); }

.news-post {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 5% 6rem;
}

/* Header sits at the same readable column width as the body so the post
   title visually aligns with the section headings (H2s) below. */
.news-post-header {
    max-width: 900px;
    margin: 0 auto 2rem;
}
.news-post-meta {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    margin-bottom: 1rem;
}
.news-post h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: 0.01em;
}

/* ── FEATURE IMAGE — natural aspect ratio, never cropped ──
   max-width caps at the full 1200px frame so the image fills the page like
   the rest of the site; max-height caps at 75vh so a tall vertical image
   (e.g. 9:16 Story) never dominates the screen. */
.news-post-feature-image {
    margin: 1rem auto 3rem;
    text-align: center;
}
.news-post-feature-image img {
    display: block;
    margin: 0 auto;
    max-width: min(100%, 1000px);
    max-height: 75vh;
    width: auto;
    height: auto;
    border-radius: var(--r-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.news-post-feature-image figcaption {
    margin-top: 1rem;
    color: var(--text-mid);
    font-size: 0.9rem;
    font-style: italic;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

/* Body is a centered, readable-width column. All children (H2/H3, p, ul,
   blockquote etc.) inherit the constraint so headings align with body text.
   The outer .news-post container stays at 1200px so galleries / prev-next /
   related-articles can extend wider when they appear OUTSIDE this body. */
.news-post-body {
    max-width: 900px;
    margin: 0 auto;
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.8;
}
.news-post-body h2 { font-size: 1.7rem; margin: 2.5rem 0 1rem; }
.news-post-body h3 { font-size: 1.35rem; margin: 2rem 0 0.8rem; }
.news-post-body p { margin-bottom: 1.5rem; }
.news-post-body a {
    color: var(--green);
    text-decoration: underline;
    text-decoration-color: rgba(121,185,73,0.4);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}
.news-post-body a:hover { text-decoration-color: var(--green); }
.news-post-body strong { color: var(--white); font-weight: 700; }
.news-post-body em { color: var(--text); }
.news-post-body img { border-radius: var(--r-md); margin: 2rem 0; }
.news-post-body ul, .news-post-body ol { margin: 0 0 1.5rem 1.5rem; }
.news-post-body li { margin-bottom: 0.5rem; }
.news-post-body blockquote {
    border-left: 3px solid var(--green);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--text-mid);
    font-style: italic;
}
.news-post-body code {
    background: var(--surface);
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--green-bright);
    font-family: 'Roboto Mono', Menlo, Consolas, monospace;
}
.news-post-body pre {
    background: var(--darker);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}
.news-post-body pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: 0.92em;
}

/* ── GALLERY ── */
/* Flex + justify-content:center so any number of images (1, 2, 3, 4 …) sit
   centered horizontally rather than left-justified with a gap on the right. */
.news-gallery {
    margin: 3rem auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    max-width: 1200px;
}
.news-gallery a {
    flex: 0 0 220px;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--r-md);
    background: var(--surface);
}
.news-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.news-gallery a:hover img { transform: scale(1.06); }

@media (max-width: 600px) {
    .news-gallery a { flex: 1 1 200px; max-width: 320px; }
}

/* ── PREV / NEXT POST NAV ── simple text links, prev left / next right */
.news-post-nav {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.news-post-nav-link {
    color: var(--text-mid);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.news-post-nav-link:hover { color: var(--green); }
.news-post-nav-link i { color: var(--green); font-size: 0.8rem; }

article.news-post + .news-post-nav {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* ── RELATED ARTICLES (bottom of each post) ── */
.news-related {
    background: var(--darker);
    border-top: 1px solid var(--border);
    padding: 4.5rem 5% 5rem;
    margin-top: 4rem;
}
.news-related-inner {
    max-width: 1200px;
    margin: 0 auto;
}
.news-related h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: 0.02em;
}
.news-related-grid {
    display: grid;
    /* auto-fit (not auto-fill) collapses empty columns so the cards always
       fill the row evenly regardless of how many there are (3, 4, …) */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
.news-related .news-card-body h3 {
    font-family: 'Barlow Condensed', sans-serif;
    text-transform: uppercase;
    font-size: 1.3rem;
    margin: 0.6rem 0 0.8rem;
    line-height: 1.2;
    font-weight: 700;
}
.news-related .news-card-body h3 a {
    color: var(--white);
    transition: color 0.3s;
}
.news-related .news-card-body h3 a:hover { color: var(--green); }

/* ── HOMEPAGE WIDGET (latest posts on / index) ── */
.home-news-widget {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 5%;
}
.home-news-widget-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.home-news-widget-head h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1;
}
.home-news-widget-head .all-link {
    color: var(--green);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.home-news-widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .news-listing { padding: 3rem 5%; gap: 1.5rem; }
    .news-page-hero { padding: 4rem 5% 2.5rem; }
    .news-post { padding: 2rem 5% 5rem; }
    .home-news-widget { padding: 4rem 5%; }
}

/* ── LIGHTBOX ── */
.news-lightbox {
    position: fixed !important;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: rgba(0,0,0,0.94);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: news-lightbox-fade 0.18s ease;
}
.news-lightbox[hidden] { display: none !important; }
@keyframes news-lightbox-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
body.news-lightbox-open { overflow: hidden; }

.news-lightbox-img {
    max-width: 92vw;
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--r-md);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    user-select: none;
    -webkit-user-drag: none;
}

.news-lightbox-close,
.news-lightbox-nav {
    position: absolute;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--white);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
    padding: 0;
    font-family: inherit;
}
.news-lightbox-close:hover,
.news-lightbox-nav:hover {
    background: var(--green);
    border-color: var(--green);
    color: var(--dark);
}
.news-lightbox-close { top: 1.5rem; right: 1.5rem; }
.news-lightbox-prev  { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.news-lightbox-next  { right: 1.5rem; top: 50%; transform: translateY(-50%); }
.news-lightbox-prev:hover { transform: translateY(-50%) scale(1.06); }
.news-lightbox-next:hover { transform: translateY(-50%) scale(1.06); }

.news-lightbox-counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text);
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 600;
    background: rgba(0,0,0,0.5);
    padding: 0.5rem 1rem;
    border-radius: var(--r-pill);
    border: 1px solid rgba(255,255,255,0.08);
}

@media (max-width: 768px) {
    .news-lightbox-close { top: 0.75rem; right: 0.75rem; width: 44px; height: 44px; }
    .news-lightbox-prev,
    .news-lightbox-next { width: 44px; height: 44px; }
    .news-lightbox-prev { left: 0.5rem; }
    .news-lightbox-next { right: 0.5rem; }
}
