/*
 * «Актуелно» beside a story (inc/article-akt.php): the left column of the article frame.
 *
 * From 1150px the frame (article.css) is three columns: free | the text | tools and «Повеќе од».
 * This fills the free one, mirrored on the right column: the same width, the same sticky top, the
 * same distance from the text. It is the front page's «Актуелно»: one story from each of the other
 * sections, every row in its own section's colour (the row carries data-sec) — the kicker with the
 * section's dot and name, the headline, the time, a square picture at the right.
 *
 * Whole rows only: the list is a wrapping column, so a row that does not fit under the window's
 * height moves to a second column, which is clipped (article-akt.js then takes it out of the tab
 * order). Below 1150px the frame has no side columns and the block is not shown.
 */

.ed-article__akt { display: none; }

@media (min-width: 1150px) {
  /* Three items share the frame's single row. */
  .ed-article__frame > .ed-article__main,
  .ed-article__frame > .ed-article__side { grid-row: 1; }

  /* Both side columns end on the page's edges (the header's first and last control): the frame's
     side columns are (window - 664px) / 2 wide and the page is 1200px at most, so 268px from the
     text, or the column less the page gutter where the window is narrower than the page. */
  .ed-article__frame > .ed-article__side {
    width: min(100% - var(--ed-gutter, 32px), 268px);
    max-width: none;
  }

  .ed-article__akt {
    --ed-akt-head: 2.75rem;                 /* the label's block: rule, air, the label, air */
    --ed-akt-pad: var(--ed-s5);             /* air between the rows and the text column */
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    display: block;
    position: sticky;
    top: calc(var(--ed-sticky-top, 64px) + 16px);
    box-sizing: border-box;
    width: min(100% - var(--ed-gutter, 32px), 268px);
    margin-top: var(--ed-s5);
    padding-right: var(--ed-akt-pad);
  }

  .ed-art-akt__title {
    box-sizing: border-box;
    height: var(--ed-akt-head);
    margin: 0;
    padding-top: 10px;
    border-top: 2px solid var(--sd-c, var(--ed-ink));
  }
  .ed-art-akt__title a { color: var(--ed-ink); text-decoration: none; }
  .ed-art-akt__title a:hover { color: var(--sd-c-text, var(--ed-ink-3)); }

  /* The list: as many whole rows as fit between the sticky top and the window's bottom edge. The
     list's box reaches a little past the rows at both sides, so the hover wash is not cut; the
     second (hidden) column starts beyond that box. */
  .ed-art-akt {
    --ed-list-gap: 0;
    display: flex;
    flex-flow: column wrap;
    align-content: flex-start;
    column-gap: 64px;
    max-height: calc(100vh - var(--ed-sticky-top, 64px) - 32px - var(--ed-akt-head));
    margin-inline: -10px calc(-1 * var(--ed-akt-pad));
    padding-inline: 10px var(--ed-akt-pad);
    overflow: hidden;
    overflow: clip;
  }
  .ed-art-akt > .ed-art-akt__row {
    flex: none;
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    width: 100%;
    margin-top: 0;
    padding-block: 11px;
  }
  .ed-art-akt > .ed-art-akt__row + .ed-art-akt__row { margin-top: 0; padding-top: 11px; border-top: 1px solid var(--ed-line); }
  .ed-art-akt > .ed-art-akt__row:first-child { padding-top: 2px; }
  .ed-art-akt > .ed-art-akt__row.is-out { visibility: hidden; }

  .ed-art-akt__item { --ed-thumb: 56px; column-gap: 10px; align-items: start; }
  .ed-art-akt__kicker {
    margin: 0 0 4px;
    font-family: var(--ed-sans);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .ed-art-akt__kicker > a,
  .ed-art-akt__kicker > span { display: inline-flex; align-items: center; color: var(--sd-c-text, var(--ed-ink)); text-decoration: none; }
  .ed-art-akt__kicker > a:hover { text-decoration: underline; text-underline-offset: 2px; }
  .ed-art-akt__dot {
    flex: none;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--sd-c, var(--ed-ink));
  }
  .ed-art-akt__item .ed-story__headline { font-size: 0.9375rem; line-height: 1.27; }
  .ed-art-akt__time {
    margin: 4px 0 0;
    font-family: var(--ed-sans);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ed-ink-4);
  }
  .ed-art-akt .ed-media { background-color: var(--sd-c-wash-2, var(--ed-bg-3)); }

  /* The row under the pointer or the keyboard: a soft wash in the section's colour, as on the front page. */
  .ed-art-akt > .ed-art-akt__row::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 calc(-1 * var(--ed-akt-pad) + 4px) 0 -10px;
    background: var(--sd-c-wash, var(--ed-bg-2));
    opacity: 0;
    pointer-events: none;
  }
  .ed-art-akt > .ed-art-akt__row:hover::before,
  .ed-art-akt > .ed-art-akt__row:focus-within::before { opacity: 1; }

  /* A text block that leaves the column for the page's width needs this room. */
  .ed-article__frame:has(.ed-prose :is(.alignwide, .alignfull)) > .ed-article__akt { display: none; }

  /* The right column's «Повеќе од» keeps to whole rows the same way: a row that does not fit under
     the window's height moves to a clipped second column instead of being cut in half. 7.5rem is
     the column's tools row and the list's own title above the rows. */
  .ed-article__side-list {
    display: flex;
    flex-flow: column wrap;
    align-content: flex-start;
    column-gap: 64px;
    max-height: calc(100vh - var(--ed-sticky-top, 64px) - 32px - 7.5rem);
    overflow: hidden;
    overflow: clip;
  }
  .ed-article__side-list > li { flex: none; box-sizing: border-box; width: 100%; }
  .ed-article__side-list > li.is-out { visibility: hidden; }
}

/* With whole rows guaranteed, the right column's list no longer waits for a 760px window: it shows
   from 600px of height (most laptops), and the grid under the article, which carries the same
   stories where the list is hidden (article.css), follows the same line. */
@media (min-width: 1150px) and (min-height: 600.02px) {
  .ed-article__side-more { display: block; }
  .ed-article-more__item:not(.is-narrow) { display: block; }
  .ed-article-more__item:not(.is-wide) { display: none; }
}

/* Windows narrower than the page: the side columns are slimmer, so they stand closer to the text
   and the pictures are smaller; the headlines keep a readable line. */
@media (min-width: 1150px) and (max-width: 1263.98px) {
  .ed-article__akt { --ed-akt-pad: 10px; }
  .ed-article__frame > .ed-article__side { padding-left: 10px; }
}
@media (min-width: 1150px) and (max-width: 1199.98px) {
  .ed-art-akt__item { --ed-thumb: 48px; }
  .ed-article__side-list .ed-story--thumb { --ed-thumb: 48px; }
}

/* Wider windows: a larger picture. */
@media (min-width: 1366px) {
  .ed-art-akt__item { --ed-thumb: 64px; column-gap: 12px; }
}

/* Very short windows: no room for two rows under the header. */
@media (min-width: 1150px) and (max-height: 420px) {
  .ed-article__akt { display: none; }
}

@media (min-width: 1150px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .ed-art-akt > .ed-art-akt__row::before { transition: opacity 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .ed-art-akt .ed-media > img { transition: transform 0.42s var(--fx-ease, ease), opacity 0.36s var(--fx-ease, ease); }
  .ed-art-akt .ed-story:hover .ed-media > img { transform: scale(1.03); }
}

@media print {
  .ed-article__akt { display: none !important; }
}
