/*
 * Alfa Editorial: widgets.css
 * Data modules: scoreboard, market strip, public procurement, videos, air quality, tip strip.
 * Loaded only on views that show one of them (inc/modules.php).
 */

/* ------------------------------------------------------------------ Shared */

.ed-widget-note {
  font-family: var(--ed-sans);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ed-ink-4);
}
.ed-widget-note a,
.ed-widget-src a {
  color: var(--ed-ink-3);
  text-decoration: underline;
  text-decoration-color: var(--ed-line-2);
  text-underline-offset: 2px;
}
.ed-widget-note a:hover,
.ed-widget-src a:hover { color: var(--ed-ink); text-decoration-color: currentColor; }
/* A standalone source link: the hit area grows to 40px without moving the line. */
.ed-widget-src a {
  display: inline-block;
  padding-block: 13px;
  margin-block: -13px;
}

/* A module in the section-front slot sits on the head's black rule and is closed by one,
   so the highlights below start exactly as they do on a page without it. */
.ed-slot--archive-top { padding-bottom: var(--ed-s5); border-bottom: 1px solid var(--ed-ink); }
.ed-slot--archive-top > :first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.ed-slot--archive-top > * + * { margin-top: var(--ed-s8); }

/* ------------------------------------------------------------------ Scoreboard */

/*
 * A board of cells, two across on phones and tablets, five across from 1024px.
 * Each cell draws its own top and left hairline half a gap outside itself; the list
 * clips what falls outside, so rules appear only between cells, at any column count.
 */
.ed-scores__list {
  --ed-n: 2;
  display: grid;
  grid-template-columns: repeat(var(--ed-n), minmax(0, 1fr));
  column-gap: calc(2 * var(--ed-col-pad));
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ed-line);   /* opens the figures under the head, as the market strip does */
  list-style: none;
  overflow: hidden;
  font-family: var(--ed-sans);
  font-variant-numeric: tabular-nums lining-nums;
}
/* Phones: two rows of games, so the section's lead story still starts on the first screen. */
@media (max-width: 739px) {
  .ed-scores__game:nth-child(n + 5) { display: none; }
}
@media (min-width: 1024px) {
  .ed-scores__list { --ed-n: 5; }
}
.ed-scores__game {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: var(--ed-s3) 0 14px;
}
.ed-scores__game::before,
.ed-scores__game::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.ed-scores__game::before {
  top: 0; bottom: 0;
  left: calc(-1 * var(--ed-col-pad) - 0.5px);
  border-left: 1px solid var(--ed-line-2);
}
.ed-scores__game::after {
  top: -1px;
  left: calc(-1 * var(--ed-col-pad));
  right: calc(-1 * var(--ed-col-pad));
  border-top: 1px solid var(--ed-line);
}

.ed-scores__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  font-size: var(--ed-fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ed-ink-4);
  white-space: nowrap;
}
.ed-scores__dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ed-ink-4);
}
.ed-scores__game--up .ed-scores__dot { background: transparent; border: 1px solid var(--ed-ink-4); }
.ed-scores__comp {
  font-size: var(--ed-fs-label);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ed-ink);
}
.ed-scores--one .ed-scores__comp { display: none; }

.ed-scores__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ed-s2);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ed-ink);
}
.ed-scores__team {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed-scores__line--event .ed-scores__team { white-space: normal; text-wrap: balance; }
.ed-scores__pts {
  flex: none;
  min-width: 1.25em;
  font-weight: 700;
  text-align: right;
}
.ed-scores__line--win { font-weight: 700; }
.ed-scores__line--loss { color: var(--ed-ink-3); }
.ed-scores__line--loss .ed-scores__pts { font-weight: 500; }

/* Source line under a module */
.ed-widget-src {
  margin-top: var(--ed-s2);
  font-family: var(--ed-sans);
  font-size: var(--ed-fs-label);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--ed-ink-4);
}
.ed-scores .ed-widget-src { margin-top: var(--ed-s1); }

/* ------------------------------------------------------------------ Market strip */

/* Equal columns with the rule drawn in the middle of each gap (the .ed-cols model), so every
   figure has the same air on both sides at any width. */
.ed-market__list {
  --ed-mpad: var(--ed-s2);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--ed-s3) calc(2 * var(--ed-mpad));
  margin: 0;
  padding: var(--ed-s3) 0;
  border-block: 1px solid var(--ed-line);
  list-style: none;
  font-family: var(--ed-sans);
  font-variant-numeric: tabular-nums lining-nums;
}
.ed-market__item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ed-market__item::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: calc(-1 * var(--ed-mpad) - 0.5px);
  border-left: 1px solid var(--ed-line);
  pointer-events: none;
}
.ed-market__item:nth-child(5n + 1)::before { display: none; }
.ed-market__sym {
  font-size: var(--ed-fs-label);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.05em;
  color: var(--ed-ink-4);
}
.ed-market__price {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ed-ink);
  white-space: nowrap;
}
@media (min-width: 740px) {
  .ed-market__list { --ed-mpad: var(--ed-s3); }
  .ed-market__price { font-size: 0.9375rem; }
}
@media (min-width: 1024px) {
  .ed-market__list { --ed-mpad: var(--ed-s4); grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .ed-market__item:nth-child(5n + 1)::before { display: block; }
  .ed-market__item:first-child::before { display: none; }
}
@media (min-width: 1150px) {
  .ed-market__price { font-size: 1rem; }
}

/* ------------------------------------------------------------------ Public procurement */

.ed-tenders__table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ed-sans);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--ed-ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}
.ed-tenders__table thead { display: none; }
.ed-tenders__table tbody { display: block; border-top: 1px solid var(--ed-line); }

/* Phones: each contract is a short ruled entry */
.ed-tenders__row {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  column-gap: var(--ed-s2);
  row-gap: 5px;
  padding: var(--ed-s3) 0;
  border-bottom: 1px solid var(--ed-line);
}
.ed-tenders__row > td { display: block; grid-column: 2; padding: 0; }
.ed-tenders__row > .ed-tenders__n {
  grid-column: 1;
  grid-row: 1 / span 4;
  font-weight: 600;
  color: var(--ed-ink-4);
}
.ed-tenders__subject {
  font-family: var(--ed-head);
  font-size: var(--ed-fs-xs);
  font-weight: 500;
  line-height: 1.22;
  color: var(--ed-ink);
  text-wrap: pretty;
}
.ed-tenders__code {
  margin-left: 0.35em;
  font-family: var(--ed-sans);
  font-size: var(--ed-fs-label);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ed-ink-4);
  white-space: nowrap;
}
.ed-tenders__parties > span { display: block; }
.ed-tenders__parties { font-size: 0.75rem; color: var(--ed-ink-3); }
.ed-tenders__k { color: var(--ed-ink-4); }
.ed-tenders__row > td[data-label]::before {
  content: attr(data-label) ": ";
  color: var(--ed-ink-4);
}
.ed-tenders__dates { font-size: 0.75rem; }
.ed-tenders__amount { font-weight: 700; color: var(--ed-ink); }
.ed-tenders__amount span,
.ed-tenders__dates span { color: var(--ed-ink-4); font-weight: 500; }
.ed-tenders__row .ed-tenders__amount span::before,
.ed-tenders__row .ed-tenders__dates span::before { content: " · "; }

@media (min-width: 740px) {
  .ed-tenders__table thead { display: table-header-group; }
  .ed-tenders__table tbody { display: table-row-group; border-top: 0; }
  .ed-tenders__row { display: table-row; padding: 0; }
  .ed-tenders__row > td { display: table-cell; }
  .ed-tenders__row > td[data-label]::before,
  .ed-tenders__k { display: none; }
  .ed-tenders__table th,
  .ed-tenders__table td {
    padding: 11px var(--ed-s3);
    border-bottom: 1px solid var(--ed-line);
    text-align: left;
    vertical-align: baseline;   /* the serif subject and the sans cells share their first baseline */
  }
  .ed-tenders__table th:first-child,
  .ed-tenders__table td:first-child { padding-left: 0; }
  .ed-tenders__table th:last-child,
  .ed-tenders__table td:last-child { padding-right: 0; }
  .ed-tenders__table th {
    padding-top: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ed-line-2);
    font-size: var(--ed-fs-label);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ed-ink);
    vertical-align: bottom;
  }
  .ed-tenders__table th span { display: block; font-weight: 500; color: var(--ed-ink-4); }
  .ed-tenders__n { width: 2rem; }
  .ed-tenders__subject { font-size: 1rem; }
  .ed-tenders__parties { width: 34%; }
  .ed-tenders__parties > span { text-wrap: balance; }
  .ed-tenders__parties > span + span { margin-top: 3px; color: var(--ed-ink-4); }
  .ed-tenders__dates { width: 6.25rem; white-space: nowrap; }
  .ed-tenders__amount { width: 8.75rem; white-space: nowrap; }
  /* Money sits flush right under its head, so the digit groups line up. */
  .ed-tenders__table th.ed-tenders__amount,
  .ed-tenders__table td.ed-tenders__amount { text-align: right; }
  .ed-tenders__dates span,
  .ed-tenders__amount span { display: block; margin-top: 3px; }
  .ed-tenders__row .ed-tenders__amount span::before,
  .ed-tenders__row .ed-tenders__dates span::before { content: none; }
}
@media (min-width: 740px) and (max-width: 1023px) {
  .ed-tenders__parties { width: 30%; }
  .ed-tenders__dates { display: none; }
}
/* Below the full width the buyer column takes a little from the subject, so a ministry's
   name stays on one line. */
@media (min-width: 1024px) and (max-width: 1149px) {
  .ed-tenders__parties { width: 37%; }
}

/* Paging: only when the script runs; without it every row stays visible */
.ed-tenders__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ed-s2) var(--ed-s4);
  margin-top: var(--ed-s3);
}
.ed-tenders__foot .ed-widget-src { margin-top: 0; }
.ed-tenders__pager { display: none; }
.js .ed-tenders__pager { display: block; }
.ed-tenders__pager ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ed-tenders__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--ed-radius);
  font-family: var(--ed-sans);
  font-size: var(--ed-fs-ui);
  font-weight: 500;
  color: var(--ed-ink-3);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s var(--ed-ease), color 0.15s var(--ed-ease);
}
.ed-tenders__page:hover { border-color: var(--ed-line-2); color: var(--ed-ink); }
.ed-tenders__page[aria-current] { border-color: var(--ed-ink); color: var(--ed-ink); font-weight: 700; }
.js .ed-tenders:not(.is-ready) .ed-tenders__row:not([data-page="1"]) { display: none; }

/* ------------------------------------------------------------------ Videos ("Емисии") */

/* Phones: a ruled list with the picture at the right (.ed-cols stacks them).
   From 740px: two, then four picture stories across, divided by column rules. */
.ed-videos__link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ed-thumb, 104px);   /* the base thumb, as in the lists around it */
  column-gap: var(--ed-s3);
  align-items: start;
  color: var(--ed-ink);
}
.ed-videos__media { grid-column: 2; grid-row: 1; }
.ed-videos__body { grid-column: 1; grid-row: 1; min-width: 0; }
.ed-videos__media img { transition: opacity 0.2s var(--ed-ease); }
.ed-videos__media .ed-media__badge { left: 6px; bottom: 6px; width: 26px; height: 26px; }
.ed-videos__link:hover .ed-videos__media img { opacity: 0.9; }
.ed-videos__link:hover .ed-videos__title { color: var(--ed-ink-3); }
.ed-videos__title {
  font-family: var(--ed-head);
  font-size: var(--ed-fs-xs);
  font-weight: 500;
  line-height: 1.22;
  color: var(--ed-ink);
  text-wrap: balance;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  transition: color 0.12s var(--ed-ease);
}
.ed-videos__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: var(--ed-s2);
  font-family: var(--ed-sans);
  font-size: var(--ed-fs-label);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ed-ink-4);
}
.ed-videos__ch { font-weight: 700; color: var(--ed-ink-3); }
.ed-videos__meta > * + *::before { content: "·"; margin-inline: 0.5em; }

@media (min-width: 740px) {
  .ed-videos__link { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
  .ed-videos__media,
  .ed-videos__body { grid-column: 1; grid-row: auto; }
  .ed-videos__media .ed-media__badge { left: 8px; bottom: 8px; width: 30px; height: 30px; }
  .ed-videos__title { font-size: var(--ed-fs-sm); line-height: 1.2; }
}

/* ------------------------------------------------------------------ Air quality + tip strip */

/* The air block opens with the black rule of .ed-block; the tip line follows it.
   When the air data is missing, the tip line opens the block itself. */
.ed-extra > .ed-tip:first-child {
  margin-top: var(--ed-s8);
  border-top-color: var(--ed-ink);
}
@media (min-width: 1024px) {
  .ed-extra > .ed-tip:first-child { margin-top: var(--ed-s10); }
}

.ed-air__list {
  --ed-n: 3;
  display: grid;
  grid-template-columns: repeat(var(--ed-n), minmax(0, 1fr));
  column-gap: calc(2 * var(--ed-col-pad));
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  font-family: var(--ed-sans);
  font-variant-numeric: tabular-nums lining-nums;
}
@media (min-width: 1024px) {
  .ed-air__list { --ed-n: 6; }
  .ed-air__name { font-size: 0.875rem; }
}
.ed-air__st {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: var(--ed-s3) 0;
}
.ed-air__st::before,
.ed-air__st::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.ed-air__st::before {
  top: 0; bottom: 0;
  left: calc(-1 * var(--ed-col-pad) - 0.5px);
  border-left: 1px solid var(--ed-line-2);
}
.ed-air__st::after {
  top: -1px;
  left: calc(-1 * var(--ed-col-pad));
  right: calc(-1 * var(--ed-col-pad));
  border-top: 1px solid var(--ed-line);
}
.ed-air__name {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ed-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed-air__vals {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--ed-s2);
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--ed-ink-4);
}
.ed-air__vals b { font-weight: 700; color: var(--ed-ink); }
.ed-air__level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ed-fs-label);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ed-ink-4);
}
/* Status as a small dot: green when good, an open ring when moderate, filled ink when bad. */
.ed-air__dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ed-ok); }
.ed-air__st--mid .ed-air__dot { background: transparent; border: 1.5px solid var(--ed-ink-3); }
.ed-air__st--high .ed-air__dot { background: var(--ed-ink); }
.ed-air__st--high .ed-air__level { font-weight: 700; color: var(--ed-ink); }

.ed-tip {
  margin-top: var(--ed-s5);
  padding-top: var(--ed-s2);
  border-top: 1px solid var(--ed-line);
  font-family: var(--ed-sans);
  font-size: var(--ed-fs-ui);
  line-height: 1.3;
}
.ed-tip__link {
  display: inline-flex;
  align-items: center;
  gap: var(--ed-s2);
  min-height: 40px;
  color: var(--ed-ink-2);
}
.ed-tip__q { font-weight: 700; color: var(--ed-ink); }
.ed-tip__a { text-decoration: underline; text-decoration-color: var(--ed-line-2); text-underline-offset: 3px; }
.ed-tip__arrow { transition: transform 0.15s var(--ed-ease); }
.ed-tip__link:hover .ed-tip__a { text-decoration-color: currentColor; color: var(--ed-ink); }
.ed-tip__link:hover .ed-tip__arrow { transform: translateX(2px); }

/* ------------------------------------------------------------------ Ads */

/* The leaderboard sits in the quiet band, its label above it, like a newspaper's ad well. */
.ed-ad--leaderboard {
  margin-top: var(--ed-s8);
  padding: var(--ed-s3) var(--ed-s4) var(--ed-s5);
  border-block: 0;
  background: var(--ed-bg-2);
}
/* Phones: a 728px banner would shrink to an unreadable strip and follow the rail's rectangle
   straight away, so it is left out (its image is lazy and is not requested). */
@media (max-width: 739px) {
  .ed-ad--leaderboard { display: none; }
}
@media (min-width: 1024px) {
  .ed-ad--leaderboard { margin-top: var(--ed-s10); }
  /* At the top of a section front's rail the ad sits on the block's black rule, its label
     level with the stream's label, instead of adding a second hairline 17px below it. */
  .ed-archive__rail > .ed-slot--archive-rail:first-child > .ed-ad:first-child {
    padding-top: 0;
    border-top: 0;
  }
}
