/*
 * Reign LifterLMS Add-on: reading mode on lessons and quizzes.
 * The mode lives on the root element (data-rllms-reader, set in the head before first paint), so nothing is
 * hidden or shown by script after load. Colours and spacing come from the Reign tokens.
 */

.rllms-reader-toggle {
	display: flex;
	justify-content: flex-end;
	margin-block-end: 1rem;
}

/* The lesson's meta row: "Back to" on the start edge, the favourite and this toggle on the end edge. */
.rllms-lesson-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin-block-end: 1.5rem;
}

.rllms-lesson-meta > * {
	margin: 0;
}

.rllms-lesson-meta .llms-parent-course-link {
	order: -1;
	margin-block: 0; /* LifterLMS's 20px bottom margin outranked the row's reset and lifted the text off the row's centre. */
	margin-inline-end: auto;
}

.rllms-lesson-meta .llms-favorite-wrapper {
	float: none;
}

.rllms-lesson-meta .rllms-reader-toggle {
	margin: 0;
}

/* Phones: "Back to" on its own line, the toggle and favourite together under it. */
@media (max-width: 480px) {
	.rllms-lesson-meta .llms-parent-course-link {
		flex-basis: 100%;
	}
}

.rllms-reader-toggle__button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.5rem;
	padding-inline: 1rem;
	border: 1px solid var(--reign-site-border-color);
	border-radius: var(--reign-global-button-radius);
	background: var(--reign-site-sections-bg-color);
	color: var(--reign-site-body-text-color);
	cursor: pointer;
}

/* The label says what the click does; the mode on the root picks it. */
html[data-rllms-reader="on"] .rllms-reader-toggle__label--enter,
html:not([data-rllms-reader="on"]) .rllms-reader-toggle__label--exit {
	display: none;
}

html[data-rllms-reader="on"] .rllms-reader-toggle__button {
	border-color: var(--reign-colors-theme);
	color: var(--reign-site-headings-color);
	box-shadow: inset 0 0 0 1px var(--reign-colors-theme);
}

.rllms-reader-toggle__button:focus-visible {
	outline: 2px solid var(--reign-colors-theme);
	outline-offset: 2px;
}

/* On: the site chrome steps aside and the lesson is one readable column. */
html[data-rllms-reader="on"] body.single-lesson #masthead,
html[data-rllms-reader="on"] body.single-llms_quiz #masthead,
html[data-rllms-reader="on"] body.single-lesson footer[itemtype$="WPFooter"],
html[data-rllms-reader="on"] body.single-llms_quiz footer[itemtype$="WPFooter"] {
	display: none;
}

html[data-rllms-reader="on"] body.single-lesson .site-content,
html[data-rllms-reader="on"] body.single-llms_quiz .site-content {
	max-width: 46rem;
	margin-inline: auto;
	padding-block: 2rem;
}
