:root {
  color-scheme: light dark;
  --paper: #f4efe3;
  --paper-2: #efe8d8;
  --ink: #211c15;
  --ink-soft: #574d3c;
  --muted: #857a64;
  --rubric: #9b2226;
  --rubric-soft: #b5433f;
  --rule: #ddd2ba;
  --gold: #9a7b34;
  /* 본문·그리스어·한글: 라틴 세리프가 폴리토닉을 렌더하고, 뒤의 명조가 한글을 받는다. */
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Charter', Georgia,
    'Times New Roman', 'Apple SD Gothic Neo', 'Noto Serif KR', 'Nanum Myeongjo', Batang,
    'Malgun Gothic', serif;
  /* 표제·워드마크: 조금 더 또렷한 세리프. 없으면 본문 스택으로 자연 폴백. */
  --display: 'Hoefler Text', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia,
    'Apple SD Gothic Neo', 'Noto Serif KR', 'Nanum Myeongjo', Batang, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171410;
    --paper-2: #1e1a14;
    --ink: #e9e0cd;
    --ink-soft: #b9ac93;
    --muted: #8d8069;
    --rubric: #d9736c;
    --rubric-soft: #e08c85;
    --rule: #362f24;
    --gold: #caa65e;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 100% -10%, color-mix(in oklab, var(--gold) 8%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in oklab, var(--rubric) 6%, transparent), transparent 55%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.12rem);
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ── 헤더 · 워드마크 ── */
.site-head {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in oklab, var(--paper) 80%, transparent);
}
.wordmark {
  display: inline-block;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.1rem 1.4rem;
  width: 100%;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark span {
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.4rem 1.4rem 3rem;
  min-height: 62vh;
  animation: rise 0.5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main { animation: none; } }

/* ── 표제 ── */
h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
}
h1.greek { font-family: var(--serif); font-weight: 700; }
h2 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rubric);
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

a { color: var(--rubric); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--rubric-soft); }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 2px; border-radius: 2px; }

/* ── 절 페이지 ── */
.korean {
  font-size: clamp(1.2rem, 1.05rem + 0.8vw, 1.55rem);
  line-height: 1.85;
  margin: 0 0 1.5rem;
  padding: 0 0 0 1.1rem;
  border-left: 3px solid var(--rubric);
  color: var(--ink);
}
.korean.missing { color: var(--muted); font-style: italic; border-left-color: var(--rule); }
.greek-full {
  font-size: 1.35rem;
  line-height: 1.9;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule);
}

/* ── 낱말 목록 (인터리니어) ── */
.words { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.word {
  display: grid;
  grid-template-columns: minmax(7rem, 1fr) minmax(5rem, 1fr) auto;
  align-items: baseline;
  gap: 0.4rem 1rem;
  padding: 0.6rem 0.2rem;
  border-bottom: 1px solid color-mix(in oklab, var(--rule) 60%, transparent);
}
.word .greek { font-size: 1.35rem; }
.word .translit { color: var(--muted); font-style: italic; }
.word .gloss { color: var(--ink); }
.word .grammar {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.greek { color: var(--ink); }
a.greek { color: var(--rubric); text-decoration: none; border-bottom: 1px solid color-mix(in oklab, var(--rubric) 35%, transparent); }
a.greek:hover { border-bottom-color: var(--rubric); }

/* ── 배지 ── */
.badge {
  display: inline-block;
  font-size: 0.76rem;
  font-family: var(--serif);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin: 0.3rem 0.4rem 0.3rem 0;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  background: var(--paper-2);
}
.badge.verified { color: var(--ink-soft); border-color: color-mix(in oklab, var(--gold) 45%, var(--rule)); }
.badge.variant { color: var(--rubric); border-color: color-mix(in oklab, var(--rubric) 40%, var(--rule)); }

/* ── 낱말 페이지 머리 ── */
h1.greek + .translit {
  font-size: 1.15rem; font-style: italic; color: var(--muted); margin: 0 0 0.2rem;
}
.gloss { font-size: 1.3rem; color: var(--ink); margin: 0.1rem 0; }
.morph, .strong {
  font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem;
  letter-spacing: 0.06em; color: var(--gold); margin: 0.1rem 0;
}

/* ── 책별 분포 막대 ── */
.bybook ul, .occurrences ul, .forms ul, .chapters ol, .topwords ul, .books, .verses {
  list-style: none; margin: 0; padding: 0;
}
.bybook li {
  display: grid; grid-template-columns: 8rem 1fr 2.5rem; align-items: center;
  gap: 0.7rem; padding: 0.22rem 0; font-size: 0.95rem;
}
.bybook a { text-decoration: none; }
.bar {
  display: block; height: 0.62rem; border-radius: 999px;
  background: linear-gradient(90deg, var(--rubric), var(--rubric-soft));
  min-width: 2px;
}
.bybook .count, .forms .count { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }

/* ── 용례 · 어형 ── */
.occurrences li { padding: 0.32rem 0; border-bottom: 1px solid color-mix(in oklab, var(--rule) 45%, transparent); }
.occurrences a { text-decoration: none; font-variant-numeric: tabular-nums; }
.excerpt { color: var(--ink-soft); }
.forms li { display: inline-flex; align-items: baseline; gap: 0.35rem; margin: 0 0.9rem 0.4rem 0; }
.forms .greek { font-size: 1.15rem; }

/* ── 목록 그리드 (장·책·홈) ── */
.verses, .chapters ol, .books {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr)); gap: 0.45rem;
}
.books { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.verses li a, .chapters li a, .books li a, .topwords li a {
  display: block; padding: 0.55rem 0.4rem; text-align: center; text-decoration: none;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--paper-2);
  font-variant-numeric: tabular-nums;
}
.books li a { text-align: left; padding-left: 0.8rem; }
.verses li a:hover, .chapters li a:hover, .books li a:hover { border-color: var(--rubric); color: var(--rubric); }
.topwords ul { display: grid; gap: 0.25rem; }
.topwords li { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.3rem 0; }
.topwords .greek { font-size: 1.15rem; }

/* ── 소스 ── */
.source .gloss-en {
  font-style: italic; color: var(--ink-soft);
  padding-left: 1rem; border-left: 2px solid var(--rule);
}

/* ── 내비 ── */
nav.verse-nav, nav.chapter-nav {
  display: flex; flex-wrap: wrap; gap: 1.4rem; margin-top: 2.4rem;
  padding-top: 1.2rem; border-top: 1px solid var(--rule);
}
nav.verse-nav a, nav.chapter-nav a { text-decoration: none; font-variant-numeric: tabular-nums; }

/* ── 푸터 ── */
footer {
  max-width: 46rem; margin: 0 auto; padding: 1.6rem 1.4rem 3rem;
  border-top: 1px solid var(--rule); color: var(--muted);
  font-size: 0.8rem; line-height: 1.6;
}
footer p { margin: 0.2rem 0; }
.site-links { margin-top: 0.6rem; }
.site-links a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--rule); }
.site-links a:hover { color: var(--rubric); border-bottom-color: var(--rubric); }

@media (max-width: 34rem) {
  .word { grid-template-columns: 1fr auto; }
  .bybook li { grid-template-columns: 6rem 1fr 2.2rem; }
}

/* ── 간극 절 — 편집자 주석이지 본문이 아니다 ── */
.gap-note {
  border-left: 3px solid var(--rubric);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: color-mix(in oklab, var(--rubric) 6%, transparent);
  font-size: 0.95em;
}
.gap-note p { margin: 0.35rem 0; }
.gap-note .evidence { opacity: 0.75; font-size: 0.9em; }
.merged-here { font-size: 0.9em; opacity: 0.8; }

/* ── 뜻풀이 고지 — 출처의 말이 아니라 뜻풀이에 대한 우리의 설명이다 ── */
.gloss-note {
  border-left: 3px solid var(--rubric);
  padding: 0.5rem 0.9rem;
  margin: 0.75rem 0;
  background: color-mix(in oklab, var(--rubric) 5%, transparent);
  font-size: 0.9em;
  opacity: 0.9;
}
.gloss-note p { margin: 0; }
ol.verses li.gap a { opacity: 0.55; font-style: italic; }
.excerpt.gap { opacity: 0.6; font-style: italic; }
