/* Phone reading. Loaded last: base, then book, then device
   (see additional-css in book.toml). */

@media (max-width: 600px) {
    /* Nothing widens the page; wide things scroll inside their own box. */
    .content main img {
        max-width: 100%;
        height: auto;
    }

    .content main table {
        display: block;
        overflow-x: auto;
    }

    /* A big target for the next chapter, easy to hit with a thumb. */
    .nav-wrapper {
        display: block;
    }

    .nav-wrapper .mobile-nav-chapters {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
        width: 100%;
        box-sizing: border-box;
        margin: 1rem 0;
        padding: 1.4rem 0;
        text-align: center;
        font-size: 1.6rem;
        font-weight: 600;
    }

    /* The theme's default is the muted icon gray, about 2.6:1 on the Rust
       theme's dark button. The sidebar foreground is the colour each theme
       pairs with that background, so text and chevron both read clearly. */
    .content .nav-wrapper a.mobile-nav-chapters:link,
    .content .nav-wrapper a.mobile-nav-chapters:visited {
        color: var(--sidebar-fg);
    }

    /* Say where each button goes, not just which way it points. The link
       already has an aria-label, which wins over this generated text. */
    .nav-wrapper .mobile-nav-chapters.previous::after {
        content: "Previous chapter";
    }

    .nav-wrapper .mobile-nav-chapters.next::after {
        content: "Next chapter";
    }

    /* Chevron on the outside edge of the words: before for previous,
       after for next. */
    .nav-wrapper .mobile-nav-chapters.next {
        flex-direction: row-reverse;
    }
}
