/*
  rail.css
  Right rail: MPU advert and the "Popular" list.
  Needs css/base.css and ad-slot.css.
*/

.fm-rail { display: grid; gap: var(--fm-gap); min-width: 0; }
.fm-rail .fm-ad--mpu { margin-top: 0; }

.fm-popular { padding: 1.1rem 1.1rem 0.6rem; border-radius: var(--fm-radius); background: #fff; }
.fm-popular h2 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.fm-popular ol { counter-reset: popular; }
.fm-popular li { counter-increment: popular; position: relative; display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.85rem; align-items: start; padding-block: 0.85rem; }
.fm-popular li + li { border-top: 1px solid var(--fm-rule); }
.fm-popular .fm-media { border-radius: 6px; }
.fm-popular .fm-media img { aspect-ratio: 3 / 2; }
.fm-popular h3 { font-size: var(--fm-t-sm); line-height: 1.3; letter-spacing: -0.01em; }
.fm-popular h3 a:hover { color: var(--fm-blue); }
/* The link stretches over the whole row so the thumbnail is clickable too */
.fm-popular h3 a::after { content: ""; position: absolute; inset: 0; }
/* Number badge sits on the thumbnail's top-left corner */
.fm-popular li::before { content: counter(popular); position: absolute; top: calc(0.85rem + 0.3rem); left: 0.3rem; z-index: 1; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--fm-blue); font-size: 0.75rem; font-weight: 700; line-height: 1; color: #fff; }

/* Tablet (rail sits under the story): MPU and Popular side by side where there is room */
@media (min-width: 48rem) and (max-width: 74.99rem) {
  .fm-rail { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
}
