/* webbook's about panel */
#webbook-info:popover-open {
    margin: 0;
    inset: 0 0 0 auto;
    /* Wide enough for its metadata and accessibility text; long values wrap rather than being cut
       off (user, 2026-11-16: "some text gets cut off") */
    width: min(30rem, 92vw);
    height: 100dvh;
    padding: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 5px 0 0 5px;

    #webbook-cover {
        width: 100%;
        height: 100%;
        min-height: 0;
        object-fit: contain;
        display: block;
        border-bottom: var(--webbook-panel-border);
    }
    .webbook-info-body {
        overflow-wrap: anywhere;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        min-height: 0;
        max-height: 100dvh;
        overflow-y: auto;
    }
    #webbook-cover[hidden] + .webbook-info-body {
        grid-row: 1 / -1;
    }
    h2 {
        margin: 0;
    }
    dl {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: .25rem 1.5rem;
        margin: 0;
    }
    dt {
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--webbook-muted-fg);
        padding-top: .15em;
    }
    dd {
        margin: 0;
        font-size: var(--size-step-0);
    }
    .webbook-cover-page-link {
        width: fit-content;
        border: 1px solid color-mix(in srgb, var(--theme-fg) 30%, transparent);
        border-radius: 4px;
        padding: .4rem .7rem;
        color: var(--theme-fg);
        background: var(--theme-bg);
        font-size: var(--size-step-0);
        font-weight: 600;
        text-decoration: none;
    }
    dt:not(:first-child) {
        margin-top: .75rem;
    }
    #webbook-progress {
        h3 {
            font-size: 0.75rem;
            font-weight: 600;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--webbook-muted-fg);
            margin: 0 0 .75rem;
        }
        p {
            margin: 0;
            font-size: var(--size-step-0);
        }
        progress {
            appearance: none;
            width: 100%;
            height: .75rem;
            margin: .75rem 0 .35rem;
            overflow: hidden;
            border: 1px solid var(--theme-fg);
            border-radius: 999px;
            background: var(--theme-bg);
            accent-color: var(--theme-fg);
        }
        progress::-webkit-progress-bar {
            background: var(--theme-bg);
        }
        progress::-webkit-progress-value {
            background: var(--theme-fg);
        }
        progress::-moz-progress-bar {
            background: var(--theme-fg);
        }
        #webbook-progress-count {
            color: var(--theme-fg);
            font-size: var(--size-step-0);
            font-weight: 700;
            text-align: end;
        }
    }
}
/* small screens */
@media(max-width: 45rem) {
    #webbook-info:popover-open {
        width: 100vw;
        border-radius: 0;
    }
}
/* The publication's accessibility information can be long: with it, the panel scrolls as a whole
   and the cover takes less of the height */
#webbook-info:popover-open:has(#webbook-accessibility) {
    display: block;
    overflow-y: auto;

    #webbook-cover {
        height: auto;
        max-height: 45vh;
    }
    /* One scrolling area, the panel, which has focusable controls; a body that also scrolled would
       be a scroll region keyboard users can't reach */
    .webbook-info-body {
        max-height: none;
        overflow: visible;
    }
}
#webbook-accessibility {
    border-top: var(--webbook-panel-border);
    padding-top: 1.25rem;

    h3 {
        margin: 0;
        font-size: 1.15rem;
    }
    .webbook-accessibility-source {
        margin: .25rem 0 0;
        font-size: .9rem;
    }
    h4 {
        margin: 1.1rem 0 .3rem;
        font-size: 1rem;
    }
    ul {
        margin: 0;
        padding-inline-start: 1.1rem;
    }
    li {
        margin-block: .25rem;
        line-height: 1.4;
        font-size: var(--size-step-0);
    }
}
