/* YouTube Playlist Embeds 2.2.0
   Functional first: cards have CSS-defined dimensions before JavaScript runs. */

.ytpe-block,
.ytpe-fallback {
	position: relative;
	width: 100%;
	max-width: 100%;
	margin: 0;
	text-align: center;
	box-sizing: border-box;
}

.ytpe-block *,
.ytpe-fallback * {
	box-sizing: border-box;
}

.ytpe-heading {
	font-family: var(--ytpe-heading-font, inherit);
	color: var(--ytpe-accent, #bd8789);
	font-size: 2.2em;
	font-weight: 600;
	line-height: 1.1;
	margin: 0 0 0.6em;
}

/* ---------- Horizontal rail ---------- */

.ytpe-carousel {
	position: relative;
	width: 100%;
	max-width: 100%;
}

.ytpe-rail {
	display: flex;
	align-items: stretch;
	gap: 12px;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 2px 0 8px;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-inline: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: 0;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--ytpe-accent, #bd8789) 60%, transparent) transparent;
}

.ytpe-rail::-webkit-scrollbar {
	height: 5px;
}

.ytpe-rail::-webkit-scrollbar-track {
	background: transparent;
}

.ytpe-rail::-webkit-scrollbar-thumb {
	background: var(--ytpe-accent, #bd8789);
	border-radius: 10px;
}

.ytpe-rail:focus-visible {
	outline: 2px solid var(--ytpe-accent, #bd8789);
	outline-offset: 4px;
}

/*
 * 88% creates a gentle next-card peek in 300–350px containers.
 * The 370px cap naturally produces two or three visible cards in wider areas.
 * The first flex-basis line is the broad fallback; the max()/min() line is the enhancement.
 */
.ytpe-thumb {
	position: relative;
	display: block;
	flex: 0 0 88%;
	flex-basis: max(240px, min(88%, 370px));
	min-width: 0;
	max-width: 370px;
	width: 88%;
	aspect-ratio: 16 / 9;
	min-height: 135px;
	padding: 0;
	margin: 0;
	border: 0;
	background: var(--ytpe-card-bg, #fff);
	border-radius: var(--ytpe-radius, 14px);
	overflow: hidden;
	cursor: pointer;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ytpe-thumb:hover,
.ytpe-thumb:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 7px 16px rgba(0, 0, 0, 0.14);
}

.ytpe-thumb:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -5px;
}

.ytpe-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 135px;
	object-fit: cover;
}

.ytpe-play-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ytpe-accent-soft, rgba(189, 135, 137, 0.55));
	opacity: 0.72;
	transition: opacity 0.2s ease;
}

.ytpe-thumb:hover .ytpe-play-icon,
.ytpe-thumb:focus-visible .ytpe-play-icon {
	opacity: 0.9;
}

.ytpe-play-icon svg {
	width: 46px;
	height: 46px;
	color: #fff;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

/* ---------- Carousel arrows ---------- */

.ytpe-arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: var(--ytpe-accent, #bd8789);
	box-shadow: 0 2px 10px rgba(70, 42, 42, 0.16);
	cursor: pointer;
	transform: translateY(-58%);
	transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.ytpe-arrow[hidden] {
	display: none !important;
}

.ytpe-arrow--prev {
	left: 7px;
}

.ytpe-arrow--next {
	right: 7px;
}

.ytpe-arrow svg {
	width: 18px;
	height: 18px;
}

.ytpe-arrow:hover,
.ytpe-arrow:focus-visible {
	background: #fff;
	transform: translateY(-58%) scale(1.05);
}

.ytpe-arrow:focus-visible {
	outline: 2px solid var(--ytpe-accent, #bd8789);
	outline-offset: 2px;
}

.ytpe-arrow:disabled {
	opacity: 0;
	pointer-events: none;
}

/* ---------- Compact CTA buttons ---------- */

.ytpe-actions {
	display: flex;
	align-items: stretch;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
	width: 100%;
	margin-top: 11px;
}

.ytpe-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 1 auto;
	min-width: 0;
	height: 41px;
	padding: 0 13px;
	border: 0;
	border-radius: 4px;
	color: #fff !important;
	font-family: inherit;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none !important;
	white-space: nowrap;
	box-shadow: none;
	transition: background 0.18s ease, transform 0.15s ease;
}

.ytpe-btn--playlist {
	background: var(--ytpe-accent, #bd8789);
	text-transform: uppercase;
	letter-spacing: 0.15em;
}

.ytpe-btn--playlist:hover,
.ytpe-btn--playlist:focus-visible {
	background: var(--ytpe-accent-dark, #a46e70);
}

.ytpe-btn--subscribe {
	gap: 6px;
	background: var(--ytpe-secondary, #efa1a5);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.015em;
	text-transform: lowercase;
}

.ytpe-btn--subscribe:hover,
.ytpe-btn--subscribe:focus-visible {
	background: var(--ytpe-secondary-dark, #dd8f93);
}

.ytpe-btn--subscribe svg {
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
}

.ytpe-btn:hover,
.ytpe-btn:focus-visible {
	color: #fff !important;
	transform: translateY(-1px);
}

.ytpe-btn:focus-visible {
	outline: 2px solid var(--ytpe-text, #4a3428);
	outline-offset: 2px;
}

/* ---------- Modal player ---------- */

.ytpe-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.ytpe-modal.is-open {
	display: flex;
}

.ytpe-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(30, 20, 20, 0.76);
}

.ytpe-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 900px;
	padding: 14px;
	border: 3px solid var(--ytpe-accent, #bd8789);
	border-radius: var(--ytpe-radius, 14px);
	background: var(--ytpe-card-bg, #fff);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.ytpe-modal__frame {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 56.25%;
	border-radius: max(0px, calc(var(--ytpe-radius, 14px) - 4px));
	overflow: hidden;
	background: #000;
}

.ytpe-modal__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.ytpe-modal__close {
	position: absolute;
	top: -14px;
	right: -14px;
	z-index: 2;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 3px solid var(--ytpe-card-bg, #fff);
	border-radius: 50%;
	background: var(--ytpe-accent, #bd8789);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ytpe-modal__close:hover,
.ytpe-modal__close:focus-visible {
	background: var(--ytpe-accent-dark, #a46e70);
}

.ytpe-modal__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* ---------- Fallback / admin messages ---------- */

.ytpe-fallback__wrapper {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 56.25%;
	border-radius: var(--ytpe-radius, 14px);
	overflow: hidden;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.ytpe-fallback__wrapper iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.ytpe-admin-note {
	margin: 0 0 0.8em;
	color: var(--ytpe-text, #4a3428);
	font-size: 0.85em;
	opacity: 0.75;
}

.ytpe-config-error {
	padding: 10px;
	border: 1px solid #8a1f11;
	border-radius: 4px;
	color: #8a1f11;
}

@media (max-width: 420px) {
	.ytpe-arrow {
		width: 31px;
		height: 31px;
	}

	.ytpe-btn {
		height: 40px;
		padding-inline: 11px;
		font-size: 10px;
	}

	.ytpe-btn--subscribe {
		font-size: 11px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ytpe-thumb,
	.ytpe-play-icon,
	.ytpe-arrow,
	.ytpe-btn {
		transition: none;
	}

	.ytpe-rail {
		scroll-behavior: auto;
	}
}
