/* Sponsored course modules (partials/affiliate). Shared by the PHP site and the WordPress blog. */

.aff-unit {
	--aff-ink: #222;
	--aff-line: #333;
	--aff-muted: #5b6270;
	--aff-accent: #ff6f61;
	--aff-accent-dark: #e85a4c;
	--aff-soft: #fff7e6;
	--aff-udemy: #a435f0;
	font-family: inherit;
	color: var(--aff-ink);
	box-sizing: border-box;
}

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

.aff-unit a {
	text-decoration: none;
}

.aff-unit img {
	display: block;
	max-width: 100%;
	height: auto;
}

.aff-sponsored {
	display: inline-block;
	font-size: 10px;
	line-height: 1;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--aff-muted);
	border: 1px solid #c9ced6;
	border-radius: 999px;
	padding: 4px 8px;
	background: #fff;
	white-space: nowrap;
}

.aff-eyebrow {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--aff-accent-dark);
}

.aff-badge {
	display: inline-flex;
	align-items: center;
	font-size: 11px;
	font-weight: 800;
	color: #fff;
	background: var(--aff-udemy);
	border-radius: 4px;
	padding: 3px 7px;
	line-height: 1.1;
}

.aff-price {
	font-size: 13px;
	color: var(--aff-ink);
}

.aff-price s {
	color: var(--aff-muted);
	margin-left: 2px;
}

.aff-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--aff-accent);
	color: #fff !important;
	font-weight: 800;
	font-size: 14px;
	border: 2px solid var(--aff-line);
	border-radius: 8px;
	padding: 9px 16px;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.aff-btn:hover,
.aff-btn:focus-visible {
	transform: translate(-2px, -2px);
	box-shadow: 4px 4px 0 var(--aff-line);
}

/* In-content card */
.aff-inline {
	margin: 28px 0;
	background: linear-gradient(135deg, #fffaf0 0%, #fff 60%);
	border: 2px solid var(--aff-line);
	border-radius: 14px;
	box-shadow: 4px 4px 0 var(--aff-line);
	padding: 16px;
}

.aff-inline__top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.aff-inline__body {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

@media (min-width: 640px) {
	.aff-inline__body {
		grid-template-columns: minmax(180px, 38%) 1fr;
		align-items: center;
	}
}

.aff-inline__thumb {
	display: block;
	border: 2px solid var(--aff-line);
	border-radius: 10px;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: #eee;
}

.aff-inline__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.aff-inline__thumb:hover img {
	transform: scale(1.04);
}

.aff-inline__heading {
	margin: 0 0 4px !important;
	font-size: 13px;
	font-weight: 600;
	color: var(--aff-muted);
}

.aff-inline__title {
	display: block;
	font-size: 18px;
	line-height: 1.3;
	font-weight: 800;
	color: var(--aff-ink) !important;
	margin-bottom: 6px;
}

.aff-inline__title:hover {
	text-decoration: underline;
}

.aff-inline__desc {
	margin: 0 0 10px !important;
	font-size: 14px;
	line-height: 1.5;
	color: #444;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.aff-inline__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: var(--aff-muted);
	margin-bottom: 12px;
}

.aff-inline__more {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px dashed #c9ced6;
	font-size: 13px;
	line-height: 1.6;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
}

.aff-inline__more-label {
	font-weight: 700;
	color: var(--aff-muted);
}

.aff-inline__more a {
	color: #1d4ed8 !important;
}

.aff-inline__more a:hover {
	text-decoration: underline;
}

/* Sidebar card */
.aff-side {
	background: #fff;
	border: 2px solid var(--aff-line);
	border-radius: 12px;
	padding: 16px;
	margin-bottom: 24px;
}

.aff-side__top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.aff-side__heading {
	margin: 0 !important;
	font-size: 17px;
	font-weight: 800;
}

.aff-side__list {
	list-style: none;
	margin: 0 !important;
	padding: 0 !important;
	display: grid;
	gap: 6px;
}

.aff-side__list li {
	margin: 0 !important;
	padding: 0;
}

.aff-side__item {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 8px;
	border-radius: 10px;
	border: 2px solid transparent;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.aff-side__item:hover {
	border-color: var(--aff-line);
	background: var(--aff-soft);
}

.aff-side__item img {
	width: 96px;
	height: 54px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	border: 1px solid #ddd;
}

.aff-side__text {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.aff-side__title {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--aff-ink);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.aff-side__meta {
	font-size: 12px;
	color: var(--aff-udemy);
	font-weight: 700;
}

.aff-side__note {
	margin: 10px 0 0 !important;
	font-size: 12px;
	color: var(--aff-muted);
}

/* Course grid (footer showcase, homepage, section pages) */
.aff-grid-wrap {
	margin: 32px 0;
}

.aff-grid-wrap__top {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 16px;
}

.aff-grid-wrap__heading {
	margin: 0 !important;
	font-size: 22px;
	line-height: 1.25;
	font-weight: 800;
}

.aff-grid-wrap__sub {
	margin: 4px 0 0 !important;
	font-size: 14px;
	color: var(--aff-muted);
}

.aff-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 18px;
}

@media (min-width: 640px) {
	.aff-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.aff-grid--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.aff-grid--4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.aff-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 2px solid var(--aff-line);
	border-radius: 12px;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	color: var(--aff-ink) !important;
}

.aff-card:hover,
.aff-card:focus-visible {
	transform: translate(-2px, -2px);
	box-shadow: 5px 5px 0 var(--aff-line);
}

.aff-card__img {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	background: #eee;
	border-bottom: 2px solid var(--aff-line);
}

.aff-card__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.aff-card__badge {
	position: absolute;
	top: 8px;
	left: 8px;
}

.aff-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px;
	flex: 1;
}

.aff-card__title {
	font-size: 15px;
	font-weight: 800;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.aff-card__desc {
	font-size: 13px;
	line-height: 1.45;
	color: #555;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.aff-card__foot {
	margin-top: auto;
	padding-top: 6px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
}

.aff-card__cta {
	margin-left: auto;
	font-size: 13px;
	font-weight: 800;
	color: var(--aff-accent-dark);
}

.aff-footer-showcase {
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 16px 8px;
}

/* Header strip */
.aff-strip {
	background: #fff3c4;
	border-bottom: 2px solid var(--aff-line);
	font-size: 14px;
}

.aff-strip__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 8px 12px;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 40px;
}

.aff-strip__icon {
	flex-shrink: 0;
	color: var(--aff-accent-dark);
}

.aff-strip__link {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--aff-ink) !important;
}

.aff-strip__label {
	font-weight: 800;
	white-space: nowrap;
}

.aff-strip__title {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aff-strip__cta {
	flex-shrink: 0;
	font-weight: 800;
	color: var(--aff-accent-dark);
	white-space: nowrap;
}

.aff-strip__link:hover .aff-strip__title {
	text-decoration: underline;
}

.aff-strip__close {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border: 0;
	background: transparent;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: var(--aff-muted);
	border-radius: 6px;
}

.aff-strip__close:hover {
	background: rgba(0, 0, 0, 0.06);
	color: var(--aff-ink);
}

@media (max-width: 639px) {
	.aff-strip {
		font-size: 13px;
	}

	.aff-strip__label,
	.aff-strip__ad {
		display: none;
	}

	.aff-strip__cta {
		font-size: 12px;
	}
}
