/*
Theme Name: Mini Life
Description: 미니라이프 전용 클래식 PHP 테마. 화면 HTML은 header.php / footer.php / index.php 등에 직접 쓴다.
Version: 1.0.0
Requires PHP: 8.1
Text Domain: minilife
*/

/* ===== 기본값 (색, 글자 크기, 폭) — 여기 숫자만 바꾸면 전체에 반영 ===== */
:root {
	--ml-bg: #ffffff;
	--ml-text: #111111;
	--ml-muted: #686868;
	--ml-line: rgba(17, 17, 17, 0.15);
	--ml-soft-bg: #fbfaf3;

	--ml-font: "Noto Sans KR", sans-serif;
	--ml-size-small: 0.875rem;                               /* 14px */
	--ml-size-body: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);  /* 휴대폰 16px ~ PC 18px */
	--ml-size-large: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
	--ml-size-x-large: clamp(1.75rem, 1.65rem + 0.4vw, 2rem);
	--ml-size-xx-large: clamp(2.15rem, 1.8rem + 1.3vw, 3rem);

	--ml-content: 760px;                  /* 본문 글 폭 (왼쪽 정렬, 오른쪽은 나중에 광고·사이드바 자리) */
	--ml-gutter: clamp(20px, 4vw, 60px);  /* 화면 양쪽 여백: 휴대폰 20px ~ 큰 화면 60px. 상단·본문·하단이 같은 왼쪽 시작선 */
}

/* ===== 기본 요소 ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--ml-bg);
	color: var(--ml-text);
	font-family: var(--ml-font);
	font-size: var(--ml-size-body);
	font-weight: 400;
	line-height: 1.6;
	letter-spacing: -0.1px;
	/* 글이 적은 페이지에서도 하단이 화면 맨 아래에 붙게 */
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
body.admin-bar { min-height: calc(100vh - 32px); }
@media (max-width: 782px) { body.admin-bar { min-height: calc(100vh - 46px); } }
a { color: currentColor; }
a:hover { text-decoration: none; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-weight: 400; line-height: 1.25; letter-spacing: -0.1px; }
h1 { font-size: var(--ml-size-xx-large); }
h2 { font-size: var(--ml-size-x-large); }
h3 { font-size: var(--ml-size-large); }
h4 { font-size: var(--ml-size-body); }

.ml-container { width: 100%; padding: 0 var(--ml-gutter); }
.ml-narrow > * { max-width: var(--ml-content); }   /* 본문 글 폭 */

/* ===== 왼쪽 메뉴 + 본문 (PC) ===== */
.site-layout { flex-grow: 1; display: flex; align-items: flex-start; gap: 60px; }
.site-layout > .site-main { flex: 1; min-width: 0; }
/* 메뉴 칸은 본문 높이만큼 늘어나고(align-self: stretch) 오른쪽 선으로 본문과 구분.
   음영으로 바꾸려면: border-right 줄을 지우고 background: var(--ml-soft-bg); 를 넣는다 */
.site-sidebar { flex: 0 0 175px; align-self: stretch; padding: 30px 20px 30px 0; border-right: 1px solid var(--ml-line); }
.site-sidebar ul { list-style: none; margin: 0; padding: 0; position: sticky; top: 30px; }   /* 스크롤해도 목록이 따라 내려옴 */
body.admin-bar .site-sidebar ul { top: 62px; }
.site-sidebar a { display: block; padding: 6px 0; text-decoration: none; }
.site-sidebar a:hover, .site-sidebar .current a { text-decoration: underline; }
.site-sidebar .current a { font-weight: 700; }
.count { color: var(--ml-muted); font-size: 0.85em; font-weight: 400; }
/* PC/휴대폰 전환 규칙은 파일 맨 끝에 (앞에 두면 뒤의 버튼 규칙에 덮어써짐) */
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: static; width: auto; height: auto; clip: auto; }

/* ===== 상단 ===== */
.site-header { padding: 20px 0; }
.site-header .ml-container { display: flex; align-items: center; gap: 16px; }
.site-title { margin: 0; font-size: var(--ml-size-x-large); font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
.site-title a { text-decoration: none; }
.site-title a:hover { text-decoration: underline; }
.site-tagline { margin: 0; font-size: var(--ml-size-body); }

/* 햄버거 버튼 (맨 왼쪽) */
.menu-toggle, .drawer-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: none; border: 0; color: inherit; cursor: pointer; }
.menu-toggle { margin-left: -10px; }   /* 아이콘 선을 글자 왼쪽 줄에 맞춤 */

/* 왼쪽에서 열리는 메뉴 */
.drawer {
	position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
	width: min(280px, 80vw); padding: 16px 24px;
	background: var(--ml-bg); box-shadow: 2px 0 16px rgba(0, 0, 0, 0.12);
	overflow-y: auto;
	transform: translateX(-100%); visibility: hidden;
	transition: transform 0.25s ease, visibility 0.25s;
}
.drawer-backdrop {
	position: fixed; inset: 0; z-index: 999;
	background: rgba(0, 0, 0, 0.35);
	opacity: 0; visibility: hidden;
	transition: opacity 0.25s, visibility 0.25s;
}
.menu-open .drawer { transform: none; visibility: visible; }
.menu-open .drawer-backdrop { opacity: 1; visibility: visible; }
.menu-open { overflow: hidden; }   /* 메뉴가 열린 동안 뒤 화면이 스크롤되지 않게 */
.drawer-close { margin-left: -10px; margin-bottom: 8px; }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.drawer a { display: block; padding: 12px 0; font-size: var(--ml-size-large); text-decoration: none; border-bottom: 1px solid var(--ml-line); }
.drawer a:hover, .drawer .current a { text-decoration: underline; }
body.admin-bar .drawer { top: 32px; }
@media (max-width: 782px) { body.admin-bar .drawer { top: 46px; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-backdrop { transition: none; } }

/* ===== 본문 영역 ===== */
.site-main { padding: 30px 0 60px; }
.page-heading { font-size: var(--ml-size-large); margin: 0 0 10px; }

/* 글 목록 (홈·카테고리) */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item { display: flex; gap: 30px; align-items: flex-start; padding: 30px 0; border-bottom: 1px solid var(--ml-line); }
.post-item:last-child { border-bottom: 0; }
.post-item-thumb { flex: 0 0 30%; }
.post-item-thumb img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.post-item-body { flex: 1; min-width: 0; }
.post-item-title { margin: 0 0 8px; font-size: var(--ml-size-large); }
.post-item-title a { text-decoration: none; }
.post-item-title a:hover { text-decoration: underline; }
.post-item-excerpt { margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) {
	.post-item { flex-direction: column; gap: 14px; }
	.post-item-thumb { flex-basis: auto; width: 100%; }
}
.post-meta { font-size: var(--ml-size-small); color: var(--ml-muted); }
.post-meta a { color: var(--ml-muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.post-meta a:hover { text-decoration: underline; }
.post-meta .sep { margin: 0 0.4em; }
.no-posts { color: var(--ml-muted); }

.pagination { margin-top: 30px; display: flex; justify-content: center; gap: 0.8em; }
.pagination .page-numbers { text-decoration: none; padding: 0.2em 0.5em; }
.pagination .current { font-weight: 700; text-decoration: underline; }

/* 글·페이지 본문 */
.entry-header { margin-bottom: 30px; }
.entry-title { margin: 0 0 10px; font-size: var(--ml-size-xx-large); }
.entry-content { line-height: 1.7; }
.entry-content > * { margin-top: 0; margin-bottom: 1.2em; }
.entry-content h2 { margin-top: 2em; font-size: var(--ml-size-x-large); }
.entry-content h3 { margin-top: 1.6em; font-size: var(--ml-size-large); }
.entry-content figure { margin-left: 0; margin-right: 0; }
.entry-content .wp-block-image img { display: block; max-height: 600px; width: auto; margin: 0 auto; }  /* 세로 캡처가 화면보다 길지 않게 */
.entry-content table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.entry-content th, .entry-content td { border: 1px solid var(--ml-line); padding: 0.5em 0.7em; text-align: left; vertical-align: top; }
.entry-content th { background: var(--ml-soft-bg); }
.entry-content .wp-block-table { overflow-x: auto; }
.entry-content blockquote { margin: 0 0 1.2em; padding: 0.8em 1.2em; border-left: 2px solid currentColor; }
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content hr { border: 0; border-top: 1px solid var(--ml-line); margin: 2em 0; }
.entry-content code { font-size: 0.9em; background: var(--ml-soft-bg); padding: 0.1em 0.3em; }
.entry-content pre { overflow-x: auto; background: var(--ml-soft-bg); padding: 1em; }

/* 글 맨 앞 "이 글의 노래" 유튜브 플레이어: 356×200 가운데 (유튜브 정책상 최소 200×200 → 16:9 최소 크기) */
.entry-content .minilife-song .wp-block-embed__wrapper { max-width: 356px; margin: 0 auto; }

/* 댓글 */
.comments-area { margin-top: 60px; padding-top: 30px; border-top: 1px solid var(--ml-line); }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-left: 1.5em; }
.comment-body { padding: 1em 0; border-bottom: 1px solid var(--ml-line); }
.comment-meta { font-size: var(--ml-size-small); color: var(--ml-muted); }
.comment-form textarea, .comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"] { width: 100%; padding: 0.6em; font: inherit; border: 1px solid var(--ml-line); }
.comment-form .submit { font: inherit; padding: 0.7em 1.8em; background: var(--ml-text); color: var(--ml-bg); border: 0; cursor: pointer; }

/* ===== 하단 ===== */
.site-footer { padding: 30px 0 40px; font-size: var(--ml-size-small); }
/* 3칸: © 왼쪽 | 안내 링크 가운데 | 언어 전환 오른쪽. 양 끝 칸을 같은 폭(1fr)으로 둬서 가운데 칸이 화면 정중앙에 온다 */
.site-footer .ml-container { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px 30px; }
.site-footer .copyright { justify-self: start; }
.footer-links { justify-self: center; }
.lang-switcher { justify-self: end; }
@media (max-width: 700px) {   /* 휴대폰: 세 줄로 쌓고 모두 가운데 */
	.site-footer .ml-container { grid-template-columns: 1fr; justify-items: center; }
	.site-footer .copyright, .lang-switcher { justify-self: center; }
	.site-footer ul { justify-content: center; }
}
.site-footer .copyright { margin: 0; white-space: nowrap; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.4em 1.2em; list-style: none; margin: 0; padding: 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.lang-switcher .current-lang a { font-weight: 700; }

/* ===== PC / 휴대폰 전환 (반드시 파일 맨 끝: 같은 선택자의 앞 규칙을 덮어써야 함) ===== */
@media (min-width: 1000px) {   /* PC: 왼쪽 메뉴가 항상 보이므로 햄버거 메뉴는 숨김 */
	.menu-toggle, .drawer, .drawer-backdrop { display: none; }
}
@media (max-width: 999px) {    /* 휴대폰·태블릿: 왼쪽 메뉴 숨김, 햄버거 메뉴 사용 */
	.site-sidebar { display: none; }
}
