/**
 * TMC LMS theme styles.
 *
 * --ld-primary / --ld-secondary / --ld-tertiary are injected at runtime from
 * LearnDash's own palette (see TMC\Theme\learndash_color_variables), so the
 * theme and the plugin's UI stay in step. Everything else is defined here.
 */

/* ---------------------------------------------------------------- tokens */

:root {
	--ink:        #16191d;
	--ink-soft:   #454b54;
	--ink-mute:   #6b7280;
	--line:       #e2e5ea;
	--line-soft:  #eef0f3;
	--bg:         #ffffff;
	--bg-alt:     #f7f8fa;
	--bg-sunk:    #eff1f4;

	/* Injected from LearnDash's palette at runtime; these are only fallbacks.
	   Keep them identical to $defaults in TMC\Theme\learndash_color_variables()
	   — that runs through wp_add_inline_style() and therefore overrides these,
	   so if the two disagree the values below never take effect.
	   The roles are LearnDash's, not ours:
	     primary   — brand and general actions
	     secondary — affirmative/progress. LearnDash applies it to Mark Complete,
	                 .ld-status-complete, the progress bar, the in-progress icon
	                 and success alerts, and to nothing else. Badly named, but it
	                 is the success colour, which is why it is green here.
	     tertiary  — alerts and warnings */
	--ld-primary:   #3E6E92;
	--ld-secondary: #2F6F3E;
	--ld-tertiary:  #B4442F;

	/* Links stay blue and stable regardless of the LearnDash palette — they are
	   navigation, not affirmative actions, so they must not follow the success
	   colour. */
	--link: #2C5F7C;

	--radius:    10px;
	--radius-sm: 6px;
	--shadow:    0 1px 2px rgba(16, 19, 23, .06), 0 4px 16px rgba(16, 19, 23, .06);
	--shadow-lg: 0 2px 4px rgba(16, 19, 23, .06), 0 12px 32px rgba(16, 19, 23, .10);

	--wrap:  1180px;
	--gap:   clamp(1rem, 3vw, 2rem);

	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	--step--1: clamp(.82rem, .8rem + .1vw, .88rem);
	--step-0:  clamp(1rem, .97rem + .15vw, 1.06rem);
	--step-1:  clamp(1.2rem, 1.1rem + .4vw, 1.4rem);
	--step-2:  clamp(1.5rem, 1.3rem + .8vw, 2rem);
	--step-3:  clamp(1.9rem, 1.5rem + 1.6vw, 2.9rem);
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: var(--step-0);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
	margin: 0 0 .5em;
	line-height: 1.2;
	letter-spacing: -.02em;
	font-weight: 650;
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1em; }

a {
	color: var(--link);
	text-decoration-thickness: 1px;
	text-underline-offset: .15em;
}

a:hover { text-decoration-thickness: 2px; }

img,
video { max-width: 100%; height: auto; display: block; }

:focus-visible {
	outline: 2px solid var(--link);
	outline-offset: 2px;
	border-radius: 3px;
}

/* ---------------------------------------------------------------- layout */

.site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.site-content { flex: 1 0 auto; padding: var(--gap) 0 calc(var(--gap) * 2); }

.wrap {
	width: min(100% - 2.5rem, var(--wrap));
	margin-inline: auto;
}

/* --------------------------------------------------------- accessibility */

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100000;
	padding: .75rem 1.25rem;
	background: var(--ink);
	color: #fff;
	text-decoration: none;
	border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- header */

.site-masthead {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(255, 255, 255, .92);
	backdrop-filter: saturate(140%) blur(10px);
	border-bottom: 1px solid var(--line);
}

/* The admin bar is fixed on desktop; offset so it doesn't cover the header. */
.admin-bar .site-masthead { top: 32px; }

@media (max-width: 782px) {
	.admin-bar .site-masthead { top: 46px; }
}

.site-masthead__inner {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	min-height: 68px;
	padding-block: .5rem;
}

.site-brand { margin-right: auto; }

.site-brand__title {
	margin: 0;
	font-size: 1.12rem;
	font-weight: 700;
	letter-spacing: -.02em;
}

.site-brand__link {
	color: var(--ink);
	text-decoration: none;
}

.site-brand__tagline {
	margin: .1rem 0 0;
	font-size: var(--step--1);
	color: var(--ink-mute);
}

.custom-logo { max-height: 48px; width: auto; }

/* ------------------------------------------------------------ navigation */

.nav__list {
	display: flex;
	align-items: center;
	gap: .35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nav__list a,
.nav a {
	display: block;
	padding: .5rem .8rem;
	border-radius: var(--radius-sm);
	color: var(--ink-soft);
	font-size: var(--step--1);
	font-weight: 550;
	text-decoration: none;
	white-space: nowrap;
}

.nav a:hover,
.nav .current-menu-item > a {
	background: var(--bg-sunk);
	color: var(--ink);
}

.nav .nav__link--cta,
.nav .menu-item--cta > a {
	background: var(--ld-primary);
	color: #fff;
}

.nav .nav__link--cta:hover { filter: brightness(1.08); }

/* Sub-menus */
.nav .sub-menu {
	position: absolute;
	min-width: 200px;
	margin: 0;
	padding: .35rem;
	list-style: none;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity .14s, transform .14s, visibility .14s;
}

.nav li { position: relative; }

.nav li:hover > .sub-menu,
.nav li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.nav-toggle {
	display: none;
	width: 42px; height: 42px;
	padding: 0;
	background: none;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	display: block;
	width: 18px; height: 2px;
	margin-inline: auto;
	background: var(--ink);
	border-radius: 2px;
	transition: transform .16s;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: relative; }
.nav-toggle__bars::before { top: -5px; }
.nav-toggle__bars::after  { top: 3px; }

@media (max-width: 860px) {
	.nav-toggle { display: block; }

	.nav {
		position: absolute;
		inset: 100% 0 auto;
		display: none;
		padding: .6rem 1.25rem 1rem;
		background: var(--bg);
		border-bottom: 1px solid var(--line);
		box-shadow: var(--shadow);
	}

	.nav.is-open { display: block; }

	.nav__list,
	.nav ul { flex-direction: column; align-items: stretch; gap: .1rem; }

	.nav .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		border: 0;
		box-shadow: none;
		padding-left: .8rem;
	}
}

/* ----------------------------------------------------------- page header */

.page-header {
	padding-bottom: 1.25rem;
	margin-bottom: calc(var(--gap) * 1.2);
	border-bottom: 1px solid var(--line);
}

.page-header__title { margin: 0; }

.page-header__intro { margin: .75rem 0 0; color: var(--ink-mute); }

/* -------------------------------------------------------------- entries */

.entry { max-width: 78ch; }

.entry--page,
.tmc-learndash .entry { max-width: none; }

.entry__header { margin-bottom: 1.5rem; }

.entry__title { margin: 0 0 .35rem; }

.entry__meta { margin: 0; color: var(--ink-mute); font-size: var(--step--1); }

.entry__media { margin: 0 0 1.5rem; border-radius: var(--radius); overflow: hidden; }

.entry__content > * + * { margin-top: 1em; }

.entry__content h2,
.entry__content h3 { margin-top: 1.6em; }

/* ---------------------------------------------------------- course cards */

.course-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--gap);
}

.course-card {
	display: flex;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	transition: transform .16s, box-shadow .16s, border-color .16s;
}

.course-card:hover {
	transform: translateY(-2px);
	border-color: transparent;
	box-shadow: var(--shadow-lg);
}

.course-card__link {
	display: flex;
	flex-direction: column;
	width: 100%;
	color: inherit;
	text-decoration: none;
}

.course-card__media {
	aspect-ratio: 16 / 10;
	background: var(--bg-sunk);
	overflow: hidden;
}

.course-card__media img { width: 100%; height: 100%; object-fit: cover; }

.course-card__placeholder {
	display: block;
	width: 100%; height: 100%;
	background:
		radial-gradient(120% 120% at 20% 10%, color-mix(in srgb, var(--ld-primary) 22%, transparent), transparent 60%),
		linear-gradient(140deg, var(--bg-sunk), var(--bg-alt));
}

.course-card__body { flex: 1 0 auto; padding: 1.1rem 1.2rem .25rem; }

.course-card__title { margin: 0 0 .4rem; font-size: 1.06rem; line-height: 1.3; }

.course-card__excerpt {
	margin: 0;
	color: var(--ink-mute);
	font-size: var(--step--1);
}

/* Pushed to the bottom of the card so the footer row lines up across a grid
   row regardless of how long each title or excerpt runs. Mirrors what
   LearnDash's own "Equal Grid Height" option does to its course-grid cards. */
.course-card__footer {
	display: flex;
	align-items: center;
	gap: .6rem;
	margin-top: auto;
	padding: .9rem 1.2rem 1.1rem;
}

.course-card__cta {
	margin-left: auto;
	color: var(--link);
	font-size: var(--step--1);
	font-weight: 600;
}

.course-card__link:hover .course-card__cta { text-decoration: underline; }

/* ------------------------------------------------------------ course hero */

.course__hero {
	padding: calc(var(--gap) * 1.4) 0;
	margin-bottom: var(--gap);
	background: linear-gradient(160deg, var(--bg-alt), var(--bg-sunk));
	border-bottom: 1px solid var(--line);
}

.course__hero-inner {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
	align-items: center;
	gap: var(--gap);
}

@media (max-width: 800px) {
	.course__hero-inner { grid-template-columns: 1fr; }
	.course__hero-media { order: -1; }
}

.course__eyebrow {
	margin: 0 0 .4rem;
	color: var(--ld-primary);
	font-size: var(--step--1);
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.course__title { margin: 0; }

.course__summary {
	max-width: 60ch;
	margin: .75rem 0 0;
	color: var(--ink-soft);
	font-size: var(--step-1);
}

.course__status {
	display: inline-block;
	margin: 1rem 0 0;
	padding: .35rem .8rem;
	border-radius: 999px;
	font-size: var(--step--1);
	font-weight: 600;
}

.course__status--enrolled {
	background: color-mix(in srgb, var(--ld-secondary) 14%, transparent);
	color: color-mix(in srgb, var(--ld-secondary) 82%, #000);
}

.course__hero-media { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

.course__body { padding-bottom: var(--gap); }

/* ----------------------------------------------------------- post cards */

.post-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: var(--gap);
}

.post-card {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}

.post-card__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.post-card__body { padding: 1.1rem 1.2rem; }

.post-card__title { margin: 0 0 .3rem; font-size: 1.08rem; }

.post-card__title a { color: inherit; text-decoration: none; }

.post-card__title a:hover { color: var(--link); }

.post-card__meta { margin: 0 0 .6rem; color: var(--ink-mute); font-size: var(--step--1); }

.post-card__excerpt { color: var(--ink-soft); font-size: var(--step--1); }

.post-card__excerpt p:last-child { margin-bottom: 0; }

/* --------------------------------------------------- buttons, tags, bits */

.button,
.entry__content .wp-block-button__link {
	display: inline-block;
	padding: .6rem 1.15rem;
	background: var(--ld-primary);
	color: #fff;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	font-size: var(--step--1);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.button:hover { filter: brightness(1.08); }

.button--ghost {
	background: transparent;
	color: var(--ink);
	border-color: var(--line);
}

.button--ghost:hover { background: var(--bg-sunk); filter: none; }

.tag {
	display: inline-block;
	padding: .2rem .6rem;
	border-radius: 999px;
	font-size: .76rem;
	font-weight: 650;
	letter-spacing: .01em;
}

.tag--enrolled {
	background: color-mix(in srgb, var(--ld-secondary) 14%, transparent);
	color: color-mix(in srgb, var(--ld-secondary) 82%, #000);
}

.notice {
	padding: calc(var(--gap) * 1.2);
	background: var(--bg-alt);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.notice--center { text-align: center; }

.notice__title { margin-top: 0; }

.notice__actions {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
	justify-content: center;
	margin: 1.25rem 0;
}

/* ------------------------------------------------------------ search form */

.search-form { display: flex; gap: .5rem; max-width: 460px; }

.search-form__field {
	flex: 1;
	min-width: 0;
	padding: .55rem .8rem;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	font: inherit;
	font-size: var(--step--1);
}

.notice--center .search-form { margin-inline: auto; }

/* ------------------------------------------------------------- pagination */

.pagination {
	display: flex;
	justify-content: center;
	margin-top: calc(var(--gap) * 1.5);
}

.pagination .nav-links { display: flex; gap: .3rem; flex-wrap: wrap; }

.pagination .page-numbers {
	display: grid;
	place-items: center;
	min-width: 40px; height: 40px;
	padding-inline: .6rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	color: var(--ink-soft);
	text-decoration: none;
	font-size: var(--step--1);
}

.pagination .page-numbers:hover { background: var(--bg-sunk); }

.pagination .page-numbers.current {
	background: var(--ink);
	border-color: var(--ink);
	color: #fff;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
	padding: calc(var(--gap) * 1.6) 0;
	background: var(--bg-alt);
	border-top: 1px solid var(--line);
	color: var(--ink-mute);
	font-size: var(--step--1);
}

.site-footer__widgets {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--gap);
	margin-bottom: var(--gap);
}

.site-footer__menu {
	display: flex;
	flex-wrap: wrap;
	gap: .3rem 1.2rem;
	margin: 0 0 1rem;
	padding: 0;
	list-style: none;
}

.site-footer__menu a { color: var(--ink-soft); text-decoration: none; }

.site-footer__menu a:hover { text-decoration: underline; }

.site-footer__legal { margin: 0; }

/* --------------------------------------------------- LearnDash integration
 *
 * LearnDash renders its own markup inside .learndash-wrapper. These rules only
 * align its typography and controls with the theme — the plugin keeps ownership
 * of structure, and Focus Mode (enabled on this site) renders lessons, topics
 * and quizzes in its own shell entirely outside the theme.
 */

.learndash-wrapper { font-family: var(--font); }

.learndash-wrapper .ld-item-list-item {
	border-radius: var(--radius-sm);
	border-color: var(--line);
}

.learndash-wrapper .ld-button,
.learndash-wrapper .btn-join,
.learndash-wrapper #btn-join {
	border-radius: var(--radius-sm);
	font-weight: 600;
	letter-spacing: 0;
}

.learndash-wrapper .ld-course-status { border-radius: var(--radius); }

/* Course grid cards (the LearnDash block used on /courses/).
 *
 * LearnDash's own "Equal Grid Height" option squares up the card boxes, but
 * the thumbnails inside them still vary — the source images run from 336x155
 * to roughly square — which leaves each title sitting at a different height.
 * Pinning the image well to one ratio fixes the alignment.
 *
 * `contain`, not `cover`: these thumbnails are company logos, and cropping
 * them to fill would cut into the marks. A course with no featured image gets
 * an empty well of the same height rather than a collapsed card.
 *
 * This theme's stylesheet loads after the course-grid card CSS, so plain
 * specificity is enough — no !important needed.
 */
.learndash-course-grid .grid > .item .thumbnail .image {
	display: grid;
	place-items: center;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--bg);
}

.learndash-course-grid .grid > .item .thumbnail .image a {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
}

.learndash-course-grid .grid > .item .thumbnail .image img {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* The enrolled-course list on /my-courses/.
 *
 * This is LearnDash's *legacy* "Course Grid v1", which is a different
 * component from the course-grid block on /courses/ and has no equal-height
 * option. It ships a bundled Bootstrap grid: .ld-course-list-items.row is a
 * flex row and each .ld_course_grid carries .col-md-4 with a fixed flex-basis
 * and max-width.
 *
 * Note the wrapper here is .learndash-wrap, NOT .learndash-wrapper — the two
 * are different classes and only the former appears on this page.
 *
 * Swapping the row to CSS Grid gives equal-height cells for free (grid items
 * stretch by default), so the columns are neutralised rather than fought.
 * This stylesheet loads after the legacy skin, so specificity alone is enough.
 */
.ld-course-list-items.row {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--gap);
	margin: 0;
}

/* BoldGrid's editor-fe.min.css applies Bootstrap 3 clearfix pseudo-elements to
   every .row (`display:table; content:" "`). Harmless over floats, but in a
   grid container ::before and ::after become grid ITEMS and take the first and
   last cells — which left an empty slot before the first card. Higher
   specificity than BoldGrid's bare `.row:before`, so this wins on cascade. */
.ld-course-list-items.row::before,
.ld-course-list-items.row::after {
	display: none;
}

/* Undo the Bootstrap column sizing so the grid controls the track width. */
.ld-course-list-items.row > .ld_course_grid {
	flex: none;
	width: auto;
	max-width: none;
	margin: 0;
	padding: 0;
}

/* The card fills its cell, so every card in a row ends level. */
.ld-course-list-items.row > .ld_course_grid > article.course {
	display: flex;
	flex-direction: column;
	height: 100%;
	margin: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg);
}

/* Uniform image well. `contain` for the same reason as the catalogue: these
   thumbnails are logos and cropping to fill would cut into the marks. */
.ld-course-list-items.row > .ld_course_grid > article.course > a {
	display: grid;
	place-items: center;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--bg);
}

.ld-course-list-items.row > .ld_course_grid > article.course > a img {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* Caption takes the slack; the button is pinned to the bottom so the CTAs
   line up across the row however long the titles run. */
.ld-course-list-items.row .caption {
	display: flex;
	flex-direction: column;
	flex: 1 0 auto;
	padding: 1.1rem 1.2rem 1.2rem;
}

.ld-course-list-items.row .caption .entry-title {
	margin: 0 0 .75rem;
	font-size: 1.06rem;
	line-height: 1.3;
}

.ld-course-list-items.row .ld_course_grid_button {
	margin-top: auto;
	padding-top: .9rem;
}

/* The legacy skin ships Bootstrap's own .btn-primary blue; bring it onto the
   theme palette. */
.ld-course-list-items.row .ld_course_grid_button .btn,
.ld-course-list-items.row .ld_course_grid_button .btn-primary {
	display: block;
	width: 100%;
	padding: .6rem 1.15rem;
	background: var(--ld-primary);
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	color: #fff;
	font-size: var(--step--1);
	font-weight: 600;
	text-decoration: none;
	text-shadow: none;
}

.ld-course-list-items.row .ld_course_grid_button .btn:hover {
	background: var(--ld-primary);
	filter: brightness(1.08);
	color: #fff;
}

/* "Enrolled" is an affirmative state, so it takes the success colour rather
   than Bootstrap's brand blue — consistent with .tag--enrolled elsewhere.
 *
 * The legacy skin sets `.ribbon.enrolled { background:#428bca }` through a
 * five-class selector, so the full chain is repeated here to outweigh it
 * rather than reaching for !important. Its folded-corner ::before tail is
 * dropped: it sits at left:-8px and the card's overflow already clips it, so
 * it only ever rendered as a stray notch. */
.ld-course-list-items.row .ld_course_grid .thumbnail.course .ribbon,
.ld-course-list-items.row .ld_course_grid .thumbnail.course .ribbon.enrolled {
	left: 10px;
	top: 10px;
	padding: .2rem .6rem;
	background: var(--ld-secondary);
	border-radius: var(--radius-sm);
	box-shadow: none;
	color: #fff;
	font-size: .76rem;
	font-weight: 650;
	text-shadow: none;
}

.ld-course-list-items.row .ld_course_grid .thumbnail.course .ribbon::before,
.ld-course-list-items.row .ld_course_grid .thumbnail.course .ribbon.enrolled::before {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}
