/* =========================================================
   글 상세 — base.css 토큰 위에 얹는 읽기 레이어

   base.css 는 520px 모바일 퍼널용이다. 3,500~4,500자 본문은 읽기 폭과
   행간이 따로 필요해서 여기서 덮는다. 색·radius·그림자 토큰은 그대로 쓴다.
   ========================================================= */

:root {
  --max-read: 720px;   /* 본문 — 한 줄 40~45자 */
  --max-page: 1180px;  /* 목차를 옆에 세울 때 */
  --fs-read: 17px;     /* 본문 (퍼널 15px 보다 크게) */
  --lh-read: 1.78;
  --toc-w: 232px;
}

/* --------------------------------------------------- 레이아웃 */
.page {
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 0 var(--s5);
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s8);
  align-items: start;
}

@media (min-width: 1080px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) var(--toc-w); }
  .toc-rail { position: sticky; top: var(--s6); }
}

/* 본문은 흰 판 위에 올린다. 페이지 바탕(--surface)과 같은 색이면
   글이 어디서 시작하고 끝나는지 경계가 보이지 않는다. */
.article {
  max-width: var(--max-read);
  width: 100%;
  font-size: var(--fs-read);
  line-height: var(--lh-read);
  color: var(--fg-body);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 0 var(--s7) var(--s7);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

@media (max-width: 720px) {
  /* 좁은 화면에서는 좌우 여백이 아까우므로 판을 화면 폭까지 넓힌다 */
  .article {
    border-left: 0; border-right: 0; border-radius: 0;
    margin-left: calc(var(--s5) * -1); margin-right: calc(var(--s5) * -1);
    padding-left: var(--s5); padding-right: var(--s5);
  }
}

/* --------------------------------------------------- 글 머리 */
.article-head { padding: var(--s7) 0 var(--s6); border-bottom: 1px solid var(--line); }

.crumb {
  font-size: var(--fs-sm);
  color: var(--fg-mute);
  display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center;
  margin-bottom: var(--s4);
}
.crumb a { color: var(--fg-mute); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb .sep { opacity: .45; }

.article-head h1 {
  font-size: clamp(26px, 4.4vw, 36px);
  line-height: 1.32;
  letter-spacing: -.02em;
  color: var(--fg-strong);
  font-weight: 800;
  margin: 0 0 var(--s4);
  word-break: keep-all;   /* 한글 어절 단위 줄바꿈 */
}

.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5);
  font-size: var(--fs-sm); color: var(--fg-mute);
}
.article-meta .dot { opacity: .4; }

.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: var(--r-chip);
  background: var(--surface); color: var(--accent);
  font: inherit; font-size: var(--fs-xs); font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), transform .14s var(--ease);
}
.share-btn svg.i { width: 14px; height: 14px; }
.share-btn:hover { background: var(--tint); }
.share-btn:active { transform: translateY(1px); }

.share-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--fg-strong); color: #fff;
  padding: 10px 18px; border-radius: var(--r-chip);
  font-size: var(--fs-sm); font-weight: 600;
  box-shadow: var(--sh-lift);
  z-index: 999;
  animation: share-toast-in .18s var(--ease);
}
@keyframes share-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.lede {
  margin: var(--s6) 0 0;
  font-size: 18px;
  line-height: 1.72;
  color: var(--fg);
}

/* --------------------------------------------------- 목차 */
.toc {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--paper);
  padding: var(--s5);
}
.toc .toc-h {
  font-size: var(--fs-sm);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0 0 var(--s3);
  font-weight: 700;
}
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--s2);
  padding: var(--s2) 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--fg-body);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: var(--s3);
  margin-left: calc(var(--s3) * -1);
  transition: color .18s var(--ease), border-color .18s var(--ease);
  word-break: keep-all;
}
.toc a::before {
  content: counter(toc);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ph);
  font-size: var(--fs-xs);
  padding-top: 2px;
}
.toc a:hover { color: var(--accent); }
.toc a.on { color: var(--accent-deep); border-left-color: var(--accent); font-weight: 600; }
.toc a.on::before { color: var(--accent); }

/* 모바일에서는 접힌 채로 */
.toc-inline { margin: var(--s6) 0; }
.toc-inline summary {
  cursor: pointer; list-style: none;
  font-size: var(--fs-sm); font-weight: 700; color: var(--fg-strong);
  padding: var(--s4) var(--s5);
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--tint);
  display: flex; justify-content: space-between; align-items: center;
}
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::after { content: "＋"; color: var(--fg-mute); font-weight: 400; }
.toc-inline[open] summary::after { content: "－"; }
.toc-inline[open] summary { border-radius: var(--r-ctl) var(--r-ctl) 0 0; border-bottom: 0; }
.toc-inline .toc { border-radius: 0 0 var(--r-ctl) var(--r-ctl); }
.toc-inline .toc-h { display: none; }   /* summary 가 이미 "목차" 라 중복 */
@media (min-width: 1080px) { .toc-inline { display: none; } }
.toc-rail { display: none; }
@media (min-width: 1080px) { .toc-rail { display: block; } }

/* --------------------------------------------------- 본문 */
/* 상단 고정 헤더 높이만큼 띄운다 — 앵커로 이동했을 때 H2 가 가리지 않게 */
.article section { scroll-margin-top: 76px; }

.kicker {
  margin: var(--s8) 0 var(--s2);
  font-size: var(--fs-sm);
  color: var(--act-text);
  font-weight: 600;
  letter-spacing: -.01em;
}

.article h2 {
  font-size: clamp(21px, 3vw, 25px);
  line-height: 1.4;
  color: var(--fg-strong);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 var(--s5);
  padding-bottom: var(--s3);
  border-bottom: 2px solid var(--tint-strong);
  word-break: keep-all;
}

.article h3 {
  font-size: 18px;
  line-height: 1.5;
  color: var(--fg);
  font-weight: 700;
  margin: var(--s7) 0 var(--s3);
  word-break: keep-all;
}

.article p { margin: 0 0 var(--s5); word-break: keep-all; }
.article strong { color: var(--fg-strong); font-weight: 700; }

.article ul { margin: 0 0 var(--s5); padding-left: 0; list-style: none; }
.article ul li {
  position: relative;
  padding-left: var(--s5);
  margin-bottom: var(--s3);
  word-break: keep-all;
}
.article ul li::before {
  content: "";
  position: absolute; left: 4px; top: .72em;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  opacity: .55;
}

/* AEO — H2 직후 직답 한 줄. AI 가 인용해 갈 자리다. */
.answer {
  margin: 0 0 var(--s6);
  padding: var(--s4) var(--s5);
  border-left: 3px solid var(--act);
  background: var(--tint);
  border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
  font-size: 16px;
  line-height: 1.68;
  color: var(--fg);
  font-weight: 600;
  word-break: keep-all;
}

/* --------------------------------------------------- 표 */
.table-wrap {
  margin: 0 0 var(--s6);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  -webkit-overflow-scrolling: touch;
}
.article table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.article th, .article td {
  padding: var(--s3) var(--s4);
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  word-break: keep-all;
  vertical-align: top;
}
.article th {
  background: var(--tint);
  color: var(--fg-strong);
  font-weight: 700;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.article tbody tr:last-child td { border-bottom: 0; }
.article td:first-child { font-weight: 600; color: var(--fg); white-space: nowrap; }

/* --------------------------------------------------- 강조 박스 */
.box {
  margin: 0 0 var(--s6);
  padding: var(--s5);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--paper);
}
.box > .box-t {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-sm); font-weight: 700;
  letter-spacing: .02em;
  color: var(--fg-strong);
  margin-bottom: var(--s3);
}
.box > .box-t svg.i { width: 15px; height: 15px; }
.box p { margin: 0 0 var(--s2); font-size: var(--fs-body); line-height: 1.7; }
.box p:last-child { margin-bottom: 0; }
.box ul { margin: 0; }
.box ul li { font-size: var(--fs-body); margin-bottom: var(--s2); }

.box.check   { background: #FFF8E8; border-color: #F2DFAE; }
.box.check   > .box-t { color: #8A6100; }
.box.example { background: var(--tint); border-color: var(--tint-strong); }
.box.example > .box-t { color: var(--brand-navy); }
.box.core    { border-left: 3px solid var(--act); }
.box.core    > .box-t { color: var(--act-text); }
.box.related { background: var(--surface); }
.box.note    { background: var(--surface); border-style: dashed; }
.box.note p  { font-size: var(--fs-sm); color: var(--fg-mute); }

@media (prefers-color-scheme: dark) {
  .box.check { background: rgba(242, 223, 174, .09); border-color: rgba(242, 223, 174, .28); }
  .box.check > .box-t { color: #E8C87A; }
}

/* 관련 글 */
.box.related ul li { padding-left: 0; margin-bottom: var(--s3); }
.box.related ul li::before { display: none; }
.box.related a {
  display: flex; align-items: center; gap: var(--s2);
  color: var(--accent-deep); text-decoration: none; font-weight: 600;
  font-size: var(--fs-body);
}
.box.related a::before { content: "›"; color: var(--ph); font-weight: 400; }
.box.related a:hover { text-decoration: underline; }
.box.related .pending { color: var(--fg-mute); font-weight: 500; }
.box.related .pending::before { content: "·"; }

/* --------------------------------------------------- 이미지 */
.figure {
  margin: 0 0 var(--s6);
  border-radius: var(--r-card);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--ph-bg);
}
.figure img { display: block; width: 100%; height: auto; }
.figure figcaption {
  padding: var(--s3) var(--s4);
  font-size: var(--fs-xs);
  color: var(--fg-mute);
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
}
/* 아직 이미지가 없을 때 — 자리와 alt 를 보여준다 */
.figure.ph {
  display: grid; place-items: center;
  min-height: 168px;
  padding: var(--s6);
  text-align: center;
  border-style: dashed;
}
.figure.ph .t { font-size: var(--fs-sm); color: var(--fg-mute); font-weight: 600; }
.figure.ph .a { font-size: var(--fs-xs); color: var(--ph); margin-top: var(--s2); }

/* --------------------------------------------------- FAQ */
.faq { margin: var(--s8) 0 0; }
.faq > h2 {
  font-size: 21px; color: var(--fg-strong); font-weight: 800;
  margin: 0 0 var(--s5); padding-bottom: var(--s3);
  border-bottom: 2px solid var(--tint-strong);
}
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  margin-bottom: var(--s3);
  background: var(--paper);
  overflow: hidden;
}
.faq summary {
  cursor: pointer; list-style: none;
  padding: var(--s4) var(--s5);
  font-weight: 700; font-size: var(--fs-body); color: var(--fg-strong);
  display: flex; gap: var(--s3); align-items: flex-start;
  word-break: keep-all;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "Q"; flex: none;
  color: var(--accent); font-weight: 800; font-size: var(--fs-sm);
  padding-top: 1px;
}
.faq details[open] summary { background: var(--tint); }
.faq .a {
  padding: var(--s4) var(--s5) var(--s5);
  font-size: var(--fs-body); line-height: 1.7; color: var(--fg-body);
  display: grid; grid-template-columns: 14px 1fr; gap: var(--s3);
  word-break: keep-all;
}
.faq .a::before { content: "A"; color: var(--act-text); font-weight: 800; font-size: var(--fs-sm); }

/* --------------------------------------------------- 해시태그 */
.tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s7) 0 0; }
.tags span {
  font-size: var(--fs-xs);
  color: var(--fg-mute);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-chip);
  padding: 5px var(--s3);
}

/* --------------------------------------------------- 용어 팝오버 */
.term {
  border-bottom: 1px dashed var(--accent);
  cursor: pointer;
  color: inherit;
  padding-bottom: 1px;
}
.term:hover { background: var(--tint); }

.pop {
  position: absolute;
  z-index: 60;
  width: 246px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  box-shadow: var(--sh-lift);
  padding: var(--s3);
  font-size: var(--fs-sm);
}
.pop .pop-t {
  font-weight: 700; color: var(--fg-strong);
  padding: 0 var(--s2) var(--s2);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: var(--s2);
  display: flex; justify-content: space-between; align-items: center;
}
.pop .pop-x {
  border: 0; background: none; cursor: pointer;
  color: var(--fg-mute); font-size: 15px; line-height: 1; padding: 2px 4px;
}
.pop a {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s2) var(--s2);
  border-radius: 8px;
  color: var(--fg-body); text-decoration: none;
  font-size: var(--fs-sm);
}
.pop a:hover { background: var(--tint); color: var(--accent-deep); }
.pop a .go { color: var(--ph); }

/* --------------------------------------------------- 글 바닥 */
.article-foot { margin: var(--s8) 0 0; padding-top: var(--s6); border-top: 1px solid var(--line); }

.pager { display: grid; gap: var(--s3); margin: var(--s7) 0 0; }
@media (min-width: 720px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a {
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: var(--s4) var(--s5);
  text-decoration: none; background: var(--paper);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.pager a:hover { border-color: var(--accent); transform: translateY(-1px); }
.pager .d { font-size: var(--fs-xs); color: var(--fg-mute); margin-bottom: 4px; }
.pager .t { font-size: var(--fs-sm); color: var(--fg-strong); font-weight: 600; line-height: 1.5; word-break: keep-all; }
.pager .next { text-align: right; }

/* --------------------------------------------------- 목록 쪽 나눔 */
.pagenav {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--s2); margin: var(--s7) 0 var(--s6);
}
.pn {
  display: grid; place-items: center;
  min-width: 38px; height: 38px; padding: 0 var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--paper); color: var(--fg);
  font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; font-variant-numeric: tabular-nums;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
a.pn:hover { border-color: var(--accent); background: var(--tint); }
.pn.on { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
.pn.gap { border: 0; background: none; color: var(--ph); min-width: 20px; }
.pn.ar { font-weight: 500; color: var(--fg-mute); }

@media (max-width: 560px) {
  .pn { min-width: 34px; height: 34px; padding: 0 var(--s2); font-size: var(--fs-xs); }
}

/* --------------------------------------------------- 목록 / 홈 카드 */
.post-grid { display: grid; gap: var(--s4); margin: var(--s6) 0; }
@media (min-width: 720px)  { .post-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card {
  display: flex; flex-direction: column; gap: var(--s2);
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: var(--s5); background: var(--paper);
  text-decoration: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.post-card:hover { border-color: var(--accent); box-shadow: var(--sh-lift); transform: translateY(-2px); }
.post-card .post-cat {
  font-size: var(--fs-xs); color: var(--act-text); font-weight: 700;
  letter-spacing: .02em;
}
.post-card h3 {
  font-size: var(--fs-h3); line-height: 1.5; color: var(--fg-strong);
  font-weight: 700; margin: 0; word-break: keep-all;
}
.post-card p {
  font-size: var(--fs-sm); color: var(--fg-mute); line-height: 1.62;
  margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.group-title {
  display: flex; align-items: baseline; gap: var(--s3);
  margin: var(--s8) 0 var(--s4);
}
.group-title h2 { font-size: 20px; color: var(--fg-strong); font-weight: 800; margin: 0; }
.group-title .n { font-size: var(--fs-sm); color: var(--fg-mute); }

/* --------------------------------------------------- 인쇄 */
@media print {
  .site-header, .toc-rail, .toc-inline, .pager, .pop, .ad-zone { display: none !important; }
  .article { max-width: 100%; font-size: 11pt; }
  .figure.ph { display: none; }
}

/* --------------------------------------------------- 광고 자리
   높이를 미리 잡아 광고가 들어올 때 본문이 밀리지 않게 한다(CLS).
   미설정이면 app.js 가 이 요소를 지우므로 빈 칸이 남지 않는다. */
.ad-zone { margin: var(--s7) 0; padding: 0; }
.ad-zone.live { min-height: 100px; }
.ad-zone.in-article.live { min-height: 280px; }
.ad-zone::before {
  content: "광고";
  display: block;
  font-size: var(--fs-xs);
  color: var(--ph);
  letter-spacing: .08em;
  margin-bottom: var(--s2);
  text-align: left;
}
.ad-zone ins { width: 100%; }
@media print { .ad-zone { display: none !important; } }

/* 자리 표시 박스 — 게시자 ID 를 넣기 전에 위치를 눈으로 확인하려고 둔다.
   app.js 가 로컬에서 열었을 때만 .ph 를 붙이므로 배포본에는 나가지 않는다.
   높이는 실제 광고가 잡을 높이(.live)와 같게 두어, 켠 뒤에 본문이 밀리지 않는다. */
.ad-zone.ph {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background:
    linear-gradient(to top right, transparent calc(50% - .5px),
      var(--line-soft) calc(50% - .5px), var(--line-soft) calc(50% + .5px),
      transparent calc(50% + .5px)),
    linear-gradient(to bottom right, transparent calc(50% - .5px),
      var(--line-soft) calc(50% - .5px), var(--line-soft) calc(50% + .5px),
      transparent calc(50% + .5px));
}
.ad-zone.ph::before { display: none; }
.ad-zone.ph::after {
  content: attr(data-label);
  background: var(--paper);
  color: var(--ph);
  font-size: var(--fs-xs);
  letter-spacing: .04em;
  padding: 5px 12px;
  border-radius: var(--r-chip);
  border: 1px solid var(--line-soft);
}

/* --------------------------------------------------- 메인 검색 */
.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;
}

.search { position: relative; margin: var(--s6) auto var(--s7); max-width: var(--max-read); }
.search input {
  width: 100%;
  padding: var(--s4) var(--s5);
  font-size: 16px;               /* 16px 미만이면 모바일에서 화면이 확대된다 */
  font-family: inherit;
  color: var(--fg);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-appearance: none;
}
.search input::placeholder { color: var(--ph); }
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--tint-strong);
}

.search-out {
  margin-top: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--paper);
  overflow: hidden;
}
.search-out .hit {
  display: block;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
}
.search-out .hit:last-child { border-bottom: 0; }
.search-out .hit:hover { background: var(--tint); }
.search-out .hit .c {
  font-size: var(--fs-xs); color: var(--act-text); font-weight: 700;
}
.search-out .hit .t {
  font-size: var(--fs-body); color: var(--fg-strong); font-weight: 700;
  line-height: 1.5; margin-top: 2px; word-break: keep-all;
}
.search-out .hit .g {
  font-size: var(--fs-xs); color: var(--fg-mute); margin-top: 4px;
}
.search-out mark {
  background: #FFF1B8; color: inherit; padding: 0 1px; border-radius: 2px;
}
@media (prefers-color-scheme: dark) {
  .search-out mark { background: rgba(255, 241, 184, .22); color: var(--fg); }
}
.search-out .none {
  padding: var(--s5); text-align: center;
  font-size: var(--fs-sm); color: var(--fg-mute);
}

/* 검색창 아래 인기 키워드 */
.hot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  margin-top: var(--s3);
}
.hot-l {
  font-size: var(--fs-xs); color: var(--fg-mute); margin-right: var(--s1);
}
.chip {
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--fg-body);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  padding: 5px var(--s3);
  cursor: pointer;
  transition: border-color .16s var(--ease), color .16s var(--ease),
              background .16s var(--ease);
}
.chip:hover, .chip:focus-visible {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: var(--tint);
  outline: none;
}

/* --------------------------------------------------- 보기 전환 */
/* 홈에서는 첫 그룹 제목 위에 오므로 아래 여백을 줄인다 */
.view-bar { display: flex; justify-content: flex-end; margin: var(--s5) 0 0; }
.view-bar + .group-title { margin-top: var(--s4); }

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--paper);
  overflow: hidden;
}
.view-switch .vb {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: var(--fs-sm); font-weight: 600;
  color: var(--fg-mute);
  background: none; border: 0; cursor: pointer;
  padding: 7px var(--s4);
  transition: color .16s var(--ease), background .16s var(--ease);
}
.view-switch .vb + .vb { border-left: 1px solid var(--line); }
.view-switch .vb svg { width: 13px; height: 13px; fill: currentColor; }
.view-switch .vb:hover { color: var(--fg); }
.view-switch .vb[aria-pressed="true"] {
  color: var(--accent-deep);
  background: var(--tint);
}

/* 리스트형 — 한 줄에 [분류] [제목] [›].
   카드마다 테두리를 두지 않고 목록 전체를 하나의 판으로 감싼다. 카드형에서는
   테두리가 흰 바탕을 잡아 주는데, 리스트에서 그걸 없애 놓으니 제목만 덩그러니
   떠 보였다. 판으로 감싸고, 분류 칸의 고정 폭을 없애고, 행 높이를 줄인다.
   요약을 옆에 붙이는 안은 버렸다 — 제목이 32~45자라 요약보다 제목이 먼저 잘린다. */
/* 목록일 때는 페이지 단 전체를 좁혀 가운데로 놓는다.
   카드형은 3단이라 1180px 를 다 쓰지만, 리스트는 한 줄에 제목 하나뿐이라
   그 폭이면 제목 오른쪽 350px 가 통째로 흰 여백이 된다.
   가장 긴 제목(45자 ≈ 675px) 기준 900px. 판만 가운데로 옮기면 위의 제목·검색창과
   왼쪽 선이 어긋나므로 .page 를 통째로 옮긴다. 안의 글은 왼쪽 정렬 그대로다. */
body.view-list .page { max-width: 900px; }

.post-grid.as-list {
  grid-template-columns: 1fr;
  gap: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.post-grid.as-list .post-card {
  display: grid;
  /* 분류 칸을 78px 로 고정해 두니 두 글자 칩 옆이 통째로 비었다. 내용에 맞춘다. */
  grid-template-columns: auto minmax(0, 1fr) 14px;
  align-items: center;
  gap: var(--s3);
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  padding: var(--s3) var(--s4);
  box-shadow: none;
}
.post-grid.as-list .post-card:first-child { border-top: 0; }
.post-grid.as-list .post-card:hover {
  transform: none; box-shadow: none; background: var(--tint);
}
.post-grid.as-list .post-cat {
  justify-self: start;
  font-size: var(--fs-xs);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-chip);
  padding: 3px 9px;
}
.post-grid.as-list .post-card h3 {
  font-size: var(--fs-body);
  line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-grid.as-list .post-card p { display: none; }
.post-grid.as-list .post-card::after {
  content: "›"; color: var(--ph); font-size: 17px; line-height: 1;
}

@media (max-width: 560px) {
  .post-grid.as-list .post-card { grid-template-columns: 1fr 14px; }
  .post-grid.as-list .post-cat { grid-column: 1 / -1; }
}

/* ===========================================================
   모바일 — 손가락으로 쓰는 화면
   PC 레이아웃은 그대로 두고, 좁은 화면에서만 손본다.
   =========================================================== */

/* 탭했을 때 파란 사각형이 번쩍이지 않게 */
@media (pointer: coarse) {
  a, button, .chip, .term, .pn { -webkit-tap-highlight-color: transparent; }
}

@media (max-width: 720px) {
  /* --- 터치 타깃 ------------------------------------------------
     기존 칩 25px · 페이저 34px 은 손가락으로 누르기에 작다.
     애플·구글 권장은 44px 이다. 글자 크기는 그대로 두고 높이만 키운다. */
  .chip {
    min-height: 40px;
    padding: 0 var(--s4);
    display: inline-flex; align-items: center;
  }
  .hot { gap: var(--s2); }

  .pn { min-width: 44px; height: 44px; }
  .pagenav { gap: 6px; }

  .view-switch .vb { min-height: 40px; padding: 0 var(--s4); }

  /* 용어는 줄 안에 있어 높이를 못 키운다. 대신 눌리는 영역을 넓힌다. */
  .term { padding: 3px 2px; margin: -3px -2px; }

  /* --- 본문 여백 ------------------------------------------------ */
  .article { padding-top: 0; }
  .figure { margin-bottom: var(--s5); }
  .table-wrap { margin-bottom: var(--s5); }

  /* 표가 잘린다는 것을 눈으로 알린다 */
  .table-wrap::after {
    content: "← 옆으로 밀어서 보세요";
    display: block; padding: 6px var(--s3);
    font-size: var(--fs-xs); color: var(--ph);
    border-top: 1px dashed var(--line-soft);
  }
}

@media (max-width: 560px) {
  /* --- 용어 팝오버를 바텀시트로 --------------------------------
     246px 고정 팝오버는 좁은 화면에서 답답하고 본문을 가린다.
     아래에서 올라오는 시트로 바꾼다. JS 가 넣는 인라인 좌표를 덮어야 해서
     !important 를 쓴다. */
  .pop {
    position: fixed !important;
    left: 0 !important; right: 0 !important;
    top: auto !important; bottom: 0 !important;
    width: auto !important;
    border-radius: 18px 18px 0 0;
    padding: var(--s4) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
    /* 화면 전체를 덮는 어두운 배경 — 요소를 더 만들지 않고 그림자로 만든다 */
    box-shadow: 0 0 0 100vmax rgba(11, 45, 107, .38);
  }
  .pop .pop-t {
    font-size: var(--fs-body);
    padding-bottom: var(--s3);
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: var(--s2);
  }
  .pop a { min-height: 48px; display: flex; align-items: center; }
}

/* 맨 위로 — 긴 글에서 헤더까지 스크롤해 올라가지 않게.
   화면을 가리지 않도록 작게, 오른쪽 아래에. 홈바 영역을 피한다. */
.to-top {
  position: fixed; z-index: 40;
  right: max(var(--s4), env(safe-area-inset-right));
  bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  color: var(--fg-strong); font-size: 17px; line-height: 1;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .14);
  cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }

/* 넓은 화면에는 목차 레일이 있어 필요 없다 */
@media (min-width: 1080px) { .to-top { display: none; } }
@media print { .to-top { display: none !important; } }
