/* Packhorse reader: the free sample of a book, as pages (a two-page spread on a wide screen, one page at a time on a phone) or as one
   scrolling column. The pages follow the studio's Preview: a 6 x 9 in page drawn at 70 px per inch (420 x 630), set in Literata,
   chapter names in the typeface of the book's cover, every chapter on a right-hand page, running heads and page numbers. */
@font-face { font-family: "Literata"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/assets/fonts/Literata-normal-400-600-latin.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 400; font-display: swap; src: url("/assets/fonts/Literata-italic-400-latin.woff2") format("woff2"); }

body.rd { --pg: #FFFCF4; --tx: #1D1B18; --mut: #6B655A; --stage: #E8DFCB; --bar: #F6EFDF; --rule: rgba(27, 26, 23, .16); --acc: #1F6F6B;
  --rf: "Literata", Georgia, "Times New Roman", serif; --hf: "BookTitle", "Literata", Georgia, serif; --fs: 18px; --barh: 58px; --footh: 0px;
  background: var(--stage); color: var(--tx); min-height: 100vh; }
body.rd[data-theme="sepia"] { --pg: #F5ECD7; --tx: #433422; --mut: #7A6A52; --stage: #DCCFB2; --bar: #EFE4CA; --rule: rgba(67, 52, 34, .2); }
body.rd[data-theme="night"] { --pg: #1A1C1F; --tx: #DAD5CB; --mut: #9C968B; --stage: #0E0F11; --bar: #141517; --rule: rgba(255, 255, 255, .13); --acc: #7FC3BC; }
body.rd[data-font="sans"] { --rf: "Inter", system-ui, "Segoe UI", sans-serif; }
body.rd.mode-book { --footh: 54px; overflow: hidden; height: 100dvh; }

/* ---------- top bar ---------- */
.rd-bar { position: sticky; top: 0; z-index: 50; height: var(--barh); display: flex; align-items: center; gap: 12px; padding: 0 clamp(10px, 2vw, 22px); background: var(--bar); color: var(--tx); border-bottom: 2px solid var(--tx); }
.rd-back { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 8px; border: 2px solid var(--tx); border-radius: 999px; font: 700 14px/1 var(--font-ui); flex: none; }
.rd-back:hover { background: var(--tx); color: var(--bar); }
.rd-logo img { height: 26px; width: auto; display: block; }
body.rd[data-theme="night"] .rd-logo img { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
.rd-ttl { min-width: 0; display: grid; line-height: 1.15; }
.rd-ttl b { font: 800 16px/1.15 var(--font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-ttl small { font: 600 12px var(--font-ui); color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.rd-seg { display: inline-flex; border: 2px solid var(--tx); border-radius: 999px; overflow: hidden; }
.rd-seg button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; font: 700 13.5px/1 var(--font-ui); color: var(--tx); }
.rd-seg button[aria-pressed="true"] { background: var(--tx); color: var(--bar); }
.rd-seg .ic { width: 17px; height: 17px; }
.rd-ib { width: 40px; height: 40px; display: grid; place-items: center; border: 2px solid var(--tx); border-radius: 50%; color: var(--tx); flex: none; }
.rd-ib:hover, .rd-ib[aria-expanded="true"] { background: var(--tx); color: var(--bar); }
.rd-ib .aa { font: 800 15px/1 var(--font-display); letter-spacing: -.02em; }
.rd-ib .ic { width: 19px; height: 19px; }
.rd-buy { flex: none; }
.rd-prog { position: sticky; top: var(--barh); z-index: 49; height: 3px; background: transparent; }
.rd-prog i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--acc); transition: width .2s; }
@media (max-width: 1000px) { .rd-logo { display: none; } }
@media (max-width: 760px) {
  body.rd { --barh: 54px; }
  .rd-back-t, .rd-ttl small, .rd-promo-i { display: none; }
  .rd-back { width: 40px; padding: 0; justify-content: center; }
  .rd-seg button { padding: 0 10px; } .rd-seg button span { display: none; }
  .rd-buy { padding: 0 12px; } .rd-buy .lg { display: none; }
}
@media (max-width: 420px) { .rd-ttl { display: none; } .rd-tools { gap: 6px; } }

/* ---------- the scrolling column ---------- */
.rd-text { max-width: 40rem; margin: 0 auto; padding: 18px 22px 40px; font: 400 var(--fs)/1.68 var(--rf); color: var(--tx); }
body.rd:not(.mode-book) .rd-main { background: var(--pg); min-height: calc(100vh - var(--barh)); }
.rd-text p { margin: 0; text-indent: 1.4em; hyphens: auto; -webkit-hyphens: auto; }
.rd-text p.f, .rd-text .sep + p, .rd-text h2 + p { text-indent: 0; }
.rd-text .sep { text-align: center; text-indent: 0; margin: 1.1em 0; letter-spacing: .4em; color: var(--mut); }
.rd-text em { font-style: italic; }
.rd-sec { scroll-margin-top: calc(var(--barh) + 12px); }
.rd-sec + .rd-sec { margin-top: 3.4em; }
.rd-h { text-align: center; margin: 0 0 1.6em; padding-top: 1.4em; }
.rd-h small { display: block; font: 700 .64em/1.3 var(--font-ui); letter-spacing: .26em; text-transform: uppercase; color: var(--mut); margin-bottom: .9em; }
.rd-h b { display: block; font: 400 1.75em/1.15 var(--hf); letter-spacing: .01em; text-wrap: balance; }
.rd-part .rd-h { padding: 3em 0; margin: 0; border-block: 1px solid var(--rule); }
.rd-part .rd-h b { font-size: 2em; }
[data-p] { scroll-margin-top: calc(var(--barh) + 16px); }
.rd-text sup, .pgflow sup { font-size: 1em; line-height: 0; vertical-align: baseline; }
a.nref { position: relative; top: -.55em; color: var(--acc); font: 700 .64em/0 var(--font-ui); padding: 0 .12em; text-decoration: none; vertical-align: baseline; }
a.nref:hover, a.nref:focus-visible { text-decoration: underline; }
.rd-cut { text-align: center; text-indent: 0 !important; color: var(--mut); font-style: italic; margin-top: 1em !important; }
.rd-notes { font-size: .86em; line-height: 1.55; padding: 0; list-style: none; counter-reset: none; }
.rd-notes li { margin: 0 0 .8em; padding-left: 2.2em; text-indent: -2.2em; }
.rd-notes .nl { display: inline-block; width: 2.2em; text-indent: 0; font: 700 .9em var(--font-ui); color: var(--acc); }
.rd-notes li:target { background: color-mix(in srgb, var(--acc) 14%, transparent); border-radius: 6px; }

/* the opening of the column: cover and what the sample holds */
.rd-front { display: grid; grid-template-columns: minmax(110px, 168px) 1fr; gap: 24px; align-items: center; padding: 22px 0 26px; border-bottom: 1px solid var(--rule); }
.rd-front .cov { box-shadow: 0 0 0 2px #1B1A17, 6px 6px 0 #1B1A17; border-radius: 3px; }
.rd-front h1 { font: 400 clamp(30px, 6vw, 46px)/1.05 var(--hf); margin: 10px 0 6px; text-wrap: balance; }
.rd-front .rd-by { font: 600 15px var(--font-ui); letter-spacing: .14em; text-transform: uppercase; text-indent: 0; color: var(--mut); }
.rd-front .rd-what { margin-top: 10px; font: 500 15px/1.45 var(--font-ui); text-indent: 0; color: var(--mut); }
.rd-front .rd-start { margin-top: 16px; text-indent: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.rd-front .eyebrow { background: var(--acc); color: #FFFCF4; border-color: #1B1A17; }
body.rd[data-theme="night"] .rd-front .eyebrow { color: #0E0F11; }
@media (max-width: 520px) { .rd-front { grid-template-columns: 96px 1fr; gap: 16px; } .rd-front h1 { font-size: 28px; } .rd-front .rd-start .btn { padding: 0 1em; } }

/* the end of the sample */
.rd-endbox { margin-top: 1em; padding: clamp(20px, 4vw, 34px); border: 2px solid #1B1A17; border-radius: 26px; background: #F6EFDF; color: #1B1A17; box-shadow: 6px 6px 0 #1B1A17; font-family: var(--font-body); font-size: 16px; line-height: 1.55; text-align: left; }
.rd-endbox p { text-indent: 0 !important; margin: 0 0 12px !important; }
.rd-endbox h2 { font: 800 clamp(26px, 4vw, 36px)/1.05 var(--font-display); letter-spacing: -.03em; margin: 14px 0 12px; }
.rd-endbox h2 em { font-style: normal; color: #1F6F6B; }
.rd-endbox .buy { margin: 18px 0 14px; }
.rd-endbox .btn { max-width: 100%; white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
@media (max-width: 520px) { .rd-h b { font-size: 1.35em; overflow-wrap: break-word; } }
.rd-endbox .stores { margin-bottom: 14px; }
.rd-endbox .store { font-size: 13px; padding: 8px 13px; }
.rd-endbox .rd-promo a { border-bottom: 2px solid currentColor; font-weight: 700; }

/* ---------- pages ---------- */
.rd-stage { position: relative; height: calc(100dvh - var(--barh) - var(--footh)); overflow: hidden; display: flex; align-items: center; justify-content: center; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.rd-stage[hidden] { display: none; }
body.rd.mode-book .rd-text, body.rd.mode-book .rd-prog { display: none; }
.bkwrap { position: relative; flex: none; }
.bk { position: absolute; left: 0; top: 0; width: 840px; height: 630px; transform-origin: 0 0; }
.bk .slide { position: absolute; inset: 0; transition: transform .7s cubic-bezier(.45, .05, .25, 1); }
.bk .inner { position: absolute; left: 420px; top: 0; width: 420px; height: 630px; perspective: 2600px; }
.leaf { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; transition: transform .85s cubic-bezier(.45, .05, .25, 1), z-index 0s .42s; }
.leaf.flipped { transform: rotateY(-180deg); }
.face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--pg); color: var(--tx); box-shadow: 0 0 0 1px var(--rule); }
.face.front { background: linear-gradient(90deg, rgba(60, 50, 30, .12), rgba(60, 50, 30, 0) 7%), var(--pg); }
.face.back { transform: rotateY(180deg); background: linear-gradient(270deg, rgba(60, 50, 30, .12), rgba(60, 50, 30, 0) 7%), var(--pg); }
.bk .shadow { position: absolute; top: 0; height: 630px; left: 0; width: 840px; box-shadow: 0 30px 60px -26px rgba(0, 0, 0, .55); pointer-events: none; transition: left .7s cubic-bezier(.45, .05, .25, 1), width .7s; }
.face .pgi { position: absolute; top: var(--pt); bottom: var(--pb); left: var(--pl); right: var(--pr); }
.face.front .pgi { --pl: var(--pin); --pr: var(--pout); }
.face.back .pgi { --pl: var(--pout); --pr: var(--pin); }
.face .rh { position: absolute; top: calc(var(--pt) * .38); left: 0; right: 0; text-align: center; font: 600 8.6px/1 var(--font-ui); letter-spacing: .2em; text-transform: uppercase; color: var(--mut); }
.face .pn { position: absolute; bottom: calc(var(--pb) * .36); left: 0; right: 0; text-align: center; font: 500 9.6px/1 var(--rf); color: var(--mut); }
.face.cover img, .face.backc .bcv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.face.cover, .face.backc { background: #1B1A17; }

/* the type of a page: the same rules for the measuring box and the pages, so what is measured is what is shown */
.pgflow { display: flow-root; font: 400 var(--bfs) / var(--blh) var(--rf); text-align: justify; hyphens: auto; -webkit-hyphens: auto; color: var(--tx); }
.pgflow p { margin: 0; text-indent: 1.35em; }
.pgflow p.f, .pgflow p.cont, .pgflow p.note, .pgflow p.cutp { text-indent: 0; }
.pgflow p.sep { text-align: center; text-indent: 0; margin: .85em 0; letter-spacing: .4em; color: var(--mut); }
.pgflow p.note { font-size: .9em; line-height: 1.4; margin-bottom: .45em; text-align: left; }
.pgflow p.note .nl { font: 700 .92em var(--font-ui); color: var(--acc); margin-right: .35em; }
.pgflow p.cutp { text-align: center; color: var(--mut); font-style: italic; margin-top: 1em; }
.pgflow .chead { margin: var(--sink) 0 var(--after); text-align: center; }
.pgflow .chead small { display: block; font: 700 calc(var(--bfs) * .78) / 1.3 var(--font-ui); letter-spacing: .24em; text-transform: uppercase; color: var(--mut); margin-bottom: .8em; }
.pgflow .chead b { display: block; font: 400 calc(var(--bfs) * 1.5) / 1.2 var(--hf); letter-spacing: .01em; text-wrap: balance; }
.pgflow a.nref { font-size: .62em; line-height: 0; }
.rd-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }

/* the special pages */
.face .titlep { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; padding: 16% 12% 11%; }
.titlep .ser { font: 700 9.5px/1.4 var(--font-ui); letter-spacing: .24em; text-transform: uppercase; color: var(--mut); min-height: 1em; }
.titlep h2 { font: 400 30px/1.12 var(--hf); text-wrap: balance; margin: 0 0 18px; }
.titlep .au { font: 600 11px/1.4 var(--font-ui); letter-spacing: .3em; text-transform: uppercase; }
.titlep img { height: 22px; width: auto; opacity: .92; }
body.rd[data-theme="night"] .titlep img, body.rd[data-theme="night"] .notice img { filter: invert(1) brightness(1.1); }
.face .notice { position: absolute; left: 12%; right: 12%; bottom: 12%; font: 400 10px/1.55 var(--font-ui); color: var(--mut); text-align: left; }
.face .notice b { color: var(--tx); }
.face .partp { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 0 12%; }
.partp small { display: block; font: 700 10.5px var(--font-ui); letter-spacing: .32em; text-transform: uppercase; color: var(--mut); margin-bottom: 16px; }
.partp b { font: 400 24px/1.25 var(--hf); text-wrap: balance; }
.face .endp { position: absolute; inset: 0; padding: 13% 10% 10%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; font-family: var(--font-body); }
.endp .eyebrow { font-size: 9.5px; padding: 6px 10px; }
.endp h2 { font: 800 25px/1.05 var(--font-display); letter-spacing: -.03em; color: var(--tx); }
.endp p { font-size: 12px; line-height: 1.5; color: var(--mut); max-width: 30ch; }
.endp .btn { min-height: 38px; font-size: 13px; padding: 0 1.1em; }
.endp .endbtns { display: grid; gap: 8px; justify-items: center; }
.endp .mini { font-size: 11.5px; } .endp .mini a { border-bottom: 1.5px solid currentColor; font-weight: 700; }
.face.backc .bcv { background: #1F6F6B; color: #F6EFDF; padding: 13% 11% 12%; display: flex; flex-direction: column; gap: 14px; font-family: var(--font-body); }
.bcv .hook { font: 400 21px/1.2 var(--hf); text-wrap: balance; }
.bcv p { font-size: 11px; line-height: 1.55; }
.bcv .bcl { margin-top: auto; display: flex; align-items: center; gap: 10px; font: 700 10px var(--font-ui); letter-spacing: .2em; text-transform: uppercase; }
.bcv .bcl img { height: 30px; width: auto; }
.face a, .face button { position: relative; z-index: 2; }

/* one page at a time (phones, narrow windows) */
.strip { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.strip::-webkit-scrollbar { display: none; }
.strip .sp { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; }
.strip .face { position: relative; inset: auto; flex: none; backface-visibility: visible; transform: none; border-radius: 4px; box-shadow: 0 0 0 1px var(--rule), 0 14px 30px -18px rgba(0, 0, 0, .5); background: var(--pg); }
.strip .face .pgi { --pl: var(--pin); --pr: var(--pin); }
.strip .pgflow { text-align: left; }                                 /* a phone-wide column justified shows holes between words; the line breaks are the same either way */

/* page controls */
.rd-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--footh); display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 10px; background: var(--bar); color: var(--tx); border-top: 2px solid var(--tx); }
.rd-foot[hidden] { display: none; }
.rd-foot button { width: 42px; height: 38px; border: 2px solid var(--tx); border-radius: 999px; display: grid; place-items: center; color: var(--tx); }
.rd-foot button:hover:not(:disabled) { background: var(--tx); color: var(--bar); }
.rd-foot button:disabled { opacity: .35; cursor: default; }
.rd-foot .ic { width: 18px; height: 18px; }
.rd-where { min-width: 0; max-width: 520px; text-align: center; font: 600 13px/1.25 var(--font-ui); }
.rd-where small { display: block; color: var(--mut); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; background: rgba(27, 26, 23, .82); color: #F6EFDF; font: 600 12.5px var(--font-ui); pointer-events: none; transition: opacity .6s; white-space: nowrap; }
.rd-hint.gone { opacity: 0; }

/* panels: contents, text settings, a note */
.rd-panel { position: fixed; z-index: 70; top: calc(var(--barh) + 8px); right: clamp(8px, 2vw, 20px); width: min(360px, calc(100vw - 16px)); max-height: calc(100dvh - var(--barh) - 24px); overflow: auto; padding: 16px 16px 14px; background: var(--bar); color: var(--tx); border: 2px solid var(--tx); border-radius: 20px; box-shadow: 6px 6px 0 rgba(27, 26, 23, .9); font-family: var(--font-ui); }
.rd-panel[hidden] { display: none; }
.rd-panel h3 { font: 800 12px var(--font-ui); letter-spacing: .16em; text-transform: uppercase; margin-bottom: 10px; color: var(--mut); }
.rd-panel ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.rd-panel ol a { display: block; padding: 9px 10px; border-radius: 10px; font: 600 14.5px/1.3 var(--font-ui); }
.rd-panel ol a small { display: block; font-weight: 500; font-size: 12px; color: var(--mut); }
.rd-panel ol a:hover, .rd-panel ol a.on { background: color-mix(in srgb, var(--tx) 10%, transparent); }
.rd-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.rd-row:first-of-type { border-top: 0; }
.rd-row > span { width: 64px; font: 700 12px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--mut); }
.rd-row button { min-width: 44px; height: 36px; padding: 0 12px; border: 2px solid var(--tx); border-radius: 999px; font: 700 13.5px var(--font-ui); color: var(--tx); }
.rd-row button[aria-pressed="true"] { background: var(--tx); color: var(--bar); }
.rd-row button[data-theme="paper"] { background: #FFFCF4; color: #1D1B18; } .rd-row button[data-theme="sepia"] { background: #F5ECD7; color: #433422; } .rd-row button[data-theme="night"] { background: #1A1C1F; color: #DAD5CB; }
.rd-row button[data-theme][aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bar), 0 0 0 5px var(--acc); }
.rd-row button[data-font="serif"] { font-family: "Literata", Georgia, serif; }
.rd-pop { position: fixed; z-index: 80; width: min(380px, calc(100vw - 20px)); padding: 16px 40px 16px 18px; background: var(--bar); color: var(--tx); border: 2px solid var(--tx); border-radius: 18px; box-shadow: 6px 6px 0 rgba(27, 26, 23, .9); font: 400 15px/1.55 var(--rf); }
.rd-pop[hidden] { display: none; }
.rd-pop .nl { font: 700 13px var(--font-ui); color: var(--acc); margin-right: 6px; }
.rd-pop-x { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border-radius: 50%; font: 700 18px/1 var(--font-ui); color: var(--tx); }
@media (max-width: 760px) {
  .rd-panel { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 70dvh; border-radius: 22px; }
  .rd-pop { left: 10px !important; right: 10px; top: auto !important; bottom: calc(var(--footh) + 10px) !important; width: auto; }
}
.rd-toast { position: fixed; z-index: 75; left: 50%; bottom: calc(var(--footh) + 16px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 16px; border-radius: 999px; background: #1B1A17; color: #F6EFDF; font: 600 13.5px var(--font-ui); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6); white-space: nowrap; }
.rd-toast[hidden] { display: none; }
.rd-toast button { padding: 6px 12px; border-radius: 999px; background: #F6EFDF; color: #1B1A17; font: 700 12.5px var(--font-ui); }
@media (prefers-reduced-motion: reduce) { .leaf, .bk .slide, .bk .shadow, .rd-prog i { transition: none !important; } .strip { scroll-behavior: auto; } }
@media print { .rd-bar, .rd-prog, .rd-foot, .rd-panel, .rd-pop, .rd-toast { display: none !important; } }
