:root {
  color-scheme: light dark;
  --bg: #f5f0e7;
  --surface: #fffaf1;
  --surface-strong: #eee4d4;
  --text: #251f1a;
  --muted: #70675e;
  --line: #d6c9b8;
  --accent: #9a3d2e;
  --accent-strong: #70291f;
  --accent-soft: #f1d4c9;
  --gold: #b18238;
  --shadow: 0 18px 50px rgb(73 47 30 / 10%);
  --serif: Georgia, "Times New Roman", "Noto Serif KR", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}

html[data-theme="dark"] {
  --bg: #171412;
  --surface: #211d19;
  --surface-strong: #2b2520;
  --text: #f2e9dc;
  --muted: #b9ac9d;
  --line: #453b33;
  --accent: #e28b75;
  --accent-strong: #f0ab98;
  --accent-soft: #472a23;
  --gold: #d0a55f;
  --shadow: 0 18px 50px rgb(0 0 0 / 24%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--accent-soft) 50%, transparent), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  line-height: 1.6;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-strong); }
button, audio { font: inherit; }
.shell { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.skip-link {
  position: fixed; z-index: 20; left: 1rem; top: 1rem; transform: translateY(-180%);
  padding: 0.7rem 1rem; border-radius: 0.5rem; background: var(--text); color: var(--bg);
}
.skip-link:focus { transform: translateY(0); }
.site-header {
  position: sticky; top: 0; z-index: 15;
  width: 100%; margin: 0; min-height: 64px; padding-inline: max(1rem, calc((100% - 1280px) / 2));
  display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.reading-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 16; height: 3px; background: transparent; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 80ms linear; }
.lang-menu { position: relative; }
.lang-menu summary {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.75rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); list-style: none; font-size: 0.9rem;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { border-color: var(--accent); }
.lang-menu[open] summary { border-color: var(--accent); }
.lang-list {
  position: absolute; right: 0; top: calc(100% + 0.45rem); z-index: 30; min-width: 11rem; margin: 0; padding: 0.4rem;
  max-height: min(70vh, 28rem); overflow-y: auto; overscroll-behavior: contain;
  list-style: none; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--surface); box-shadow: var(--shadow);
}
.lang-list a {
  display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.45rem 0.7rem; border-radius: 0.45rem;
  font-size: 0.88rem; text-decoration: none;
}
.lang-list a:hover { background: var(--accent-soft); }
.lang-list a[aria-current="page"] { color: var(--accent-strong); font-weight: 750; }
.lang-list a[aria-current="page"]::after { content: "✓"; }
.lang-banner {
  position: fixed; z-index: 12; left: 50%; bottom: 1rem; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.35rem; max-width: calc(100% - 2rem); padding: 0.5rem 0.6rem 0.5rem 1rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 0.88rem;
}
.lang-banner a { color: var(--accent-strong); font-weight: 750; text-decoration: none; }
.lang-banner button { border: 0; background: none; padding: 0.2rem 0.45rem; color: var(--muted); font-size: 1rem; cursor: pointer; }
.edition-strip { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin: 1.6rem 0 0; padding: 0; list-style: none; }
.edition-strip a { color: var(--muted); font-size: 0.85rem; text-decoration: none; border-bottom: 1px solid transparent; }
.edition-strip a:hover { color: var(--accent-strong); border-bottom-color: currentcolor; }
.chapter-translations { display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; margin-top: 0.2rem; padding-top: 0.5rem; border-top: 1px dashed var(--line); }
.chapter-translations a { color: var(--muted); font-size: 0.74rem; text-decoration: none; }
.chapter-translations a:hover { color: var(--accent-strong); }
.badge.lang { color: #6b4f1d; background: #f0e4c8; }
html[data-theme="dark"] .badge.lang { color: #ecd9ab; background: #46381f; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-weight: 750; text-decoration: none; letter-spacing: -0.02em; }
.brand-logo { width: 3.15rem; height: 3.15rem; object-fit: contain; }
html[data-theme="dark"] .brand-logo { filter: invert(1); }
.site-nav { display: flex; align-items: center; gap: 1.2rem; font-size: 0.9rem; }
.site-nav a { text-decoration: none; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--text); padding: 0.45rem 0.75rem; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.65fr); gap: clamp(2rem, 7vw, 7rem); align-items: center; padding-block: clamp(4rem, 9vw, 8rem); }
.eyebrow { margin: 0 0 0.7rem; color: var(--accent); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: -0.035em; line-height: 1.05; }
.hero h1 { max-width: 10ch; margin: 0; font-size: clamp(3.5rem, 10vw, 7.75rem); font-weight: 500; }
.author { margin: 1rem 0 0; color: var(--gold); font-family: var(--serif); font-size: 1.2rem; font-style: italic; }
.lede { max-width: 55ch; margin: 1.8rem 0 0; color: var(--muted); font-family: var(--serif); font-size: clamp(1.15rem, 1rem + 0.8vw, 1.55rem); line-height: 1.55; }
.lede.compact { max-width: 62ch; margin-top: 1rem; font-size: 1.1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.button { display: inline-flex; justify-content: center; padding: 0.75rem 1rem; border-radius: 999px; font-size: 0.9rem; font-weight: 700; text-decoration: none; }
.button.primary { background: var(--accent); color: #fffaf3; }
.button.primary:hover { background: var(--accent-strong); color: #fff; }
.button.secondary { border: 1px solid var(--line); background: var(--surface); }
.book-card {
  position: relative; overflow: hidden; min-height: 380px; padding: 2rem; border: 1px solid var(--line); border-radius: 1rem;
  display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(145deg, var(--accent-soft), var(--surface)); box-shadow: var(--shadow);
}
.book-card::after { content: ""; position: absolute; right: -4rem; bottom: -4rem; width: 13rem; aspect-ratio: 1; border: 1px solid var(--accent); border-radius: 50%; opacity: 0.3; }
.book-monogram { font-family: var(--serif); font-size: 5rem; color: var(--accent); letter-spacing: -0.1em; }
.book-card p { margin: 0.2rem 0; font-size: 0.9rem; color: var(--muted); }
.chapter-section { padding-bottom: 7rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-heading h2 { margin: 0; font-size: clamp(2.1rem, 5vw, 3.8rem); font-weight: 500; }
.section-note { color: var(--muted); font-size: 0.85rem; }
.chapter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.chapter-card { display: grid; grid-template-columns: 4.2rem 1fr; gap: 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: 0.8rem; background: color-mix(in srgb, var(--surface) 86%, transparent); }
.chapter-number { color: var(--line); font-family: var(--serif); font-size: 2.5rem; line-height: 1; }
.chapter-card h3 { margin: 0 0 0.85rem; font-size: 1.15rem; }
.chapter-links { display: flex; flex-direction: column; gap: 0.45rem; }
.chapter-links a { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; color: var(--muted); font-size: 0.78rem; text-decoration: none; }
.chapter-links a:hover { color: var(--accent-strong); }
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.67rem; font-weight: 750; letter-spacing: 0.02em; white-space: nowrap; }
.badge.easy { color: #23614d; background: #d7eee5; }
.badge.parallel { color: #5e4183; background: #e8def3; }
.badge.ko { color: #285e83; background: #dbeaf4; }
html[data-theme="dark"] .badge.easy { color: #b9ead6; background: #214438; }
html[data-theme="dark"] .badge.parallel { color: #ddc5f5; background: #3d2c52; }
html[data-theme="dark"] .badge.ko { color: #c7e2f5; background: #253e50; }
.reader, .parallel-reader { width: min(100% - 2rem, 1040px); padding-block: clamp(3rem, 7vw, 6rem); }
.reader { max-width: 790px; }
.reader-header { margin-bottom: 2.4rem; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 2.4rem; color: var(--muted); font-size: 0.78rem; }
.reader-header h1 { margin: 0; font-size: clamp(3.1rem, 8vw, 6.2rem); font-weight: 500; }
.reader-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.3rem; color: var(--muted); font-size: 0.78rem; }
.audio-panel { display: grid; grid-template-columns: 1fr minmax(240px, 0.9fr); align-items: center; gap: 1.5rem; margin: 0 0 2.8rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--surface); box-shadow: var(--shadow); }
.audio-panel h2 { margin: 0; font-family: var(--sans); font-size: 1.05rem; letter-spacing: -0.02em; }
.audio-panel p:not(.eyebrow) { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.78rem; }
.audio-panel audio { width: 100%; }
.audio-pending { border-style: dashed; box-shadow: none; }
.prose { max-width: 68ch; margin-inline: auto; font-family: var(--serif); font-size: clamp(1.12rem, 1.02rem + 0.5vw, 1.38rem); line-height: 1.88; letter-spacing: 0.003em; }
.reader-ko .prose { word-break: keep-all; line-height: 2; }
.prose p { margin: 0 0 1.55em; }
.prose p:first-child:not(.no-dropcap)::first-letter { float: left; margin: 0.08em 0.12em 0 0; color: var(--accent); font-size: 3.4em; line-height: 0.78; }
.read-cue { border-radius: 0.2rem; background: transparent; color: inherit; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color 130ms ease, color 130ms ease; }
.read-cue.is-active { background: #ffd86f; color: #332005; box-shadow: 0 0 0 0.16em #ffd86f; }
.follow-text-button { position: fixed; z-index: 10; right: 1rem; bottom: 1rem; padding: 0.55rem 0.85rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); font-size: 0.82rem; font-weight: 750; cursor: pointer; }
.follow-text-button:hover { border-color: var(--accent); background: var(--accent-soft); }
.audio-disclosure { color: var(--muted); font-size: 0.7rem !important; }
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.chapter-nav a { display: flex; flex-direction: column; text-decoration: none; font-family: var(--serif); font-size: 1.1rem; }
.chapter-nav a span { color: var(--muted); font-family: var(--sans); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.chapter-nav .next { text-align: right; }
.parallel-reader { max-width: 1180px; }
.parallel-header { max-width: 820px; }
.alignment-note { max-width: 72ch; padding: 0.75rem 0.9rem; border-left: 3px solid var(--gold); background: var(--surface); color: var(--muted); font-size: 0.82rem; }
.alignment-note.needs-review { border-left-color: var(--accent); }
.alignment-note strong { color: var(--accent-strong); }
.parallel-labels { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-left: 3.5rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.parallel-pairs { margin: 0; padding: 0; list-style: none; }
.parallel-pair { display: grid; grid-template-columns: 2.5rem 1fr 1fr; gap: 1rem 2rem; padding-block: 1.5rem; border-bottom: 1px solid var(--line); }
.pair-number { color: var(--gold); font-family: var(--serif); font-size: 0.9rem; }
.parallel-pair section { min-width: 0; }
.parallel-pair h2 { display: none; }
.parallel-pair p { max-width: 58ch; margin: 0; font-family: var(--serif); font-size: clamp(1rem, 0.97rem + 0.18vw, 1.14rem); line-height: 1.75; }
.easy-stack { display: grid; gap: 0.8rem; }
.easy-stack p + p { padding-top: 0.8rem; border-top: 1px dashed var(--line); }
.parallel-pair .missing-pair { color: var(--muted); font-family: var(--sans); font-size: 0.78rem; font-style: italic; }
.site-footer { width: min(1280px, calc(100% - 2rem)); margin: 0 auto; min-height: 110px; padding-block: 1.5rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 0.75rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-block: 3.5rem; }
  .hero h1 { font-size: clamp(3.4rem, 17vw, 5.5rem); }
  .book-card { min-height: 250px; }
  .chapter-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; gap: 0.5rem; }
  .audio-panel { grid-template-columns: 1fr; }
  .parallel-labels { display: none; }
  .parallel-pair { grid-template-columns: 2.2rem 1fr; gap: 1rem; }
  .parallel-pair section { grid-column: 2; }
  .parallel-pair h2 { display: block; margin: 0 0 0.45rem; color: var(--muted); font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
  .pair-number { grid-row: 1 / span 2; }
}

@media (max-width: 480px) {
  .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lang-current { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .site-nav { gap: 0.7rem; }
  .chapter-card { grid-template-columns: 3rem 1fr; padding: 1rem; }
  .chapter-number { font-size: 2rem; }
  .chapter-links a { align-items: flex-start; flex-direction: column; }
  .site-footer { flex-direction: column; justify-content: center; gap: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
