/**
 * News & Articles Styles
 */

/* ===== SINGLE ARTICLE ===== */
.news-article-single {
    max-width: 100%;
    margin: 0 auto;
}

.article-header {
    margin-bottom: 3rem;
}

.article-hero-image {
    width: 100%;
    max-height: 500px;
    overflow: hidden;
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 24px rgba(6, 39, 53, 0.25);
}

.article-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-header-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.article-meta-top {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.article-type-badge,
.article-featured-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Work Sans', sans-serif;
}

.article-type-badge {
    background: #1b5137;
    color: white;
}

.article-featured-badge {
    background: #e1a038;
    color: white;
}

.article-headline {
    font-family: 'Fraunces', serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    color: #1b5137;
}

.article-subheadline {
    font-family: 'Work Sans', sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.5;
    color: #666;
    margin: 0 0 1.5rem 0;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.9rem;
    color: #666;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-meta svg {
    fill: #e1a038;
}

.article-verified {
    color: #059669;
    font-weight: 600;
}

.article-verified svg {
    fill: #059669;
}

/* ===== ARTICLE CONTENT ===== */
.article-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.article-content {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.article-content p {
    margin: 0 0 1.5rem 0;
}

.article-content h2 {
    font-family: 'Fraunces', serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem 0;
    color: #1b5137;
}

.article-content h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: #1b5137;
}

.article-content a {
    color: #4f9aa8;
    text-decoration: underline;
}

.article-content a:hover {
    color: #1b5137;
}

/* Inline images in articles */
.article-inline-image {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-inline-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-inline-image figcaption {
    padding: 1rem;
    background: #f9f9f9;
    font-size: 0.9rem;
    font-style: italic;
    color: #666;
    text-align: center;
}

/* ===== Inline image placement (width / align / wrap) =====
   Controlled per-image from the article's Article Details meta box.
   See soec_parse_inline_images() in news-articles.php. */

.article-inline-image.width-full    { width: 100%; }
.article-inline-image.width-half    { width: 50%; }
.article-inline-image.width-third   { width: 33.333%; }
.article-inline-image.width-quarter { width: 25%; }

/* When two or three [IMAGE:N] markers appear back-to-back with no real
   paragraph text between them, soec_parse_inline_images() wraps them together
   in this container rather than leaving them as independent floats. display:
   flow-root establishes a new block formatting context, which — as a side
   effect — makes this div's own rendered height correctly expand to contain
   its floated children (a standard "clearfix"). That matters here because
   floats don't push down the flow position of whatever comes after them;
   only clearing does, and clearing only accounts for floats already placed.
   Without this container, a paragraph following a close pair of images could
   end up wrapping around the FIRST image instead of aligning with the
   second, since its own starting position would be computed as if the
   images' clear:both spacing never happened. Wrapping them means later
   content just starts fresh below the group, using normal block flow. */
.article-inline-image-group {
    display: flow-root;
}

/* No wrap: image is a block of its own, centred within its width, text stacks
   above/below rather than beside it. */
.article-inline-image.wrap-none {
    float: none;
    clear: both;
    margin-left: auto;
    margin-right: auto;
}

/* Full wrap: image floats to the chosen side, with text flowing around it.
   "Narrow" vs "normal" just controls how much breathing room the text gets.
   No top margin on the float itself — that, combined with resetting the
   following paragraph's default top margin below, is what keeps the first
   line of wrapped text level with the top of the image rather than
   drifting down beneath it.
   clear: both is deliberate — without it, a second floated image can start
   before a prior one has finished (if there isn't much text between them),
   letting their vertical ranges overlap. Clearing means a new floated image
   can never start until the previous float's bottom edge (including its own
   margin-bottom) has been passed, guaranteeing no image-to-image overlap —
   at the cost of never allowing two images to sit level, side by side. */
.article-inline-image.wrap-narrow.align-left,
.article-inline-image.wrap-normal.align-left {
    float: left;
    clear: both;
}

.article-inline-image.wrap-narrow.align-right,
.article-inline-image.wrap-normal.align-right {
    float: right;
    clear: both;
}

.article-inline-image.wrap-narrow.align-left  { margin: 0 1rem 0.75rem 0; }
.article-inline-image.wrap-narrow.align-right { margin: 0 0 0.75rem 1rem; }
.article-inline-image.wrap-normal.align-left  { margin: 0 2rem 1.5rem 0; }
.article-inline-image.wrap-normal.align-right { margin: 0 0 1.5rem 2rem; }

/* The element immediately after a wrapped image inherits a default top
   margin from the browser/theme (paragraphs, headings, etc.) which is what
   was actually causing the "shifted down" look — the image had almost no
   top margin, but the text after it did. Zeroing it here means that text
   starts flush with the top of the image. */
.article-inline-image.wrap-narrow + *,
.article-inline-image.wrap-normal + * {
    margin-top: 0 !important;
}

/* Narrow screens: floated inline images rarely have room to wrap sensibly
   alongside text at half/third/quarter width — drop back to full-width,
   unfloated, same as "no wrap" would render. */
@media (max-width: 600px) {
    .article-inline-image.wrap-narrow,
    .article-inline-image.wrap-normal {
        float: none;
        width: 100%;
        margin: 1.5rem 0;
    }
}

/* Embedded stat cards in articles */
.embedded-stat-card {
    margin: 2.5rem auto;
    max-width: 500px;
}

/* ===== SIDEBAR ===== */
.article-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.sidebar-section {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: #1b5137;
}

.topic-tags,
.centre-tags {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-tags li,
.centre-tags li {
    margin: 0;
}

.topic-tags a,
.centre-tags a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.topic-tags a:hover,
.centre-tags a:hover {
    background: #1b5137;
    color: white;
    border-color: #1b5137;
}

.source-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.source-links li {
    margin: 0 0 0.5rem 0;
}

.source-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #4f9aa8;
    text-decoration: none;
    font-size: 0.9rem;
}

.source-links a:hover {
    text-decoration: underline;
}

.source-links svg {
    fill: currentColor;
}

/* ===== RELATED ARTICLES ===== */
.related-articles {
    max-width: 1400px;
    margin: 4rem auto 0;
    padding: 0 2rem;
}

.related-articles h2 {
    font-family: 'Fraunces', serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 2rem 0;
    color: #1b5137;
    text-align: center;
}

.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* ===== ARTICLE CARDS ===== */
.article-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(6, 39, 53, 0.25);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(6, 39, 53, 0.3);
}

.article-card.is-featured {
    border: 3px solid #e1a038;
}

.article-card-image {
    position: relative;
    aspect-ratio: 16/9;
    background: #9b9b9b;
    overflow: hidden;
}

.article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-card-image img {
    transform: scale(1.05);
}

.card-featured-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #e1a038;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.article-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-card-type {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: #1b5137;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    width: fit-content;
}

.article-card-title {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 1rem 0;
}

.article-card-title a {
    color: #1b5137;
    text-decoration: none;
}

.article-card-title a:hover {
    color: #4f9aa8;
}

.article-card-excerpt {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #666;
    margin: 0 0 1rem 0;
    flex: 1;
}

.article-card-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 1rem;
}

.article-card-button {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    background: white;
    border: 2px solid #1b5137;
    color: #1b5137;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.article-card-button:hover {
    background: #e1a038;
    border-color: #e1a038;
    color: white;
}

/* ===== ARCHIVE PAGE ===== */
.news-archive {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.archive-header {
    text-align: center;
    margin-bottom: 3rem;
}

.archive-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: #1b5137;
}

.archive-description {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #666;
    max-width: 700px;
    margin: 0 auto 2rem;
}

.archive-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.archive-filters a {
    padding: 0.6rem 1.5rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 25px;
    color: #333;
    text-decoration: none;
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.archive-filters a:hover {
    border-color: #1b5137;
    color: #1b5137;
}

.archive-filters a.active {
    background: #1b5137;
    color: white;
    border-color: #1b5137;
}

/* ===== FEATURED HERO ===== */
.featured-article-hero {
    position: relative;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(6, 39, 53, 0.25);
    margin-bottom: 3rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 400px;
}

.featured-article-hero .featured-image {
    position: relative;
    background: #9b9b9b;
}

.featured-article-hero .featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-article-hero .featured-content {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #e1a038;
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    width: fit-content;
}

.featured-article-hero h2 {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem 0;
}

.featured-article-hero h2 a {
    color: #1b5137;
    text-decoration: none;
}

.featured-article-hero h2 a:hover {
    color: #4f9aa8;
}

.featured-subheadline {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #666;
    margin: 0 0 1.5rem 0;
}

.featured-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 1.5rem;
}

.featured-button {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: white;
    border: 2px solid #1b5137;
    color: #1b5137;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    width: fit-content;
}

.featured-button:hover {
    background: #e1a038;
    border-color: #e1a038;
    color: white;
}

/* ===== ARTICLES GRID ===== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    padding: 0.6rem 1rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination a:hover {
    border-color: #1b5137;
    color: #1b5137;
}

.pagination .current {
    background: #1b5137;
    border-color: #1b5137;
    color: white;
}

/* ===== NO ARTICLES ===== */
.no-articles {
    text-align: center;
    padding: 4rem 2rem;
    background: #f9f9f9;
    border-radius: 20px;
    margin: 2rem 0;
}

.no-articles p {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .articles-grid,
    .related-articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .article-content-wrapper {
        grid-template-columns: 1fr 250px;
        gap: 2rem;
    }
}

@media (max-width: 900px) {
    .article-content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .article-sidebar {
        position: static;
        margin-top: 3rem;
    }
    
    .featured-article-hero {
        grid-template-columns: 1fr;
    }
    
    .featured-article-hero .featured-image {
        aspect-ratio: 16/9;
    }
    
    .featured-article-hero .featured-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .articles-grid,
    .related-articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .archive-filters {
        flex-direction: column;
    }
    
    .archive-filters a {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .article-header-content {
        padding: 0 1rem;
    }
    
    .article-content-wrapper {
        padding: 0 1rem;
    }
    
    .featured-article-hero .featured-content {
        padding: 1.5rem;
    }
}