/*
 * The English Lab — lesson / learning area
 *
 * Tutor LMS 4.x "learning area": the page students study in (header bar,
 * curriculum sidebar, lesson content, prev/next footer). Restyled after the
 * student-portal concept art: white cards with a hairline border on a soft
 * blue-grey page, mono "eyebrow" micro-labels, cobalt -> indigo accent, and a
 * dark banner (.tel-hero) as the one dark element.
 *
 * The lesson content itself is an H5P iframe; h5p-lab.css is loaded inside it
 * (see functions.php) and uses the same palette. To make the page dark again
 * (it was dark until 2026-11-10), swap the --lab-* values below for the dark
 * set kept in the README, and the same in h5p-lab.css.
 *
 * Scoped to .tutor-learning-page (the learning area's own wrapper), so
 * nothing else on the site changes.
 */

body.tutor-frontend .tutor-learning-page {
	--lab-bg: #eef1f6;
	--lab-surface: #fff;
	--lab-surface-2: #e8eef8;
	--lab-rule: rgb(26 32 44 / 12%);
	--lab-ink: #1a202c;
	--lab-soft: rgb(26 32 44 / 72%);
	--lab-faint: rgb(26 32 44 / 52%);
	--lab-cobalt: #1a56db;
	--lab-accent: #6c63ff;
	--lab-paper: #fff;
	--lab-radius: 16px;
}

/* Dark mode, switched on by js/tel-mode.js (data-tel-mode on <html>) in the
   evening and at night. Only the values change; every rule below uses them. */
html[data-tel-mode='dark'] body.tutor-frontend .tutor-learning-page {
	--lab-bg: #161c2a;
	--lab-surface: #1d2536;
	--lab-surface-2: #252e42;
	--lab-rule: rgb(245 247 250 / 12%);
	--lab-ink: #f5f7fa;
	--lab-soft: rgb(245 247 250 / 70%);
	--lab-faint: rgb(245 247 250 / 52%);
	--lab-cobalt: #4a90e2;
	--lab-accent: #8b86f0;
	--lab-paper: #1d2536;
}

/* Tutor's own text colours are only flipped on parts this file also paints
   dark (the shell parts above and the panels below). Flipping them for the
   whole page left quiz text near-white on Tutor's own white surface for
   visitors whose system is in light mode (2026-11-23). */
html[data-tel-mode='dark'] body.tutor-frontend .tutor-learning-page .tutor-lesson-content > :not(.tutor-learning-area-footer),
html[data-tel-mode='dark'] body.tutor-frontend .tutor-learning-page .tutor-lesson-content-tab:has(iframe.h5p-iframe) .tutor-tab-panel:not(:has(iframe.h5p-iframe)) {
	--tutor-text-primary: var(--lab-ink);
	--tutor-text-secondary: var(--lab-soft);
	--tutor-text-subdued: var(--lab-faint);
	color: var(--lab-ink);
}

html[data-tel-mode='dark'] body.tutor-frontend .tutor-learning-page .tutor-learning-header,
html[data-tel-mode='dark'] body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar,
html[data-tel-mode='dark'] body.tutor-frontend .tutor-learning-page .tutor-learning-area-footer {
	--tutor-border-hover: rgb(245 247 250 / 30%);
}

/* Tutor colours its own text through these variables. Remapping them on the
   shell parts only (header, sidebar, prev/next bar) re-themes everything in
   them at once. */
body.tutor-frontend .tutor-learning-page .tutor-learning-header,
body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar,
body.tutor-frontend .tutor-learning-page .tutor-learning-area-footer {
	--tutor-text-primary: var(--lab-ink);
	--tutor-text-secondary: var(--lab-soft);
	--tutor-text-subdued: var(--lab-faint);
	--tutor-tab-l3-active-hover: var(--lab-surface-2);

	/* topic progress circles, and the vertical rail beside a topic's lessons */
	--tutor-actions-gray-empty: var(--lab-surface-2);
	--tutor-border-hover: rgb(26 32 44 / 30%);
	--tutor-surface-l1-hover: var(--lab-rule);
}

/* On phones the sidebar is a full-screen drawer with its own background. */
body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar {
	background: var(--lab-bg);
}

/* Shell ------------------------------------------------------------ */

body.tutor-frontend .tutor-learning-page .tutor-learning-area,
body.tutor-frontend .tutor-learning-page .tutor-learning-header {
	background: var(--lab-bg);
}

body.tutor-frontend .tutor-learning-page .tutor-learning-header-inner {
	background: var(--lab-surface);
	border: 1px solid var(--lab-rule);
	border-radius: var(--lab-radius);
}

body.tutor-frontend .tutor-learning-page .tutor-learning-header-title {
	color: var(--lab-ink);
	font-weight: 600;
	letter-spacing: -0.02em;
}

/* components.css gives the back button its light chip with !important, so
   the Lab version needs it too. */
body.tutor-frontend .tutor-learning-page .tutor-learning-header-back a,
body.tutor-frontend .tutor-learning-page .tutor-learning-header-back .tutor-btn {
	color: var(--lab-ink) !important;
	background: var(--lab-surface-2) !important;
	border: 1px solid var(--lab-rule) !important;
}

body.tutor-frontend .tutor-learning-page .tutor-learning-header-back a:hover,
body.tutor-frontend .tutor-learning-page .tutor-learning-header-back .tutor-btn:hover {
	color: var(--lab-cobalt) !important;
	background: var(--lab-rule) !important;
	border-color: var(--lab-cobalt) !important;
}

body.tutor-frontend .tutor-learning-page .tutor-learning-header-toggle-mobile .tutor-btn {
	color: var(--lab-ink);
	background: var(--lab-surface-2);
	border: 1px solid var(--lab-rule);
}

/* Sidebar ---------------------------------------------------------- */

body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar-curriculum,
body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar-pages {
	background: var(--lab-surface);
	border: 1px solid var(--lab-rule);
	border-radius: var(--lab-radius);
	box-shadow: none;
}

body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar h5 {
	color: var(--lab-ink);
}

/* "0% Completed" as a mono eyebrow, with a cobalt -> indigo bar */
body.tutor-frontend .tutor-learning-page .tutor-learning-progress-text {
	font-family: var(--tel-font-mono);
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--lab-soft);
}

body.tutor-frontend .tutor-learning-page .tutor-learning-progress-text span {
	color: var(--lab-ink);
	font-weight: 700;
}

body.tutor-frontend .tutor-learning-page .tutor-progress-bar {
	height: 6px;
	overflow: hidden;
	background: var(--lab-rule);
	border-radius: 999px;
}

body.tutor-frontend .tutor-learning-page .tutor-progress-bar-fill {
	background: linear-gradient(90deg, var(--lab-cobalt), var(--lab-accent));
	border-radius: inherit;
}

body.tutor-frontend .tutor-learning-sidebar .tutor-learning-sidebar-curriculum .tutor-learning-nav-topic .tutor-learning-nav-header-title {
	color: var(--lab-soft);
	font-weight: 600;
	letter-spacing: -0.01em;
}

body.tutor-frontend .tutor-learning-sidebar .tutor-learning-sidebar-curriculum .tutor-learning-nav-topic.active .tutor-learning-nav-header-title {
	color: var(--lab-ink);
}

body.tutor-frontend .tutor-learning-page .tutor-learning-nav-header-arrow {
	color: var(--lab-faint);
}

/* These mirror Tutor's own (long) selector so they outrank it. */
body.tutor-frontend .tutor-learning-sidebar .tutor-learning-sidebar-curriculum .tutor-learning-nav .tutor-learning-nav-item {
	color: var(--lab-soft);
	border-radius: 12px;
	transition:
		background-color 0.15s ease,
		color 0.15s ease;
}

body.tutor-frontend .tutor-learning-sidebar .tutor-learning-sidebar-curriculum .tutor-learning-nav .tutor-learning-nav-item:hover {
	color: var(--lab-ink);
	background: var(--lab-surface-2);
}

body.tutor-frontend .tutor-learning-sidebar .tutor-learning-sidebar-curriculum .tutor-learning-nav .tutor-learning-nav-item.active {
	color: var(--lab-ink);
	background: var(--lab-surface-2);
	box-shadow: inset 3px 0 0 var(--lab-cobalt);
}

body.tutor-frontend .tutor-learning-sidebar .tutor-learning-sidebar-curriculum .tutor-learning-nav .tutor-learning-nav-item svg {
	flex: none;
	color: var(--lab-faint);
}

body.tutor-frontend .tutor-learning-sidebar .tutor-learning-sidebar-curriculum .tutor-learning-nav .tutor-learning-nav-item.active svg {
	color: var(--lab-cobalt);
}

/* Lesson type under the title ("Reading", "Quiz"...) */
body.tutor-frontend .tutor-learning-page .tutor-learning-nav-item .tutor-text-subdued {
	font-family: var(--tel-font-mono);
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--lab-faint);
}

/* "Mais" and its popover */
body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar-pages .tutor-learning-pages-item {
	color: var(--lab-soft);
}

body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar-pages .tutor-learning-pages-item:hover {
	color: var(--lab-ink);
	background: var(--lab-surface-2);
}

body.tutor-frontend .tutor-learning-page .tutor-popover {
	color: var(--lab-ink);
	background: var(--lab-surface-2);
	border: 1px solid var(--lab-rule);
	border-radius: 14px;
}

body.tutor-frontend .tutor-learning-page .tutor-popover .tutor-learning-pages-item {
	color: var(--lab-ink);
}

body.tutor-frontend .tutor-learning-page .tutor-popover .tutor-learning-pages-item:hover {
	background: var(--lab-rule);
}

body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar .tutor-learning-pages-item svg,
body.tutor-frontend .tutor-learning-page .tutor-learning-sidebar .tutor-popover .tutor-learning-pages-item svg {
	color: var(--lab-soft);
}

body.tutor-frontend .tutor-learning-page .tutor-expand-btn {
	color: var(--lab-soft);
	background: var(--lab-surface);
	border-color: var(--lab-rule);
}

/* Lesson content: light paper panel --------------------------------- */

body.tutor-frontend .tutor-learning-page .tutor-lesson-content > :not(.tutor-learning-area-footer) {
	background: var(--lab-paper);
	border: 1px solid var(--lab-rule);
	border-radius: 20px;
}

/* H5P lessons: the iframe draws its own white cards (h5p-lab.css, loaded
   inside the iframe), so the paper panel steps aside and the cards sit
   directly on the page. Other tabs of the same lesson (Comentários) keep a
   white panel. */
body.tutor-frontend .tutor-learning-page .tutor-lesson-content > :not(.tutor-learning-area-footer):has(iframe.h5p-iframe) {
	background: transparent;
	border: 0;
}

body.tutor-frontend .tutor-learning-page .tutor-lesson-content-tab:has(iframe.h5p-iframe) .tutor-tab-panel:not(:has(iframe.h5p-iframe)) {
	margin: 16px;
	background: var(--lab-paper);
	border-radius: 20px;
}

/* Tab bar (Visão Geral / Comentários) */
body.tutor-frontend .tutor-learning-page .tutor-lesson-content-tab:has(iframe.h5p-iframe) .tutor-tabs-nav {
	--tutor-text-primary: var(--lab-ink);
	--tutor-text-secondary: var(--lab-soft);
	--tutor-text-subdued: var(--lab-faint);
	border-color: var(--lab-rule);
}

body.tutor-frontend .tutor-learning-page .tutor-lesson-content-tab:has(iframe.h5p-iframe) .tutor-tabs-nav [role='tab'] {
	color: var(--lab-soft);
	background: transparent;
	border-radius: 12px;
}

body.tutor-frontend .tutor-learning-page .tutor-lesson-content-tab:has(iframe.h5p-iframe) .tutor-tabs-nav [role='tab'][aria-selected='true'] {
	color: var(--lab-cobalt);
	background: var(--lab-surface-2);
}

/* Plain links inside the paper panel (comments, descriptions) */
body.tutor-frontend .tutor-learning-page .tutor-lesson-content a:not(.tutor-btn) {
	color: var(--tel-cobalt);
}

/* Previous / next bar ----------------------------------------------- */

body.tutor-frontend .tutor-learning-page .tutor-learning-area-footer {
	background: var(--lab-bg);
	border-top: 1px solid var(--lab-rule);
}

body.tutor-frontend .tutor-learning-page .tutor-learning-area-footer .tutor-btn {
	color: var(--lab-ink);
	background: var(--lab-surface);
	border: 1px solid var(--lab-rule);
	border-radius: 999px;
}

body.tutor-frontend .tutor-learning-page .tutor-learning-area-footer .tutor-btn:hover {
	background: var(--lab-surface-2);
	border-color: var(--lab-cobalt);
}

/* Lesson banner (printed by functions.php: tel_child_lesson_hero_html) -- */

body.tutor-frontend .tutor-learning-page .tel-hero {
	/* the banner stays dark whatever the page palette is */
	--lab-surface: #1d2536;
	--lab-rule: rgb(245 247 250 / 12%);
	--lab-ink: #f5f7fa;
	--lab-soft: #c3c9d6;
	--lab-cobalt: #4a90e2;
	--lab-accent: #8b86f0;

	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	margin: 0 10px 14px; /* lines up with the H5P cards below (10px margin inside the iframe) */
	padding: 28px 32px;
	overflow: hidden;
	color: var(--lab-ink);
	background: var(--lab-surface);
	border: 1px solid var(--lab-rule);
	border-radius: 20px;
}

body.tutor-frontend .tutor-learning-page .tel-hero__body {
	position: relative;
	z-index: 1;
	min-width: 0;
}

body.tutor-frontend .tutor-learning-page .tel-hero__brand {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 28px;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--lab-ink);
}

body.tutor-frontend .tutor-learning-page .tel-hero__dots {
	display: inline-flex;
	gap: 6px;
}

body.tutor-frontend .tutor-learning-page .tel-hero__dots i {
	width: 12px;
	height: 12px;
	border-radius: 50%;
}

body.tutor-frontend .tutor-learning-page .tel-hero__dots i:nth-child(1) {
	background: #e07b00;
}

body.tutor-frontend .tutor-learning-page .tel-hero__dots i:nth-child(2) {
	background: var(--lab-cobalt);
}

body.tutor-frontend .tutor-learning-page .tel-hero__dots i:nth-child(3) {
	background: var(--lab-accent);
}

body.tutor-frontend .tutor-learning-page .tel-hero__eyebrow {
	margin: 0 0 10px;
	font-family: var(--tel-font-mono);
	font-size: 0.78rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--lab-soft);
}

body.tutor-frontend .tutor-learning-page .tel-hero .tel-hero__title {
	margin: 0;
	font-size: clamp(1.6rem, 3.4vw, 2.6rem);
	font-weight: 700;
	line-height: 1.08;
	letter-spacing: -0.035em;
	color: var(--lab-ink);
}

body.tutor-frontend .tutor-learning-page .tel-hero__title em {
	font-style: italic;
	color: var(--lab-cobalt);
}

body.tutor-frontend .tutor-learning-page .tel-hero__orbit {
	flex: none;
	width: clamp(120px, 18vw, 210px);
	height: auto;
	color: var(--lab-ink);
}

@media (max-width: 640px) {
	body.tutor-frontend .tutor-learning-page .tel-hero {
		padding: 20px;
	}

	body.tutor-frontend .tutor-learning-page .tel-hero__orbit {
		display: none;
	}

	body.tutor-frontend .tutor-learning-page .tel-hero__brand {
		margin-bottom: 18px;
	}
}

/* Quiz question text: paragraphs made from line breaks (functions.php,
   tel_child_quiz_description_breaks) need a little air between them. The quiz
   screen is not always inside .tutor-learning-page, so this is scoped to the
   quiz title block only. */
body.tutor-frontend .tutor-quiz-question-title p {
	margin: 0 0 0.5em;
}

body.tutor-frontend .tutor-quiz-question-title p:last-child {
	margin-bottom: 0;
}
