/**
 * Nouyouin YouTube — grille de vidéos.
 */

.nyv {
	--nyv-green: #184d47;
	--nyv-orange: #c14426;
	--nyv-yellow: #d4a019;
	--nyv-ink: #2b2b2b;
	--nyv-muted: #6d6a63;
	--nyv-line: #e8e2d6;
	--nyv-soft: #faf8f4;

	max-width: 1200px;
	margin: 0 auto;
	color: var(--nyv-ink);
}

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

/* ---------- En-tête ---------- */
.nyv-head {
	text-align: center;
	max-width: 720px;
	margin: 0 auto 34px;
}

.nyv-title {
	margin: 0 0 12px;
	font-size: clamp(26px, 3.4vw, 38px);
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -0.01em;
	color: var(--nyv-green);
}

.nyv-intro {
	margin: 0 0 10px;
	font-size: 17px;
	line-height: 1.6;
	color: var(--nyv-muted);
}

.nyv-count {
	margin: 0;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--nyv-orange);
}

/* ---------- Recherche ---------- */
.nyv-search {
	max-width: 460px;
	margin: 0 auto 30px;
	text-align: center;
}

.nyv-search-input {
	width: 100%;
	padding: 13px 18px;
	font-size: 16px; /* >=16px : évite le zoom automatique sur iPhone. */
	font-family: inherit;
	color: var(--nyv-ink);
	background: #fff;
	border: 1px solid var(--nyv-line);
	border-radius: 999px;
}

.nyv-search-input:focus {
	outline: none;
	border-color: var(--nyv-green);
	box-shadow: 0 0 0 3px rgba(24, 77, 71, 0.12);
}

.nyv-search-empty {
	display: block;
	margin-top: 14px;
	font-size: 14px;
	color: var(--nyv-muted);
}

/* ---------- Grille ---------- */
.nyv-grid {
	display: grid;
	gap: 26px 22px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

/* ---------- Carte ---------- */
.nyv-card {
	display: flex;
	flex-direction: column;
	transition: transform 0.2s ease;
}

.nyv-card[hidden] { display: none; }

.nyv-card:hover { transform: translateY(-4px); }

.nyv-thumb {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: none;
	cursor: pointer;
	background: #0d0d0d;
	border-radius: 14px;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
}

.nyv-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.45s ease, opacity 0.2s ease;
}

.nyv-card:hover .nyv-thumb img {
	transform: scale(1.06);
	opacity: 0.85;
}

.nyv-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	border: 2px solid rgba(255, 255, 255, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	transition: background 0.2s ease, transform 0.2s ease;
}

.nyv-card:hover .nyv-play {
	background: var(--nyv-orange);
	border-color: var(--nyv-orange);
	transform: translate(-50%, -50%) scale(1.08);
}

.nyv-play svg { width: 26px; height: 26px; margin-left: 3px; }

.nyv-thumb:focus-visible {
	outline: 3px solid var(--nyv-green);
	outline-offset: 3px;
}

.nyv-body { padding: 14px 2px 0; }

.nyv-card-title {
	margin: 0 0 6px;
	font-size: 16.5px;
	line-height: 1.4;
	font-weight: 700;
	color: var(--nyv-ink);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.nyv-card:hover .nyv-card-title { color: var(--nyv-green); }

.nyv-date {
	font-size: 13px;
	color: var(--nyv-muted);
}

/* ---------- Lecteur ---------- */
.nyv-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(10, 10, 10, 0.92);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.nyv-modal.is-open {
	opacity: 1;
	pointer-events: auto;
}

.nyv-modal-inner {
	position: relative;
	width: 100%;
	max-width: 1000px;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 12px;
	overflow: hidden;
}

.nyv-modal iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.nyv-close {
	position: absolute;
	top: -46px;
	right: 0;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nyv-close:hover { background: var(--nyv-orange); }

/* ---------- États ---------- */
.nyv-empty,
.nyv-error {
	padding: 30px 24px;
	text-align: center;
	border-radius: 12px;
	background: var(--nyv-soft);
	color: var(--nyv-muted);
	font-size: 15px;
}

.nyv-error {
	background: #fdf0ed;
	color: #8f2f18;
	border: 1px solid #f3d2c9;
	text-align: left;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.nyv-grid,
	.nyv-cols-4 .nyv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
	.nyv-grid,
	.nyv-cols-2 .nyv-grid,
	.nyv-cols-3 .nyv-grid,
	.nyv-cols-4 .nyv-grid { grid-template-columns: minmax(0, 1fr); }

	.nyv-grid { gap: 22px; }
	.nyv-close { top: auto; bottom: -46px; right: 50%; transform: translateX(50%); }
}

@media (prefers-reduced-motion: reduce) {
	.nyv-card,
	.nyv-thumb img,
	.nyv-play,
	.nyv-modal { transition: none; }
	.nyv-card:hover { transform: none; }
	.nyv-card:hover .nyv-thumb img { transform: none; }
}
