/**
 * YouTube Grid Connect — grid, facades, lightbox, stage.
 * Sober and elegant. Each instance is scoped under .ytgc.
 */

/* ---------- Base ---------- */

.ytgc {
	--ytgc-gap: 1.2rem;
	--ytgc-radius: 0;
	--ytgc-muted: rgba(0, 0, 0, 0.55);
	--ytgc-rule: rgba(0, 0, 0, 0.12);
	margin: 0 0 2em;
	line-height: 1.5;
}

.ytgc-heading {
	font-size: 1.1em;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin: 0 0 1em;
	padding-bottom: 0.5em;
	border-bottom: 1px solid var(--ytgc-rule);
}

.ytgc-grid {
	display: grid;
	gap: var(--ytgc-gap);
	grid-template-columns: repeat(var(--ytgc-cols, 3), minmax(0, 1fr));
}

.ytgc-cols-1 { --ytgc-cols: 1; }
.ytgc-cols-2 { --ytgc-cols: 2; }
.ytgc-cols-3 { --ytgc-cols: 3; }
.ytgc-cols-4 { --ytgc-cols: 4; }
.ytgc-cols-5 { --ytgc-cols: 5; }
.ytgc-cols-6 { --ytgc-cols: 6; }

@media (max-width: 900px) {
	.ytgc-cols-4, .ytgc-cols-5, .ytgc-cols-6 { --ytgc-cols: 3; }
}

@media (max-width: 680px) {
	.ytgc-cols-3, .ytgc-cols-4, .ytgc-cols-5, .ytgc-cols-6 { --ytgc-cols: 2; }
}

@media (max-width: 440px) {
	.ytgc-grid { --ytgc-cols: 1 !important; }
}

/* ---------- Items ---------- */

.ytgc-item {
	margin: 0;
}

.ytgc-thumb {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	cursor: pointer;
	background: #000;
	border-radius: var(--ytgc-radius);
}

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

.ytgc-thumb:hover img,
.ytgc-thumb:focus-visible img {
	transform: scale(1.03);
}

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

/* Play affordance */
.ytgc-play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 3.2em;
	height: 3.2em;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	transition: background 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}

.ytgc-play::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 0.55em 0 0.55em 0.95em;
	border-color: transparent transparent transparent #fff;
}

.ytgc-thumb:hover .ytgc-play {
	background: rgba(0, 0, 0, 0.8);
	transform: translate(-50%, -50%) scale(1.08);
}

.ytgc-playing .ytgc-play,
.ytgc-playing .ytgc-duration,
.ytgc-playing .ytgc-zoom {
	display: none;
}

.ytgc-duration {
	position: absolute;
	right: 0.5em;
	bottom: 0.5em;
	padding: 0.1em 0.45em;
	font-size: 0.72em;
	letter-spacing: 0.05em;
	color: #fff;
	background: rgba(0, 0, 0, 0.7);
	border-radius: 2px;
}

.ytgc-zoom {
	position: absolute;
	top: 0.4em;
	right: 0.4em;
	width: 1.9em;
	height: 1.9em;
	padding: 0;
	font-size: 1em;
	line-height: 1.9em;
	text-align: center;
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
	border: none;
	border-radius: 2px;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.ytgc-thumb:hover .ytgc-zoom,
.ytgc-zoom:focus-visible {
	opacity: 1;
}

/* Meta */
.ytgc-meta {
	padding: 0.6em 0.1em 0;
}

.ytgc-title {
	display: block;
	font-size: 0.92em;
	font-weight: 500;
	line-height: 1.4;
	text-decoration: none;
	color: inherit;
	border: none;
}

.ytgc-title:hover {
	text-decoration: underline;
}

.ytgc-date {
	display: block;
	margin-top: 0.15em;
	font-size: 0.78em;
	color: var(--ytgc-muted);
}

/* ---------- Hover titles ---------- */

.ytgc-hover-title {
	position: absolute;
	inset: auto 0 0 0;
	padding: 1.8em 0.8em 0.7em;
	font-size: 0.85em;
	font-weight: 500;
	line-height: 1.35;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}

.ytgc-thumb:hover .ytgc-hover-title,
.ytgc-thumb:focus-visible .ytgc-hover-title {
	opacity: 1;
	transform: translateY(0);
}

@media (hover: none) {
	.ytgc-hover-title {
		opacity: 1;
		transform: none;
	}
}

/* ---------- Channel header ---------- */

.ytgc-channel {
	display: flex;
	align-items: center;
	gap: 1em;
	margin-bottom: 1.4em;
	padding-bottom: 1.2em;
	border-bottom: 1px solid var(--ytgc-rule);
}

.ytgc-channel-avatar {
	flex-shrink: 0;
	border: none;
	line-height: 0;
}

.ytgc-channel-avatar img {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
}

.ytgc-channel-text {
	flex: 1;
	min-width: 0;
}

.ytgc-channel-name {
	display: inline-block;
	font-size: 1.05em;
	font-weight: 600;
	color: inherit;
	text-decoration: none;
	border: none;
}

.ytgc-channel-name:hover {
	text-decoration: underline;
}

.ytgc-channel-desc {
	margin: 0.25em 0 0;
	font-size: 0.85em;
	color: var(--ytgc-muted);
	line-height: 1.5;
}

.ytgc-subscribe {
	flex-shrink: 0;
	align-self: center;
	font-size: 0.8em;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	padding: 0.55em 1.4em;
	border: 1px solid currentColor;
	border-radius: var(--ytgc-radius);
	color: inherit;
	transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.ytgc-subscribe:hover {
	background: #c00;
	border-color: #c00;
	color: #fff;
}

@media (max-width: 560px) {
	.ytgc-channel {
		flex-wrap: wrap;
	}

	.ytgc-channel-desc {
		flex-basis: 100%;
	}
}

.ytgc-style-cinema .ytgc-channel-desc {
	color: rgba(255, 255, 255, 0.6);
}

.ytgc-style-cards .ytgc-subscribe {
	border-radius: 999px;
}

/* ---------- Load more ---------- */

.ytgc-more-wrap {
	text-align: center;
	margin-top: 1.6em;
}

.ytgc-more {
	font: inherit;
	font-size: 0.85em;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 0.7em 2em;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: var(--ytgc-radius);
	cursor: pointer;
	transition: background 0.25s ease, color 0.25s ease;
}

.ytgc-more:hover:not(:disabled) {
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
}

.ytgc-more:disabled {
	opacity: 0.5;
	cursor: wait;
}

/* ---------- Inline stage ---------- */

.ytgc-stage {
	margin-bottom: var(--ytgc-gap);
}

.ytgc-stage-player {
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: var(--ytgc-radius);
	overflow: hidden;
}

.ytgc-stage-player iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.ytgc-stage-bar {
	display: flex;
	align-items: baseline;
	gap: 1em;
	padding: 0.5em 0.1em;
	font-size: 0.88em;
}

.ytgc-stage-title {
	flex: 1;
	font-weight: 500;
}

.ytgc-stage-link {
	white-space: nowrap;
	font-size: 0.85em;
	color: var(--ytgc-muted);
}

.ytgc-stage-close {
	background: none;
	border: none;
	font-size: 1.3em;
	line-height: 1;
	cursor: pointer;
	color: var(--ytgc-muted);
	padding: 0 0.2em;
}

.ytgc-stage-close:hover {
	color: inherit;
}

/* ---------- Lightbox ---------- */

.ytgc-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.88);
	padding: 4vmin;
}

.ytgc-lightbox-inner {
	width: min(1100px, 100%);
}

.ytgc-lightbox-player {
	aspect-ratio: 16 / 9;
	background: #000;
}

.ytgc-lightbox-player iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.ytgc-lightbox-bar {
	display: flex;
	align-items: baseline;
	gap: 1em;
	padding: 0.7em 0.2em;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.9em;
}

.ytgc-lightbox-title {
	flex: 1;
}

.ytgc-lightbox-link {
	color: rgba(255, 255, 255, 0.6);
	white-space: nowrap;
}

.ytgc-lightbox-link:hover {
	color: #fff;
}

.ytgc-lightbox-close {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.7);
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
	padding: 0 0.2em;
}

.ytgc-lightbox-close:hover {
	color: #fff;
}

.ytgc-no-scroll {
	overflow: hidden;
}

/* Editor-only notice */
.ytgc-notice {
	padding: 0.8em 1em;
	border: 1px dashed rgba(0, 0, 0, 0.3);
	border-radius: 3px;
	font-size: 0.85em;
	color: rgba(0, 0, 0, 0.6);
}

/* ---------- Style: theme (inherit) ---------- */
/* Intentionally minimal: typography and colors flow from the theme. */

/* ---------- Style: minimal / editorial ---------- */

.ytgc-style-minimal {
	--ytgc-gap: 1.6rem;
	--ytgc-muted: #8a8a8e;
	--ytgc-rule: #e3e3e6;
}

.ytgc-style-minimal .ytgc-title {
	font-weight: 400;
}

.ytgc-style-minimal .ytgc-thumb img {
	filter: saturate(0.92);
}

.ytgc-style-minimal .ytgc-thumb:hover img {
	filter: saturate(1);
}

.ytgc-style-minimal .ytgc-date {
	font-variant: small-caps;
	letter-spacing: 0.1em;
}

/* ---------- Style: dark cinema ---------- */

.ytgc-style-cinema {
	--ytgc-gap: 1rem;
	--ytgc-muted: rgba(255, 255, 255, 0.5);
	--ytgc-rule: rgba(255, 255, 255, 0.15);
	background: #101012;
	color: rgba(255, 255, 255, 0.92);
	padding: 1.6em;
	border-radius: 4px;
}

.ytgc-style-cinema .ytgc-heading {
	color: rgba(255, 255, 255, 0.92);
}

.ytgc-style-cinema .ytgc-thumb img {
	opacity: 0.85;
}

.ytgc-style-cinema .ytgc-thumb:hover img {
	opacity: 1;
}

.ytgc-style-cinema .ytgc-more {
	color: rgba(255, 255, 255, 0.85);
	border-color: rgba(255, 255, 255, 0.4);
}

.ytgc-style-cinema .ytgc-more:hover:not(:disabled) {
	background: #fff;
	color: #101012;
}

.ytgc-style-cinema .ytgc-stage-link,
.ytgc-style-cinema .ytgc-stage-close {
	color: rgba(255, 255, 255, 0.6);
}

/* ---------- Style: modern cards ---------- */

.ytgc-style-cards {
	--ytgc-gap: 1.4rem;
	--ytgc-radius: 10px;
	--ytgc-muted: #71717a;
}

.ytgc-style-cards .ytgc-item {
	background: #fff;
	border: 1px solid #e8e8ec;
	border-radius: calc(var(--ytgc-radius) + 2px);
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.ytgc-style-cards .ytgc-item:hover {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.ytgc-style-cards .ytgc-thumb {
	border-radius: 0;
}

.ytgc-style-cards .ytgc-meta {
	padding: 0.75em 1em 1em;
}

.ytgc-style-cards .ytgc-more {
	border-radius: 999px;
}
