/*
 * Abule lesson styles for the MasterStudy course player.
 *
 * Lesson content carries only class names (no inline styles). Every color is a token,
 * redefined when MasterStudy toggles its dark mode class on the player content, so
 * lessons stay readable in both modes. Honors-only parts are hidden in Standard courses
 * by the body class the theme adds from the course's `abule_level` meta.
 */

@font-face { font-family: "Libre Caslon Text"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/libre-caslon-text-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Libre Caslon Text"; font-weight: 400; font-style: italic; font-display: swap; src: url("fonts/libre-caslon-text-italic-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400 500; font-style: normal; font-display: swap; src: url("fonts/inter-normal-400-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-mono-400.woff2") format("woff2"); }

.ab-lesson {
	--ab-ink: #252923;
	--ab-muted: #5C6158;
	--ab-line: #D3CBBB;
	--ab-sheet: #EAE3D5;
	--ab-sheet-line: #CBBFA8;
	--ab-moss: #5F6B55;
	--ab-ochre: #8E7A35;
	--ab-ochre-mark: #BDA65C;
	--ab-verm: #A44935;
	--ab-display: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
	--ab-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--ab-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

	max-width: 68ch;
	margin: 0 auto;
	color: var(--ab-ink);
	font: 400 17px/1.65 var(--ab-body);
}

.masterstudy-course-player-content_dark-mode .ab-lesson {
	--ab-ink: #ECE6DA;
	--ab-muted: #AEAA9F;
	--ab-line: rgba(236, 230, 218, 0.18);
	--ab-sheet: rgba(236, 230, 218, 0.06);
	--ab-sheet-line: rgba(236, 230, 218, 0.2);
	--ab-moss: #A6B298;
	--ab-ochre: #D2BC74;
	--ab-verm: #D9775F;
}

.ab-lesson :is(p, li, dd, dt, td, th, blockquote, figcaption, h2, h3, h4) { color: var(--ab-ink); }
.ab-lesson p { margin: 0 0 1em; }
.ab-lesson a { color: var(--ab-ink); text-decoration: underline; text-decoration-color: var(--ab-moss); text-underline-offset: 3px; }
.ab-lesson a:hover { text-decoration-color: var(--ab-ink); }

.ab-lesson h2,
.ab-lesson h3 {
	font-family: var(--ab-display);
	font-weight: 400;
	text-wrap: balance;
	letter-spacing: 0;
}
.ab-lesson h2 { font-size: clamp(26px, 3vw, 32px); line-height: 1.2; margin: 1.8em 0 0.6em; }
.ab-lesson h3 { font-size: 21px; line-height: 1.3; margin: 1.6em 0 0.5em; }
.ab-lesson > :first-child { margin-top: 0; }

/* Small uppercase labels */
.ab-lesson .ab-label {
	display: block;
	font: 500 11.5px/1.4 var(--ab-mono);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--ab-muted);
}

/* Cycle header */
.ab-cycle-head { padding-bottom: 22px; border-bottom: 1px solid var(--ab-ink); margin-bottom: 28px; }
.ab-cycle-head .ab-question {
	font-family: var(--ab-display);
	font-size: clamp(22px, 2.6vw, 27px);
	line-height: 1.3;
	margin: 8px 0 0;
}

/* Section opener: label over a hairline */
.ab-section { margin-top: 44px; padding-top: 12px; border-top: 1px solid var(--ab-line); }
.ab-section > .ab-label + h2 { margin-top: 12px; }

/* Archival source sheet */
.ab-source {
	margin: 26px 0;
	padding: 22px clamp(18px, 3vw, 28px) 18px;
	background: var(--ab-sheet);
	border: 1px solid var(--ab-sheet-line);
}
.ab-source .ab-cat {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--ab-sheet-line);
	font: 500 11.5px/1.4 var(--ab-mono);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--ab-muted);
}
.ab-source .ab-cat strong { color: var(--ab-ink); font-weight: 500; }
.ab-source h3 { margin: 14px 0 2px; font-size: 21px; }
.ab-source .ab-who { font-size: 14.5px; color: var(--ab-muted); margin: 0; }
.ab-source blockquote {
	margin: 16px 0 0;
	padding: 0;
	border: 0;
	background: none;
	font-family: var(--ab-display);
	font-size: 19px;
	line-height: 1.6;
	font-style: normal;
}
.ab-source blockquote p { margin: 0 0 0.8em; font: inherit; }
.ab-source .ab-gap { font-family: var(--ab-body); font-size: 14px; color: var(--ab-muted); }
.ab-source .ab-cite { margin: 12px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ab-muted); }

/* Close-reading questions under a source */
.ab-ask { margin: -8px 0 28px; font-size: 15.5px; }
.ab-ask .ab-label { color: var(--ab-moss); margin-bottom: 6px; }
.ab-ask ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }

/* Placeholder for archival images still to be sourced */
.ab-plate {
	margin: 26px 0;
	padding: 28px 18px;
	border: 1px dashed var(--ab-sheet-line);
	text-align: center;
	font-size: 14px;
	color: var(--ab-muted);
}

/* Key terms */
.ab-terms { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr); gap: 12px 22px; margin: 16px 0 0; }
.ab-terms dt { font-family: var(--ab-display); font-size: 17px; font-weight: 400; }
.ab-terms dd { margin: 0; font-size: 15.5px; }
@media (max-width: 560px) {
	.ab-terms { grid-template-columns: 1fr; gap: 2px; }
	.ab-terms dd { margin-bottom: 12px; }
}

/* Two-week path and task blocks */
.ab-steps { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.ab-steps li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 15.5px; line-height: 1.45; }
.ab-steps li .ab-label { color: var(--ab-moss); padding-top: 3px; }

.ab-task { margin: 20px 0; padding-top: 12px; border-top: 1px solid var(--ab-ink); }
.ab-task ul { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 5px; font-size: 16px; }

/* The resolution for discussion week */
.ab-resolved { margin: 8px 0 24px; padding: 24px 0; border-top: 1px solid var(--ab-ink); border-bottom: 1px solid var(--ab-ink); }
.ab-resolved p {
	font-family: var(--ab-display);
	font-size: clamp(23px, 3vw, 31px);
	line-height: 1.25;
	margin: 10px 0 0;
}

/* Rubric */
.ab-table { overflow-x: auto; margin: 12px 0 24px; }
.ab-table table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 15px; line-height: 1.45; border: 0; }
.ab-table th,
.ab-table td { text-align: left; vertical-align: top; padding: 11px 14px 11px 0; border: 0; border-bottom: 1px solid var(--ab-line); background: none; }
.ab-table th { font: 500 11.5px/1.4 var(--ab-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ab-muted); border-bottom-color: var(--ab-ink); }
.ab-table td:first-child { font-family: var(--ab-display); font-size: 16.5px; width: 22%; }

/* Honors-only parts */
.ab-honors-tag { display: inline-flex; align-items: center; gap: 7px; color: var(--ab-ochre); }
.ab-honors-tag::before { content: ""; width: 8px; height: 8px; background: var(--ab-ochre-mark); }
body.ab-level-standard .ab-honors,
body.ab-level-honors .ab-standard-only { display: none !important; }

/*
 * MasterStudy colors player text and links (with its accent) at higher specificity,
 * which beat the tokens above in dark mode. These restate the lesson colors so ours win.
 */
html body .ab-lesson.ab-lesson { color: var(--ab-ink); }
html body .ab-lesson.ab-lesson :is(p, li, dd, dt, td, blockquote, h2, h3, h4, strong, em, a) { color: var(--ab-ink); }
html body .ab-lesson.ab-lesson :is(.ab-label, .ab-who, .ab-cite, .ab-gap, .ab-cat, .ab-plate, th) { color: var(--ab-muted); }
html body .ab-lesson.ab-lesson :is(.ab-ask .ab-label, .ab-steps .ab-label, .ab-resolved .ab-label) { color: var(--ab-moss); }
html body .ab-lesson.ab-lesson .ab-honors-tag { color: var(--ab-ochre); }
html body .ab-lesson.ab-lesson :is(.ab-cat strong, .ab-cite a) { color: var(--ab-ink); }
/* stm_lms.css sets `a { text-decoration: none !important }`. */
html body .ab-lesson.ab-lesson a { text-decoration: underline !important; text-decoration-color: var(--ab-moss) !important; text-underline-offset: 3px; }

/* Photographs, with a credit line under each */
.ab-lesson .ab-figure { margin: 28px 0; }
.ab-lesson .ab-figure img { display: block; width: 100%; height: auto; }
.ab-lesson .ab-figure figcaption { margin-top: 10px; font-size: 14.5px; line-height: 1.5; }
.ab-lesson .ab-figure .ab-credit { display: block; margin-top: 3px; font-size: 12.5px; }
html body .ab-lesson.ab-lesson .ab-figure .ab-credit,
html body .ab-lesson.ab-lesson .ab-figure .ab-credit a { color: var(--ab-muted); }
.ab-lesson .ab-figure-wide { margin-left: calc(-1 * clamp(0px, 4vw, 48px)); margin-right: calc(-1 * clamp(0px, 4vw, 48px)); }
.ab-lesson .ab-figure-portrait { max-width: 440px; }
.ab-lesson .ab-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin: 28px 0; align-items: start; }
.ab-lesson .ab-pair .ab-figure { margin: 0; }
@media (max-width: 560px) { .ab-lesson .ab-pair { grid-template-columns: 1fr; } }
.ab-source .ab-figure { margin: 18px 0 6px; }

/* Video */
.ab-lesson .ab-video { margin: 28px 0; }
.ab-lesson .ab-video .ab-frame { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: #000; }
.ab-lesson .ab-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ab-lesson .ab-video figcaption { margin-top: 10px; font-size: 14.5px; line-height: 1.5; }

/*
 * H5P activities sit on a paper sheet in both modes: H5P draws its own light
 * widgets, so the sheet keeps them readable when the player goes dark.
 */
.ab-lesson .ab-activity { margin: 30px 0; }
.ab-lesson .ab-activity > .ab-label { margin-bottom: 6px; }
.ab-lesson .ab-activity > p { font-size: 15.5px; }
.ab-lesson .ab-activity .ab-h5p { background: #F3F0E8; border: 1px solid var(--ab-sheet-line); padding: 8px; color: #252923; }
.ab-lesson .ab-h5p .h5p-content { background: #F3F0E8; font-family: var(--ab-body); }
.ab-lesson .ab-h5p .h5p-joubelui-button,
.ab-lesson .ab-h5p .h5p-question-check-answer,
.ab-lesson .ab-h5p .h5p-dialogcards .h5p-dialogcards-turn { background: #252923 !important; border-color: #252923 !important; color: #F3F0E8 !important; box-shadow: none !important; border-radius: 2px !important; font-family: var(--ab-body) !important; }
.ab-lesson .ab-h5p .h5p-joubelui-button:hover { background: #3a3f37 !important; }
.ab-lesson .ab-h5p .h5p-dialogcards-card-text-area,
.ab-lesson .ab-h5p .h5p-dialogcards-card-text { font-family: var(--ab-display); color: #252923; }
.ab-lesson .ab-h5p .h5p-image-hotspots-header { font-family: var(--ab-display); }
.ab-lesson .ab-h5p .h5p-dragquestion .h5p-draggable { font-family: var(--ab-body); }
