/* /moex/<ticker>/<year>/ — the review of one annual report (pipeline/pages/moexrev.py). The reading layout is
   css/articles.css (.art, .art-wide, .art-sec); here: the source marks, the better / worse table, the profit
   bridge, breakdown bars, history cards, peer rankings, the auditor card, events, "promised / delivered".
   All charts on this page are HTML and CSS (bars sized in percent), so they read at any width and in every theme. */

.mr .art-head h1 { max-width: 20ch; font-size: clamp(34px, 5vw, 58px); }
.mr .bento .card .mx-u { font: 600 0.5em/1 var(--font); letter-spacing: 0; margin-left: 0.3em; white-space: nowrap; }
.mr .bento .card .mid .mx-u { font-size: 0.6em; }
.mr-after { margin-top: 20px !important; }

/* a source mark: the document and the page a statement comes from */
.mr-ref { display: inline-block; margin: 0 1px; padding: 0 6px; border: 1px solid var(--border); border-radius: 7px; font: 500 12.5px/1.55 var(--font);
  color: var(--muted); text-decoration: none; white-space: nowrap; vertical-align: 0.08em; background: var(--surface-2); }
.mr-ref:hover { color: var(--accent-ink); border-color: currentColor; }

/* the short version */
.mr-tldr { margin-top: 28px; padding: 22px 26px; }
.mr-tldr ul { margin: 8px 0 0; padding-left: 20px; font-size: 17.5px; line-height: 1.55; color: var(--ink-2); }
.mr-tldr li { margin: 0 0 8px; }
.mr-tldr li:last-child { margin-bottom: 0; }
.mr-tldr b, .mr-list b { color: var(--ink); font-weight: 650; }
.mr-list { margin: 0 0 16px; padding-left: 22px; }
.mr-list li { margin: 0 0 8px; }

/* better or worse */
.mr-score { margin-top: 20px; }
.mr-score .note { margin: 10px 0 0; }
.mr-meter { display: flex; gap: 3px; height: 14px; border-radius: 7px; overflow: hidden; }
.mr-seg.up { background: var(--good); } .mr-seg.down { background: var(--bad); } .mr-seg.same { background: var(--line-gray); }
.mr-meter-sum { margin: 8px 0 14px; font-size: 15.5px; font-weight: 550; color: var(--ink-2); }
.mr-score-table th[scope="row"] { white-space: normal; min-width: 150px; }
.mr-was { color: var(--muted); }
.mr-mark { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.mr-mark::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line-gray); }
.mr-mark.up { color: var(--good); } .mr-mark.up::before { background: var(--good); }
.mr-mark.down { color: var(--bad); } .mr-mark.down::before { background: var(--bad); }
.mr-mark.same { color: var(--muted); }

/* figures */
.mr-fig { padding: 20px 22px 8px; margin-top: 12px !important; }
.mr-fig .legend { padding: 0; margin: 0 0 12px; }
.mr-fig .chart-foot { padding: 12px 0 8px; }
.mr-fig-h { margin: 0 0 10px; font: 650 17.5px/1.3 var(--font); color: var(--ink); }
.mr-plot { min-height: 300px; }
.mr-fig.has-full > .mr-bridge { margin-top: 26px; }   /* room for the full-screen button above the first row */
.mr-fig.has-full > .mr-fig-h { padding-right: 40px; }

/* the profit bridge: last year's profit, each line's change, this year's profit */
.mr-bridge { display: grid; gap: 4px; }
.mr-br-row { display: grid; grid-template-columns: minmax(200px, 34%) minmax(0, 1fr) 128px; gap: 4px 16px; align-items: center; padding: 7px 0; border-top: 1px solid var(--border); }
.mr-br-row:first-child { border-top: 0; }
.mr-br-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mr-br-n { font-weight: 600; color: var(--ink); font-size: 16px; line-height: 1.3; }
.mr-br-why { font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.mr-br-t { position: relative; height: 26px; border-radius: 6px; background: linear-gradient(var(--track), var(--track)) center / 100% 1px no-repeat; }
.mr-br-b { position: absolute; top: 2px; bottom: 2px; border-radius: 5px; background: var(--line-gray); }
.mr-br-row.up .mr-br-b { background: var(--good); }
.mr-br-row.down .mr-br-b { background: var(--bad); }
.mr-br-row.tot .mr-br-b { background: var(--solid); }
.mr-br-v { text-align: right; font: 600 16px/1.2 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.mr-br-row.up .mr-br-v { color: var(--good); }
.mr-br-row.down .mr-br-v { color: var(--bad); }
.mr-br-row.tot .mr-br-n, .mr-br-row.tot .mr-br-v { font-weight: 700; }

/* a breakdown from the notes: this year against the year before */
.mr-mix { display: grid; gap: 2px; }
.mr-mx-row { display: grid; grid-template-columns: minmax(170px, 28%) minmax(0, 1fr) 96px; gap: 4px 16px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.mr-mx-row:first-child { border-top: 0; }
.mr-mx-n { font-weight: 600; color: var(--ink); font-size: 16px; line-height: 1.3; }
.mr-mx-bars { display: grid; gap: 4px; min-width: 0; }
.mr-mx-line { display: flex; align-items: center; gap: 8px; font: 550 14.5px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.mr-mx-line.was { color: var(--muted); }
/* a bar takes its share (--w, 0…1) of the line minus the room its value needs */
.mr-mx-b { height: 13px; min-width: 2px; width: calc(var(--w) * (100% - 104px)); border-radius: 4px; background: var(--s1); flex: none; }
.mr-mx-b.was { background: var(--line-gray); opacity: 0.55; }
.mr-mx-b.neg { background: var(--bad); }
.mr-mx-b.was.neg { background: var(--bad); opacity: 0.4; }
.mr-mx-d { text-align: right; }
.mr-sw-cur { background: var(--s1); } .mr-sw-was { background: var(--line-gray); opacity: 0.55; }

/* tables */
.mr-ops th[scope="row"], .mr-outlook td:first-child { white-space: normal; min-width: 220px; }
.mr-outlook td:first-child { text-align: left; color: var(--ink-2); line-height: 1.5; }
.mr-src { text-align: left; }
.mr .table-wrap.art-wide { margin-top: 12px; }

/* cash tiles, history cards */
.mr-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 12px !important; }
.mr-tile { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 20px; }
.mr-tile .mid { font-size: 26px; }
.mr-tile .mx-u { font: 600 0.62em/1 var(--font); letter-spacing: 0; margin-left: 0.3em; }
.mr-hgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px !important; }
.mr-hist { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 20px; }
.mr-hist .mid { font-size: 26px; }
.mr-hsvg { width: 100%; height: 64px; margin-top: 6px; overflow: visible; }
.mr-hb { fill: var(--line-gray); opacity: 0.5; }
.mr-hb.last { fill: var(--s1); opacity: 1; }
.mr-hb.neg { fill: var(--bad); opacity: 0.45; }
.mr-hb.neg.last { opacity: 1; }
.mr-hm { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: 0.55; }
.mr-hx { display: flex; justify-content: space-between; font: 500 12px/1 var(--mono); color: var(--muted); }

/* peer rankings */
.mr-ranks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 12px !important; }
.mr-rank { padding: 18px 20px; border-radius: 20px; display: flex; flex-direction: column; gap: 5px; }
.mr-rank-h { font: 650 15.5px/1.3 var(--font); color: var(--ink); margin-bottom: 6px; }
.mr-rk-row { display: grid; grid-template-columns: minmax(74px, 34%) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 14.5px; color: var(--ink-2); }
.mr-rk-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-rk-t { position: relative; height: 16px; }
.mr-rk-z { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--axis); }
.mr-rk-b { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; background: var(--line-gray); opacity: 0.6; }
.mr-rk-v { font: 500 13.5px/1 var(--font); font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; white-space: nowrap; }
.mr-rk-row.me { color: var(--ink); font-weight: 650; }
.mr-rk-row.me .mr-rk-b { background: var(--s1); opacity: 1; }
.mr-rk-row.me .mr-rk-v { font-weight: 700; }
.mr-rank .art-sub { margin-top: 8px; font-size: 13px; }
.mr-notes { margin-top: 14px !important; padding-left: 20px; font-size: 14.5px; color: var(--muted); }
.mr-notes li { margin-bottom: 4px; }

/* the auditor */
.mr-audit { padding: 22px 26px; margin-top: 12px !important; }
.mr-audit-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.mr-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font: 650 15.5px/1.2 var(--font); background: var(--track); color: var(--ink); }
.mr-badge::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.mr-badge.good { background: var(--good-soft); color: var(--good); }
.mr-badge.bad { background: var(--bad-soft); color: var(--bad); }
.mr-audit-who { color: var(--ink-2); font-size: 15.5px; }
.mr-kam { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 12px; color: var(--ink-2); font-size: 16.5px; line-height: 1.55; }
.mr-kam b { display: block; color: var(--ink); font-weight: 650; }

/* events */
.mr-events { list-style: none; padding: 0; margin-top: 12px !important; display: grid; gap: 0; }
.mr-events li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; padding: 12px 0 12px 18px; border-left: 2px solid var(--border); position: relative; }
.mr-events li::before { content: ""; position: absolute; left: -6px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--solid); }
.mr-ev-d { font: 650 15px/1.6 var(--font); font-variant-numeric: tabular-nums; color: var(--ink); }
.mr-ev-t { color: var(--ink-2); font-size: 16.5px; line-height: 1.55; }

/* promised / delivered */
.mr-vsum { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px !important; }
.mr-vchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font: 600 13.5px/1.4 var(--font); background: var(--track); color: var(--ink-2); white-space: nowrap; }
.mr-vchip.met { background: var(--good-soft); color: var(--good); }
.mr-vchip.missed { background: var(--bad-soft); color: var(--bad); }
.mr-vchip.partly, .mr-vchip.changed { background: var(--brand-soft); color: var(--btc-ink); }
.mr-prs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px !important; }
.mr-pr { padding: 18px 20px; border-radius: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); border-left: 4px solid var(--line-gray); }
.mr-pr.met { border-left-color: var(--good); } .mr-pr.missed { border-left-color: var(--bad); }
.mr-pr.partly, .mr-pr.changed { border-left-color: var(--btc); }
.mr-pr-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mr-pr-p .label, .mr-pr-f .label { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
.mr-pr-f { padding-top: 10px; border-top: 1px solid var(--border); color: var(--ink); }

@media (max-width: 1020px) {
  .mr-ranks, .mr-hgrid, .mr-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .mr-fig { padding: 16px 14px 6px; }
  .mr-br-row { grid-template-columns: minmax(0, 1fr) auto; }
  .mr-br-l { grid-column: 1; }
  .mr-br-v { grid-column: 2; grid-row: 1; align-self: start; }
  .mr-br-t { grid-column: 1 / -1; height: 20px; }
  .mr-mx-row { grid-template-columns: minmax(0, 1fr) auto; }
  .mr-mx-d { grid-column: 2; grid-row: 1; }
  .mr-mx-bars { grid-column: 1 / -1; }
  .mr-prs { grid-template-columns: minmax(0, 1fr); }
  .mr-events li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .mr-tldr { padding: 18px 18px; }
}
@media (max-width: 560px) {
  .mr-ranks, .mr-hgrid, .mr-tiles { grid-template-columns: minmax(0, 1fr); }
  /* the key figures two in a row under the wide first one; the tables without the columns a phone has no room for */
  .mr .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mr .bento .w2 { grid-column: 1 / -1; }
  .mr .bento .card:not(.w2) { padding: 14px 14px 12px; border-radius: 18px; }
  .mr .bento .card:not(.w2) .mid { font-size: 21px; }
  .mr .bento .card:not(.w2) .pill { font-size: 12.5px; padding: 2px 7px; }
  /* the two tables as stacked rows: the name on its own line, its figures under it. A name squeezed into a
     narrow column breaks after every character in Japanese and Chinese, and long German names push the
     last column off the screen. The heading row stays for screen readers only. */
  .mr-score-table .mr-was, .mr-ops .mr-was, .mr-ops .mr-src { display: none; }
  .mr-score-table, .mr-ops, .mr-score-table tbody, .mr-ops tbody { display: block; }
  .mr-score-table thead, .mr-ops thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mr-score-table tr, .mr-ops tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 11px 14px; }
  .mr-score-table th[scope="row"], .mr-ops th[scope="row"] { grid-column: 1 / -1; min-width: 0; padding: 0; white-space: normal; text-align: left; }
  .mr-score-table td, .mr-ops td { padding: 0; text-align: left; }
  .mr-score-table td.num:first-of-type, .mr-ops td.num:first-of-type { font-weight: 600; color: var(--ink); }
  /* what to check next year: the promise, its date under it */
  .mr-outlook, .mr-outlook tbody { display: block; }
  .mr-outlook thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mr-outlook tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 11px 14px; }
  .mr-outlook td, .mr-outlook td:first-child { padding: 0; min-width: 0; text-align: left; white-space: normal; }
  .mr-outlook td.num { font-weight: 600; color: var(--ink); }
}
