/* =========================================================
   우리반 백과 - style.css (기본 제공)
   1. 색 값은 모두 아래 :root 안에 모아 두었다.
   2. 크기는 rem 단위로 적었다.
   ========================================================= */

/* ---------- 색과 크기 값 모음 (CSS 변수) ---------- */
/* style.css 에서 내 취향에 맞게 색상 코드(#000000)를 변경해 보세요! */
:root {
  --bg: #f7f9fc;          /* 배경색 */
  --text: #172033;        /* 기본 글자색 */
  --sub-text: #667085;    /* 부가 설명 글자색 */
  --link: #3b6ea8;        /* 링크 색상 */
  --link-visited: #7657a6;/* 방문한 링크 색상 */
  --border: #98a6b8;      /* 굵은 테두리 색상 */
  --line: #d5dce5;        /* 얇은 선 색상 */
  --box-bg: #eef3f8;      /* 정보 상자 배경색 */
  --box-head: #c9d9e8;    /* 정보 상자 제목 배경색 */


  --font-scale: 1; /* [추가] 글자 크기 기본 배율 */
  --content-max: 1200px;
}
/* 다크 모드 색상 변수 */
html[data-theme="dark"] {
  --bg: #101418;
  --text: #eaecf0;
  --sub-text: #a2a9b1;
  --link: #8ab4f8;
  --link-visited: #c5a3e0;
  --border: #54595d;
  --line: #3a4048;
  --box-bg: #1b2027;
  --box-head: #2a3a55;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #101418;
    --text: #eaecf0;
    --sub-text: #a2a9b1;
    --link: #8ab4f8;
    --link-visited: #c5a3e0;
    --border: #54595d;
    --line: #3a4048;
    --box-bg: #1b2027;
    --box-head: #2a3a55;
  }
}

/* :root 바로 아래에 속성 선택자 규칙 추가 */
html[data-fontsize="small"] { --font-scale: 0.875; }
html[data-fontsize="large"] { --font-scale: 1.25; }

/* html 태그 글자 크기 수정 */
/* 바꾸기 전: font-size: 16px; */

html {
  font-size: calc(16px * var(--font-scale));
  scroll-behavior: smooth;
}

/* ---------- 문서 전체 ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "맑은 고딕", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  font-size: 0.875rem;
  line-height: 1.75;
}

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }
a:focus-visible,
input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---------- 맨 위 머리글 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.logo {
  width: 46px; height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: serif; font-size: 1.5rem;
  color: var(--sub-text);
}
.sitename strong {
  display: block;
  font-family: serif; font-weight: 400;
  font-size: 1.5rem; letter-spacing: 0.15em;
}
.sitename span { font-size: 0.75rem; color: var(--sub-text); }
html[data-width="wide"] { --content-max: 100%; }
/* ---------- 전체 배치 (그리드) ---------- */
.wrap {
  max-width: var(--content-max);
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 200px;
  gap: 2rem;
  align-items: start;
}

/* ---------- 왼쪽 목차 ---------- */
.toc { position: sticky; top: 1rem; font-size: 0.8125rem; }
.toc h2 {
  font-size: 0.875rem; margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0.45rem 0; }

/* ---------- 가운데 본문 ---------- */
.content h1 {
  font-family: serif; font-weight: 400;
  font-size: 1.9rem;
  margin: 0 0 0.3rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}
.subtitle { font-size: 0.8125rem; color: var(--sub-text); margin-bottom: 1.2rem; }
.content h2 {
  font-family: serif; font-weight: 400;
  font-size: 1.4rem;
  margin: 1.8rem 0 0.7rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line);
}
.content p { margin: 0.7rem 0; }
.content ul { margin: 0.5rem 0; padding-left: 1.3rem; }
.footnote { font-size: 0.8125rem; color: var(--sub-text); }

/* ---------- 오른쪽 인물 정보 상자 ---------- */
.infobox {
  float: right;
  width: 280px;
  margin: 0 0 1rem 1.5rem;
  border: 1px solid var(--border);
  background: var(--box-bg);
  font-size: 0.8125rem;
}
.infobox .infobox-title {
  background: var(--box-head);
  text-align: center;
  font-weight: bold;
  padding: 0.4rem;
}
.infobox img {
  display: block;
  width: calc(100% - 1.2rem);
  height: auto;
  margin: 0.6rem;
  border: 1px solid var(--line);
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox caption {
  background: var(--box-head);
  font-weight: bold;
  padding: 0.35rem;
}
.infobox th, .infobox td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line);
}
.infobox th { width: 35%; }
/* 오른쪽 외관 설정 패널 스타일 추가 */
.appearance { position: sticky; top: 1rem; }
.appearance h2 {
  font-size: 0.875rem; margin: 0 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.panel-group { border: 0; margin: 0 0 1.2rem; padding: 0; }
.panel-group legend {
  padding: 0; margin-bottom: 0.3rem;
  font-size: 0.75rem; color: var(--sub-text);
}
.panel-group label {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.22rem 0;
  font-size: 0.8125rem;
  cursor: pointer;
}

/* ---------- 화면이 좁을 때 ---------- */
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; gap: 1.5rem; }
  .toc, .appearance { position: static; } /* [수정] .appearance 추가 */
  .infobox { float: none; width: 100%; margin: 0 0 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  .toc, .appearance { display: none; } /* 목차와 설정 패널 숨기기 */
  .wrap { max-width: 100%; display: block; } /* 그리드 해제하고 전체 너비 사용 */
}