/* ---------- Media monitor (media-monitor.html): the parliamentary forces in the press ----------
 * ADR 0010 of hirhanyo-pro: per analysed full-text article and force, the context it shows the
 * force in (positive, neutral or mixed, negative), whether it is a main subject, and a one-line
 * reason. Not a rating of outlets and no proof of bias: the page says so first. The frame, a tile
 * per force with its daily articles (small multiples on one scale), the sources by force with a
 * minimum sample, the stories of the week, the articles with their reasons, the method. Builds on
 * metrics.css (diverging bar, legend, stance chips), lists.css, select.css and pager.css. */

/* The stance colours of metrics.css (.mx) for the whole page: legends and bars outside a .mx */
.mm-page { --mx-fill: var(--color-primary); --mx-track: var(--track); --mx-positive: color-mix(in oklab, var(--color-blue) 80%, var(--color-background)); --mx-negative: color-mix(in oklab, var(--color-orange) 80%, var(--color-background)); --mx-neutral: var(--line-bright); }
[data-theme="light"] .mm-page { --mx-positive: var(--color-blue); --mx-negative: var(--color-orange); }
.mm-page .mx-legend { margin: 0 0 12px; }
.mm-page > * { min-width: 0; }

/* The frame: what it measures and what not */
.mm-frame { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mm-frame > div { display: grid; gap: 8px; align-content: start; padding: 14px 18px; }
.mm-frame > div + div { border-left: 1px solid var(--line); }
.mm-frame h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.mm-frame h2 .icon { font-size: 15px; }
.mm-frame .is-yes .icon { color: var(--color-success); }
.mm-frame .is-no .icon { color: var(--color-warning-text); }
.mm-frame ul { display: grid; gap: 5px; margin: 0; padding-left: 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.mm-frame strong { color: var(--text); font-weight: 600; }

/* A tile per force: articles, main subject share, the context split, the daily articles */
.mm-forces { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mm-force { display: grid; gap: 14px; align-content: start; padding: 16px 18px; }
.mm-force-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mm-force-head h3 { margin: 0; font-size: 18px; font-weight: 600; }
.mm-force-head .mono { color: var(--muted); font-size: 9px; }
.mm-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; border: 1px solid var(--line); background: var(--line); }
.mm-figures div { display: grid; gap: 2px; padding: 8px 10px; background: var(--panel); }
.mm-figures dt { color: var(--muted); font-family: var(--font-mono); font-size: 8px; letter-spacing: .05em; }
.mm-figures dd { margin: 0; font-family: var(--font-heading); font-size: 22px; font-weight: 600; line-height: 1.1; }
.mm-figures dd small { margin-left: 2px; color: var(--muted); font-family: var(--font-body); font-size: 12px; font-weight: 500; }
.mm-split { display: grid; gap: 6px; }
.mm-split .mx-dbar { height: 12px; }
.mm-split-values { display: flex; justify-content: space-between; color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.mm-split-values b { color: var(--text); font-weight: 600; }
.mm-daily { display: grid; gap: 4px; }
.mm-daily-label { display: flex; justify-content: space-between; color: var(--muted); font-family: var(--font-mono); font-size: 8px; letter-spacing: .05em; }
.mm-bars { display: grid; grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr)); gap: 3px; align-items: end; height: 54px; padding-bottom: 1px; border-bottom: 1px solid var(--line); }
.mm-bars i { display: block; min-height: 2px; height: calc(var(--n) / var(--max) * 100%); border-radius: 2px 2px 0 0; background: var(--color-primary); }
.mm-bars i:hover { filter: brightness(1.2); }
.mm-axis { display: flex; justify-content: space-between; color: var(--muted); font-family: var(--font-mono); font-size: 8px; }

/* Sources by force: a matrix, a cell is the source's own articles about the force */
.mm-matrix { width: 100%; border-collapse: collapse; }
.mm-matrix th, .mm-matrix td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.mm-matrix thead th { color: var(--muted); font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: .06em; }
.mm-matrix tbody tr:last-child th, .mm-matrix tbody tr:last-child td { border-bottom: 0; }
.mm-matrix tbody th { width: 220px; font-weight: 600; }
.mm-source { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mm-source span:last-child { display: grid; gap: 1px; min-width: 0; }
.mm-source small { color: var(--muted); font-family: var(--font-mono); font-size: 9px; font-weight: 500; }
.mm-cell { display: grid; gap: 5px; min-width: 140px; }
.mm-cell .mx-dbar { width: 100%; height: 10px; }
.mm-cell-n { display: flex; justify-content: space-between; color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.mm-cell-n b { color: var(--text); font-weight: 600; }
.mm-cell.is-few { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; }
.mm-cell.is-few .icon { margin-right: 4px; }
.mm-cell.is-none { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.mm-table-wrap { overflow-x: auto; }

/* Stories of the week, with their split per force */
.mm-stories { display: grid; margin: 0; padding: 0 18px; list-style: none; }
.mm-stories li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 8px 20px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mm-stories li:last-child { border-bottom: 0; }
.mm-stories a { display: -webkit-box; overflow: hidden; color: var(--text); font-family: var(--font-heading); font-size: 15px; font-weight: 600; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mm-stories a:hover { color: var(--color-primary); }
.mm-stories .sw-stats { margin-top: 4px; }
.mm-story-forces { display: grid; gap: 6px; margin: 0; }
.mm-story-forces div { display: grid; grid-template-columns: 82px minmax(0, 1fr) 24px; gap: 8px; align-items: center; }
.mm-story-forces dt { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.mm-story-forces dd { display: contents; }
.mm-story-forces .mx-dbar { height: 8px; }
.mm-story-forces .mx-value { color: var(--muted); font-size: 9px; text-align: right; }

/* Articles with their forces and the reason of the analysis */
.mm-articles { display: grid; margin: 0; padding: 0 18px; list-style: none; }
.mm-article { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mm-article:last-child { border-bottom: 0; }
.mm-article > div { display: grid; gap: 6px; min-width: 0; }
.mm-article-title { display: -webkit-box; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mm-article-title:hover { color: var(--color-primary); }
.mm-article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.mm-reasons { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mm-reasons li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: baseline; }
.mm-reasons .mx-stance { min-width: 132px; }
.mm-reasons p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; font-style: italic; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

/* The method */
.mm-method { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; margin: 0; padding: 14px 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.mm-method dt { color: var(--text); font-family: var(--font-mono); font-size: 9px; letter-spacing: .06em; }
.mm-method dd { margin: 0 0 6px; }

.mm-sample { padding: 2px 6px; border: 1px dashed var(--color-warning-text); color: var(--color-warning-text); font-family: var(--font-mono); font-size: 9px; letter-spacing: .05em; }

@media (max-width: 1000px) {
  .mm-forces { grid-template-columns: minmax(0, 1fr); }
  .mm-stories li { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .mm-frame, .mm-method { grid-template-columns: minmax(0, 1fr); }
  .mm-frame > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .mm-reasons li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .mm-matrix tbody th { width: auto; }
}
