:root {
  color-scheme: light;
  --paper: #f7f8f5;
  --surface: #fff;
  --ink: #172922;
  --secondary: #475a51;
  --link: #17604c;
  --line: #d7e0d9;
  --tint: #e9f3ec;
  --accent: #154b3c;
  --header-height: 4.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-height) + 1rem); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.8 "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a { color: var(--link); text-underline-offset: .22em; }
a:hover { text-decoration-thickness: .12em; }
:focus-visible { outline: .17rem solid var(--link); outline-offset: .2rem; }
.skip-link { position: fixed; z-index: 3; left: .75rem; top: .75rem; padding: .65rem 1rem; background: var(--surface); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.site-header { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner, .site-footer { width: min(100% - 3rem, 81rem); margin-inline: auto; }
.header-inner { min-height: var(--header-height); display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.wordmark { color: var(--ink); font-size: 1rem; font-weight: 750; text-decoration: none; line-height: 1.35; }
.header-toc { flex: none; font-size: .9rem; font-weight: 700; padding: .35rem .65rem; border-radius: .45rem; }
.header-toc:hover { background: var(--tint); }

.book-layout { width: min(100% - 3rem, 81rem); margin: 2.6rem auto 4rem; display: grid; grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr); gap: clamp(2rem, 4vw, 4.5rem); align-items: start; }
.home-layout { display: block; }
.book-nav {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  max-height: calc(100dvh - var(--header-height) - 2rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 .75rem .75rem 0;
  scrollbar-width: thin;
}
.nav-label { margin: .65rem 0 .35rem .65rem; font-size: .82rem; font-weight: 750; color: var(--secondary); }
.book-nav ul { list-style: none; margin: 0 0 1.2rem; padding: 0; }
.book-nav a { display: block; color: var(--ink); padding: .37rem .65rem; text-decoration: none; border-radius: .35rem; font-size: .89rem; line-height: 1.45; }
.book-nav a:hover, .book-nav a[aria-current] { background: var(--tint); }
.book-nav a[aria-current] { color: var(--link); font-weight: 750; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(9rem, 17rem);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 5rem);
  padding: clamp(1.7rem, 5.4vw, 5rem);
  border-radius: 1.4rem;
  background: #e7f0e8;
  border: 1px solid #d3e2d7;
}
.hero h1 { margin: .35rem 0 .8rem; max-width: 17ch; font-size: clamp(2.1rem, 4.5vw, 4.15rem); font-weight: 800; line-height: 1.14; letter-spacing: -.045em; }
.hero h1 span { display: block; color: var(--accent); font-size: .64em; font-weight: 650; margin-bottom: .45em; letter-spacing: -.025em; }
.volume, .author { font-weight: 750; color: var(--accent); }
.volume { font-size: .88rem; margin: 0; }
.description { color: var(--secondary); max-width: 34ch; margin: 1.1rem 0 .9rem; }
.author { margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1.2rem; margin-top: 1.45rem; font-size: .95rem; font-weight: 750; }
.button { display: inline-block; padding: .65rem 1rem; border-radius: .5rem; text-decoration: none; background: var(--accent); color: #fff; }
.button:hover { background: #0e3c2f; }
.cover { display: block; width: 100%; height: auto; border-radius: .35rem; box-shadow: 0 .75rem 2rem #17382a35; }

.prose, .pagination { max-width: 51rem; margin-inline: auto; }
.prose { min-width: 0; }
.contents { margin-top: 3rem; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.3; letter-spacing: -.023em; }
.prose h1 { font-size: clamp(1.95rem, 3.1vw, 2.85rem); margin: 0 0 1.3rem; }
.prose h2 { font-size: clamp(1.38rem, 2.15vw, 1.8rem); margin: 2.65rem 0 .9rem; }
.prose h3 { font-size: clamp(1.18rem, 1.75vw, 1.38rem); margin: 1.85rem 0 .7rem; }
.prose h4 { font-size: 1.08rem; margin: 1.55rem 0 .6rem; }
.contents > h2:first-child { font-size: clamp(1.75rem, 3vw, 2.5rem); margin-top: 0; }
.contents > h2:not(:first-child) { padding-top: 1rem; border-top: 1px solid var(--line); }
.prose p { margin: 0 0 1.05rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-inline-start: 1.6rem; }
.prose li + li { margin-top: .28rem; }
.prose li > p { margin: .28rem 0; }
.manuscript > :first-child { margin-top: 0; }
.section-toc { max-width: 42rem; margin: 0 0 1.65rem; padding: .75rem 1rem; border: 1px solid var(--line); background: var(--surface); border-radius: .5rem; }
.section-toc summary { cursor: pointer; font-weight: 750; font-size: .94rem; }
.section-toc ul { margin: .65rem 0 .1rem; font-size: .95rem; }
.prose img { display: block; margin: 1.7rem auto .55rem; max-width: 100%; height: auto; border-radius: .55rem; }
.prose img + em, .prose p:has(> img) + p > em { color: var(--secondary); font-size: .92rem; }
.prose blockquote { margin: 1.5rem 0; padding: .85rem 1.1rem; border-inline-start: .23rem solid var(--link); background: var(--tint); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2rem; }

code { font: .91em/1.55 "Cascadia Mono", "Consolas", monospace; word-break: normal; }
:not(pre) > code { color: #214d3d; background: var(--tint); padding: .1em .32em; border-radius: .24rem; }
.prose pre { max-width: 100%; margin: 1.1rem 0 1.5rem; padding: .95rem 1.1rem; overflow: auto; background: #172922; color: #f1f7f2; border-radius: .6rem; tab-size: 2; line-height: 1.6; }
pre code { overflow-wrap: normal; }
.code-tools { display: flex; justify-content: flex-end; margin: 1.15rem 0 .35rem; }
.code-tools + pre { margin-top: 0; }
.copy-code { appearance: none; color: var(--link); background: var(--surface); border: 1px solid var(--line); border-radius: .35rem; padding: .38rem .7rem; font: inherit; font-size: .86rem; font-weight: 700; line-height: 1.35; cursor: pointer; }
.copy-code:hover { background: var(--tint); }
.prose table { border-collapse: collapse; border-spacing: 0; font-size: .95rem; line-height: 1.6; margin: 1.1rem 0 1.5rem; display: block; max-width: 100%; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .6rem .75rem; min-width: 6.1rem; vertical-align: top; text-align: left; background: var(--surface); }
.prose th { background: var(--tint); }
.prose td { white-space: normal; }

.pagination { border-top: 1px solid var(--line); display: flex; gap: .75rem; margin-top: 2.75rem; padding-top: 1.1rem; }
.pagination a { display: flex; flex: 1; flex-direction: column; border: 1px solid var(--line); border-radius: .55rem; padding: .75rem; background: var(--surface); text-decoration: none; font-size: .94rem; font-weight: 700; line-height: 1.45; }
.pagination a:hover { background: var(--tint); }
.pagination small { color: var(--secondary); font-size: .83rem; margin-bottom: .25rem; }
.site-footer { border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem 1rem; padding: 1rem 0 2rem; color: var(--secondary); font-size: .86rem; }
.site-footer a { color: inherit; }

@media (max-width: 56rem) {
  .book-layout { display: block; }
  .book-nav { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(7rem, 33%); }
}
@media (max-width: 35rem) {
  :root { --header-height: 3.4rem; }
  .header-inner, .site-footer, .book-layout { width: calc(100% - 2rem); }
  .book-layout { margin-block: 1.25rem 2.8rem; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding: 1.25rem; border-radius: .95rem; }
  .hero h1 { font-size: clamp(1.88rem, 7.5vw, 2.8rem); }
  .cover { width: min(62%, 11.5rem); }
  .contents { margin-top: 2rem; }
  .prose table { font-size: .9rem; }
  .pagination { flex-direction: column; }
}
