/*
    Update Log popup (DEV-628) — the "News" dialog in the portal header.

    Deliberately mirrors the orders-modal convention (fixed overlay, centred card, its own head/body/foot)
    rather than introducing a second modal idiom. Loaded globally from _Layout because the header that
    opens it is on every migrated portal page, and a dialog that only styles itself on some pages is worse
    than no dialog.

    Related: Pages/Shared/_NewsDialog.cshtml, Pages/Shared/_PortalHeader.cshtml, css/dot-orders.css.
*/

/*
    Closed by construction, not by a rule that has to WIN.

    The obvious shape — `display: flex` here plus `[hidden] { display: none }` below — puts the open and
    closed states in a specificity fight, and losing it means this fixed, full-viewport overlay paints over
    every page in the portal. The render test can assert the `hidden` attribute but cannot evaluate CSS, so
    that failure would be invisible to the whole pipeline.
    Scoping the flex to `:not([hidden])` means there is nothing to win: no attribute, no layout.
*/
.news-overlay {
    position: fixed;
    inset: 0;
    background: rgba(23, 23, 26, 0.45);
    z-index: 1000;
    overflow: auto;
    padding: 48px 16px;
}

.news-overlay:not([hidden]) {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* The page behind a modal should not scroll under it. */
body.news-open { overflow: hidden; }

.news-modal {
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(23, 23, 26, 0.28);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 96px);
}

.news-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.35rem 0.9rem;
    border-bottom: 1px solid var(--card-line);
}

.news-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 650;
}

.news-sub {
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: var(--muted, #6b6b73);
}

.news-close {
    background: none;
    border: 1px solid var(--card-line);
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: inherit;
    flex: 0 0 auto;
}
.news-close:hover { background: rgba(23, 23, 26, 0.05); }

/* The body scrolls, not the card — the head and pager stay put on a long week. */
.news-body {
    padding: 1.1rem 1.35rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

.news-week-heading {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted, #6b6b73);
}

/* The shape of a release in one line, above its entries. Set apart by a rule and a slightly
   larger size rather than a tinted box: it is the same kind of text as the list, just the part
   read first, and a callout panel would make it look like a warning. */
.news-summary {
    margin: 0 0 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--card-line, #e4ded4);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* A summary that introduces a per-release list (DEV-947) is a lead line, not a block of its own — the
   rule under the section comes from the list instead. */
.news-summary--lead {
    margin-bottom: 0.6rem;
    padding-bottom: 0;
    border-bottom: 0;
    color: var(--ink-soft, #6b665e);
}

/* One point per release: version and day in a narrow margin, the shape of the release beside them. */
.news-points {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0 0 0.85rem;
    border-bottom: 1px solid var(--card-line, #e4ded4);
    display: grid;
    gap: 0.7rem;
}

.news-point {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    /* The text spans both rows; the second row takes the slack so the date sits right under the
       version instead of floating halfway down a tall entry. */
    grid-template-rows: auto 1fr;
    column-gap: 0.85rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.news-point-release {
    grid-column: 1;
    font-weight: 700;
    white-space: nowrap;
}

.news-point-when {
    grid-column: 1;
    align-self: start;
    font-size: 0.78rem;
    color: var(--ink-soft, #6b665e);
    white-space: nowrap;
}

.news-point-text {
    grid-column: 2;
    grid-row: 1 / span 2;
}

@media (max-width: 560px) {
    .news-point { grid-template-columns: 1fr; }
    .news-point-when { margin-bottom: 0.15rem; }
    .news-point-text { grid-column: 1; grid-row: auto; }
}

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

.news-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--card-line);
    line-height: 1.45;
}
.news-item:last-child { border-bottom: none; }

/* The sentence takes the row and the tags trail it, so scanning down reads as prose rather than a table. */
.news-text { flex: 1 1 16rem; }

.news-tag {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    white-space: nowrap;
}
.news-tag--ticket {
    background: rgba(94, 106, 210, 0.12);
    color: #4b55b8;
}
.news-tag--version {
    background: rgba(23, 23, 26, 0.06);
    color: var(--muted, #6b6b73);
    font-variant-numeric: tabular-nums;
}

.news-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.35rem;
    border-top: 1px solid var(--card-line);
}

.news-pos {
    font-size: 0.8rem;
    color: var(--muted, #6b6b73);
    font-variant-numeric: tabular-nums;
}

.news-foot .btn[disabled] {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 640px) {
    .news-overlay { padding: 16px 10px; }
    .news-modal   { max-height: calc(100vh - 32px); }
}
