@layer components {
    .pager {
        --pager-dot: light-dark(
            oklch(from var(--system-background) 70% c h),
            oklch(from var(--system-background) 40% c h)
        );
        --pager-dot-active: light-dark(
            oklch(from var(--system-background) 30% c h),
            oklch(from var(--system-background) 80% c h)
        );

        position: relative;
        display: flex;
        flex: 1;
        flex-direction: column;
        min-block-size: 0;
        min-inline-size: 0;

        & > .pager__pages {
            flex: 1;
            min-block-size: 0;
            min-inline-size: 0;
            display: flex;
            scroll-snap-type: x mandatory;
        }

        &.pager--axis-vertical > .pager__pages {
            flex-direction: column;
            scroll-snap-type: y mandatory;
        }

        & .pager__page {
            display: grid;
            flex-shrink: 0;
            inline-size: 100%;
            block-size: 100%;
            scroll-snap-align: start;
            scroll-snap-stop: always;

            /* The page hosts a single fill child (e.g. a scrolling stack); let it
               shrink to the page so its own overflow scrolls instead of growing. */
            & > * {
                min-block-size: 0;
            }

            & > :is(img, video) {
                block-size: 100%;
                inline-size: 100%;
                object-fit: contain;
            }
        }

        &.pager--axis-vertical .pager__page video[data-src] {
            -webkit-touch-callout: none;
            display: block;
            block-size: 100%;
            inline-size: 100%;
            object-fit: contain;
        }

        &.pager--axis-vertical.pager--video-fill .pager__page video[data-src] {
            object-fit: cover;
        }

        /* The dots overlay the bottom of the pages so page content scrolls under
           them. */
        & > .pager__indicator {
            position: absolute;
            z-index: 2;
            inset-block-end: 0;
            inset-inline: 0;
            display: flex;
            gap: 0.5rem;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }

        & .pager__dot {
            inline-size: 0.5rem;
            block-size: 0.5rem;
            border-radius: 50%;
            background: var(--pager-dot);
            transition: background 0.2s ease;
        }

        & .pager__dot--active {
            background: var(--pager-dot-active);
        }
    }
}
