/*
 * Momapt 테마 공통 스타일.
 * 디자인 토큰(색상·폰트·간격)은 theme.json 프리셋(CSS 변수)을 사용한다.
 */

html {
	scroll-behavior: smooth;
}

/* ── 헤더 ─────────────────────────────────────────────── */
.momapt-site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: 1px solid var(--wp--preset--color--surface);
}

/* ── 히어로 ─────────────────────────────────────────── */
/*
 * 배경 이미지(그라데이션 + hero-bg.jpg)는 functions.php 에서
 * 절대 URL 인라인 스타일로 주입된다. 여기서는 이미지 로드 전/실패 대비
 * 네이비 단색 폴백만 지정한다.
 */
.momapt-hero {
	background-color: var(--wp--preset--color--primary);
	background-size: cover;
	background-position: center;
	min-height: 460px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.momapt-hero__title {
	color: #ffffff;
	text-shadow: 0 2px 12px rgba(16, 28, 46, 0.35);
}

.momapt-hero__sub {
	color: rgba(255, 255, 255, 0.88);
	max-width: 34em;
	text-shadow: 0 1px 8px rgba(16, 28, 46, 0.35);
}

.momapt-hero__cta .wp-block-button__link {
	background: #ffffff;
	color: var(--wp--preset--color--primary);
}

.momapt-hero__cta .wp-block-button__link:hover {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary);
}

/* ── 브레드크럼 ───────────────────────────────────────── */
.momapt-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	list-style: none;
	margin: 0 0 var(--wp--preset--spacing--20);
	padding: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--secondary);
}

.momapt-breadcrumb li:not(:last-child)::after {
	content: "›";
	margin-left: 0.25rem;
	color: var(--wp--preset--color--secondary);
}

.momapt-breadcrumb a {
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
}

.momapt-breadcrumb a:hover {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

.momapt-breadcrumb li[aria-current="page"] span {
	color: var(--wp--preset--color--text);
	font-weight: 500;
}

/* ── 목차(TOC) ────────────────────────────────────────── */
.momapt-toc {
	margin: var(--wp--preset--spacing--30) 0;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--surface);
	border: 1px solid #e2e8f0;
	border-radius: 12px;
}

.momapt-toc__summary {
	cursor: pointer;
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	list-style-position: inside;
}

.momapt-toc__list {
	margin: var(--wp--preset--spacing--10) 0 0;
	padding-left: 1.25rem;
}

.momapt-toc__list li {
	margin: 0.375rem 0;
}

.momapt-toc__list a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.momapt-toc__list a:hover {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

/* ── 글 메타 ─────────────────────────────────────────── */
.momapt-post-meta {
	gap: var(--wp--preset--spacing--20);
	color: var(--wp--preset--color--secondary);
}

/* ── 글 카드 (홈 최신 글 / index / archive 그리드 공용) ── */
/*
 * 그리드 행 높이에 맞춰 카드가 늘어나도록 처리.
 * WP 버전에 따라 post-template 그리드가 is-layout-grid 또는
 * is-flex-container(columns-N)로 렌더링되므로 둘 다 커버한다.
 */
.wp-block-post-template.is-layout-grid > .wp-block-post,
.wp-block-post-template.is-flex-container > .wp-block-post {
	height: 100%;
}

.wp-block-post-template.is-flex-container > .wp-block-post {
	align-self: stretch;
}

.momapt-post-card {
	background: var(--wp--preset--color--background);
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
	padding-bottom: var(--wp--preset--spacing--20);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
	height: 100%;
	display: flex;
	flex-direction: column;
}

/* 제목이 1줄이든 2줄이든 날짜는 항상 카드 맨 아래에 고정 */
.momapt-post-card .wp-block-post-date {
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--20);
}

.momapt-post-card:hover {
	box-shadow: 0 8px 24px rgba(31, 58, 95, 0.12);
	transform: translateY(-2px);
}

.momapt-post-card .wp-block-post-featured-image {
	margin: 0 0 var(--wp--preset--spacing--20);
}

.momapt-post-card .wp-block-post-terms,
.momapt-post-card .wp-block-post-title,
.momapt-post-card .wp-block-post-date {
	padding-left: var(--wp--preset--spacing--20);
	padding-right: var(--wp--preset--spacing--20);
}

.momapt-post-card .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--text);
}

.momapt-post-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--primary);
}

/* ── 카테고리 큐레이션 ───────────────────────────────── */
.momapt-curation-item {
	padding: 0.625rem 0;
	border-bottom: 1px solid #e2e8f0;
}

.momapt-curation-item .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--text);
}

.momapt-curation-item .wp-block-post-title a:hover {
	color: var(--wp--preset--color--primary);
}

.momapt-curation-more a {
	font-weight: 600;
	text-decoration: none;
}

/* ── 관련 글 ─────────────────────────────────────────── */
.momapt-related {
	margin-top: var(--wp--preset--spacing--40);
}

.momapt-related__heading {
	font-size: var(--wp--preset--font-size--x-large);
	color: var(--wp--preset--color--primary);
	margin-bottom: var(--wp--preset--spacing--30);
}

.momapt-related__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--wp--preset--spacing--30);
}

.momapt-related__thumb {
	display: block;
	border-radius: 12px;
	overflow: hidden;
	margin-bottom: var(--wp--preset--spacing--10);
}

.momapt-related__thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	transition: transform 0.2s ease;
}

.momapt-related__thumb:hover img {
	transform: scale(1.03);
}

.momapt-related__title {
	font-size: var(--wp--preset--font-size--medium);
	margin: 0 0 0.25rem;
}

.momapt-related__title a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.momapt-related__title a:hover {
	color: var(--wp--preset--color--primary);
}

.momapt-related__date {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--secondary);
}

@media (max-width: 781px) {
	.momapt-related__grid {
		grid-template-columns: 1fr;
	}
}

/* ── 푸터 ───────────────────────────────────────────── */
.momapt-footer-links a {
	text-decoration: none;
}

.momapt-footer-links a:hover {
	text-decoration: underline;
}

/* ── 스크롤 탑 버튼 ──────────────────────────────────── */
.momapt-scroll-top {
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 200;
	width: 2.75rem;
	height: 2.75rem;
	border: none;
	border-radius: 50%;
	background: var(--wp--preset--color--primary);
	color: #fff;
	font-size: 1.125rem;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(0.5rem);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
	box-shadow: 0 4px 12px rgba(31, 58, 95, 0.3);
}

.momapt-scroll-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.momapt-scroll-top:hover {
	background: var(--wp--preset--color--secondary);
}
