/* Frame shared by the app pages inside the app shell (AppShell) of every platform site: page width and padding, and
   the page head with the eyebrow, title, lead and actions. Each site loads it on every page, so the page skeletons shown
   before a page loads use it as well. */

/* ========
     page
   ======== */

/* Wide enough to fill a large screen next to the sidebar; the cap only keeps lines readable on very wide screens.
   The same space on all four sides (the shell gutter: 32px, 24px on a tablet, 16px on a phone), so a page that fits
   the screen does not scroll. */
.apg-page {
    max-width: 1760px;
    margin: 0 auto;
    padding: var(--ml-content-gutter, 32px);
}

/* ---------- page that fits the screen ---------- */

/* A page that fills the screen below the top bar exactly, so the page itself does not scroll (Dashboard: only the
   website inside the preview scrolls). The head keeps its height and the block marked apg-fill takes the rest.
   - The height is a height, not only a minimum: the preview's iframe is sized in percent of it, and without a definite
     height it falls back to the browser's 150px.
   - min-height: min-content lets the page grow past a screen too short for the head and the fill's minimum, so it
     scrolls instead of cutting off its bottom (the shell clips what overflows). A browser without it keeps the height. */
.apg-page-fit {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--ml-topbar-height, 72px));
    height: calc(100dvh - var(--ml-topbar-height, 72px));
    min-height: min-content;
}

.apg-fill {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 420px;
}

/* ---------- page with a bottom dock ---------- */

/* The bar round a page's glass dock (apg-dock, e.g. the pages chosen on /pages, the unsaved settings on /seo) rests at
   the bottom of the screen whatever the length of the page: a sticky dock alone stays right under content shorter than
   the screen, halfway up. The dock is the last thing of the page (inside it or right after it in the shell's content),
   the page fills at least the screen below the top bar, and the dock's auto margin takes the room left. It is always
   20px above the screen's bottom: sticky while the page is longer than the screen, and at the page's end the page's
   20px bottom padding (dock inside) or the sticky offset itself (dock after the page) holds it there, so the dock never
   moves when the content grows or shrinks. At the page's end the content stops 20px above the dock (the bar's own
   padding), the same as the dock's 20px to the screen's bottom, on every page and in every view; a page whose dock is
   pinned (position: fixed, on phones) keeps --app-dock-room clear under its content instead (app-dock.css). Pages set
   only the bar's sides, never its top. */
.apg-dock {
    position: sticky;
    bottom: 20px;
    z-index: 12;
    display: flex;
    justify-content: center;
    margin-top: auto;
    padding-top: 20px;
    pointer-events: none;
}

.apg-dock > * {
    pointer-events: auto;
}

/* A dock drawn in a page's skeleton is only a shape and takes no pointer, as the rest of the skeleton (app-ui.css
   .app-skel-region, R36) */
.app-skel-region .apg-dock > * {
    pointer-events: none;
}

/* The dock inside the page */
.apg-page:has(> .apg-dock) {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--ml-topbar-height, 72px));
    min-height: calc(100dvh - var(--ml-topbar-height, 72px));
    padding-bottom: 20px;
}

/* The dock right after the page (outside its layer, so on a phone it can float over a bottom sheet) */
.ml-content:has(> .apg-dock) {
    display: flex;
    flex-direction: column;
}

.ml-content:has(> .apg-dock) > .apg-page {
    flex: 1 0 auto;
    width: 100%;
}

/* At the page's end the sticky dock is held 20px up into the page's bottom padding, so that padding is the content's
   gap above the dock: 20px, as with the dock inside the page. No more specific than the page's own class, so a page
   whose dock is pinned on phones can keep --app-dock-room clear instead. */
:where(.ml-content:has(> .apg-dock)) > .apg-page {
    padding-bottom: 20px;
}

/* ---------- the glow behind a page ----------
   Two soft brand glows behind a page's content (the page lists, settings pages and full-screen viewers all have the
   same pair), faded out inside the box's own edges on every side so no edge ever cuts a glow into a straight line
   (rules/UI.md). Put apg-glow on the page's root (or on a viewer's stage); its skeleton carries it too, so loading and
   loaded look the same. */
.apg-glow {
    position: relative;
    isolation: isolate;
}

.apg-glow::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(560px 360px at 82% 220px, color-mix(in srgb, var(--app-color-primary) 18%, transparent), transparent 70%),
        radial-gradient(520px 340px at 12% 640px, color-mix(in srgb, var(--app-color-peach) 14%, transparent), transparent 70%);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 120px, #000 calc(100% - 120px), transparent),
        linear-gradient(to right, transparent, #000 120px, #000 calc(100% - 120px), transparent);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to bottom, transparent, #000 120px, #000 calc(100% - 120px), transparent),
        linear-gradient(to right, transparent, #000 120px, #000 calc(100% - 120px), transparent);
    mask-composite: intersect;
}

/* ---------- head ---------- */

.apg-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.apg-head-text {
    min-width: 0;
}

.apg-title {
    margin: 10px 0 8px;
    font-size: clamp(28px, 2.6vw, 38px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--app-text-strong);
}

.apg-lead {
    max-width: 560px;
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--app-text-muted);
}

.apg-head-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    flex: none;
}

/* ========
     page
   ======== */


/* ==============
     responsive
   ============== */

/* Tablet: the actions go below the title */
@media (max-width: 991.98px) {
    .apg-head {
        flex-direction: column;
        align-items: stretch;
    }

    .apg-head-actions {
        justify-content: space-between;
    }
}

@media (max-width: 767.98px) {
    .apg-head {
        gap: 16px;
        margin-bottom: 18px;
    }

    .apg-lead {
        font-size: 14px;
    }

    .apg-head-actions > * {
        flex: 1 1 auto;
    }
}

/* ==============
     responsive
   ============== */
