/**
 * WS40 Time Lapse player styles (DT-264: one control bar, messages and
 * loading ring on the image).
 *
 * @package WS40
 */

.ws40tl {
	--ws40tl-accent: #0f6e56;
	--ws40tl-line: #dcdcde;
	max-width: 100%;
	margin: 0 0 1.5em;
	font-size: 14px;
	color: #1d2327;
	box-sizing: border-box;
}

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

/* 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;
}

/* 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;
}


/* Title of the webcam, on the image */
.ws40tl__title {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	padding: 3px 10px;
	border-radius: 999px;
	background: rgba(10, 16, 13, .55);
	color: #fff;
	font-size: 12.5px;
	font-weight: 600;
	pointer-events: none;
	backdrop-filter: blur(4px);
}

/* Loading ring of the day */
.ws40tl__prog {
	--p: 0;
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: rgba(10, 16, 13, .35);
	color: #fff;
	font-weight: 600;
	transition: opacity .5s ease;
	pointer-events: none;
}

.ws40tl__prog.is-done {
	opacity: 0;
}

.ws40tl__ring {
	position: relative;
	display: grid;
	place-items: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .22) 0);
	transition: background .2s linear;
}

.ws40tl__ring::before {
	content: "";
	position: absolute;
	inset: 6px;
	border-radius: 50%;
	background: #18211d;
}

.ws40tl__pct {
	position: relative;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
}

.ws40tl__progtxt {
	font-size: 13px;
	text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* Messages (link copied, video…) */
.ws40tl__toast {
	position: absolute;
	left: 50%;
	bottom: 14px;
	z-index: 4;
	max-width: calc(100% - 24px);
	padding: 8px 16px;
	border-radius: 999px;
	background: rgba(10, 16, 13, .82);
	color: #fff;
	font-size: 13.5px;
	font-weight: 600;
	text-align: center;
	opacity: 0;
	transform: translate(-50%, 8px);
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
}

.ws40tl__toast.is-on {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* One control bar */
.ws40tl__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	margin-top: 10px;
	padding: 8px 10px;
	border: 1px solid var(--ws40tl-line);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.ws40tl__play {
	display: grid;
	place-items: center;
	flex: 0 0 42px;
	width: 42px;
	min-width: 0;
	height: 42px;
	min-height: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ws40tl-accent);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(15, 110, 86, .35);
	transition: transform .12s ease, background .15s ease;
}

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

.ws40tl__play:active {
	transform: scale(.94);
}

.ws40tl__play svg {
	width: 22px;
	height: 22px;
}

.ws40tl__i-pause,
.ws40tl.is-playing .ws40tl__i-play {
	display: none;
}

.ws40tl.is-playing .ws40tl__i-pause {
	display: block;
}

.ws40tl__now {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
	min-width: 64px;
	font-variant-numeric: tabular-nums;
}

.ws40tl__clock {
	font-size: 18px;
	font-weight: 700;
}

.ws40tl__counter {
	font-size: 11.5px;
	color: #646970;
}

.ws40tl__dates {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.ws40tl__dates input[type="date"] {
	height: 34px;
	padding: 0 8px;
	border: 1px solid var(--ws40tl-line);
	border-radius: 8px;
	background: #f6f7f7;
	font-size: 13px;
	color: #1d2327;
	min-width: 0;
}

.ws40tl__sep {
	color: #8c8f94;
	font-size: 12px;
}

.ws40tl__jumps {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	background: #f0f2f1;
	gap: 2px;
}

.ws40tl__jumps button {
	padding: 5px 12px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #1d2327;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.ws40tl__jumps button:hover:not(:disabled) {
	background: #fff;
	color: var(--ws40tl-accent);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.ws40tl__jumps button:disabled {
	opacity: .4;
	cursor: default;
}

.ws40tl__tools {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
}

.ws40tl__ico {
	display: inline-grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 8px;
	background: transparent;
	color: #3c434a;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease, color .15s ease;
}

.ws40tl__ico svg {
	width: 20px;
	height: 20px;
}

.ws40tl__ico:hover:not(:disabled) {
	background: #f0f2f1;
	color: var(--ws40tl-accent);
}

.ws40tl__ico:disabled {
	opacity: .35;
	cursor: default;
}

.ws40tl__ico:focus-visible,
.ws40tl__jumps button:focus-visible,
.ws40tl__play:focus-visible {
	outline: 2px solid var(--ws40tl-accent);
	outline-offset: 2px;
}

.ws40tl__speed {
	accent-color: var(--ws40tl-accent);
}

/* Range of days: plain slider */
.ws40tl__scrubrow {
	margin-top: 8px;
}

.ws40tl__scrubber {
	display: block;
	width: 100%;
	margin: 0;
	accent-color: var(--ws40tl-accent);
}

@media (max-width: 700px) {
	.ws40tl__bar {
		gap: 8px 10px;
	}

	.ws40tl__jumps {
		order: 5;
		flex-basis: 100%;
		justify-content: space-between;
	}

	.ws40tl__jumps button {
		flex: 1 1 0;
		padding: 6px 4px;
	}

	.ws40tl__dates {
		order: 4;
		flex: 1 1 100%;
	}

	.ws40tl__dates input[type="date"] {
		flex: 1 1 0;
	}

	.ws40tl__tools {
		margin-left: auto;
	}


}

/* DT-262: day strip (night / daylight from sunrise and sunset, one tick per frame) */
.ws40tl [hidden] {
	display: none !important;
}

.ws40tl:focus-visible {
	outline: 2px solid #0f6e56;
	outline-offset: 2px;
}

.ws40tl__stage {
	cursor: pointer;
	touch-action: pan-y;
}

.ws40tl__tl {
	position: relative;
	margin-top: 8px;
	height: 34px;
	border-radius: 6px;
	overflow: visible;
	cursor: pointer;
	touch-action: none;
}

.ws40tl__tlc {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 6px;
}

.ws40tl__head {
	position: absolute;
	top: -3px;
	bottom: -3px;
	width: 3px;
	margin-left: -1.5px;
	background: #fff;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
	pointer-events: none;
}

.ws40tl__tip {
	position: absolute;
	bottom: calc(100% + 8px);
	transform: translateX(-50%);
	padding: 4px;
	background: #1d2327;
	color: #fff;
	border-radius: 6px;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-align: center;
	pointer-events: none;
	z-index: 2;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.ws40tl__tip img {
	display: block;
	width: 160px;
	height: auto;
	border-radius: 4px;
	margin-bottom: 3px;
}

/* DT-263: same time on the previous days */
.ws40tl__week {
	margin-top: 10px;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	background: #fff;
}

.ws40tl__week > summary {
	padding: 7px 12px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.ws40tl__weekgrid {
	display: grid;
	grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr));
	gap: 8px;
	padding: 0 10px 10px;
	font-size: 12px;
	color: #646970;
}

.ws40tl__weekgrid button {
	padding: 0;
	border: 1px solid #dcdcde;
	border-radius: 5px;
	background: #f6f7f7;
	overflow: hidden;
	cursor: pointer;
	text-align: center;
	font-size: 12px;
	color: #1d2327;
}

.ws40tl__weekgrid button:hover {
	border-color: #0f6e56;
}

.ws40tl__weekgrid img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: #1a1a1a;
}

.ws40tl__weekgrid span {
	display: block;
	padding: 3px 4px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}


/* WS40's reset sets height:auto !important on every button inside [class*="ws40"]:
   the round buttons of the bar keep their size. */
.ws40tl .ws40tl__play {
	height: 42px !important;
}

.ws40tl .ws40tl__ico {
	height: 34px !important;
}

/* DT-265: previous photo, play, next photo */
.ws40tl__transport {
	display: inline-flex;
	align-items: center;
	gap: 2px;
}

/* DT-266: on phones the previous days scroll sideways on one row */
@media (max-width: 600px) {
	.ws40tl__weekgrid {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: 42%;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
	}

	.ws40tl__weekgrid button {
		scroll-snap-align: start;
	}
}

/* DT-267: previews being updated */
.ws40tl__weekgrid.is-loading {
	opacity: .45;
	transition: opacity .2s ease;
}

/* DT-268: loading ring of the previous days (same look as the one of the day) */
.ws40tl__weekmsg {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 96px;
	color: #646970;
	font-size: 13px;
}

.ws40tl__weekgrid.is-loading .ws40tl__weekmsg {
	opacity: 1;
}

.ws40tl__weekgrid.is-loading:has(.ws40tl__weekmsg) {
	opacity: 1;
}

.ws40tl__spin {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 3px solid #e0e6e3;
	border-top-color: var(--ws40tl-accent);
	animation: ws40tl-spin .8s linear infinite;
}

@keyframes ws40tl-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ws40tl__spin {
		animation-duration: 2.4s;
	}
}

@media (max-width: 600px) {
	.ws40tl__weekmsg {
		grid-row: 1;
		min-width: 100%;
	}
}

/* DT-269: second date only for several days */
.ws40tl__range {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.ws40tl__rangebtn[aria-pressed="true"] {
	background: #e6f4ef;
	color: var(--ws40tl-accent);
}

/* DT-269: speed as a value, slider and quick choices in a small panel */
.ws40tl__speedbox {
	position: relative;
	display: inline-flex;
}

.ws40tl .ws40tl__speedbtn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 34px !important;
	padding: 0 10px;
	border: 1px solid var(--ws40tl-line);
	border-radius: 999px;
	background: #f6f7f7;
	color: #3c434a;
	font-size: 12.5px;
	cursor: pointer;
	white-space: nowrap;
}

.ws40tl__speedbtn svg {
	width: 16px;
	height: 16px;
}

.ws40tl__speedbtn b {
	font-size: 14px;
	color: #1d2327;
	font-variant-numeric: tabular-nums;
}

.ws40tl__speedbtn:hover,
.ws40tl__speedbtn[aria-expanded="true"] {
	border-color: var(--ws40tl-accent);
	color: var(--ws40tl-accent);
}

.ws40tl__speedpop {
	position: absolute;
	right: 0;
	bottom: calc(100% + 8px);
	z-index: 6;
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 200px;
	padding: 10px 12px;
	border: 1px solid var(--ws40tl-line);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}

.ws40tl__speedpop .ws40tl__speed {
	width: 100%;
}

.ws40tl__presets {
	display: flex;
	gap: 6px;
}

.ws40tl__presets button {
	flex: 1 1 0;
	padding: 4px 0;
	border: 1px solid var(--ws40tl-line);
	border-radius: 8px;
	background: #f6f7f7;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
}

.ws40tl__presets button:hover {
	border-color: var(--ws40tl-accent);
	color: var(--ws40tl-accent);
}

/* DT-269: full screen with strip and bar laid over the image */
html.ws40tl-noscroll,
html.ws40tl-noscroll body {
	overflow: hidden;
}

.ws40tl.is-fs {
	position: fixed;
	inset: 0;
	z-index: 100000;
	margin: 0;
	background: #000;
}

.ws40tl:fullscreen {
	background: #000;
}

.ws40tl.is-fs .ws40tl__stage {
	position: absolute;
	inset: 0;
	aspect-ratio: auto;
	border-radius: 0;
	background: #000;
}

.ws40tl.is-fs .ws40tl__img {
	object-fit: contain;
}

.ws40tl.is-fs .ws40tl__dock {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 5;
	padding: 40px 16px 14px;
	background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
	transition: opacity .35s ease;
}

.ws40tl.is-fs .ws40tl__bar {
	background: rgba(24, 28, 26, .82);
	border-color: rgba(255, 255, 255, .12);
	color: #fff;
	backdrop-filter: blur(6px);
}

.ws40tl.is-fs .ws40tl__ico,
.ws40tl.is-fs .ws40tl__clock,
.ws40tl.is-fs .ws40tl__jumps button {
	color: #f0f0f1;
}

.ws40tl.is-fs .ws40tl__counter,
.ws40tl.is-fs .ws40tl__sep {
	color: #a7aaad;
}

.ws40tl.is-fs .ws40tl__jumps,
.ws40tl.is-fs .ws40tl__dates input[type="date"],
.ws40tl.is-fs .ws40tl__speedbtn {
	background: rgba(255, 255, 255, .1);
	border-color: rgba(255, 255, 255, .14);
	color: #f0f0f1;
	color-scheme: dark;
}

.ws40tl.is-fs .ws40tl__speedbtn b {
	color: #fff;
}

.ws40tl.is-fs .ws40tl__ico:hover:not(:disabled),
.ws40tl.is-fs .ws40tl__jumps button:hover:not(:disabled) {
	background: rgba(255, 255, 255, .14);
	color: #fff;
}

.ws40tl.is-fs .ws40tl__scrubrow,
.ws40tl.is-fs .ws40tl__week {
	display: none;
}

.ws40tl.is-fs.is-idle .ws40tl__dock {
	opacity: 0;
	pointer-events: none;
}

.ws40tl.is-fs.is-idle {
	cursor: none;
}

.ws40tl.is-fs .ws40tl__toast {
	bottom: auto;
	top: 18px;
}

.ws40tl.is-fs .ws40tl__rangebtn[aria-pressed="true"] {
	background: rgba(255, 255, 255, .2);
	color: #fff;
}

.ws40tl.is-fs .ws40tl__speedpop {
	background: #1f2422;
	border-color: rgba(255, 255, 255, .14);
}

.ws40tl.is-fs .ws40tl__presets button {
	background: rgba(255, 255, 255, .1);
	border-color: rgba(255, 255, 255, .14);
	color: #f0f0f1;
}
