/* Book page template (custom-book.hbs). Loaded after built/screen.css; no rebuild needed.
   Selectors start from #main-content so they win over Solo's content-spacing rules. */

.gh-book {
    --book-cover-width: 34%;
    --book-gap: 56px;
    padding-top: 40px;
}

#main-content .gh-book-content {
    display: block;
    max-width: 1040px;
    margin: 0 auto;
}

#main-content .gh-book-content::after {
    display: block;
    clear: both;
    content: "";
}

/* Cover, floated left */
#main-content .gh-book-content > .gh-book-cover {
    float: left;
    width: var(--book-cover-width);
    margin: 0 0 72px;
}

#main-content .gh-book-cover img {
    display: block;
    width: 100%;
    height: auto;
}

/* Title, and everything above the first divider, sit beside the cover */
#main-content .gh-book-content > :not(hr):not(hr ~ *):not(.gh-book-cover) {
    margin-left: calc(var(--book-cover-width) + var(--book-gap));
}

#main-content .gh-book-content > .gh-book-title {
    margin-top: 0;
    font-size: clamp(3.6rem, 2vw + 2.4rem, 5.6rem);
}

#main-content .gh-book-content > .gh-book-excerpt {
    max-width: none;
    margin-top: 16px;
    font-size: 2rem;
    font-weight: 700;
}

/* Buying buttons, one under the other */
#main-content .gh-book-content > .kg-button-card {
    display: block;
    width: auto;
    margin-top: 12px;
    text-align: left;
}

#main-content .gh-book-content > :not(.kg-button-card) + .kg-button-card {
    margin-top: 40px;
}

#main-content .gh-book-content > .kg-button-card .kg-btn {
    display: inline-flex;
    justify-content: center;
    width: auto;
    min-width: 240px;
}

/* The first divider ends the top block */
#main-content .gh-book-content > hr {
    clear: both;
    height: 1px;
    margin: 72px 0;
}

/* Below it: one centred column */
#main-content .gh-book-content > hr ~ * {
    max-width: 720px;
    margin-right: auto;
    margin-left: auto;
}

/* The excerpt: the text under the heading "Extrait" (or "Excerpt"), set like a book page */
#main-content .gh-book-content > :is(#extrait, #excerpt) ~ p:not(:is(#extrait, #excerpt) ~ h2 ~ *) {
    margin-top: 0.5em;
    font-family: var(--font-serif);
    font-size: 1.8rem;
    line-height: 1.8;
    text-indent: 1.6em;
}

#main-content .gh-book-content > :is(#extrait, #excerpt) + p:not(:is(#extrait, #excerpt) ~ h2 ~ *) {
    margin-top: 1.4em;
    text-indent: 0;
}

@media (max-width: 767px) {
    .gh-book {
        padding-top: 16px;
    }

    #main-content .gh-book-content > .gh-book-cover {
        float: none;
        width: 240px;
        max-width: 70%;
        margin: 0 auto 40px;
    }

    #main-content .gh-book-content > :not(hr):not(hr ~ *):not(.gh-book-cover) {
        margin-left: 0;
    }

    #main-content .gh-book-content > hr {
        margin: 48px 0;
    }
}
