/* Shared media-controller styles for all video sub-components.
   Imported in each internal component's frontmatter.
   Prefixed with .amk for scope protection — each sub-component
   adds this class to its root wrapper element. */

/* Shrink-wrap the zoom wrapper to match the media-controller's intrinsic size,
   so PhotoSwipe's zoom animation origin matches the visible content. */
.pswp-zoom:has(> .amk) {
	width: fit-content;
	max-width: 100%;
}

.amk > * {
	max-width: 100%;
}

.amk media-controller {
	--media-time-range-hover-bottom: 0;
}

/* Lightbox mode: transition for JS-driven visibility toggle. */
.amk media-controller.lightbox media-control-bar {
	transition: opacity 0.25s;
}

/* Never show the control bar when auto-playing, unless the video has played. */
.amk media-controller.autoplay:not([mediahasplayed]) media-control-bar,
.amk media-controller.autoplay:not([mediahasplayed]) media-play-button {
	display: none;
}

/* Hide volume slider on platforms that don't support programmatic volume (e.g. iOS). */
.amk media-controller[mediavolumeunavailable] media-volume-range {
	display: none;
}

/* Hide mute and volume controls when the video has no audio track.
   Excluded for embed services (.amk-embed) — YouTube/Vimeo always have
   audio but the audioTracks API isn't available cross-origin. */
.amk:not(.amk-embed) media-controller[mediaaudiotrackunavailable] media-mute-button,
.amk:not(.amk-embed) media-controller[mediaaudiotrackunavailable] media-volume-range {
	display: none;
}

/* Don't hide the cursor when inactive, unless fullscreen. */
.amk media-controller[userinactive]:not([mediaisfullscreen]) * {
	cursor: auto !important;
}
