/* 둘에서 하나로 — 리소 듀오톤: 블루 잉크 + 형광 핑크 잉크 두 가지만 쓴다 */
:root {
  --paper: #f7f8fa;
  --ink: #1a2233;
  --blue: #0078bf;
  --pink: #ff48b0;
  --muted: #6b7385;
  --line: #dde1e8;
  --tint: #eaf3fa;
  --code-bg: #eef1f5;
  --measure: 44rem;
  --page: 70rem;
  --side: 17rem;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "D2Coding", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.75 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--blue); text-underline-offset: 0.2em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; }

.wrap { width: min(100% - 2.5rem, var(--page)); margin-inline: auto; }

/* 2단: 본문 + 사이드바 */
.shell { display: grid; grid-template-columns: minmax(0, 1fr) var(--side); gap: 4rem; align-items: start; }
.shell > main { min-width: 0; }
.post { max-width: var(--measure); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { top: 1rem; }

/* ---------- 머리 ---------- */
.site-head { padding: 2.25rem 0 1.75rem; border-bottom: 1px solid var(--line); background: #fff; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.tagline { margin: .55rem 0 0; color: var(--muted); font-size: .92rem; }

/* 로고: 스패너(파랑)와 톱니(핑크)가 겹치는 마크 + 글자 */
.logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.logo-mark { width: 44px; height: 44px; flex: none; }
.logo-text { font-size: clamp(1.45rem, 4vw, 1.85rem); line-height: 1; letter-spacing: -0.04em; font-weight: 500; }
.logo-text b { font-weight: 800; }
.logo:hover { color: var(--ink); }
.logo:hover .logo-mark { transform: rotate(-8deg); }
.logo-mark { transition: transform .35s cubic-bezier(.2,.7,.2,1); }

.search input {
  font: inherit;
  font-size: .95rem;
  width: 14rem;
  max-width: 100%;
  padding: .45rem .8rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}
.search input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgb(0 120 191 / .18); }

.cats {
  display: none;
  gap: .25rem 1.25rem;
  margin-top: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.cats::-webkit-scrollbar { display: none; }
.cats a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 500;
  padding: .35rem 0 .7rem;
  border-bottom: 3px solid transparent;
}
.cats a:hover { color: var(--ink); }
.cats a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--pink); }

.shell { padding-block: 2.75rem 4rem; }

/* ---------- 목록 ---------- */
.list-head { margin-bottom: 1.5rem; }
.list-head h1 { font-size: 1.75rem; letter-spacing: -0.02em; line-height: 1.3; margin: 0 0 .25rem; }
.list-head p { margin: 0; color: var(--muted); }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list > li { padding: 1.5rem 0; border-bottom: 1px solid var(--line); display: flex; gap: 1.5rem; align-items: flex-start; }
.pl-text { flex: 1 1 auto; min-width: 0; }
.pl-thumb { flex: 0 0 9.5rem; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--tint); display: block; }
.pl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.post-list > li:hover .pl-thumb img { transform: scale(1.04); }
.post-list > li:first-child { padding-top: .25rem; }
.pl-link { display: block; text-decoration: none; color: inherit; }
.pl-title { font-size: 1.25rem; line-height: 1.45; letter-spacing: -0.015em; margin: 0 0 .35rem; font-weight: 700; color: var(--ink); }
.pl-link:hover .pl-title { color: var(--blue); }
.pl-excerpt { margin: 0; color: #454e60; font-size: .98rem; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pl-meta { margin: .6rem 0 0; font-size: .85rem; color: var(--muted); display: flex; gap: .75rem; align-items: center; }
.pl-meta a { font-weight: 500; color: var(--blue) !important; }
.pl-meta a { color: var(--muted); text-decoration: none; }
.pl-meta a:hover { color: var(--blue); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; flex-wrap: wrap; }
.pg-nums { display: flex; gap: .25rem; flex-wrap: wrap; }
.pager a, .pager span[aria-current] {
  min-width: 2.25rem; padding: .35rem .6rem; text-align: center; border-radius: 6px; text-decoration: none; font-size: .95rem;
}
.pager a { color: var(--ink); }
.pager a:hover { background: var(--tint); color: var(--blue); }
.pager span[aria-current] { background: var(--ink); color: #fff; font-weight: 700; }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips a { display: inline-block; padding: .3rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; text-decoration: none; color: var(--ink); font-size: .92rem; }
.chips a:hover { border-color: var(--blue); color: var(--blue); }
.chips span { color: var(--muted); font-size: .82rem; margin-left: .15rem; }

/* ---------- 글 ---------- */
.post-head { margin-bottom: 2.25rem; }
.crumbs { display: flex; gap: .45rem; align-items: center; margin: 0 0 .7rem; font-size: .88rem; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:last-child { color: var(--blue); font-weight: 500; }
.crumbs a:hover { color: var(--ink); }
.post-head h1 { font-size: clamp(1.7rem, 4.2vw, 2.3rem); line-height: 1.32; letter-spacing: -0.03em; margin: 0; }
.post-meta { margin: .9rem 0 0; color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.post-meta a { color: var(--ink); font-weight: 500; text-decoration: none; }
.author-box { display: flex; gap: 1rem; align-items: center; margin-top: 2.5rem; padding: 1.1rem 1.25rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.author-box img { border-radius: 50%; flex: none; }
.author-box p { margin: 0; font-size: .92rem; color: var(--muted); line-height: 1.6; }
.author-box a { color: var(--ink); font-weight: 700; text-decoration: none; }

.post-body { font-size: 1.0625rem; }
.post-body > :first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.1em; }
.post-body h2, .post-body h3, .post-body h4 { line-height: 1.4; letter-spacing: -0.02em; margin: 2.2em 0 .7em; }
.post-body h2 { font-size: 1.45rem; }
.post-body h3 { font-size: 1.25rem; }
.post-body h4 { font-size: 1.1rem; }
.post-body ul, .post-body ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.post-body li { margin: .25em 0; }
.post-body blockquote {
  margin: 1.5em 0; padding: .6em 1.2em; border-left: 4px solid var(--pink); background: #fff; color: #39424f;
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.post-body table { border-collapse: collapse; width: 100%; margin: 1.5em 0; font-size: .95rem; display: block; overflow-x: auto; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: .5em .7em; text-align: left; vertical-align: top; }
.post-body th { background: var(--tint); }

/* 이미지 블록 */
.post-body figure { margin: 1.75em 0; }
.post-body figure.imageblock { text-align: center; }
.post-body figure.imageblock img { border-radius: 4px; }
.post-body figure.imageblock.alignLeft { text-align: left; }
.post-body figure.imageblock.alignRight { text-align: right; }
.post-body figcaption { margin-top: .5em; font-size: .88rem; color: var(--muted); text-align: center; }
.post-body figure.imagegridblock .image-container { display: flex; gap: 4px; }
.post-body figure.imagegridblock .image-container > * { flex: 1 1 0; }

/* 동영상 */
.post-body iframe { max-width: 100%; }
.post-body figure[data-ke-type="video"] iframe,
.post-body iframe[src*="youtube"] { width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 4px; display: block; }

/* 코드 */
.post-body code { font-family: var(--mono); font-size: .9em; background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
.post-body pre {
  font-family: var(--mono);
  font-size: .88rem;
  line-height: 1.6;
  background: #16202f;
  color: #e6edf5;
  padding: 1.1em 1.25em;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5em 0;
  border-top: 3px solid var(--blue);
  word-break: normal;
  overflow-wrap: normal;
}
.post-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: pre; }

/* 첨부파일 */
.post-body figure.fileblock a {
  display: flex; align-items: center; gap: .9rem; padding: .85rem 1.1rem; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  text-decoration: none; color: var(--ink);
}
.post-body figure.fileblock a:hover { border-color: var(--blue); }
.post-body figure.fileblock .image {
  width: 2.2rem; height: 2.2rem; flex: none; border-radius: 4px; background: var(--tint);
  background-image: linear-gradient(var(--blue), var(--blue)); background-size: 40% 3px; background-position: 50% 60%; background-repeat: no-repeat;
  position: relative;
}
.post-body figure.fileblock .image::after { content: ""; position: absolute; left: 50%; top: 22%; width: 3px; height: 38%; background: var(--blue); transform: translateX(-50%); }
.post-body figure.fileblock .desc { min-width: 0; }
.post-body figure.fileblock .name { font-weight: 500; }
.post-body figure.fileblock .size { color: var(--muted); font-size: .85rem; }

/* 링크 미리보기 카드 */
.post-body figure[data-ke-type="opengraph"] a {
  display: flex; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; text-decoration: none; color: var(--ink);
}
.post-body figure[data-ke-type="opengraph"] a:hover { border-color: var(--blue); }
.post-body .og-image { flex: 0 0 9.5rem; min-height: 7rem; background-size: cover; background-position: center; background-color: var(--tint); }
.post-body .og-text { padding: .85rem 1.1rem; min-width: 0; }
.post-body .og-text p { margin: 0; }
.post-body .og-title { font-weight: 700; line-height: 1.45; }
.post-body .og-desc { color: #4a5262; font-size: .9rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: .2rem !important; }
.post-body .og-host { color: var(--muted); font-size: .82rem; margin-top: .35rem !important; }

/* 접은글 */
.post-body .moreless_content { display: none; }
.post-body .moreless_content.open { display: block; }

.post-tags { list-style: none; padding: 0; margin: 3rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.post-tags a { text-decoration: none; font-size: .92rem; color: var(--muted); }
.post-tags a:hover { color: var(--pink); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 2px solid var(--ink); }
.post-nav a { text-decoration: none; color: var(--ink); font-weight: 500; line-height: 1.5; }
.post-nav a:hover { color: var(--blue); }
.post-nav span { display: block; font-size: .82rem; color: var(--muted); font-weight: 400; margin-bottom: .2rem; }
.pn-next { text-align: right; }

.related { margin-top: 3rem; }
.related h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; }
.related li a { color: var(--ink); text-decoration: none; }
.related li a:hover { color: var(--blue); }
.related time { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* ---------- 사이드바 ---------- */
.side { position: sticky; top: 1.5rem; display: grid; gap: 1.25rem; font-size: .93rem; }
.side-box { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.2rem; }
.side-box h2 { font-size: .95rem; margin: 0 0 .7rem; padding-bottom: .55rem; border-bottom: 2px solid var(--ink); }
.side-box ul { list-style: none; margin: 0; padding: 0; }
.profile { display: flex; gap: .9rem; align-items: center; }
.profile img { width: 72px; height: 72px; border-radius: 50%; background: var(--tint); flex: none; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--pink); }
.profile p { margin: 0; }
.pf-name { font-weight: 700; font-size: 1rem; }
.pf-desc { color: var(--muted); font-size: .86rem; line-height: 1.55; margin-top: .2rem !important; }
.side-cats a { display: flex; justify-content: space-between; padding: .32rem 0; color: var(--ink); text-decoration: none; }
.side-cats a span { color: var(--muted); font-size: .85rem; }
.side-cats a:hover, .side-cats a[aria-current="page"] { color: var(--blue); }
.side-cats a[aria-current="page"] { font-weight: 700; }
.side-recent li { padding: .4rem 0; border-bottom: 1px dashed var(--line); line-height: 1.5; }
.side-recent li:last-child { border-bottom: 0; }
.side-recent a { color: var(--ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-recent a:hover { color: var(--blue); }
.side-tags { margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.side-tags a { font-size: .82rem; padding: .18rem .55rem; border-radius: 999px; background: var(--tint); color: #2a4a66; text-decoration: none; }
.side-tags a:hover { background: var(--blue); color: #fff; }
.side-more { margin: .8rem 0 0; font-size: .85rem; }

/* ---------- 바닥 ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 2rem 0 3rem; color: var(--muted); font-size: .88rem; background: #fff; }
.site-foot p { margin: .2rem 0; }
.site-foot a { color: var(--muted); margin-right: 1rem; }

@media (max-width: 64rem) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 3rem; }
  .shell > main { max-width: none; }
  .side { position: static; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
  .cats { display: flex; }
  .site-head { padding-bottom: 0; }
  .tagline { display: none; }
}

@media (max-width: 40rem) {
  .pl-thumb { flex-basis: 5.5rem; }
  .post-list > li { gap: 1rem; }
  .pl-title { font-size: 1.08rem; }
  .pl-excerpt { -webkit-line-clamp: 2; font-size: .92rem; }
  body { font-size: 1rem; }
  .site-head { padding-top: 1.5rem; }
  .search, .search input { width: 100%; }
  .post-body .og-image { flex-basis: 6rem; }
  .post-nav { grid-template-columns: 1fr; }
  .pn-next { text-align: left; }
  .related li { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .logo-mark { transition: none; }
}

.preview-note { margin: 0 0 1.5rem; padding: .7rem 1rem; border-left: 4px solid var(--pink); background: #fff; font-size: .92rem; }
.pf-name a { color: var(--ink); text-decoration: none; }

/* ---------- 글 구성 요소 (요약·목차·표·체크리스트·주의·FAQ·출처) ---------- */
.post-body .summary-box { margin: 0 0 1.75em; padding: 1.1rem 1.3rem; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; }
.post-body .summary-box > :first-child { margin-top: 0; }
.post-body .summary-box > :last-child { margin-bottom: 0; }
.post-body .summary-box .summary-title { font-weight: 700; margin: 0 0 .5em; font-size: 1rem; }
.post-body .summary-box ul { margin: 0; }
.post-body .key-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; margin: 1.25em 0 1.75em; padding: 0; list-style: none; }
.post-body .key-figures li { margin: 0; padding: .8rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.post-body .key-figures b { display: block; font-size: 1.25rem; letter-spacing: -0.02em; color: var(--ink); }
.post-body .key-figures span { font-size: .85rem; color: var(--muted); }
.toc { margin: 0 0 2em; }
.toc details { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1.1rem; }
.toc summary { cursor: pointer; font-weight: 700; font-size: .95rem; }
.toc ol { margin: .6rem 0 .2rem; padding-left: 1.3em; font-size: .95rem; }
.toc li { margin: .25em 0; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--blue); text-decoration: underline; }
.post-body h2[id] { scroll-margin-top: 1rem; }
.post-body table { background: #fff; }
.post-body thead th, .post-body tr:first-child th { background: var(--tint); font-weight: 700; }
.post-body ul.checklist { list-style: none; padding-left: 0; }
.post-body ul.checklist li { position: relative; padding-left: 1.7em; margin: .45em 0; }
.post-body ul.checklist li::before { content: ""; position: absolute; left: 0; top: .32em; width: 1.05em; height: 1.05em; border: 2px solid var(--blue); border-radius: 4px; background: #fff; }
.post-body .caution, .post-body .tip-box { margin: 1.5em 0; padding: .9rem 1.15rem; border-radius: 8px; font-size: .97rem; }
.post-body .caution { background: #fff5fa; border: 1px solid #ffc7e6; border-left: 4px solid var(--pink); }
.post-body .tip-box { background: var(--tint); border: 1px solid #cfe3f3; border-left: 4px solid var(--blue); }
.post-body .caution > :last-child, .post-body .tip-box > :last-child { margin-bottom: 0; }
.post-body .caution strong:first-child, .post-body .tip-box strong:first-child { display: block; margin-bottom: .25em; }
.post-body h2 + h3 { margin-top: 1em; }
.post-body .faq h3, .post-body h3.faq-q { font-size: 1.05rem; }
.post-body .sources { margin-top: 2.5em; padding-top: 1rem; border-top: 1px dashed var(--line); font-size: .88rem; color: var(--muted); }
.post-body .sources a { color: var(--muted); }
.post-body .checked-date { font-size: .85rem; color: var(--muted); }

/* 카테고리 모아보기 */
.cat-index { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .75rem; }
.cat-index li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .9rem 1.1rem; }
.cat-index a { display: flex; justify-content: space-between; gap: .5rem; text-decoration: none; color: var(--ink); }
.cat-index a:hover b { color: var(--blue); }
.cat-index a span { color: var(--muted); font-size: .88rem; }
.cat-index p { margin: .35rem 0 0; font-size: .88rem; color: var(--muted); line-height: 1.55; }
