/* =============================================================
   News / editorial article template  (single-news.php)
   Prefix: nw-   ·   Scoped to .nw-article to avoid global bleed.

   For company updates, announcements and thought-leadership
   pieces — an editorial layout (flat-green dateline band, large
   overlapping lead image, narrow centred prose column) distinct
   from the guide template (sticky TOC, At-a-Glance, Related
   Guides) which stays on single.php.
   ============================================================= */

/* Horizontal-overflow guard, scoped to news article pages only.
   A fixed/oversized third-party widget (cookie consent popup) can poke
   past the viewport on this template; overflow-x:clip on the root kills
   the stray horizontal scroll without creating a scroll container (so
   the fixed header and vertical scrolling are unaffected). Scoped via
   the body.nw-template class so no other page is touched. */
html:has(body.nw-template) {
    overflow-x: clip;
}

.nw-article {
    overflow-x: clip; /* belt-and-braces for legacy in-content media */
    --nw-green: var(--sd-color-primary, #36452f);
    --nw-accent: var(--sd-color-cta, #5f7d3a);
    --nw-accent-hover: var(--sd-color-cta-hover, #8db35a);
    --nw-ink: #1a1a1a;
    --nw-muted: #6b7280;
    --nw-line: rgba(54, 69, 47, 0.12);
    --nw-cream: #f8f6ee;

    --nw-prose: 760px;   /* readable text column            */
    --nw-media: 1000px;  /* lead image + hero content width  */
    --nw-wide: 1200px;   /* more-news grid + CTA             */

    background: #fff;
    color: var(--nw-ink);
}

/* ── Hero (flat green dateline band) ─────────────────────── */

.nw-hero {
    background: var(--nw-green); /* flat, matches nav — no gradient */
    /* Top padding clears the fixed site header (~110px); the deep
       bottom padding gives the lead image green to overlap into. */
    padding: clamp(6.5rem, 11vw, 9rem) clamp(1.25rem, 5vw, 3.5rem)
             clamp(3.5rem, 9vw, 7rem);
}

.nw-hero__inner {
    max-width: var(--nw-media);
    margin-inline: auto;
}

.nw-back {
    display: flex; /* block-level so the eyebrow + title sit on their own lines */
    width: fit-content;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color 0.18s ease;
}

.nw-back:hover { color: #fff; }
.nw-back svg { flex-shrink: 0; }

/* Keyboard focus on the dark-green bands: the global blue ring (#0066cc)
   fails contrast against #36452f, so use a white ring there (WCAG 1.4.11). */
.nw-hero a:focus-visible,
.nw-cta a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    border-radius: 2px;
}

.nw-eyebrow {
    display: inline-block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #a9cf78; /* lighter than --nw-accent-hover so it clears WCAG AA (4.5:1) on the green band */
    margin-bottom: 0.85rem;
}

.nw-title {
    color: #fff;
    font-size: clamp(2.25rem, 5vw, 4rem); /* unified hero title scale */
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0;
    max-width: 24ch;
    /* weight inherits the global bold (700) so it matches sibling heroes */
}

.nw-standfirst {
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(1.0625rem, 0.5vw + 1rem, 1.3rem);
    line-height: 1.55;
    margin: 1.25rem 0 0;
    max-width: 60ch;
}

.nw-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.7rem;
    margin-top: 1.6rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9375rem;
}

.nw-meta__author {
    color: #fff;
    font-weight: 600;
}

.nw-meta__dot { opacity: 0.5; }

/* ── Lead image (overlaps the green band) ────────────────── */

.nw-lead {
    max-width: var(--nw-media);
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 5vw, 3.5rem);
    /* Pull up so the top of the image sits over the green band.
       Overlap is always smaller than the hero's bottom padding. */
    margin-top: clamp(-5rem, -6vw, -2rem);
    position: relative;
    z-index: 2;
}

.nw-lead__frame {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.45);
    background: var(--nw-cream);
    aspect-ratio: 16 / 9;
}

.nw-lead__frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nw-lead__caption {
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: var(--nw-muted);
    text-align: center;
}

/* ── Body ────────────────────────────────────────────────── */

.nw-body {
    padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 5vw, 3.5rem)
             clamp(3rem, 7vw, 5rem);
}

/* When there's no lead image the body needs its own top breathing room. */
.nw-article--no-image .nw-body {
    padding-top: clamp(2.5rem, 6vw, 4rem);
}

.nw-content {
    max-width: var(--nw-prose);
    margin-inline: auto;
    color: var(--nw-ink);
    font-size: 1.125rem;
    line-height: 1.75;
    /* Keep arbitrary editor copy inside the column — the overflow-x:clip
       guard would otherwise truncate a long unbroken word/URL. */
    overflow-wrap: break-word;
}

.nw-content > * + * { margin-top: 1.15em; }

.nw-content h2,
.nw-content h3,
.nw-content h4 {
    line-height: 1.3;
    margin-top: 1.6em;
    margin-bottom: 0.5em;
    /* !important to beat the global h2-h6 bold(700) rule and keep prose
       headings semibold, matching the guide template (post.css). */
    font-weight: 600 !important;
    color: var(--nw-green);
}

.nw-content h2 { font-size: clamp(1.5rem, 1.2vw + 1rem, 2rem); }
.nw-content h3 { font-size: clamp(1.25rem, 0.9vw + 0.9rem, 1.5rem); }
.nw-content h4 { font-size: 1.125rem; }

.nw-content a {
    color: var(--nw-green);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--nw-accent);
    overflow-wrap: anywhere; /* bare URLs wrap instead of being clipped */
}
.nw-content a:hover { text-decoration-thickness: 2px; }

.nw-content ul { list-style: disc; padding-left: 1.5rem; }
.nw-content ol { list-style: decimal; padding-left: 1.5rem; }
.nw-content li + li { margin-top: 0.4rem; }

.nw-content img,
.nw-content figure,
.nw-content .wp-caption {
    display: block;
    margin: 2rem auto;
    max-width: 100%;
}

.nw-content figure img { width: 100%; height: auto; border-radius: 6px; }

.nw-content figcaption,
.nw-content .wp-caption-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--nw-muted);
    text-align: center;
}

.nw-content blockquote {
    margin: 2rem 0;
    padding: 0.25rem 0 0.25rem 1.5rem;
    border-left: 4px solid var(--nw-accent);
    font-size: 1.35rem;
    line-height: 1.5;
    font-weight: 500;
    color: var(--nw-green);
}

.nw-content blockquote p { margin: 0; }

/* Wide legacy tables/code scroll within their own box so the article's
   overflow-x:clip guard never truncates them. */
.nw-content table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.nw-content table th,
.nw-content table td {
    border: 1px solid var(--nw-line);
    padding: 0.6rem 0.75rem;
    text-align: left;
}

.nw-content pre {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #0b1220;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.nw-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background: #f3f4f6;
    color: #111827;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.nw-content pre code { background: none; color: inherit; padding: 0; }

/* ── Share + footer ──────────────────────────────────────── */

.nw-footer {
    max-width: var(--nw-prose);
    margin: clamp(2.5rem, 5vw, 3.5rem) auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--nw-line);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.nw-posted {
    font-size: 0.9375rem;
    color: var(--nw-muted);
}

.nw-posted a {
    color: var(--nw-green);
    font-weight: 600;
    text-decoration: none;
}
.nw-posted a:hover { text-decoration: underline; text-underline-offset: 2px; }

.nw-share {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nw-share__label {
    font-size: 0.85rem;
    color: var(--nw-muted);
    font-weight: 500;
    margin-right: 0.15rem;
}

.nw-share__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--nw-line);
    color: var(--nw-green);
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nw-share__link:hover {
    background: var(--nw-green);
    border-color: var(--nw-green);
    color: #fff;
}

/* ── More news ───────────────────────────────────────────── */

.nw-more {
    background: var(--nw-cream);
    padding: clamp(3rem, 7vw, 5rem) clamp(1.25rem, 5vw, 3.5rem);
}

.nw-more__inner {
    max-width: var(--nw-wide);
    margin-inline: auto;
}

.nw-more__head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.nw-more__heading {
    font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
    font-weight: 600;
    color: var(--nw-green);
    margin: 0;
}

.nw-more__all {
    color: var(--nw-green);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
}
.nw-more__all:hover { text-decoration: underline; text-underline-offset: 2px; }

.nw-more__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
}

.nw-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0; /* let the grid track shrink; long titles wrap, not blow out */
    background: #fff;
    border: 1px solid var(--nw-line);
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.nw-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
    border-color: var(--nw-accent);
}

.nw-card__link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.nw-card__thumb {
    aspect-ratio: 16 / 10;
    background: var(--nw-cream);
    overflow: hidden;
}

.nw-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.nw-card:hover .nw-card__thumb img { transform: scale(1.04); }

.nw-card__body {
    padding: 1.25rem 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nw-card__cat {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--nw-green); /* dark green clears WCAG AA on the white card */
    overflow-wrap: anywhere;
}

.nw-card__title {
    font-size: 1.125rem;
    line-height: 1.35;
    font-weight: 600;
    color: var(--nw-ink);
    margin: 0;
    overflow-wrap: anywhere;
}

.nw-card__date {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--nw-muted);
}

/* ── CTA banner ──────────────────────────────────────────── */

.nw-cta {
    background: var(--nw-green);
    padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 5vw, 3.5rem);
}

.nw-cta__inner {
    max-width: var(--nw-wide);
    margin-inline: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    align-items: center;
    justify-content: space-between;
}

.nw-cta__title {
    color: #fff;
    font-size: clamp(1.5rem, 2vw + 1rem, 2.25rem);
    font-weight: 600;
    margin: 0 0 0.4rem;
}

.nw-cta__sub {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    max-width: 52ch;
}

.nw-cta__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.nw-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.85rem 1.75rem;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.15s ease, color 0.2s ease;
}

.nw-btn--primary {
    background: var(--nw-accent);
    color: #fff;
}
.nw-btn--primary:hover { background: var(--sd-color-cta-strong, #4f6b30); transform: translateY(-1px); }

.nw-btn--outline {
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
}
.nw-btn--outline:hover { background: rgba(255, 255, 255, 0.12); }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 900px) {
    .nw-more__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .nw-more__grid { grid-template-columns: 1fr; }
    .nw-lead__frame { aspect-ratio: 4 / 3; }
    .nw-footer { flex-direction: column; align-items: flex-start; }
    .nw-cta__inner { flex-direction: column; align-items: flex-start; }
}

/* ── Announcement intro (post_announcement_text, kept verbatim from the Divi
      site: the "21 years, 21 stories" blocks and event notes) ── */
.sd-announcement {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0 0 2rem;
  padding: 1.5rem 1.75rem;
  background: var(--sd-color-background-alt, #f3f4f6);
  border-left: 4px solid var(--sd-color-primary, #36452f);
  border-radius: 0 var(--sd-radius-xl, 0.375rem) var(--sd-radius-xl, 0.375rem) 0;
}
.sd-announcement .sd-announcement__text { flex: 1; min-width: 0; }
.sd-announcement .sd-announcement__text > :first-child { margin-top: 0; }
.sd-announcement .sd-announcement__text > :last-child { margin-bottom: 0; }
.sd-announcement .sd-announcement__text h2 {
  font-size: clamp(1.25rem, 0.8vw + 1rem, 1.5rem);
  margin: 0 0 0.5rem;
  color: var(--sd-color-primary, #36452f);
}
.sd-announcement .sd-announcement__image { flex: 0 0 auto; width: 112px; height: auto; margin: 0; }
@media (max-width: 640px) {
  .sd-announcement { flex-direction: column-reverse; align-items: flex-start; gap: 1rem; padding: 1.25rem; }
  .sd-announcement .sd-announcement__image { width: 88px; }
}
