/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Noto Sans KR', sans-serif; color: #333; background: #fff; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ===== Variables ===== */
:root {
  --bg: #ffffff;
  --bg2: #f8f9fa;
  --bg3: #eaecf0;
  --surface: #f8f9fa;
  --heading: #1a1a1a;
  --text: #444;
  --text-dim: #888;
  --link: #0b60c5;
  --link-hover: #0645ad;
  --link-visited: #6b3fa0;
  --border: #e0e0e0;
  --border-light: #c8ccd1;
  --accent: #3366cc;
  --max-w: 1100px;
  --sidebar-w: 200px;
}

/* ===== Common ===== */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* =========================================
   HEADER (공통)
   ========================================= */
header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 46px;
}

/* 로고 */
.logo { font-size: .88rem; font-weight: 800; color: var(--heading); letter-spacing: -.3px; flex-shrink: 0; display: flex; align-items: baseline; gap: 6px; }
.logo-sub { font-family: 'Caveat', cursive; font-size: .85rem; font-weight: 500; color: #777; letter-spacing: 0; }
.logo-icon { margin-right: 4px; }
.logo-text { font-size: .88rem; font-weight: 800; color: var(--heading); }

/* 헤더 검색 (index.html) */
.header-search { flex: 1; max-width: 280px; margin-left: auto; }
.header-search input {
  width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: .8rem;
  font-family: inherit;
  background: #fff;
  color: var(--heading);
  transition: border-color .2s;
}
.header-search input:focus { outline: none; border-color: var(--accent); }
.header-search input::placeholder { color: var(--text-dim); }

/* 헤더 네비 (sub pages) */
header nav { display: flex; gap: 4px; margin-left: auto; }
.nav-tab {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 3px;
  transition: all .15s;
}
.nav-tab:hover { color: var(--heading); background: rgba(0,0,0,.04); }

/* =========================================
   WIKI LAYOUT (index.html — MediaWiki 스타일)
   ========================================= */
.wiki-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  min-height: calc(100vh - 46px);
}

/* --- 사이드바 --- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 46px;
  height: calc(100vh - 46px);
  overflow-y: auto;
}
.sidebar-section { padding: 0 0 12px; }
.sidebar-title {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 14px 4px;
}
.sidebar ul { padding: 0; }
.sidebar li a {
  display: block;
  padding: 4px 14px 4px 18px;
  font-size: .8rem;
  color: var(--text);
  border-left: 2px solid transparent;
  transition: all .12s;
}
.sidebar li a:hover {
  color: var(--link);
  background: rgba(51,102,204,.06);
  border-left-color: var(--link);
}
.sidebar li a.active {
  color: var(--link);
  font-weight: 600;
  border-left-color: var(--link);
  background: rgba(51,102,204,.08);
}

/* --- 본문 --- */
.content {
  flex: 1;
  min-width: 0;
  padding: 20px 28px 40px;
  background: var(--bg);
}

/* 페이지 제목 */
.page-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--heading);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
  letter-spacing: -.5px;
}

/* 환영 안내 박스 */
.wiki-notice {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 14px 16px;
  font-size: .84rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 20px;
}
.wiki-notice strong { color: var(--heading); }

/* 목차 박스 */
.toc {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 24px;
  display: inline-block;
  min-width: 200px;
}
.toc-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.toc ol { counter-reset: toc; padding-left: 0; }
.toc li { counter-increment: toc; margin-bottom: 3px; }
.toc li a {
  color: var(--link);
  font-size: .82rem;
  transition: color .12s;
}
.toc li a::before {
  content: counter(toc) " ";
  color: var(--text-dim);
  font-weight: 600;
}
.toc li a:hover { text-decoration: underline; }

/* 본문 h2 */
.content h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--heading);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  margin: 28px 0 12px;
}

/* 본문 h3 */
.content h3 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--heading);
  margin: 16px 0 6px;
}

/* 본문 p */
.content > p, .content section > p {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 8px;
}
.content p a { color: var(--link); }
.content p a:hover { text-decoration: underline; }

/* 본문 ul */
.content > ul, .content section > ul {
  margin: 8px 0 16px;
  padding-left: 0;
}
.content > ul li, .content section > ul li {
  font-size: .84rem;
  color: var(--text);
  padding: 2px 0 2px 16px;
  position: relative;
  line-height: 1.7;
}
.content > ul li::before, .content section > ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 11px;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.content > ul li a, .content section > ul li a { color: var(--link); }
.content > ul li a:hover, .content section > ul li a:hover { text-decoration: underline; }

/* 위키 테이블 */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  margin: 12px 0 20px;
  border: 1px solid var(--border);
}
.wiki-table thead th {
  background: var(--bg3);
  color: var(--heading);
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--border);
}
.wiki-table tbody td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  line-height: 1.6;
}
.wiki-table tbody td a { color: var(--link); }
.wiki-table tbody td a:hover { text-decoration: underline; }
.wiki-table tbody tr:hover { background: rgba(0,0,0,.02); }

/* =========================================
   FOOTER (공통)
   ========================================= */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
}
.footer-inner, .footer-copy {
  font-size: .72rem;
  color: var(--text-dim);
}

/* =========================================
   SUB PAGES (개별 문서 페이지)
   ========================================= */

/* 페이지 히어로 */
.wiki-page-hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 20px 0;
}
.wiki-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--link);
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: 10px;
  transition: color .12s;
}
.wiki-back:hover { color: var(--link-hover); text-decoration: underline; }
.wiki-page-hero h1 {
  color: var(--heading);
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 6px;
  letter-spacing: -.5px;
}
.wiki-page-hero .wiki-page-desc {
  color: var(--text);
  font-size: .84rem;
  line-height: 1.6;
}

/* 서브페이지 TOC */
.wiki-toc {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin: 14px 0;
  display: inline-block;
  min-width: 200px;
}
.wiki-toc-title {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.wiki-toc ol { counter-reset: toc; padding-left: 0; }
.wiki-toc li { counter-increment: toc; margin-bottom: 3px; }
.wiki-toc li a {
  color: var(--link);
  font-size: .82rem;
  display: flex;
  gap: 4px;
  transition: color .12s;
}
.wiki-toc li a::before {
  content: counter(toc) ".";
  color: var(--text-dim);
  font-weight: 600;
  flex-shrink: 0;
}
.wiki-toc li a:hover { text-decoration: underline; }

/* 섹션 */
.wiki-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 20px;
  border-top: 1px solid var(--border);
}
.wiki-section:first-of-type { border-top: none; }
.wiki-section h2 {
  color: var(--heading);
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.wiki-section h3 {
  color: var(--heading);
  font-size: .9rem;
  font-weight: 700;
  margin: 14px 0 6px;
}
.wiki-section p {
  color: var(--text);
  font-size: .85rem;
  line-height: 1.8;
  margin-bottom: 8px;
}
.wiki-section ul { margin: 8px 0; padding-left: 0; }
.wiki-section li {
  color: var(--text);
  font-size: .85rem;
  line-height: 1.8;
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
}
.wiki-section li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.wiki-section li strong { color: var(--heading); }
.wiki-section a { color: var(--link); }
.wiki-section a:hover { text-decoration: underline; }

/* 정보 박스 */
.wiki-info {
  background: #f0f6ff;
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin: 12px 0;
}
.wiki-info p { margin: 0; font-size: .82rem; color: var(--text); line-height: 1.7; }
.wiki-info strong { color: var(--heading); }

/* 인포박스 (우측 요약 카드) */
.wiki-infobox {
  float: right;
  width: 260px;
  margin: 0 0 16px 20px;
  border: 1px solid var(--border);
  background: var(--bg2);
  font-size: .82rem;
}
.wiki-infobox-title {
  background: var(--accent);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
  padding: 8px 12px;
}
.wiki-infobox-image {
  text-align: center;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.wiki-infobox-image img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}
.wiki-infobox-caption {
  font-size: .72rem;
  color: var(--text-dim);
  text-align: center;
  padding: 4px 10px 8px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.wiki-infobox table {
  width: 100%;
  border-collapse: collapse;
}
.wiki-infobox th {
  text-align: left;
  padding: 6px 10px;
  color: var(--heading);
  font-weight: 600;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  width: 35%;
  vertical-align: top;
  font-size: .78rem;
}
.wiki-infobox td {
  padding: 6px 10px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}
.wiki-infobox a { color: var(--link); }
.wiki-infobox a:hover { text-decoration: underline; }

/* 다이어그램/이미지 */
.wiki-figure {
  margin: 16px 0;
  text-align: center;
}
.wiki-figure img {
  max-width: 100%;
  height: auto;
}

/* 비교 테이블 */
.wiki-compare { margin: 12px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wiki-compare table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  border: 1px solid var(--border);
}
.wiki-compare th {
  background: var(--bg3);
  color: var(--heading);
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.wiki-compare td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}
.wiki-compare .compare-label { color: var(--heading); font-weight: 600; white-space: nowrap; }

/* 작업 과정 스텝 */
.wiki-steps { margin: 12px 0; }
.wiki-step { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-start; }
.wiki-step-num {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: .7rem;
  border-radius: 50%;
}
.wiki-step-content strong { display: block; color: var(--heading); font-size: .86rem; margin-bottom: 2px; }
.wiki-step-content p { margin: 0; font-size: .8rem; color: var(--text); line-height: 1.6; }

/* 비용 가이드 */
.wiki-cost { margin: 12px 0; }
.wiki-cost-item {
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wiki-cost-item:last-of-type { border-bottom: none; }
.wiki-cost-item .cost-label { font-size: .85rem; color: var(--heading); font-weight: 600; }
.wiki-cost-item .cost-range { font-size: .85rem; color: var(--accent); font-weight: 700; }
.wiki-cost-note { font-size: .72rem; color: var(--text-dim); margin-top: 6px; line-height: 1.5; }

/* FAQ */
.wiki-faq-list { display: flex; flex-direction: column; }
.wiki-faq-item { border-bottom: 1px solid var(--border); }
.wiki-faq-item:last-child { border-bottom: none; }
.wiki-faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  cursor: pointer;
  font-weight: 700;
  font-size: .85rem;
  color: var(--heading);
  transition: color .12s;
}
.wiki-faq-q:hover { color: var(--link); }
.wiki-faq-q span { font-size: .8rem; color: var(--text-dim); transition: transform .3s; }
.wiki-faq-item.open .wiki-faq-q span { transform: rotate(180deg); }
.wiki-faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.wiki-faq-a-inner { padding: 0 0 12px; color: var(--text); line-height: 1.7; font-size: .82rem; }

/* 관련 문서 */
.wiki-related { padding: 20px 20px; max-width: var(--max-w); margin: 0 auto; }
.wiki-related h2 { color: var(--heading); font-size: .9rem; font-weight: 700; margin-bottom: 8px; }
.wiki-related-grid { display: flex; flex-wrap: wrap; gap: 0; }
.wiki-related-link {
  font-size: .82rem;
  color: var(--link);
  font-weight: 500;
  padding: 2px 0;
  transition: color .12s;
}
.wiki-related-link:hover { text-decoration: underline; }
.wiki-related-link::after { content: " · "; color: var(--text-dim); }
.wiki-related-link:last-child::after { content: ""; }

/* 서브페이지 설명 (page-title 아래) */
.page-desc {
  font-size: .84rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* 본문 내부 섹션 간격 */
.content > section + section { margin-top: 28px; }
.content li strong { color: var(--heading); }

/* =========================================
   MOBILE
   ========================================= */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 16px 16px 32px; }
  .page-title { font-size: 1.25rem; }
  .toc, .wiki-toc { display: block; }
  .wiki-page-hero { padding: 16px 16px 0; }
  .wiki-page-hero h1 { font-size: 1.25rem; }
  .wiki-section { padding: 20px 16px; }
  .wiki-related { padding: 16px; }
  .wiki-table { font-size: .78rem; }
  .wiki-table thead th, .wiki-table tbody td { padding: 6px 8px; }
  .wiki-infobox { float: none; width: 100%; margin: 0 0 16px; }
}

/* =========================================
   DESKTOP
   ========================================= */
@media (min-width: 769px) {
  .sidebar { display: block; }
  .page-title { font-size: 1.6rem; }
  .content h2 { font-size: 1.2rem; }
  .wiki-page-hero h1 { font-size: 1.6rem; }
  .wiki-section h2 { font-size: 1.2rem; }
}
