/* ============================================================
   한국어 성경 — 읽기 화면

   구성 원칙
   1. 본문은 문단으로 흐른다. 절은 조판을 끊지 않고, 번호는 어깨에 물러나 있다.
      (절·장 구분은 16세기에 붙은 것이지 원문에 있던 것이 아니다.)
   2. 근거는 본문 위에 겹쳐 열린다. 본문의 조판을 절대 밀어내지 않는다.
   3. 편집자가 붙인 것(번호·소제목)은 원문에서 온 것보다 한 단계 물러난다.
   ============================================================ */

:root {
  --paper: #f6f2e9;
  --paper-raised: #fbf8f2;
  --ink: #23201a;
  --ink-soft: #554e42;
  --ink-faint: #8b8171;
  --rule: #ddd4c2;
  --rule-soft: #e8e0d1;

  --madder: #9d3b1c;
  --madder-soft: #c2704f;
  --madder-wash: #f0e2d8;

  --slate: #3b4a5a;
  --slate-soft: #7c8b9b;
  --slate-wash: #eaeef2;

  /* 절 번호 — 있는 줄은 알되 읽기를 방해하지 않는 밝기 */
  --vnum: #b9ad98;

  --serif-ko: 'Nanum Myeongjo', 'Apple SD Gothic Neo', 'Noto Serif KR', serif;
  --serif-display: 'Gowun Batang', 'Nanum Myeongjo', serif;
  --serif-grc: 'EB Garamond', 'GFS Didot', 'Palatino Linotype', 'Times New Roman', serif;

  /* 본문 폭. 33rem 은 라틴 문자 기준의 한 줄 66자를 옮겨 온 값인데, 한국어는
     한 글자가 더 넓고 어절 단위로 끊어 읽으므로 그 폭에서는 줄이 너무 자주 꺾인다.
     읽기 설정에서 34/40/48rem 로 바꿀 수 있고, 여기 적힌 것은 그 가운데 값이다. */
  --measure: 40rem;
  /* 글자 크기 배율 — 읽기 설정이 이 값 하나만 움직인다 */
  --fs-scale: 1;
  --shadow: 0 2px 40px rgba(60, 45, 25, 0.16);

  color-scheme: light dark;
}

/* 어두운 바탕. 세 가지 상태를 모두 덮는다 —
   ① 기기 설정을 따르는 '자동'(data-theme 없음)
   ② 독자가 고른 '어둡게'(data-theme="dark")
   ③ '밝게'를 고른 독자는 기기가 어둡더라도 밝게 남는다(:not([data-theme='light'])) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #16140f;
    --paper-raised: #1f1c16;
    --ink: #e9e2d4;
    --ink-soft: #b3a994;
    --ink-faint: #7d745f;
    --rule: #35301f;
    --rule-soft: #2a2519;

    --madder: #e08055;
    --madder-soft: #a95f3d;
    --madder-wash: #2e2018;

    --slate: #9db4cb;
    --slate-soft: #6b7d8f;
    --slate-wash: #1b2129;

    --vnum: #5f5847;
    --shadow: 0 2px 44px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme='dark'] {
  --paper: #16140f;
  --paper-raised: #1f1c16;
  --ink: #e9e2d4;
  --ink-soft: #b3a994;
  --ink-faint: #7d745f;
  --rule: #35301f;
  --rule-soft: #2a2519;

  --madder: #e08055;
  --madder-soft: #a95f3d;
  --madder-wash: #2e2018;

  --slate: #9db4cb;
  --slate-soft: #6b7d8f;
  --slate-wash: #1b2129;

  --vnum: #5f5847;
  --shadow: 0 2px 44px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

/* hidden 속성은 브라우저 기본 스타일의 [hidden]{display:none} 으로 동작하는데,
   클래스 선택자가 우선순위에서 이겨 버린다. 실제로 .panel{display:flex} 가
   hidden 을 무력화해 근거 패널이 닫히지 않았다. 여기서 못을 박아 둔다. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-ko);
  /* 한국어는 어절 단위로 끊어야 읽힌다 */
  word-break: keep-all;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

.skip {
  position: absolute;
  left: -9999px;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 200;
}
.skip:focus {
  left: 0;
  top: 0;
}

/* ── 판심(版心) ──────────────────────────────────────────── */

.chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: opacity 0.35s, transform 0.35s, border-color 0.35s;
}

.chrome[data-visible='false'] {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

.chrome[data-visible='true'] {
  opacity: 1;
  transform: none;
  border-bottom-color: var(--rule-soft);
}

.chrome__left {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
}

/* 서가로 나가는 문. 책 이름 앞에 서서, 여기가 어느 총서의 한 권인지도 함께 말한다. */
.chrome__home {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.15rem 0.4rem 0.15rem 0.25rem;
  border-radius: 2px;
  transition: color 0.18s, background 0.18s;
}

.chrome__home:hover,
.chrome__home:focus-visible {
  color: var(--madder);
  background: var(--madder-wash);
}

.chrome__homeArrow {
  font-size: 0.9em;
  transition: transform 0.18s;
}

.chrome__home:hover .chrome__homeArrow {
  transform: translateX(-2px);
}

.chrome__book {
  font-family: var(--serif-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chrome__book::before {
  content: '·';
  color: var(--rule);
  margin-right: 0.55rem;
}

/* 지금 읽는 자리. 판심 한가운데에서 장을 크게 말한다 — 마태복음 28장을 스크롤로
   다니는 독자가 늘 볼 수 있어야 하는 것은 절이 아니라 장이다. 누르면 장 목록이
   펼쳐진다(장이 하나뿐인 책에서는 눌리지 않는다). */
.chrome__loc {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--serif-ko);
  font-size: 0.78rem;
  color: var(--ink-faint);
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  min-width: 0;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.chrome__loc b {
  font-family: var(--serif-display);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.chrome__loc:hover:not(:disabled),
.chrome__loc:focus-visible:not(:disabled) {
  border-color: var(--rule);
  background: var(--paper-raised);
}

.chrome__loc:disabled {
  cursor: default;
}

.chrome__nav {
  display: flex;
  gap: 0.4rem;
}

.chrome__btn {
  font-family: var(--serif-ko);
  font-size: 0.76rem;
  color: var(--ink-faint);
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.chrome__btn:hover {
  color: var(--ink);
  border-color: var(--rule);
}

.chrome__btn[aria-pressed='true'],
.chrome__btn[aria-expanded='true'] {
  color: var(--madder);
  border-color: var(--madder-soft);
  background: var(--madder-wash);
}

/* 어디까지 왔는지 — 판심 아래에 눕는 한 줄 */
.chrome__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  overflow: hidden;
}

.chrome__progress i {
  display: block;
  height: 100%;
  background: var(--madder);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0.75;
}

/* 좁은 화면에서는 '원문'(대역)이 설 자리가 없다 */
@media (max-width: 73rem) {
  #btn-facing {
    display: none;
  }
}

/* 더 좁아지면 총서 이름과 해설까지 접는다. 남기는 것은 나가는 문(←), 책 이름,
   지금 자리, 그리고 듣기다. */
@media (max-width: 34rem) {
  .chrome {
    gap: 0.5rem;
    padding-inline: 0.9rem;
  }
  .chrome__home {
    font-size: 0;
    gap: 0;
  }
  .chrome__homeArrow {
    font-size: 0.95rem;
  }
  .chrome__book::before {
    display: none;
  }
  .chrome__btn {
    padding: 0.25rem 0.45rem;
  }
}

/* ── 표제지 ──────────────────────────────────────────────── */

.titlepage {
  /* 아래의 '아래로' 표시가 이 면의 바닥을 기준으로 서게 한다. 기준을 잡아 두지
     않으면 본문이 옆으로 밀릴 때(근거 패널이 열릴 때) 그 표시가 문서 맨 아래로
     떨어진다 — transform 이 걸린 조상이 기준이 되기 때문이다. */
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  gap: 0;
}

.titlepage__series {
  margin: 0 0 1.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
}

/* 서가로 되돌아가는 문. 읽기를 방해하지 않도록 밑줄은 짚었을 때만 보인다. */
.titlepage__home {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.titlepage__home:hover,
.titlepage__home:focus-visible {
  border-bottom-color: currentColor;
}

.titlepage__title {
  margin: 0;
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(3rem, 13vw, 5rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.titlepage__rule {
  width: 3.5rem;
  height: 1px;
  background: var(--madder);
  margin: 1.8rem 0;
}

.titlepage__sub {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  font-style: italic;
}

.titlepage__scroll {
  position: absolute;
  bottom: 2.5rem;
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  animation: breathe 3.2s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 0.85;
    transform: translateY(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .titlepage__scroll {
    animation: none;
    opacity: 0.6;
  }
}

/* ── 본문 ────────────────────────────────────────────────── */

.text {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 8vw, 5rem) 1.5rem;
}

.loading {
  color: var(--ink-faint);
  font-style: italic;
}

/* 문단 — 책의 리듬은 문단 사이 여백이 아니라 첫 줄 들여쓰기에서 온다 */
.para {
  margin: 0 0 0.15em;
  text-indent: 1em;
  font-size: calc(clamp(1.06rem, 1rem + 0.35vw, 1.2rem) * var(--fs-scale));
  line-height: 2;
  letter-spacing: 0.005em;
}

/* 첫 문단은 들여쓰지 않는다 — 앞에 이어질 글이 없으므로 */
.para--open {
  text-indent: 0;
}

/* 절 — 문단 안에서 흐르는 인라인 조각.
   scroll-margin-top 은 장 고르기·해시 링크로 절을 찾아갈 때 판심 아래로 가려지지
   않게 하는 여백이다. */
.v {
  transition: background 0.4s;
  border-radius: 2px;
  scroll-margin-top: 5.5rem;
}

.v--active {
  background: var(--madder-wash);
}

/* 절 번호 — 편집자가 붙인 것이므로 한 단계 물러난다.
   동시에 근거를 여는 손잡이라, 다가가면 반응한다. */
.vnum {
  font-family: var(--serif-grc);
  font-size: 0.6em;
  vertical-align: 0.62em;
  color: var(--vnum);
  background: none;
  border: 0;
  padding: 0 0.22em 0 0.04em;
  margin: 0;
  cursor: pointer;
  text-indent: 0;
  letter-spacing: 0.02em;
  transition: color 0.18s;
}

.vnum:hover,
.vnum:focus-visible {
  color: var(--madder);
}

.vnum:focus-visible {
  outline: 1px solid var(--madder);
  outline-offset: 2px;
  border-radius: 2px;
}

/* 대역(對譯) — 넓은 화면에서만, 문단 단위로 나란히 */
.unit {
  margin-bottom: 1.6em;
}

.para--grc {
  display: none;
  font-family: var(--serif-grc);
  font-size: calc(1.04rem * var(--fs-scale));
  line-height: 1.95;
  color: var(--slate);
  text-indent: 1em;
  margin: 0;
}

@media (min-width: 73rem) {
  .text[data-facing='on'] {
    max-width: 68rem;
  }

  .text[data-facing='on'] .unit {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 3rem;
    align-items: start;
  }

  .text[data-facing='on'] .para--grc {
    display: block;
  }
}

.endmark {
  text-align: center;
  padding: 1rem 0 6rem;
  color: var(--madder);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
}

/* ── 근거 패널 — 본문 위에 겹친다 ──────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(35, 28, 18, 0.28);
  animation: fade 0.25s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.panel {
  position: fixed;
  z-index: 70;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 모바일 — 아래에서 올라오는 시트 */
@media (max-width: 55.99rem) {
  .panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 72svh;
    border-top: 2px solid var(--madder);
    border-radius: 14px 14px 0 0;
    animation: rise 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  @keyframes rise {
    from {
      transform: translateY(100%);
    }
  }
}

/* 근거 패널이 열리면 본문이 그 뒤로 숨지 않도록 옆으로 비켜 준다.
   자리를 다시 잡는 것이 아니라 통째로 미는 것이라(transform) 줄바꿈은 그대로다 —
   본문 조판을 건드리지 않는다는 원칙을 지키면서 읽던 줄을 가리지 않는 방법이다.
   좁은 화면에서는 패널이 아래에서 올라오므로 밀 일이 없다. */
@media (min-width: 56rem) {
  #book {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.is-panel #book {
    transform: translateX(calc(min(27rem, 40vw) / -2));
  }
}

@media (prefers-reduced-motion: reduce) {
  #book {
    transition: none;
  }
}

/* 데스크톱 — 오른쪽에서 밀려드는 면. 본문은 그대로 남는다. */
@media (min-width: 56rem) {
  .panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(27rem, 40vw);
    border-left: 1px solid var(--rule);
    animation: slide 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  @keyframes slide {
    from {
      transform: translateX(100%);
    }
  }
  .scrim {
    background: rgba(35, 28, 18, 0.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .scrim {
    animation: none;
  }
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem 0.7rem;
  border-bottom: 1px solid var(--rule-soft);
}

.panel__where {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.panel__ref {
  font-family: var(--serif-display);
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 4.5rem;
  text-align: center;
}

.panel__step,
.panel__close {
  background: none;
  border: 0;
  color: var(--ink-faint);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 2px;
  transition: color 0.16s, background 0.16s;
}

.panel__step:hover,
.panel__close:hover {
  color: var(--ink);
  background: var(--madder-wash);
}

.panel__step:disabled {
  opacity: 0.25;
  cursor: default;
}

.panel__verse {
  margin: 0;
  padding: 0.85rem 1.1rem;
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper);
}

.panel__tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.6rem 1.1rem 0;
}

.tab {
  font-family: var(--serif-ko);
  font-size: 0.78rem;
  color: var(--ink-faint);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected='true'] {
  color: var(--madder);
  border-bottom-color: var(--madder);
}

.tab:disabled {
  opacity: 0.3;
  cursor: default;
}

.panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem 2.5rem;
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--ink-soft);
  -webkit-overflow-scrolling: touch;
}

.panel__empty {
  color: var(--ink-faint);
  font-style: italic;
}

/* 패널 안 내용 */

.note {
  margin-bottom: 1.2rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--madder-soft);
}

.note__kind {
  display: inline-block;
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  color: var(--madder);
}

.note__title {
  display: block;
  margin: 0.2rem 0 0.35rem;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.55;
}

.note__anchor {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.note__anchor b {
  color: var(--madder);
  font-weight: 400;
  border-bottom: 1px dotted var(--madder-soft);
}

.grc-line {
  font-family: var(--serif-grc);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--slate);
  margin: 0 0 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule-soft);
}

.words {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.gw {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr;
  gap: 0.15rem 0.75rem;
  align-items: baseline;
  padding-bottom: 0.5rem;
  border-bottom: 1px dotted var(--rule-soft);
}

.gw__grc {
  font-family: var(--serif-grc);
  font-size: 1rem;
  color: var(--slate);
}

.gw__ko {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.gw__parse {
  grid-column: 1 / -1;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  color: var(--slate-soft);
}

/* 표제어는 자간을 주지 않는다.
   폰트에 완성형 글리프가 없어 '기본자 + 결합 악센트'로 분해 렌더링될 때
   letter-spacing이 악센트까지 밀어내 ἀδελφό ́ ς 처럼 떨어져 보인다. */
.gw__lemma {
  grid-column: 1 / -1;
  font-family: var(--serif-grc);
  font-size: 0.78rem;
  letter-spacing: normal;
  color: var(--slate-soft);
}

.gw__lemma::before {
  content: '표제어 ';
  font-family: var(--serif-ko);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.gw--override .gw__ko {
  color: var(--madder);
}

.wit,
.view {
  margin-bottom: 1.1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px dotted var(--rule);
}

.wit:last-child,
.view:last-child {
  border-bottom: 0;
}

.wit__reading {
  font-family: var(--serif-grc);
  font-size: 1rem;
  color: var(--slate);
}

.wit__alt {
  color: var(--ink-faint);
}

/* 설명 없이 자리만 표시한 이문. 기술된 이문보다 눈에 덜 띄어야 한다 —
   여기 무언가 있다는 것만 알리고 읽기를 방해하지 않는 것이 목적이다. */
.wit--bare {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 3px;
}

.wit__bareHead {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.wit__bareItem {
  margin: 0.2rem 0;
  font-family: var(--serif-grc);
  color: var(--slate);
  letter-spacing: normal;
}

.wit__bareWhy {
  margin: 0.6rem 0 0;
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--ink-faint);
}

.wit__flag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--madder);
  border: 1px solid var(--madder-soft);
  border-radius: 2px;
  vertical-align: 0.1em;
}

.view__issue {
  display: block;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.pos {
  margin: 0 0 0.6rem;
  padding-left: 0.8rem;
  border-left: 2px solid var(--rule);
}

.pos--pd {
  border-left-color: var(--slate-soft);
}

.pos__src {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-style: italic;
}

.view__taken {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.8rem;
  background: var(--madder-wash);
  border-left: 2px solid var(--madder);
  color: var(--ink);
}

.view__taken b {
  color: var(--madder);
}

/* ── 해설 — 본문에서 떼어낸 앞붙이 ─────────────────────────── */

.about {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--paper);
  overflow-y: auto;
  animation: fade 0.25s ease both;
}

.about__inner {
  max-width: 38rem;
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 4.5rem) 1.5rem 5rem;
}

.about__close {
  font-family: var(--serif-ko);
  font-size: 0.78rem;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.35rem 0.8rem;
  margin-bottom: 2.5rem;
  cursor: pointer;
}

.about__close:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.about h2 {
  font-family: var(--serif-display);
  font-size: 1.2rem;
  margin: 2.5rem 0 0.9rem;
  color: var(--madder);
}

.about h2:first-of-type {
  margin-top: 0;
}

.about h3 {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  font-weight: 400;
  margin: 2rem 0 0.6rem;
}

.about p {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.95;
  color: var(--ink-soft);
}

.about .fine {
  font-size: 0.78rem;
  line-height: 1.8;
  color: var(--ink-faint);
}

.about ol {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--ink-soft);
}

.about li {
  margin-bottom: 0.5rem;
}

.about li b {
  color: var(--ink);
}

/* ============================================================
   서가 — 들어오는 문
   책을 고르는 자리이지 읽는 자리가 아니므로, 본문 조판보다 성기게 둔다.
   ============================================================ */

.shelf {
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(3rem, 10vw, 6rem) 1.5rem 5rem;
  position: relative;
  z-index: 1;
}

.shelf__series {
  margin: 0 0 0.8rem;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
}

.shelf__name {
  margin: 0;
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(3rem, 12vw, 4.5rem);
  line-height: 1;
  letter-spacing: 0.04em;
}

.shelf__rule {
  width: 3.5rem;
  height: 1px;
  background: var(--madder);
  margin: 1.6rem 0;
}

.shelf__lede {
  margin: 0 0 clamp(2.5rem, 7vw, 4rem);
  font-size: 1rem;
  line-height: 1.95;
  color: var(--ink-soft);
  max-width: 32rem;
}

.shelf__list {
  list-style: none;
  margin: 0 0 clamp(2.5rem, 7vw, 4rem);
  padding: 0;
  border-top: 1px solid var(--rule);
}

.shelf__item {
  border-bottom: 1px solid var(--rule);
}

.shelf__link {
  display: grid;
  gap: 0.2rem;
  padding: 1.15rem 0.4rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.16s, padding-left 0.16s;
}

.shelf__link:hover,
.shelf__link:focus-visible {
  background: var(--madder-wash);
  padding-left: 0.9rem;
  outline: none;
}

.shelf__title {
  font-family: var(--serif-display);
  font-size: 1.32rem;
  font-weight: 700;
}

.shelf__sub {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-style: italic;
}

.shelf__meta {
  font-size: 0.74rem;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.shelf__note {
  border-top: 1px solid var(--rule-soft);
  padding-top: 1.6rem;
  font-size: 0.86rem;
  line-height: 1.85;
  color: var(--ink-faint);
}

.shelf__note h2 {
  margin: 0 0 0.8rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  font-weight: 400;
  color: var(--ink-soft);
}

.shelf__note p {
  margin: 0 0 0.9rem;
}

.shelf__note strong {
  color: var(--madder);
  font-weight: 400;
}

/* 본문 끝의 초안 표시 — 확정본으로 오해하지 않도록 */
.endmark__draft {
  margin: 1.4rem auto 0;
  max-width: 26rem;
  font-size: 0.74rem;
  letter-spacing: 0;
  line-height: 1.8;
  color: var(--ink-faint);
}

/* ── 장 표지 ─────────────────────────────────────────────────
   절·장 구분은 16세기에 붙은 것이지만, 장은 이 책들이 실제로 인용되고 기억되는
   단위다. 그래서 절 번호처럼 어깨로 물러나게 두지 않고 본문의 흐름 안에 세운다.
   다만 표제와 겨루지 않도록 숫자만 크고 획은 가늘게 둔다. */

.chap {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  margin: 2.6em 0 1.1em;
  padding-top: 1.1em;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--serif-display);
  font-weight: 400;
  color: var(--madder);
  scroll-margin-top: 5.5rem;
}

.unit:first-child .chap {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.chap__num {
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: 0.02em;
}

.chap__unit {
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}

/* ── 겹쳐 열리는 판 — 장 고르기 · 읽기 설정 ─────────────────
   본문 위에 잠깐 내려왔다 걷히는 것이므로, 근거 패널처럼 자리를 차지하지 않는다. */

.sheet {
  position: fixed;
  top: 3.1rem;
  left: 0;
  right: 0;
  z-index: 55;
  display: flex;
  justify-content: center;
  padding: 0 clamp(0.75rem, 4vw, 2.5rem);
  animation: sheetdrop 0.18s ease both;
}

@keyframes sheetdrop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet {
    animation: none;
  }
}

.sheet__inner {
  width: min(34rem, 100%);
  max-height: min(60vh, 30rem);
  overflow-y: auto;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 0.9rem;
}

/* 장이 여섯인 책과 스물여덟인 책이 같은 판을 쓴다. 칸을 늘려 판을 채우는 대신
   판이 내용만큼만 넓어지게 둔다 — 여섯 장짜리 책에서 빈 판이 펼쳐지지 않도록. */
#chapters .sheet__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  width: fit-content;
  max-width: min(34rem, 100%);
}

.chapbtn {
  width: 2.6rem;
  font-family: var(--serif-grc);
  font-size: 0.92rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  padding: 0.5rem 0;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}

.chapbtn:hover,
.chapbtn:focus-visible {
  color: var(--madder);
  border-color: var(--madder-soft);
}

.chapbtn--here {
  color: var(--paper-raised);
  background: var(--madder);
  border-color: var(--madder);
}

/* 읽기 설정 */

.srow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.3rem;
  border-bottom: 1px dotted var(--rule-soft);
}

.srow:last-child {
  border-bottom: 0;
}

.srow--voice {
  flex-wrap: wrap;
}

.srow__label {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.srow__select {
  font-family: var(--serif-ko);
  font-size: 0.78rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.3rem 0.4rem;
  max-width: 60%;
}

.srow__hint {
  flex-basis: 100%;
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.seg {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.seg__btn {
  font-family: var(--serif-ko);
  font-size: 0.76rem;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.28rem 0.6rem;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}

.seg__btn:hover {
  color: var(--ink);
}

.seg__btn--on {
  color: var(--madder);
  border-color: var(--madder-soft);
  background: var(--madder-wash);
}

.seg__val {
  min-width: 3.2rem;
  text-align: center;
  font-family: var(--serif-grc);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* ── 읽던 자리 ───────────────────────────────────────────────
   책은 펼치면 표제부터 보이는 것이 옳다. 되돌아갈지는 읽는 사람이 정한다. */

.titlepage__resume {
  margin-top: 2.2rem;
  font-family: var(--serif-ko);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--madder);
  background: none;
  border: 1px solid var(--madder-soft);
  border-radius: 2px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: color 0.16s, background 0.16s;
}

.titlepage__resume:hover,
.titlepage__resume:focus-visible {
  background: var(--madder-wash);
}

/* ── 듣기 ────────────────────────────────────────────────────
   읽어 주는 동안에만 화면 아래에 머문다. 멈추면 자취 없이 사라진다. */

.v--speaking {
  background: var(--slate-wash);
  box-shadow: 0 0 0 2px var(--slate-wash);
  border-radius: 2px;
}

.playbar {
  position: fixed;
  z-index: 65;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: min(26rem, calc(100vw - 1.6rem));
  padding: 0.5rem 0.6rem 0.5rem 0.5rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--madder);
  border-radius: 3px;
  box-shadow: var(--shadow);
  animation: playbar-rise 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 이름을 따로 둔다. 근거 패널이 좁은 화면에서 쓰는 'rise' 와 이름이 겹치면
   나중에 정의된 쪽이 이겨서, 아래에서 올라오던 패널이 옆으로 미끄러진다. */
@keyframes playbar-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .playbar {
    animation: none;
  }
}

.playbar__toggle {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  background: var(--madder);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.playbar__toggle svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: var(--paper-raised);
}

.playbar__where {
  flex: 1;
  min-width: 0;
  font-size: 0.76rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playbar__rate {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.playbar__rateBtn,
.playbar__stop {
  background: none;
  border: 0;
  color: var(--ink-faint);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.3rem 0.4rem;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.14s, background 0.14s;
}

.playbar__rateBtn:hover,
.playbar__stop:hover {
  color: var(--ink);
  background: var(--madder-wash);
}

.playbar__rateVal {
  font-family: var(--serif-grc);
  font-size: 0.74rem;
  color: var(--ink-faint);
  min-width: 2.2rem;
  text-align: center;
}

.playbar__stop {
  border-left: 1px solid var(--rule-soft);
  padding-left: 0.55rem;
  margin-left: 0.1rem;
}

/* 근거 패널이 아래에서 올라오는 좁은 화면에서는 재생바가 그 위에 겹친다 */
@media (max-width: 55.99rem) {
  .playbar {
    bottom: max(0.7rem, env(safe-area-inset-bottom));
  }
}

/* ── 알림 한 줄 ─────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--paper);
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  border-radius: 3px;
  animation: fade 0.2s ease both;
}

/* 서가에서 보이는 읽던 자리 — 읽은 적 있는 책에만 붙는다 */
.shelf__resume {
  justify-self: start;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--madder);
  border-bottom: 1px dotted var(--madder-soft);
}

/* 좁은 화면에서 근거 패널은 아래에서 올라와 재생바가 서 있던 자리를 덮는다.
   두 개를 겹쳐 놓느니 재생바를 잠시 접는다 — 읽어 주기는 그대로 이어지고,
   판심의 '듣는 중' 이 그 사실을 말해 준다. 패널을 닫으면 다시 나타난다. */
@media (max-width: 55.99rem) {
  body.is-panel .playbar {
    display: none;
  }
}

/* ── 찾기 ────────────────────────────────────────────────────
   목록은 본문이 아니다. 절 이름을 앞세우고 본문은 앞뒤를 잘라 한 줄로 보인다. */

.sheet--find .sheet__inner {
  width: min(38rem, 100%);
  max-height: min(70vh, 34rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.find__bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule-soft);
}

.find__input {
  flex: 1;
  min-width: 0;
  font-family: var(--serif-ko);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.45rem 0.6rem;
}

.find__input:focus-visible {
  outline: 1px solid var(--madder-soft);
  outline-offset: 1px;
  border-color: var(--madder-soft);
}

.find__note {
  margin: 0.55rem 0.2rem 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

.find__list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hit {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  font-family: var(--serif-ko);
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--rule-soft);
  padding: 0.55rem 0.3rem;
  cursor: pointer;
  transition: background 0.14s, padding-left 0.14s;
}

.hit:hover,
.hit:focus-visible {
  background: var(--madder-wash);
  padding-left: 0.7rem;
  outline: none;
}

.hit__where {
  font-family: var(--serif-display);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--madder);
  letter-spacing: 0.02em;
}

.hit__text {
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.hit mark {
  background: var(--slate-wash);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 0.1em;
}

/* 찾아 들어간 절 — 잠깐 물들었다 가라앉는다 */
.v--found {
  animation: found 2.4s ease-out both;
}

@keyframes found {
  0%,
  55% {
    background: var(--madder-wash);
    box-shadow: 0 0 0 2px var(--madder-wash);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v--found {
    animation: none;
    background: var(--madder-wash);
  }
}

/* 좁은 화면 — 범위 단추가 입력칸을 밀어내지 않도록 아래로 내린다 */
@media (max-width: 34rem) {
  .find__bar {
    flex-wrap: wrap;
  }
  .find__input {
    flex-basis: 100%;
  }
}

/* ── 노트 안의 표기 ──────────────────────────────────────────
   번역 노트는 본문보다 한 단계 물러난 잿빛(--ink-soft)으로 적힌다. 그 안에서
   굵게 짚은 대목은 색까지 먹빛으로 돌아와야 눈에 걸린다. */

.panel__body b,
.about p b,
.about li b {
  color: var(--ink);
  font-weight: 700;
}

/* 백틱으로 감싼 것은 「본문 그대로의 조각」이다 — 원문 낱말(Σὺ εἶ)이나 조사(~에게),
   더러는 표기 토큰(social>up). 고정폭 글꼴로 바꾸지 않는다. 그리스어와 한글이
   섞여 들어오므로 글꼴을 갈면 그쪽 글자가 되레 상한다. 바탕으로만 구분한다. */
.panel__body code,
.about code {
  font-family: inherit;
  font-size: 0.94em;
  color: var(--slate);
  background: var(--slate-wash);
  border-radius: 2px;
  padding: 0 0.24em;
  letter-spacing: normal;
}
