/* Presentation variables: --curve-surround, --curve-fill, --curve-image. Defaults match white on soft background. */
.section--curved { position: relative; isolation: isolate; overflow: clip; background: linear-gradient(var(--curve-surround, var(--color-background)) 420px, var(--curve-fill, var(--color-surface)) 420px); }
.section--curved::before { content: ''; position: absolute; z-index: -1; inset-block-start: 0; inset-inline-start: -80%; inline-size: 260%; block-size: clamp(840px, 177vw, 3400px); background: var(--curve-image, url('../../decor/section-curve.svg')) center / 100% 100% no-repeat; pointer-events: none; }

/* Shared decorative divider. The parent supplies placement, colors and safe content padding.
 * Default bend is fully convex, including without JS and with reduced motion.
 * Both placements use the same curve geometry and scroll controller.
 */
.section--with-divider { --curve-depth: calc(clamp(840px, 177vw, 3400px) / 26); position: relative; isolation: isolate; }
.section-divider {
    --curve-padding: var(--section-padding-start, var(--section-padding-block));
    --curve-safe-depth: min(var(--curve-depth), max(0px, calc(var(--curve-padding) - var(--space-lg))));
    --curve-positive: max(0, var(--curve-bend, 1));
    --curve-negative: min(0, var(--curve-bend, 1));
    --curve-baseline: calc(var(--curve-safe-depth) * (1 + var(--curve-negative)) + (var(--curve-depth) - var(--curve-safe-depth)) * var(--curve-positive));
    position: absolute; z-index: -1; isolation: isolate; inset-inline: 0; inset-block-start: 0;
    block-size: var(--curve-depth); pointer-events: none;
    background: linear-gradient(var(--curve-surround, var(--color-background)) var(--curve-baseline), var(--curve-fill, var(--color-surface)) var(--curve-baseline));
}
.section-divider--end { --curve-padding: var(--section-padding-end, var(--section-padding-block)); inset-block-start: auto; inset-block-end: 0; }
.section-divider::before, .section-divider::after {
    content: ''; position: absolute; inset-block-start: 0; inset-inline: 0;
    block-size: var(--curve-depth); pointer-events: none;
    mask: url('../../decor/section-curve-cap.svg') center / 100% 100% no-repeat;
    transform-origin: center bottom;
}
.section-divider::before {
    background: var(--curve-fill, var(--color-surface));
    transform: translateY(calc(var(--curve-baseline) - var(--curve-depth))) scaleY(var(--curve-positive));
}
.section-divider::after {
    block-size: var(--curve-safe-depth);
    background: var(--curve-surround, var(--color-background));
    transform: translateY(calc(var(--curve-baseline) - var(--curve-safe-depth))) scaleY(var(--curve-negative));
}
@media (prefers-reduced-motion: no-preference) {
    .section-divider[data-scroll-motion-active]::before,
    .section-divider[data-scroll-motion-active]::after { will-change: transform; }
}
@media (prefers-reduced-motion: reduce) {
    .section-divider { --curve-bend: 1 !important; }
}
