/* Toolbar and slide list for plugin/ui.js. Colors follow the active reveal.js theme. */

.reveal {
	--rtlui-bg: color-mix(in srgb, var(--r-background-color, #fff) 92%, var(--r-main-color, #222));
	--rtlui-fg: var(--r-main-color, #222);
	--rtlui-accent: var(--r-link-color, #2a76dd);
	--rtlui-border: color-mix(in srgb, var(--r-main-color, #222) 20%, transparent);
	--rtlui-font: var(--rtl-font, var(--r-main-font, sans-serif));
}

.reveal.rtl .rtlui-panel,
.reveal.rtl .rtlui-toolbar {
	direction: rtl;
}

.rtlui-panel,
.rtlui-toolbar {
	font-family: var(--rtlui-font);
	font-size: 15px;
	color: var(--rtlui-fg);
	background: var(--rtlui-bg);
	border: 1px solid var(--rtlui-border);
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
	z-index: 40;
}

/* Slide list panel */

.rtlui-panel {
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	width: min(320px, 85vw);
	display: flex;
	flex-direction: column;
	border-block: 0;
	border-inline-start: 0;
}

.rtlui-panel[hidden] {
	display: none;
}

.rtlui-search {
	margin: 12px;
	padding: 8px 12px;
	font: inherit;
	color: inherit;
	background: var(--r-background-color, #fff);
	border: 1px solid var(--rtlui-border);
	border-radius: 6px;
}

.rtlui-search:focus-visible {
	outline: 2px solid var(--rtlui-accent);
	outline-offset: 1px;
}

/* Extra specificity: theme and rtl.css list rules (`.reveal.rtl ol`) must not apply here. */
.reveal .rtlui-panel .rtlui-list {
	flex: 1;
	overflow-y: auto;
	margin: 0;
	padding: 0 8px 12px;
	list-style: none;
}

.rtlui-item {
	display: flex;
	gap: 10px;
	width: 100%;
	padding: 8px 10px;
	font: inherit;
	color: inherit;
	text-align: start;
	background: none;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.rtlui-item:hover {
	background: var(--rtlui-border);
}

.rtlui-item:focus-visible {
	outline: 2px solid var(--rtlui-accent);
}

.rtlui-item-current {
	color: var(--rtlui-accent);
	font-weight: bold;
}

.rtlui-item-vertical {
	padding-inline-start: 28px;
}

.rtlui-item-number {
	min-width: 2ch;
	opacity: 0.6;
}

/* Slide preview beside the panel. The stage is the slide at its real size (config width/height),
   scaled down; it re-creates the bits of `.reveal .slides` styling the copy needs. */
.rtlui-preview {
	position: absolute;
	inset-inline-start: calc(100% + 8px);
	overflow: hidden;
	background: var(--r-background-color, #fff);
	border: 1px solid var(--rtlui-border);
	border-radius: 6px;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
	pointer-events: none;
}

.rtlui-preview[hidden] {
	display: none;
}

.rtlui-preview-stage {
	display: flex;
	flex-direction: column;
	justify-content: center;
	transform-origin: 0 0;
	text-align: center;
	font-family: var(--rtl-font, var(--r-main-font));
	font-size: var(--r-main-font-size, 40px);
	color: var(--r-main-color, #222);
	line-height: 1.3;
}

.rtlui-preview-stage[dir="rtl"] {
	transform-origin: 100% 0;
}

.rtlui-preview-stage :is(h1, h2, h3, h4) {
	font-family: var(--rtl-font, var(--r-heading-font));
	letter-spacing: normal;
}

.rtlui-preview-stage > section {
	display: block !important;
	padding: 20px;
}

.rtlui-empty {
	margin: 0 12px;
	opacity: 0.7;
}

/* Toolbar */

.rtlui-toolbar {
	position: absolute;
	inset-block-end: 12px;
	left: 50%;
	translate: -50% 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 4px;
	box-sizing: border-box;
	/* Absolute + left: 50% would shrink-to-fit into half the width; size to content, wrap if too wide. */
	width: max-content;
	max-width: calc(100% - 16px);
	padding: 4px 8px;
	border-radius: 22px;
	transition: opacity 0.3s;
}

.reveal.rtlui-idle .rtlui-toolbar,
.reveal.rtlui-idle .rtlui-show {
	opacity: 0;
	pointer-events: none;
}

/* Hidden toolbar: only a small handle at the bottom center. */
.reveal.rtlui-hidden .rtlui-toolbar {
	display: none;
}

.rtlui-button.rtlui-show {
	position: absolute;
	inset-block-end: 12px;
	left: 50%;
	translate: -50% 0;
	z-index: 40;
	color: var(--rtlui-fg);
	background: var(--rtlui-bg);
	border: 1px solid var(--rtlui-border);
	opacity: 0.6;
	transition: opacity 0.3s;
}

.rtlui-button.rtlui-show:hover,
.rtlui-button.rtlui-show:focus-visible {
	opacity: 1;
}

.reveal:not(.rtlui-hidden) .rtlui-show {
	display: none;
}

.rtlui-group {
	display: flex;
	align-items: center;
	gap: 2px;
	padding-inline: 4px;
}

.rtlui-group + .rtlui-group {
	border-inline-start: 1px solid var(--rtlui-border);
}

.rtlui-button {
	display: inline-grid;
	place-items: center;
	min-width: 32px;
	height: 32px;
	padding: 0;
	font: inherit;
	font-size: 16px;
	line-height: 1;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.rtlui-button:hover,
.rtlui-button[aria-pressed="true"],
.rtlui-button[aria-expanded="true"] {
	background: var(--rtlui-border);
}

.rtlui-button:focus-visible,
.rtlui-theme:focus-visible {
	outline: 2px solid var(--rtlui-accent);
}

/* First/last arrows point the reading direction. */
.reveal.rtl .rtlui-mirror {
	transform: scaleX(-1);
}

.rtlui-button.rtlui-timer {
	border-radius: 6px;
	font-size: inherit;
}

.rtlui-button.rtlui-timer-warn {
	color: #1a1a1a;
	background: #f9c74f;
}

.rtlui-button.rtlui-timer-over {
	color: #fff;
	background: #d62828;
}

.rtlui-timer,
.rtlui-clock {
	min-width: 4ch;
	padding-inline: 4px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* Zoom from plugin/ui.js. Applied to each slide (not .slides, whose transform-origin reveal.js
   controls) so it scales around the slide center; `scale` composes with transition transforms. */
.reveal .slides section:not(.stack) {
	scale: var(--rtlui-zoom, 1);
}

.reveal.overview .slides section,
html.print-pdf .reveal .slides section {
	scale: none;
}

.rtlui-button.rtlui-zoom-value {
	min-width: 4.5ch;
	border-radius: 6px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

/* Laser pointer and pen (core/draw.js). Above the slides, below the toolbar and panel. */
.rtlui-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 30;
	pointer-events: none;
}

.reveal.rtlui-pen .rtlui-canvas {
	pointer-events: auto;
	touch-action: none;
	cursor: crosshair;
}

.rtlui-laser {
	position: absolute;
	top: -7px;
	left: -7px;
	width: 14px;
	height: 14px;
	z-index: 35;
	border-radius: 50%;
	background: #ff1744;
	box-shadow: 0 0 6px 3px rgb(255 23 68 / 0.6), 0 0 18px 6px rgb(255 23 68 / 0.3);
	pointer-events: none;
}

.rtlui-laser[hidden] {
	display: none;
}

.reveal.rtlui-laser-on,
.reveal.rtlui-laser-on * {
	cursor: none;
}

.reveal.rtlui-laser-on .rtlui-toolbar,
.reveal.rtlui-laser-on .rtlui-toolbar *,
.reveal.rtlui-laser-on .rtlui-panel,
.reveal.rtlui-laser-on .rtlui-panel * {
	cursor: auto;
}

html.print-pdf .rtlui-canvas,
html.print-pdf .rtlui-laser {
	display: none;
}

/* While taking a slide image: only the slide and the pen drawing. */
.reveal.rtlui-capturing :is(.rtlui-toolbar, .rtlui-show, .rtlui-panel, .rtlui-laser, .controls, .progress) {
	visibility: hidden !important;
}

/* Export menu */
.rtlui-menu-wrapper {
	position: relative;
}

.rtlui-menu {
	position: absolute;
	inset-block-end: calc(100% + 10px);
	/* The export button sits on the toolbar's end side, so open toward the start (center). */
	inset-inline-end: 0;
	min-width: 180px;
	display: flex;
	flex-direction: column;
	padding: 6px;
	background: var(--rtlui-bg);
	border: 1px solid var(--rtlui-border);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
}

.reveal.rtlui-busy,
.reveal.rtlui-busy .rtlui-toolbar * {
	cursor: progress;
}

.rtlui-menu[hidden] {
	display: none;
}

.rtlui-menu-item {
	padding: 8px 12px;
	font: inherit;
	color: inherit;
	text-align: start;
	white-space: nowrap;
	background: none;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.rtlui-menu-item:hover,
.rtlui-menu-item:focus-visible {
	background: var(--rtlui-border);
	outline: none;
}

.rtlui-theme {
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid var(--rtlui-border);
	border-radius: 6px;
	padding: 2px 6px;
}

.rtlui-theme option {
	color: initial;
	background: initial;
}

/* Leave room so the toolbar does not cover reveal's own controls and slide number. */
.reveal .controls {
	bottom: 60px;
}

@media print {
	.rtlui-panel,
	.rtlui-toolbar,
	.rtlui-show {
		display: none !important;
	}
}

html.print-pdf .rtlui-panel,
html.print-pdf .rtlui-toolbar,
html.print-pdf .rtlui-show {
	display: none !important;
}

/* Small screens: drop the controls a phone already has or cannot use, and wrap if still too wide. */
@media (max-width: 640px) {
	.rtlui-wide-only {
		display: none !important;
	}

	.rtlui-toolbar {
		gap: 0;
		padding: 2px 4px;
		border-radius: 18px;
	}

	.rtlui-group {
		gap: 0;
		padding-inline: 0;
	}

	.rtlui-group + .rtlui-group {
		border-inline-start: 0;
	}

	.rtlui-button {
		min-width: 32px;
		height: 36px;
	}

	.rtlui-timer {
		min-width: 0;
		padding-inline: 2px;
	}

	/* The full-width toolbar would cover the slide number in the corner. */
	.reveal .slide-number {
		bottom: 60px;
	}
}
