/* 정원기 삼국지 연구소 공통 스타일: 한지 바탕, 먹색 글, 낙관 붉은색 하나 */
:root {
  --paper: #f5f0e6;
  --paper-2: #ece4d3;
  --card: #fbf8f2;
  --ink: #1f1c18;
  --ink-2: #4a443b;
  --ink-3: #6f675b;
  --line: #d9ccb3;
  --seal: #a3271f;
  --seal-dark: #7e1d17;
  --wei: #2f4a6b;
  --shu: #2f5d3a;
  --wu: #8a3a1e;
  --serif: 'Noto Serif KR', 'Nanum Myeongjo', 'Batang', 'AppleMyungjo', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  --radius: 10px;
  --max: 1080px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; }
a { color: var(--seal-dark); text-underline-offset: 3px; }
a:hover { color: var(--seal); }
:focus-visible { outline: 3px solid var(--seal); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.3rem, 3.6vw, 1.65rem); margin: 2.2em 0 .7em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 .5em; }
p { margin: 0 0 1em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 760px; }

/* 머리말 */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 240, 230, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.brand .seal { display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--seal); color: var(--paper); border-radius: 4px; font-size: 18px; }
.brand small { display: block; font-family: var(--sans); font-weight: 400; font-size: .7rem; color: var(--ink-3); letter-spacing: .04em; }
.nav { margin-left: auto; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; }
.nav a { display: block; padding: 8px 8px; text-decoration: none; color: var(--ink-2); font-size: .93rem; border-radius: 6px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--paper-2); color: var(--ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--seal); }
.menu-toggle { display: none; }
@media (max-width: 1240px) {
  .nav { position: relative; }
  .menu-toggle { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font: inherit; color: var(--ink); cursor: pointer; }
  .nav ul { display: none; position: absolute; right: 0; top: 46px; width: min(86vw, 320px); flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.12); }
  .nav.open ul { display: flex; }
  .nav a { padding: 11px 12px; font-size: 1rem; }
}

/* 첫 화면 */
.hero { position: relative; min-height: min(88vh, 760px); display: grid; align-items: end; color: #fff; background: #3b352d; overflow: hidden; }
.hero picture, .hero picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,16,12,.05) 0%, rgba(20,16,12,.25) 45%, rgba(20,16,12,.78) 100%); }
.hero .wrap { position: relative; z-index: 1; padding-top: 80px; padding-bottom: 48px; width: 100%; }
.hero .since { display: inline-block; font-size: .85rem; letter-spacing: .08em; padding: 4px 10px; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; margin-bottom: 14px; background: rgba(0,0,0,.18); }
.hero h1 { font-size: clamp(2.1rem, 7.5vw, 3.6rem); margin: 0 0 .25em; text-shadow: 0 2px 18px rgba(0,0,0,.45); }
.hero .lead { font-size: clamp(1.02rem, 2.6vw, 1.22rem); max-width: 40em; margin-bottom: 1.2em; text-shadow: 0 1px 10px rgba(0,0,0,.5); }
.hero form { display: flex; gap: 8px; max-width: 560px; }
.hero input[type="search"] { flex: 1; min-width: 0; padding: 13px 14px; font: inherit; border-radius: 8px; border: 0; background: rgba(255,255,255,.95); color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: 8px; border: 1px solid var(--seal); background: var(--seal); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--seal-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--seal-dark); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: 7px 12px; font-size: .92rem; }

/* 쪽 머리 */
.page-head { background: var(--paper-2); border-bottom: 1px solid var(--line); padding: 34px 0 26px; }
.page-head .eyebrow { color: var(--seal-dark); font-size: .85rem; letter-spacing: .08em; margin: 0 0 6px; }
.page-head p.desc { color: var(--ink-2); max-width: 46em; margin: 0; }
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: 8px; }
.crumbs a { color: var(--ink-3); }
main { display: block; padding-bottom: 60px; }
.section { padding: 8px 0; }

/* 카드 */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); text-decoration: none; }
a.card:hover { border-color: var(--seal); box-shadow: 0 6px 18px rgba(80,50,20,.08); color: var(--ink); }
.card h3 { margin: 0 0 6px; font-size: 1.08rem; }
.card p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.card .meta { color: var(--ink-3); font-size: .85rem; margin-top: 8px; }
.tag { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--paper); vertical-align: middle; }
.tag.wei { border-color: var(--wei); color: var(--wei); }
.tag.shu { border-color: var(--shu); color: var(--shu); }
.tag.wu { border-color: var(--wu); color: var(--wu); }
.tag.novel { border-color: var(--seal); color: var(--seal); }

/* 본문 */
.prose { max-width: 760px; }
.prose h2:first-child { margin-top: 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .3em 0; }
.note { background: var(--card); border-left: 4px solid var(--seal); padding: 12px 16px; border-radius: 0 8px 8px 0; color: var(--ink-2); margin: 1.2em 0; }
.note.plain { border-left-color: var(--line); }
blockquote.classic { margin: 1.4em 0; padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
blockquote.classic .zh { font-family: var(--serif); font-size: 1.2rem; letter-spacing: .03em; }
blockquote.classic .ko { color: var(--ink-2); margin-top: 6px; }
blockquote.classic cite { display: block; font-style: normal; font-size: .85rem; color: var(--ink-3); margin-top: 6px; }
.table-wrap { overflow-x: auto; margin: 1em 0 1.5em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--paper-2); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.src { font-size: .85rem; color: var(--ink-3); }
.src a { color: var(--ink-3); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 1em 0; }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; }

/* 인물 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; align-items: center; }
.filters input { flex: 1 1 220px; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.chip { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font: inherit; font-size: .92rem; cursor: pointer; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.person-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.person-list a { display: block; height: 100%; }
.person-list .hz { font-family: var(--serif); color: var(--ink-3); margin-left: 4px; }
.person-head .hz { font-family: var(--serif); font-size: 1.4rem; color: var(--ink-3); margin-left: 8px; font-weight: 400; }

/* 연표 */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline > li { position: relative; padding: 2px 0 18px 22px; }
.timeline > li::before { content: ''; position: absolute; left: -7px; top: 9px; width: 12px; height: 12px; background: var(--paper); border: 2px solid var(--seal); border-radius: 50%; }
.timeline .yr { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.timeline .era { color: var(--ink-3); font-size: .85rem; margin-left: 8px; }
.timeline ul { margin: 4px 0 0; padding-left: 1.1em; }
.yearnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 22px; }
.yearnav a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: .9rem; background: var(--card); color: var(--ink-2); }

/* 아카이브 */
.post-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.post-list li { border-bottom: 1px solid var(--line); padding: 11px 2px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.post-list .t { flex: 1 1 280px; }
.post-list .d { color: var(--ink-3); font-size: .88rem; white-space: nowrap; }
.post-list .w { color: var(--ink-3); font-size: .88rem; }
.old-post { white-space: pre-wrap; font-size: 1.02rem; line-height: 1.9; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.old-badge { display: inline-block; background: var(--ink); color: var(--paper); font-size: .78rem; padding: 2px 8px; border-radius: 4px; }

/* 게시판 */
.board-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.board-tabs a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink-2); background: var(--card); }
.board-tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.form { display: grid; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.form label { display: grid; gap: 4px; font-size: .92rem; color: var(--ink-2); }
.form input, .form textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
.form textarea { min-height: 180px; resize: vertical; }
.form .row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .form .row { grid-template-columns: 1fr; } }
.hp { position: absolute !important; left: -5000px !important; width: 1px; height: 1px; overflow: hidden; }
.msg { padding: 10px 14px; border-radius: 8px; background: #fff4e5; border: 1px solid #e8c48f; }
.msg.ok { background: #eef6ee; border-color: #9cc59c; }
.post-view { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.post-view .body { white-space: pre-wrap; margin-top: 14px; }
.comments { list-style: none; padding: 0; margin: 16px 0; }
.comments li { border-top: 1px solid var(--line); padding: 10px 0; }
.comments .who { font-weight: 600; }
.comments .when { color: var(--ink-3); font-size: .85rem; margin-left: 6px; }
.comments .body { white-space: pre-wrap; margin-top: 4px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-3); text-decoration: underline; cursor: pointer; font-size: .85rem; }

/* 검색 결과 */
.results { list-style: none; padding: 0; margin: 14px 0; }
.results li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.results .k { font-size: .78rem; color: var(--ink-3); margin-right: 6px; }

/* 꼬리말 */
.site-foot { border-top: 1px solid var(--line); background: var(--paper-2); color: var(--ink-3); font-size: .88rem; padding: 28px 0 36px; }
.site-foot a { color: var(--ink-2); }
.site-foot .cols { display: flex; flex-wrap: wrap; gap: 18px 36px; justify-content: space-between; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }

.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; margin: 1em 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.mt0 { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .site-head, .site-foot, .menu-toggle { display: none; } body { background: #fff; } }

[hidden] { display: none !important; }

/* 지도 */
.map-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin: 16px 0; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.map-wrap .pt { fill: var(--seal); }
.map-wrap .pt.cap { fill: var(--ink); }
.map-wrap text { font-family: var(--sans); font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
.map-wrap a:hover text, .map-wrap a:focus text { fill: var(--seal); font-weight: 700; }
.map-wrap .river { fill: none; stroke: #8fb3c9; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.map-wrap .rl { fill: #5f8aa3; font-size: 11px; font-style: italic; }

/* 옛 글 속 그림·첨부 */
.old-post figure.old-img { margin: 10px 0; white-space: normal; }
.old-post figure.old-img img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.old-post figure.old-img figcaption { font-size: .82rem; }
.old-post .old-file { display: inline-block; margin: 6px 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); text-decoration: none; }
.old-post .lost { color: var(--ink-3); font-size: .9rem; }
