/*
 * Reign LifterLMS Add-on: the Spotlight course layout and related courses.
 * Loaded after the Reign course page stylesheet; every colour and size comes from its tokens
 * (--reign-course-*, --reign-site-*), so light, dark, palettes and RTL follow the theme.
 * Desktop starts at 1025px, the Reign desktop breakpoint.
 */

/* ## Spotlight: the course image behind the header, the enrol card beside it as on the Reign default. */

.rllms-course--spotlight .reign-course {
	--rllms-cover-height: 20rem;
	--rllms-cover: none; /* The course image is set inline from the featured image. */
}

/* The image band is a grid item spanning the first row, so it is as tall as the header and bleeds to the window edges. */
.rllms-course--spotlight .reign-course__grid::before {
	content: "";
	grid-row: 1;
	grid-column: 1 / -1;
	margin-inline: calc(50% - 50vw);
	background:
		linear-gradient(color-mix(in srgb, black 60%, transparent), color-mix(in srgb, black 60%, transparent)),
		var(--rllms-cover, none) center / cover no-repeat,
		var(--reign-course-hero-bg);
}

.rllms-course--spotlight .reign-course__hero {
	grid-column: 1; /* Pinned: the band above takes row 1 across, so without this the hero auto-places into a second column on phones. */
	grid-row: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	min-height: var(--rllms-cover-height);
	border-image: none;
}

@media (min-width: 1025px) {
	.rllms-course--spotlight .reign-course {
		--rllms-cover-height: 26.25rem;
	}
}

/* ## Related courses: LifterLMS's loop inside the main column. */

.reign-course__section--related .llms-loop {
	margin-block-start: 0;
}

/* ## Reviews: the list with stars and the form. Tokens come from the Reign course page. */

.rllms-stars {
	/* An unfilled star is the text colour at 30%, so it stays visible in dark mode where the border colour nearly matches the page. */
	--rllms-star-off: color-mix(in srgb, var(--reign-site-body-text-color, currentColor) 30%, transparent);
	position: relative;
	display: inline-block;
	line-height: 1;
	letter-spacing: 0.1em;
}

.rllms-stars::before,
.rllms-stars::after {
	content: "\2605\2605\2605\2605\2605";
}

.rllms-stars::before {
	color: var(--rllms-star-off);
}

.rllms-stars::after {
	position: absolute;
	inset-block-start: 0;
	inset-inline-start: 0;
	width: calc(var(--rllms-rating, 0) * 100%);
	overflow: hidden;
	white-space: nowrap;
	color: var(--reign-course-star);
}

.rllms-reviews__title {
	margin-block: 0 1rem;
}

.rllms-reviews__list {
	display: grid;
	gap: 1.25rem;
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}

.rllms-review {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
}

.rllms-review__avatar {
	flex: none;
	border-radius: 50%;
}

.rllms-review__body {
	min-width: 0;
}

.rllms-review__body > * {
	margin-block: 0 0.25rem;
}

.rllms-review__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	color: var(--reign-site-alternate-text-color);
}

.rllms-review__title {
	font-weight: 600;
	color: var(--reign-site-headings-color);
}

.rllms-review__text {
	overflow-wrap: anywhere;
}

.rllms-reviews__notice {
	padding: 0.75rem 1rem;
	border: 1px solid var(--reign-site-border-color);
	border-radius: var(--reign-global-border-radius);
}

.rllms-reviews__notice--success {
	border-color: var(--reign-colors-theme);
}

.rllms-reviews__notice--error {
	border-color: currentcolor;
}

.rllms-reviews__pages {
	margin-block: 1.5rem 1rem;
}

.rllms-reviews__login {
	margin-block: 1rem 0;
}

.rllms-reviews__pages .page-numbers {
	display: inline-block;
	margin-inline-end: 0.5rem;
	padding: 0.25rem 0.625rem;
	border: 1px solid var(--reign-site-border-color);
	border-radius: var(--reign-global-border-radius);
}

.rllms-reviews__pages .current {
	background: var(--reign-colors-theme);
	border-color: var(--reign-colors-theme);
	color: var(--reign-site-button-text-color);
}

.rllms-review-form {
	display: grid;
	margin-block-start: 1.5rem;
	gap: 1rem;
	max-width: 40rem;
}

.rllms-review-form p {
	margin: 0;
}

.rllms-review-form label {
	display: block;
	margin-block-end: 0.25rem;
}

.rllms-review-form input[type="text"],
.rllms-review-form textarea {
	width: 100%;
}

/* Stars: the radios are in the order 5 to 1 and drawn in reverse, so a checked or hovered star fills the ones before it with no script. */
.rllms-review-form__rating {
	margin: 0;
	padding: 0;
	border: 0;
}

.rllms-review-form__rating legend {
	padding: 0;
	margin-block-end: 0.25rem;
}

.rllms-review-form__stars {
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 0.125rem;
}

.rllms-review-form__stars input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.rllms-review-form__stars label {
	margin: 0;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	color: color-mix(in srgb, var(--reign-site-body-text-color, currentColor) 30%, transparent);
}

.rllms-review-form__stars label::before {
	content: "\2605";
}

.rllms-review-form__stars input:checked ~ label,
.rllms-review-form__stars label:hover,
.rllms-review-form__stars label:hover ~ label {
	color: var(--reign-course-star);
}

.rllms-review-form__stars input:focus-visible + label {
	outline: 2px solid var(--reign-colors-theme);
	outline-offset: 2px;
}
