@charset "UTF-8";

:root {
  color-scheme: dark;
  --bg: #081613;
  --surface: #10231e;
  --surface-2: #183129;
  --surface-3: #1e3a30;
  --ink: #f3f5e9;
  --muted: #adc3b7;
  --line: rgba(204, 239, 214, .15);
  --accent: #b8ef91;
  --accent-ink: #102514;
  --warm: #ff7853;
  --prose: #e5eae0;
  --shadow: 0 26px 75px rgba(0, 0, 0, .35);
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Iowan Old Style, Palatino Linotype, Book Antiqua, Georgia, serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6ef;
  --surface: #fffefa;
  --surface-2: #edf2e8;
  --surface-3: #e3ecdf;
  --ink: #15231d;
  --muted: #516358;
  --line: rgba(35, 70, 48, .15);
  --accent: #207b51;
  --accent-ink: #fff;
  --warm: #c34c2a;
  --prose: #26342c;
  --shadow: 0 25px 65px rgba(35, 55, 37, .13);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; background: var(--bg); color: var(--ink); font-family: var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--warm); outline-offset: 4px; }
.skip-link { position: fixed; z-index: 100; top: -100px; left: 1rem; padding: .8rem 1rem; background: var(--accent); color: var(--accent-ink); border-radius: .5rem; }
.skip-link:focus { top: 1rem; }

.site-header { position: relative; z-index: 30; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 91%, transparent); backdrop-filter: blur(18px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: min(100% - 3rem, 1370px); min-height: 72px; margin: auto; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-size: .93rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 50%; color: var(--accent); font-size: 1.25rem; }
.header-actions { display: flex; align-items: center; gap: .6rem; }
.theme-button, .nav-button { min-height: 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; transition: background .2s ease, transform .2s ease; }
.theme-button:hover, .nav-button:hover { background: var(--surface-2); transform: translateY(-1px); }
.theme-button { width: 38px; font-size: 1.22rem; }
.nav-button { display: none; padding: 0 1rem; font-size: .85rem; font-weight: 700; }

.hero { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 67% 8%, rgba(23, 113, 76, .28), transparent 38%), radial-gradient(ellipse at 4% 100%, rgba(47, 102, 91, .22), transparent 36%), #0a1917; color: #f4f6ea; }
.hero::after { content: ""; position: absolute; z-index: -1; inset: auto -15% -30% 35%; height: 80%; border: 1px solid rgba(183, 239, 145, .08); border-radius: 50%; transform: rotate(-18deg); box-shadow: 0 0 0 85px rgba(183,239,145,.025), 0 0 0 170px rgba(183,239,145,.018); }
.hero-stars { position: absolute; z-index: -1; inset: 0; opacity: .6; background-image: radial-gradient(circle, rgba(219,248,224,.75) 1px, transparent 1.5px), radial-gradient(circle, rgba(219,248,224,.45) 1px, transparent 1.5px); background-size: 127px 143px, 173px 189px; background-position: 20px 16px, 79px 87px; mask-image: linear-gradient(90deg, transparent, #000 55%); }
.hero-inner { display: grid; grid-template-columns: minmax(290px, .82fr) minmax(420px, 1.18fr); align-items: center; gap: clamp(3rem, 8vw, 7rem); width: min(100% - 5rem, 1200px); min-height: 670px; margin: auto; padding: 5.4rem 0 6.2rem; }
.cover-wrap { position: relative; justify-self: center; width: min(100%, 365px); transform: rotate(-3deg); }
.cover-wrap::before { content: ""; position: absolute; z-index: -1; inset: 8% -15% -5% 13%; border-radius: 50%; background: #1ba76c; filter: blur(60px); opacity: .34; }
.book-cover { width: 100%; height: auto; border-radius: 3px 11px 11px 3px; box-shadow: 8px 18px 0 rgba(0,0,0,.19), 18px 35px 55px rgba(0,0,0,.48); }
.hero-copy { max-width: 700px; }
.eyebrow { margin: 0 0 1.3rem; color: var(--accent); font-size: .76rem; font-weight: 800; letter-spacing: .19em; text-transform: uppercase; }
.hero h1 { margin: 0; font-family: var(--serif); font-size: clamp(3.7rem, 6.4vw, 6.25rem); font-weight: 700; letter-spacing: -.045em; line-height: 1.04; text-wrap: balance; }
.hero h1 em { display: block; color: #c6efa6; font-weight: 500; }
.hero-author { margin: 1.5rem 0 2rem; color: #d4e8d8; font-size: .94rem; font-weight: 680; letter-spacing: .09em; text-transform: uppercase; }
.hero-description { max-width: 57ch; color: #d6e1d7; font-family: var(--serif); font-size: 1.16rem; line-height: 1.65; }
.hero-description p { margin: 0; }
.hero-description em { font-style: normal; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2.3rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 1.35rem; min-height: 50px; padding: .8rem 1.4rem; border: 1px solid rgba(198,239,166,.38); border-radius: 999px; font-size: .88rem; font-weight: 760; text-decoration: none; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.button:hover { transform: translateY(-3px); }
.button-primary { border-color: #c5eea3; background: #c5eea3; color: #142c1b; box-shadow: 0 10px 28px rgba(177,236,136,.16); }
.button-primary:hover { background: #def7c5; }
.button-secondary { color: #e6f3dc; }
.button-secondary:hover { background: rgba(198,239,166,.12); }
.hero-note { margin: 1.25rem 0 0; color: #9eb8a9; font-size: .79rem; }

.toc-section { width: min(100% - 4rem, 1080px); margin: auto; padding: clamp(5rem, 8vw, 8rem) 0 7rem; }
.section-heading { max-width: 640px; margin-bottom: 2.7rem; }
.section-heading h2 { margin: 0 0 .8rem; font-family: var(--serif); font-size: clamp(2.8rem, 5vw, 4.4rem); font-weight: 600; letter-spacing: -.04em; }
.section-heading p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }
.preface-card { display: grid; grid-template-columns: 62px 1fr auto 30px; align-items: center; gap: 1rem; min-height: 82px; margin-bottom: 1.1rem; padding: 1rem 1.35rem; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 14px; background: linear-gradient(100deg, var(--surface-2), var(--surface)); text-decoration: none; transition: transform .2s ease, border-color .2s ease; }
.preface-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.preface-card strong { font-family: var(--serif); font-size: 1.35rem; }
.preface-card > span:nth-last-child(2) { color: var(--muted); font-size: .82rem; }
.preface-card > span:last-child { color: var(--accent); font-size: 1.2rem; }
.toc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; padding: 0; margin: 0; list-style: none; }
.toc-grid li a { display: grid; grid-template-columns: 45px minmax(0, 1fr) auto 20px; align-items: center; gap: .7rem; min-height: 79px; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.toc-grid li a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 65%, transparent); background: var(--surface-2); }
.toc-number { color: var(--accent); font-family: var(--serif); font-size: 1.14rem; font-variant-numeric: tabular-nums; }
.toc-name { overflow: hidden; font-family: var(--serif); font-size: 1.13rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.toc-time { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.toc-arrow { color: var(--accent); font-size: 1rem; }
.end-note { display: flex; align-items: center; justify-content: center; gap: 1.2rem; padding: 2rem 2rem 5rem; color: var(--muted); text-align: center; }
.end-note span { color: var(--accent); font-size: 1.4rem; }
.end-note p { margin: 0; font-family: var(--serif); font-size: 1.2rem; font-style: italic; }

.reading-progress { position: fixed; z-index: 100; top: 0; left: 0; width: 100%; height: 3px; transform: scaleX(0); transform-origin: left; background: var(--accent); }
.reader-layout { display: grid; grid-template-columns: 275px minmax(0, 1fr); max-width: 1500px; min-height: calc(100vh - 73px); margin: auto; }
.reader-sidebar { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); scrollbar-width: thin; }
.sidebar-heading { display: grid; gap: .55rem; padding: 2.1rem 1.45rem 1.6rem; border-bottom: 1px solid var(--line); }
.sidebar-heading span { color: var(--accent); font-size: .65rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.sidebar-heading strong { font-family: var(--serif); font-size: 1.35rem; line-height: 1.2; }
.sidebar-chapters { display: grid; gap: 2px; padding: .8rem; }
.sidebar-link { display: grid; grid-template-columns: 30px 1fr; align-items: start; gap: .5rem; padding: .68rem .7rem; border-radius: 8px; color: var(--muted); font-size: .81rem; line-height: 1.45; text-decoration: none; }
.sidebar-link:hover { background: var(--surface); color: var(--ink); }
.sidebar-link.is-active { background: var(--surface-2); color: var(--ink); font-weight: 730; }
.sidebar-number { color: var(--accent); font-variant-numeric: tabular-nums; }
.sidebar-backdrop { display: none; }
.reading-main { width: min(100% - 6rem, 880px); margin: 0 auto; padding: 3.2rem 0 7rem; }
.reading-topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .75rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.reading-topline a { color: var(--muted); text-decoration: none; }
.reading-topline a:hover { color: var(--accent); }
.chapter-article { width: min(100%, 69ch); margin: 5rem auto 0; }
.chapter-heading { margin-bottom: 4rem; text-align: center; }
.chapter-heading h1 { margin: 0; font-family: var(--serif); font-size: clamp(2.75rem, 5vw, 4.8rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; text-wrap: balance; }
.heading-rule { display: flex; align-items: center; gap: 1rem; width: min(100%, 250px); margin: 2.7rem auto 0; color: var(--accent); }
.heading-rule::before, .heading-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.heading-rule span { font-size: 1rem; }
.book-prose { color: var(--prose); font-family: var(--serif); font-size: clamp(1.06rem, 1.5vw, 1.19rem); line-height: 1.82; overflow-wrap: break-word; }
.book-prose p { margin: 0 0 1.35em; }
.book-prose p:first-child { margin-bottom: 1.8em; }
.book-prose strong { color: var(--ink); }
.book-prose em { font-style: italic; }
.book-prose a { color: var(--accent); text-underline-offset: 3px; }
.book-prose blockquote { margin: 2rem 0; padding: .2rem 0 .2rem 1.4rem; border-left: 3px solid var(--accent); color: var(--muted); }
.book-prose hr { width: 80px; height: 1px; margin: 3rem auto; border: 0; background: var(--line); }
.chapter-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; width: min(100%, 69ch); margin: 5rem auto 0; padding-top: 2rem; border-top: 1px solid var(--line); }
.chapter-nav-card { display: flex; flex-direction: column; gap: .45rem; min-height: 102px; padding: 1.15rem 1.3rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); text-decoration: none; transition: transform .2s ease, border-color .2s ease; }
.chapter-nav-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.chapter-nav-card.is-next { grid-column: 2; text-align: right; }
.chapter-nav-card span { color: var(--accent); font-size: .72rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.chapter-nav-card strong { font-family: var(--serif); font-size: 1.15rem; }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; width: min(100% - 3rem, 1200px); margin: auto; padding: 1.8rem 0; color: var(--muted); font-size: .77rem; line-height: 1.5; }
.footer-inner span:last-child { display: flex; flex-wrap: wrap; gap: .35rem; }
.footer-inner a { text-underline-offset: 3px; }
.footer-inner a:hover { color: var(--accent); }

@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: minmax(240px, .75fr) minmax(0, 1.25fr); gap: 3rem; width: min(100% - 3rem, 900px); }
  .hero h1 { font-size: clamp(3.4rem, 6vw, 5rem); }
  .reader-layout { grid-template-columns: 235px minmax(0, 1fr); }
  .reading-main { width: min(100% - 4rem, 760px); }
}

@media (max-width: 760px) {
  .header-inner { width: min(100% - 2rem, 720px); min-height: 62px; }
  .brand { font-size: .79rem; letter-spacing: .055em; }
  .brand-mark { width: 27px; height: 27px; }
  .hero-inner { display: flex; flex-direction: column; gap: 3.5rem; width: min(100% - 2.5rem, 600px); min-height: unset; padding: 3.2rem 0 5rem; }
  .cover-wrap { width: min(60vw, 290px); }
  .hero-copy { align-self: stretch; }
  .hero h1 { font-size: clamp(3.25rem, 9vw, 5.1rem); }
  .toc-section { width: min(100% - 2rem, 620px); padding: 4rem 0 5rem; }
  .toc-grid { grid-template-columns: 1fr; }
  .nav-button { display: inline-block; }
  .reader-layout { display: block; }
  .reader-sidebar { position: fixed; z-index: 50; top: 0; left: 0; width: min(85vw, 320px); height: 100dvh; transform: translateX(-105%); box-shadow: var(--shadow); transition: transform .25s ease; }
  .reader-layout.nav-open .reader-sidebar { transform: translateX(0); }
  .reader-layout.nav-open .sidebar-backdrop { display: block; position: fixed; z-index: 40; inset: 0; background: rgba(0,0,0,.65); }
  .reading-main { width: min(100% - 2.5rem, 650px); padding: 2.2rem 0 5rem; }
  .chapter-article { margin-top: 3.5rem; }
  .chapter-heading { margin-bottom: 3rem; }
}

@media (max-width: 480px) {
  .hero-inner { width: min(100% - 2rem, 440px); }
  .hero h1 { font-size: clamp(2.9rem, 11vw, 4rem); }
  .hero-buttons .button { width: 100%; }
  .toc-grid li a { grid-template-columns: 36px minmax(0, 1fr) 18px; min-height: 70px; }
  .toc-time { display: none; }
  .preface-card { grid-template-columns: 35px 1fr 22px; gap: .6rem; }
  .preface-card > span:nth-last-child(2) { display: none; }
  .book-prose { font-size: 1.09rem; line-height: 1.79; }
  .chapter-next { grid-template-columns: 1fr; }
  .chapter-nav-card.is-next { grid-column: 1; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

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

@media print {
  :root { color-scheme: light; }
  body { background: white; color: black; }
  .site-header, .site-footer, .reader-sidebar, .reading-progress, .reading-topline, .chapter-next, .sidebar-backdrop { display: none !important; }
  .reader-layout { display: block; }
  .reading-main { width: auto; padding: 0; }
  .chapter-article { width: auto; margin: 0; }
  .book-prose { color: black; font-size: 11pt; }
  .chapter-heading { margin-bottom: 1.5rem; }
  .chapter-heading h1 { color: black; font-size: 24pt; }
}
