@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");

:root {
  --text: #111;
  --body: #333;
  --muted: #7a7a7a;
  --line: #e4e4e4;
  --soft: #f7f8fa;
  --link: #1a6fc4;
  --accent: #1a6fc4;
  --accent-soft: #eaf3fc;
  --w: 720px;
  --wide: 960px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 28px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: #fff;
  color: var(--body);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.7;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--w); margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: var(--wide); }
.hwrap { max-width: var(--wide); margin: 0 auto; padding: 0 16px; }

/* 읽기 진행 막대 / 맨 위로 */
#progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 60; transition: width .1s linear; }
#to-top { position: fixed; right: 18px; bottom: 22px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: 18px; cursor: pointer; box-shadow: var(--shadow); z-index: 40; }
#to-top:hover { background: var(--soft); }
#to-top[hidden] { display: none; }

/* 헤더 */
.site-header { background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); }
.site-header .hwrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; min-height: 68px; padding-top: 12px; padding-bottom: 4px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 19px; letter-spacing: -0.02em; flex: none; }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #0e4f93); color: #fff; font-size: 17px; font-weight: 800; }
/* 윗줄: 이름 + 검색 / 아랫줄: 메뉴 전체 (메뉴가 많아도 잘리지 않고 필요하면 줄바꿈) */
.cats { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 100%; order: 3; min-width: 0; margin: 0 -13px 4px; }
.cats a { flex: none; padding: 6px 13px; border-radius: 999px; color: #555; font-size: 14.5px; font-weight: 500; }
.cats a:hover { background: var(--soft); color: var(--text); text-decoration: none; }
.cats a.on { background: var(--text); color: #fff; }
.search { margin-left: auto; flex: none; }
.search input { border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 14px; width: 160px; transition: width .2s, background .2s, border-color .2s; }
.search input:focus { outline: none; background: #fff; border-color: var(--accent); width: 210px; }

main.wrap { padding-top: 36px; padding-bottom: 72px; min-height: 60vh; }

.cats a.extra { color: var(--accent); font-weight: 600; }
.cats a.extra:hover { background: var(--accent-soft); color: var(--accent); }
.cats a.extra.on { background: var(--accent); color: #fff; }
.cats a.extra:first-of-type { margin-left: 8px; }

/* 홈 소개 */
.hero { padding: 26px 0 30px; }
.hero-eyebrow { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.hero h1 { margin: 0; font-size: 34px; line-height: 1.35; color: var(--text); font-weight: 800; letter-spacing: -0.03em; max-width: 640px; }
.hero-sub { margin: 12px 0 0; max-width: 620px; font-size: 16.5px; line-height: 1.7; color: #555; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-btn { display: inline-block; padding: 10px 20px; border-radius: 999px; font-size: 15px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.hero-btn:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 16%, #fff); }
.hero-btn.primary { color: #fff; background: var(--accent); }
.hero-btn.primary:hover { background: #155fa9; }
.list-head { padding: 6px 0 22px; }
.list-head h1 { font-size: 28px; margin: 0 0 4px; color: var(--text); font-weight: 800; letter-spacing: -0.02em; }
.list-head p { margin: 0; color: var(--muted); }
.sec-title { font-size: 18px; margin: 44px 0 16px; color: var(--text); font-weight: 800; }

/* 카테고리 알약 */
.pill { display: inline-block; font-size: 12.5px; font-weight: 700; line-height: 1; padding: 6px 10px; border-radius: 999px; color: var(--c, #555); background: color-mix(in srgb, var(--c, #555) 11%, #fff); }
.pill:hover { text-decoration: none; background: color-mix(in srgb, var(--c, #555) 20%, #fff); }

/* 글 카드 목록 */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
.card { display: flex; flex-direction: column; border-radius: var(--radius); background: #fff; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-3px); }
.card-thumb { position: relative; display: block; aspect-ratio: 1200 / 630; border-radius: var(--radius); overflow: hidden; background: #eee; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.card:hover .card-thumb img { transform: scale(1.04); }
.card-thumb.empty-thumb { background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); }
.card-thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; font-weight: 800; color: rgba(255, 255, 255, .85); }
.card-body { padding: 14px 2px 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.card-meta span + span::before { content: "·"; margin-right: 10px; }
.card h2 { font-size: 19px; line-height: 1.45; margin: 0; letter-spacing: -0.02em; }
.card h2 a { color: var(--text); }
.card h2 a:hover { color: var(--accent); text-decoration: none; }
.card .desc { margin: 0; color: #5b5b5b; font-size: 15px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 홈 첫 글: 크게 */
.card.featured { flex-direction: row; gap: 28px; align-items: center; margin-bottom: 8px; }
.card.featured .card-thumb { flex: 0 0 56%; }
.card.featured .card-body { padding: 0; gap: 10px; }
.card.featured h2 { font-size: 27px; line-height: 1.4; font-weight: 800; }
.card.featured .desc { font-size: 16px; -webkit-line-clamp: 3; }

.empty { color: var(--muted); padding: 60px 0; text-align: center; grid-column: 1 / -1; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; font-size: 14px; color: var(--muted); }
.pager a { border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; color: var(--text); }
.pager a:hover { background: var(--soft); text-decoration: none; }

/* 글 */
.post-head { margin-bottom: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.post-title { font-size: 34px; line-height: 1.38; color: var(--text); margin: 14px 0 14px; letter-spacing: -0.03em; font-weight: 800; }
.post-head .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.post-head .meta span + span::before, .post-head .meta time + span::before { content: "·"; margin-right: 12px; }
.meta { font-size: 13px; color: var(--muted); }
.tags { margin: 40px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { font-size: 13.5px; background: var(--soft); color: #555; padding: 5px 12px; border-radius: 999px; border: 1px solid #eee; }
.tags a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; border-color: #cfe2f6; }
.prevnext { display: flex; gap: 14px; justify-content: space-between; margin: 52px 0 0; }
.prevnext a { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: var(--text); font-size: 14.5px; font-weight: 600; line-height: 1.5; max-width: 50%; transition: border-color .2s, background .2s; }
.prevnext a:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.prevnext a.r { text-align: right; }
.prevnext small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.related { margin-top: 20px; }
.related .grid { gap: 22px 20px; }
.related .card h2 { font-size: 16.5px; }
.related .card .desc { display: none; }
.preview-notice { background: #fff8e1; border: 1px solid #f0d98a; padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; color: #7a5b00; }

/* 본문 (인라인 스타일이 있는 요소는 그 값이 우선) */
.prose { font-size: 16.5px; line-height: 1.85; overflow-wrap: anywhere; }
.prose > * { max-width: 100%; }
.prose p { margin: 0 0 16px; }
.prose h2 { font-size: 23px; line-height: 1.45; color: var(--text); border-bottom: 2px solid #333; padding-bottom: 8px; margin: 48px 0 18px; font-weight: 800; letter-spacing: -0.02em; }
.prose h3 { font-size: 18.5px; line-height: 1.5; color: #222; margin: 30px 0 12px; font-weight: 700; }
.prose h2, .prose h3, .prose [id] { scroll-margin-top: 16px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose blockquote { margin: 20px 0; padding: 6px 18px; border-left: 4px solid var(--accent); color: #555; background: var(--soft); border-radius: 0 8px 8px 0; }
.prose figure, .post-figure { margin: 24px 0; text-align: center; }
.prose img { border-radius: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }
.prose details > summary { cursor: pointer; }
.prose pre { background: #f6f8fa; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-size: 14px; line-height: 1.6; position: relative; word-break: normal; }
.prose code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.92em; }
.prose :not(pre) > code { background: #f1f1f1; padding: 2px 6px; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.copy-btn { position: absolute; top: 8px; right: 8px; font-size: 12px; border: 1px solid #ccc; background: #fff; border-radius: 6px; padding: 3px 9px; cursor: pointer; color: #555; }
.table-wrap { overflow-x: auto; margin: 22px 0; -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; width: 100%; min-width: 420px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; font-size: 15px; }
.prose th { background: #f0f0f0; }
.video { position: relative; padding-top: 56.25%; margin: 24px 0; background: #000; border-radius: 10px; overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.gallery { display: flex; gap: 8px; margin: 24px 0; overflow-x: auto; }
.gallery img { height: 160px; width: auto; flex: none; cursor: zoom-in; object-fit: cover; border-radius: 8px; }

/* 링크 카드 (내 글 카드 / 외부 사이트 카드) */
.link-card { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 24px 0; background: #fff; color: var(--text); text-decoration: none; transition: border-color .2s, box-shadow .2s; }
.link-card:hover { text-decoration: none; border-color: #c4c4c4; box-shadow: var(--shadow); }
.lc-img { flex: none; width: 160px; background: #eee; }
.lc-img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; }
.lc-body { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; padding: 14px 18px; }
.lc-title { font-size: 16px; line-height: 1.45; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-desc { font-size: 14px; line-height: 1.5; color: #555; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-site { font-size: 12px; color: var(--muted); }

/* 함께 보면 좋은 글 상자 */
.related-box { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; margin: 32px 0; }
.related-box .rb-title { margin: 0 0 10px; font-weight: 800; color: var(--text); }
.related-box ul { margin: 0; padding-left: 20px; line-height: 1.95; }

/* 자동 목차 */
.toc { margin: 22px 0 10px; }
.toc details { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.toc summary { font-size: 17px; font-weight: 800; cursor: pointer; color: var(--text); }
.toc ol { list-style: none; padding-left: 0; margin: 12px 0 0; }
.toc ol ol { padding-left: 16px; margin: 4px 0; }
.toc li { margin: 6px 0; }
.toc a { color: #333; }
.toc a:hover { color: var(--accent); }
.toc ol ol a { color: #666; font-size: 15px; }

/* 광고 */
/* 광고와 위·아래 글 사이 간격은 정확히 10px (이웃 요소의 인라인 마진도 !important 로 덮어 씀) */
.ad { margin: 10px 0 !important; min-height: 90px; text-align: center; overflow: hidden; line-height: 0; font-size: 0; }
.ad ins { max-width: 100%; }
.ad-300 { min-height: 250px; }
.ad-preview, .ad-preview-300 { margin-top: 10px !important; margin-bottom: 10px !important; }
.prose :has(+ .ad), .prose :has(+ .ad-preview) { margin-bottom: 0 !important; }
.prose .ad + *, .prose .ad-preview + * { margin-top: 0 !important; }
.ad-preview-300 { width: 300px; height: 250px; margin-left: auto !important; margin-right: auto !important; display: grid; place-items: center; }
.ad-preview, .slot-empty { margin: 20px 0; padding: 18px; text-align: center; font-size: 13px; color: #888; background: #f4f4f4; border: 1px dashed #bbb; border-radius: 8px; }
.slot-empty { background: #eef5ff; border-color: #9bbbe0; color: #4a6fa0; }

/* 라이트박스 */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 0; }

/* 관리자 바 (로그인 상태에서만 JS가 표시) */
#admin-bar { position: sticky; top: 0; z-index: 70; background: #111; color: #fff; font-size: 13px; padding: 7px 16px; display: flex; gap: 14px; align-items: center; }
#admin-bar[hidden] { display: none; }
#admin-bar a { color: #8cc4ff; }

/* 푸터 */
.site-footer { border-top: 1px solid var(--line); background: var(--soft); color: var(--muted); font-size: 13.5px; padding: 34px 0 40px; }
.site-footer .foot { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer strong { color: var(--text); font-size: 16px; }
.site-footer p { margin: 4px 0 0; }
.site-footer a { color: #555; }
.foot-r { text-align: right; }
.foot-r .copy { font-size: 12.5px; }

@media (max-width: 760px) {
  .site-header .hwrap { flex-wrap: wrap; height: auto; gap: 10px 14px; padding-top: 12px; padding-bottom: 10px; }
  .cats { order: 3; flex: 1 1 100%; }
  .search input, .search input:focus { width: 130px; }
  .hero h1 { font-size: 26px; }
  .card.featured { flex-direction: column; align-items: stretch; gap: 14px; }
  .card.featured .card-thumb { flex: none; }
  .card.featured h2 { font-size: 22px; }
  .grid { grid-template-columns: 1fr; gap: 26px; }
  .related .grid { grid-template-columns: 1fr; }
  .post-title { font-size: 26px; }
  .prose { font-size: 16px; }
  .lc-img { width: 104px; }
  .lc-desc { -webkit-line-clamp: 1; }
  .foot-r { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
