@property --about-fan {
    syntax: "<number>";
    inherits: false;
    initial-value: 1;
}

@layer components {
    /* about text with polaroids: fanned out beside it on wide screens, stacked above it below 1500px */
    @scope (.about) {
        :scope {
            /* the desktop cluster's centre, which the stacked layout pivots around */
            --about-stack-x: 473px;
            --about-stack-y: 67px;
            --about-stack-inset: 150px; /* from the section edge the stack sits at */
            --about-stack-scale: 1;
            --about-spread: 1;
            /* where that centre lands: beside the text on wide screens */
            --about-center-x: var(--about-stack-x);
            --about-center-y: var(--about-stack-y);
            position: relative;
            width: min(360px, 100% - 2 * var(--edge));
            margin-block-start: 102px;
            margin-inline: auto;
            text-align: center;
            display: grid;
            gap: 14px;
            font-size: var(--text-sm);

            @container page (width < 1500px) {
                --about-center-x: 0px;
                --about-center-y: calc(var(--about-stack-inset) * var(--about-stack-scale));
                padding-block-start: 340px;
            }

            @media (width < 768px) {
                --about-spread: 0.52;
                --about-stack-scale: 0.85;
                padding-block-start: 280px;
            }
        }

        .about-title {
            margin-block-end: 13px;
        }

        /* markup sets --about-x, --about-y and --about-r per photo; --about-fan goes from a pile (0) to the layout (1) */
        .about-polaroid {
            position: absolute;
            inset-inline-start: calc(50% + var(--about-center-x) + (var(--about-x) - var(--about-stack-x)) * var(--about-spread) * var(--about-fan));
            inset-block-start: calc(var(--about-center-y) + (var(--about-y) - var(--about-stack-y)) * var(--about-spread) * var(--about-fan));
            width: 201px;
            translate: -50% -50%;
            rotate: calc(var(--about-r) * var(--about-fan));
            scale: var(--about-stack-scale);
            z-index: 1;
            transition: --about-fan calc(var(--t-slow) * 2) cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* set by the page script until the section is half in view, so without javascript the photos are simply laid out */
        :scope.is-piled .about-polaroid {
            --about-fan: 0;
        }

        .about-polaroid--portrait {
            width: 176px;
            height: 242px;
            object-fit: cover;
            border: 6px solid #f6f6f6;
            box-shadow: 0 8px 40px rgb(0 0 0 / 0.25);
        }
    }
}
