/* Portal 4 news listing and individual articles.
   Upload as Pages/news.css, replacing the existing file.
   Listing: tblPortalNewsFeedDefaultMarkup.StylesheetUrl (already configured).
   Articles: tblPortalNewsArticlePageSettings.StylesheetUrl.
   The scoped rules below override the legacy news image dimensions. */

.tile-news-item-image-div {
    display: flex;
    flex-direction: column;
    height: calc(100% - 20px);
    min-height: 0;
    margin-bottom: 20px;
    padding: 0;
    border: 1px solid var(--portal-border, #dbe5f1);
    border-radius: 12px;
    background: var(--portal-white, #fff);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(20, 44, 70, .03);
}

.tile-news-feed-image {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.tile-news-item-date {
    margin: 24px 24px 12px;
    color: var(--portal-muted, #52657a);
    font-size: var(--portal-text-tag, .8rem);
    line-height: 1.5;
}

.tile-news-item-location {
    margin: 0 24px 12px;
    color: var(--portal-muted, #52657a);
    font-size: var(--portal-text-md, .925rem);
    line-height: 1.5;
}

.tile-news-item-title {
    display: block;
    margin: 0 24px 10px;
    color: var(--portal-ink, #142c46);
    font-size: var(--portal-text-card-title, 1.125rem);
    font-weight: 700;
    line-height: 1.4;
    text-underline-offset: 4px;
    overflow-wrap: anywhere;
}

.tile-news-item-title:hover {
    color: var(--portal-link-hover, #133e73);
}

.tile-news-item-title:focus-visible:focus {
    color: var(--focus-text-color, #0b0c0c);
    background: var(--focus-color, #ffdd00);
    outline: 3px solid var(--focus-text-color, #0b0c0c);
    outline-offset: 3px;
    box-shadow: none;
}

.tile-news-item-text {
    margin: 0 24px 24px;
    padding: 0;
    color: var(--portal-muted, #52657a);
    font-size: var(--portal-text-md, .925rem);
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.tile-news-item-text p {
    font-size: inherit;
    line-height: inherit;
}

.tile-news-item-text > :last-child {
    margin-bottom: 0;
}

.tile-news-item-text img {
    max-width: 100%;
    height: auto;
}

.tile-news-feed-datebox {
    width: auto;
    height: auto;
    margin: 0;
    padding: 20px 24px;
    border: 0;
    background: var(--portal-tint, #eaf2fd);
    color: var(--portal-primary, #1d5fb4);
    text-align: left;
}

.tile-news-feed-datebox-day {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.tile-news-feed-datebox-month {
    padding-top: 4px;
    font-size: 1rem;
    line-height: 1.5;
}

/* News listing: equal image frames, proportional cropping, equal card heights. */
[id$="PageInnerContent"] .tile-news-feed-row {
    align-items: stretch;
    padding-top: 0;
}

[id$="PageInnerContent"] .tile-news-item {
    display: flex;
    min-width: 0;
}

[id$="PageInnerContent"] .tile-news-item-image-div {
    width: 100%;
    height: auto;
    min-height: 0;
    margin-bottom: 24px;
    padding: 0;
    border: 1px solid var(--portal-border, #dbe5f1);
    border-top: 3px solid var(--portal-primary, #1d5fb4);
    border-radius: 12px;
}

[id$="PageInnerContent"] img.tile-news-feed-image {
    width: 100% !important; /* Legacy control CSS sets width: 400px !important. */
    max-width: 100%;
    height: 200px !important;
    min-height: 0 !important; /* Reset the legacy 270px minimum. */
    margin: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: center;
}

[id$="PageInnerContent"] .tile-news-item-date {
    margin: 24px 24px 12px;
}

/* Pagination only: do not restyle portal navigation buttons. */
[id$="PageInnerContent"] :is([id$="PreviousPageButton"], [id$="NextPageButton"]) {
    min-height: 46px;
    margin: 0 8px 12px 0;
    padding: 11px 24px;
    border: 1px solid var(--portal-primary, #1d5fb4);
    border-radius: 7px;
    background: var(--portal-primary, #1d5fb4);
    color: #fff;
    font-size: var(--portal-text-control, .95rem);
    font-weight: 700;
    line-height: 1.5;
    white-space: normal;
}

[id$="PageInnerContent"] :is([id$="PreviousPageButton"], [id$="NextPageButton"]):hover {
    background: var(--portal-primary-hover, #174b8d);
    border-color: var(--portal-primary-hover, #174b8d);
}

[id$="PageInnerContent"] [id$="ArticlesLabel"] {
    color: var(--portal-muted, #52657a);
    font-size: .925rem;
}

/* Article pages: full-width image followed by a readable content column.
   The :has selector limits the surrounding card to NewsArticle.aspx. */
[id$="PageInnerContent"]:has(> [id$="ArticleTitle"]) {
    min-width: 0;
    padding: 28px;
    border: 1px solid var(--portal-border, #dbe5f1);
    border-top: 3px solid var(--portal-primary, #1d5fb4);
    border-radius: 12px;
    background: var(--portal-white, #fff);
    box-shadow: 0 2px 4px rgba(20, 44, 70, .03);
}

[id$="PageInnerContent"] > [id$="ArticleTitle"] {
    margin: 0 0 16px;
    color: var(--portal-ink, #142c46);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: break-word;
}

[id$="PageInnerContent"] > [id$="ArticleIntroduction"] {
    display: block;
    margin: 0 0 20px;
    color: var(--portal-muted, #52657a);
    font-size: 1.125rem;
    line-height: 1.7;
}

[id$="PageInnerContent"]:has(> [id$="ArticleTitle"]) :is(.published-info, .location-info, .additional-fields-info) {
    padding-top: 0;
    color: var(--portal-muted, #52657a);
    font-size: .925rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

[id$="PageInnerContent"]:has(> [id$="ArticleTitle"]) hr {
    margin: 24px 0;
    border-color: var(--portal-border, #dbe5f1);
    opacity: 1;
}

[id$="PageInnerContent"] > [id$="ArticleImagePanel"],
[id$="PageInnerContent"] > .col-md-8:has(> [id$="ArticleContent"]) {
    display: block;
    float: none;
    width: 100%;
    max-width: 100%;
    padding: 0;
}

[id$="PageInnerContent"] > [id$="ArticleImagePanel"] {
    margin: 0 0 28px;
}

[id$="PageInnerContent"] img[id$="ArticleImage"] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    height: 320px !important;
    min-height: 0 !important;
    margin: 0;
    border: 1px solid var(--portal-border, #dbe5f1);
    border-radius: 10px;
    object-fit: cover;
    object-position: center;
}

[id$="PageInnerContent"] [id$="ArticleContent"] {
    display: block;
    max-width: 72ch;
    color: var(--portal-ink, #142c46);
    font-size: 1rem;
    line-height: 1.8;
    overflow-wrap: break-word;
}

[id$="PageInnerContent"] [id$="ArticleContent"] :is(p, ul, ol) {
    margin: 0 0 1.25em;
    font-size: inherit;
    line-height: inherit;
}

[id$="PageInnerContent"] [id$="ArticleContent"] :is(h2, h3) {
    margin: 1.6em 0 .6em;
    color: var(--portal-ink, #142c46);
    font-weight: 700;
    line-height: 1.35;
}

[id$="PageInnerContent"] [id$="ArticleContent"] h2 { font-size: 1.4rem; }
[id$="PageInnerContent"] [id$="ArticleContent"] h3 { font-size: 1.2rem; }
[id$="PageInnerContent"] [id$="ArticleContent"] li + li { margin-top: .5em; }

[id$="PageInnerContent"] [id$="ArticleContent"] img {
    max-width: 100%;
    height: auto;
}

[id$="PageInnerContent"] [id$="PortalNewsArticleDocumentsPanel"] {
    float: none;
    width: 100%;
    margin-top: 28px;
    padding: 24px 0 0;
    border-top: 1px solid var(--portal-border, #dbe5f1);
}

[id$="PageInnerContent"] :is([id$="ArticleContent"], [id$="PortalNewsArticleDocumentsPanel"], .additional-fields-info) a {
    color: var(--portal-primary, #1d5fb4);
    text-decoration: underline;
    text-underline-offset: 3px;
}

[id$="PageInnerContent"] :is([id$="PreviousPageButton"], [id$="NextPageButton"], .tile-news-item-title, [id$="ArticleContent"] a, [id$="PortalNewsArticleDocumentsPanel"] a, .additional-fields-info a):focus-visible:focus {
    color: var(--focus-text-color, #0b0c0c) !important;
    background-color: var(--focus-color, #ffdd00) !important;
    outline: 3px solid var(--focus-text-color, #0b0c0c);
    outline-offset: 3px;
    box-shadow: none;
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    [id$="PageInnerContent"] .tile-news-item {
        width: 50%;
    }
}

@media (max-width: 767.98px) {
    [id$="PageInnerContent"]:has(> [id$="ArticleTitle"]) { padding: 20px; }
    [id$="PageInnerContent"] img[id$="ArticleImage"] { height: 220px !important; }
    [id$="PageInnerContent"] .tile-news-item { width: 100%; }
    [id$="PageInnerContent"] .tile-news-item-image-div { margin-bottom: 20px; }
}
