/*
 * "Watch live" (MEP_Watch_Renderer). Layout only: it renders in the light DOM of somebody else's
 * theme, so it inherits fonts and colours and a skin paints. Nothing here may make a `hidden` node
 * visible — the state switches depend on it.
 *
 * The widget sizes itself to its own column, not the window (container queries), because it is as
 * likely to sit in a half-width Elementor column as across the page.
 */

.mep-watch [hidden] {
	display: none !important;
}

.mep-watch {
	container-type: inline-size;
	box-sizing: border-box;
	width: 100%;
}

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

.mep-watch-layout {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
	gap: 20px;
}

.mep-watch-main {
	display: grid;
	gap: 16px;
	align-content: start;
	min-width: 0;
}

/* ---- the screen: player and caption read as one object ------------------------------------- */

.mep-watch-screen {
	display: grid;
	overflow: hidden;
}

.mep-watch-player {
	position: relative;
	aspect-ratio: 16 / 9;
	max-width: 100%;
	background: #000;
}

.mep-watch-player iframe,
.mep-watch-player .mep-embed-placeholder {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	margin: 0;
}

.mep-watch-player .mep-embed-placeholder {
	display: grid;
	place-content: center;
	padding: 16px;
	text-align: center;
}

.mep-watch-live {
	position: absolute;
	top: 12px;
	inset-inline-start: 12px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	pointer-events: none;
}

.mep-watch-live i {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #f87171;
	animation: mep-watch-pulse 2s ease-in-out infinite;
}

@keyframes mep-watch-pulse {
	50% {
		opacity: 0.35;
	}
}

.mep-watch-caption {
	display: grid;
	gap: 6px;
	padding: 14px 16px;
}

.mep-watch-caption-top {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}


.mep-watch-title {
	margin: 0;
	text-wrap: balance;
}

.mep-watch-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---- before the event: the poster stands in for the player --------------------------------- */

.mep-watch-poster {
	position: relative;
	aspect-ratio: 16 / 9;
	max-width: 100%;
	display: grid;
	place-items: center;
	padding: 24px;
	overflow: hidden;
	text-align: center;
}

.mep-watch-poster-in {
	position: relative;
	display: grid;
	gap: 14px;
	justify-items: center;
}

.mep-watch-kicker {
	display: block;
}

.mep-watch-poster-big {
	margin: 0;
	max-width: 24ch;
	text-wrap: balance;
}

.mep-watch-poster-line {
	margin: 0;
	max-width: 44ch;
	text-wrap: balance;
}

.mep-watch-count {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.mep-watch-count-unit {
	display: grid;
	justify-items: center;
	min-width: 68px;
	padding: 10px 8px;
}

.mep-watch-count-unit b {
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

/* ---- after the event: the recorded days, buttons wide and a dropdown on a phone ------------- */

.mep-watch-pick:empty {
	display: none;
}

.mep-watch-days-wide {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.mep-watch-day-select {
	display: none;
	gap: 6px;
}

.mep-watch-day-select select {
	min-height: 48px;
	width: 100%;
	padding-inline: 12px;
	font: inherit;
}

.mep-watch-days {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 3px;
	border-radius: 999px;
}

.mep-watch-day {
	all: unset;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 999px;
	white-space: nowrap;
}

.mep-watch-day:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ---- editors only: a day with no link, and the Preview bar ----------------------------------- */

.mep-watch-test {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 8px;
	padding: 16px;
	text-align: center;
}

.mep-watch-test-tag {
	padding: 6px 12px;
	border-radius: 999px;
	border: 1px dashed currentColor;
	font-weight: 500;
}

/* Its own colours, so it reads the same on any theme; nobody but an editor ever sees it. */
.mep-watch-preview {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-block-end: 12px;
	padding: 10px 14px;
	border-radius: 12px;
	border: 1px solid #f59e0b;
	background: #fef3c7;
	color: #422006;
	font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
	letter-spacing: 0;
	text-transform: none;
}

.mep-watch-preview b {
	font-weight: 600;
}

.mep-watch-preview label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.mep-watch-preview select,
.mep-watch-preview input {
	font: inherit;
	padding: 4px 8px;
	border-radius: 8px;
	border: 1px solid #d6a74a;
	background: #fffbeb;
	color: #422006;
	min-height: 0;
	height: auto;
	width: auto;
}

.mep-watch-preview-show {
	all: unset;
	cursor: pointer;
	padding: 5px 12px;
	border-radius: 999px;
	background: #422006;
	color: #fffbeb;
	font-weight: 600;
}

.mep-watch-preview-show:focus-visible {
	outline: 2px solid #422006;
	outline-offset: 2px;
}

.mep-watch-preview-note {
	margin-inline-start: auto;
	color: #7c4a03;
}

/* ---- questions: full width under the player ---------------------------------------------- */

.mep-watch-questions {
	grid-column: 1 / -1;
	min-width: 0;
}

.mep-watch-questions:empty {
	display: none;
}

/* QR code and link: the card is as wide as the video, directly under it. The Slido embed keeps
   the full width. (Without :has, the card simply stays full width.) */
.mep-watch-layout:has(> .mep-watch-questions > .mep-watch-q:not(.mep-watch-q--embed)) > .mep-watch-questions {
	grid-column: 1;
}

.mep-watch-q {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 20px;
	width: 100%;
}

.mep-watch-q--embed {
	display: block;
}

.mep-watch-q-frame {
	display: block;
	width: 100%;
	min-height: 560px;
	border: 0;
}

.mep-watch-q--qr {
	grid-template-columns: auto minmax(0, 1fr) auto;
}

.mep-watch-q-qr {
	display: block;
	width: 96px;
	height: 96px;
	object-fit: contain;
}

.mep-watch-q-head,
.mep-watch-q-line {
	margin: 0;
}

.mep-watch-q-btn {
	justify-self: end;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	white-space: nowrap;
	text-decoration: none;
}

/* ---- the rail ------------------------------------------------------------------------------ */

.mep-watch-rail {
	position: relative;
	min-width: 0;
	min-height: 320px;
}

/* As tall as the player side, exactly: the column scrolls inside itself. */
.mep-watch-rail-inner {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.mep-watch-rail-inner > [data-mep-watch-rail] {
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1;
	min-height: 0;
}

.mep-watch-rail-head {
	margin: 0;
}

/* Every day is in the rail: a gap above each day after the first. */
.mep-watch-rows + .mep-watch-rail-head {
	margin-block-start: 20px;
}

.mep-watch-timeline {
	flex: 1;
	min-height: 0;
	overflow: auto;
	-webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent 100%);
	mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent 100%);
	padding-block: 8px 24px;
}

.mep-watch-earlier {
	all: unset;
	cursor: pointer;
	padding: 4px 6px;
}

.mep-watch-earlier:focus-visible {
	outline: 2px solid currentColor;
}

.mep-watch-rows {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mep-watch-row {
	position: relative;
	display: grid;
	margin: 0;
	padding-block: 8px;
	padding-inline: 22px 6px;
}

/* The thin line and its dots. */
.mep-watch-row::before {
	content: "";
	position: absolute;
	inset-inline-start: 7px;
	top: 0;
	bottom: 0;
	width: 1px;
	background: currentColor;
	opacity: 0.25;
}

.mep-watch-row::after {
	content: "";
	position: absolute;
	inset-inline-start: 4px;
	top: 14px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	border: 1px solid currentColor;
	background: transparent;
}

.mep-watch-row.is-past::after {
	background: currentColor;
}

/* "Show times": the start time in its own column, before the title (so on the right in Arabic). */
.mep-watch-rows--timed .mep-watch-row {
	grid-template-columns: 3.2em minmax(0, 1fr);
	column-gap: 10px;
	align-items: baseline;
}

.mep-watch-row-time {
	font-size: 0.9em;
	font-variant-numeric: tabular-nums;
	opacity: 0.75;
}

.mep-watch-zone {
	font-size: 0.8rem;
	opacity: 0.75;
}

.mep-watch-foot {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

/* ---- calm motion ---------------------------------------------------------------------------- */

.mep-watch-caption,
.mep-watch-questions,
[data-mep-watch-rail] {
	transition: opacity 0.2s ease;
}

.mep-watch .is-swapping {
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
	.mep-watch-live i {
		animation: none;
	}
	.mep-watch-caption,
	.mep-watch-questions,
	[data-mep-watch-rail] {
		transition: none;
	}
}

/* ---- narrow: video, the day dropdown, then questions; no agenda ---------------------------- */

@container (max-width: 760px) {
	.mep-watch-layout {
		grid-template-columns: 1fr;
		gap: 16px;
	}
	/* A phone has no room for the agenda beside the video; the site's own agenda page has it. */
	.mep-watch-rail {
		display: none;
	}
	.mep-watch-days-wide {
		display: none;
	}
	.mep-watch-day-select {
		display: grid;
	}
	/* You can't scan your own screen: a phone gets the button alone. */
	.mep-watch-q,
	.mep-watch-q--qr {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 12px;
	}
	.mep-watch-q-qr,
	.mep-watch-q-line {
		display: none;
	}
	/* The poster's lines outgrow 16:9 on a phone: at least that tall, taller when it needs to be. */
	.mep-watch-poster {
		aspect-ratio: auto;
		min-height: 56cqw;
		padding: 28px 16px;
	}
	.mep-watch-count-unit {
		min-width: 52px;
		padding: 8px 6px;
	}
	.mep-watch-preview-note {
		margin-inline-start: 0;
	}
}


/* ---- time-zone picker at the rail's foot (Show times on) ---------------------------------- */
/* The agenda's own control (MEP_Agenda_Renderer::timezone_select + timezone.js); these are its
   base rules from mep-agenda.css, which a Watch page does not load. */
.mep-watch-zone {
	position: relative;
}

.mep-watch-zone .mep-agenda-timezone {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.85rem;
}

.mep-watch-zone .mep-agenda-timezone-label {
	opacity: 0.75;
	white-space: nowrap;
}

.mep-watch-zone .mep-agenda-timezone select {
	font: inherit;
	font-size: 0.85rem;
	padding: 0.3rem 0.4rem;
	color: inherit;
	background: transparent;
	border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
	border-radius: 0.35rem;
	max-width: 14rem;
}

.mep-watch-zone .mep-tz {
	position: relative;
	display: inline-block;
}

.mep-watch-zone .mep-tz-panel {
	position: absolute;
	bottom: calc(100% + 0.4rem);
	inset-inline-start: 0;
	z-index: 5;
	width: min(20rem, 85vw);
	padding: 0.5rem;
	background: #fff;
	color: #111;
	border: 1px solid #d0d5dd;
	border-radius: 8px;
}

.mep-watch-zone .mep-tz-list {
	list-style: none;
	margin: 0.4rem 0 0;
	padding: 0;
	max-height: 16rem;
	overflow-y: auto;
}

.mep-watch-zone .mep-tz-option {
	display: block;
	width: 100%;
	padding: 0.35rem 0.5rem;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: start;
	cursor: pointer;
}
