@font-face { font-family: "Paperlogy"; src: url(/assets/fonts/Paperlogy-6SemiBold.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url(/assets/fonts/Pretendard-Regular.subset.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url(/assets/fonts/Pretendard-SemiBold.subset.woff2) format("woff2"); font-weight: 600; font-display: swap; }

/* --accent, --accent-soft 는 사이트마다 다르다: publish.py 가 sites.json 값을 이 파일 끝에 붙인다 */
:root {
  --ink: #1b2430; --sub: #566170; --line: #e2e6ea; --soft: #f4f6f8;
  --accent: #12736b; --accent-soft: #e9f3f1; --warn: #b93327; --warn-soft: #fbefed;
  --radius: 8px; --w: 1120px;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #fff; font: 17px/1.85 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; word-break: keep-all; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
b { font-weight: 600; }
.in { max-width: var(--w); margin: 0 auto; padding: 0 20px; }

/* 머리글 · 바닥글 */
.site { border-bottom: 1px solid var(--line); }
.site .in { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; column-gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-family: "Paperlogy", sans-serif; font-weight: 600; font-size: 17px; color: var(--ink); }
.brand i { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); }
.site nav a { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--sub); font-size: 15px; }
.site nav a:hover { color: var(--accent); }
.foot { margin-top: 104px; border-top: 1px solid var(--line); background: var(--soft); font-size: 14px; color: var(--sub); }
.foot .in { padding-top: 24px; padding-bottom: 32px; }
.foot b { display: block; color: var(--ink); font-family: "Paperlogy", sans-serif; font-size: 15px; margin-bottom: 4px; }
.foot p { margin: 0; }
.foot a { display: inline-flex; align-items: center; gap: 3px; min-height: 44px; margin-top: 4px; }

/* 글 맨 위 */
.crumb { display: flex; align-items: center; gap: 2px; font-size: 14px; color: var(--sub); margin: 8px 0 0 -8px; }
.crumb a, .crumb em { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; color: var(--sub); font-style: normal; }
h1 { font-family: "Paperlogy", sans-serif; font-weight: 600; font-size: clamp(28px, 4.8vw, 42px); line-height: 1.34; letter-spacing: -0.01em; margin: 12px 0 20px; }
.lead { font-size: 18px; color: var(--sub); margin: 0 0 22px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 24px; list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--sub); }
.meta li { display: inline-flex; align-items: center; gap: 7px; }
/* 맨 위는 한 단: 제목 · 소개 → 요약 상자 → 대표 사진. 목차는 그 아래 본문부터 옆에 붙는다 */
.top { padding: 36px 0 72px; }
.top > :is(h1, .lead, .meta, .adnote) { max-width: 880px; }
.top .first { margin-top: 44px; }
.photo { margin: 28px 0 0; }
.photo img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: 10px; }

/* 목차 + 본문 */
.body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 80px; border-top: 1px solid var(--line); padding-top: 56px; }
.side { position: sticky; top: 20px; align-self: start; }
.toc { font-size: 14px; }
.toc summary { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 4px; pointer-events: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc a { display: flex; align-items: center; min-height: 44px; padding: 6px 0; line-height: 1.5; color: var(--sub); border-top: 1px solid var(--line); }
.toc a:hover { color: var(--accent); }
article > :first-child { margin-top: 0; }
article > h2:first-child { padding-top: 0; border-top: 0; }   /* 바로 위에 본문 시작 선이 있다 */
/* 화면이 낮으면 따라다니는 왼쪽 칸이 화면보다 길어져 아래가 잘린다: 광고를 하나로 줄이거나 뺀다 */
@media (max-height: 899px) { .side .ad a + a { display: none; } }
@media (max-height: 679px) { .side .ad { display: none; } }
h2 { font-family: "Paperlogy", sans-serif; font-weight: 600; font-size: clamp(24px, 3.2vw, 30px); line-height: 1.4; letter-spacing: -0.01em; margin: 88px 0 28px; padding-top: 44px; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
h2 .n { color: var(--accent); margin-right: 14px; }
p { margin: 0 0 20px; }
.note { position: relative; font-size: 15px; color: var(--sub); margin: 24px 0 0; padding-left: 28px; }
.menu { background: var(--soft); border-radius: 4px; padding: 2px 7px; font-size: 14px; }

/* 먼저 볼 요약 */
.first { background: var(--accent-soft); border-radius: var(--radius); padding: 32px 36px; }
.first > b { display: flex; align-items: center; gap: 10px; font-family: "Paperlogy", sans-serif; font-size: 20px; margin-bottom: 14px; }
.first ul { list-style: none; margin: 0; padding: 0; }
.first li { position: relative; padding: 9px 0 9px 30px; }
.first li::before { content: ""; position: absolute; left: 3px; top: 19px; width: 12px; height: 7px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

/* 주의 · 순서 · 표 */
.warn { background: var(--warn-soft); border-radius: var(--radius); padding: 20px 24px; margin: 0 0 28px; }
.warn strong { color: var(--warn); font-weight: 600; margin-right: 8px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 22px 0 22px 52px; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 22px; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); font-size: 15px; font-weight: 600; display: grid; place-items: center; line-height: 1; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; vertical-align: top; padding: 16px 20px; border-top: 1px solid var(--line); }
th { background: var(--soft); border-top: 0; font-weight: 600; color: var(--sub); font-size: 15px; }
td:first-child { font-weight: 600; min-width: 7.5em; }

/* 도식: 이어진 길(.flow), 갈림(.split), 온도 막대(.temp) */
.flow { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 36px 16px 32px; margin: 28px 0 0; }
.flow.line::before { content: ""; position: absolute; left: calc(50% / var(--n, 4)); right: calc(50% / var(--n, 4)); top: 62px; height: 4px; border-radius: 2px; background: #b8c2cc; }
.flow div { position: relative; text-align: center; padding: 0 8px; }
.flow svg { width: 56px; height: 56px; display: block; margin: 0 auto 10px; background: #fff; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flow b { display: block; font-size: 16px; line-height: 1.4; }
.flow span { display: block; font-size: 14px; color: var(--sub); line-height: 1.6; margin-top: 6px; }
.flow span b { display: inline; font-size: inherit; color: var(--ink); }
.flow.two { --n: 2; }
.cap { font-size: 14px; color: var(--sub); margin: 16px 0 0; }
.split { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); margin: 8px 0 24px; }
.split div { padding: 24px 24px 24px 0; }
.split div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.split b { display: block; line-height: 1.5; }
.split span { display: block; font-size: 14px; color: var(--sub); margin-top: 6px; }
.split em { display: block; font-style: normal; font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 8px; }
.temp { margin: 12px 0 32px; }
.temp .bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; }
.temp .ticks { position: relative; height: 24px; font-size: 13px; color: var(--sub); }
.temp .ticks span { position: absolute; top: 4px; transform: translateX(-50%); }
.temp .ticks span:first-child { transform: none; }
.temp .ticks span:last-child { transform: translateX(-100%); }
.temp ul { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.temp li i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 7px; }

/* 위치 그림: 번호를 붙인 그림과 번호별 설명 */
.locate { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 48px; align-items: start; margin: 28px 0 0; }
.locate svg { display: block; width: 100%; height: auto; font-family: inherit; }
.locate ol { list-style: none; margin: 0; padding: 0; }
.locate li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.locate li:first-child { border-top: 0; padding-top: 0; }
.locate i { width: 28px; height: 28px; margin-top: 2px; border-radius: 50%; color: #fff; font-style: normal; font-size: 14px; font-weight: 600; display: grid; place-items: center; line-height: 1; }
.locate li b { display: block; }

/* 사이트 소개 */
.about { max-width: 760px; padding: 36px 0 0; }
.about h2 { font-size: 22px; margin: 56px 0 16px; padding-top: 32px; }
.about ul { margin: 0; padding-left: 22px; }
.about li { margin-bottom: 10px; }
.about a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }

/* 출처 */
.sources { margin: 88px 0 0; padding: 36px 0 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--sub); scroll-margin-top: 16px; }
.sources b { display: flex; align-items: center; gap: 8px; color: var(--ink); margin-bottom: 6px; }
.sources a { display: flex; align-items: center; gap: 16px; min-height: 44px; padding: 6px 0; line-height: 1.5; border-top: 1px solid var(--line); }
.sources a:first-of-type { border-top: 0; }

/* 광고 칸(쿠팡 파트너스 상품): 본문 가운데 · 출처 위 · 목차 아래 */
.adnote { position: relative; font-size: 13px; color: var(--sub); background: var(--soft); border-radius: 6px; padding: 8px 12px 8px 36px; margin: 16px 0 0; }
.ad { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px 20px; margin: 72px 0 0; }
.ad + h2 { margin-top: 72px; }
.ad + .sources { margin-top: 72px; }
.ad > em { display: block; font-style: normal; font-size: 12px; color: var(--sub); margin-bottom: 10px; }
.ad > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.ad a { display: block; color: var(--ink); font-size: 14px; line-height: 1.5; }
.ad a:hover span { color: var(--accent); }
.ad img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; margin-bottom: 8px; }
.ad span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ad strong { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; }
.side .ad { margin: 28px 0 0; padding: 10px 12px 12px; }
.side .ad > div { grid-template-columns: minmax(0, 1fr); }

/* 작은 아이콘: 굵기 1.7의 선 그림. 놓인 자리의 글자색으로 칠해지도록 mask 로 쓴다. 새 자리에 넣을 때는 아래 목록에 선택자를 더하고 --i 만 정한다 */
:root {
  --i-cal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2.5'/%3E%3Cpath d='M3.5 9.5h17M8 3v4M16 3v4M9 14.8l2 2 4-4.2'/%3E%3C/svg%3E");
  --i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3.2 2'/%3E%3C/svg%3E");
  --i-list: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6.5h11M9 12h11M9 17.5h11M4.5 6.5h.5M4.5 12h.5M4.5 17.5h.5'/%3E%3C/svg%3E");
  --i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4.5 3.5 19.5h17zM12 10.5v4M12 17h.01'/%3E%3C/svg%3E");
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5.5M12 7.8h.01'/%3E%3C/svg%3E");
  --i-mail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='12' rx='2'/%3E%3Cpath d='M4.5 7.5 12 13l7.5-5.5'/%3E%3C/svg%3E");
  --i-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 6l6 6-6 6'/%3E%3C/svg%3E");
}
:where(.meta li:nth-child(-n+2), .toc summary, .warn strong, .note, .adnote, .about a)::before,
.foot a::after { content: ""; flex: none; display: inline-block; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.meta li:nth-child(1) { --i: var(--i-cal); }
.meta li:nth-child(2) { --i: var(--i-clock); }
.toc summary { --i: var(--i-list); }
.warn strong { --i: var(--i-alert); }
.warn strong::before { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; }
.note, .adnote { --i: var(--i-info); }
.note::before { position: absolute; left: 0; top: 5px; width: 18px; height: 18px; }
.adnote::before { position: absolute; left: 12px; top: 12px; }
.about a { --i: var(--i-mail); }
.foot a { --i: var(--i-next); }
.foot a::after { width: 14px; height: 14px; }

/* 사이트 첫 화면 */
.home h1 { margin-top: 36px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; list-style: none; margin: 28px 0 0; padding: 0; }
.cards a { display: block; height: 100%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--ink); }
.cards a:hover { border-color: var(--accent); }
.cards img, .cards .noimg { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--accent-soft); }
.cards div { padding: 16px 18px 18px; }
.cards b { display: block; font-family: "Paperlogy", sans-serif; font-size: 17px; line-height: 1.45; }
.cards span { display: block; font-size: 14px; color: var(--sub); line-height: 1.6; margin-top: 6px; }

/* 글 끝: 이 사이트의 다른 글 */
.more { margin-top: 104px; padding-top: 44px; border-top: 1px solid var(--line); }
.more > b { display: block; font-family: "Paperlogy", sans-serif; font-size: clamp(22px, 2.8vw, 26px); }

@media (max-width: 860px) {
  /* 좁은 화면: 답이 첫 화면에 들어오게 위쪽을 줄인다 */
  .crumb { display: none; }
  .top { padding: 20px 0 32px; }
  .top .first { margin-top: 24px; }
  .photo { margin-top: 20px; }
  .photo img { aspect-ratio: 16 / 9; }
  .lead { font-size: 16px; margin-bottom: 16px; }
  .body { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; }
  h2 { margin-top: 64px; padding-top: 36px; }
  .first { padding: 24px 22px; }
  .locate { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .locate svg { max-width: 300px; margin: 0 auto; }
  .side { position: static; }
  /* 좁은 화면에서는 목차를 접어 두어 요약이 먼저 보이게 한다(publish.py 가 넣는 한 줄 스크립트가 닫는다) */
  .toc summary { min-height: 48px; margin: 0; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius); pointer-events: auto; cursor: pointer; }
  .toc summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--sub); border-bottom: 2px solid var(--sub); transform: translateY(-2px) rotate(45deg); }
  .toc details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .toc details[open] a { padding-left: 16px; padding-right: 16px; }
  .toc details[open] a:first-of-type { border-top: 0; }
  .side .ad { display: none; }
}
@media (max-width: 620px) {
  /* 세 칸 이상인 표는 줄마다 카드로 푼다(칸 제목은 publish.py 가 붙인 data-label) */
  .tablewrap:has(td[data-label]) { border: 0; border-radius: 0; overflow: visible; }
  .tablewrap:has(td[data-label]) :is(table, tbody, tr, td) { display: block; }
  .tablewrap:has(td[data-label]) tr:first-child { display: none; }
  .tablewrap:has(td[data-label]) tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
  .tablewrap:has(td[data-label]) td { border: 0; padding: 6px 0; min-width: 0; }
  .tablewrap:has(td[data-label]) td:first-child { font-size: 17px; padding: 0 0 8px; }
  .tablewrap:has(td[data-label]) td:not(:first-child)::before { content: attr(data-label); display: block; font-size: 13px; font-weight: 600; color: var(--sub); }
  .more { margin-top: 72px; padding-top: 36px; }
  .split { grid-template-columns: 1fr; }
  .split div, .split div + div { padding: 20px 0; border-left: 0; }
  .split div + div { border-top: 1px solid var(--line); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 22px; }
  .flow.line::before { display: none; }
  .flow.two { grid-template-columns: minmax(0, 1fr); }
  .ad > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

:root { --accent: #12736b; --accent-soft: #e9f3f1; }
