/**
 * 자료실 — archive + single
 */

/* Match site pages: white body bg */
body.post-type-archive-library,
body.single-library {
	background: #fff;
}

/* Astra's .ast-container uses display:flex (row) which would line up our
   hero section and the card grid side-by-side. Force block stacking. */
body.post-type-archive-library .ast-container,
body.single-library .ast-container {
	display: block !important;
}

.mg-library-page {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px 80px;
}

@media (max-width: 768px) {
	.mg-library-page {
		padding: 0 16px 60px;
	}
}

/* Grid */
.mg-library-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 28px 24px;
}

@media (max-width: 900px) {
	.mg-library-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
	.mg-library-grid { grid-template-columns: 1fr; }
}

.mg-library-card {
	margin: 0;
}

.mg-library-card-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.mg-library-card-thumb {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 56.25%; /* 16:9 */
	background: #1a1a1a center/cover no-repeat;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 14px;
}

.mg-library-card-thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.25) 100%);
	pointer-events: none;
}

.mg-library-card-play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 56px;
	height: 56px;
	transform: translate(-50%, -50%);
	background: rgba(255,255,255,0.92);
	border-radius: 50%;
	box-shadow: 0 4px 16px rgba(0,0,0,0.2);
	transition: transform 0.2s ease, background 0.2s ease;
	z-index: 1;
}

.mg-library-card-play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	width: 0;
	height: 0;
	border-left: 16px solid #A32424;
	border-top: 10px solid transparent;
	border-bottom: 10px solid transparent;
}

.mg-library-card-link:hover .mg-library-card-play {
	transform: translate(-50%, -50%) scale(1.08);
	background: #fff;
}

.mg-library-card-body {
	padding: 0 2px;
}

.mg-library-card-title {
	font-size: 16px;
	font-weight: 700;
	color: #222;
	line-height: 1.4;
	margin: 0 0 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mg-library-card-date {
	font-size: 12px;
	color: #8a8a8a;
}

.mg-library-pagination {
	margin-top: 50px;
	text-align: center;
}

.mg-library-pagination .nav-links {
	display: inline-flex;
	gap: 6px;
}

.mg-library-pagination .page-numbers {
	padding: 8px 13px;
	border: 1px solid #ececec;
	border-radius: 4px;
	color: #606060;
	font-size: 13px;
	text-decoration: none;
}

.mg-library-pagination .page-numbers.current,
.mg-library-pagination .page-numbers:hover {
	background: #A32424;
	border-color: #A32424;
	color: #fff;
}

.mg-library-empty {
	text-align: center;
	padding: 60px 20px;
	color: #8a8a8a;
}

/* Single */
.mg-library-single {
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 60px 20px 80px;
	box-sizing: border-box;
}

.mg-library-single-header {
	margin-bottom: 28px;
}

.mg-library-back {
	display: inline-block;
	font-size: 13px;
	color: #8a8a8a;
	text-decoration: none;
	margin-bottom: 14px;
}

.mg-library-back:hover {
	color: #A32424;
}

.mg-library-single-title {
	font-size: 26px;
	font-weight: 700;
	color: #222;
	margin: 0 0 8px;
	line-height: 1.35;
}

.mg-library-single-date {
	font-size: 12px;
	color: #8a8a8a;
}

.mg-library-video {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 56.25%; /* 16:9 */
	background: #000;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 32px;
}

.mg-library-video iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.mg-library-video-error {
	padding: 20px;
	background: #fff5f5;
	border: 1px solid #fcc;
	border-radius: 6px;
	color: #a33;
	font-size: 13px;
}

.mg-library-content {
	font-size: 15px;
	color: #333;
	line-height: 1.8;
}

.mg-library-content p {
	margin: 0 0 1em;
}
