/**
 * Shared YouTube lightbox/modal used by both carousel and gallery cards.
 * The thumbnail strip + prev/next nav only apply in gallery context (see
 * modal.js `setupGalleryMode`) — hidden and inert for carousel opens, so
 * the carousel's lightbox is visually unchanged.
 */

.tmc-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

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

/* Gallery mode: the strip is a fixed bar pinned to the top of the page, not
   part of the modal box, so it reads as real top navigation rather than a
   panel stuck to the video. padding-top reserves room for it so the modal
   box still centers in the space below. */
.tmc-modal-overlay.has-strip {
	padding-top: 84px;
}

.tmc-modal {
	position: relative;
	width: min(90vw, 960px);
	background: #000;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	display: flex;
	flex-direction: column;
}

.tmc-modal__close {
	position: absolute;
	top: -44px;
	right: 0;
	width: 36px;
	height: 36px;
	border: none;
	background: transparent;
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	z-index: 3;
}

/* Gallery mode: close button pins to the page corner (fixed), independent
   of the modal box and always clear of the top strip. */
.tmc-modal-overlay.has-strip .tmc-modal__close {
	position: fixed;
	top: 14px;
	right: 16px;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 50%;
	z-index: 100002; /* strip is fixed + z-index 100001 and spans full width
	                     including the close button's padded-out corner —
	                     without this the strip's own box (padding included)
	                     sits on top and swallows the click. */
}

/* ---- Thumbnail strip (gallery mode only) — fixed top nav bar ---- */

.tmc-modal__strip {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100001;
	display: flex;
	gap: 6px;
	padding: 12px 76px 12px 16px; /* right padding clears the fixed close button */
	background: rgba(0, 0, 0, 0.92);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
	overflow-x: auto;
	scrollbar-width: thin;
}

.tmc-modal__strip[hidden] {
	display: none;
}

.tmc-modal__strip-item {
	flex: 0 0 auto;
	width: 96px;
	aspect-ratio: 16 / 9;
	border-radius: 4px;
	overflow: hidden;
	padding: 0;
	border: 2px solid transparent;
	background: #000;
	opacity: 0.55;
	cursor: pointer;
	transition: opacity 0.15s ease, border-color 0.15s ease;
}

.tmc-modal__strip-item:hover,
.tmc-modal__strip-item:focus-visible {
	opacity: 0.85;
}

.tmc-modal__strip-item.is-active {
	opacity: 1;
	border-color: #d4a24e;
}

.tmc-modal__strip-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ---- Video stage ---- */

.tmc-modal__stage {
	position: relative;
	aspect-ratio: 16 / 9;
}

.tmc-modal__body {
	position: absolute;
	inset: 0;
}

.tmc-modal__body iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.tmc-modal__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.tmc-modal__nav[hidden] {
	display: none;
}

.tmc-modal__nav:hover {
	border-color: #d4a24e;
	color: #d4a24e;
}

.tmc-modal__nav:disabled {
	opacity: 0.3;
	cursor: default;
}

.tmc-modal__nav--prev {
	left: 12px;
}

.tmc-modal__nav--next {
	right: 12px;
}

@media (max-width: 640px) {
	.tmc-modal {
		width: 94vw;
	}

	.tmc-modal-overlay.has-strip {
		padding-top: 64px;
	}

	.tmc-modal__strip {
		padding: 8px 52px 8px 8px;
	}

	.tmc-modal__strip-item {
		width: 64px;
	}

	.tmc-modal-overlay.has-strip .tmc-modal__close {
		top: 10px;
		right: 10px;
		width: 32px;
		height: 32px;
	}

	/* Carousel mode (no .has-strip): close button still floats above the
	   modal box on desktop (top: -44px) — on short mobile viewports that
	   can land off-screen, so it moves inside the box instead. */
	.tmc-modal-overlay:not(.has-strip) .tmc-modal__close {
		top: 6px;
		right: 6px;
		width: 32px;
		height: 32px;
		background: rgba(0, 0, 0, 0.55);
		border-radius: 50%;
	}

	.tmc-modal__nav {
		width: 34px;
		height: 34px;
		font-size: 18px;
	}
}
