/**
 * Videos: the click-to-play player, the homepage section, the /videos/ list
 * and a video's own page. Uses the theme's colors and fonts when available,
 * with fallbacks.
 */

/* ---------- Player ---------- */

.ivo-video {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: 8px;
	background: var(--wp--preset--color--night, #0f172a);
}

.ivo-video__play {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: inherit;
	background: none;
	color: #fff;
	cursor: pointer;
}

.ivo-video__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

/* No thumbnail yet: a plain navy panel behind the play button. */
.ivo-video__image--none {
	background: linear-gradient(135deg, var(--wp--preset--color--primary-dark, #1e3a8a), var(--wp--preset--color--night, #0f172a));
}

.ivo-video__icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: clamp(48px, 16%, 72px);
	translate: -50% -50%;
	filter: drop-shadow(0 2px 6px rgb(15 23 42 / 0.4));
}

.ivo-video__icon svg {
	display: block;
	width: 100%;
	height: auto;
}

.ivo-video__icon-bg {
	fill: rgb(15 23 42 / 0.78);
	stroke: #fff;
	stroke-width: 2;
	transition: fill 0.2s ease;
}

.ivo-video__play:hover .ivo-video__icon-bg,
.ivo-video__play:focus-visible .ivo-video__icon-bg {
	fill: var(--wp--preset--color--accent, #0d9488);
}

.ivo-video__play:hover .ivo-video__image {
	transform: scale(1.03);
}

.ivo-video__frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: inherit;
}

/* ---------- Section and lists ---------- */

.ivo-videos__featured {
	display: grid;
	gap: 1rem 2rem;
	align-items: center;
}

@media (min-width: 782px) {
	.ivo-videos__featured {
		grid-template-columns: 3fr 2fr;
	}
}

.ivo-videos__featured-title,
.ivo-videos__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading, inherit);
	line-height: 1.3;
}

.ivo-videos__featured-title {
	font-size: var(--wp--preset--font-size--x-large, 1.5rem);
}

.ivo-videos__title {
	margin-top: 0.75rem;
	font-size: var(--wp--preset--font-size--medium, 1.0625rem);
}

.ivo-videos__featured-title a,
.ivo-videos__title a {
	color: var(--wp--preset--color--contrast, #1e293b);
	text-decoration: none;
}

.ivo-videos__featured-title a:hover,
.ivo-videos__title a:hover {
	color: var(--wp--preset--color--primary, #1d4ed8);
	text-decoration: underline;
}

.ivo-videos__description {
	margin: 0.75rem 0 0;
	color: var(--wp--preset--color--muted, #475569);
}

/* One per row on phones, then as many 14rem cards as fit (3 at the content width). */
.ivo-videos__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
	gap: 2rem 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ivo-videos__featured + .ivo-videos__grid {
	margin-top: 2rem;
}

.ivo-videos__card {
	margin: 0;
	min-width: 0;
}

.ivo-videos__date,
.ivo-videos__excerpt {
	margin: 0.25rem 0 0;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-videos__date {
	color: var(--wp--preset--color--muted, #475569);
}

.ivo-videos.is-list {
	margin-top: 2rem;
}

.ivo-videos__all {
	margin: 1.5rem 0 0;
	font-weight: 700;
	text-align: end;
}

.ivo-videos__empty {
	margin: 0;
}

/* ---------- Homepage: the YouTube channel section ("channel" layout) ---------- */

.ivo-videos__channel {
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
	margin-block: 1.5rem;
}

.ivo-videos__channel .ivo-logo {
	flex: none;
	width: 48px;
	height: 48px;
}

.ivo-videos__channel-name {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-weight: 700;
}

.ivo-videos__channel-name a {
	color: var(--wp--preset--color--primary-dark, #1e3a8a);
	text-decoration: none;
}

.ivo-videos__channel-name a:hover {
	text-decoration: underline;
}

.ivo-videos__channel-text {
	margin: 0.25rem 0 0;
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

/* A video with its title over the top of the thumbnail, as on YouTube. */
.ivo-videos__tile {
	position: relative;
}

.ivo-videos__caption {
	position: absolute;
	inset: 0 0 auto;
	z-index: 1;
	margin: 0;
	padding: 0.6rem 0.75rem 1.75rem;
	border-radius: 8px 8px 0 0;
	background: linear-gradient(rgb(15 23 42 / 0.8), rgb(15 23 42 / 0));
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.3;
	pointer-events: none;
}

.ivo-videos__main .ivo-videos__caption {
	padding: 0.9rem 1.25rem 2.5rem;
	font-size: var(--wp--preset--font-size--large, 1.25rem);
}

.ivo-videos__caption a {
	display: -webkit-box;
	overflow: hidden;
	color: #fff;
	text-decoration: none;
	pointer-events: auto;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

/* Small cards: one line, so the title stays clear of the play button. */
.ivo-videos__row .ivo-videos__caption a {
	-webkit-line-clamp: 1;
}

.ivo-videos__caption a:hover {
	text-decoration: underline;
}

/* The YouTube player shows its own title once playing. */
.ivo-videos__tile:has(.is-playing) .ivo-videos__caption {
	display: none;
}

/* One per row on phones, then all in one row (no lone card on a second row). */
.ivo-videos__row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {
	.ivo-videos__row {
		grid-template-columns: none;
		grid-auto-columns: minmax(0, 1fr);
		grid-auto-flow: column;
	}
}

.ivo-videos__row li {
	margin: 0;
	min-width: 0;
}

.ivo-videos__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: center;
	margin: 1.5rem 0 0;
}

.ivo-videos__actions .wp-element-button {
	display: inline-flex;
	gap: 0.5rem;
	align-items: center;
	min-height: 44px;
	box-sizing: border-box;
	font-weight: 700;
	text-decoration: none;
}

.ivo-videos__actions .ivo-videos__more {
	background: var(--wp--preset--color--highlight, #f59e0b);
	color: var(--wp--preset--color--night, #0f172a);
}

.ivo-videos__actions .ivo-videos__subscribe {
	background: var(--wp--preset--color--primary-dark, #1e3a8a);
	color: #fff;
}

.ivo-videos__actions .wp-element-button:hover {
	filter: brightness(0.92);
}

/* ---------- Pagination on /videos/ (as on /issuances/) ---------- */

.ivo-videos__pagination ul.page-numbers {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 2.5rem 0 0;
	padding: 0;
	border: 0;
	list-style: none;
}

.ivo-videos__pagination li {
	margin: 0;
}

.ivo-videos__pagination a.page-numbers,
.ivo-videos__pagination span.page-numbers {
	display: inline-grid;
	place-items: center;
	box-sizing: border-box;
	min-width: 44px;
	min-height: 44px;
	padding-inline: 0.75rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 4px;
	text-decoration: none;
}

.ivo-videos__pagination a.page-numbers:hover {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-videos__pagination span.page-numbers.current {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	background: var(--wp--preset--color--primary, #1d4ed8);
	color: #fff;
}

.ivo-videos__pagination span.page-numbers.dots {
	min-width: auto;
	padding-inline: 0.25rem;
	border-color: transparent;
}

/* ---------- A video's own page ---------- */

.ivo-video-details__title {
	margin: 0;
}

.ivo-video-details__date {
	margin: 0.5rem 0 1.5rem;
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-video-details__description {
	margin: 1.5rem 0 0;
	max-width: 70ch;
}

.ivo-video-details__back {
	margin: 2rem 0 0;
	font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
	.ivo-video__image,
	.ivo-video__icon-bg {
		transition: none;
	}

	.ivo-video__play:hover .ivo-video__image {
		transform: none;
	}
}
