@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

/* ===== 색·기본값 ===== */
:root {
  color-scheme: light;
  --bg: #faf6ef;          /* 크림 종이 */
  --surface: #fffdf8;
  --surface-2: #f4ede2;
  --text: #2b2520;        /* 따뜻한 짙은 갈색: 배경 대비 약 14:1 */
  --muted: #6b5f55;       /* 보조 글자: bg 5.7:1, surface-2 5.3:1 */
  --line: #e6dccd;
  --line-strong: #d3c5b2;
  --accent: #a4482a;      /* 테라코타: bg 5.5:1, accent-soft 4.9:1 */
  --accent-soft: #f6e7dc;
  --sage: #4d6a56;        /* 세이지: bg 5.4:1, sage-soft 5.0:1 */
  --sage-soft: #e8efe6;
  --highlight: #f6dcc8;
  --shadow: rgba(60, 40, 25, 0.16);
  --shadow-soft: rgba(60, 40, 25, 0.08);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --measure: 34em;        /* 한글 한 줄 약 38~43자 */
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1b1815;
    --surface: #23201c;
    --surface-2: #2a2621;
    --text: #ece5da;        /* bg 대비 약 14:1 */
    --muted: #b3a796;       /* surface 대비 약 6.9:1 */
    --line: #3b352e;
    --line-strong: #544b41;
    --accent: #eb9a7e;      /* bg 대비 약 7.5:1 */
    --accent-soft: #3a2820;
    --sage: #a3c2ab;
    --sage-soft: #222b25;
    --highlight: #5a3a2c;
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-soft: rgba(0, 0, 0, 0.3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
p { text-wrap: pretty; }
::selection { background: var(--highlight); color: var(--text); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ===== 레이아웃 ===== */
.wrap { max-width: 880px; margin-inline: auto; padding-inline: 20px; }
main { padding-block: 28px 64px; }

/* ===== 상단 ===== */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 24px; padding-block: 16px;
}
.logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 20px; letter-spacing: -0.03em;
  color: var(--text); text-decoration: none;
}
.logo::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.top nav {
  display: flex; flex-wrap: wrap; gap: 2px 2px;
  margin-inline: -10px; font-size: 14.5px; line-height: 1.5;
}
.top nav a {
  padding: 5px 10px; border-radius: 999px;
  color: var(--muted); text-decoration: none;
  transition: color .15s, background-color .15s;
}
.top nav a:hover { color: var(--accent); background: var(--accent-soft); }

/* ===== 제목·공통 글자 ===== */
h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.1rem);
  line-height: 1.35; letter-spacing: -0.03em; font-weight: 800;
  margin: 8px 0 14px; text-wrap: balance;
}
h2 {
  font-size: 1.4em; line-height: 1.4; letter-spacing: -0.025em; font-weight: 750;
  margin: 2.2em 0 0.7em; text-wrap: balance;
}
h3 {
  font-size: 1.12em; line-height: 1.45; letter-spacing: -0.02em; font-weight: 700;
  margin: 1.8em 0 0.5em;
}
.lead { font-size: 18px; line-height: 1.7; color: var(--muted); }
.meta { font-size: 14px; line-height: 1.6; color: var(--muted); letter-spacing: 0; }
.meta strong { color: var(--sage); font-weight: 650; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ===== 홈: 소개·주제·카드 ===== */
.hero { padding: 12px 0 8px; }
.hero h1 { margin-top: 0; }
.hero .lead { margin: 0 0 8px; max-width: 36em; }

.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 10px; margin: 16px 0 8px;
}
.topic {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 18px 12px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-weight: 650; text-decoration: none;
  transition: border-color .15s, background-color .15s, color .15s;
}
.topic:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
/* 아이콘 | 주제 이름 위, 글 수 아래 (4칸일 때도 이름이 한 줄에 들어가게) */
.topic { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 0; line-height: 1.4; }
.topic .topic-icon { grid-row: 1 / 3; }
.topic strong { min-width: 0; font-weight: inherit; align-self: end; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic span { color: var(--muted); font-size: 13px; font-weight: 500; }
/* 주제 아이콘: 연한 테라코타 원 안에 선 아이콘 */
.topic .topic-icon {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  transition: background-color .15s;
}
.topic .topic-icon svg { width: 22px; height: 22px; }
.topic:hover .topic-icon { background: var(--surface); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 16px; margin-top: 16px;
}
.card { min-width: 0; }
.card a {
  display: block; height: 100%; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  color: var(--text); text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card a:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px var(--shadow-soft);
  transform: translateY(-2px);
}
.card h3 { font-size: 18.5px; margin: 8px 0 6px; }
.card a:hover h3 { color: var(--accent); }
.card p { font-size: 15px; line-height: 1.65; color: var(--muted); margin: 6px 0 12px; }
.card .meta { margin: 0; font-size: 13px; }
.cat { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0; }

/* ===== 글 페이지 ===== */
.crumb { font-size: 14px; line-height: 1.6; color: var(--muted); margin-bottom: 20px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); text-decoration: underline; }

.post { max-width: var(--measure); margin-inline: auto; font-size: 18px; }
.post h1 { margin-top: 0; }
.post .meta { margin: 0 0 22px; }
.post .lead {
  margin: 0 0 32px; padding: 18px 22px;
  background: var(--accent-soft); border-radius: var(--radius);
  color: var(--text); font-size: 1em; line-height: 1.75;
}

.body > :first-child { margin-top: 0; }
.body p { margin: 0 0 1.35em; }
.post h2::before {
  content: ""; display: block;
  width: 28px; height: 4px; border-radius: 2px;
  background: var(--accent); margin-bottom: 14px;
}
.body strong {
  font-weight: 700;
  background: linear-gradient(transparent 62%, var(--highlight) 0);
}

.body ul, .body ol { margin: 0 0 1.4em; padding-left: 1.3em; }
.body li { margin: 0.5em 0; padding-left: 0.2em; }
.body li::marker { color: var(--accent); }
.body ol > li::marker { font-weight: 700; }

.body hr { border: 0; height: 1px; background: var(--line); margin: 2.5em 0; }
.body code {
  font-size: 0.9em; padding: 0.1em 0.35em; border-radius: 4px;
  background: var(--surface-2); word-break: break-all;
}

/* 표: 내용 폭에 맞추고, 넘치면 상자 안에서만 가로 스크롤 */
.body table {
  display: block; width: max-content; max-width: 100%;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 1.6em 0; border: 1px solid var(--line); border-radius: 12px;
  border-collapse: collapse; font-size: 0.875em; line-height: 1.6;
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--shadow), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--shadow), transparent) right / 12px 100% no-repeat scroll,
    var(--surface);
}
.body th, .body td {
  padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: top;
}
.body th {
  background: var(--sage-soft); color: var(--text);
  font-weight: 700; white-space: nowrap;
}
.body td:first-child { font-weight: 600; }
.body tbody tr:last-child td { border-bottom: 0; }

/* 그림 */
figure { margin: 2em 0; }
figure img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); background: var(--line);
  border: 1px solid var(--line);  /* 도식 카드 배경이 페이지와 같은 크림색이라 테두리로 구분 */
}
figcaption {
  margin-top: 10px; padding-inline: 1em;
  font-size: 14px; line-height: 1.6; color: var(--muted); text-align: center;
}
figcaption .credit { display: block; font-size: 12px; color: var(--muted); }

/* 쿠팡 파트너스: 공정위 표시 문구와 상품 상자 */
.post .disclosure {
  margin: 0 0 18px; padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font-size: 13.5px; line-height: 1.6;
}
.product {
  margin: 1.6em 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-size: 16px; line-height: 1.6;
}
.product-tag { display: block; font-size: 12.5px; font-weight: 700; color: var(--sage); margin-bottom: 4px; }
.product strong { display: block; font-size: 17px; background: none; }  /* 본문 굵은 글씨 형광펜 효과 제외 */
.product p { margin: 4px 0 12px; color: var(--muted); font-size: 15px; }
.product a {
  display: inline-block; padding: 7px 16px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 14.5px; font-weight: 700; text-decoration: none;
}
.product a:hover { opacity: .9; }
@media (prefers-color-scheme: dark) {
  .product a { color: #1b1815; }  /* 다크 모드 강조색이 밝아서 글자는 어둡게 */
}
@media (prefers-color-scheme: dark) {
  figure img { filter: brightness(0.92); }
}

.body blockquote {
  margin: 1.6em 0; padding: 14px 20px;
  background: var(--sage-soft); border-left: 4px solid var(--sage);
  border-radius: 0 12px 12px 0; color: var(--text);
}
.body blockquote p:last-child { margin-bottom: 0; }

/* 자주 묻는 질문 */
.faq { margin-top: 3em; }
.faq details {
  margin: 10px 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s;
}
.faq details[open] { border-color: var(--line-strong); }
.faq summary {
  position: relative; list-style: none; cursor: pointer;
  padding: 15px 48px 15px 54px;
  font-weight: 700; line-height: 1.55;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "Q"; position: absolute; left: 16px; top: 14px;
  display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--sage-soft); color: var(--sage);
  font-size: 14px; font-weight: 800; line-height: 1;
}
.faq summary::after {
  content: ""; position: absolute; right: 22px; top: 22px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: translate(0, 4px) rotate(-135deg); }
.faq summary:hover { color: var(--accent); }
.faq details p { margin: 0; padding: 0 20px 18px 54px; font-size: 0.95em; }

/* 출처 */
.sources {
  margin-top: 3em; padding: 20px 22px;
  background: var(--surface-2); border-radius: var(--radius);
  font-size: 15px; line-height: 1.7; color: var(--muted);
}
.sources h2 { font-size: 18px; margin: 0 0 0.6em; color: var(--text); }
.sources h2::before { width: 20px; height: 3px; margin-bottom: 10px; }
.sources ol, .sources ul { margin: 0; padding-left: 1.4em; }
.sources li { margin: 0.35em 0; }
.sources a { overflow-wrap: anywhere; }

/* 태그 */
.tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 28px; font-size: 14px; color: var(--muted);
}
.tags span {
  padding: 4px 12px; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}

/* ===== 하단 ===== */
.foot {
  margin-top: 24px; padding-block: 28px 56px;
  border-top: 1px solid var(--line);
  font-size: 14px; line-height: 1.7; color: var(--muted);
}
.foot p { margin: 0 0 6px; }

/* ===== 넓은 화면: 그림을 본문보다 조금 넓게 ===== */
@media (min-width: 760px) {
  .body figure { margin-inline: -48px; }
  .body figcaption { padding-inline: 48px; }
}

/* ===== 휴대폰 ===== */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 16px; }
  main { padding-block: 20px 48px; }
  .top .wrap { padding-block: 12px; gap: 6px 16px; }
  .top nav { font-size: 14px; margin-inline: -8px; }
  .top nav a { padding: 4px 8px; }
  .post { font-size: 17px; }
  .post .lead { padding: 16px 18px; margin-bottom: 26px; }
  h2 { font-size: 1.32em; }
  .body table { font-size: 14.5px; }
  .body th, .body td { padding: 10px 12px; }
  figure img { border-radius: 10px; }
  .faq summary { padding: 14px 42px 14px 50px; }
  .faq summary::before { left: 14px; top: 13px; }
  .faq details p { padding: 0 16px 16px 50px; }
  .sources { padding: 18px 18px; }
  .card a { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .card a:hover { transform: none; }
}
