/* ==========================================================================
   Widescreen layout.
   Served when the visitor is on a large screen, or has explicitly chosen it.
   The lede is a hero with two runners-up beside it; below that the ranking
   continues as a two-column grid that steps down to a headline list.
   All colour and component work lives in base.css.
   ========================================================================== */

.topbar__inner {
    max-width: 1240px;
}

.tabs {
    margin-left: 10px;
}

.shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 34px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.shell--article {
    padding-top: 6px;
}

.column {
    min-width: 0;
}

.rail {
    position: sticky;
    top: 74px;
}

/* ------------------------------------------------------------- the lede */

/* The top recommendation takes the larger column and spans both rows, so
   rank one is unmistakably the lead story and ranks two and three sit
   beside it as runners-up. */
@media (min-width: 900px) {
    .lede {
        grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
        grid-auto-rows: min-content;
    }

    .card--hero {
        grid-row: span 2;
        padding: 22px;
    }

    .card--hero .card__main {
        flex-direction: column;
        gap: 0;
    }

    .card--hero .card__media {
        order: -1;
        width: 100%;
        margin: 0 0 16px;
    }

    .card--lead .card__media {
        display: none;
    }

    .card--lead .card__body {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}

/* ------------------------------------------------------------- the grid */

/* Below the lede the feed runs two across, which keeps a dozen ranked
   stories above the fold on a laptop without shrinking the type. */
@media (min-width: 900px) {
    .feed {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    /* Headline-only rows and ads run the full width of the grid. */
    .card--compact,
    .ad--infeed {
        grid-column: 1 / -1;
    }

    .card--standard .card__media {
        order: 2;
        width: 148px;
        margin-top: 2px;
        aspect-ratio: auto;
    }

    .card--standard .card__main:has(.card__media) {
        min-height: 92px;
    }
}

/* ------------------------------------------------------ narrower windows */

@media (max-width: 1080px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }

    .rail {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        align-items: start;
    }

    .ad--halfpage {
        min-height: 250px;
    }
}

@media (max-width: 899px) {
    .feed,
    .lede {
        display: flex;
        flex-direction: column;
    }

    .card--hero .card__main,
    .card--lead .card__main {
        flex-direction: column;
        gap: 0;
    }

    .card--hero .card__title {
        font-size: 1.6rem;
    }
}

@media (max-width: 700px) {
    .topbar__inner {
        padding: 10px 14px;
        gap: 10px;
    }

    .brand__name {
        display: none;
    }

    .shell {
        padding: 0 14px 32px;
    }

    .footer__inner {
        padding: 28px 14px 22px;
    }
}

/* -------------------------------------------------------- settings panel */

.panel:not(.panel--center) {
    justify-content: flex-end;
}

.panel:not(.panel--center) .panel__sheet {
    width: min(420px, 100%);
    height: 100%;
    border-left: 1px solid var(--border);
    animation: slide-in 0.24s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes slide-in {
    from {
        transform: translateX(100%);
    }
}

/* --------------------------------------------------------- story layout */

/* A story page gets a wider rail than the front page: the reading queue in
   it has to hold a headline, a source and a thumbnail per row without the
   titles collapsing to two words a line. */
.shell--story {
    grid-template-columns: minmax(0, 1fr) 360px;
    padding-top: 6px;
}

.shell--story .prose {
    max-width: 74ch;
}

/* The sticky behaviour for this rail belongs to the inner element, which is
   what scrolls; the outer column just holds the track. */
.rail--queue {
    position: static;
    align-self: stretch;
}

@media (max-width: 1180px) {
    .shell--story {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}

@media (max-width: 1000px) {
    .shell--story {
        grid-template-columns: minmax(0, 1fr);
    }

    .shell--story .prose {
        max-width: none;
    }
}
