/* ===================================================================
   유튜브 최신 영상 위젯 - 기본 스킨
   PC: 가로 한 줄 그리드 / 모바일: 가로 스크롤 (스크롤 스냅)
   =================================================================== */

.ytw-widget {
	--ytw-gap: 16px;
	--ytw-radius: 12px;
	--ytw-secondary: #8a8f98;
	margin: 0 auto;
	font-family: inherit;
}

/* ----- 상단 헤더 (제목 + 새로고침) ----- */
.ytw-widget .ytw-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 14px;
}
.ytw-widget .ytw-title {
	margin: 0;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
}
.ytw-widget .ytw-head-right {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}
.ytw-widget .ytw-updated {
	font-size: 12px;
	color: var(--ytw-secondary);
	white-space: nowrap;
}
.ytw-widget .ytw-refresh {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: 1px solid rgba(128, 134, 143, .35);
	border-radius: 50%;
	color: var(--ytw-secondary);
	background: transparent;
	text-decoration: none;
	transition: transform .35s ease, color .2s, border-color .2s;
}
.ytw-widget .ytw-refresh:hover {
	color: #f03;
	border-color: #f03;
	transform: rotate(180deg);
}

/* ----- 오류 메시지 ----- */
.ytw-widget .ytw-error {
	margin: 0;
	padding: 18px 16px;
	border: 1px dashed rgba(128, 134, 143, .45);
	border-radius: var(--ytw-radius);
	font-size: 13px;
	color: var(--ytw-secondary);
	text-align: center;
}

/* ----- 카드 그리드 ----- */
.ytw-widget .ytw-grid {
	display: grid;
	grid-template-columns: repeat(var(--ytw-cols, 5), minmax(0, 1fr));
	gap: var(--ytw-gap);
}

/* ----- 카드 ----- */
.ytw-widget .ytw-card {
	display: block;
	min-width: 0;
	text-decoration: none;
	color: inherit;
}
.ytw-widget .ytw-card:hover { text-decoration: none; }

/* 썸네일: 유튜브 표준 16:9 */
.ytw-widget .ytw-thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	border-radius: var(--ytw-radius);
	overflow: hidden;
	background: rgba(128, 134, 143, .15);
}
.ytw-widget .ytw-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .3s ease;
}
.ytw-widget .ytw-card:hover .ytw-thumb img { transform: scale(1.05); }

/* NEW 배지 (24시간 이내 영상) */
.ytw-widget .ytw-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	padding: 2px 7px;
	border-radius: 5px;
	background: #f03;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .06em;
	line-height: 1.5;
}

/* ----- 텍스트 영역: 썸네일 너비를 넘지 않도록 말줄임 처리 ----- */
.ytw-widget .ytw-meta {
	display: block;
	padding: 9px 2px 0;
	min-width: 0;
}
.ytw-widget .ytw-video-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;          /* 제목은 최대 2줄 */
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: inherit;
	word-break: break-all;
}
.ytw-widget .ytw-channel {
	display: block;
	margin-top: 4px;
	overflow: hidden;
	text-overflow: ellipsis;        /* 채널명은 1줄 말줄임 */
	white-space: nowrap;
	font-size: 12.5px;
	color: var(--ytw-secondary);
}
.ytw-widget .ytw-channel:hover { color: inherit; }
.ytw-widget .ytw-date {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: var(--ytw-secondary);
}

/* ----- 태블릿/모바일: 가로 스크롤 + 스냅 ----- */
@media (max-width: 860px) {
	.ytw-widget .ytw-grid {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 6px;
		scrollbar-width: thin;
	}
	.ytw-widget .ytw-card {
		flex: 0 0 46%;
		max-width: 46%;
		scroll-snap-align: start;
	}
}
@media (max-width: 480px) {
	.ytw-widget .ytw-card {
		flex: 0 0 70%;
		max-width: 70%;
	}
}
