/* Written by `npm run scenes:build` from packages/scenes/src/herbarium.css. Edit that file, not this copy. */
/*
 * The "Living herbarium" scene (@tideframe/scenes), first drawn for Seedlark Commons.
 * A fixed scene behind every page, in the manner of a frame from an animated film that has
 * come alive. The artwork (shapes, gradients) is drawn by herbarium/art.mjs and placed by
 * herbarium/markup.mjs; this file lays the layers out, fits them to the window and moves them.
 * Only transform, the individual transform properties and opacity are animated.
 * Keyframes are named sls-* so they cannot meet a page's own sl-* keyframes.
 *
 * This is the one stylesheet for every surface. `npm run scenes:build` copies it into the
 * Seedlark theme as assets/css/scene.css; edit it here, never there.
 *
 * Motion runs under html[data-motion="on"] only. Without it (no script, reduced motion,
 * or Pause pressed) every animation is held still: a finished picture. Reduced motion
 * wins over a stored "Play": the rules that set anything moving sit inside
 * (prefers-reduced-motion: no-preference), and the control is not shown.
 */

.sl-scene {
	--H: 100vh;
	--k: max(calc(100vw / 2400), calc(var(--H) / 1350)); /* one unit of the 2400 x 1350 backdrop */
	--bh: max(calc(var(--H) * 0.4), 16.667vw); /* height of the meadow band: 800 units */
	--fk: min(calc(var(--H) * 0.00094), 0.076vw); /* one unit in the corner frames */
	position: fixed;
	top: 0;
	left: 0;
	z-index: 0;
	width: 100%;
	height: var(--H);
	overflow: hidden;
	contain: strict;
	pointer-events: none;
	background: #f3e7cb;
}

/* The large viewport, so a collapsing phone toolbar never rescales the scene. */
@supports (height: 100lvh) {
	.sl-scene {
		--H: 100lvh;
	}
}

.sl-scene svg {
	position: absolute;
	display: block;
	overflow: visible;
}

.sl-scene i {
	position: absolute;
	display: block;
}

.sl-scene .sl-defs {
	width: 0;
	height: 0;
}

/* The primer: an empty <svg> printed before the scene, which only asks for the sprite early. The paints
   holder: the one copy of the gradients for a page that prints several cuts (plan decision E9). Neither
   takes room wherever the page puts it (a flex or grid container included). The holder is never hidden with
   display:none, which would leave every gradient reference that points into it unpainted. */
.sl-primer,
.sl-paints {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
	pointer-events: none;
}

/* ---------- the far world: sky, light, clouds, hills ---------- */

.sl-scene .sl-sky,
.sl-scene .sl-far,
.sl-scene .sl-mid,
.sl-scene .sl-meadow {
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/*
 * The backdrop is cropped to the window from its bottom centre, so a backdrop point (x, y)
 * sits at left 50% + (x - 1200) k and top 100% - (1350 - y) k. The sun is at (1440, 706).
 */
.sl-scene .sl-rays {
	top: calc(100% - 1404 * var(--k));
	left: calc(50% - 660 * var(--k));
	width: calc(1800 * var(--k));
	height: calc(900 * var(--k));
	transform-origin: 50% 84.44%;
}

.sl-scene .sl-cloud {
	top: calc(100% - (1350 - var(--cy)) * var(--k));
	left: calc(50% + (var(--cx) - 1200) * var(--k) * var(--cz, 1));
	width: calc(var(--cw) * var(--k) * var(--cs, 1));
	aspect-ratio: var(--ar);
	translate: -50% -50%;
}

/* The sun's bloom, spilling over the hills in front of it. */
.sl-glow {
	top: calc(100% - 1394 * var(--k));
	left: calc(50% - 510 * var(--k));
	width: calc(1500 * var(--k));
	height: calc(1500 * var(--k));
	border-radius: 50%;
	background: radial-gradient(closest-side, rgba(255, 248, 228, 0.86), rgba(255, 233, 184, 0.4) 26%, rgba(255, 216, 152, 0.15) 56%, rgba(255, 216, 152, 0));
}

/* ---------- the meadow ---------- */

/* A 6:1 strip, centred and bottom-anchored, cropped at the sides when the window is narrower. */
.sl-band {
	position: absolute;
	bottom: 0;
	left: 50%;
	width: calc(var(--bh) * 6);
	height: var(--bh);
	margin-left: calc(var(--bh) * -3);
}

/* Warm air between the far plants and the near ones. */
.sl-haze {
	inset: 0;
	background: linear-gradient(to top, rgba(255, 238, 204, 0) 6%, rgba(255, 238, 204, 0.3) 36%, rgba(255, 238, 204, 0.22) 52%, rgba(255, 238, 204, 0) 80%);
}

/* ---------- the near frame: leaves in the bottom corners, boughs in the top ones ---------- */

.sl-frame {
	position: absolute;
	width: calc(var(--fk) * 500);
	height: calc(var(--fk) * 800);
}

.sl-frame--bl {
	bottom: 0;
	left: 0;
}

.sl-frame--br {
	right: 0;
	bottom: 0;
}

.sl-frame--tl,
.sl-frame--tr {
	top: 0;
	width: calc(var(--fk) * 520);
	height: calc(var(--fk) * 600);
}

.sl-frame--tl {
	left: 0;
}

.sl-frame--tr {
	right: 0;
}

/* ---------- plants ---------- */

/* Placed by its foot (or, for a hanging bough, by its top) and sized from its height. */
.sl-p {
	position: absolute;
	bottom: calc(var(--y) * 1%);
	left: calc(var(--x) * 1%);
	display: block;
	height: calc(var(--hh) * 1%);
	aspect-ratio: var(--ar);
	translate: calc(var(--ox) * -1) 0;
	transform-origin: var(--ox) 100%;
}

.sl-p--hang {
	top: calc(var(--y) * 1%);
	bottom: auto;
	transform-origin: var(--ox) 0;
}

/* Mirrored, so the lit edge faces the sun. */
.sl-flip {
	scale: -1 1;
}

.sl-p > svg:first-child {
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.sl-n {
	transform-origin: var(--o);
}

/* Which plants show at which window shape (the band is cropped at the sides). */
@media (max-aspect-ratio: 173/100) {
	.sl-scene .sl-z4 {
		display: none;
	}
}

@media (max-aspect-ratio: 120/100) {
	.sl-scene .sl-z3 {
		display: none;
	}
}

@media (max-aspect-ratio: 72/100) {
	.sl-scene .sl-z2 {
		display: none;
	}
}

/* Portrait phones get their own arrangement. */
.sl-scene .sl-tall {
	display: none;
}

/* Clouds draw in towards the middle and shrink, so a narrow sky still has them. */
@media (max-aspect-ratio: 3/4) {
	.sl-scene {
		--cz: 0.34;
		--cs: 0.5;
	}
}

@media (max-aspect-ratio: 3/5) {
	.sl-scene .sl-tall {
		display: block;
	}

	.sl-scene .sl-wide {
		display: none;
	}
}

/*
 * The hero bloom stands right of the middle on wide windows, and never further out than 85% of
 * the way across (a 4:3 window crops the band hard). On upright windows it is placed from the
 * window, not the band, so it keeps to the right-hand third whatever the shape.
 */
.sl-scene .sl-bloom--wide {
	left: min(calc(var(--x) * 1%), calc(50% + 35vw));
}

.sl-scene .sl-bloom--narrow {
	left: calc(50% + 23vw);
	display: none;
}

@media (max-aspect-ratio: 13/10) {
	.sl-scene .sl-bloom--narrow {
		display: block;
	}

	.sl-scene .sl-bloom--wide {
		display: none;
	}
}

/* ---------- light in the air ---------- */

.sl-motes,
.sl-flies,
.sl-events {
	position: absolute;
	inset: 0;
}

.sl-mote,
.sl-fly {
	--u: 0.16vmin;
	top: calc(var(--y) * 1%);
	left: calc(var(--x) * 1%);
	width: calc(var(--s) * var(--u));
	height: calc(var(--s) * var(--u));
	border-radius: 50%;
}

.sl-fly {
	--u: 0.22vmin;
}

.sl-mote {
	background: radial-gradient(closest-side, rgba(255, 252, 238, 0.96), rgba(255, 236, 178, 0.5) 42%, rgba(255, 228, 160, 0));
}

.sl-fly {
	background: radial-gradient(closest-side, rgba(250, 255, 214, 1), rgba(226, 240, 132, 0.6) 36%, rgba(214, 232, 120, 0));
}

/* Evening comes on at the foot of a long page (the controller sets is-deep), and the fireflies with it. */
.sl-dusk {
	inset: 0;
	background: linear-gradient(to top, rgba(20, 40, 29, 0.64), rgba(31, 61, 43, 0.42) 26%, rgba(150, 78, 116, 0.18) 50%, rgba(214, 110, 110, 0.1) 70%, rgba(214, 110, 110, 0) 92%);
}

.sl-dusk,
.sl-flies {
	visibility: hidden; /* nothing to draw, and no layer to keep, until evening */
	opacity: 0;
	transition: opacity 1.8s ease, visibility 0s 1.8s;
}

.sl-motes {
	transition: opacity 1.8s ease;
}

/* Evening belongs to the moving scene: the resting picture, and reduced motion, stay in daylight. */
@media (prefers-reduced-motion: no-preference) {
	html[data-motion="on"] .sl-scene.is-deep .sl-dusk,
	html[data-motion="on"] .sl-scene.is-deep .sl-flies {
		visibility: visible;
		opacity: 1;
		transition-delay: 0s;
	}

	/* The pollen settles as the fireflies come out. */
	html[data-motion="on"] .sl-scene.is-deep .sl-motes {
		opacity: 0;
	}

	html[data-motion="on"] .sl-scene.is-deep .sl-motes .sl-mote.sl-a {
		animation-play-state: paused;
	}
}

/* ---------- passers-by: a falling petal, a butterfly (added by the controller) ---------- */

.sl-e {
	position: absolute;
	top: calc(var(--y, 0) * 1%);
	left: calc(var(--x, 0) * 1%);
	display: block;
	width: calc(var(--s, 3) * 1vmin);
	aspect-ratio: var(--ar);
}

.sl-e__in {
	position: absolute;
	inset: 0;
	display: block;
	rotate: var(--r, 0deg);
}

.sl-e__in > svg:first-child {
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.sl-e__part {
	transform-origin: var(--o);
}

/* ---------- motion ---------- */

.sl-scene .sl-a {
	animation-duration: calc(var(--t, 9) * 1s);
	animation-timing-function: ease-in-out;
	animation-delay: calc(var(--d, 0) * 1s + var(--sl-t0, 0s));
	animation-iteration-count: infinite;
	animation-play-state: paused;
}

/* Never under reduced motion, whatever data-motion says. */
@media (prefers-reduced-motion: no-preference) {
	html[data-motion="on"] .sl-scene:not(.is-offscreen) .sl-a,
	html[data-motion="on"] .sl-scene.is-deep:not(.is-offscreen) .sl-fly {
		animation-play-state: running;
	}
}

/* Wind: a gust, a settle, a second smaller push, then a slow return. One loop, never mirrored. */
.sl-scene .sl-p {
	animation-name: sls-sway;
}

/* Far plants are small: they sway as one piece. */
.sl-scene .sl-far-plant .sl-n {
	animation-name: none;
}

/* Heads and fronds follow the stem a beat later and swing further: follow-through. */
.sl-scene .sl-n {
	animation-name: sls-nod;
	animation-delay: calc(var(--d, 0) * 1s + var(--sl-t0, 0s) + var(--t, 9) * var(--lag, 0.08) * 1s);
}

.sl-scene .sl-n:nth-child(3) {
	--lag: 0.12;
}

.sl-scene .sl-n:nth-child(4) {
	--lag: 0.05;
}

.sl-scene .sl-n:nth-child(5) {
	--lag: 0.15;
}

.sl-scene .sl-far {
	--t: 71;
	--px: 22;
	animation-name: sls-drift;
	animation-direction: alternate;
}

.sl-scene .sl-mid {
	--t: 53;
	--px: -34;
	animation-name: sls-drift;
	animation-direction: alternate;
}

.sl-scene .sl-cloud {
	--px: 90;
	animation-name: sls-drift;
	animation-direction: alternate;
}

.sl-scene .sl-rays {
	animation-name: sls-rays;
	animation-direction: alternate;
}

.sl-scene .sl-rays--1 {
	--t: 17;
	--d: -3;
}

.sl-scene .sl-rays--2 {
	--t: 23;
	--d: -11;
}

.sl-scene .sl-rays--3 {
	--t: 29;
	--d: -19;
}

.sl-scene .sl-glow {
	--t: 13;
	animation-name: sls-breathe;
	animation-direction: alternate;
}

.sl-scene .sl-mote {
	animation-name: sls-float;
}

.sl-scene .sl-fly {
	animation: sls-wander calc(var(--t, 9) * 1s) ease-in-out calc(var(--d, 0) * 1s) infinite paused;
}

/* One pass each; the controller removes them when they have gone. */
.sl-scene .sl-e {
	animation-timing-function: linear;
	animation-delay: 0s;
	animation-iteration-count: 1;
	animation-fill-mode: both;
}

.sl-scene .sl-e--petal {
	animation-name: sls-fall;
}

.sl-scene .sl-e--butterfly {
	animation-name: sls-cross;
}

.sl-scene .sl-e__in,
.sl-scene .sl-e__part {
	animation-delay: 0s;
	animation-direction: alternate;
}

.sl-scene .sl-e--petal .sl-e__in {
	animation-name: sls-tumble;
	animation-duration: calc(var(--t, 9) * 0.19s);
}

.sl-scene .sl-e--butterfly .sl-e__in {
	animation-name: sls-flutter;
	animation-duration: 1.7s;
}

.sl-scene .sl-e--butterfly .sl-e__part {
	animation-name: sls-flap;
	animation-duration: 0.23s;
}

@keyframes sls-sway {
	0%,
	100% {
		transform: rotate(calc(var(--a, 2deg) * -0.55));
		animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
	}

	24% {
		transform: rotate(var(--a, 2deg));
	}

	37% {
		transform: rotate(calc(var(--a, 2deg) * 0.6));
	}

	50% {
		transform: rotate(calc(var(--a, 2deg) * 0.84));
		animation-timing-function: cubic-bezier(0.45, 0, 0.5, 1);
	}
}

@keyframes sls-nod {
	0%,
	100% {
		transform: rotate(calc(var(--a, 2deg) * -1.1));
		animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
	}

	24% {
		transform: rotate(calc(var(--a, 2deg) * 1.7));
	}

	36% {
		transform: rotate(calc(var(--a, 2deg) * 0.5));
	}

	49% {
		transform: rotate(calc(var(--a, 2deg) * 1.2));
		animation-timing-function: cubic-bezier(0.45, 0, 0.5, 1);
	}
}

@keyframes sls-drift {
	from {
		transform: translateX(calc(var(--k) * var(--px, 20) * -1));
	}

	to {
		transform: translateX(calc(var(--k) * var(--px, 20)));
	}
}

@keyframes sls-rays {
	from {
		opacity: 0.3;
		transform: rotate(-1.6deg);
	}

	to {
		opacity: 1;
		transform: rotate(1.6deg);
	}
}

@keyframes sls-breathe {
	from {
		opacity: 0.72;
		transform: scale(0.96);
	}

	to {
		opacity: 1;
		transform: scale(1.03);
	}
}

/* --dx and --dy are in mote widths. */
@keyframes sls-float {
	0% {
		opacity: 0;
		transform: translate(0, 0) scale(0.5);
	}

	14% {
		opacity: 1;
	}

	30% {
		transform: translate(calc(var(--dx) * 22%), calc(var(--dy) * 34%)) scale(1);
	}

	55% {
		transform: translate(calc(var(--dx) * 64%), calc(var(--dy) * 50%)) scale(0.82);
	}

	80% {
		opacity: 0.9;
		transform: translate(calc(var(--dx) * 72%), calc(var(--dy) * 84%)) scale(1.1);
	}

	100% {
		opacity: 0;
		transform: translate(calc(var(--dx) * 100%), calc(var(--dy) * 100%)) scale(0.6);
	}
}

@keyframes sls-wander {
	0%,
	100% {
		opacity: 0;
		transform: translate(0, 0);
	}

	12% {
		opacity: 1;
	}

	26% {
		opacity: 0.25;
		transform: translate(calc(var(--dx) * 40%), calc(var(--dy) * 55%));
	}

	40% {
		opacity: 1;
	}

	58% {
		opacity: 0.2;
		transform: translate(calc(var(--dx) * 100%), calc(var(--dy) * 20%));
	}

	74% {
		opacity: 0.95;
		transform: translate(calc(var(--dx) * 55%), calc(var(--dy) * -60%));
	}

	88% {
		opacity: 0.3;
	}
}

@keyframes sls-fall {
	from {
		opacity: 0;
		transform: translate(0, 0);
	}

	6%,
	90% {
		opacity: 1;
	}

	to {
		opacity: 0;
		transform: translate(calc(var(--dx, 0) * 1vw), calc(var(--H) * var(--dy, 1.1)));
	}
}

@keyframes sls-tumble {
	from {
		transform: translateX(-140%) rotate(-50deg) scaleY(1);
	}

	50% {
		transform: translateX(0) rotate(40deg) scaleY(0.35);
	}

	to {
		transform: translateX(140%) rotate(150deg) scaleY(1);
	}
}

@keyframes sls-cross {
	from {
		opacity: 0;
		transform: translate(0, 0);
	}

	4%,
	94% {
		opacity: 1;
	}

	to {
		opacity: 0;
		transform: translate(calc(var(--dx, 0) * 1vw), calc(var(--H) * var(--dy, 0)));
	}
}

@keyframes sls-flutter {
	from {
		transform: translateY(-90%) rotate(-9deg);
	}

	to {
		transform: translateY(90%) rotate(9deg);
	}
}

@keyframes sls-flap {
	from {
		transform: scaleX(1);
	}

	to {
		transform: scaleX(0.16);
	}
}

/* ---------- scroll: the hero bloom opens, and the near world gives way as the eye travels down ---------- */

@keyframes sls-open {
	from {
		rotate: var(--r0, -30deg);
		scale: var(--s0, 0.5);
	}

	to {
		rotate: 0deg;
		scale: 1;
	}
}

@keyframes sls-sink {
	to {
		translate: 0 var(--sink, 0);
	}
}

/*
 * The start of each ring: already half open, drawn in and turned a little, so the flower reads as a
 * flower before any scrolling and is fully open well before the next section covers it.
 * Without scroll timelines the bloom is simply open.
 */
.sl-bloom .sl-n:nth-child(2) {
	--s0: 0.68;
	--r0: -26deg;
}

.sl-bloom .sl-n:nth-child(3) {
	--s0: 0.75;
	--r0: 19deg;
}

.sl-bloom .sl-n:nth-child(4) {
	--s0: 0.86;
	--r0: -12deg;
}

.sl-bloom .sl-n:nth-child(5) {
	--s0: 0.8;
	--r0: 0deg;
}

.sl-band {
	--sink: calc(var(--H) * 0.035);
}

.sl-frame--bl,
.sl-frame--br {
	--sink: calc(var(--H) * 0.08);
}

.sl-frame--tl,
.sl-frame--tr {
	--sink: calc(var(--H) * -0.07);
}

/* Scroll-linked movement is movement too: none of it under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
	@supports (animation-timeline: scroll()) {
		/* The petals keep nodding (transform) while the scroll opens them (scale and rotate). */
		html[data-motion="on"] .sl-scene .sl-bloom .sl-n {
			animation-name: sls-nod, sls-open;
			animation-duration: calc(var(--t, 9) * 1s), 1s;
			animation-timing-function: ease-in-out, linear;
			animation-delay: calc(var(--d, 0) * 1s + var(--sl-t0, 0s) + var(--t, 9) * var(--lag, 0.08) * 1s), 0s;
			animation-iteration-count: infinite, 1;
			animation-fill-mode: none, both;
			animation-timeline: auto, scroll(root);
			animation-range: normal, 0px 40vh; /* open by two fifths of a window, while the bloom is still in view */
		}

		html[data-motion="on"] .sl-band,
		html[data-motion="on"] .sl-frame {
			animation: sls-sink 1s linear both; /* the duration only makes the keyframes span the scroll range */
			animation-timeline: scroll(root);
			animation-range: 0px 160vh;
		}

		html[data-motion="on"] .sl-scene.is-offscreen .sl-band,
		html[data-motion="on"] .sl-scene.is-offscreen .sl-frame {
			animation-play-state: paused;
		}
	}
}

/* ---------- inner pages: the same world, quieter, with the middle left clear for reading ---------- */

.sl-scene[data-variant="page"]::after {
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse 74% 70% at 50% 46%, rgba(244, 238, 223, 0.5), rgba(244, 238, 223, 0.3) 55%, rgba(244, 238, 223, 0));
	content: "";
}

/* ---------- narrow and upright windows: fewer and smaller moving layers ---------- */

/*
 * On a portrait window most of the backdrop lies outside the frame, so its wide layers are left
 * still (they are then painted once with the sky and cost nothing): the hills do not drift, one
 * fan of light shimmers instead of three (the topmost, so the two under it join the sky's
 * layer), the sun's bloom holds, and the meadow does not sink.
 */
@media (max-aspect-ratio: 1/1) {
	.sl-scene .sl-far,
	.sl-scene .sl-mid,
	.sl-scene .sl-glow,
	.sl-scene .sl-rays--1,
	.sl-scene .sl-rays--2,
	html[data-motion="on"] .sl-band {
		animation-name: none;
	}
}

/*
 * On a phone the plants in the meadow band are small, so each sways as one piece: its heads and
 * fronds do not nod on their own. That is fewer pieces for each frame to move and for a press of
 * Pause to stop. The large plants in the corners keep their follow-through, and the hero bloom
 * keeps its own rule above.
 */
@media (max-width: 48em) {
	.sl-scene .sl-band .sl-n {
		animation-name: none;
	}
}

/* ---------- the Pause motion / Play motion control ---------- */

.sl-motion-toggle {
	position: fixed;
	right: max(8px, env(safe-area-inset-right));
	bottom: max(8px, env(safe-area-inset-bottom));
	z-index: 50;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	color: var(--sl-paper, #f4eedf);
	font: inherit;
	background: linear-gradient(155deg, #2c543b, var(--sl-ink, #14281d) 78%);
	border: 0;
	border-radius: 999px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 0 0 1px rgba(244, 238, 223, 0.2), 0 0 0 5px rgba(244, 238, 223, 0.26), 0 8px 22px rgba(20, 40, 29, 0.3), 0 0 28px rgba(233, 162, 59, 0.45);
	cursor: pointer;
	transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1), box-shadow 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.sl-motion-toggle[hidden] {
	display: none;
}

/* A site's own styles may recolour every button on hover and focus (the Seedlark parent theme does); this one keeps its own colours. */
.sl-motion-toggle:hover,
.sl-motion-toggle:focus {
	color: var(--sl-paper, #f4eedf);
	background: linear-gradient(155deg, #2c543b, var(--sl-ink, #14281d) 78%);
}

.sl-motion-toggle:hover {
	transform: translateY(-2px);
}

.sl-motion-toggle:active {
	transform: scale(0.94);
}

/* Two rings, paper inside ink, so the focus shows on the light sky and the dark leaves alike. */
.sl-motion-toggle:focus-visible {
	outline: 3px solid var(--sl-ink, #14281d);
	outline-offset: 4px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 0 4px var(--sl-paper, #f4eedf), 0 8px 22px rgba(20, 40, 29, 0.3);
}

.sl-motion-toggle__icon {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.sl-mt-play {
	fill: currentColor;
	stroke-width: 1.8;
}

/* The icon follows what the control does: two bars while the scene moves, a triangle while it is held
   (data-state="paused", set by the controller with the label). */
.sl-motion-toggle .sl-mt-play,
.sl-motion-toggle[data-state="paused"] .sl-mt-pause {
	display: none;
}

.sl-motion-toggle[data-state="paused"] .sl-mt-play {
	display: inline;
}

/* The name of the control slides out beside it on hover and keyboard focus. */
.sl-motion-toggle__label {
	position: absolute;
	top: 50%;
	right: calc(100% + 10px);
	padding: 9px 14px;
	color: var(--sl-paper, #f4eedf);
	font-weight: 600;
	font-size: 13px;
	line-height: 1.2;
	white-space: nowrap;
	background: var(--sl-ink, #14281d);
	border-radius: 999px;
	box-shadow: 0 6px 18px rgba(20, 40, 29, 0.26);
	opacity: 0;
	pointer-events: none;
	translate: 8px -50%;
	transition: opacity 0.16s ease, translate 0.2s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.sl-motion-toggle:hover .sl-motion-toggle__label,
.sl-motion-toggle:focus-visible .sl-motion-toggle__label {
	opacity: 1;
	translate: 0 -50%;
}

/*
 * On a phone the control is a small pale disc with an ink icon and no glow, so it does not read
 * as a second call to action over the page. The button keeps its 48px box, which is what a finger
 * presses; the 40px disc is drawn inside it, behind the icon.
 */
@media (max-width: 48em) {
	.sl-motion-toggle,
	.sl-motion-toggle:hover,
	.sl-motion-toggle:focus {
		color: var(--sl-ink, #14281d);
		background: none;
		box-shadow: none;
	}

	.sl-motion-toggle::before {
		position: absolute;
		inset: 4px;
		z-index: -1;
		background: rgb(255 254 250 / 0.86);
		border-radius: 999px;
		box-shadow: 0 0 0 1px rgb(31 61 43 / 0.14), 0 6px 16px rgb(20 40 29 / 0.18);
		content: "";
	}

	/* The same two rings as on a wide window: paper round the disc, ink round the paper. */
	.sl-motion-toggle:focus-visible {
		outline-offset: 0;
		box-shadow: none;
	}

	.sl-motion-toggle:focus-visible::before {
		box-shadow: 0 0 0 4px var(--sl-paper, #f4eedf), 0 6px 16px rgb(20 40 29 / 0.18);
	}

	.sl-motion-toggle__icon {
		width: 20px;
		height: 20px;
		stroke-width: 2.4;
	}
}

/* Under reduced motion the scene is always still, so there is nothing for the control to do.
   If the setting is switched on in the evening, the dusk goes at once instead of fading. */
@media (prefers-reduced-motion: reduce) {
	.sl-motion-toggle {
		display: none;
	}

	.sl-dusk,
	.sl-flies,
	.sl-motes {
		transition: none;
	}
}

@media print, (forced-colors: active) {
	.sl-scene,
	.sl-motion-toggle {
		display: none;
	}
}
