/*
 * 홈 섹션 스타일.
 *
 * 클래스는 전부 nn-hs-* 로 따로 쓴다.
 * 처음에는 테마의 .nn-card / .nn-recent-item 을 재사용했는데,
 * 그 규칙들이 블록 에디터가 만드는 다른 구조를 전제로 해서 레이아웃이 깨졌다.
 * (.nn-card 는 flex row 가 기본이고, 세로 방향은 코어의 grid 래퍼 안에서만 걸린다)
 * 섹션 제목(.nn-section-label)과 더보기(.nn-more)는 테마 것을 그대로 쓴다.
 */

.nn-home-section {
	margin-block-start: var(--wp--preset--spacing--60, 4rem);
}

.nn-home-section:first-child {
	margin-block-start: var(--wp--preset--spacing--50, 3rem);
}

.nn-home-items {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ── 카드 그리드 ── */

.nn-home-section.is-grid .nn-home-items {
	display: grid;
	grid-template-columns: repeat(var(--nn-cols, 4), minmax(0, 1fr));
	gap: var(--wp--preset--spacing--40, 2rem) var(--wp--preset--spacing--30, 1.5rem);
}

.nn-hs-card {
	display: flex;
	flex-direction: column;
	margin: 0;
	min-width: 0;
}

.nn-hs-thumb {
	display: block;
}

.nn-hs-thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: var(--nn-radius, 6px);
}

/* ── 컴팩트 목록 ── */

.nn-hs-row {
	display: flex;
	gap: 0.9rem;
	align-items: flex-start;
	margin: 0;
	padding-block: 0.85rem;
	border-block-start: 1px solid var(--nn-line, #e2e2df);
}

.nn-home-section.is-list .nn-home-items > .nn-hs-row:first-child {
	border-block-start: 0;
	padding-block-start: 0;
}

.nn-hs-thumb.is-small {
	flex: 0 0 auto;
}

.nn-hs-thumb.is-small img {
	width: 56px;
	height: 56px;
	aspect-ratio: auto;
}

.nn-hs-body {
	min-width: 0;
}

/* ── 공통 ── */

.nn-hs-terms {
	margin-block-start: 0.7rem;
	color: var(--nn-muted, #67696d);
}

.nn-hs-row .nn-hs-terms {
	margin-block-start: 0.2rem;
}

.nn-hs-terms a {
	color: inherit;
	text-decoration: none;
}

.nn-hs-terms a:hover {
	text-decoration: underline;
}

.nn-hs-title {
	margin: 0.25rem 0 0;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.45;
	letter-spacing: -0.02em;
	word-break: keep-all;
	overflow-wrap: anywhere;
}

.nn-hs-row .nn-hs-title {
	margin-block-start: 0;
}

.nn-hs-title a {
	color: inherit;
	text-decoration: none;
}

.nn-hs-title a:hover {
	text-decoration: underline;
}

.nn-home-section .nn-more {
	margin-block-start: var(--wp--preset--spacing--30, 1.5rem);
}

/* 1열일 때는 썸네일을 더 납작하게. 안 그러면 카드 하나가 화면을 다 먹는다 */
.nn-home-section.is-grid[style*="--nn-cols:1"] .nn-hs-thumb img {
	aspect-ratio: 21 / 9;
}

@media (max-width: 781px) {
	/* 열 수 설정과 상관없이 2열. 4열은 글자가 뭉개진다 */
	.nn-home-section.is-grid .nn-home-items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--30, 1.5rem) 1rem;
	}

	.nn-home-section.is-grid[style*="--nn-cols:1"] .nn-home-items {
		grid-template-columns: 1fr;
	}

	/*
	 * 가로 슬라이드 — 항목이 많은 섹션용.
	 * 8편을 2열로 쌓으면 네 줄이라 화면이 한참 길어진다.
	 * JS 없이 scroll-snap 만 쓴다.
	 */
	.nn-home-section.is-mobile-slide .nn-home-items {
		display: flex;
		gap: 0.9rem;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding-block-end: 0.25rem;
	}

	.nn-home-section.is-mobile-slide .nn-home-items::-webkit-scrollbar {
		display: none;
	}

	/* 다음 카드가 살짝 보이게 해서 넘길 수 있다는 걸 알린다 */
	.nn-home-section.is-mobile-slide .nn-hs-card {
		flex: 0 0 78%;
		max-width: 78%;
		scroll-snap-align: start;
	}
}

@media (max-width: 480px) {
	.nn-home-section.is-mobile-slide .nn-hs-card {
		flex-basis: 84%;
		max-width: 84%;
	}
}

/* ==========================================================================
   히어로 — 배경 사진 + 막 + 글
   ========================================================================== */

.nn-hero {
	position: relative;
	display: flex;
	align-items: center;
	isolation: isolate;
	/* 개인 블로그다. 히어로가 첫 화면을 다 먹으면 글이 안 보인다 */
	padding-block: var(--wp--preset--spacing--40, 2rem);
	padding-inline: var(--wp--style--root--padding-left, 1.5rem);
	overflow: hidden;
	margin-block-start: 0;
}

/*
 * 헤더와 붙인다.
 * main 이 받는 위쪽 간격이 남아 있으면 어두운 히어로 위로 흰 띠가 보인다.
 */
.wp-site-blocks > main:has(> .nn-hero:first-child) {
	margin-block-start: 0;
}

.nn-hero-bg,
.nn-hero-dim {
	position: absolute;
	inset: 0;
	z-index: -1;
}

.nn-hero-bg {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nn-hero-dim {
	background: var(--wp--preset--color--contrast, #17181a);
}

.nn-hero-inner {
	width: 100%;
	max-width: var(--wp--style--global--wide-size, 68rem);
	margin-inline: auto;
}

.nn-hero.is-align-center .nn-hero-inner {
	text-align: center;
}

.nn-hero-lead {
	margin: 0;
	font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.25rem);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: -0.028em;
	max-width: 20em;
	text-wrap: balance;
	word-break: keep-all;
}

.nn-hero-sub {
	margin: var(--wp--preset--spacing--30, 1.5rem) 0 0;
	max-width: 34em;
	word-break: keep-all;
	overflow-wrap: anywhere;
}

.nn-hero.is-align-center .nn-hero-lead,
.nn-hero.is-align-center .nn-hero-sub {
	margin-inline: auto;
}

.nn-hero-btns {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-block-start: var(--wp--preset--spacing--40, 2rem);
}

.nn-hero.is-align-center .nn-hero-btns {
	justify-content: center;
}

.nn-hero-btn {
	display: inline-block;
	padding: 0.6rem 1.2rem;
	border: 1px solid;
	border-radius: var(--nn-radius, 6px);
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 120ms ease, color 120ms ease;
}

/* 어두운 사진 위 — 흰 글자 */
.nn-hero.is-light .nn-hero-lead { color: #fff; }
.nn-hero.is-light .nn-hero-sub  { color: rgba(255, 255, 255, 0.82); }
.nn-hero.is-light .nn-hero-btn  { color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.nn-hero.is-light .nn-hero-btn:hover,
.nn-hero.is-light .nn-hero-btn:focus-visible {
	color: var(--wp--preset--color--contrast, #17181a);
	border-color: #fff;
	background: #fff;
}

/* 밝은 사진 위 — 검은 글자. 막도 흰색으로 바꾼다 */
.nn-hero.is-dark .nn-hero-dim  { background: var(--wp--preset--color--base, #fcfcfb); }
.nn-hero.is-dark .nn-hero-lead { color: var(--wp--preset--color--contrast, #17181a); }
.nn-hero.is-dark .nn-hero-sub  { color: var(--nn-muted, #67696d); }
.nn-hero.is-dark .nn-hero-btn  { color: var(--wp--preset--color--contrast, #17181a); border-color: rgba(23, 24, 26, 0.45); }
.nn-hero.is-dark .nn-hero-btn:hover,
.nn-hero.is-dark .nn-hero-btn:focus-visible {
	color: var(--wp--preset--color--base, #fcfcfb);
	background: var(--wp--preset--color--contrast, #17181a);
	border-color: var(--wp--preset--color--contrast, #17181a);
}

.nn-hero-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}
