/* =============================================
   YouTube Gallery + Modal
   Palette: black bg, yellow (#e5b829) accents
   ============================================= */

/* Wrapper establishes container context and forces full width */
.yt-gallery-wrap {
	container-type: inline-size;
	display: block;
	width: 100%;
	box-sizing: border-box;
	float: none;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* --- Grid --- */
.yt-gallery {
	display: grid;
	gap: 16px 16px;
	row-gap: 40px;
	padding: 24px 0;
	width: 100%;
	box-sizing: border-box;
}

.yt-gallery-cols-1 { grid-template-columns: 1fr; }
.yt-gallery-cols-2 { grid-template-columns: repeat(2, 1fr); }
.yt-gallery-cols-3 { grid-template-columns: repeat(3, 1fr); }
.yt-gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }
.yt-gallery-cols-5 { grid-template-columns: repeat(5, 1fr); }
.yt-gallery-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Responsive: based on actual container width, not viewport */
@container (max-width: 1100px) {
	.yt-gallery-cols-5,
	.yt-gallery-cols-6 { grid-template-columns: repeat(4, 1fr); }
}

@container (max-width: 900px) {
	.yt-gallery-cols-3,
	.yt-gallery-cols-4,
	.yt-gallery-cols-5,
	.yt-gallery-cols-6 { grid-template-columns: repeat(2, 1fr); }
}

@container (max-width: 540px) {
	.yt-gallery-cols-2,
	.yt-gallery-cols-3,
	.yt-gallery-cols-4,
	.yt-gallery-cols-5,
	.yt-gallery-cols-6 { grid-template-columns: 1fr; }
}

/* --- Item --- */
.yt-gallery-item {
	cursor: pointer;
	outline: none;
	text-decoration: none;
}

.yt-gallery-item:focus-visible .yt-gallery-thumb {
	outline: 2px solid #e5b829;
	outline-offset: 3px;
}

/* --- Thumbnail --- */
.yt-gallery-thumb {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 10px;
	background: #111;
	border: 1px solid #333;
}

.yt-gallery-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease, filter 0.3s ease;
}

.yt-gallery-item:hover .yt-gallery-thumb img,
.yt-gallery-item:focus-visible .yt-gallery-thumb img {
	transform: scale(1.05);
	filter: brightness(0.6);
}

/* --- Play Button --- */
.yt-gallery-play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.yt-gallery-play svg {
	width: 64px;
	height: 45px;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.7));
	transition: transform 0.2s ease, filter 0.2s ease;
}

.yt-gallery-item:hover .yt-gallery-play svg,
.yt-gallery-item:focus-visible .yt-gallery-play svg {
	transform: scale(1.15);
	filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.9));
}

/* --- Title --- */
.yt-gallery-title {
	margin: 8px 0 0;
	padding: 0;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.3;
	color: #e5b829;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* =============================================
   Modal
   ============================================= */
.yt-modal[hidden] {
	display: none;
}

.yt-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.yt-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.9);
	cursor: pointer;
}

.yt-modal-content {
	position: relative;
	z-index: 1;
	width: 90vw;
	max-width: 960px;
	background: #000;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 10px 50px rgba(0, 0, 0, 0.9);
	animation: yt-modal-in 0.2s ease;
}

@keyframes yt-modal-in {
	from { opacity: 0; transform: scale(0.95); }
	to   { opacity: 1; transform: scale(1); }
}

.yt-modal-iframe-wrap {
	position: relative;
	padding-bottom: 56.25%; /* 16:9 */
	height: 0;
	overflow: hidden;
}

.yt-modal-iframe-wrap iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
}

.yt-modal-close {
	position: absolute;
	top: -44px;
	right: 0;
	background: none;
	border: none;
	color: #fff;
	font-size: 40px;
	line-height: 1;
	cursor: pointer;
	padding: 0 6px;
	z-index: 2;
	transition: color 0.15s ease, transform 0.15s ease;
}

.yt-modal-close:hover,
.yt-modal-close:focus-visible {
	color: #e5b829;
	transform: scale(1.15);
	outline: none;
}
