/* =========================================================================
   The Startup CTO's Handbook (KO) — 에디토리얼/매거진 디자인 시스템
   본문: Pretendard · 디스플레이: Fraunces + Nanum Myeongjo · 라이트/다크
   ========================================================================= */

/* ---------- 디자인 토큰 ---------- */
:root {
  /* 타이포 */
  --font-body: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-serif: "Fraunces", "Nanum Myeongjo", Georgia, "Apple SD Gothic Neo", serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", ui-monospace, Menlo, monospace;

  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.7vw, 1.85rem);
  --step-3: clamp(1.85rem, 1.55rem + 1.4vw, 2.6rem);
  --step-4: clamp(2.4rem, 1.8rem + 2.8vw, 4rem);
  --step-5: clamp(3rem, 2rem + 4.6vw, 5.4rem);

  /* 간격 */
  --space-xs: 0.5rem;
  --space-sm: 0.875rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  --measure: 40rem;
  --header-h: 4rem;
  --radius: 4px;
  --radius-lg: 10px;

  /* 라이트 팔레트 (따뜻한 종이 + 러스트 강조) */
  --paper: #f6f3ea;
  --paper-2: #fffdf7;
  --paper-3: #efe9da;
  --ink: #1c1a16;
  --ink-soft: #46413a;
  --ink-mute: #76705f;
  --rule: #ddd4c2;
  --rule-strong: #c6bba4;
  --accent: #b1492a;
  --accent-deep: #8f351c;
  --accent-soft: rgba(177, 73, 42, 0.1);
  --accent-ink: #fffaf4;
  --shadow: 0 1px 2px rgba(28, 26, 22, 0.04), 0 12px 30px -18px rgba(28, 26, 22, 0.35);
  --shadow-lift: 0 2px 6px rgba(28, 26, 22, 0.06), 0 26px 50px -22px rgba(28, 26, 22, 0.45);
  --grain-opacity: 0.4;
  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #141310;
  --paper-2: #1c1a15;
  --paper-3: #24211a;
  --ink: #ece6d8;
  --ink-soft: #c2bba9;
  --ink-mute: #8f8975;
  --rule: #322e25;
  --rule-strong: #45402f;
  --accent: #e08a57;
  --accent-deep: #eba472;
  --accent-soft: rgba(224, 138, 87, 0.14);
  --accent-ink: #1a1610;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -18px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.4), 0 26px 50px -22px rgba(0, 0, 0, 0.8);
  --grain-opacity: 0.22;
  color-scheme: dark;
}

/* ---------- 리셋 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(
    140% 120% at 100% 0%,
    var(--paper-2) 0%,
    var(--paper) 55%
  );
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
  overflow-wrap: anywhere;
  min-height: 100vh;
}

/* 미세 그레인 텍스처 (종이 질감) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.18s ease;
}
a:hover {
  color: var(--accent-deep);
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- 레이아웃 컨테이너 ---------- */
.wrap {
  width: min(72rem, 100% - 2.5rem);
  margin-inline: auto;
}
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--step--1);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- 읽기 진행바 ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  z-index: 120;
  transition: width 0.1s linear;
}

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover {
  color: var(--ink);
}
.brand .brand-mark {
  color: var(--accent);
  font-style: italic;
}
.brand .brand-sub {
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--ink-mute);
  font-weight: 500;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--rule);
}
.icon-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}
.theme-toggle .moon {
  display: none;
}
html[data-theme="dark"] .theme-toggle .sun {
  display: none;
}
html[data-theme="dark"] .theme-toggle .moon {
  display: block;
}
.nav-toggle {
  display: none;
}

/* ---------- 푸터 ---------- */
.site-footer {
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding-block: var(--space-xl);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--space-lg);
}
.site-footer h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}
.site-footer p,
.site-footer li {
  color: var(--ink-mute);
  font-size: var(--step--1);
  line-height: 1.7;
}
.site-footer ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.site-footer .col-title {
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 0.8rem;
}
.footer-bottom {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: var(--step--1);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* =========================================================================
   홈 (랜딩)
   ========================================================================= */
.hero {
  padding-block: clamp(3rem, 8vw, 6.5rem) var(--space-xl);
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0.6rem 0 1rem;
  white-space: nowrap;
}
.hero-title .en {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.46em;
  letter-spacing: 0;
  margin-top: 0.7rem;
}
.hero-sub {
  font-size: var(--step-0);
  color: var(--ink-soft);
  max-width: 32rem;
  line-height: 1.6;
}
.hero-meta {
  margin-top: 1.4rem;
  color: var(--ink-mute);
  font-size: var(--step-0);
}
.hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: var(--space-lg);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--step-0);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.btn svg {
  width: 1.15rem;
  height: 1.15rem;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}
.btn-primary:hover {
  background: var(--accent-deep);
  color: var(--accent-ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.btn-ghost {
  border-color: var(--rule-strong);
  color: var(--ink);
  background: var(--paper-2);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* 표지 이미지 */
.hero-cover {
  justify-self: center;
  position: relative;
  perspective: 1600px;
}
.hero-cover img {
  width: min(20rem, 70vw);
  border-radius: 2px;
  box-shadow: var(--shadow-lift);
  transform: rotate(2.2deg);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero-cover:hover img {
  transform: rotate(0deg) translateY(-6px);
}
.hero-cover::after {
  content: "";
  position: absolute;
  inset: auto 8% -1.6rem 8%;
  height: 2.5rem;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.25), transparent 70%);
  filter: blur(8px);
  z-index: -1;
}

/* ---------- 목차 (카드 섹션) ---------- */
.toc-section {
  padding-block: var(--space-xl);
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
  border-bottom: 2px solid var(--ink);
}
.section-head h2 {
  font-family: var(--font-serif);
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-head .count {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-mute);
  font-size: var(--step-1);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.25rem;
}
.chapter-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.5rem 1.4rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.chapter-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.25s ease;
}
.chapter-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--rule-strong);
}
.chapter-card:hover::before {
  transform: scaleY(1);
}
.chapter-numeral {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.85;
}
.chapter-card h3 {
  font-family: var(--font-serif);
  font-size: var(--step-2);
  font-weight: 600;
  margin: 0.6rem 0 0.15rem;
  letter-spacing: -0.01em;
}
.chapter-card .ch-en {
  font-size: var(--step--1);
  color: var(--ink-mute);
  font-style: italic;
  letter-spacing: 0.02em;
}
.chapter-card ol {
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 0;
  display: grid;
  gap: 0.1rem;
  counter-reset: sec;
}
.chapter-card li a {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.45rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--step-0);
  transition: background 0.16s ease, color 0.16s ease;
}
.chapter-card li a::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.72em;
  color: var(--ink-mute);
  padding-top: 0.2em;
  flex: 0 0 auto;
  white-space: nowrap;
}
.chapter-card li a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.chapter-card.is-single a.card-link {
  margin-top: auto;
  padding-top: 1rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* =========================================================================
   본문 (절) 읽기 페이지
   ========================================================================= */
.reader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  padding-block: var(--space-xl);
}
.reader.no-toc {
  grid-template-columns: minmax(0, 1fr);
}
.reader.no-toc .prose,
.reader.no-toc .article-head {
  max-width: 44rem;
  margin-inline: auto;
}
.article-head {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--rule);
}
.article-head .crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.article-head .crumb a {
  text-decoration: none;
  color: var(--ink-mute);
  font-size: var(--step--1);
}
.article-head .crumb a:hover {
  color: var(--accent);
}
.article-head h1 {
  font-family: var(--font-serif);
  font-size: var(--step-4);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.article-head .title-en {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-1);
  color: var(--ink-mute);
}
.article-head .src-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  font-size: var(--step--1);
  color: var(--ink-mute);
  text-decoration: none;
}
.article-head .src-link:hover {
  color: var(--accent);
}
.article-head .src-link svg {
  width: 0.95rem;
  height: 0.95rem;
}

/* 본문 타이포 (.prose) */
.prose {
  max-width: var(--measure);
  font-size: var(--step-0);
  line-height: 1.85;
  color: var(--ink-soft);
}
.prose > * + * {
  margin-top: 1.4em;
}
.prose p {
  color: var(--ink-soft);
}
.prose strong {
  color: var(--ink);
  font-weight: 700;
}
.prose em {
  font-style: italic;
}
.prose .ct-heading {
  font-family: var(--font-serif);
  color: var(--ink);
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
  position: relative;
}
.prose h2.ct-heading {
  font-size: var(--step-2);
  font-weight: 600;
  margin-top: 2.6em;
  padding-top: 0.6em;
  border-top: 1px solid var(--rule);
  line-height: 1.25;
}
.prose h3.ct-heading {
  font-size: var(--step-1);
  font-weight: 600;
  margin-top: 2em;
  line-height: 1.3;
}
.prose h4 {
  font-size: var(--step-0);
  font-weight: 700;
  color: var(--ink);
  margin-top: 1.8em;
}
.ct-anchor {
  position: absolute;
  left: -1.3em;
  color: var(--rule-strong);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.16s ease;
  font-weight: 400;
}
.ct-heading:hover .ct-anchor {
  opacity: 1;
}
.prose a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.prose a:hover {
  text-decoration-color: var(--accent);
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li {
  margin-top: 0.5em;
}
.prose li::marker {
  color: var(--accent);
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.2em 0 0.2em 1.3em;
  color: var(--ink-mute);
  font-style: italic;
}
.prose blockquote p {
  color: var(--ink-mute);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--paper-3);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}
.prose pre {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1em 1.3em;
  overflow-x: auto;
}
.prose pre code {
  background: none;
  padding: 0;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.4em 0;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}
.prose th,
.prose td {
  text-align: left;
  padding: 0.6em 0.8em;
  border-bottom: 1px solid var(--rule);
}
.prose th {
  font-weight: 600;
  color: var(--ink);
  border-bottom: 2px solid var(--rule-strong);
}
.prose img {
  border-radius: var(--radius);
  margin-inline: auto;
}
/* 도입부 첫 문단 드롭캡 */
.prose > p:first-of-type::first-letter {
  font-family: var(--font-serif);
  float: left;
  font-size: 3.4em;
  line-height: 0.78;
  font-weight: 600;
  padding: 0.05em 0.12em 0 0;
  color: var(--accent);
}

/* ---------- 사이드 TOC (스크롤스파이) ---------- */
.toc-rail {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
  font-size: var(--step--1);
}
.toc-rail .toc-title {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  font-size: 0.72rem;
  margin-bottom: 0.9rem;
}
.toc-rail ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--rule);
}
.toc-rail li a {
  display: block;
  padding: 0.32rem 0 0.32rem 0.9rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-mute);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.16s ease, border-color 0.16s ease;
}
.toc-rail li.lvl-3 a {
  padding-left: 1.6rem;
  font-size: 0.95em;
}
.toc-rail li a:hover {
  color: var(--ink);
}
.toc-rail li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- 이전/다음 내비 ---------- */
.pager {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--rule);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.2rem;
  border: none;
  background: transparent;
  text-decoration: none;
  transition: color 0.18s ease;
}
.pager a:hover {
  border-color: var(--accent);
}
.pager a.next {
  text-align: right;
  align-items: flex-end;
}
.pager .dir {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--step--2);
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.pager .dir svg {
  width: 0.85em;
  height: 0.85em;
}
.pager .ttl {
  font-size: var(--step--1);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
}
.pager a:hover .ttl {
  color: var(--accent);
}
.pager .empty {
  border: 1px dashed var(--rule);
  background: transparent;
  pointer-events: none;
}

/* =========================================================================
   검색 (Pagefind) 모달
   ========================================================================= */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  padding: 8vh 1rem 1rem;
  background: color-mix(in srgb, var(--ink) 35%, transparent);
  backdrop-filter: blur(4px);
}
.search-modal.open {
  display: block;
}
.search-panel {
  width: min(40rem, 100%);
  margin-inline: auto;
  background: var(--paper-2);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.search-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: var(--step--1);
}
#search-host {
  padding: 1rem 1.2rem 1.4rem;
  overflow-y: auto;
}
/* Pagefind UI 테마 변수 */
.pagefind-ui {
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--paper-2);
  --pagefind-ui-border: var(--rule);
  --pagefind-ui-tag: var(--paper-3);
  --pagefind-ui-border-radius: var(--radius);
  --pagefind-ui-font: var(--font-body);
}

/* =========================================================================
   진입 애니메이션
   ========================================================================= */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.reveal {
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.reveal-1 {
  animation-delay: 0.05s;
}
.reveal-2 {
  animation-delay: 0.15s;
}
.reveal-3 {
  animation-delay: 0.25s;
}
.reveal-4 {
  animation-delay: 0.35s;
}

/* =========================================================================
   반응형
   ========================================================================= */
@media (max-width: 1024px) {
  .reader {
    grid-template-columns: minmax(0, 1fr);
  }
  .toc-rail {
    display: none;
  }
  .prose {
    max-width: 44rem;
    margin-inline: auto;
  }
}

@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-title {
    white-space: normal;
  }
  .hero-sub {
    margin-inline: auto;
  }
  .hero-cta {
    justify-content: center;
  }
  .hero-cover {
    order: -1;
  }
  .hero-cover img {
    width: min(16rem, 56vw);
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .nav-toggle {
    display: inline-grid;
  }
  .desktop-only {
    display: none;
  }
}

@media (max-width: 560px) {
  .brand {
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager a.empty {
    display: none;
  }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .prose > p:first-of-type::first-letter {
    font-size: 2.8em;
  }
}

/* 모바일 슬라이드 메뉴 */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  background: var(--paper);
  padding: calc(var(--header-h) + 1rem) 1.5rem 2rem;
  overflow-y: auto;
}
.mobile-nav.open {
  display: block;
}
.mobile-nav h2 {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  margin: 1.4rem 0 0.5rem;
}
.mobile-nav a {
  display: block;
  padding: 0.55rem 0;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.mobile-nav a:hover {
  color: var(--accent);
}
.mobile-nav .close-row {
  position: absolute;
  top: 0;
  right: 1rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
}
