/* aard.slider.css: layered photo slider. Linked only by pages that set extra_css to this file. */
.page-reading .e-content > .layer-slider { max-width: none; }
.layer-slider { position: relative; margin: 1.5rem 0 2.5rem; }
.layer-slider__track { display: flex; gap: 1.25rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 0.5rem; }
.layer-slider__track::-webkit-scrollbar { display: none; }
.layer-slider__slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; view-timeline: --slide inline; }

/* The frame. overflow: clip (not hidden) keeps the animation tied to the slider, not to this box. */
.layer-slider__stage { position: relative; box-sizing: border-box; aspect-ratio: var(--ratio); overflow: clip; border: 3px solid var(--aard-primary); border-radius: 1.25rem; background: var(--aard-muted-border-color); box-shadow: 0 2px 4px rgb(0 0 0 / 0.15), 0 24px 44px -24px rgb(0 0 0 / 0.55); }
@media (max-width: 40rem) { .layer-slider__stage { aspect-ratio: 4 / 3; border-radius: 0.9rem; } }

/* Both layers are 40% wider than the stage, centred, and share object-fit, so at rest they line up exactly.
   The extra width is the room they travel in. The doubled class beats aardCSS's `.e-content img` rules. */
.layer-slider .layer-slider__bg, .layer-slider .layer-slider__fg {
	position: absolute; top: 0; left: -20%; width: 140%; height: 100%; max-width: none;
	object-fit: cover; object-position: center; border-radius: 0; transform-origin: 50% 100%; will-change: transform, filter;
}
.layer-slider__slide figcaption { margin-top: 0.8rem; padding-top: 0.5rem; border-top: 1px solid var(--aard-muted-border-color); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--aard-muted-color); text-align: left; }
.layer-slider__nav { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.25rem; }
.layer-slider__nav[hidden] { display: none; }
.layer-slider__nav button { min-width: var(--aard-tap-min, 44px); min-height: var(--aard-tap-min, 44px); margin: 0; padding: 0; font-size: 1.2rem; line-height: 1; }
.layer-slider__nav button:disabled { opacity: 0.35; }

/* The drift. At the centre of the view both layers are at rest and sharp. As a slide comes in or goes out:
   the scene slides one way, leaning (the top moves further than the bottom) and softening like motion blur,
   while the person slides the other way, faster, so the two clearly part. */
@media (prefers-reduced-motion: no-preference) {
	@supports (animation-timeline: view()) {
		.layer-slider .layer-slider__bg { animation: layer-bg linear both; animation-timeline: --slide; animation-range: cover; }
		.layer-slider .layer-slider__fg { animation: layer-fg linear both; animation-timeline: --slide; animation-range: cover; }
		@keyframes layer-bg {
			0%   { transform: translateX(-13%) skewX(7deg);  filter: blur(7px); }
			50%  { transform: none; filter: blur(0); }
			100% { transform: translateX(13%) skewX(-7deg); filter: blur(7px); }
		}
		@keyframes layer-fg {
			0%   { transform: translateX(18%); }
			50%  { transform: none; }
			100% { transform: translateX(-18%); }
		}
	}
}
