/**
 * WS40 Time Lapse player styles.
 *
 * @package WS40
 */

.ws40tl {
	max-width: 100%;
	margin: 0 0 1.5em;
	padding: 0 4px;
	font-size: 14px;
	color: #1d2327;
	box-sizing: border-box;
	overflow: hidden;
}

.ws40tl *,
.ws40tl *::before,
.ws40tl *::after {
	box-sizing: border-box;
}

.ws40tl__title {
	font-weight: 700;
	font-size: .95em;
	color: #0f6e56;
	margin-left: auto;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

/* Toolbar: date pickers + load + frame counter (below the image) */
.ws40tl__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	max-width: 100%;
}

.ws40tl__toolbar input[type="date"] {
	padding: 5px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 5px;
	font-size: 13px;
	min-width: 0;
	max-width: 100%;
}

.ws40tl__sep {
	color: #646970;
	font-weight: 700;
}

.ws40tl__load {
	background: #0f6e56;
	color: #fff;
	border: 0;
	border-radius: 5px;
	padding: 6px 18px;
	cursor: pointer;
	font-weight: 600;
	font-size: 13px;
	line-height: 1.6;
	transition: background .15s ease;
}

.ws40tl__load:hover {
	background: #0c5946;
}

.ws40tl__load:active {
	transform: translateY(1px);
}

.ws40tl__meta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-left: 4px;
	font-size: 12px;
	color: #646970;
}

.ws40tl__counter {
	font-variant-numeric: tabular-nums;
}

/* Stage: two stacked images (double buffer) */
.ws40tl__stage {
	position: relative;
	width: 100%;
	background: #1a1a1a;
	border-radius: 6px;
	overflow: hidden;
	aspect-ratio: 16 / 9;
}

.ws40tl__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: opacity var(--ws40tl-fade, 150ms) ease-in-out;
}

/* Fullscreen: the stage fills the whole screen; both buffered images stay
   absolutely positioned and overlapping, sized to the VIEWPORT (100vw/100vh)
   rather than the pre-fullscreen stage box, so the image fills the screen
   instead of collapsing into one half. */
.ws40tl__stage:fullscreen {
	width: 100vw;
	height: 100vh;
	aspect-ratio: auto;
	background: #000;
	border-radius: 0;
}

.ws40tl__stage:fullscreen .ws40tl__img {
	position: absolute;
	top: 0;
	left: 0;
	right: auto;
	bottom: auto;
	width: 100vw;
	height: 100vh;
	object-fit: contain;
}

/* WebKit/Blink prefixed fullscreen pseudo-classes (older Safari/Chrome). */
.ws40tl__stage:-webkit-full-screen {
	width: 100vw;
	height: 100vh;
	aspect-ratio: auto;
	background: #000;
	border-radius: 0;
}

.ws40tl__stage:-webkit-full-screen .ws40tl__img {
	position: absolute;
	top: 0;
	left: 0;
	right: auto;
	bottom: auto;
	width: 100vw;
	height: 100vh;
	object-fit: contain;
}

/* Controls bar */
.ws40tl__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
	max-width: 100%;
}

.ws40tl__controls button {
	background: #f0f0f1;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 4px 10px;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	flex: 0 0 auto;
}

.ws40tl__controls button:hover {
	background: #e0e0e1;
}

.ws40tl.is-playing .ws40tl__play {
	background: #0f6e56;
	color: #fff;
	border-color: #0f6e56;
}

.ws40tl__speedwrap {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #646970;
	margin-left: auto;
	flex: 0 1 auto;
	min-width: 0;
}

.ws40tl__speedwrap .ws40tl__speed {
	width: 90px;
	max-width: 100%;
	min-width: 0;
}

/* Scrubber row: full-width slider below the control buttons */
.ws40tl__scrubrow {
	margin-top: 8px;
	max-width: 100%;
}

.ws40tl__scrubber {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	display: block;
	margin: 0;
}

/* Mobile */
@media (max-width: 600px) {
	.ws40tl__toolbar {
		gap: 6px;
	}

	.ws40tl__toolbar input[type="date"] {
		flex: 1 1 40%;
	}

	.ws40tl__meta {
		flex-basis: 100%;
		margin-left: 0;
	}

	.ws40tl__controls {
		gap: 6px;
	}

	.ws40tl__speedwrap {
		margin-left: 0;
	}
}
