/* 방문자 화면 스타일 (워드프레스 블로그 테마 형태). 외부 폰트·프레임워크 없이 시스템 폰트를 사용해 빠르게 로드한다. */
:root {
    --text: #1e1e1e;
    --muted: #6b6b6b;
    --line: #e2e2e2;
    --bg: #ffffff;
    --bg-soft: #f7f7f5;
    --accent: #1f5eff;
    --accent-soft: #eef3ff;
    --max: 1160px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    word-break: keep-all;
    overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; background: #fff; padding: 8px; z-index: 10; }

/* 헤더: 사이트 제목 + 설명, 아래에 메뉴 막대 */
/* 헤더 상자를 풀어서(contents) 메뉴 막대가 화면 전체 기준으로 위에 붙어 있게 한다 */
.site-header { display: contents; }
html { scroll-padding-top: 80px; } /* 목차를 눌러 이동해도 소제목이 메뉴 막대에 가리지 않게 */
.branding { padding-top: 28px; padding-bottom: 20px; text-align: center; }
/* 블로그 제목: 크게 붓글씨 (Nanum Brush Script, 못 받으면 기본 글꼴) */
.site-title { font-family: "Nanum Brush Script", cursive; font-size: 104px; font-weight: 400; line-height: 1; color: var(--text); letter-spacing: 0.01em; }
.site-title:hover { text-decoration: none; color: var(--accent); }
.site-tagline { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.menu-bar { position: sticky; top: 0; z-index: 45; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.admin-bar ~ .menu-bar { top: 36px; } /* 관리자 바 바로 아래에 붙는다 */
.menu-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; }
.main-menu ul { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.main-menu a { display: block; padding: 14px 12px; color: var(--text); font-size: 15px; font-weight: 600; white-space: nowrap; }
.main-menu a:hover { color: var(--accent); text-decoration: none; }
/* 다크 모드 버튼 (검색창 오른쪽) */
.theme-toggle { flex-shrink: 0; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
    background: var(--bg); font-size: 16px; line-height: 1; cursor: pointer; }
.theme-toggle:hover { background: var(--bg-soft); }
/* 검색창: 오른쪽 사이드바(300px)와 같은 폭 */
.search-form { display: flex; gap: 6px; flex-shrink: 0; width: 300px; }
.search-form input { flex: 1; min-width: 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 14px; background: var(--bg-soft); }
.search-form button { padding: 7px 14px; border: 0; border-radius: 4px; background: var(--text); color: #fff; font: inherit; font-size: 14px; cursor: pointer; }

/* 본문 + 사이드바 */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; padding-top: 40px; padding-bottom: 56px; }
.empty { padding: 48px 0; color: var(--muted); }

.archive-header { padding-bottom: 20px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.archive-label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; }
.archive-title { font-size: 30px; margin: 4px 0 0; }
.archive-description { margin: 8px 0 0; color: var(--muted); }
/* 카테고리 페이지: '카테고리' 글자 없이 이름과 설명만 */
.archive-category .archive-title { margin-top: 0; }

/* 글 목록 항목: 썸네일 + 제목·요약 */
.entries { display: flex; flex-direction: column; }
.entry { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); }
.entry:first-child { padding-top: 0; }
.entry:not(:has(.entry-thumb)) { grid-template-columns: 1fr; }
/* 썸네일 카드(1200×630)와 같은 비율이라 카드 글자가 잘리지 않는다 */
.entry-thumb img { display: block; width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 6px; background: var(--bg-soft); }
.entry-category { display: inline-block; font-size: 13px; font-weight: 700; color: var(--accent); }
.entry-title { font-size: 22px; line-height: 1.4; margin: 4px 0 6px; }
.entry-title a { color: var(--text); }
.entry-title a:hover { color: var(--accent); text-decoration: none; }
.entry-meta { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.post-meta { text-align: right; } /* 글 상세의 날짜·시간은 오른쪽 */
.entry-summary { margin: 0 0 8px; color: #444; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 첫 페이지의 최신 글은 크게 */

.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 40px 0 0; }
.pagination a { padding: 8px 16px; border: 1px solid var(--line); border-radius: 4px; color: var(--text); }
.pagination a:hover { border-color: var(--text); text-decoration: none; }

/* 사이드바 위젯 */
.widget { margin-bottom: 36px; }
.widget-title { font-size: 15px; font-weight: 800; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--text); }
.widget-text { margin: 0 0 6px; color: #444; font-size: 15px; }
.widget-list, .plain-list { list-style: none; margin: 0; padding: 0; }
.widget-list li, .plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.5; }
.widget-list a, .plain-list a { color: var(--text); }
.widget-list a:hover { color: var(--accent); }

/* 사이드바 로그인 칸 (별도 로그인 페이지 없음) */
.login-body { min-height: 180px; } /* 로그인 전후 높이를 같게 해서 아래 위젯이 움직이지 않게 */
.login-welcome { display: flex; flex-direction: column; }
.login-welcome .login-form { margin-top: auto; }
.welcome-text { margin: 0 0 6px; font-size: 16px; }
.login-form { display: grid; gap: 6px; }
.login-form input { width: 100%; padding: 7px 12px; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 14px; background: var(--bg-soft); }
.login-form .remember { display: flex; align-items: center; justify-content: flex-start; gap: 6px; margin: 2px 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.login-form .remember input { width: 14px; height: 14px; margin: 0; padding: 0; flex: none; }
.login-form button { padding: 7px 14px; border: 0; border-radius: 4px; background: var(--text); color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.widget-alert { margin: 0 0 8px; font-size: 14px; color: #b32d2e; }
.widget-note { margin: 0 0 8px; font-size: 14px; color: var(--muted); }

/* 관리자 바: 관리자로 로그인했을 때만 모든 화면 맨 위에 붙는다 (워드프레스 상단 바) */
.admin-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; min-height: 36px; padding: 0 12px; background: #1d2327; color: #f0f0f1; font-size: 13px; line-height: 1.4; }
.admin-bar ul { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.admin-bar a { display: block; padding: 9px 10px; color: #f0f0f1; }
.admin-bar a:hover { background: #2c3338; color: #72aee6; text-decoration: none; }
.admin-bar-edit { color: #72aee6 !important; font-weight: 700; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tag-cloud a { display: block; padding: 3px 10px; border: 1px solid var(--line); border-radius: 3px; color: #444; font-size: 13px; }
.tag-cloud a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* 글 상세 */
.post { min-width: 0; }
.breadcrumb { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb .edit-link { color: var(--text); font-weight: 600; white-space: nowrap; }
.breadcrumb a { color: var(--muted); }
.post-header { margin-bottom: 24px; }
.post-header h1 { font-size: 34px; line-height: 1.3; margin: 4px 0 10px; letter-spacing: -0.01em; }
.post-cover { display: block; width: 100%; border-radius: 8px; margin-bottom: 28px; aspect-ratio: 16 / 9; object-fit: cover; }
.affiliate-notice { background: #fff8e6; border: 1px solid #f5d98b; border-radius: 6px; padding: 10px 14px; font-size: 14px; color: #6b4e00; }

.post-content { font-size: 17px; line-height: 1.85; }
.post-content h2 { font-size: 25px; margin: 52px 0 16px; }
.post-content h3 { font-size: 20px; margin: 32px 0 12px; }
.post-content p, .post-content ul, .post-content ol { margin: 0 0 20px; }
.post-content img { display: block; margin: 24px auto; border-radius: 6px; }
/* 주의·팁 상자(인용문)도 색 없이: 회색 왼쪽 줄만 둔다 */
.post-content blockquote { margin: 28px 0; padding: 4px 20px; border-left: 4px solid var(--line); color: inherit; }
.post-content blockquote p:last-child { margin-bottom: 0; }
/* 강조 표현: 굵게(핵심어), 기울임(뉘앙스·예시), ++밑줄++(꼭 기억할 문장). 본문 글씨에는 색을 넣지 않는다 */
.post-content strong { font-weight: 700; }
.post-content em { font-style: italic; }
.post-content ins { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.post-content li { margin-bottom: 6px; }
.post-content pre { background: #1e1e1e; color: #f3f4f6; padding: 16px; border-radius: 6px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.post-content code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
.post-content :not(pre) > code { background: var(--bg-soft); padding: 2px 6px; border-radius: 4px; }
.post-content table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 15px; display: block; overflow-x: auto; }
.post-content th, .post-content td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.post-content th { background: var(--bg-soft); }

/* 쿠팡 파트너스 상품 카드 */
.product-card { display: flex; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 24px 0; }
.product-image img { width: 140px; height: 140px; object-fit: contain; margin: 0; border-radius: 6px; }
.product-body p { margin: 0 0 6px; }
.product-name { font-weight: 700; font-size: 17px; }
.product-price { color: #e11d48; font-weight: 700; }
.product-desc { color: #4b5563; font-size: 15px; }
.product-link { display: inline-block; margin-top: 6px; padding: 8px 16px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; }
.product-link:hover { text-decoration: none; opacity: 0.9; }

.sources { margin-top: 40px; padding: 16px 20px; background: var(--bg-soft); border-radius: 6px; font-size: 15px; }
.sources h2 { font-size: 16px; margin: 0 0 8px; }
.sources ul { margin: 0; padding-left: 20px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 28px 0; }
.tags a { display: block; padding: 4px 10px; border-radius: 3px; background: var(--bg-soft); color: #444; font-size: 14px; }

.author-box { margin: 36px 0 0; padding: 20px; border-top: 2px solid var(--text); background: var(--bg-soft); }
.author-box p { margin: 0; }
.author-name { font-weight: 800; }
/* 이전 글·다음 글: 색 없이 테두리 카드 두 장 */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 36px; }
.post-nav a { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--bg); color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.post-nav a:hover { border-color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.06); transform: translateY(-2px); text-decoration: none; }
.post-nav-label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.post-nav-title { font-size: 16px; font-weight: 700; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-nav-next { grid-column: 2; text-align: right; }

.related { margin-top: 48px; }
.related > h2 { font-size: 20px; }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.related-item { display: block; padding: 16px 20px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 600; line-height: 1.45; transition: border-color .15s, box-shadow .15s, transform .15s; }
.related-item:hover { border-color: var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); transform: translateY(-2px); text-decoration: none; }

/* 광고: 자리를 미리 확보해 레이아웃 흔들림(CLS)을 줄인다 */
.ad-slot { margin: 32px 0; min-height: 100px; text-align: center; }
/* 운영자 한마디 */
.author-note { margin: 32px 0; padding: 16px 20px; border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--accent-soft); }
.author-note p { margin: 0; white-space: pre-line; }
.author-note .author-note-title { margin-bottom: 6px; font-weight: 800; }
/* 본문의 "○○ 바로가기" 링크 → 버튼 (공식 사이트로 보내는 버튼) */
.post-content a.btn-link { display: block; max-width: 420px; margin: 20px auto; padding: 14px 20px; border-radius: 8px;
    border: 1px solid var(--text); background: var(--bg); color: var(--text); font-weight: 700; text-align: center; text-decoration: none; }
.post-content a.btn-link::after { content: " →"; }
.post-content a.btn-link:hover { background: var(--bg-soft); text-decoration: none; } /* 버튼에 색을 넣지 않는다 */

/* 플러그인: 목차, 공유 버튼, 맨 위로 버튼 */
.toc { margin: 0 0 28px; padding: 16px 20px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; }
.toc-title { margin: 0 0 6px; font-weight: 800; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 3px 0; }
.toc li.toc-sub { margin-left: 16px; list-style: circle; font-size: 15px; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--accent); }
.share { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 28px 0; }
.share-label { font-size: 14px; font-weight: 700; margin-right: 4px; }
.share-btn { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text);
    font: inherit; font-size: 14px; cursor: pointer; }
.share-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.back-to-top { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; background: var(--text); color: #fff; font-size: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.back-to-top:hover { background: var(--accent); text-decoration: none; }
.site-header .ad-slot { margin: 20px 0 0; min-height: 90px; } /* 메뉴 아래 가로 배너 */
.sidebar .ad-slot { margin: 0 0 36px; min-height: 250px; }
.ad-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }

.preview-banner { background: #fef3c7; text-align: center; padding: 8px; font-size: 14px; }
.error-page { padding: 80px 16px; text-align: center; }

/* 푸터 */
.site-footer { margin-top: 24px; background: #1e1e1e; color: #d4d4d4; font-size: 14px; }
.footer-inner { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px; }
.site-footer .muted { color: #a3a3a3; margin: 0; }
.footer-links { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: #d4d4d4; }
.copyright { margin: 0; color: #8a8a8a; }

/* 모바일 */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; gap: 40px; padding-top: 24px; }
    .branding { padding-top: 24px; padding-bottom: 18px; }
    .site-title { font-size: 68px; }
    .menu-inner { flex-wrap: wrap; padding-bottom: 10px; gap: 0; }
    .main-menu { width: 100%; }
    .main-menu a { padding: 12px 10px; }
    .search-form { width: 100%; }
    .search-form input { flex: 1; width: auto; }
        .entry { grid-template-columns: 120px minmax(0, 1fr); gap: 14px; padding: 16px 0; }
    .entry-title { font-size: 18px; }
    .entry-summary { display: none; }
                .post-header h1 { font-size: 27px; }
    .post-content { font-size: 16px; }
    .product-card { flex-direction: column; text-align: center; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-next { grid-column: 1; }
    .related-grid { grid-template-columns: 1fr; }
}

/* ===== 다크 모드 (관리자 바 오른쪽 버튼, theme.js 가 html 에 data-theme="dark" 를 붙인다) ===== */
html[data-theme="dark"] {
    --text: #e4e4e7;
    --muted: #a1a1aa;
    --line: #34353c;
    --bg: #16171b;
    --bg-soft: #1f2026;
    --accent: #7aa2ff;
    --accent-soft: #1e2a44;
    color-scheme: dark;
}
html[data-theme="dark"] .site-header, html[data-theme="dark"] .menu-bar, html[data-theme="dark"] .skip-link:focus, html[data-theme="dark"] .share-btn { background: var(--bg); }
html[data-theme="dark"] .entry-summary, html[data-theme="dark"] .widget-text, html[data-theme="dark"] .tag-cloud a, html[data-theme="dark"] .tags a,
html[data-theme="dark"] .product-desc { color: #c8c8d0; }
html[data-theme="dark"] .search-form button, html[data-theme="dark"] .login-form button, html[data-theme="dark"] .back-to-top { background: #3a3b42; }
html[data-theme="dark"] .affiliate-notice { background: #2b2410; border-color: #6b5a1e; color: #f0d68a; }
html[data-theme="dark"] .preview-banner { background: #3a3210; }
html[data-theme="dark"] .site-footer { background: #0e0f12; }
