/*
Theme Name: 온하루
Theme URI: https://blog.onharu.app
Description: Twenty Twenty-Five 자식 테마. 먹색, Noto Sans KR, 기록장형 글 목록.
Template: twentytwentyfive
Version: 1.2.0
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 7.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: onharu
*/

/* 색은 theme.json 팔레트를 그대로 가리킨다. 사이트 편집기에서 색을 바꾸면 여기도 따라간다. */
:root {
	--onharu-wrap: 1080px;
	--onharu-gutter: 20px;
	--onharu-ground: var(--wp--preset--color--base);
	--onharu-ink: var(--wp--preset--color--contrast);
	--onharu-surface: var(--wp--preset--color--accent-1);
	--onharu-wash: var(--wp--preset--color--accent-2);
	--onharu-accent: var(--wp--preset--color--accent-3);
	--onharu-soft: var(--wp--preset--color--accent-4);
	--onharu-rule-soft: var(--wp--preset--color--accent-5);
	--onharu-rule: var(--wp--preset--color--accent-6);
	--onharu-faint: var(--wp--preset--color--faint);
	--onharu-sans: var(--wp--preset--font-family--manrope);
	--onharu-mono: var(--wp--preset--font-family--fira-code);
}

/* 전역 스타일의 :root 변수가 이 파일보다 늦게 출력되므로 선택자를 한 단계 높인다. */
@media (prefers-color-scheme: dark) {
	:root:root {
		--wp--preset--color--base: #101011;
		--wp--preset--color--contrast: #E8E8E9;
		--wp--preset--color--accent-1: #171818;
		--wp--preset--color--accent-2: #212223;
		--wp--preset--color--accent-3: #B4B8BA;
		--wp--preset--color--accent-4: #96999B;
		--wp--preset--color--accent-5: #1D1E1F;
		--wp--preset--color--accent-6: #2A2B2C;
		--wp--preset--color--faint: #6C6F71;
	}
}

body {
	-webkit-font-smoothing: antialiased;
	word-break: keep-all;
	overflow-wrap: anywhere;
}

/* 머리·본문·바닥 사이 여백은 아래에서 직접 준다. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

a:focus-visible {
	outline: 2px solid var(--onharu-accent);
	outline-offset: 3px;
}

/* ---------- 상단 ---------- */
.onharu-masthead {
	border-bottom: 1px solid var(--onharu-rule);
}
.onharu-masthead-in {
	max-width: var(--onharu-wrap);
	min-height: 60px;
	margin-inline: auto;
	padding-inline: var(--onharu-gutter);
	gap: 16px;
}
.onharu-wordmark {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1.4;
}
.onharu-wordmark a {
	color: var(--onharu-ink);
	text-decoration: none;
}
.onharu-nav {
	gap: 22px;
	font-size: 0.9rem;
}
.onharu-nav a {
	color: var(--onharu-soft);
	text-decoration: none;
}
.onharu-nav a:hover {
	color: var(--onharu-ink);
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* ---------- 첫 화면 문구 · 카테고리 제목 ---------- */
.onharu-banner {
	max-width: var(--onharu-wrap);
	margin: 0 auto;
	padding: 56px var(--onharu-gutter) 40px;
}
.onharu-banner > * {
	margin: 0;
}
.onharu-banner p {
	max-width: 34em;
	color: var(--onharu-soft);
	font-size: 1rem;
	line-height: 1.8;
}
.onharu-archive-title {
	font-size: 1.35rem;
	font-weight: 700;
}
.onharu-banner .wp-block-term-description {
	margin-top: 8px;
}

/* ---------- 본문 + 오른쪽 칸 ---------- */
.onharu-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 244px;
	gap: 56px;
	align-items: start;
	max-width: var(--onharu-wrap);
	margin: 0 auto;
	padding: 0 var(--onharu-gutter) 72px;
}
.onharu-grid > * {
	margin: 0 !important;
}
.onharu-grid-single {
	padding-top: 48px;
}
/* 블록 사이 기본 간격이 "기록" 제목과 첫 글 사이에 한 번 더 끼어든다. 글 항목이 자체 여백을 가지므로 뺀다. */
.onharu-col-main > * + * {
	margin-block-start: 0;
}
.onharu-rail {
	position: sticky;
	top: 24px;
}

.onharu-label {
	margin: 0 0 4px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--onharu-rule);
	color: var(--onharu-faint);
	font-size: 0.78rem !important;
	font-weight: 400;
	letter-spacing: 0.02em;
	line-height: 1.5;
}

/* ---------- 글 목록 ---------- */
.onharu-entries .wp-block-post-template {
	margin: 0;
	padding: 0;
	list-style: none;
}
.onharu-entries .wp-block-post-template > li {
	margin: 0;
}
.onharu-entry {
	display: grid;
	grid-template-columns: 92px minmax(0, 1fr) 200px;
	gap: 22px;
	padding-block: 26px;
	border-bottom: 1px solid var(--onharu-rule-soft);
}
/* 대표 이미지가 없는 글은 썸네일 칸을 없애고 본문 칸을 넓힌다. */
.onharu-entry:not(:has(.wp-block-post-featured-image)) {
	grid-template-columns: 92px minmax(0, 1fr);
}
.onharu-entry > * {
	margin: 0 !important;
}
.onharu-entry-meta {
	display: flex;
	flex-direction: column;
	gap: 7px;
	padding-top: 4px;
}
.onharu-entry-meta > * {
	margin: 0 !important;
}
.onharu-date {
	color: var(--onharu-faint);
	font-family: var(--onharu-mono);
	font-size: 0.76rem;
	font-variant-numeric: tabular-nums;
}
.onharu-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	font-size: 0.7rem;
}
.onharu-chips a {
	display: inline-block;
	padding: 1px 7px;
	border: 1px solid var(--onharu-accent);
	border-radius: 2px;
	color: var(--onharu-accent);
	line-height: 1.7;
	text-decoration: none;
	white-space: nowrap;
}
.onharu-chips a:hover {
	background: var(--onharu-wash);
}
.onharu-chips .wp-block-post-terms__separator {
	display: none;
}
.onharu-entry-title {
	margin: 0 0 8px !important;
	font-size: 1.2rem !important;
	font-weight: 500;
	line-height: 1.5;
}
.onharu-entry-title a {
	color: var(--onharu-ink);
	text-decoration: none;
}
.onharu-entry-title a:hover {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}
.onharu-excerpt,
.onharu-excerpt p {
	margin: 0;
	color: var(--onharu-soft);
	font-size: 0.94rem;
	line-height: 1.8;
}
.onharu-excerpt .wp-block-post-excerpt__more-text {
	display: none;
}
.onharu-thumb {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: 3px;
	background: var(--onharu-rule-soft);
}
.onharu-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.onharu-entries .wp-block-query-pagination {
	padding-top: 28px;
	color: var(--onharu-soft);
	font-size: 0.88rem;
}
.onharu-entries .wp-block-query-pagination a {
	text-decoration: none;
}

/* ---------- 오른쪽 칸 ---------- */
.onharu-rail-in {
	display: flex;
	flex-direction: column;
	gap: 38px;
}
.onharu-rail-in > *,
.onharu-widget > * {
	margin: 0 !important;
}
.onharu-about {
	margin-top: 10px !important;
	color: var(--onharu-soft);
	font-size: 0.9rem;
	line-height: 1.8;
}
.onharu-about strong {
	color: var(--onharu-ink);
	font-weight: 500;
}
.onharu-cats {
	margin: 0;
	padding: 0;
	list-style: none;
}
/* 글 수는 링크 뒤에 글자로만 붙어 나와서 li 전체를 흐린 고정폭으로 두고 링크만 되돌린다. */
.onharu-cats li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	padding-block: 9px;
	border-bottom: 1px solid var(--onharu-rule-soft);
	color: var(--onharu-faint);
	font-family: var(--onharu-mono);
	font-size: 0.78rem;
}
.onharu-cats li a {
	color: var(--onharu-soft);
	font-family: var(--onharu-sans);
	font-size: 0.9rem;
	text-decoration: none;
}
.onharu-cats li a:hover {
	color: var(--onharu-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- 글 하나 ---------- */
.onharu-article {
	max-width: 680px;
}
.onharu-article > * {
	margin-block: 0;
}
.onharu-entry-meta-row {
	flex-direction: row;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px !important;
}
.onharu-article-title {
	margin: 0 0 28px !important;
	font-size: 1.75rem !important;
	line-height: 1.4;
}
.onharu-content {
	color: var(--onharu-ink);
	font-size: 1.0625rem;
	line-height: 1.9;
}
.onharu-content > * {
	margin-block: 0 1.3em;
}
.onharu-content h2 {
	margin: 2.2em 0 0.7em;
	font-size: 1.35rem;
}
.onharu-content h3 {
	margin: 1.8em 0 0.6em;
	font-size: 1.12rem;
}
.onharu-content ul,
.onharu-content ol {
	padding-left: 1.5em;
}
.onharu-content li {
	margin-bottom: 0.5em;
}
.onharu-content li::marker {
	color: var(--onharu-faint);
}
.onharu-content a {
	text-underline-offset: 3px;
}
.onharu-content blockquote {
	margin: 1.6em 0;
	padding: 2px 0 2px 18px;
	border-left: 2px solid var(--onharu-rule);
	color: var(--onharu-soft);
}
.onharu-content code {
	padding: 1px 5px;
	border-radius: 2px;
	background: var(--onharu-wash);
	font-family: var(--onharu-mono);
	font-size: 0.88em;
}
.onharu-content pre {
	overflow-x: auto;
	padding: 14px 16px;
	border-radius: 3px;
	background: var(--onharu-wash);
	font-family: var(--onharu-mono);
	font-size: 0.88rem;
	line-height: 1.6;
	word-break: normal;
	overflow-wrap: normal;
}
.onharu-content pre code {
	padding: 0;
	background: none;
	font-size: inherit;
}
.onharu-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92em;
}
.onharu-content th,
.onharu-content td {
	padding: 8px 10px;
	border: 1px solid var(--onharu-rule);
	text-align: left;
}
/* 본문에 넣은 큰 사진이 칸을 뚫고 나가 화면이 옆으로 밀리지 않게 한다. */
.onharu-content img {
	max-width: 100%;
	height: auto;
	border-radius: 3px;
}
.onharu-content figure {
	max-width: 100%;
	margin: 1.4em 0;
}
.onharu-content figure img {
	display: block;
}
/* 유튜브 같은 외부 영상은 고정 폭(예: 500px)으로 들어와 휴대폰 화면을 뚫고 나간다. 칸 폭에 맞춘다. */
.onharu-content iframe,
.onharu-content embed,
.onharu-content object,
.onharu-content video {
	max-width: 100%;
}
.onharu-content iframe[src*="youtube.com"],
.onharu-content iframe[src*="youtube-nocookie.com"],
.onharu-content iframe[src*="youtu.be"],
.onharu-content iframe[src*="vimeo.com"],
.onharu-content video {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: 3px;
}
.onharu-content figcaption {
	margin-top: 6px;
	color: var(--onharu-faint);
	font-size: 0.82rem;
	text-align: center;
}

/* ---------- 고정 페이지(소개 등) ---------- */
.onharu-page-narrow {
	max-width: 720px;
	margin: 0 auto;
	padding: 48px var(--onharu-gutter) 72px;
}

/* ---------- 하단 ---------- */
.onharu-foot {
	border-top: 1px solid var(--onharu-rule);
	background: var(--onharu-surface);
}
.onharu-foot-in {
	max-width: var(--onharu-wrap);
	margin: 0 auto;
	padding: 26px var(--onharu-gutter) 34px;
	gap: 12px;
	color: var(--onharu-faint);
	font-family: var(--onharu-mono);
	font-size: 0.72rem;
	letter-spacing: 0.04em;
}
.onharu-foot-in p {
	margin: 0;
}

/* ---------- 사진을 더 보이게 ---------- */
/* 홈 첫 페이지의 최신 글에 대표 사진이 있으면 사진을 크게 올린 대표 글로 보여준다.
   배치 규칙 전부를 :has() 안에 둔다. 칸 이름(grid-area)만 따로 적용되면
   사진 없는 글에서 없는 칸이 생겨 제목이 짜부라지고 날짜와 겹친다. */
.home:not(.paged) .onharu-entries .wp-block-post-template > li:first-child .onharu-entry:has(.wp-block-post-featured-image) {
	grid-template-columns: 92px minmax(0, 1fr);
	grid-template-areas:
		"thumb thumb"
		"meta  main";
	row-gap: 18px;
}
.home:not(.paged) .onharu-entries .wp-block-post-template > li:first-child .onharu-entry:has(.wp-block-post-featured-image) .onharu-thumb {
	grid-area: thumb;
	aspect-ratio: 16 / 9;
}
.home:not(.paged) .onharu-entries .wp-block-post-template > li:first-child .onharu-entry:has(.wp-block-post-featured-image) .onharu-entry-meta {
	grid-area: meta;
}
.home:not(.paged) .onharu-entries .wp-block-post-template > li:first-child .onharu-entry:has(.wp-block-post-featured-image) .onharu-entry-main {
	grid-area: main;
}
.home:not(.paged) .onharu-entries .wp-block-post-template > li:first-child .onharu-entry:has(.wp-block-post-featured-image) .onharu-entry-title {
	font-size: 1.5rem !important;
	line-height: 1.45;
}
.onharu-thumb img {
	transition: transform 0.4s ease;
}
.onharu-entry:hover .onharu-thumb img {
	transform: scale(1.03);
}

/* ---------- 홈에서는 위쪽 세 줄 문구가 소개를 대신한다 ---------- */
.home .onharu-widget-about {
	display: none;
}

/* ---------- 카테고리 "전체" ---------- */
.onharu-cats li.current-cat > a {
	color: var(--onharu-ink);
	font-weight: 500;
}

/* ---------- 방문자 수 ---------- */
.onharu-counter {
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin: 10px 0 0;
	border: 1px solid var(--onharu-rule);
	border-radius: 3px;
	background: var(--onharu-surface);
}
.onharu-counter > div {
	padding: 12px 14px;
}
.onharu-counter > div + div {
	border-left: 1px solid var(--onharu-rule-soft);
}
.onharu-counter dt {
	color: var(--onharu-faint);
	font-size: 0.74rem;
}
.onharu-counter dd {
	margin: 2px 0 0;
	color: var(--onharu-ink);
	font-family: var(--onharu-mono);
	font-size: 1.15rem;
	font-variant-numeric: tabular-nums;
	font-weight: 500;
	line-height: 1.3;
}

@media (max-width: 620px) {
	.home:not(.paged) .onharu-entries .wp-block-post-template > li:first-child .onharu-entry:has(.wp-block-post-featured-image) {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"thumb"
			"meta"
			"main";
		row-gap: 12px;
	}
	.home:not(.paged) .onharu-entries .wp-block-post-template > li:first-child .onharu-entry:has(.wp-block-post-featured-image) .onharu-entry-title {
		font-size: 1.3rem !important;
	}
}

/* ---------- 이전 글 / 다음 글 ---------- */
/* 글이 하나뿐이면 링크 없이 빈 칸만 남아 본문과 댓글 사이를 벌려놓는다. 링크가 없으면 칸째 숨긴다. */
.onharu-post-nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 48px !important;
	padding-top: 20px;
	border-top: 1px solid var(--onharu-rule);
	font-size: 0.9rem;
}
.onharu-post-nav:not(:has(a)) {
	display: none;
}
.onharu-post-nav > * {
	margin: 0 !important;
}
.onharu-post-nav-next {
	grid-column: 2;
	text-align: right;
}
.onharu-post-nav a {
	color: var(--onharu-ink);
	text-decoration: none;
}
.onharu-post-nav a:hover .post-navigation-link__title,
.onharu-post-nav a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}
.onharu-post-nav .post-navigation-link__label {
	display: block;
	color: var(--onharu-faint);
	font-size: 0.74rem;
}

/* ---------- 댓글 ---------- */
.onharu-comments {
	margin-top: 56px !important;
	padding-top: 24px;
	border-top: 1px solid var(--onharu-rule);
}
.onharu-post-nav:has(a) + .onharu-comments {
	margin-top: 28px !important;
}
.onharu-comments > * {
	margin-block: 0;
}
.onharu-comment {
	padding-block: 16px;
	border-bottom: 1px solid var(--onharu-rule-soft);
}
.onharu-comment-meta {
	gap: 10px;
	color: var(--onharu-faint);
	font-size: 0.8rem;
}
.onharu-comment-meta .wp-block-comment-author-name {
	color: var(--onharu-ink);
	font-weight: 500;
}
.onharu-comment .wp-block-comment-content p {
	margin: 6px 0 0;
	font-size: 0.95rem;
}
.onharu-comment .wp-block-comment-reply-link {
	font-size: 0.78rem;
}
.onharu-comments .comment-reply-title {
	margin: 0 0 6px;
	color: var(--onharu-faint);
	font-size: 0.78rem;
	font-weight: 400;
	letter-spacing: 0.02em;
}
.onharu-comments .comment-reply-title small {
	margin-left: 8px;
}
.onharu-comments .comment-notes,
.onharu-comments .logged-in-as {
	margin: 0 0 14px;
	color: var(--onharu-faint);
	font-size: 0.8rem;
}
.onharu-comments .comment-form p {
	margin: 0 0 14px;
}
.onharu-comments .comment-form label {
	display: block;
	margin-bottom: 4px;
	color: var(--onharu-soft);
	font-size: 0.82rem;
}
.onharu-comments .comment-form input[type="text"],
.onharu-comments .comment-form input[type="email"],
.onharu-comments .comment-form textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--onharu-rule);
	border-radius: 3px;
	background: var(--onharu-surface);
	color: var(--onharu-ink);
	font-family: var(--onharu-sans);
	font-size: 0.95rem;
	line-height: 1.6;
}
.onharu-comments .comment-form textarea {
	height: 120px;
	min-height: 120px;
	resize: vertical;
}
.onharu-comments .comment-form input:focus,
.onharu-comments .comment-form textarea:focus {
	border-color: var(--onharu-accent);
	outline: none;
}
.onharu-comments .comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}
.onharu-comments .comment-form-cookies-consent label {
	display: inline;
	margin: 0;
	color: var(--onharu-faint);
	font-size: 0.78rem;
	line-height: 1.5;
}
.onharu-comments .comment-form-cookies-consent input {
	margin-top: 3px;
}
.onharu-comments .form-submit input[type="submit"] {
	padding: 9px 18px;
	border: 1px solid var(--onharu-accent);
	border-radius: 3px;
	background: var(--onharu-accent);
	color: var(--onharu-surface);
	font-family: var(--onharu-sans);
	font-size: 0.88rem;
	line-height: 1.4;
	cursor: pointer;
}
.onharu-comments .form-submit input[type="submit"]:hover {
	opacity: 0.88;
}

/* ---------- 홈 문구 오른쪽 사진 ---------- */
/* 아래 본문·오른쪽 칸과 같은 열 폭을 써서 사진이 카테고리 칸 바로 위에 맞춰 선다.
   사진은 "홈 사진" 템플릿 파트라 사이트 편집기에서 바꿀 수 있다. */
.onharu-banner-home {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 244px;
	gap: 56px;
	align-items: center;
}
.onharu-banner-visual {
	margin: 0;
}
.onharu-home-visual {
	margin: 0;
	aspect-ratio: 8 / 5;
	overflow: hidden;
	border-radius: 3px;
	background: var(--onharu-rule-soft);
}
.onharu-home-visual img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
@media (max-width: 900px) {
	.onharu-banner-home {
		grid-template-columns: minmax(0, 1fr);
	}
	/* 좁은 화면에서는 사진이 문구와 글 목록 사이를 밀어내므로 숨긴다. */
	.onharu-banner-visual {
		display: none;
	}
}

/* ---------- 좁은 화면 ---------- */
@media (max-width: 900px) {
	.onharu-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 44px;
	}
	.onharu-rail {
		position: static;
	}
	.onharu-banner {
		padding-top: 36px;
		padding-bottom: 28px;
	}
}
@media (max-width: 620px) {
	.onharu-entry,
	.onharu-entry:not(:has(.wp-block-post-featured-image)) {
		grid-template-columns: minmax(0, 1fr);
		gap: 12px;
	}
	.onharu-entry-meta {
		flex-direction: row;
		align-items: center;
		gap: 10px;
		padding-top: 0;
	}
	.onharu-thumb {
		order: -1;
		aspect-ratio: 16 / 9;
	}
	.onharu-article-title {
		font-size: 1.45rem !important;
	}
}
@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
		animation: none !important;
	}
}
