/*
 * Onward navigation on project (design/website) detail pages.
 * Two reachable controls that reuse the already-loaded related projects,
 * so a reader does not have to scroll the full gallery to find somewhere
 * to go next. No new queries: the markup is fed by $related_blogs.
 */

/* ---- Mid-article "More in <hub>" row ---- */
.onward-more {
    background: #f4f4f4;
    padding: 44px 0;
    margin: 0;
}

.onward-more__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 24px;
}

.onward-more__title {
    margin: 0;
}

.onward-more__hub {
    white-space: nowrap;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.onward-more__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.onward-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.onward-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    background: #e7e7e7;
}

.onward-card__media img,
.onward-card__media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.onward-card__title {
    margin: 14px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile and narrow widths: horizontal scroller. All three cards sit on one
   line and the third is partly cut off, so it reads as swipeable. The 3-up grid
   is kept only at full desktop width, where all three fit without clipping. */
@media (max-width: 991px) {
    .onward-more__grid {
        display: flex;
        gap: 14px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -2px;
        padding: 0 2px 4px;
    }

    .onward-more__grid::-webkit-scrollbar {
        display: none;
    }

    .onward-card {
        flex: 0 0 43%;
        scroll-snap-align: start;
    }
}

/* ---- Persistent "Next project" control ---- */
.onward-next {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 60;
    max-width: min(340px, calc(100vw - 40px));
    /* Hidden until the reader scrolls past the first screen (onward-nav.js
       adds .is-visible). Keeps it off the hero on load. */
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.onward-next.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.onward-next__link {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #111;
    color: #fff;
    border-radius: 999px;
    padding: 12px 18px;
    text-decoration: none;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease;
}

.onward-next__link:hover,
.onward-next__link:focus {
    background: #000;
    color: #fff;
}

.onward-next__text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.onward-next__label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.7;
}

.onward-next__name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.onward-next__arrow {
    flex: 0 0 auto;
    font-size: 18px;
    line-height: 1;
}

/* On Pro project pages the studio pill (.sticky-bar, fixed bottom-centre) owns
   the hovering slot, so suppress the Next-project control there entirely to
   avoid any overlap. The mid-article row and bottom Related still carry onward
   navigation on those pages. */
.sticky-bar ~ .onward-next {
    display: none;
}

@media (max-width: 575px) {
    .onward-next {
        right: 12px;
        bottom: 14px;
        max-width: calc(100vw - 24px);
    }

    .onward-next__name {
        max-width: 150px;
    }
}
