/**
 * Shared primitives.
 *
 * Only things used by three or more surfaces live here. Page-specific styling
 * belongs in marketing.css, learndash.css or buddyboss.css so the specificity
 * story stays readable: base sets, the others adjust.
 */

/* BuddyBoss sets this globally, but relying on the parent for it means every
   padded grid item overflows its track anywhere the parent sheet is absent —
   wp-login.php, the block editor, an isolated preview. Declared here too;
   matching the parent's value makes it a no-op on the front end. */
*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	background: var(--rcm-bg);
	color: var(--rcm-fg);
	font-family: var(--rcm-font-sans);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
.rcm-display {
	font-family: var(--rcm-font-display);
	letter-spacing: -0.03em;
	text-wrap: balance;
	color: var(--rcm-fg);
}

p {
	text-wrap: pretty;
}

/* Body copy caps at ~70 characters. Long measures are the fastest way to make
   a course description feel like a wall of text on a phone. */
.rcm-prose p {
	max-width: 68ch;
	line-height: 1.65;
}

html {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* Keyboard focus must stay visible everywhere, including inside BuddyBoss
   components that reset outlines. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 3px solid var(--rcm-gold);
	outline-offset: 2px;
	border-radius: var(--rcm-radius-sm);
}

/* BuddyBoss defines .screen-reader-text, but depending on the parent to hide
   accessibility labels means they become visible anywhere the parent sheet is
   missing — wp-login.php, for one. Defined here too. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	clip: auto;
	white-space: normal;
}

.rcm-skip-link:focus {
	left: 1rem;
	top: 1rem;
	width: auto;
	height: auto;
	padding: 0.75rem 1rem;
	background: var(--rcm-navy);
	color: #fff;
	z-index: 9999;
}

/* Icons are inline SVG inheriting currentColor. Sizing them here rather than on
   each <svg> keeps every call site to a single class. */
.rcm-icon {
	width: 1.25em;
	height: 1.25em;
	flex: 0 0 auto;
	vertical-align: middle;
}

.rcm-btn .rcm-icon,
.rcm-badge .rcm-icon,
.rcm-hero__kicker .rcm-icon {
	width: 1em;
	height: 1em;
}

.rcm-stat__icon .rcm-icon {
	width: 1.75rem;
	height: 1.75rem;
}

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

.rcm-container {
	width: 100%;
	max-width: var(--rcm-container);
	margin-inline: auto;
	padding-inline: var(--rcm-gutter);
}

.rcm-container--narrow {
	max-width: var(--rcm-container-narrow);
}

.rcm-grid {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}

/* Horizontal scroller used for course and category rails on mobile. */

/* ---------------------------------------------------------------- buttons */

.rcm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.7rem 1.15rem;
	border: 1px solid transparent;
	border-radius: var(--rcm-radius);
	font-family: var(--rcm-font-sans);
	font-size: var(--rcm-text-sm);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.rcm-btn--lg {
	padding: 0.9rem 1.5rem;
	font-size: var(--rcm-text-base);
}

.rcm-btn--navy {
	background: var(--rcm-navy);
	color: #fff;
}

.rcm-btn--navy:hover,
.rcm-btn--navy:focus {
	background: var(--rcm-navy-hover);
	color: #fff;
}

.rcm-btn--gold {
	background: var(--rcm-gold);
	color: var(--rcm-gold-fg);
}

.rcm-btn--gold:hover,
.rcm-btn--gold:focus {
	background: var(--rcm-gold-bright);
	color: var(--rcm-gold-fg);
}

.rcm-btn--white {
	background: #fff;
	color: var(--rcm-navy-deep);
}

.rcm-btn--white:hover,
.rcm-btn--white:focus {
	background: var(--rcm-muted);
	color: var(--rcm-navy-deep);
}

.rcm-btn--outline {
	background: transparent;
	border-color: var(--rcm-border);
	color: var(--rcm-fg);
}

.rcm-btn--outline:hover,
.rcm-btn--outline:focus {
	border-color: var(--rcm-navy);
	color: var(--rcm-navy);
}

.rcm-btn--ghost {
	background: transparent;
	color: var(--rcm-navy);
	padding-inline: 0.5rem;
}

.rcm-btn--sm {
	padding: 0.5rem 0.85rem;
	font-size: var(--rcm-text-xs);
}

/* A 32px button is fine under a mouse and awkward under a thumb. On a touch
   device the small button grows to a hittable height without changing its
   visual weight on desktop. */
@media (pointer: coarse) {
	.rcm-btn--sm {
		min-height: 2.5rem;
		padding-block: 0.6rem;
	}
}

/* border-box is not optional here: .rcm-btn carries horizontal padding, so a
   plain width:100% resolves to 100% + padding and overflows its container. */
.rcm-btn--block {
	width: 100%;
	box-sizing: border-box;
}

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

.rcm-card {
	display: flex;
	flex-direction: column;
	background: var(--rcm-card);
	border: 1px solid var(--rcm-border);
	border-radius: var(--rcm-radius-lg);
	overflow: hidden;
	height: 100%;
}

.rcm-card--raised {
	border-color: transparent;
	box-shadow: var(--rcm-shadow-soft);
}

.rcm-card__media {
	aspect-ratio: 16 / 10;
	object-fit: cover;
	width: 100%;
	display: block;
	background: var(--rcm-muted);
}

.rcm-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem 1.1rem 1.25rem;
	flex: 1;
}

.rcm-card__title {
	font-size: var(--rcm-text-lg);
	font-weight: 700;
	margin: 0;
	line-height: 1.3;
}

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

.rcm-card__title a:hover {
	color: var(--rcm-navy);
}

.rcm-card__meta {
	font-size: var(--rcm-text-sm);
	color: var(--rcm-muted-fg);
	margin: 0;
}

.rcm-card__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: auto;
	padding-top: 0.85rem;
	border-top: 1px solid var(--rcm-border);
}

/* ----------------------------------------------------------------- badges */

.rcm-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.22rem 0.6rem;
	border-radius: var(--rcm-radius-pill);
	font-size: var(--rcm-text-xs);
	font-weight: 600;
	background: var(--rcm-muted);
	color: var(--rcm-muted-fg);
	width: fit-content;
}

.rcm-badge--navy {
	background: var(--rcm-navy-08);
	color: var(--rcm-navy);
}

.rcm-badge--gold {
	background: var(--rcm-gold-12);
	color: #7a5300;
}

.rcm-badge--live {
	background: rgb(180 35 24 / 0.1);
	color: var(--rcm-danger);
}

.rcm-price {
	font-family: var(--rcm-font-display);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--rcm-navy);
}

/* --------------------------------------------------------------- progress */

.rcm-progress {
	height: 0.375rem;
	border-radius: var(--rcm-radius-pill);
	background: var(--rcm-muted);
	overflow: hidden;
}

.rcm-progress__bar {
	height: 100%;
	border-radius: inherit;
	background: var(--rcm-navy);
}

/* ------------------------------------------------------------ dark panels */

.rcm-panel-deep {
	background: var(--rcm-navy-deep);
	color: #fff;
	border-radius: var(--rcm-radius-xl);
}

.rcm-panel-deep :is(h1, h2, h3, h4) {
	color: #fff;
}

.rcm-panel-deep p {
	color: rgb(255 255 255 / 0.75);
}

/* ------------------------------------------------------------- typography */

.rcm-eyebrow {
	font-size: var(--rcm-text-xs);
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--rcm-gold);
	margin: 0;
}

.rcm-section-title {
	font-size: var(--rcm-text-3xl);
	font-weight: 700;
	margin: 0.25rem 0 0;
}

/* --------------------------------------------------------------- helpers */

.rcm-mt {
	margin-top: 1.5rem;
}

/* The "view all" links sit beside the rail arrows and are dropped on phones,
   where the rail itself is the way to browse and the link is redundant. */
.rcm-hide-sm {
	display: none;
}

.rcm-btn[hidden],
.rcm-hide-sm[hidden] {
	display: none !important;
}

@media (min-width: 40rem) {
	.rcm-hide-sm {
		display: inline-flex;
	}
}

/* ----------------------------------------------------------------- rails */

/* Horizontal at every width, matching the mockup's HScroll: cards keep a fixed
   width and the row scrolls, rather than reflowing into a grid on desktop.
   Bleeding to the viewport edge on small screens is deliberate — a card
   half-visible at the edge is what tells someone there is more to swipe. */
/* stretch keeps every card in a rail the same height whatever the title
   length, so the Details/Enroll rows line up across the row. */
.rcm-rail {
	display: flex;
	align-items: stretch;
	gap: 0.75rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-bottom: 0.25rem;
	margin-inline: calc(var(--rcm-gutter) * -1);
	padding-inline: var(--rcm-gutter);
	scroll-padding-inline: var(--rcm-gutter);
}

.rcm-rail::-webkit-scrollbar {
	display: none;
}

.rcm-rail > * {
	scroll-snap-align: start;
	flex: 0 0 auto;
	width: 16rem;
}

.rcm-rail--units > * {
	width: 18rem;
}

.rcm-rail--groups > * {
	width: 20rem;
}

@media (min-width: 40rem) {
	.rcm-rail {
		margin-inline: 0;
		padding-inline: 0;
		scroll-padding-inline: 0;
	}
}

/* [hidden] is a UA display:none rule and loses to the display below, so it
   has to be restated. This is the second time this pattern has bitten — the
   rail buttons had it too. */
.rcm-rail-nav[hidden] {
	display: none;
}

.rcm-rail-nav {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-shrink: 0;
}

.rcm-rail-nav__btn {
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid var(--rcm-border);
	border-radius: 50%;
	background: var(--rcm-card);
	color: var(--rcm-fg);
	box-shadow: 0 1px 2px rgb(7 21 58 / 0.06);
	cursor: pointer;
	transition: border-color 0.16s ease, color 0.16s ease;
}

.rcm-rail-nav__btn:hover {
	border-color: var(--rcm-navy);
	color: var(--rcm-navy);
}

/* The UA rule [hidden] { display: none } loses to the class above, which sets
   display: grid. Without this the arrows stay visible on a rail that has
   nothing to scroll, and clicking them does nothing. */
.rcm-rail-nav__btn[hidden] {
	display: none;
}

/* Live rows are anchors, so their inner text nodes need to stack explicitly. */
.rcm-live__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.rcm-live__level,
.rcm-live__title,
.rcm-live__meta {
	display: block;
}

.rcm-how__title,
.rcm-how__text,
.rcm-group__program,
.rcm-group__name,
.rcm-group__meta {
	display: block;
}
