/* ==========================================================================
   ИАПП · mod_iapp_courses
   Карточки курсов и компактный список.
   Токены палитры берутся из user.css шаблона; в var() стоят запасные
   значения — если модуль поставят на страницу без шаблона, он не поплывёт.
   ========================================================================== */

.iapp-courses {
	--crs-navy: var(--iapp-navy-900, #14294a);
	--crs-navy-700: var(--iapp-navy-700, #1e3e67);
	--crs-blue: var(--iapp-blue-500, #36609c);
	--crs-blue-300: var(--iapp-blue-300, #90bae4);
	--crs-blue-100: var(--iapp-blue-100, #e4edf7);
	--crs-slate: var(--iapp-slate-500, #6b7a8c);
	--crs-line: var(--iapp-line, #d9e2ec);
	--crs-radius: 14px;
	--crs-gap: 24px;
}

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

/* Любой display, заданный классом, сильнее браузерного [hidden] — а вкладки и
   карусели прячут элементы именно атрибутом. Одно правило на весь модуль,
   иначе баг всплывает в каждом новом макете заново. */
.iapp-courses [hidden] { display: none !important; }

/* --- сетка ---------------------------------------------------------------- */

.iapp-courses__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--crs-gap);
	align-items: stretch;
}

.iapp-courses.cols-2 .iapp-courses__grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.iapp-courses.cols-4 .iapp-courses__grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1199.98px) {
	.iapp-courses.cols-4 .iapp-courses__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 991.98px) {
	.iapp-courses__grid,
	.iapp-courses.cols-4 .iapp-courses__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 639.98px) {
	.iapp-courses__grid,
	.iapp-courses.cols-2 .iapp-courses__grid,
	.iapp-courses.cols-4 .iapp-courses__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --- карточка ------------------------------------------------------------- */

.iapp-courses .iapp-course {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: #fff;
	border: 1px solid var(--crs-line);
	border-radius: var(--crs-radius);
	overflow: hidden;
	transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

@media (hover: hover) {
	.iapp-courses .iapp-course:hover {
		border-color: var(--crs-blue-300);
		box-shadow: 0 12px 28px rgba(20, 41, 74, .10);
		transform: translateY(-2px);
	}
}

.iapp-courses .iapp-course.is-done {
	background: #fbfcfd;
}

.iapp-courses .iapp-course.is-done .iapp-course__media img {
	filter: grayscale(1);
	opacity: .75;
}

/* картинка */

.iapp-courses .iapp-course__media {
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--crs-blue-100);
	overflow: hidden;
}

/* заглушка, когда у курса не задана картинка: ряд карточек не должен разъезжаться */
.iapp-courses .iapp-course__media.is-blank {
	position: relative;
	background: linear-gradient(135deg, var(--crs-blue-100) 0%, #f4f8fc 100%);
}

.iapp-courses .iapp-course__media.is-blank::after {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2390bae4' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5.5A1.5 1.5 0 0 1 5.5 4H10a2 2 0 0 1 2 2 2 2 0 0 1 2-2h4.5A1.5 1.5 0 0 1 20 5.5v12a1.5 1.5 0 0 1-1.5 1.5H14a2 2 0 0 0-2 2 2 2 0 0 0-2-2H5.5A1.5 1.5 0 0 1 4 17.5z'/%3E%3Cpath d='M12 6v14'/%3E%3C/svg%3E");
	content: "";
	opacity: .8;
}

.iapp-courses .iapp-course__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* тело */

.iapp-courses .iapp-course__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
}

/* верхняя строка меток */

.iapp-courses .iapp-course__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.iapp-courses .iapp-course__tag {
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--crs-blue-100);
	color: var(--crs-navy-700);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: .01em;
}

.iapp-courses .iapp-course__badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
}

.iapp-courses .iapp-course__badge.is-status::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	flex: none;
}

.iapp-courses .iapp-course__badge.is-open {
	background: #e6f4ec;
	color: #1d7a45;
}

.iapp-courses .iapp-course__badge.is-closed {
	background: #fdeeee;
	color: #a33232;
}

.iapp-courses .iapp-course__badge.is-going {
	background: #fff3e0;
	color: #9a5b12;
}

.iapp-courses .iapp-course__badge.is-done,
.iapp-courses .iapp-course__badge.is-nodate {
	background: #eef1f5;
	color: var(--crs-slate);
}

.iapp-courses .iapp-course__badge.is-free {
	background: var(--crs-navy);
	color: #fff;
}

/* заголовок */

.iapp-courses .iapp-course__title,
.iapp-courses h2.iapp-course__title,
.iapp-courses h3.iapp-course__title,
.iapp-courses h4.iapp-course__title,
.iapp-courses h5.iapp-course__title {
	margin: 0;
	color: var(--crs-navy);
	font-size: 19px;
	font-weight: 700;
	line-height: 1.32;
	letter-spacing: -.01em;
	text-wrap: balance;
}

.iapp-courses .iapp-course__title a {
	color: inherit;
	text-decoration: none;
}

@media (hover: hover) {
	.iapp-courses .iapp-course__title a:hover {
		color: var(--crs-blue);
	}
}

/* описание */

.iapp-courses .iapp-course__intro {
	margin: 0;
	color: var(--crs-slate);
	font-size: 14px;
	line-height: 1.55;
}

/* факты */

.iapp-courses .iapp-course__facts {
	display: flex;
	flex-direction: column;
	gap: 7px;
	margin: 2px 0 0;
	padding: 0;
	list-style: none;
}

.iapp-courses .iapp-course__facts li {
	position: relative;
	padding-left: 26px;
	color: var(--crs-navy-700);
	font-size: 14px;
	line-height: 1.45;
}

.iapp-courses .iapp-course__facts li::before {
	position: absolute;
	top: 50%;
	left: 0;
	width: 18px;
	height: 18px;
	margin-top: -9px;
	background: center / contain no-repeat;
	content: "";
	opacity: .65;
}

.iapp-courses .iapp-course__facts .is-date::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2336609c' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
}

.iapp-courses .iapp-course__facts .is-hours::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2336609c' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

.iapp-courses .iapp-course__facts .is-format::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2336609c' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='13' rx='2'/%3E%3Cpath d='M8 21h8'/%3E%3C/svg%3E");
}

.iapp-courses .iapp-course__facts .is-period::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2336609c' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M21 12a9 9 0 1 1-2.6-6.4'/%3E%3Cpath d='M21 4v5h-5'/%3E%3C/svg%3E");
}

.iapp-courses .iapp-course__note {
	color: var(--crs-slate);
	font-size: 13px;
}

.iapp-courses .iapp-course__note::before {
	content: " · ";
}

/* преподаватель */

.iapp-courses .iapp-course__teacher {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-top: auto;
	padding-top: 14px;
	border-top: 1px solid var(--crs-line);
}

.iapp-courses .iapp-course__avatar {
	display: block;
	flex: none;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--crs-blue-100);
}

.iapp-courses .iapp-course__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.iapp-courses .iapp-course__teacher a {
	color: var(--crs-navy-700);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

@media (hover: hover) {
	.iapp-courses .iapp-course__teacher a:hover {
		color: var(--crs-blue);
		text-decoration: underline;
	}
}

/* подвал карточки */

.iapp-courses .iapp-course__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: 14px;
	border-top: 1px solid var(--crs-line);
}

.iapp-courses .iapp-course__teacher + .iapp-course__foot {
	margin-top: 0;
	padding-top: 12px;
	border-top: 0;
}

.iapp-courses .iapp-course__price {
	color: var(--crs-navy);
	font-size: 15px;
	font-weight: 700;
}

.iapp-courses .iapp-course__price:empty {
	display: none;
}

/* кнопка */

.iapp-courses .iapp-course__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 18px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: var(--crs-blue);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

@media (hover: hover) {
	.iapp-courses .iapp-course__btn:hover {
		background: var(--crs-navy-700);
		color: #fff;
	}
}

.iapp-courses .iapp-course__btn.is-ghost {
	background: transparent;
	border-color: var(--crs-line);
	color: var(--crs-navy-700);
}

@media (hover: hover) {
	.iapp-courses .iapp-course__btn.is-ghost:hover {
		background: var(--crs-blue-100);
		border-color: var(--crs-blue-300);
		color: var(--crs-navy);
	}
}

.iapp-courses .iapp-course.is-done .iapp-course__btn {
	background: transparent;
	border-color: var(--crs-line);
	color: var(--crs-slate);
}

/* ссылка под списком */

.iapp-courses__more {
	margin: 28px 0 0;
	text-align: center;
}

.iapp-courses__more .iapp-course__btn {
	min-height: 46px;
	padding: 0 26px;
}

/* пусто */

.iapp-courses__empty {
	margin: 0;
	padding: 22px;
	border: 1px dashed var(--crs-line);
	border-radius: var(--crs-radius);
	color: var(--crs-slate);
	text-align: center;
}

/* ==========================================================================
   Компактный список
   ========================================================================== */

.iapp-courses.is-compact .iapp-courses__list {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--crs-line);
}

.iapp-courses .iapp-course-row {
	display: flex;
	gap: 16px;
	align-items: center;
	padding: 16px 0;
	border-bottom: 1px solid var(--crs-line);
}

.iapp-courses .iapp-course-row__date {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	border-radius: 12px;
	background: var(--crs-blue-100);
	color: var(--crs-navy-700);
	line-height: 1.1;
}

.iapp-courses .iapp-course-row__date strong {
	font-size: 20px;
	font-weight: 700;
}

.iapp-courses .iapp-course-row__date span {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.iapp-courses .iapp-course-row.is-free .iapp-course-row__date {
	background: var(--crs-navy);
	color: #fff;
}

.iapp-courses .iapp-course-row__main {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

.iapp-courses .iapp-course-row__title,
.iapp-courses h2.iapp-course-row__title,
.iapp-courses h3.iapp-course-row__title,
.iapp-courses h4.iapp-course-row__title,
.iapp-courses h5.iapp-course-row__title {
	margin: 0;
	color: var(--crs-navy);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
}

.iapp-courses .iapp-course-row__title a {
	color: inherit;
	text-decoration: none;
}

@media (hover: hover) {
	.iapp-courses .iapp-course-row__title a:hover {
		color: var(--crs-blue);
	}
}

.iapp-courses .iapp-course-row__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	align-items: center;
	color: var(--crs-slate);
	font-size: 13px;
}

.iapp-courses .iapp-course-row .iapp-course__btn {
	flex: none;
}

@media (max-width: 575.98px) {
	.iapp-courses .iapp-course-row {
		flex-wrap: wrap;
	}

	.iapp-courses .iapp-course-row__main {
		flex-basis: calc(100% - 70px);
	}

	.iapp-courses .iapp-course-row .iapp-course__btn {
		width: 100%;
		margin-top: 4px;
	}
}

/* ==========================================================================
   Расписание (макет schedule.php)
   ========================================================================== */

/* --- панель управления ---------------------------------------------------- */

.iapp-sched__bar {
	display: flex;
	flex-wrap: wrap;
	gap: 14px 20px;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 16px;
	margin-bottom: 8px;
	border-bottom: 2px solid var(--crs-line);
}

.iapp-sched__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.iapp-sched__tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border: 1px solid var(--crs-line);
	border-radius: 999px;
	background: transparent;
	color: var(--crs-navy-700);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.iapp-sched__tab:hover {
	background: var(--crs-blue-100);
	border-color: var(--crs-blue-300);
}

.iapp-sched__tab.is-active {
	background: var(--crs-navy);
	border-color: var(--crs-navy);
	color: #fff;
}

.iapp-sched__count {
	min-width: 22px;
	padding: 1px 7px;
	border-radius: 999px;
	background: var(--crs-blue-100);
	color: var(--crs-navy-700);
	font-size: 12.5px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: center;
}

.iapp-sched__tab.is-active .iapp-sched__count {
	background: rgba(255, 255, 255, .18);
	color: #fff;
}

.iapp-sched__views {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--crs-line);
	border-radius: 999px;
}

.iapp-sched__view {
	padding: 7px 15px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--crs-slate);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

.iapp-sched__view.is-active {
	background: var(--crs-blue-100);
	color: var(--crs-navy);
}

.iapp-sched__tab:focus-visible,
.iapp-sched__view:focus-visible {
	outline: 3px solid var(--crs-blue-300);
	outline-offset: 2px;
}

/* --- месяцы --------------------------------------------------------------- */

.iapp-sched__months {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.iapp-sched__month-title {
	margin: 28px 0 4px;
	color: var(--crs-navy);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.iapp-sched .iapp-sched__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.iapp-sched__item {
	display: flex;
	gap: 16px;
	align-items: center;
	padding: 15px 0;
	border-bottom: 1px solid var(--crs-line);
}

.iapp-sched__item.is-done { color: var(--crs-slate); }

.iapp-sched__day {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 12px;
	background: var(--crs-blue-100);
	color: var(--crs-navy-700);
	line-height: 1.1;
}

.iapp-sched__day strong { font-size: 21px; font-weight: 700; }

.iapp-sched__day span {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.iapp-sched__item.is-done .iapp-sched__day { background: #eef1f5; color: var(--crs-slate); }
.iapp-sched__item.is-free .iapp-sched__day { background: var(--crs-navy); color: #fff; }

.iapp-sched__main {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

.iapp-sched .iapp-sched__title,
.iapp-sched h2.iapp-sched__title,
.iapp-sched h3.iapp-sched__title,
.iapp-sched h4.iapp-sched__title,
.iapp-sched h5.iapp-sched__title {
	margin: 0;
	color: var(--crs-navy);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.32;
}

.iapp-sched__title a { color: inherit; text-decoration: none; }

@media (hover: hover) {
	.iapp-sched__title a:hover { color: var(--crs-blue); }
}

.iapp-sched__item.is-done .iapp-sched__title { color: var(--crs-slate); }

.iapp-sched__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	align-items: center;
	color: var(--crs-slate);
	font-size: 13.5px;
}

.iapp-sched__empty {
	margin: 32px 0;
	padding: 24px;
	border: 1px dashed var(--crs-line);
	border-radius: var(--crs-radius);
	color: var(--crs-slate);
	text-align: center;
}

/* --- вид «по месяцам» ----------------------------------------------------- */

.iapp-sched.is-grid .iapp-sched__months {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 20px;
	align-items: start;
}

.iapp-sched.is-grid .iapp-sched__month {
	padding: 20px 22px;
	border: 1px solid var(--crs-line);
	border-radius: var(--crs-radius);
	background: #fff;
}

.iapp-sched.is-grid .iapp-sched__month-title {
	margin: 0 0 8px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--crs-line);
}

.iapp-sched.is-grid .iapp-sched__item {
	gap: 12px;
	padding: 12px 0;
	align-items: flex-start;
}

.iapp-sched.is-grid .iapp-sched__item:last-child { border-bottom: 0; padding-bottom: 0; }

.iapp-sched.is-grid .iapp-sched__day {
	width: 42px;
	height: 42px;
	border-radius: 10px;
}

.iapp-sched.is-grid .iapp-sched__day strong { font-size: 16px; }
.iapp-sched.is-grid .iapp-sched__day span { font-size: 10px; }

.iapp-sched.is-grid .iapp-sched__title { font-size: 15px; }

/* В плитке кнопка съедает ширину — карточка и так вся кликабельна по названию */
.iapp-sched.is-grid .iapp-sched__item .iapp-course__btn { display: none; }

/* --- адаптив -------------------------------------------------------------- */

@media (max-width: 767.98px) {
	.iapp-sched__bar {
		flex-direction: column;
		align-items: stretch;
	}

	.iapp-sched__views { align-self: flex-start; }

	.iapp-sched__item {
		flex-wrap: wrap;
	}

	.iapp-sched__main { flex-basis: calc(100% - 72px); }

	.iapp-sched__item .iapp-course__btn {
		width: 100%;
		margin-top: 6px;
	}

	.iapp-sched.is-grid .iapp-sched__months { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Блок «Ближайшие мероприятия» (макет events.php)
   ========================================================================== */

/* Заголовок раздела (название модуля при выключенном «Показывать заголовок»).
   Оформлен как остальные заголовки разделов главной: по центру, крупно. */
.iapp-events__head {
	margin: 0 auto 28px;
	max-width: 760px;
	text-align: center;
}

.iapp-events__title {
	margin: 0;
	color: var(--crs-navy);
	font-size: clamp(24px, 2.8vw, 36px);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -.01em;
	text-wrap: balance;
}

.iapp-events__lead {
	margin: 12px auto 0;
	max-width: 52ch;
	color: var(--crs-slate);
	font-size: 17px;
	line-height: 1.6;
}

/* С заголовком по центру вкладки тоже выравниваем по центру */
.iapp-events.has-title .iapp-events__tabs { justify-content: center; }

.iapp-events__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 24px;
}

.iapp-events__tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1px solid var(--crs-navy);
	border-radius: 8px;
	background: #fff;
	color: var(--crs-navy);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

.iapp-events__tab:hover { background: var(--crs-blue-100); }

.iapp-events__tab.is-active {
	background: var(--crs-navy);
	color: #fff;
}

.iapp-events__count {
	min-width: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--crs-blue-100);
	color: var(--crs-navy-700);
	font-size: 12px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: center;
}

.iapp-events__tab.is-active .iapp-events__count {
	background: rgba(255, 255, 255, .2);
	color: #fff;
}

.iapp-events__tab:focus-visible,
.iapp-events__arrow:focus-visible,
.iapp-free__arrow:focus-visible {
	outline: 3px solid var(--crs-blue-300);
	outline-offset: 2px;
}

/* карусель */

.iapp-events__viewport,
.iapp-free__viewport {
	position: relative;
}

.iapp-events__track,
.iapp-free__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 2 * var(--crs-gap)) / 3);
	gap: var(--crs-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	padding-bottom: 4px;
}

.iapp-events__track::-webkit-scrollbar,
.iapp-free__track::-webkit-scrollbar { display: none; }

.iapp-events__track > *,
.iapp-free__track > * { scroll-snap-align: start; }

/* Без карусели тот же макет работает как каталог: сетка с переносом строк */
.iapp-events:not(.is-carousel) .iapp-events__track {
	grid-auto-flow: row;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	overflow: visible;
	scroll-snap-type: none;
}

.iapp-events.cols-2:not(.is-carousel) .iapp-events__track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.iapp-events.cols-4:not(.is-carousel) .iapp-events__track { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 991.98px) {
	.iapp-events:not(.is-carousel) .iapp-events__track,
	.iapp-events.cols-4:not(.is-carousel) .iapp-events__track {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 639.98px) {
	.iapp-events:not(.is-carousel) .iapp-events__track,
	.iapp-events.cols-2:not(.is-carousel) .iapp-events__track,
	.iapp-events.cols-4:not(.is-carousel) .iapp-events__track {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* карточки, спрятанные вкладкой, не должны занимать колонку грида */
.iapp-events__track > [hidden] { display: none; }

.iapp-events__arrow,
.iapp-free__arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	border: 1px solid var(--crs-line);
	border-radius: 50%;
	background: rgba(255, 255, 255, .94);
	backdrop-filter: blur(4px);
	box-shadow: 0 4px 14px rgba(20, 41, 74, .16);
	cursor: pointer;
	transition: background-color .15s ease, opacity .15s ease;
}

.iapp-events__arrow.is-prev, .iapp-free__arrow.is-prev { left: -22px; }
.iapp-events__arrow.is-next, .iapp-free__arrow.is-next { right: -22px; }

.iapp-events__arrow span,
.iapp-free__arrow span {
	width: 10px;
	height: 10px;
	border-top: 2px solid var(--crs-navy);
	border-right: 2px solid var(--crs-navy);
}

.iapp-events__arrow.is-prev span, .iapp-free__arrow.is-prev span { transform: rotate(-135deg) translate(-2px, -2px); }
.iapp-events__arrow.is-next span, .iapp-free__arrow.is-next span { transform: rotate(45deg) translate(-2px, 2px); }

/* display:flex выше по специфичности, чем [hidden] из стилей браузера,
   поэтому скрытие приходится задавать явно */
.iapp-events__arrow[hidden],
.iapp-free__arrow[hidden] { display: none; }

/* В начале и в конце списка стрелка не просто гаснет, а убирается совсем:
   на узком экране она стоит поверх карточки и иначе закрывала бы текст. */
.iapp-events__arrow[disabled],
.iapp-free__arrow[disabled] {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.iapp-events__arrow:hover:not([disabled]),
.iapp-free__arrow:hover:not([disabled]) { background: var(--crs-blue-100); }

/* шапка карточки с преподавателем */

.iapp-ev__head {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 16px 20px 0;
}

.iapp-ev__avatar {
	flex: none;
	width: 52px;
	height: 52px;
	border-radius: 12px;
	overflow: hidden;
	background: var(--crs-blue-100);
}

.iapp-ev__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.iapp-ev__who {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.iapp-ev__who-label {
	color: var(--crs-slate);
	font-size: 13px;
}

.iapp-ev__who a {
	color: var(--crs-navy);
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
}

@media (hover: hover) {
	.iapp-ev__who a:hover { color: var(--crs-blue); text-decoration: underline; }
}

.iapp-ev__head + .iapp-ev__body { padding-top: 14px; }

/* тип мероприятия строкой, когда обложки нет */

.iapp-ev__kicker { margin: 0; }

.iapp-ev__kicker span {
	display: inline-block;
	padding: 4px 12px;
	border: 1px solid var(--crs-line);
	border-radius: 8px;
	color: var(--crs-navy);
	font-size: 13px;
	font-weight: 600;
}

/* карточка мероприятия */

.iapp-events .iapp-ev {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: #fff;
	border: 1px solid var(--crs-line);
	border-radius: 18px;
	overflow: hidden;
}

.iapp-ev__media {
	position: relative;
	aspect-ratio: 16 / 10;
	background: var(--crs-navy-700);
}

.iapp-ev__media img,
.iapp-ev__blank {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.iapp-ev__blank {
	background: linear-gradient(140deg, var(--crs-navy-700) 0%, var(--crs-blue) 100%);
}

.iapp-ev__type {
	position: absolute;
	top: 12px;
	left: 12px;
	max-width: calc(100% - 24px);
	padding: 5px 12px;
	border: 1px solid var(--crs-line);
	border-radius: 8px;
	background: #fff;
	color: var(--crs-navy);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
}

.iapp-ev__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 8px;
	padding: 18px 20px 20px;
}

.iapp-events .iapp-ev__title,
.iapp-events h2.iapp-ev__title,
.iapp-events h3.iapp-ev__title,
.iapp-events h4.iapp-ev__title,
.iapp-events h5.iapp-ev__title {
	margin: 0;
	color: var(--crs-navy);
	font-size: 19px;
	font-weight: 700;
	line-height: 1.28;
	letter-spacing: -.01em;
	text-wrap: balance;
}

.iapp-ev__title a { color: inherit; text-decoration: none; }

@media (hover: hover) {
	.iapp-ev__title a:hover { color: var(--crs-blue); }
}

.iapp-ev__sub {
	margin: 0;
	color: var(--crs-slate);
	font-size: 14px;
	line-height: 1.45;
}

.iapp-ev__start {
	margin: auto 0 0;
	padding-top: 10px;
	color: var(--crs-navy);
	font-size: 15px;
}

.iapp-ev__start strong { font-weight: 700; }

.iapp-ev__facts { color: var(--crs-slate); }

.iapp-ev__facts i {
	font-style: normal;
	color: var(--crs-line);
	padding: 0 2px;
}

.iapp-ev__time {
	display: block;
	color: var(--crs-slate);
	font-size: 13px;
}

.iapp-ev__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	align-items: center;
	justify-content: space-between;
	margin: 0;
}

.iapp-ev__more {
	color: var(--crs-navy);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

@media (hover: hover) {
	.iapp-ev__more:hover { color: var(--crs-blue); text-decoration: underline; }
}

/* кнопка «Смотреть все курсы» */

.iapp-events__more {
	margin: 32px 0 0;
	text-align: center;
}

.iapp-events__more-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	padding: 0 40px;
	border: 1px solid var(--crs-navy);
	border-radius: 10px;
	background: #fff;
	color: var(--crs-navy);
	font-size: 17px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color .15s ease, color .15s ease;
}

@media (hover: hover) {
	.iapp-events__more-btn:hover { background: var(--crs-navy); color: #fff; }
}

.iapp-events__empty {
	margin: 24px 0;
	padding: 24px;
	border: 1px dashed var(--crs-line);
	border-radius: var(--crs-radius);
	color: var(--crs-slate);
	text-align: center;
}

/* ==========================================================================
   Блок «Ближайшие бесплатные мероприятия» (макет free.php)
   ========================================================================== */

.iapp-free {
	--crs-gap: 24px;
	padding: 40px clamp(20px, 4vw, 56px) 44px;
	border-radius: 28px;
	background: var(--crs-navy);
}

.iapp-free .iapp-free__title {
	margin: 0 0 28px;
	color: #fff;
	font-size: clamp(24px, 3vw, 34px);
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-wrap: balance;
}

.iapp-free .iapp-free__lead {
	margin: -16px auto 28px;
	max-width: 52ch;
	color: rgba(255, 255, 255, .72);
	font-size: 17px;
	line-height: 1.6;
	text-align: center;
}

.iapp-free__track {
	grid-auto-columns: calc((100% - var(--crs-gap)) / 2);
}

.iapp-free-card {
	display: flex;
	gap: 18px;
	min-width: 0;
	padding: 18px;
	border-radius: 20px;
	background: #fff;
}

.iapp-free-card__media {
	flex: none;
	width: 150px;
	border-radius: 14px;
	overflow: hidden;
	background: var(--crs-blue-100);
}

.iapp-free-card__media img,
.iapp-free-card__blank {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 150px;
	object-fit: cover;
}

.iapp-free-card__blank {
	background: linear-gradient(140deg, var(--crs-blue-100) 0%, #cfe0f2 100%);
}

.iapp-free-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.iapp-free-card__when {
	align-self: flex-start;
	margin: 0;
	padding: 4px 12px;
	border-radius: 8px;
	background: #f7e2ef;
	color: #8a3a6b;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
}

.iapp-free-card__kind {
	margin: 0;
}

.iapp-free-card__kind span {
	display: inline-block;
	padding: 4px 12px;
	border: 1px solid var(--crs-navy);
	border-radius: 8px;
	color: var(--crs-navy);
	font-size: 13px;
	font-weight: 600;
}

.iapp-free .iapp-free-card__title,
.iapp-free h2.iapp-free-card__title,
.iapp-free h3.iapp-free-card__title,
.iapp-free h4.iapp-free-card__title,
.iapp-free h5.iapp-free-card__title {
	margin: 0;
	color: var(--crs-navy);
	font-size: 18px;
	font-weight: 600;
	line-height: 1.32;
	text-wrap: balance;
}

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

@media (hover: hover) {
	.iapp-free-card__title a:hover { color: var(--crs-blue); }
}

.iapp-free-card__who {
	margin: 0;
	color: var(--crs-slate);
	font-size: 14px;
}

.iapp-free-card__more {
	margin: auto 0 0;
	padding-top: 8px;
}

.iapp-free-card__more a {
	color: var(--crs-navy);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

@media (hover: hover) {
	.iapp-free-card__more a:hover { color: var(--crs-blue); text-decoration: underline; }
}

/* стрелки на тёмном фоне держатся светлыми */
.iapp-free__arrow { border-color: transparent; }

/* --- адаптив каруселей ---------------------------------------------------- */

@media (max-width: 991.98px) {
	.iapp-events__track { grid-auto-columns: calc((100% - var(--crs-gap)) / 2); }
	.iapp-free__track { grid-auto-columns: 100%; }

	.iapp-events__arrow.is-prev, .iapp-free__arrow.is-prev { left: 4px; }
	.iapp-events__arrow.is-next, .iapp-free__arrow.is-next { right: 4px; }
}

/* Снаружи стрелки помещаются только на широком экране; иначе они срезаются
   краем окна, поэтому уводим их внутрь поверх карточек. */
@media (max-width: 1399.98px) {
	.iapp-events__arrow.is-prev, .iapp-free__arrow.is-prev { left: 6px; }
	.iapp-events__arrow.is-next, .iapp-free__arrow.is-next { right: 6px; }
}

@media (max-width: 639.98px) {
	.iapp-events__track { grid-auto-columns: 86%; }

	/* На телефоне карусель листается пальцем, а стрелки только закрывают текст */
	.iapp-events__arrow,
	.iapp-free__arrow { display: none; }

	.iapp-events__tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		margin-inline: -16px;
		padding-inline: 16px;
	}

	.iapp-events__tabs::-webkit-scrollbar { display: none; }

	.iapp-events__tab { flex: none; }

	.iapp-free-card { flex-direction: column; }

	.iapp-free-card__media {
		width: 100%;
		aspect-ratio: 3 / 2;
	}

	.iapp-free-card__media img { min-height: 0; }
}

/* ==========================================================================
   2.0 — новая схема программ
   ========================================================================== */

/* статусы, которых раньше не было */
.iapp-courses .iapp-course__badge.is-waitlist { background: #f1ecfb; color: #5b3fa3; }
.iapp-courses .iapp-course__badge.is-join     { background: #e6f4ec; color: #1d7a45; }
.iapp-courses .iapp-course__badge.is-record   { background: var(--crs-blue-100); color: var(--crs-navy-700); }

/* несколько ведущих: фото «стопкой» */
.iapp-ev__avatars { display: flex; flex: none; }
.iapp-ev__head.is-many .iapp-ev__avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px var(--crs-line);
}
.iapp-ev__head.is-many .iapp-ev__avatar + .iapp-ev__avatar { margin-left: -12px; }

.iapp-ev__who span:not(.iapp-ev__who-label) {
	color: var(--crs-navy);
	font-size: 15px;
	font-weight: 700;
}

.iapp-ev__who a + a,
.iapp-ev__who a + span { margin-left: 0; }

.iapp-courses .iapp-course__facts .is-price { font-weight: 700; color: var(--crs-navy); }
.iapp-ev__names { display: block; line-height: 1.35; }
.iapp-ev__names a { font-size: inherit; }
