/* 사용법 화면. 머리줄은 style.css 것을 그대로 쓰고, 본문만 여기서 꾸민다.
   style.css의 body는 지도 화면용(높이 100vh, flex)이라 이 화면에서는 풀어 준다. */

body.guide {
  height: auto;
  min-height: 100vh;
  display: block;
}

/* 길어서 내려가도 다른 화면으로 가는 길이 보이게 한다 */
body.guide header {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* 머리줄의 이름이 링크다(도면 화면으로) */
body.guide header a.brand { color: inherit; }

.guide main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px 96px;
  line-height: 1.7;
  font-size: 15px;
}

.guide h1 { font-size: 28px; line-height: 1.3; margin-bottom: 12px; }
.guide .lead { font-size: 17px; color: #3a3a36; margin-bottom: 24px; }

.guide h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  margin: 0 0 14px;
  padding-top: 8px;
  scroll-margin-top: 64px;
}
.guide h3 { font-size: 16px; margin: 24px 0 8px; }

/* 장은 하나씩 보이거나(스크립트가 있을 때), 이어서 보인다(없을 때) */
.guide section { margin-bottom: 8px; scroll-margin-top: 64px; }
.guide h3, .guide figure { scroll-margin-top: 64px; }
.guide section + section { margin-top: 40px; padding-top: 28px; border-top: 1px solid #d4d2cb; }
.guide.js section + section { margin-top: 0; padding-top: 0; border-top: 0; }
.guide [hidden] { display: none !important; }

.guide p, .guide ul, .guide ol, .guide table, .guide pre { margin-bottom: 12px; }
.guide ul, .guide ol { padding-left: 22px; }
.guide li { margin-bottom: 4px; }
.guide a { color: #2c5a26; }

/* 일러스트는 폭이 넓어서 칸을 가득 채운다 */
.guide img.wide {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 16px;
}

.guide .note {
  background: #fff;
  border-left: 4px solid #3d6b35;
  padding: 10px 14px;
  margin: 24px 0;
  border-radius: 0 6px 6px 0;
}

.guide code {
  background: #ebe9e1;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.92em;
}
.guide pre {
  background: #fff;
  border: 1px solid #d4d2cb;
  border-radius: 6px;
  padding: 10px 14px;
  overflow-x: auto;
}

.guide table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #d4d2cb;
  font-size: 14px;
}
.guide th, .guide td {
  text-align: left;
  vertical-align: top;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e0d9;
}
.guide th { background: #ebe9e1; font-weight: 600; }
.guide tr:last-child td { border-bottom: 0; }

.guide figure { margin: 16px 0; }
.guide figure img { display: block; width: 100%; height: auto; border: 1px solid #d4d2cb; border-radius: 6px; background: #fff; }
.guide figcaption { font-size: 13px; color: #57564f; margin-top: 6px; line-height: 1.5; }

.guide .pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.guide .small { font-size: 13px; color: #57564f; }

/* 휴대폰: 사진 둘을 위아래로, 표는 가로로 밀리지 않게 */
@media (max-width: 640px) {
  /* 머리줄이 한 줄에 안 들어가므로 줄을 바꾼다. 앱 화면은 데스크톱용이라 그대로 둔다 */
  body.guide header { flex-wrap: wrap; row-gap: 6px; }
  body.guide header span.tagline { display: none; }
  body.guide header .links { margin-left: 0; flex-wrap: wrap; gap: 6px 14px; }
  /* 탭이 머리줄 높이를 채우는 것은 한 줄일 때만이다. 줄이 바뀌면 여백 없이 제 높이로 */
  body.guide header nav.screens { margin: 0; align-self: auto; }
  body.guide header nav.screens a { padding: 6px 12px; border-radius: 6px; }
  .guide main { padding: 24px 16px 72px; }
  .guide h1 { font-size: 23px; }
  .guide .pair { grid-template-columns: 1fr; }
  .guide table { display: block; overflow-x: auto; }
}

/* ── 목차(처음 화면) ── */
.guide #guide-home { max-width: 860px; margin: 0 auto; }

.guide .toc-title { font-size: 22px; margin: 36px 0 14px; }

.guide .contents { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid #d4d2cb; border-radius: 10px; }
.guide .contents > li { padding: 14px 18px; border-bottom: 1px solid #e2e0d9; margin: 0; }
.guide .contents > li:last-child { border-bottom: 0; }

.guide .no {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3d6b35;
  color: #f5f5f0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.guide .chap {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #1a1a1a;
  text-decoration: none;
}
.guide .chap .txt { display: flex; flex-direction: column; }
.guide .chap b { font-size: 17px; }
.guide .chap .txt span { font-size: 13.5px; color: #57564f; }
.guide .chap:hover b { color: #2c5a26; text-decoration: underline; }

.guide .subs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 8px 0 0 42px;
  margin: 0;
}
.guide .subs a {
  display: inline-block;
  font-size: 13px;
  color: #3a3a36;
  background: #f0eee6;
  border-radius: 999px;
  padding: 1px 11px;
  text-decoration: none;
}
.guide .subs a:hover { background: #dfe9db; color: #2c5a26; }

/* ── 읽는 화면: 왼쪽 목차 + 본문 ── */
.guide .reader { display: flex; align-items: flex-start; gap: 36px; }
.guide .reader[hidden] { display: none; }
.guide .reader article { flex: 1; min-width: 0; }

.guide .side {
  position: sticky;
  top: 72px;
  width: 210px;
  flex-shrink: 0;
  font-size: 14px;
}
.guide .side .home { display: inline-block; margin-bottom: 10px; color: #57564f; text-decoration: none; }
.guide .side .home:hover { color: #2c5a26; text-decoration: underline; }
.guide .side ol { list-style: none; padding: 0; margin: 0; }
.guide .side li { margin: 0; }
.guide .side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #1a1a1a;
  text-decoration: none;
}
.guide .side a:hover { background: #ebe9e1; }
.guide .side a[aria-current] { background: #dfe9db; font-weight: 700; }
.guide .side .no { width: 22px; height: 22px; font-size: 12px; }

/* 이전 · 다음 */
.guide .pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #d4d2cb;
}
.guide .pager a {
  display: flex;
  flex-direction: column;
  max-width: 48%;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #d4d2cb;
  border-radius: 10px;
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 700;
}
.guide .pager a small { font-size: 12px; font-weight: 400; color: #57564f; }
.guide .pager a:hover { border-color: #3d6b35; }
.guide .pager .next { margin-left: auto; text-align: right; }

/* 좁은 화면: 옆 목차는 접고, 위의 '← 처음으로'와 아래의 이전·다음으로 다닌다 */
@media (max-width: 860px) {
  .guide .reader { display: block; }
  .guide .side { position: static; width: auto; margin-bottom: 16px; }
  .guide .side ol { display: none; }
}
