:root {
  --ink: #211914;
  --muted: #75695f;
  --paper: #f7f1e6;
  --paper-deep: #eee3d1;
  --accent: #bb5b36;
  --accent-dark: #7f321e;
  --night: #17120f;
  --night-soft: #231a16;
  --line: rgba(56, 39, 29, 0.17);
  --reader-font-size: 19px;
  --reader-line-height: 1.75;
  --reader-font: Georgia, 'Times New Roman', serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--night); color: #f8f1e8; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid #e99d76; outline-offset: 3px; }
[hidden] { display: none !important; }

.library-view { min-height: 100dvh; overflow: hidden; background: radial-gradient(circle at 75% 8%, rgba(187,91,54,.19), transparent 28%), linear-gradient(140deg, #120e0c, #201612 52%, #110d0b); }
.site-nav { height: 86px; padding: 0 clamp(22px, 5vw, 80px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08); }
.wordmark { color: #fff8ef; text-decoration: none; letter-spacing: .22em; font-weight: 800; font-size: 14px; }
.wordmark span { display: block; margin-top: 3px; color: #c69276; font-size: 8px; letter-spacing: .52em; font-weight: 600; }
.nav-action { border: 0; background: transparent; color: #e8d6ca; padding: 10px 0; border-bottom: 1px solid rgba(232,214,202,.4); }

.hero { width: min(1420px, 100%); min-height: calc(100dvh - 86px); margin: auto; padding: clamp(56px, 7vw, 110px) clamp(24px, 6vw, 92px); display: grid; grid-template-columns: 1.02fr .98fr; align-items: center; gap: clamp(40px, 7vw, 120px); }
.eyebrow { margin: 0 0 18px; color: #bd7b5a; font-size: 11px; letter-spacing: .25em; font-weight: 800; }
.hero h1 { margin: 0; max-width: 680px; color: #fff8ef; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(62px, 8.4vw, 132px); line-height: .82; letter-spacing: -.055em; font-weight: 500; }
.hero h1 em { color: #c9653f; font-weight: 400; }
.subtitle { max-width: 620px; margin: 34px 0; color: #cdbcb2; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(18px, 2vw, 25px); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.primary-button, .secondary-button { min-height: 52px; padding: 0 24px; border-radius: 999px; font-weight: 750; }
.primary-button { border: 1px solid #d87c53; background: #c4613c; color: white; box-shadow: 0 12px 35px rgba(153,63,31,.33); }
.primary-button:hover { transform: translateY(-1px); background: #d06b43; }
.secondary-button { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.05); color: #f7eee7; }
.resume-hint { min-height: 20px; margin-top: 18px; color: #9f8d81; font-size: 13px; }

.cover-stage { position: relative; display: grid; place-items: center; min-height: 630px; perspective: 1300px; }
.book-cover { position: relative; width: min(390px, 72vw); aspect-ratio: .67; padding: 58px 46px 42px; overflow: hidden; background: radial-gradient(circle at 75% 18%, rgba(227,145,99,.18), transparent 24%), linear-gradient(145deg, #2a1712, #0e0b0a 65%, #24120e); border: 1px solid rgba(255,226,205,.22); border-radius: 5px 16px 16px 5px; transform: rotateY(-11deg) rotateZ(1.2deg); box-shadow: -24px 28px 80px rgba(0,0,0,.55), inset 0 0 70px rgba(255,255,255,.025); }
.book-cover::before { content: ''; position: absolute; inset: 12px; border: 1px solid rgba(207,112,70,.35); pointer-events: none; }
.cover-spine { position: absolute; left: 0; top: 0; bottom: 0; width: 18px; background: linear-gradient(90deg, #0b0807, #452117 65%, #160c09); box-shadow: 8px 0 13px rgba(0,0,0,.4); }
.cover-stars { color: #d4845b; letter-spacing: .15em; font-size: 18px; }
.cover-kicker { margin-top: 92px; color: #a98f80; font-size: 9px; letter-spacing: .24em; font-weight: 700; }
.book-cover h2 { margin: 18px 0 34px; color: #fff4e9; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(48px, 5.3vw, 72px); line-height: .87; letter-spacing: -.04em; font-weight: 500; }
.book-cover h2 i { color: #cf6f48; font-weight: 400; }
.cover-rule { width: 48px; height: 1px; background: #c67650; }
.cover-author { margin-top: 20px; color: #efe2d7; letter-spacing: .35em; font-size: 12px; }
.book-shadow { position: absolute; width: 70%; height: 38px; bottom: 45px; border-radius: 50%; background: rgba(0,0,0,.55); filter: blur(16px); transform: rotate(-2deg); z-index: -1; }

.experience-section { padding: 110px clamp(24px, 6vw, 92px) 125px; background: #f1e8db; color: var(--ink); }
.experience-section > h2 { max-width: 780px; margin: 0 0 58px; font: 500 clamp(42px, 5.8vw, 80px)/.98 Georgia, 'Times New Roman', serif; letter-spacing: -.045em; }
.experience-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(45,28,20,.22); }
.experience-grid article { padding: 34px clamp(16px, 3vw, 40px) 10px 0; border-right: 1px solid rgba(45,28,20,.17); }
.experience-grid article + article { padding-left: clamp(18px, 3vw, 40px); }
.experience-grid article:last-child { border-right: 0; }
.experience-grid span { color: #a64c2d; font-size: 11px; letter-spacing: .2em; font-weight: 800; }
.experience-grid h3 { margin: 22px 0 13px; font: 500 27px/1.1 Georgia, 'Times New Roman', serif; }
.experience-grid p { margin: 0; color: #6c5d53; line-height: 1.75; }
.site-footer { min-height: 150px; padding: 45px clamp(24px, 6vw, 92px); display: flex; justify-content: space-between; align-items: center; gap: 20px; color: #927e71; font-size: 12px; }

.reader-view { position: fixed; inset: 0; overflow: hidden; color: var(--ink); background: var(--paper); transition: background .25s ease, color .25s ease; --reader-bg: var(--paper); --reader-page: #fbf7ee; --reader-text: #29211c; --reader-muted: #75695f; --reader-border: rgba(55,38,29,.14); }
.reader-view[data-theme='sepia'] { --reader-bg: #d9c5a7; --reader-page: #ead9bd; --reader-text: #38281d; --reader-muted: #79614f; --reader-border: rgba(69,43,25,.2); }
.reader-view[data-theme='night'] { --reader-bg: #0d1014; --reader-page: #15191f; --reader-text: #e9e6df; --reader-muted: #979aa0; --reader-border: rgba(255,255,255,.11); }
.reader-view { background: var(--reader-bg); color: var(--reader-text); }
.reader-topbar { position: absolute; z-index: 20; top: 0; left: 0; right: 0; min-height: calc(72px + var(--safe-top)); padding: calc(12px + var(--safe-top)) calc(18px + var(--safe-right)) 12px calc(18px + var(--safe-left)); display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; background: color-mix(in srgb, var(--reader-bg) 91%, transparent); border-bottom: 1px solid var(--reader-border); backdrop-filter: blur(18px); transition: opacity .3s ease, transform .3s ease; }
.icon-button { min-width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--reader-border); border-radius: 999px; background: color-mix(in srgb, var(--reader-page) 78%, transparent); color: var(--reader-text); }
.icon-button.labelled { height: 45px; min-width: 58px; padding: 3px 10px; border-radius: 14px; }
.icon-button.labelled span { font-weight: 800; line-height: 1; }
.icon-button small { display: block; font-size: 8px; margin-top: 2px; color: var(--reader-muted); letter-spacing: .08em; text-transform: uppercase; }
.icon-button[aria-pressed='true'] { background: var(--accent); color: white; border-color: transparent; }
.icon-button[aria-pressed='true'] small { color: rgba(255,255,255,.8); }
.chapter-pill { min-width: 0; justify-self: center; max-width: 520px; border: 0; background: transparent; color: var(--reader-text); text-align: center; }
.chapter-pill span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--reader-muted); font-size: 8px; letter-spacing: .18em; font-weight: 800; }
.chapter-pill strong { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 16px/1.1 Georgia, 'Times New Roman', serif; }
.topbar-actions { display: flex; gap: 7px; }

.reader-stage { position: absolute; inset: calc(72px + var(--safe-top)) 0 calc(106px + var(--safe-bottom)); display: grid; grid-template-columns: clamp(36px, 5vw, 72px) minmax(0, 1fr) clamp(36px, 5vw, 72px); align-items: stretch; touch-action: pan-y; }
.pages-viewport { min-width: 0; overflow: hidden; position: relative; padding: clamp(12px, 2.2vw, 28px) 0 74px; }
.pages-track { height: 100%; display: flex; will-change: transform; transition: transform .52s cubic-bezier(.22,.82,.24,1); }
.page-sheet { position: relative; flex: 0 0 100%; height: 100%; padding: clamp(24px, 4vh, 52px) clamp(24px, 7vw, 94px) clamp(24px, 4vh, 52px); overflow: hidden; background: var(--reader-page); color: var(--reader-text); border: 1px solid var(--reader-border); border-radius: 3px 15px 15px 3px; box-shadow: 0 18px 55px rgba(35,22,15,.11); transform-origin: left center; }
.page-sheet::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0,0,0,.045), transparent 7%, transparent 94%, rgba(0,0,0,.025)); }
.page-sheet.turning-next { animation: turnNext .5s ease both; }
.page-sheet.turning-prev { animation: turnPrev .5s ease both; }
@keyframes turnNext { 0% { transform: rotateY(0); filter: brightness(1); } 50% { transform: perspective(1300px) rotateY(-7deg) translateX(-1.2%); filter: brightness(.92); } 100% { transform: rotateY(0); filter: brightness(1); } }
@keyframes turnPrev { 0% { transform: rotateY(0); } 50% { transform: perspective(1300px) rotateY(7deg) translateX(1.2%); } 100% { transform: rotateY(0); } }
.page-sheet p { max-width: 760px; margin: 0 auto 1.08em; font-family: var(--reader-font); font-size: var(--reader-font-size); line-height: var(--reader-line-height); letter-spacing: .002em; text-wrap: pretty; }
.page-sheet .chapter-heading { max-width: 760px; margin: 0 auto clamp(28px, 5vh, 60px); }
.chapter-heading .part-label { margin: 0 0 18px; color: var(--accent); font: 800 9px/1.2 ui-sans-serif, system-ui, sans-serif; letter-spacing: .23em; text-transform: uppercase; }
.chapter-heading .chapter-label { margin: 0 0 10px; color: var(--reader-muted); font: 800 10px/1.2 ui-sans-serif, system-ui, sans-serif; letter-spacing: .18em; text-transform: uppercase; }
.chapter-heading h1 { margin: 0; font: 500 clamp(38px, 5.2vw, 72px)/.98 var(--reader-font); letter-spacing: -.042em; text-wrap: balance; }
.page-sheet .letter-signoff { margin-top: 2em; font-style: italic; }
.page-number { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: var(--reader-muted); font-size: 10px; letter-spacing: .18em; }
.measure-page { position: fixed !important; z-index: -100; visibility: hidden; pointer-events: none; left: -200vw; top: 0; width: min(calc(100vw - 2 * clamp(36px, 5vw, 72px)), 1200px); height: calc(100dvh - 72px - 106px - var(--safe-top) - var(--safe-bottom) - clamp(12px, 2.2vw, 28px) - 74px); }

.chapter-edge { border: 0; background: transparent; color: var(--reader-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; transition: color .2s ease, background .2s ease; }
.chapter-edge:hover { color: var(--accent); background: color-mix(in srgb, var(--reader-page) 44%, transparent); }
.chapter-edge span { font: 300 42px/1 Georgia, serif; }
.chapter-edge small { writing-mode: vertical-rl; font-size: 7px; letter-spacing: .18em; }
.page-controls { position: absolute; z-index: 5; left: clamp(46px, 7vw, 105px); right: clamp(46px, 7vw, 105px); bottom: 13px; min-height: 48px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.page-controls button { border: 0; background: transparent; color: var(--reader-muted); font-size: 12px; }
.page-controls button:first-child { justify-self: start; }
.page-controls button:last-child { justify-self: end; }
.page-controls button:disabled { opacity: .28; cursor: default; }
.page-controls p { margin: 0; color: var(--reader-muted); font-size: 11px; }
.down-page-button { display: inline-flex; align-items: center; gap: 8px; }
.reader-footer { position: absolute; z-index: 15; left: 0; right: 0; bottom: 0; min-height: calc(106px + var(--safe-bottom)); padding: 14px calc(28px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(28px + var(--safe-left)); background: color-mix(in srgb, var(--reader-bg) 92%, transparent); border-top: 1px solid var(--reader-border); backdrop-filter: blur(18px); transition: opacity .3s ease, transform .3s ease; }
.progress-meta { display: flex; justify-content: space-between; color: var(--reader-muted); font-size: 10px; }
.progress-track { height: 3px; margin: 9px 0 10px; background: var(--reader-border); overflow: hidden; border-radius: 99px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .35s ease; }
.reader-hint { margin: 0; text-align: center; color: var(--reader-muted); font-size: 9px; letter-spacing: .04em; }
.reader-view.controls-hidden .reader-topbar { opacity: 0; transform: translateY(-100%); pointer-events: none; }
.reader-view.controls-hidden .reader-footer { opacity: 0; transform: translateY(100%); pointer-events: none; }
.reader-view.controls-hidden .reader-stage { inset: var(--safe-top) 0 var(--safe-bottom); }
.reader-view.controls-hidden .pages-viewport { padding-top: clamp(18px, 4vh, 44px); padding-bottom: clamp(18px, 4vh, 44px); }
.reader-view.controls-hidden .page-controls { opacity: 0; pointer-events: none; }
.reader-view.controls-hidden .measure-page { height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 2 * clamp(18px, 4vh, 44px)); }

.drawer { position: absolute; z-index: 50; top: 0; bottom: 0; width: min(460px, 92vw); padding: calc(30px + var(--safe-top)) 28px calc(30px + var(--safe-bottom)); overflow-y: auto; background: var(--reader-page); color: var(--reader-text); box-shadow: 0 0 80px rgba(0,0,0,.24); transition: transform .32s ease; }
.toc-drawer { left: 0; transform: translateX(-105%); }
.settings-drawer { right: 0; transform: translateX(105%); }
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.drawer-header h2 { margin: 0 0 28px; font: 500 42px/1 Georgia, serif; }
.toc-search { width: 100%; height: 46px; padding: 0 15px; margin-bottom: 24px; border: 1px solid var(--reader-border); border-radius: 12px; background: var(--reader-bg); color: var(--reader-text); }
.toc-part { margin: 29px 0 11px; color: var(--accent); font-size: 9px; letter-spacing: .17em; font-weight: 800; text-transform: uppercase; }
.toc-item { width: 100%; min-height: 47px; padding: 9px 6px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; border: 0; border-bottom: 1px solid var(--reader-border); background: transparent; color: var(--reader-text); text-align: left; }
.toc-item:hover, .toc-item.active { color: var(--accent); }
.toc-item .toc-number { color: var(--reader-muted); font-size: 10px; }
.toc-item .toc-title { font-family: Georgia, serif; font-size: 15px; }
.toc-item .toc-check { font-size: 11px; }
.drawer-backdrop { position: absolute; z-index: 45; inset: 0; background: rgba(0,0,0,.38); backdrop-filter: blur(2px); }
.setting-row { display: grid; grid-template-columns: 1fr auto; gap: 11px; margin: 27px 0; color: var(--reader-muted); font-size: 13px; }
.setting-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.theme-options, .font-options { margin: 28px 0; padding: 0; border: 0; }
.theme-options legend, .font-options legend { margin-bottom: 11px; color: var(--reader-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.theme-options button, .font-options button { min-height: 42px; padding: 0 15px; margin: 0 6px 8px 0; border: 1px solid var(--reader-border); border-radius: 10px; background: var(--reader-bg); color: var(--reader-text); }
.theme-options button[aria-pressed='true'], .font-options button[aria-pressed='true'] { border-color: var(--accent); color: var(--accent); }
.danger-button { width: 100%; min-height: 46px; margin-top: 24px; border: 1px solid rgba(180,55,38,.35); border-radius: 12px; background: transparent; color: #b74432; }

.wave-panel { position: absolute; z-index: 60; right: calc(18px + var(--safe-right)); top: calc(86px + var(--safe-top)); width: min(300px, calc(100vw - 36px)); overflow: hidden; border: 1px solid var(--reader-border); border-radius: 18px; background: #141414; color: white; box-shadow: 0 22px 65px rgba(0,0,0,.42); }
.wave-panel-head { min-height: 55px; padding: 10px 12px 9px 16px; display: flex; justify-content: space-between; align-items: center; }
.wave-panel-head strong { display: block; font-size: 13px; }
.wave-panel-head small { display: block; color: #999; font-size: 9px; margin-top: 3px; }
.wave-panel-head button { border: 0; border-radius: 99px; padding: 7px 12px; background: #292929; color: #eee; font-size: 10px; }
.wave-panel video { width: 100%; aspect-ratio: 4/3; display: block; object-fit: cover; transform: scaleX(-1); filter: saturate(.65) contrast(1.12); }
.wave-panel > p { min-height: 42px; margin: 0; padding: 11px 14px; color: #ddd; font-size: 11px; line-height: 1.45; }
.wave-legend { padding: 9px 14px 12px; display: flex; justify-content: space-between; color: #888; font-size: 8px; border-top: 1px solid #2c2c2c; }
.gesture-toast { position: absolute; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9); padding: 14px 20px; border-radius: 999px; background: rgba(18,14,12,.88); color: white; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; font-weight: 750; font-size: 13px; }
.gesture-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 74px; }
  .hero-copy { order: 1; }
  .cover-stage { order: 0; min-height: 470px; }
  .book-cover { width: min(300px, 72vw); padding: 44px 34px 34px; }
  .cover-kicker { margin-top: 55px; }
  .experience-grid { grid-template-columns: 1fr; }
  .experience-grid article, .experience-grid article + article { padding: 28px 0; border-right: 0; border-bottom: 1px solid rgba(45,28,20,.17); }
  .site-footer { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 680px) {
  .site-nav { height: 70px; }
  .hero { min-height: auto; padding: 42px 22px 80px; }
  .hero h1 { font-size: clamp(58px, 19vw, 88px); }
  .cover-stage { min-height: 410px; }
  .reader-topbar { grid-template-columns: 44px minmax(0, 1fr) auto; padding-left: calc(8px + var(--safe-left)); padding-right: calc(8px + var(--safe-right)); }
  .topbar-actions { gap: 3px; }
  .icon-button.labelled { min-width: 43px; width: 43px; padding: 2px; }
  .icon-button.labelled small { display: none; }
  .chapter-pill strong { font-size: 13px; }
  .reader-stage { grid-template-columns: 25px minmax(0, 1fr) 25px; }
  .pages-viewport { padding-top: 7px; }
  .page-sheet { padding: 30px 21px 38px; border-radius: 2px 10px 10px 2px; }
  .page-sheet p { font-size: min(var(--reader-font-size), 21px); }
  .chapter-heading h1 { font-size: clamp(36px, 11vw, 54px); }
  .chapter-edge small { display: none; }
  .chapter-edge span { font-size: 32px; }
  .page-controls { left: 30px; right: 30px; }
  .page-controls button span { display: none; }
  .reader-hint { display: none; }
  .reader-footer { min-height: calc(83px + var(--safe-bottom)); }
  .reader-stage { bottom: calc(83px + var(--safe-bottom)); }
  .measure-page { width: calc(100vw - 50px); height: calc(100dvh - 72px - 83px - var(--safe-top) - var(--safe-bottom) - 7px - 74px); }
}

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