/* KM Spatial Drift — front (scoped to .kmsd-stage) */

/* ----------------------------------------------------------------------
   THEME ISOLATION
   Reset every element inside the stage to its initial value so the host
   theme's button/p/h3/svg rules can't bleed in. Our own rules below then
   restyle the few elements we use. `revert` falls back to the UA default,
   not the theme cascade, which is exactly what we want.
   ---------------------------------------------------------------------- */
.kmsd-stage,
.kmsd-stage * {
	all: revert;
	box-sizing: border-box;
}
.kmsd-stage *::before,
.kmsd-stage *::after {
	box-sizing: border-box;
}
/* Buttons are the usual victim of theme styling — hard-reset them.
   Key visual props use !important so even a theme with `button{...!important}`
   can't override our scoped controls (short of Shadow DOM, which is the
   bulletproof option available as a setting). */
.kmsd-stage button {
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	outline: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	line-height: normal !important;
	text-shadow: none !important;
	min-width: 0 !important;
	min-height: 0 !important;
	width: auto !important;
	height: auto !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	font-family: "JetBrains Mono", ui-monospace, monospace !important;
	color: inherit !important;
	cursor: pointer;
	transition: none;
}
.kmsd-stage button:hover,
.kmsd-stage button:focus,
.kmsd-stage button:active {
	background: none;
	box-shadow: none;
	outline: none;
	transform: none;
}
.kmsd-stage h3,
.kmsd-stage p,
.kmsd-stage div,
.kmsd-stage span {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	text-transform: none;
}
.kmsd-stage svg {
	display: block;
	max-width: none !important;
	max-height: none !important;
	width: auto;
	height: auto;
	vertical-align: baseline;
	box-shadow: none !important;
}

.kmsd-stage {
	position: relative;
	width: 100%;
	height: var(--kmsd-h, 80vh);
	background: var(--kmsd-bg, #050505);
	overflow: hidden;
	font-family: "Archivo Narrow", system-ui, sans-serif;
	color: #e8e6e0;
	/* Establish a stacking + containment context to limit theme interference. */
	isolation: isolate;
	contain: layout style;
	line-height: 1.4;
}

.kmsd-stage .kmsd-gl {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}

.kmsd-stage .kmsd-hud {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 3;
	font-family: "JetBrains Mono", ui-monospace, monospace;
}

.kmsd-stage .kmsd-brand {
	position: absolute;
	top: 18px;
	left: 20px;
	font-size: 11px;
	letter-spacing: .32em;
	text-transform: uppercase;
	color: #8a8780;
}
.kmsd-stage .kmsd-brand b {
	color: #e8e6e0;
	font-weight: 500;
}

.kmsd-stage .kmsd-counter {
	position: absolute;
	top: 18px;
	right: 20px;
	font-size: 11px;
	letter-spacing: .14em;
	color: #8a8780;
	text-align: right;
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
}
.kmsd-stage .kmsd-counter b {
	color: #e8e6e0;
	font-weight: 600;
}
.kmsd-stage .kmsd-sep {
	color: #5a5750;
}

.kmsd-stage .kmsd-label {
	position: absolute;
	left: 20px;
	bottom: 120px;
	max-width: 60ch;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .5s ease, transform .5s ease;
	pointer-events: none;
}
.kmsd-stage .kmsd-label.kmsd-on {
	opacity: 1;
	transform: none;
}
.kmsd-stage .kmsd-lnum {
	font-size: 11px;
	letter-spacing: .3em;
	color: #c0a36b;
	margin-bottom: 10px;
}
.kmsd-stage .kmsd-ltitle {
	font-family: "Archivo Narrow", system-ui, sans-serif !important;
	font-weight: 700 !important;
	font-size: clamp(44px, 7vw, 96px) !important;
	line-height: .9 !important;
	letter-spacing: -.02em !important;
	margin: 0 !important;
	color: rgba(232, 230, 224, .68) !important;
	text-shadow: 0 2px 40px rgba(0, 0, 0, .5) !important;
}
.kmsd-stage .kmsd-ldesc {
	font-size: 12px;
	color: #8a8780;
	margin: 10px 0 0;
	letter-spacing: .04em;
}

/* delicate "open link" button — only shown for works that have a link */
.kmsd-stage .kmsd-openlink {
	display: none;
	pointer-events: auto;
	margin-top: 16px !important;
	align-items: center;
	gap: 9px;
	font-family: "JetBrains Mono", ui-monospace, monospace !important;
	font-size: 10px !important;
	letter-spacing: .18em !important;
	text-transform: uppercase !important;
	color: #cfccc4 !important;
	background: rgba(8, 8, 8, .72) !important;
	border: 1px solid rgba(255, 255, 255, .14) !important;
	border-radius: 4px !important;
	padding: 11px 18px !important;
	cursor: pointer;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: color .22s ease, border-color .22s ease, background .22s ease;
}
.kmsd-stage .kmsd-label.kmsd-has-link .kmsd-openlink {
	display: inline-flex;
}
.kmsd-stage .kmsd-openlink:hover {
	color: #fff !important;
	border-color: #c0a36b !important;
	background: rgba(8, 8, 8, .92) !important;
}
.kmsd-stage .kmsd-openlink svg {
	display: block;
	opacity: .85;
}

.kmsd-stage .kmsd-hint {
	position: absolute;
	left: 50%;
	bottom: 96px;
	transform: translateX(-50%);
	font-size: 9px;
	letter-spacing: .26em;
	text-transform: uppercase;
	color: #5a5750;
	opacity: .55;
	transition: opacity .4s ease;
	white-space: nowrap;
	pointer-events: none;
}
.kmsd-stage:hover .kmsd-hint {
	opacity: .8;
}

/* ---- close (exit close-up) button ---- */
.kmsd-stage .kmsd-close {
	position: absolute;
	top: 14px;
	right: 56px;
	display: none;
	pointer-events: auto;
	align-items: center;
	justify-content: center;
	width: 34px !important;
	height: 34px !important;
	color: #aaa7a0 !important;
	background: rgba(10, 10, 10, .55) !important;
	border: 1px solid rgba(255, 255, 255, .12) !important;
	border-radius: 50% !important;
	cursor: pointer;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.kmsd-stage .kmsd-close.kmsd-on {
	display: inline-flex;
}
.kmsd-stage .kmsd-close:hover {
	color: #fff !important;
	border-color: #c0a36b !important;
	background: rgba(10, 10, 10, .8) !important;
}

/* ---- numeric pagination (dots with numbers) ---- */
.kmsd-stage .kmsd-pager {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	pointer-events: auto;
	flex-wrap: wrap;
	justify-content: center;
	max-width: 70vw;
}
.kmsd-stage .kmsd-dot {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 30px !important;
	height: 30px !important;
	padding: 0 !important;
	margin: 0 !important;
	font-family: "JetBrains Mono", ui-monospace, monospace !important;
	font-size: 11px !important;
	line-height: 1 !important;
	color: #cfccc4 !important;
	background: rgba(8, 8, 8, .55) !important;
	border: 1px solid rgba(255, 255, 255, .14) !important;
	border-radius: 50% !important;
	cursor: pointer !important;
	box-shadow: none !important;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.kmsd-stage .kmsd-dot:hover {
	color: #fff !important;
	border-color: #c0a36b !important;
	background: rgba(8, 8, 8, .82) !important;
}
.kmsd-stage .kmsd-dot.kmsd-active {
	color: #12110d !important;
	background: #c0a36b !important;
	border-color: #c0a36b !important;
	font-weight: 600;
}

/* ---- bottom control bar (play/pause + pager) ---- */
.kmsd-stage .kmsd-controls {
	position: absolute;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%);
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 0 !important;
	pointer-events: auto;
	background: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}

.kmsd-stage .kmsd-ctrl {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px !important;
	height: 40px !important;
	padding: 0 !important;
	color: #cfccc4 !important;
	background: transparent !important;
	border: none !important;
	border-radius: 50% !important;
	cursor: pointer;
	transition: color .2s ease, background .2s ease, transform .15s ease;
}
.kmsd-stage .kmsd-ctrl:active {
	transform: scale(.92);
}
.kmsd-stage .kmsd-ctrl svg,
.kmsd-stage .kmsd-close svg,
.kmsd-stage .kmsd-openlink svg {
	display: block;
	overflow: visible;
}
.kmsd-stage .kmsd-ctrl svg { width: 18px !important; height: 18px !important; }
.kmsd-stage .kmsd-close svg { width: 16px !important; height: 16px !important; }
.kmsd-stage .kmsd-openlink svg { width: 13px !important; height: 13px !important; }

/* stroke-based icons (close X, external-link) */
.kmsd-stage .kmsd-close svg path,
.kmsd-stage .kmsd-openlink svg path {
	fill: none !important;
	stroke: currentColor !important;
	stroke-width: 1.6 !important;
	stroke-linecap: round !important;
	stroke-linejoin: round !important;
}
/* fill-based icons (play triangle, pause bars) */
.kmsd-stage .kmsd-ic-play path { fill: currentColor !important; stroke: none !important; }
.kmsd-stage .kmsd-ic-pause rect { fill: currentColor !important; stroke: none !important; }

/* play/pause is the emphasized centre control */
.kmsd-stage .kmsd-playpause {
	width: 54px !important;
	height: 54px !important;
	color: #12110d !important;
	background: rgba(232, 230, 224, .92) !important;
	box-shadow: 0 6px 28px rgba(0, 0, 0, .45) !important;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}
.kmsd-stage .kmsd-playpause:hover {
	background: #fff !important;
	color: #12110d !important;
}
/* icon swap: show play by default, pause when active */
.kmsd-stage .kmsd-playpause .kmsd-ic-pause { display: none; }
.kmsd-stage .kmsd-playpause.kmsd-playing .kmsd-ic-play { display: none; }
.kmsd-stage .kmsd-playpause.kmsd-playing .kmsd-ic-pause { display: block; }
.kmsd-stage .kmsd-playpause.kmsd-playing {
	color: #12110d !important;
	background: #c0a36b !important;
}
.kmsd-stage .kmsd-playpause.kmsd-playing:hover {
	background: #d4b87f !important;
}

.kmsd-stage .kmsd-loader {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--kmsd-bg, #050505);
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 11px;
	letter-spacing: .3em;
	text-transform: uppercase;
	color: #8a8780;
	transition: opacity .6s ease;
}
.kmsd-stage .kmsd-loader.kmsd-gone {
	opacity: 0;
	pointer-events: none;
}

.kmsd-stage .kmsd-noscript {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #8a8780;
	font-family: system-ui, sans-serif;
}

@media (max-width: 760px) {
	.kmsd-stage .kmsd-ltitle {
		font-size: clamp(32px, 11vw, 56px);
	}
	.kmsd-stage .kmsd-label {
		bottom: 110px;
		left: 16px;
		right: 16px;
	}
	.kmsd-stage .kmsd-hint {
		bottom: 92px;
		font-size: 8px;
		letter-spacing: .2em;
	}
	.kmsd-stage .kmsd-controls {
		bottom: 18px;
		gap: 4px;
	}
	.kmsd-stage .kmsd-ctrl {
		width: 44px !important;
		height: 44px !important;
	}
	.kmsd-stage .kmsd-playpause {
		width: 56px !important;
		height: 56px !important;
	}
	.kmsd-stage .kmsd-dot {
		width: 34px !important;
		height: 34px !important;
		font-size: 12px !important;
	}
	.kmsd-stage .kmsd-pager {
		gap: 6px;
		max-width: 64vw;
	}
	.kmsd-stage .kmsd-close {
		right: 14px;
		top: 12px;
	}
}
