/* =============================================================================
   Media Slideshow — images/MP4 cycling at a fixed ratio, with a ring in the
   top-right that counts the slide down AND acts as the pause button.

   No comp exists for this block (client, 2026-07-31) — the ring geometry
   below (32px, 2.5px stroke, 20px inset, clockwise from 12 o'clock, white on
   a 35% track) is ours. Flag to Dapper along with the <756px behaviour.
   ============================================================================= */

.slideshow--figure {
	position: relative;
	margin: 0;
}

/* --- stage: the cropping frame every slide is stacked inside --- */
.slideshow--stage {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 12px;
	/* pan-y keeps vertical page scrolling native while horizontal drags are
	   ours to interpret as swipes */
	touch-action: pan-y;
}

.slideshow--ratio-16-9 .slideshow--stage { aspect-ratio: 16 / 9; }
.slideshow--ratio-9-16 .slideshow--stage { aspect-ratio: 9 / 16; }
.slideshow--ratio-1-1  .slideshow--stage { aspect-ratio: 1 / 1; }
.slideshow--ratio-2-3  .slideshow--stage { aspect-ratio: 2 / 3; }
.slideshow--ratio-2-1  .slideshow--stage { aspect-ratio: 2 / 1; }
.slideshow--ratio-4-3  .slideshow--stage { aspect-ratio: 4 / 3; }
.slideshow--ratio-3-4  .slideshow--stage { aspect-ratio: 3 / 4; }

/* --- slides ---------------------------------------------------------------
   Only the INCOMING slide animates. The outgoing one is held at full opacity
   underneath (.is-leaving) until the fade finishes, because cross-fading both
   at once leaves them at 0.5 alpha each mid-transition — a composite of 0.75,
   i.e. a visible 25% dip to the page behind. Fading one layer in over an
   opaque one has no dip at all. */
.slideshow--slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	z-index: 0;
	transition: opacity .4s ease;
}
.slideshow--slide.is-leaving {
	opacity: 1;
	z-index: 1;
}
.slideshow--slide.is-active {
	opacity: 1;
	z-index: 2;
}

.slideshow--slide img,
.slideshow--slide video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* =============================================================================
   The ring — progress indicator and pause button in one
   ============================================================================= */

.slideshow--ring {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 3;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	line-height: 0;
	cursor: pointer;
	/* White on a bright photograph is ~1:1. The shadow is invisible over dark
	   and mid-tone imagery and does the contrast work over light imagery,
	   keeping the control at 3:1 for WCAG 1.4.11 without adding a dark disc. */
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
}
.slideshow--ring svg { display: block; }

.slideshow--ring-track,
.slideshow--ring-progress {
	fill: none;
	stroke-width: 2.5;
	stroke-linecap: round;
}
.slideshow--ring-track { stroke: rgba(255, 255, 255, .35); }

.slideshow--ring-progress {
	stroke: #fff;
	stroke-dasharray: 100;
	/* Resting arc for the non-cycling cases (single slide, editor canvas) so
	   the ring still reads as a ring rather than an empty circle. */
	stroke-dashoffset: 70;
}

/* The animation IS the timer — media-slideshow.js advances the slide on this
   element's `animationiteration`. Deliberately NOT disabled under
   prefers-reduced-motion: the client chose to keep cycling for those users
   (2026-07-31), so the ring has to keep telling them when a cut is coming. */
.slideshow--cycling .slideshow--ring-progress {
	animation: slideshow-ring var(--slideshow-duration, 4s) linear infinite;
}

@keyframes slideshow-ring {
	from { stroke-dashoffset: 100; }
	to   { stroke-dashoffset: 0; }
}

/* --- glyphs: ⏸ hints "click to pause", ▶ means "latched, click to resume" --- */
.slideshow--ring-pause,
.slideshow--ring-play {
	fill: #fff;
	opacity: 0;
	transition: opacity .2s;
}
/* Scoped to the ring itself, matching the JS listeners — hovering the artwork
   must neither pause nor hint (client, 2026-08-01).
   Gated to real pointers so it mirrors the JS, which ignores a non-mouse
   pointerenter (a tap fires enter with no matching leave and would latch the
   carousel off). Touch browsers can apply a sticky :hover after a tap — without
   this gate that would show a pause glyph on a carousel that is still running. */
@media (hover: hover) and (pointer: fine) {
	.slideshow--ring:hover .slideshow--ring-pause { opacity: 1; }
}
.slideshow--ring:focus-visible .slideshow--ring-pause { opacity: 1; }

/* Equal specificity to the hover rules above, so source order decides —
   a latched pause must win over the hover hint. Keep these last. */
.slideshow--figure.is-user-paused .slideshow--ring-pause { opacity: 0; }
.slideshow--figure.is-user-paused .slideshow--ring-play { opacity: 1; }

/* --- focus -----------------------------------------------------------------
   reset.min.css ships `button:focus{outline:-webkit-focus-ring-color auto 5px}`
   — note :focus, not :focus-visible — so resetting only :focus-visible would
   leave a browser outline on mouse click. Both are reset; only :focus-visible
   gets an indicator. The dark halo guarantees the white outline is visible
   over light photography. */
.slideshow--ring:focus { outline: none; }
.slideshow--ring:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
	box-shadow: 0 0 0 5px rgba(0, 0, 0, .55);
}

/* --- editor placeholder (no slides chosen) --- */
.slideshow--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	padding: 0 20px;
	background: #f0f0f0;
	color: #757575;
	font-size: 14px;
	text-align: center;
}

/* =============================================================================
   Mobile (<756px) — no comps; assumption flagged to Dapper
   ============================================================================= */
@media (max-width: 755.98px) {
	.slideshow--ring {
		top: 12px;
		right: 12px;
	}
}

/* --- reduced motion --------------------------------------------------------
   The crossfade goes; the cycle and the ring sweep deliberately stay (client,
   2026-07-31), so a visitor with the preference set still sees every slide,
   just with hard cuts. Note this diverges from acf/media, which stops its
   background videos outright for these users. */
@media (prefers-reduced-motion: reduce) {
	.slideshow--slide,
	.slideshow--ring-pause,
	.slideshow--ring-play {
		transition: none;
	}
}
