/*
 * Course, lesson, topic and quiz content (TAU_Lesson_Display). Loaded on LearnDash pages.
 *
 * Per the design doc's template rules, everything is driven by CSS custom properties, so a
 * student-facing dark mode (or any restyle) only needs new values for the variables below, not new
 * rules. Override a variable, or a rule, in Appearance → Customize → Additional CSS.
 *
 * The same file styles the block editor for courses and lessons. In the editor, Tip box, Slide and
 * the code languages are block styles (is-style-*); converted content uses the older classes
 * (tau-callout, tau-shadow, language-*). Both are styled here. Syntax colors are in code-colors.css.
 */

body {
	--tau-lesson-bg: var(--global-palette7, #FFFFFF);
	--tau-lesson-text: var(--global-palette4, #334155);
	--tau-lesson-heading: var(--global-palette3, #0B192C);
	--tau-lesson-muted: var(--global-palette5, #64748B);
	--tau-lesson-border: #E2E8F0;
	--tau-lesson-surface: #F1F5F9;
	--tau-lesson-surface-alt: #F8FAFC;
	--tau-lesson-accent: var(--global-palette2, #00A298);
	--tau-lesson-cta: var(--global-palette1, #FF5A1F);
	--tau-lesson-title-size: 32px;
	--tau-sidebar-width: 350px;
	--tau-image-max: 600px;

	/* Video player sizes (the Player size buttons under each video). Medium is the default; it
	   can be changed in Appearance → Customize → TAU video player. */
	--tau-video-course-small: 560px;
	--tau-video-course-medium: min(840px, calc((100vh - 240px) * 16 / 9)); /* fits the screen height */
	--tau-video-course-large: 100%;                                          /* the full course column */
	--tau-video-lesson-small: 560px;
	--tau-video-lesson-medium: 100%;                                         /* the text column */
	--tau-video-lesson-large: calc(100% + 2 * var(--tau-video-bleed));      /* into the side margins */
	--tau-video-bleed: 0px;                                                  /* set below for wide screens */
	--tau-video-control-text: var(--tau-lesson-muted);
	--tau-video-control-active: var(--tau-lesson-heading);
	--tau-video-control-accent: var(--tau-lesson-accent);
	--tau-shadow: 0 8px 24px rgba(11, 25, 44, 0.15);

	/* Code: dark container, JetBrains Mono (design doc, "Code Container & Syntax Highlighting Rules"). */
	--tau-code-font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--tau-code-bg: #0B192C;
	--tau-code-text: #E2E8F0;
	--tau-code-toolbar: #13243A;
	--tau-code-toolbar-text: #94A3B8;
	--tau-code-size: 14px;
	--tau-code-line: 1.5;
	--tau-inline-code-bg: #F1F5F9;
	--tau-inline-code-text: #334155;


	/* Tip boxes and quotes. */
	--tau-callout-bg: #EFFAF8;
	--tau-callout-accent: var(--tau-lesson-accent);
	--tau-warning-bg: #FEF6E4;
	--tau-warning-accent: #F9C967;
	--tau-quote-accent: var(--tau-lesson-cta);
}

/* Lesson titles: a little smaller, so more of the lesson shows on screen. */
.ld-focus-content h1 {
	font-size: var(--tau-lesson-title-size);
}

/* Images: smaller in the lesson, full size on click; slides keep their shadow. */
.ld-focus-content .wp-block-image {
	max-width: var(--tau-image-max);
	margin: 20px auto;
}
.wp-block-image.tau-shadow img,
.wp-block-image.is-style-tau-slide img {
	box-shadow: var(--tau-shadow);
	border-radius: 6px;
}

/* Videos on course pages and lessons, sized by the Player size buttons (TAU_Video_Player, video-size.js).
   The size comes from a class on <body>; without one, Medium. Large lessons use the side margins
   of LearnDash's lesson view on wide screens. */
@media (min-width: 1100px) {
	body {
		--tau-video-bleed: 85px;
	}
}
.single-sfwd-courses {
	--tau-video-width: var(--tau-video-course-medium);
	--tau-video-room: 100%;
}
.single-sfwd-courses.tau-video-small { --tau-video-width: var(--tau-video-course-small); }
.single-sfwd-courses.tau-video-large { --tau-video-width: var(--tau-video-course-large); }
.single-sfwd-lessons,
.single-sfwd-topic {
	--tau-video-width: var(--tau-video-lesson-medium);
	--tau-video-room: calc(100% + 2 * var(--tau-video-bleed));
}
.single-sfwd-lessons.tau-video-small,
.single-sfwd-topic.tau-video-small { --tau-video-width: var(--tau-video-lesson-small); }
.single-sfwd-lessons.tau-video-large,
.single-sfwd-topic.tau-video-large { --tau-video-width: var(--tau-video-lesson-large); }

.learndash-wrapper figure.wp-block-embed.is-type-video,
.ld-focus-content figure.wp-block-embed.is-type-video,
.tau-video-size {
	--tau-video-final: min(var(--tau-video-width, 100%), var(--tau-video-room, 100%));
	width: var(--tau-video-final);
	max-width: none;
	margin-left: calc((100% - var(--tau-video-final)) / 2);
	margin-right: calc((100% - var(--tau-video-final)) / 2);
}
.learndash-wrapper figure.wp-block-embed.is-type-video,
.ld-focus-content figure.wp-block-embed.is-type-video {
	margin-bottom: 8px;
}

/* The Player size buttons, right-aligned under the video. */
.tau-video-size {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
	gap: 4px 12px;
	margin-top: 0;
	margin-bottom: 24px;
	font-size: 13px;
	color: var(--tau-video-control-text);
}
.tau-video-size-option {
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	padding: 2px 0;
	font: inherit;
	color: inherit;
	cursor: pointer;
}
/* The theme gives buttons a colored background on hover and focus; these stay plain text. */
.tau-video-size-option:hover,
.tau-video-size-option:focus,
.tau-video-size-option:active {
	background: none;
	box-shadow: none;
	color: var(--tau-video-control-active);
}
.tau-video-size-option:focus-visible {
	outline: 2px solid var(--tau-video-control-accent);
	outline-offset: 2px;
}
.tau-video-size-option[aria-pressed="true"] {
	color: var(--tau-video-control-active);
	font-weight: 600;
	border-bottom-color: var(--tau-video-control-accent);
}

/* Tip boxes (:::tip on the old site; "Tip box" in the editor). */
.tau-callout,
.wp-block-group.is-style-tau-tip {
	background: var(--tau-callout-bg);
	border-left: 4px solid var(--tau-callout-accent);
	border-radius: 8px;
	padding: 16px 20px;
	margin: 24px 0;
}
/* Warning boxes (:::warning and :::danger on the old site; "Warning box" in the editor). */
.tau-callout.tau-callout-warning,
.tau-callout.tau-callout-danger,
.wp-block-group.is-style-tau-warning {
	background: var(--tau-warning-bg);
	border-left: 4px solid var(--tau-warning-accent);
	border-radius: 8px;
	padding: 16px 20px;
	margin: 24px 0;
}
.tau-callout .tau-callout-title,
.is-style-tau-tip .tau-callout-title,
.is-style-tau-warning .tau-callout-title {
	margin: 0 0 4px;
}
.tau-callout > :last-child,
.is-style-tau-tip > :last-child,
.is-style-tau-warning > :last-child {
	margin-bottom: 0;
}

/* Tables: bordered, shaded header, striped rows. */
.learndash-wrapper .wp-block-table table,
.ld-focus-content .wp-block-table table,
.editor-styles-wrapper .wp-block-table table {
	border-collapse: collapse;
	width: 100%;
	font-size: 15px;
	line-height: 1.5;
}
.learndash-wrapper .wp-block-table th,
.learndash-wrapper .wp-block-table td,
.ld-focus-content .wp-block-table th,
.ld-focus-content .wp-block-table td,
.editor-styles-wrapper .wp-block-table th,
.editor-styles-wrapper .wp-block-table td {
	border: 1px solid var(--tau-lesson-border);
	padding: 10px 14px;
	vertical-align: top;
}
.learndash-wrapper .wp-block-table thead th,
.ld-focus-content .wp-block-table thead th,
.editor-styles-wrapper .wp-block-table thead th {
	background: var(--tau-lesson-surface);
	color: var(--tau-lesson-heading);
	font-weight: 600;
	text-align: left;
}
.learndash-wrapper .wp-block-table tbody tr:nth-child(even) td,
.ld-focus-content .wp-block-table tbody tr:nth-child(even) td,
.editor-styles-wrapper .wp-block-table tbody tr:nth-child(even) td {
	background: var(--tau-lesson-surface-alt);
}

/* Quotes. */
.learndash-wrapper .wp-block-quote,
.ld-focus-content .wp-block-quote,
.editor-styles-wrapper .wp-block-quote {
	border-left: 4px solid var(--tau-quote-accent);
	padding: 4px 0 4px 20px;
	margin: 24px 0;
	font-style: italic;
}

/* Code blocks: dark container with a toolbar (language badge, Copy), added by lesson.js. */
.learndash-wrapper .wp-block-code,
.ld-focus-content .wp-block-code,
.editor-styles-wrapper .wp-block-code {
	position: relative;
	background: var(--tau-code-bg);
	color: var(--tau-code-text);
	border: 0;
	border-radius: 10px;
	padding: 44px 20px 18px;
	font-family: var(--tau-code-font);
	font-size: var(--tau-code-size);
	line-height: var(--tau-code-line);
	overflow-x: auto;
	white-space: pre;
}
.learndash-wrapper .wp-block-code code,
.ld-focus-content .wp-block-code code,
.editor-styles-wrapper .wp-block-code code {
	background: none;
	color: inherit;
	padding: 0;
	font: inherit;
}
.tau-code-toolbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 10px;
	height: 32px;
	padding: 0 10px;
	background: var(--tau-code-toolbar);
	border-radius: 10px 10px 0 0;
	font-family: var(--tau-code-font);
	font-size: 11px;
	letter-spacing: 0.06em;
	color: var(--tau-code-toolbar-text);
}
.tau-code-lang {
	text-transform: uppercase;
}
.tau-code-copy {
	background: none;
	border: 1px solid currentColor;
	border-radius: 4px;
	color: inherit;
	font: inherit;
	letter-spacing: 0.04em;
	padding: 2px 8px;
	cursor: pointer;
}
.tau-code-copy:hover,
.tau-code-copy:focus-visible {
	color: var(--tau-code-text);
}

/* Inline code in text. */
.learndash-wrapper :not(pre) > code,
.ld-focus-content :not(pre) > code,
.editor-styles-wrapper :not(pre) > code {
	font-family: var(--tau-code-font);
	font-size: var(--tau-code-size);
	background: var(--tau-inline-code-bg);
	color: var(--tau-inline-code-text);
	padding: 1px 6px;
	border-radius: 4px;
}

/* In the editor there's no toolbar (it's added on the page), so no room is kept for it. */
.editor-styles-wrapper .wp-block-code {
	padding-top: 18px;
}
