/* =========================================================
   Lessons listing page
   ========================================================= */

/* The Spotlight carousel spans the full window width; clipping sideways here
   keeps that from ever adding a horizontal page scrollbar. */
body {
	overflow-x: clip;
}

/* Top-aligned (not the shared vertical centering) so switching layouts does
   not make the heading and controls jump. */
.lessons-main {
	max-width: 1180px;
	justify-content: flex-start;
	gap: clamp(1rem, 3vh, 1.75rem);
}

.lessons-heading {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
}

.lessons-heading-text {
	flex: 1 1 22rem;
}

.lessons-heading h1 {
	font-family: var(--font-display);
	font-size: clamp(1.9rem, 3vw, 2.5rem);
	font-weight: 500;
	letter-spacing: -0.025em;
	color: var(--text-primary);
	margin: 0 0 0.5rem;
}

.lessons-heading p {
	margin: 0;
	max-width: 40rem;
	color: var(--text-muted);
}

/* ---- Settings gear ----
   Sits where the reset button used to, opening the settings panel. */
.lesson-settings-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	flex-shrink: 0;
	padding: 0;
	border: 1px solid var(--border-card);
	border-radius: var(--radius-pill);
	background: var(--surface-card);
	color: var(--text-secondary);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lesson-settings-btn:hover {
	background: var(--surface-soft);
	border-color: var(--accent-border);
	color: var(--text-primary);
}

.lesson-settings-btn[hidden] {
	display: none;
}

.lesson-settings-btn svg {
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---- Completion ring (beside the heading) ----
   The ring is the shared .progress-ring component from style.css, the same
   one the Progress page uses, drawn smaller here. */
.lessons-heading-aside {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	flex-wrap: wrap;
}

/* Same ring as the Progress page, at 80% of its size. */
.lessons-ring {
	width: 8.4rem;
	height: 8.4rem;
}

.lessons-ring .progress-ring-percent {
	font-size: 1.6rem;
}

/* 80% would be ~10px; held at 12px so the caption stays readable. */
.lessons-ring .progress-ring-caption {
	font-size: 0.75rem;
}

@media (max-width: 640px) {
	.lessons-ring {
		width: 7.2rem;
		height: 7.2rem;
	}
}

.lessons-progress-link {
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--accent-text);
	text-decoration: none;
	white-space: nowrap;
}

.lessons-progress-link[hidden] {
	display: none;
}

.lessons-progress-link:hover {
	text-decoration: underline;
}

/* ---- Settings dialog ---- */
.lesson-settings {
	width: min(27.5rem, calc(100vw - 2.5rem));
	max-height: min(85vh, 44rem);
	padding: clamp(1.25rem, 2.4vw, 1.6rem);
	border: 1px solid var(--border-card);
	border-radius: var(--radius-lg);
	background: var(--surface-card);
	color: var(--text);
	box-shadow: var(--shadow-md);
	overflow-y: auto;
}

.lesson-settings::backdrop {
	background: rgba(6, 10, 17, 0.62);
}

.lesson-settings-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.lesson-settings-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.35rem;
	font-weight: 500;
	letter-spacing: -0.015em;
	color: var(--text-primary);
}

.lesson-settings-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	margin-right: -0.5rem;
	padding: 0;
	border: none;
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--text-secondary);
	cursor: pointer;
}

.lesson-settings-close:hover {
	background: var(--surface-soft);
	color: var(--text-primary);
}

.lesson-settings-close svg {
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
}

.lesson-settings-subtitle {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	color: var(--text-primary);
}

.lesson-settings-hint {
	margin: 0.25rem 0 0.9rem;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--text-secondary);
}

.lesson-settings-divider {
	margin: 1.35rem 0;
	border: 0;
	border-top: 1px solid var(--border-card);
}

.lesson-settings-foot {
	display: flex;
	justify-content: flex-end;
	margin-top: 1.5rem;
}

/* The page behind an open dialog stays put. */
.has-modal,
.has-modal body {
	overflow: hidden;
}

/* ---- Reset progress ----
   Lives in the settings panel: a rare, destructive action kept quiet until
   it is asked for, and always confirmed. */
.lessons-reset-btn {
	font-size: 0.875rem;
	padding: 0.5rem 1.1rem;
}

.lessons-reset-btn[hidden] {
	display: none;
}

.lessons-reset-confirm {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 0.9rem 1rem;
	border-radius: var(--radius-md);
	border: 1px solid var(--reset-danger-border);
	background: var(--reset-danger-bg);
}

/* Inside the tinted panel the confirm button becomes the solid one. */
.lessons-reset-confirm .lessons-reset-danger {
	background: var(--reset-danger-border);
	color: var(--reset-danger-on-solid);
}

.lessons-reset-confirm .lessons-reset-danger:hover,
.lessons-reset-confirm .lessons-reset-danger:focus-visible {
	background: var(--reset-danger-text);
	border-color: var(--reset-danger-text);
}

.lessons-reset-confirm[hidden] {
	display: none;
}

.lessons-reset-message {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--reset-danger-text);
}

.lessons-reset-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.lessons-reset-actions .btn {
	font-size: 0.875rem;
	padding: 0.5rem 1.1rem;
}

/* Tinted rather than solid: a destructive action should not shout, but the
   border carries the shape so the button is clearly there on a dark panel. */
.lessons-reset-danger {
	background: var(--reset-danger-bg);
	color: var(--reset-danger-text);
	border: 1.5px solid var(--reset-danger-border);
	font-weight: 600;
}

.lessons-reset-danger:hover,
.lessons-reset-danger:focus-visible {
	background: var(--reset-danger-border);
	border-color: var(--reset-danger-border);
	color: var(--reset-danger-on-solid);
}

.lessons-reset-status {
	margin: 0.75rem 0 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--text-secondary);
}

.lessons-reset-status:empty {
	display: none;
}

.lessons-heading {
	--reset-danger-bg: #fbe8e8;
	--reset-danger-border: #c94343;
	--reset-danger-text: #8a2323;
	--reset-danger-on-solid: #ffffff;
}

.lesson-settings {
	--reset-danger-bg: #fbe8e8;
	--reset-danger-border: #c94343;
	--reset-danger-text: #8a2323;
	--reset-danger-on-solid: #ffffff;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Lesson display toggle (inside the settings panel) ---- */
.view-toggle {
	display: flex;
	width: 100%;
	gap: 0.25rem;
	padding: 0.25rem;
	border-radius: var(--radius-pill);
	background: var(--surface-card);
	border: 1px solid var(--card-border);
	box-shadow: var(--shadow-sm);
}

.view-toggle-btn {
	display: inline-flex;
	flex: 1 1 0;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	min-height: 2.75rem;
	padding: 0 1.1rem;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: var(--text-muted);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.view-toggle-btn:hover:not(:disabled):not([aria-pressed="true"]) {
	background: var(--surface-soft);
	color: var(--text-primary);
}

.view-toggle-btn[aria-pressed="true"] {
	background: var(--primary-button-bg);
	color: var(--primary-button-text);
}

/* The shared focus rule squares off corners; keep the pill shape. */
.view-toggle-btn:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
	border-radius: 999px;
}

/* Shown but not usable until the lessons have loaded. */
.view-toggle-btn:disabled {
	cursor: default;
	opacity: 0.55;
}

.view-toggle-icon {
	flex-shrink: 0;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linejoin: round;
}

/* ---- Lesson collection (shared by Grid and Spotlight) ----
   Spotlight's geometry lives in these tokens so each breakpoint only has to
   change numbers, never selectors. Card width is a share of the full-width
   carousel; lessons.js reads the scale, edge gap, and offset tokens to place
   the neighbors so their outer edges always stay on screen. */
.lessons-collection {
	--lesson-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--spot-fade-duration: 120ms;

	--spot-card-width: min(58%, 54rem);
	--spot-card-ratio: 2.3 / 1; /* grows taller if a card's text needs it */
	--spot-image-share: 55%;
	--spot-pad-block: 2.25rem; /* room for the focus glow above and below */
	--spot-edge-gap: 1.5rem; /* space between a neighbor card and the window edge */
	--spot-max-offset: 0.72; /* on very wide screens, neighbors stop drifting apart */

	--spot-side-scale: 0.9;
	--spot-far-scale: 0.82;
	/* A dark scrim rather than a fade toward the page color: fading would make
	   side cards vanish in dark mode, where cards and page are nearly the same
	   color. A scrim keeps them a distinct, recessed panel in both themes. */
	--spot-dim-color: rgb(16, 23, 34);
	--spot-side-dim: 0.42;

	--spot-arrow-size: 2.75rem;
	min-width: 0;
}

.lessons-collection[hidden],
.view-spotlight[hidden] {
	display: none;
}

.lessons-viewport {
	min-width: 0;
	transition: opacity var(--spot-fade-duration) ease;
}

/* Fallback when View Transitions are unavailable. */
.lessons-collection.is-switching .lessons-viewport {
	opacity: 0;
}

.lesson-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
	gap: 1.5rem;
}

/* No overflow clipping on the card itself: Spotlight draws its focus glow and
   dimming layer as pseudo-elements that must reach the card's edge. The image
   clips its own corners instead. */
.lesson-card {
	position: relative;
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.view-grid .lesson-card:hover {
	box-shadow: var(--shadow-md);
	transform: translateY(-3px);
}

.lesson-card-link {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	color: inherit;
	text-decoration: none;
}

.lesson-card-image {
	position: relative;
	aspect-ratio: 16 / 9;
	background: var(--blue-soft);
	overflow: hidden;
	border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}

/* Shown whole in every layout; lessons.js paints the frame with the image's
   own background color so the space around it blends in. */
.lesson-card-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Both the lesson image and the fallback failed: keep the tinted placeholder. */
.lesson-card-image img[hidden] {
	display: none;
}

/* Subtle "quiz passed" indicator on the thumbnail — present but not loud. */
.lesson-card-quiz-badge {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	width: 1.75rem;
	height: 1.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--surface-card);
	border: 1.5px solid var(--success);
	color: var(--teal-dark);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1;
	box-shadow: var(--shadow-sm);
}

.lesson-card-body {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.25rem;
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: break-word;
}

.lesson-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.lesson-card-tag {
	background: var(--accent-soft);
	color: var(--accent-text);
	border-radius: var(--radius-pill);
	padding: 0.3rem 0.8rem;
	font-size: 0.75rem;
	font-weight: 600;
}

.lesson-card-title {
	margin: 0;
	font-family: var(--font-ui);
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--text-primary);
}

.lesson-card-desc {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--text-muted);
	flex: 1 1 auto;
}

.lesson-card-progress {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	margin-top: 0.15rem;
}

.lesson-card-progress-track {
	flex: 1 1 auto;
	height: 0.5rem;
	border-radius: 999px;
	background: var(--blue-soft);
	overflow: hidden;
}

.lesson-card-progress-fill {
	height: 100%;
	border-radius: 999px;
	background: var(--blue);
}

.lesson-card-progress-fill.is-complete {
	background: var(--teal);
}

.lesson-card-progress-label {
	flex-shrink: 0;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--text-muted);
}

/* ---- Module completion ----
   A module is only finished when the slides are done and the quiz is passed,
   so the card lists both requirements and reserves the banner for the moment
   both are met. */
.lesson-card.is-module-complete {
	border-color: var(--teal);
	box-shadow: 0 0 0 1px var(--teal), var(--shadow-sm);
}

.lesson-card-complete-banner {
	display: flex;
	align-items: center;
	align-self: flex-start;
	gap: 0.45rem;
	margin: 0 0 0.15rem;
	padding: 0.35rem 0.75rem 0.35rem 0.4rem;
	border-radius: 999px;
	background: var(--teal-soft);
	color: var(--teal-dark);
	font-size: 0.8125rem;
	font-weight: 700;
}

.lesson-card-complete-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.2rem;
	height: 1.2rem;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--teal);
	color: var(--card-bg);
	font-size: 0.8125rem;
	line-height: 1;
}

.lesson-card-checklist {
	list-style: none;
	margin: 0.2rem 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1rem;
}

.lesson-card-check {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--text-muted);
}

.lesson-card-check.is-done {
	color: var(--teal-dark);
}

.lesson-card-check-mark {
	font-size: 0.875rem;
	line-height: 1;
}

.lesson-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 0 1.25rem 1.25rem;
}

.lesson-card-cta {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--accent-text);
	text-decoration: none;
}

.lesson-card:hover .lesson-card-cta,
.lesson-card-cta:focus-visible {
	text-decoration: underline;
}

.lesson-card-quiz-btn {
	margin-left: auto;
	padding: 0.4rem 0.9rem;
	font-size: 0.8125rem;
}

/* =========================================================
   Spotlight view
   ========================================================= */
.view-spotlight {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	grid-template-areas:
		"viewport viewport viewport"
		"prev     footer   next";
	align-items: center;
	column-gap: 1rem;
	row-gap: 0.25rem;
}

.view-spotlight .spotlight-prev { grid-area: prev; justify-self: end; }
.view-spotlight .lessons-viewport { grid-area: viewport; }
.view-spotlight .spotlight-next { grid-area: next; justify-self: start; }
.view-spotlight .spotlight-footer { grid-area: footer; }

/* Native horizontal scrolling carries touch, trackpad, and wheel input. The
   carousel bleeds to both window edges so neighbors have room to show whole. */
.view-spotlight .lessons-viewport {
	margin-inline: calc(50% - 50vw);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}

.view-spotlight .lessons-viewport::-webkit-scrollbar {
	display: none;
}

.view-spotlight .lessons-viewport {
	position: relative; /* anchors the snap markers to the scrolling content */
}

/* Snap points: one empty, never-transformed marker per card (see lessons.js). */
.spotlight-snaps {
	display: none;
}

.view-spotlight .spotlight-snaps {
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 1px;
	pointer-events: none;
}

.spotlight-snap {
	position: absolute;
	top: 0;
	height: 1px;
	scroll-snap-align: center;
}

.view-spotlight .lesson-grid {
	display: flex;
	align-items: stretch;
	gap: 0;
	position: relative; /* makes card offsets relative to the scroll track */
	padding-block: var(--spot-pad-block);
}

/* Spacers let the first and last lessons reach the center. They are flex
   items, so they count toward the scrollable width in every browser. */
.view-spotlight .lesson-grid::before,
.view-spotlight .lesson-grid::after {
	content: "";
	flex: 0 0 calc((100% - var(--spot-card-width)) / 2);
}

/* ---- The shared Spotlight card ----
   Every card in this view uses the same layout. Focus never changes a card's
   inside; lessons.js only sets the outer card's position, scale, and layer,
   plus --spot-depth (0 centered, 1 neighbor, 2 hidden), which drives the glow,
   the dimming, and the fade below. Nothing here transitions: the values follow
   the scroll position frame by frame, so the smooth scroll is the animation. */
.view-spotlight .lesson-card {
	--spot-depth: 2;
	flex: 0 0 var(--spot-card-width);
	aspect-ratio: var(--spot-card-ratio);
	display: grid;
	grid-template-columns: var(--spot-image-share) minmax(0, 1fr);
	/* The text row never shrinks below its content, so the ratio above is a
	   minimum height: a wordier lesson makes every card in the row taller. */
	grid-template-rows: minmax(min-content, 1fr) auto;
	opacity: clamp(0, calc(2 - var(--spot-depth)), 1);
	transform: scale(var(--spot-far-scale));
	transition: none;
	will-change: transform, opacity;
}

/* While lessons load, one placeholder stands in for the focused card. */
.view-spotlight .lesson-card-skeleton {
	opacity: 1;
	transform: none;
	min-height: 0;
}

.view-spotlight .lesson-card-skeleton ~ .lesson-card-skeleton {
	display: none;
}

/* The card link spans the whole card and shares its grid (subgrid), so the
   image fills the left column while the footer sits under the text. The link
   keeps a real box, so it stays focusable. */
.view-spotlight .lesson-card-link {
	grid-column: 1 / -1;
	grid-row: 1 / -1;
	display: grid;
	grid-template-columns: subgrid;
	grid-template-rows: subgrid;
	min-width: 0;
}

/* Spotlight's image column is a different shape than the artwork, so the
   picture is scaled up to fill it and the overflow is cropped: no gaps. The
   column is kept wide, and the card short, so little is lost from the sides. */
.view-spotlight .lesson-card-image img {
	object-fit: cover;
}

.view-spotlight .lesson-card-image {
	grid-column: 1;
	grid-row: 1 / -1;
	aspect-ratio: auto;
	border-radius: calc(var(--radius-lg) - 1px) 0 0 calc(var(--radius-lg) - 1px);
}


.view-spotlight .lesson-card-body {
	grid-column: 2;
	grid-row: 1;
	justify-content: center;
	gap: 0.55rem;
	padding: clamp(1rem, 1.6vw, 1.5rem) clamp(1.25rem, 2.4vw, 2.25rem) 0.5rem;
}

.view-spotlight .lesson-card-desc {
	flex: 0 0 auto;
}

.view-spotlight .lesson-card-footer {
	grid-column: 2;
	grid-row: 2;
	padding: 0.5rem clamp(1.25rem, 2.4vw, 2.25rem) clamp(1rem, 1.6vw, 1.5rem);
}

/* Larger type to suit the larger card, applied to every card alike. */
@media (min-width: 900px) {
	.view-spotlight .lesson-card-title {
		font-size: clamp(1.3rem, 0.9rem + 0.8vw, 1.75rem);
	}

	.view-spotlight .lesson-card-desc {
		font-size: clamp(0.9375rem, 0.8rem + 0.3vw, 1.0625rem);
	}

	.view-spotlight .lesson-card-tag {
		font-size: 0.8125rem;
	}

	.view-spotlight .lesson-card-cta {
		font-size: 0.9375rem;
	}

	.view-spotlight .lesson-card-quiz-btn {
		padding: 0.55rem 1.1rem;
		font-size: 0.875rem;
	}
}

/* Focus glow (::before) and dimming layer (::after). Both are opacity only,
   so moving between states never repaints a shadow or runs a filter. */
.view-spotlight .lesson-card::before,
.view-spotlight .lesson-card::after {
	content: "";
	position: absolute;
	inset: -1px;
	border-radius: inherit;
	pointer-events: none;
}

.view-spotlight .lesson-card::before {
	box-shadow: 0 0 0 2px var(--accent-text), 0 16px 32px -18px rgba(36, 93, 234, 0.55);
	opacity: clamp(0, calc(1 - var(--spot-depth) * 2), 1);
}

/* The ring sits on top of the card border, so a finished module keeps its
   green completion color when focused instead of turning blue. */
.view-spotlight .lesson-card.is-module-complete::before {
	box-shadow: 0 0 0 2px var(--success), 0 16px 32px -18px rgba(20, 122, 87, 0.5);
}

.view-spotlight .lesson-card::after {
	background: var(--spot-dim-color);
	opacity: calc(min(var(--spot-depth), 1) * var(--spot-side-dim));
}

.view-spotlight .lesson-card.is-before,
.view-spotlight .lesson-card.is-after {
	cursor: pointer;
}

/* The dimming layer also catches clicks, so pressing a side card brings it
   forward instead of opening the lesson underneath. */
.view-spotlight .lesson-card.is-before::after,
.view-spotlight .lesson-card.is-after::after {
	pointer-events: auto;
}

.view-spotlight .lesson-card.is-far {
	pointer-events: none;
}

.view-spotlight .lesson-card:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: -6px;
}

/* ---- Spotlight controls ---- */
.spotlight-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--spot-arrow-size);
	height: var(--spot-arrow-size);
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--card-border);
	background: var(--card-bg);
	color: var(--blue-dark);
	box-shadow: var(--shadow-sm);
	cursor: pointer;
	transition: background-color 0.2s ease, opacity 0.2s ease;
}

.spotlight-arrow[hidden] {
	display: none;
}

.spotlight-arrow svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.spotlight-arrow:hover:not([aria-disabled="true"]) {
	background: var(--blue-soft);
}

.spotlight-arrow:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
	border-radius: 50%;
}

/* aria-disabled rather than disabled: a disabled button drops keyboard focus
   the moment the carousel reaches either end. */
.spotlight-arrow[aria-disabled="true"] {
	opacity: 0.4;
	cursor: not-allowed;
	box-shadow: none;
}

.spotlight-footer {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--spot-arrow-size);
}

.spotlight-footer[hidden],
.spotlight-dots[hidden],
.spotlight-counter[hidden] {
	display: none;
}

.spotlight-dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.1rem;
}

/* A 2rem hit area around a small visible dot. */
.spotlight-dot {
	position: relative;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.spotlight-dot::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 50%;
	background: var(--text-muted);
	opacity: 0.6;
	transform: translate(-50%, -50%);
	transition: transform 0.25s var(--lesson-ease), opacity 0.25s ease, background-color 0.25s ease;
}

.spotlight-dot:hover::before {
	opacity: 0.85;
}

.spotlight-dot[aria-current="true"]::before {
	background: var(--blue);
	opacity: 1;
	transform: translate(-50%, -50%) scale(1.45);
}

.spotlight-dot:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: -3px;
	border-radius: 50%;
}

.spotlight-counter {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--text-muted);
	font-variant-numeric: tabular-nums;
}

/* Grid and Spotlight morph between each other when the browser supports it. */
::view-transition-group(*) {
	animation-duration: 260ms;
	animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Loading skeleton ---- */
.lesson-card-skeleton {
	min-height: 20rem;
	background: linear-gradient(100deg, var(--surface-card) 30%, var(--surface-soft) 50%, var(--surface-card) 70%);
	background-size: 200% 100%;
	animation: lesson-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes lesson-skeleton-shimmer {
	from {
		background-position: 150% 0;
	}
	to {
		background-position: -50% 0;
	}
}

.lesson-grid-error {
	text-align: center;
	color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
	.lesson-card-skeleton {
		animation: none;
	}

	/* Spotlight still works; it just moves without animating. */
	.lessons-viewport,
	.view-toggle-btn,
	.spotlight-arrow,
	.spotlight-dot::before {
		transition: none;
	}

	.view-grid .lesson-card:hover {
		transform: none;
	}
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
	.lessons-collection {
		--spot-card-width: 64%;
		--spot-card-ratio: 2.2 / 1;
		--spot-image-share: 55%;
		--spot-edge-gap: 1rem;
	}
}

/* Every Spotlight card stacks the same way once the card is too narrow to hold
   a wide image column beside the text. */
@media (max-width: 899px) {
	.lessons-collection {
		--spot-card-width: 74%;
		--spot-card-ratio: auto;
	}

	.view-spotlight .lesson-card {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr) auto;
	}

	.view-spotlight .lesson-card-image {
		grid-column: 1;
		grid-row: 1;
		aspect-ratio: 16 / 9;
		border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
	}

	.view-spotlight .lesson-card-body {
		grid-column: 1;
		grid-row: 2;
		justify-content: flex-start;
		padding: 1.25rem 1.25rem 0.5rem;
	}

	.view-spotlight .lesson-card-footer {
		grid-column: 1;
		grid-row: 3;
		padding: 0.5rem 1.25rem 1.25rem;
	}
}

/* Neighbors tuck almost fully behind, showing only their rounded outer edge. */
@media (max-width: 640px) {
	.lessons-collection {
		--spot-card-width: 84%;
		--spot-side-scale: 0.92;
		--spot-edge-gap: 0.4rem;
		--spot-pad-block: 1.25rem;
	}
}

@media (max-width: 560px) {
	.lesson-grid {
		grid-template-columns: 1fr;
	}
}

/* ---- Dark theme ---- */
[data-theme="dark"] .lesson-card-quiz-badge {
	background: var(--card-bg);
}

[data-theme="dark"] .lessons-collection {
	--spot-dim-color: rgb(6, 10, 17);
	--spot-side-dim: 0.5;
}

[data-theme="dark"] .lessons-heading,
[data-theme="dark"] .lesson-settings {
	--reset-danger-bg: #3b1f22;
	--reset-danger-border: #cf5b5b;
	--reset-danger-text: #f3b2b2;
	--reset-danger-on-solid: #2a1113;
}



