/* 에몽스토리 — 아카이브 공책 */
:root {
  --ink: #1f3b53;
  --text: #1a242d;
  --muted: #46525d;
  --paper: #fcfcfa;
  --surface: #f2f4f3;
  --rule: #d5dbdf;
  --learning: #9a6a2f;
  --learning-tint: #f6eee3;
  --travel: #1c7480;
  --travel-tint: #e4f1f2;
  --life: #4f7a36;
  --life-tint: #eaf1e4;
  --accent: var(--ink);
  --accent-tint: var(--surface);
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --wrap: 960px;
  --read: 920px;
}
.cat-learning-archive { --accent: var(--learning); --accent-tint: var(--learning-tint); }
.cat-travel-archive { --accent: var(--travel); --accent-tint: var(--travel-tint); }
.cat-life-archive { --accent: var(--life); --accent-tint: var(--life-tint); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 10; }

/* 헤더 */
.site-header { border-bottom: 1px solid var(--rule); background: #fff; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.logo { display: block; line-height: 0; flex-shrink: 0; }
.tagline {
  margin: 0; padding-left: 18px; border-left: 1px solid var(--rule);
  font-size: 14.5px; line-height: 1.5; color: var(--text); letter-spacing: -0.01em; white-space: nowrap;
}
/* 세 단어는 각 카테고리 색 형광펜. 처음 열 때 한 번만 차례로 그어진다 */
.tagline .kw {
  color: var(--accent); font-weight: 700; padding: 0 1px; margin: 0 -1px;
  --marker: var(--accent-tint);
  --marker: color-mix(in srgb, var(--accent) 24%, transparent);
  background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 90% / 100% 42%;
  animation: kw-sweep 0.55s cubic-bezier(.3,.7,.4,1) both;
}
.tagline .kw:nth-of-type(2) { animation-delay: 0.18s; }
.tagline .kw:nth-of-type(3) { animation-delay: 0.36s; }
@keyframes kw-sweep { from { background-size: 0 42%; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.logo img { height: 30px; width: auto; }
.nav { display: flex; align-items: stretch; gap: 4px; align-self: stretch; }
.nav a {
  display: flex; align-items: center; padding: 0 14px;
  color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.nav a:hover, .nav a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.nav .search-link { padding: 0 6px 0 14px; }
.menu-btn, .nav .nav-search { display: none; }
.nav .search-link svg { width: 20px; height: 20px; }

/* 공통 탭 라벨: 카테고리 표시 */
.tab {
  display: inline-block; padding: 2px 10px 1px; border-radius: 4px 4px 0 0;
  background: var(--accent-tint); color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-size: 13px; font-weight: 600; text-decoration: none; line-height: 1.6;
}
a.tab:hover { background: var(--accent); color: #fff; }

/* 홈: 소개 + 아카이브 인덱스 */
.home-top { padding-top: 40px; }
.archives { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: -8px 0 72px; }
.archives-title { margin-top: 8px; }
.archive {
  position: relative; background: #fff; border: 1px solid var(--rule); border-top: 3px solid var(--accent);
  border-radius: 0 8px 8px 8px; padding: 20px 22px 18px; margin-top: 30px;
  display: flex; flex-direction: column;
}
.archive .tab-head {
  position: absolute; top: -32px; left: -1px; padding: 4px 16px 3px;
  background: var(--accent); color: #fff; border-radius: 8px 8px 0 0;
  font-weight: 700; font-size: 15px; text-decoration: none;
}
.archive p { margin: 0 0 14px; color: var(--muted); font-size: 15px; line-height: 1.65; min-height: 3.3em; }
.archive ul { list-style: none; margin: 0 0 12px; padding: 12px 0 0; border-top: 1px dashed var(--rule); }
.archive li { font-size: 15px; line-height: 1.5; padding: 4px 0; color: var(--text); }
.archive li a { color: var(--text); }
.archive li a { text-decoration: none; }
.archive li a:hover { text-decoration: underline; }
.archive .more { margin-top: auto; font-size: 14px; color: var(--accent); font-weight: 600; text-decoration: none; }

/* 글 목록 */
.section-title { font-weight: 800; color: var(--ink); font-size: 20px; margin: 0 0 12px; letter-spacing: -0.01em; }
.list-head { padding: 40px 0 8px; }
.list-head p { margin: 4px 0 0; color: var(--muted); max-width: 40em; }
.list-head h1 { color: var(--ink); font-size: 28px; font-weight: 800; line-height: 1.4; margin: 10px 0 0; letter-spacing: -0.02em; }
.posts { margin-bottom: 64px; }
.post-row {
  display: grid; grid-template-columns: 1fr 200px; gap: 40px; align-items: center;
  padding: 24px 0; border-bottom: 1px solid var(--rule);
}
.post-row:first-child { border-top: 0; }
.post-row h2 { font-size: 20px; line-height: 1.45; margin: 10px 0 6px; font-weight: 700; letter-spacing: -0.01em; }
.post-row h2 a { color: var(--ink); text-decoration: none; }
.post-row h2 a:hover { text-decoration: underline; }
.post-row .excerpt {
  margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-row time { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.post-row .thumb { display: block; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--surface); }
.post-row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-row.no-thumb { grid-template-columns: 1fr; }
.post-row.lead { grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding-top: 4px; }
.post-row.lead .thumb { order: -1; aspect-ratio: auto; }
.post-row.lead .thumb img { height: auto; }
.post-row.lead h2 { font-size: 26px; line-height: 1.4; }
.post-row.lead .excerpt { -webkit-line-clamp: 3; }

/* 본문 */
.article { max-width: calc(var(--read) + 40px); margin: 0 auto; padding-top: 44px; padding-bottom: 24px; }
.article-head { margin-bottom: 32px; }
.article-head h1 {
  color: var(--ink); font-weight: 700;
  font-size: clamp(26px, 3.6vw, 34px); font-weight: 800; line-height: 1.38; margin: 14px 0 12px; letter-spacing: -0.025em;
}
.article-head .meta { color: var(--muted); font-size: 14px; }
.content > * { margin-top: 0; margin-bottom: 1.25em; }
.content h2 {
  color: var(--ink); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.45;
  margin: 2.4em 0 0.8em; padding-top: 18px; position: relative; scroll-margin-top: 16px;
}
.content h2::before { content: ""; position: absolute; top: 0; left: 0; width: 32px; height: 3px; background: var(--accent); border-radius: 2px; }
.content h3 { font-size: 20px; line-height: 1.5; color: var(--ink); margin: 1.8em 0 0.6em; }
.content h4, .content h5 { font-size: 17px; color: var(--ink); margin: 1.6em 0 0.5em; }
.content h2 strong, .content h3 strong { font-weight: inherit; }
.content ul, .content ol { padding-left: 1.4em; }
.content li { margin: 0.3em 0; }
.content li::marker { color: var(--accent); }
.content hr { border: 0; border-top: 1px solid var(--rule); margin: 2.2em 0; }
.content blockquote {
  margin-left: 0; margin-right: 0; padding: 16px 20px; background: var(--accent-tint);
  border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
}
.content blockquote p { margin: 0.3em 0; }
.content blockquote cite { display: block; font-size: 14px; color: var(--muted); font-style: normal; }
.content figure { margin-left: 0; margin-right: 0; }
.content .wp-block-image { text-align: center; }
.content .wp-block-image img { border-radius: 6px; vertical-align: top; }
.content figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; text-align: center; }
.content .wp-block-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.content .wp-block-gallery figure { margin: 0; }
.content .wp-block-gallery img { width: 100% !important; aspect-ratio: 3 / 4; object-fit: cover; }
.content .wp-block-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; min-width: 520px; }
.content th, .content td { border: 1px solid var(--rule); padding: 9px 12px; vertical-align: top; text-align: left; }
.content th { background: var(--surface); color: var(--ink); font-weight: 600; }
.content .has-text-align-center { text-align: center; }
.content pre { background: var(--surface); padding: 14px 16px; border-radius: 6px; overflow-x: auto; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.draft-banner { margin-top: 20px; padding: 10px 14px !important; background: #fff4d6; border: 1px solid #f0d58a; border-radius: 8px; font-size: 14px; color: #6b5310; }

/* 목차 */
.toc { border: 1px solid var(--rule); border-radius: 8px; background: #fff; padding: 4px 20px; margin: 1.6em 0 2em; }
.toc summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: 10px 0; font-size: 16px; }
.toc ol { margin: 0 0 14px; padding-left: 1.3em; font-size: 15px; line-height: 1.6; }
.toc li { margin: 6px 0; }
.toc a { text-decoration: none; color: var(--text); }
.toc a:hover { color: var(--accent); text-decoration: underline; }

/* 광고: 본문 흐름 안에서 조용히. 실제로 채워진 광고만 라벨·여백을 보인다 */
.ad { margin: 0 auto; max-width: 728px; text-align: center; }
.ad-label { display: none; font-size: 11px; color: #8a949c; letter-spacing: 0.04em; margin-bottom: 4px; text-align: left; }
.ad:has(ins[data-ad-status="filled"]) { margin: 2.2em auto; }
.ad:has(ins[data-ad-status="filled"]) .ad-label { display: block; }
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-banner { max-width: none; }
.ad-banner ins { display: block; width: 100%; }
.posts .ad:has(ins[data-ad-status="filled"]) { margin: 26px 0; }

/* 글 하단 */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 40px 0 0; padding: 0; list-style: none; }
.tags a {
  display: inline-block; font-size: 14px; color: var(--text); text-decoration: none;
  background: var(--surface); padding: 4px 10px; border-radius: 4px;
}
.tags a:hover { color: var(--accent); background: var(--accent-tint); }
/* 이전·다음 글: 테두리 버튼 + 화살표. 색은 지금 글의 카테고리 색 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 44px 0 0; }
.pager-link {
  display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 16px 18px; border: 1px solid var(--rule); border-radius: 10px; background: #fff;
  color: var(--ink); text-decoration: none; transition: border-color 0.15s, background-color 0.15s;
}
.pager-link:hover { border-color: var(--accent); background: var(--accent-tint); color: var(--ink); }
.pager-icon {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-tint); color: var(--accent);
  transition: background-color 0.15s, color 0.15s;
}
.pager-icon svg { width: 18px; height: 18px; }
.pager-link:hover .pager-icon { background: var(--accent); color: #fff; }
.pager-text { min-width: 0; }
.pager-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.pager-title {
  font-size: 15px; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pager .next { grid-column: 2; justify-content: flex-end; text-align: right; }
.related { max-width: calc(var(--read) + 40px); margin: 0 auto 72px; }
.related h2 { color: var(--ink); font-size: 19px; font-weight: 800; margin: 0 0 16px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.related-grid a { text-decoration: none; color: var(--ink); font-size: 15px; line-height: 1.5; font-weight: 500; }
.related-grid a:hover .rel-title { text-decoration: underline; }
.related-grid .thumb { display: block; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--surface); margin-bottom: 8px; }
.related-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related-grid .text-card {
  display: flex; align-items: flex-start; padding: 16px 16px 0;
  background: var(--accent-tint); border-top: 3px solid var(--accent);
}
.related-grid .text-card span {
  font-size: 14px; line-height: 1.65; color: var(--text); font-weight: 400;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}

/* 검색 */
.search-form { display: flex; gap: 8px; margin: 18px 0 8px; max-width: 560px; }
.search-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 10px 14px;
  border: 1px solid var(--rule); border-radius: 6px; background: #fff; color: var(--text);
}
.search-form button { flex-shrink: 0; font: inherit; font-size: 15px; padding: 0 18px; border: 0; border-radius: 6px; background: var(--ink); color: #fff; cursor: pointer; }
.search-status { color: var(--muted); font-size: 14px; }

/* 정적 페이지 */
.page { max-width: calc(var(--read) + 40px); margin: 0 auto; padding-top: 44px; padding-bottom: 72px; }
.page h1 { color: var(--ink); font-size: 28px; font-weight: 800; margin: 0 0 24px; }
.page h2 { font-size: 19px; color: var(--ink); margin: 2em 0 0.5em; }

/* 푸터 */
.site-footer { border-top: 1px solid var(--rule); background: #fff; padding: 32px 0 40px; font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.site-footer .to-top {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 1px solid var(--rule); border-radius: 50%; color: var(--ink); background: var(--paper);
}
.site-footer .to-top:hover { background: var(--ink); border-color: var(--ink); color: #fff; text-decoration: none; }
.site-footer .to-top svg { width: 16px; height: 16px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* 모바일 */
@media (max-width: 859px) {
  .site-header .wrap { padding-top: 10px; padding-bottom: 10px; }
  .brand { flex-direction: column; align-items: flex-start; gap: 6px; }
  .tagline { padding-left: 0; border-left: 0; font-size: 13px; }
  .archives { grid-template-columns: 1fr; gap: 8px; margin-bottom: 48px; }
  .post-row.lead { grid-template-columns: 1fr; gap: 16px; }
  .related-grid { grid-template-columns: 1fr 1fr; }
  .related-grid a:nth-child(3) { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  /* 모바일 헤더: 로고·문구 + 햄버거, 메뉴는 아래로 펼침 */
  .site-header { position: relative; }
  .site-header .wrap { flex-wrap: nowrap; align-items: center; min-height: 0; padding-top: 12px; padding-bottom: 12px; gap: 12px; }
  .logo img { height: 25px; }
  .brand { flex-direction: column; align-items: flex-start; gap: 6px; }
  .tagline { padding-left: 0; border-left: 0; font-size: 13px; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 44px; height: 44px; margin-right: -10px; padding: 0;
    border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: 6px;
  }
  .menu-btn svg { width: 24px; height: 24px; }
  .menu-btn .i-close, .menu-open .menu-btn .i-open { display: none; }
  .menu-open .menu-btn .i-close { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--rule);
    box-shadow: 0 16px 24px -16px rgba(31, 59, 83, 0.28); padding: 12px 20px 18px;
  }
  .menu-open .nav { display: flex; }
  .menu-open::after {
    content: ""; position: fixed; inset: 0; z-index: 20; background: rgba(26, 36, 45, 0.35);
  }
  .site-header .wrap { position: relative; z-index: 31; background: #fff; }
  .nav .nav-search { display: flex; margin: 0 0 8px; max-width: none; }
  .nav a {
    padding: 14px 0 14px 14px; margin: 0; font-size: 16px; font-weight: 600;
    border-bottom: 1px solid var(--rule); border-left: 3px solid var(--accent);
  }
  .nav a:nth-last-of-type(2) { border-bottom: 0; }
  .nav a:hover, .nav a[aria-current] { color: var(--accent); border-bottom-color: var(--rule); background: var(--accent-tint); }
  .nav .search-link { display: none; }
  .archive ul { display: none; }
  .archive { padding: 16px 18px 14px; }
  .archive p { margin-bottom: 6px; min-height: 0; }

  .post-row { grid-template-columns: 1fr 104px; gap: 16px; padding: 20px 0; align-items: center; }
  .post-row h2 { font-size: 18px; margin-top: 8px; }
  .post-row.lead h2 { font-size: 22px; }
  .post-row .excerpt { display: none; }
  .post-row.lead .excerpt { display: -webkit-box; }
  .article { padding-top: 28px; }
  .content h2 { font-size: 22px; }
  .content .wp-block-gallery { grid-template-columns: 1fr 1fr; gap: 6px; }
  .related-grid { gap: 12px; }
  .pager { grid-template-columns: 1fr; gap: 10px; }
  .pager .next { grid-column: auto; }
  .related-grid a { font-size: 14px; }
  .related-grid .text-card { padding: 12px 12px 0; }
  .related-grid .text-card span { font-size: 13px; -webkit-line-clamp: 4; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .tagline .kw { animation: none; } .pager-link, .pager-icon { transition: none; } }
@media print { .site-header, .site-footer, .ad, .related, .pager, .toc { display: none; } }
