/* pages/news.css — /news/ (SPEC §5.4).
 *
 * ONE COLUMN, topic not source, no preview text, NO READ/UNREAD (his rules,
 * apps/news/views.py). The page is a list/detail split with no page-top and no
 * visible head: the fixed top is the record head (§4.7, app.css).
 *   - The list COLUMN is the scroller: the AI Overview card rides at its top
 *     and scrolls away with the stories (it used to sit over the whole split
 *     and push the column below the fold).
 *   - A story row is an M3 two-line list item (.m3-list-item in the markup);
 *     this file only shapes its two lines.
 *   - A story's reports are a SEGMENTED list of whole-row links.
 *
 * PAGE-SCOPE RULE (§1.1, test_design check 9): every selector starts with a
 * class this file owns — `.stories`, `.story*`, `.brief*`, `.report*` —
 * or with [data-page="news"]. All eleven page files load on every page.
 */

/* ═══════════════════════════════════════════════════════ THE LIST COLUMN ══
   THE scroller of the list side, at every width (§5.4): a VERTICAL fade
   scroller (§4.13), declared here because it is this page's own. It paints
   nothing, so it can be masked. Its children keep their height and the
   column scrolls; nothing inside it scrolls on its own. */
[data-page="news"] .split__list {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
[data-page="news"] .split__list::-webkit-scrollbar { display: none; }
[data-page="news"] .split__list > * { flex: none; }
@supports (animation-timeline: scroll(self)) {
  [data-page="news"] .split__list {
    mask-image: linear-gradient(to bottom, transparent 0, black var(--m3-fade-start),
                                black calc(100% - var(--m3-fade-end)), transparent 100%);
    animation-name: m3-fade-start, m3-fade-end;
    animation-duration: auto, auto;
    animation-timing-function: linear, linear;
    animation-fill-mode: both, both;
    animation-timeline: scroll(self block), scroll(self block);
    animation-range: 0px var(--m3-fade, 40px), calc(100% - var(--m3-fade, 40px)) 100%;
  }
  /* The stories are no longer a scroller of their own, so they take no mask:
     one fade, on the column. */
  .stories { mask-image: none; }
}

/* ════════════════════════════════════════════════════════ THE AI OVERVIEW ══
   A filled card (.panel = .m3-card, radius 12) at the top of the column. Its
   head: a leading auto_awesome, "AI Overview" in title-medium, the date in
   label-medium (m3.css's .panel__note). One block per topic he follows.
   (The text is raw Markdown through |linebreaks: a renderer, out of scope, §0.5.) */
/* 16px all round (M3's card padding), not .panel's 16/20: the topic and body
   text then start on the same x as the story headlines below the card. */
[data-page="news"] .split__list > .panel { margin: 0; padding: 16px; }
[data-page="news"] .split__list > .panel > .panel__head { align-items: center; }
.brief__icon {
  --_icon: var(--app-icon-size-medium);
  --_opsz: 20;
  color: var(--md-sys-color-on-surface-variant);
}
.brief + .brief {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  margin-top: 12px;
  padding-top: 12px;
}
.brief__topic {
  margin: 0 0 4px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-title-small-size);
  line-height: var(--md-sys-typescale-title-small-line-height);
  font-weight: var(--md-sys-typescale-title-small-weight);
}
.brief__body {
  color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  font-weight: var(--md-sys-typescale-body-medium-weight);
  overflow-wrap: anywhere;
}
.brief__body p { margin: 0 0 8px; }
.brief__body p:last-child { margin-bottom: 0; }
/* The overview's `- **Subject:** sentence` bullets (briefs.as_html). */
.brief__body ul { margin: 0 0 8px; padding-left: 20px; }
.brief__body ul:last-child { margin-bottom: 0; }
.brief__body li + li { margin-top: 4px; }
.brief__body strong { font-weight: var(--md-sys-typescale-title-small-weight); }

/* ═════════════════════════════════════════════════════════════ THE STORIES ══
   ul.stories.m3-list > li > button.story.m3-list-item.m3-list-item--two.
   m3.css draws the item: transparent at rest, the 8/10/10% state layer, the
   4 → 12 → 16 shape morph, the inner focus ring, and the selected grey step
   (#333537, emphasized headline) on aria-current="true". This file sets the
   two lines: the headline, clamped to two, then source · "+N more" · time.
   NO read/unread styling, ever (the News rule, and a test). */
.stories { gap: 0; }
/* No gap between the two lines: a wrapped 2×24 headline + the 20px meta +
   10/10 padding is exactly M3's 88px three-line row; one line stays 72. */
.story > .m3-list-item__text { row-gap: 0; }
.story__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--_head);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  font-weight: var(--_head-w);
  font-variation-settings: "ROND" var(--_head-rond);
}
.story__meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--_sup);
}
.story__source {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
}
/* "+N more" is TEXT, not a pill (§5.4; the "+1 more" literal is test-pinned). */
.story__more {
  flex: none;
  white-space: nowrap;
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line-height);
  font-weight: var(--md-sys-typescale-label-medium-weight);
}
.story__meta time {
  flex: none;
  margin-inline-start: auto;
  white-space: nowrap;
  font-size: var(--md-sys-typescale-label-small-size);
  line-height: var(--md-sys-typescale-label-small-line-height);
  font-weight: var(--md-sys-typescale-label-small-weight);
  font-variant-numeric: tabular-nums;
}

/* ═════════════════════════════════════════════════════════════ THE REPORTS ══
   A story opens on its reports, and on nothing else. Each p.report is a
   segmented-list tile (#282A2C on the reading region, 2px apart, corners 16
   at the ends and 4 between) that is ONE link: the <a>'s ::after covers the
   whole tile, so a click anywhere opens the outlet. The grid puts the
   open_in_new mark in its own column beside both lines (it used to fall onto
   a row of its own under the link, pages-a §5(e)2). */
[data-page="news"] .field:has(> .report) { gap: 2px; }
[data-page="news"] .field:has(> .report) > h3 { margin-bottom: 6px; }   /* 8px from the label to the first tile */
.report {
  --_container: var(--md-sys-color-surface-container-high);
  --_state-color: var(--md-sys-color-on-surface);
  --_report-rt: var(--md-sys-shape-corner-extra-small);
  --_report-rb: var(--md-sys-shape-corner-extra-small);
  position: relative;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "link ext" "meta ext";
  align-content: center;
  column-gap: 12px;
  row-gap: 2px;
  min-height: var(--app-list-h-2);
  margin: 0;
  padding: 12px 16px;
  border-start-start-radius: var(--_report-rt);
  border-start-end-radius: var(--_report-rt);
  border-end-start-radius: var(--_report-rb);
  border-end-end-radius: var(--_report-rb);
  background-color: color-mix(in srgb, var(--_state-color) var(--_state, 0%), var(--_container));
}
.report:first-of-type { --_report-rt: var(--md-sys-shape-corner-large); }
.report:last-of-type { --_report-rb: var(--md-sys-shape-corner-large); }
@media (hover: hover) {
  .report:hover { --_state: var(--md-sys-state-hover-state-layer-opacity); }
}
.report:has(> a:focus-visible) { --_state: var(--md-sys-state-hover-state-layer-opacity); }
.report:has(> a:active) { --_state: var(--md-sys-state-pressed-state-layer-opacity); }

.report > a {
  grid-area: link;
  min-width: 0;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  overflow-wrap: anywhere;
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  font-weight: var(--md-sys-typescale-body-large-weight);
  -webkit-tap-highlight-color: transparent;
}
.report > a:hover { text-decoration: none; }
/* The whole tile is the link. The focus ring is the link's, drawn on this
   cover inside the tile's own corners (§2.14: inner, −3px). */
.report > a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-start-start-radius: var(--_report-rt);
  border-start-end-radius: var(--_report-rt);
  border-end-start-radius: var(--_report-rb);
  border-end-end-radius: var(--_report-rb);
}
.report > a:focus-visible { outline: none; }
.report > a:focus-visible::after {
  outline: var(--app-focus-ring);
  outline-offset: var(--app-focus-offset-inner);
}
.report > .field__ext {
  grid-area: ext;
  align-self: center;
  margin: 0;
}
.report__meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
  min-width: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  font-weight: var(--md-sys-typescale-body-medium-weight);
}
.report__meta b {
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
}
.report__meta time { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: no-preference) {
  .report {
    transition: background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
}

/* Every class above that is given a display value yields to [hidden] (K42). */
.story__title[hidden],
.story__meta[hidden],
.report[hidden],
.report__meta[hidden] { display: none; }
