/* The Perfect Library: a calm reading room. Warm paper, navy ink, gold for the small things. */
.reader { --bg: #F6F1E6; --ink: #27324A; --soft: rgba(39, 50, 74, .74); --faint: rgba(39, 50, 74, .1); --accent: #86631E; --chrome: rgba(39, 50, 74, .74);
  position: absolute; inset: 0; overflow: hidden; background: var(--bg); color: var(--ink); font-family: 'Jost', 'Avenir Next', sans-serif; font-weight: 300; transition: background-color .5s ease, color .5s ease; -webkit-font-smoothing: antialiased; }
.reader[data-theme=sepia] { --bg: #EFE3CB; --ink: #3B2E21; --soft: rgba(59, 46, 33, .75); --faint: rgba(59, 46, 33, .11); --accent: #76551C; --chrome: rgba(59, 46, 33, .74) }
.reader[data-theme=sage] { --bg: #E3E8DC; --ink: #2A392F; --soft: rgba(42, 57, 47, .75); --faint: rgba(42, 57, 47, .11); --accent: #6A5720; --chrome: rgba(42, 57, 47, .74) }
.reader[data-theme=cream] { --bg: #F7EED8; --ink: #2E2A24; --soft: rgba(46, 42, 36, .74); --faint: rgba(46, 42, 36, .1); --accent: #7F5F1F; --chrome: rgba(46, 42, 36, .74) }
.reader[data-theme=linen] { --bg: #EFEBE4; --ink: #30333A; --soft: rgba(48, 51, 58, .74); --faint: rgba(48, 51, 58, .1); --accent: #785B24; --chrome: rgba(48, 51, 58, .74) }
.reader[data-theme=mist] { --bg: #E5E9EC; --ink: #2C3540; --soft: rgba(44, 53, 64, .74); --faint: rgba(44, 53, 64, .1); --accent: #6B5527; --chrome: rgba(44, 53, 64, .74) }
.reader[data-theme=blush] { --bg: #F3E7E2; --ink: #3D2F2E; --soft: rgba(61, 47, 46, .74); --faint: rgba(61, 47, 46, .1); --accent: #814F32; --chrome: rgba(61, 47, 46, .74) }
.reader[data-theme=stone] { --bg: #DEDAD2; --ink: #2F2D2A; --soft: rgba(47, 45, 42, .76); --faint: rgba(47, 45, 42, .12); --accent: #6B5320; --chrome: rgba(47, 45, 42, .76) }
.reader[data-theme=charcoal] { --bg: #2A2C30; --ink: #CFC9BC; --soft: rgba(207, 201, 188, .72); --faint: rgba(207, 201, 188, .11); --accent: #C3A15E; --chrome: rgba(207, 201, 188, .6) }
.reader[data-theme=amber] { --bg: #1C1813; --ink: #D8BC8C; --soft: rgba(216, 188, 140, .7); --faint: rgba(216, 188, 140, .1); --accent: #D9A85A; --chrome: rgba(216, 188, 140, .55) }
.reader[data-theme=dusk] { --bg: #383B43; --ink: #DAD4C6; --soft: rgba(218, 212, 198, .72); --faint: rgba(218, 212, 198, .12); --accent: #C9A65E; --chrome: rgba(218, 212, 198, .6) }
.reader[data-theme=night] { --bg: #15181F; --ink: #BDB5A3; --soft: rgba(189, 181, 163, .72); --faint: rgba(189, 181, 163, .1); --accent: #BA9752; --chrome: rgba(189, 181, 163, .55) }
.reader[data-theme=midnight] { --bg: #0F1B33; --ink: #CDC5B1; --soft: rgba(205, 197, 177, .72); --faint: rgba(205, 197, 177, .11); --accent: #C9A65E; --chrome: rgba(205, 197, 177, .58) }
.reader [hidden] { display: none !important }
.reader section { height: auto; position: static }
.reader button { font: inherit; color: inherit; background: transparent; border: 0; padding: 0; cursor: default; -webkit-tap-highlight-color: transparent }
.reader .r-orn { display: flex; justify-content: center; color: var(--accent); opacity: .8 }

/* Brightness and warmth: still layers over everything, never animated. */
.r-veil { position: absolute; inset: 0; pointer-events: none; z-index: 30 }
.r-veil i { position: absolute; inset: 0; opacity: 0 }
.r-dim { background: #000 }
.r-warm { background: #FF9F45; mix-blend-mode: multiply }

/* ---------- Reading ---------- */
.r-read { position: absolute; inset: 0; display: flex; flex-direction: column }
.r-bar { position: relative; z-index: 8; flex: 0 0 auto; height: 48px; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 8px; padding: 0 14px; color: var(--chrome); opacity: .55; transition: opacity .35s ease }
.r-bar:hover, .r-bar:focus-within { opacity: 1 }
.r-ic { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; transition: background-color .2s ease, color .2s ease }
.r-ic:hover, .r-ic.on { background: var(--faint); color: var(--ink) }
.r-bm.on { color: var(--accent); --fill: var(--accent) }
.r-heading { min-width: 0; display: flex; justify-content: center; align-items: baseline; gap: 12px; white-space: nowrap; overflow: hidden }
.r-btitle { font-family: 'Cormorant Garamond', 'Iowan Old Style', serif; font-style: italic; font-size: calc(17px * var(--u, 1)); color: var(--ink); overflow: hidden; text-overflow: ellipsis; max-width: 48% }
.r-cname { font-size: calc(11.5px * var(--u, 1)); letter-spacing: 1.6px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis }
.r-tools { display: flex; align-items: center; gap: 2px }
.r-goalpill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 6px; border-radius: 17px; font-size: calc(12px * var(--u, 1)); letter-spacing: .4px; margin-right: 6px; font-variant-numeric: tabular-nums; transition: background-color .2s ease }
.r-goalpill:hover { background: var(--faint) }

.r-stage { position: relative; flex: 1 1 auto; min-height: 0 }
.r-page, .r-face, .r-measure { position: absolute; top: 0; width: var(--r-pagew); height: 100%; overflow: hidden; background: var(--bg) }
.r-measure { visibility: hidden; pointer-events: none; z-index: -1 }
.r-flow { position: absolute; left: var(--r-gut); top: var(--r-vpad); width: var(--r-col); height: var(--r-pageh); column-width: var(--r-col); column-gap: 60px; column-fill: auto;
  font-family: var(--r-font); font-size: var(--r-size); line-height: var(--r-lh); color: var(--ink); text-align: left; -webkit-hyphens: auto; hyphens: auto; hanging-punctuation: first; font-kerning: normal; font-variant-ligatures: common-ligatures; text-rendering: optimizeLegibility; overflow-wrap: break-word; orphans: 2; widows: 2; -webkit-user-select: text; user-select: text; cursor: text }
.reader.justify .r-flow { text-align: justify }
.reader.airy .r-flow { letter-spacing: .03em; word-spacing: .1em }
.r-flow p { margin: 0 0 .8em }
.reader.indent .r-flow p { margin: 0; text-indent: 1.4em }
.reader.indent .r-flow h2 + p, .reader.indent .r-flow h3 + p, .reader.indent .r-flow blockquote + p, .reader.indent .r-chead + p, .reader.indent .r-flow ul + p { text-indent: 0 }
.r-flow h2, .r-flow h3 { break-after: avoid; -webkit-column-break-after: avoid; break-inside: avoid }
.r-flow h2 { margin: 1.5em 0 .6em; font-family: 'Cormorant Garamond', var(--r-font); font-style: italic; font-weight: 400; font-size: 1.35em; line-height: 1.25; color: var(--ink) }
.r-flow h3 { margin: 1.4em 0 .5em; font-family: 'Jost', 'Avenir Next', sans-serif; font-weight: 400; font-size: .7em; line-height: 1.5; letter-spacing: .16em; text-transform: uppercase; color: var(--accent) }
.r-flow i, .r-flow em { font-style: italic }
.r-flow sup { font-size: .62em; line-height: 0; vertical-align: .55em; font-family: 'Jost', sans-serif; font-weight: 400 }
.r-flow sup.fn { color: var(--accent); padding: 0 .15em; cursor: pointer }
.r-flow sup.fn:hover { text-decoration: underline }

/* Chapter opening: room to breathe, the title in Cormorant italic, a small gold star. */
.r-chead, .r-titlepage { break-inside: avoid; text-align: center; padding: 14% 0 2.2em }
.r-titlepage { height: 100%; box-sizing: border-box; padding-top: 28%; break-after: column; -webkit-column-break-after: always }
.r-titlepage h1 { margin: .6em 0 .4em; font-family: 'Cormorant Garamond', var(--r-font); font-style: italic; font-weight: 400; font-size: 2.05em; line-height: 1.15 }
.r-by { margin: 0 0 1.4em !important; font-family: 'Jost', sans-serif; font-size: .7em; letter-spacing: .22em; text-transform: uppercase; color: var(--soft); text-indent: 0 !important }
.r-kicker { font-family: 'Jost', sans-serif; font-size: .62em; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.1em }
.r-chead h1 { margin: 0 0 .8em; font-family: 'Cormorant Garamond', var(--r-font); font-style: italic; font-weight: 400; font-size: 1.75em; line-height: 1.2; -webkit-hyphens: manual; hyphens: manual; text-wrap: balance }

/* The Qur'an, set apart and centred, with its surah and verse. Hadith with a fine gold rule and their source. */
.r-quran { margin: 1.1em .6em 1.3em; padding: .2em 0; text-align: center; break-inside: avoid-column }
.r-quran p { margin: 0 0 .5em !important; text-indent: 0 !important; font-style: italic; text-align: center; -webkit-hyphens: manual; hyphens: manual }
.r-quran cite, .r-hadith cite { display: block; font-family: 'Jost', sans-serif; font-style: normal; font-size: .6em; letter-spacing: .2em; text-transform: uppercase; color: var(--accent) }
.r-quran::before { content: ''; display: block; width: 2.4em; height: 1px; margin: 0 auto .9em; background: var(--accent); opacity: .5 }
.r-hadith { margin: 1em 0 1.2em; padding: .1em 0 .1em 1.05em; border-left: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) }
.r-hadith p { margin: 0 0 .45em !important; text-indent: 0 !important }
.r-lead { display: block; break-after: avoid; -webkit-column-break-after: avoid; break-inside: avoid; margin-bottom: .2em; font-family: 'Jost', sans-serif; font-size: .7em; letter-spacing: .08em; color: var(--soft) }
.r-hadith cite { text-align: left; letter-spacing: .14em }
.r-qv { font-style: italic }
.r-ref { font-family: 'Jost', sans-serif; font-size: .62em; letter-spacing: .1em; color: var(--accent); white-space: nowrap }
.r-cap { margin-bottom: .3em !important; font-family: 'Jost', sans-serif; font-size: .7em; letter-spacing: .16em; text-transform: uppercase; color: var(--soft); text-indent: 0 !important }
.r-list { margin: 0 0 1.2em; padding: 0; list-style: none }
.r-list li { position: relative; padding-left: 1.2em; margin: 0 0 .25em }
.r-list li::before { content: ''; position: absolute; left: .15em; top: .72em; width: .34em; height: .34em; transform: rotate(45deg); background: var(--accent); opacity: .7 }
.r-notes { break-before: column; -webkit-column-break-before: always; font-size: .84em; line-height: 1.5 }
.r-notes h4 { margin: 0 0 1em; font-family: 'Jost', sans-serif; font-weight: 400; font-size: .72em; letter-spacing: .22em; text-transform: uppercase; color: var(--accent) }
.r-notes ol { margin: 0; padding: 0; list-style: none }
.r-notes li { margin: 0 0 .8em; display: grid; grid-template-columns: 1.6em 1fr }
.r-notes li span { color: var(--accent); font-family: 'Jost', sans-serif; font-size: .8em; padding-top: .15em }
.r-end { display: block; height: 1px }

/* Highlights: soft washes of colour, kept faint on dark paper. */
mark.r-hl { color: inherit; border-radius: 2px; padding: .05em 0; -webkit-box-decoration-break: clone; box-decoration-break: clone }
mark.c-gold, .r-dot.c-gold { background: rgba(222, 184, 96, .38) }
mark.c-rose, .r-dot.c-rose { background: rgba(222, 150, 140, .32) }
mark.c-sage, .r-dot.c-sage { background: rgba(140, 180, 130, .32) }
mark.c-sky, .r-dot.c-sky { background: rgba(120, 160, 210, .3) }
.reader.dark mark.c-gold { background: rgba(217, 181, 106, .22) } .reader.dark mark.c-rose { background: rgba(222, 150, 140, .2) }
.reader.dark mark.c-sage { background: rgba(140, 180, 130, .2) } .reader.dark mark.c-sky { background: rgba(120, 160, 210, .2) }
mark.noted { box-shadow: inset 0 -1px 0 var(--accent) }
mark.r-flash { background: rgba(222, 184, 96, .5); transition: background-color .6s ease }

/* The leaf that turns: paper with a soft edge; its shading only fades in and out. */
.r-spine { position: absolute; top: 0; bottom: 0; width: 60px; pointer-events: none; z-index: 2; display: none; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .05) 45%, rgba(0, 0, 0, .09) 50%, rgba(0, 0, 0, .05) 55%, transparent) }
.r-stage.spread .r-spine { display: block }
.r-leaf { position: absolute; top: 0; width: var(--r-pagew); height: 100%; z-index: 5; transform-style: preserve-3d; pointer-events: none; will-change: transform }
.r-face { left: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; box-shadow: 0 0 24px rgba(20, 20, 30, .14) }
.r-back { transform: rotateY(180deg) }
.r-shade { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, .0) 40%, rgba(0, 0, 0, .16)) }
.r-back .r-shade { background: linear-gradient(270deg, rgba(0, 0, 0, .0) 40%, rgba(0, 0, 0, .16)) }
.r-cast { position: absolute; top: 0; width: var(--r-pagew); height: 100%; z-index: 4; pointer-events: none; opacity: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0) 60%) }
.r-ribbon { position: absolute; top: 0; z-index: 3; pointer-events: none }
.r-edge { position: absolute; top: 0; bottom: 0; z-index: 3; display: flex; align-items: center; color: var(--chrome); opacity: .28; transition: opacity .3s ease }
.r-prev { left: 0; justify-content: flex-start; padding-left: 14px !important }
.r-next { right: 0; justify-content: flex-end; padding-right: 14px !important }
.r-edge:hover { opacity: .85 }

.r-foot { flex: 0 0 auto; position: relative; z-index: 8; height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px 4px; font-size: calc(12px * var(--u, 1)); letter-spacing: .5px; color: var(--chrome); opacity: .85; font-variant-numeric: tabular-nums }
.r-track { position: absolute; left: 26px; right: 26px; top: 0; height: 1px; background: var(--faint) }
.r-done { position: absolute; inset: 0; background: var(--accent); opacity: .65; transform-origin: left; transform: scaleX(0); transition: transform .4s ease }

/* Pop-ups: footnotes, the highlight bar, a note being written. */
.r-pop, .r-hlbar { position: absolute; z-index: 20; background: var(--bg); color: var(--ink); border-radius: 14px; box-shadow: 0 10px 34px rgba(15, 20, 35, .2), 0 0 0 1px var(--faint) }
.reader.dark .r-pop, .reader.dark .r-hlbar, .reader.dark .r-panel, .reader.dark .r-dcard, .reader.dark .r-menu { background: color-mix(in srgb, var(--bg) 86%, #fff); box-shadow: 0 10px 34px rgba(0, 0, 0, .45) }
.r-pop { width: min(calc(360px * var(--u, 1)), 80%); padding: 14px 18px 16px; font-family: var(--r-font); font-size: calc(var(--r-size) * .82); line-height: 1.5 }
.r-pop-k { font-family: 'Jost', sans-serif; font-size: calc(10.5px * var(--u, 1)); letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px }
.r-pop textarea { box-sizing: border-box; width: 100%; padding: 8px 10px; border: 1px solid var(--faint); border-radius: 10px; background: transparent; color: var(--ink); font: inherit; resize: vertical; outline: 0 }
.r-pop-row { display: flex; justify-content: flex-end; gap: 16px; margin-top: 10px }
.r-hlbar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 22px }
.r-dot { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: transform .15s ease }
.r-dot:hover, .r-dot.on { transform: scale(1.18) }
.r-dot.on { box-shadow: 0 0 0 1.5px var(--accent) }
.r-sep { width: 1px; height: 18px; background: var(--faint); margin: 0 2px }
.r-txt { font-size: calc(12.5px * var(--u, 1)); letter-spacing: .4px; color: var(--soft); padding: 4px 2px !important; transition: color .2s ease }
.r-txt:hover { color: var(--ink) }
.r-strong { color: var(--accent) }

/* Side panels. */
.r-panel { position: absolute; top: 52px; right: 14px; bottom: 50px; z-index: 18; width: min(calc(370px * var(--u, 1)), calc(100% - 28px)); box-sizing: border-box; padding: 16px 20px 20px; overflow-y: auto; background: var(--bg); border-radius: 18px; box-shadow: 0 14px 44px rgba(15, 20, 35, .18), 0 0 0 1px var(--faint); overscroll-behavior: contain }
.r-panel-type, .r-panel-goal { bottom: auto; max-height: calc(100% - 104px) }
.r-ph { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px }
.r-ph h3 { margin: 0; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(22px * var(--u, 1)); color: var(--ink) }
.r-x { width: 28px; height: 28px; color: var(--soft) }
.r-input { box-sizing: border-box; width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--faint); border-radius: 10px; background: transparent; color: var(--ink); font: inherit; font-size: calc(14px * var(--u, 1)); outline: 0 }
.r-input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent) }
.r-results button, .r-nitem button { display: block; width: 100%; text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--faint); font-family: var(--r-font); font-size: calc(14px * var(--u, 1)); line-height: 1.45; color: var(--ink) }
.r-results button:hover, .r-nitem button:hover { background: var(--faint) }
.r-results small, .r-nitem small { display: block; font-family: 'Jost', sans-serif; font-size: calc(10px * var(--u, 1)); letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); margin-bottom: 3px }
.r-results b { font-weight: inherit; background: rgba(222, 184, 96, .35); border-radius: 2px }
.r-count, .r-empty, .r-mutedp { font-size: calc(12.5px * var(--u, 1)); color: var(--soft); margin: 10px 2px }
.r-nitem { border-left: 3px solid transparent; padding-left: 6px }
.r-nitem.c-gold { border-color: rgba(222, 184, 96, .75) } .r-nitem.c-rose { border-color: rgba(222, 150, 140, .75) } .r-nitem.c-sage { border-color: rgba(140, 180, 130, .75) } .r-nitem.c-sky { border-color: rgba(120, 160, 210, .75) }
.r-nitem q { quotes: '“' '”' }
.r-nnote { display: block; margin-top: 6px; font-family: 'Jost', sans-serif; font-size: calc(12.5px * var(--u, 1)); color: var(--soft) }
.r-tabs { display: flex; gap: 18px; margin-bottom: 8px }
.r-tabs button { padding: 0 0 4px !important; font-size: calc(11px * var(--u, 1)); letter-spacing: 2px; text-transform: uppercase; color: var(--soft); border-bottom: 1px solid transparent !important }
.r-tabs button.on { color: var(--ink); border-bottom-color: var(--accent) !important }

/* Reading settings. */
.r-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 8px }
.r-swatches button { height: 78px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); font-family: 'Iowan Old Style', serif; font-size: calc(16px * var(--u, 1)); transition: box-shadow .2s ease }
.r-swatches button small { font-family: 'Jost', sans-serif; font-size: calc(8.5px * var(--u, 1)); letter-spacing: .8px; opacity: .75 }
.r-swatches button.on { box-shadow: 0 0 0 2px var(--accent) }
.r-row { margin: 14px 0 0 }
.r-lab { display: block; margin-bottom: 7px; font-size: calc(11px * var(--u, 1)); letter-spacing: 1.8px; text-transform: uppercase; color: var(--soft) }
.r-fonts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px }
.r-fonts button { height: 34px; border-radius: 9px; font-size: calc(14px * var(--u, 1)); box-shadow: inset 0 0 0 1px var(--faint); color: var(--ink) }
.r-fonts button.on { box-shadow: inset 0 0 0 1.5px var(--accent) }
.r-size { display: flex; align-items: center; gap: 10px; font-family: 'Iowan Old Style', serif }
.r-size button { width: 26px; color: var(--ink) }
.reader input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; width: 100%; height: 20px; background: transparent; outline: 0 }
.reader input[type=range]::-webkit-slider-runnable-track { height: 2px; border-radius: 1px; background: var(--faint) }
.reader input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(0, 0, 0, .15) }
.r-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; margin: 0 6px 4px 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--faint) }
.r-seg button { padding: 5px 11px !important; border-radius: 8px; font-size: calc(12.5px * var(--u, 1)); color: var(--soft); transition: background-color .2s ease, color .2s ease }
.r-seg button.on { background: var(--faint); color: var(--ink) }
.r-check { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; font-size: calc(13px * var(--u, 1)); color: var(--ink) }
.r-check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0 }
.r-sub { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--faint); font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(18px * var(--u, 1)); color: var(--ink) }
.r-foot2 { display: flex; justify-content: space-between; margin-top: 18px }
.r-why p { margin: 0 0 12px; font-family: var(--r-font); font-size: calc(14px * var(--u, 1)); line-height: 1.55 }
.r-why b { font-weight: 600 }
.r-why .r-src { font-family: 'Jost', sans-serif; font-size: calc(11px * var(--u, 1)); line-height: 1.6; color: var(--soft) }
.r-big { margin: 4px 0 0; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: calc(40px * var(--u, 1)); color: var(--ink) }
.r-big small { font-family: 'Jost', sans-serif; font-style: normal; font-size: calc(13px * var(--u, 1)); color: var(--soft) }
.r-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 64px; margin: 14px 0 4px; align-items: end }
.r-week span { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px }
.r-week i { width: 100%; max-width: 18px; flex: 1; border-radius: 3px; background: color-mix(in srgb, var(--accent) 45%, transparent); transform-origin: bottom }
.r-week i.met { background: var(--accent) }
.r-week b { font-weight: 400; font-size: calc(10px * var(--u, 1)); color: var(--soft) }

/* ---------- The shelf ---------- */
.r-shelf { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain }
.r-shelfin { max-width: calc(1040px * var(--u, 1)); margin: 0 auto; padding: 36px 48px 64px; position: relative }
.r-shead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px }
.r-eyebrow { font-size: calc(11.5px * var(--u, 1)); letter-spacing: 3px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px }
.r-shead h1 { margin: 0; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(44px * var(--u, 1)); line-height: 1; color: var(--ink) }
.r-goalcard { display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 8px !important; border-radius: 40px; text-align: left; font-size: calc(13px * var(--u, 1)); color: var(--ink); box-shadow: inset 0 0 0 1px var(--faint); transition: background-color .2s ease }
.r-goalcard:hover { background: var(--faint) }
.r-goalcard b { font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(22px * var(--u, 1)) }
.r-goalcard small { display: block; font-size: calc(12px * var(--u, 1)); color: var(--soft) }
.r-goalmore { margin: -10px 0 26px auto; width: calc(340px * var(--u, 1)); padding: 6px 18px 16px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--faint) }
.r-continue { display: grid; grid-template-columns: calc(150px * var(--u, 1)) 1fr; gap: 30px; align-items: center; padding: 26px; margin-bottom: 34px; border-radius: 22px; background: color-mix(in srgb, var(--ink) 4%, transparent); box-shadow: inset 0 0 0 1px var(--faint) }
.r-continue h2 { margin: 0 0 6px; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(30px * var(--u, 1)); line-height: 1.15; color: var(--ink) }
.r-continue p { margin: 0 0 14px; font-size: calc(14.5px * var(--u, 1)); color: var(--soft) }
.r-continue .r-mutedp { margin: 6px 0 16px }
.r-go { height: 38px; padding: 0 26px !important; border-radius: 19px; background: linear-gradient(135deg, #CDA95E, #A9823A) !important; color: #FFFDF8 !important; font-size: calc(11px * var(--u, 1)) !important; letter-spacing: 2.6px; text-transform: uppercase; box-shadow: 0 6px 16px rgba(169, 130, 58, .22); transition: box-shadow .25s ease }
.r-go:hover { box-shadow: 0 8px 20px rgba(169, 130, 58, .32) }
.r-bar2 { position: relative; height: 2px; max-width: 280px; border-radius: 1px; background: var(--faint); overflow: hidden }
.r-bar2 i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0) }
.r-row-books h3 { margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--faint); font-family: 'Jost', sans-serif; font-weight: 400; font-size: calc(12px * var(--u, 1)); letter-spacing: 2.4px; text-transform: uppercase; color: var(--soft) }
.r-row-books { margin-bottom: 36px }
.r-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(140px * var(--u, 1)), 1fr)); gap: 30px 26px }
.r-book { position: relative; display: flex; flex-direction: column; gap: 10px }
.r-cover { position: relative; display: block; aspect-ratio: 2 / 3; width: 100%; border-radius: 4px 7px 7px 4px; overflow: hidden; background: #0F1B33; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 8px 22px rgba(20, 25, 40, .14); transition: transform .3s ease, box-shadow .3s ease }
.r-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .18), rgba(255, 255, 255, .08) 3%, rgba(0, 0, 0, 0) 7%); pointer-events: none }
.r-book .r-cover:hover, .r-continue .r-cover:hover { transform: translateY(-3px); box-shadow: 0 2px 3px rgba(0, 0, 0, .12), 0 14px 30px rgba(20, 25, 40, .2) }
.r-cover img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover }
.r-gencover { height: 100%; box-sizing: border-box; padding: 26% 12% 12%; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: #EAD9AE; background: linear-gradient(160deg, #17284A, #0B1530) }
.r-gencover b { font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(17px * var(--u, 1)); line-height: 1.2 }
.r-gencover small { font-size: calc(9px * var(--u, 1)); letter-spacing: 1.6px; text-transform: uppercase; opacity: .7 }
.r-fin { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 9px; background: rgba(15, 27, 51, .78); color: #EAD9AE; font-size: calc(9px * var(--u, 1)); letter-spacing: 1.6px; text-transform: uppercase }
.r-btxt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(18px * var(--u, 1)); line-height: 1.2; color: var(--ink) }
.r-btxt small { display: block; margin: 3px 0 8px; font-size: calc(12.5px * var(--u, 1)); color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.r-more { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; background: rgba(15, 27, 51, .55) !important; color: #F2E8CF !important; font-size: calc(15px * var(--u, 1)) !important; line-height: 1; opacity: 0; transition: opacity .2s ease }
.r-book:hover .r-more { opacity: 1 }
.r-add { aspect-ratio: 2 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px !important; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--faint); text-align: center; font-size: calc(14.5px * var(--u, 1)); color: var(--ink); transition: background-color .2s ease }
.r-add:hover { background: var(--faint) }
.r-add span { font-family: 'Cormorant Garamond', serif; font-size: calc(40px * var(--u, 1)); line-height: 1; color: var(--accent) }
.r-add small { font-size: calc(12px * var(--u, 1)); line-height: 1.45; color: var(--soft) }
.r-importing { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); padding: 10px 20px; border-radius: 20px; background: var(--ink); color: var(--bg); font-size: calc(13px * var(--u, 1)); z-index: 25 }
.r-menu { position: absolute; z-index: 22; width: 190px; padding: 6px; border-radius: 12px; background: var(--bg); box-shadow: 0 10px 30px rgba(15, 20, 35, .2), 0 0 0 1px var(--faint) }
.r-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px !important; border-radius: 8px; font-size: calc(13px * var(--u, 1)) }
.r-menu button:hover { background: var(--faint) }

.r-dialog { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(10, 14, 25, .28) }
.r-dcard { width: min(400px, calc(100% - 40px)); padding: 22px 24px 18px; border-radius: 18px; background: var(--bg); box-shadow: 0 20px 60px rgba(0, 0, 0, .25) }
.r-dcard h3 { margin: 0 0 10px; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(24px * var(--u, 1)) }
.r-dcard p { margin: 0 0 10px; font-size: calc(13.5px * var(--u, 1)); line-height: 1.5; color: var(--soft) }
.r-dcard label { display: block; margin: 10px 0 0; font-size: calc(10.5px * var(--u, 1)); letter-spacing: 1.6px; text-transform: uppercase; color: var(--soft) }
.r-dcard label .r-input { margin-top: 5px; text-transform: none; letter-spacing: 0 }

.r-toast { position: absolute; left: 50%; bottom: 56px; z-index: 26; transform: translateX(-50%); padding: 9px 18px; border-radius: 18px; background: var(--ink); color: var(--bg); font-size: calc(12.5px * var(--u, 1)); letter-spacing: .3px; transition: opacity .5s ease; white-space: nowrap }
.r-toast.out { opacity: 0 }
.r-spark { position: absolute; z-index: 27; color: var(--accent); pointer-events: none; opacity: 0 }
.r-rest { position: absolute; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 82%, transparent) }
.r-restcard { width: min(380px, calc(100% - 40px)); padding: 26px 28px 20px; border-radius: 22px; background: var(--bg); text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .18), 0 0 0 1px var(--faint) }
.r-restcard h3 { margin: 10px 0 8px; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: calc(28px * var(--u, 1)) }
.r-restcard p { margin: 0 0 18px; font-family: var(--r-font); font-size: calc(15px * var(--u, 1)); line-height: 1.55; color: var(--soft) }
.r-restbar { display: block; height: 2px; margin: 0 20% 16px; background: var(--faint); border-radius: 1px; overflow: hidden }
.r-restbar i { display: block; height: 100%; background: var(--accent); transform-origin: left }

@media (max-width: 720px) {
  .r-shelfin { padding: 24px 18px 48px }
  .r-continue { grid-template-columns: 100px 1fr; gap: 18px; padding: 18px }
  .r-shead { flex-direction: column; align-items: flex-start }
  .r-cname { display: none }
}

.r-leaf.idle, .r-cast.idle { visibility: hidden }

/* Contents: chapters in Cormorant, their sections folded beneath, numbers kept in their own quiet column. */
.r-tocbook { margin: -6px 0 14px; font-size: calc(12px * var(--u, 1)); letter-spacing: .3px; color: var(--soft) }
.r-toc, .r-tsubs { margin: 0; padding: 0; list-style: none }
.r-tch { border-top: 1px solid var(--faint) }
.r-tch:last-child { border-bottom: 1px solid var(--faint) }
.r-trow { display: grid; grid-template-columns: 1fr auto 24px; align-items: center; gap: 8px }
.r-tgo { display: block; text-align: left; padding: 12px 4px 12px 0 !important; color: var(--ink) }
.r-tgo small { display: block; margin-bottom: 3px; font-size: calc(10.5px * var(--u, 1)); letter-spacing: .2em; text-transform: uppercase; color: var(--accent) }
.r-tgo span { display: block; font-family: 'Cormorant Garamond', 'Iowan Old Style', serif; font-style: italic; font-size: calc(18px * var(--u, 1)); line-height: 1.25; text-wrap: pretty; transition: color .2s ease }
.r-tgo:hover span { color: var(--accent) }
.r-tch.here .r-tgo span { color: var(--accent) }
.r-trow em { font-style: normal; font-size: calc(11.5px * var(--u, 1)); color: var(--soft); font-variant-numeric: tabular-nums }
.r-tfold { width: 24px; height: 24px; display: flex !important; align-items: center; justify-content: center; border-radius: 6px; color: var(--soft); transition: background-color .2s ease }
.r-tfold:hover { background: var(--faint) }
.r-tfold svg { transition: transform .25s ease }
.r-tch.open .r-tfold svg { transform: rotate(180deg) }
.r-tsubs { display: none; margin: -2px 0 12px; padding-left: 2px; border-left: 1px solid color-mix(in srgb, var(--accent) 35%, transparent) }
.r-tch.open .r-tsubs { display: block }
.r-tsubs button { display: grid; grid-template-columns: 2em 1fr; width: 100%; text-align: left; padding: 5px 6px 5px 10px !important; border-radius: 0 8px 8px 0; font-size: calc(13.5px * var(--u, 1)); line-height: 1.45; color: var(--soft); transition: background-color .2s ease, color .2s ease }
.r-tsubs button:hover { background: var(--faint); color: var(--ink) }
.r-tsubs b { font-weight: 400; font-size: .86em; color: var(--accent); font-variant-numeric: tabular-nums; padding-top: .08em }
.r-tsubs li.h2 button { color: var(--ink) }
.r-tsubs li.now button { color: var(--accent) }
.r-tsubs li.now b::before { content: ''; display: inline-block; width: 4px; height: 4px; margin: 0 5px 2px -9px; border-radius: 50%; background: var(--accent) }

/* The paper curl (one page). Every part is placed by transform; the turning page sits above the next one. */
.r-curl { position: absolute; top: 0; width: var(--r-pagew); height: 100%; overflow: hidden; z-index: 5; pointer-events: none }
.r-curl.idle { visibility: hidden }
.r-curl > *, .r-ccut, .r-cflip, .r-cbox, .r-cin, .r-cshadow { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform }
.r-ccut, .r-cbox { overflow: hidden }
.r-cpaper { position: absolute; left: 0; top: 0; width: var(--r-pagew); height: var(--r-curlh, 100vh); overflow: hidden; background: var(--bg) }
.r-cback { background: color-mix(in srgb, var(--bg) 94%, #fff) }
.reader.dark .r-cback { background: color-mix(in srgb, var(--bg) 90%, #fff) }
/* Light gathers along the fold and deepens towards the edge, like a sheet bending. */
.r-cshade { position: absolute; left: 0; top: 0; width: 100px; height: 1000vmax; transform-origin: 0 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .14) 0, rgba(255, 255, 255, .28) 5%, rgba(255, 255, 255, .06) 22%, rgba(0, 0, 0, .05) 62%, rgba(0, 0, 0, .16) 100%) }
.reader.dark .r-cshade { background: linear-gradient(90deg, rgba(0, 0, 0, .35) 0, rgba(255, 255, 255, .1) 5%, rgba(255, 255, 255, .03) 22%, rgba(0, 0, 0, .12) 62%, rgba(0, 0, 0, .3) 100%) }
.r-cshadow { width: 70px; height: 1000vmax; background: linear-gradient(90deg, rgba(0, 0, 0, .2), rgba(0, 0, 0, .06) 40%, rgba(0, 0, 0, 0)); opacity: 0 }

/* ---------- The page as a sheet ----------
   The page is a sheet of paper resting on a slightly deeper ground, with a faint grain. Nothing here moves. */
.r-read { background: color-mix(in srgb, var(--bg) 92%, var(--ink)) }
.reader.dark .r-read { background: color-mix(in srgb, var(--bg) 82%, #000) }
.r-stage { margin: 2px 0 4px }
.r-page, .r-face, .r-cpaper, .r-sheet {
  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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .28 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E") }
.reader.dark .r-page, .reader.dark .r-face, .reader.dark .r-cpaper, .reader.dark .r-sheet { background-image: none }
.r-page { box-shadow: 0 0 0 1px var(--faint), 0 8px 34px rgba(20, 25, 40, .07) }
.reader.dark .r-page { box-shadow: 0 0 0 1px rgba(255, 255, 255, .04), 0 8px 34px rgba(0, 0, 0, .3) }

/* Page numbers: small and centred at the foot of each page, between two gold points. */
.r-folio { position: absolute; left: 0; right: 0; bottom: calc(var(--r-vpad) * .32); display: flex; align-items: center; justify-content: center; gap: .7em; font-family: 'Jost', 'Avenir Next', sans-serif; font-size: calc(12px * var(--u, 1)); letter-spacing: .12em; color: var(--soft); font-variant-numeric: tabular-nums; pointer-events: none }
.r-folio:empty { display: none }
.r-folio::before, .r-folio::after { content: ''; width: 4px; height: 4px; transform: rotate(45deg); background: var(--accent); opacity: .55 }

/* A chapter opens with a large initial in gold and a first line in small capitals. */
.r-flow p.r-open::first-letter { float: left; margin: .05em .09em 0 0; font-family: 'Cormorant Garamond', var(--r-font); font-size: 3.3em; line-height: .8; font-weight: 400; color: var(--accent) }
.r-flow p.r-open::first-line { font-variant-caps: small-caps; letter-spacing: .03em }
.reader.indent .r-flow p.r-open { text-indent: 0 }
/* A fine gold rule before each section. */
.r-flow h2::before { content: ''; display: block; width: 1.8em; height: 1px; margin-bottom: .75em; background: var(--accent); opacity: .45 }

/* ---------- Continuous scroll ---------- */
.r-scroll { display: none; position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; z-index: 1 }
.r-stage.scrolling .r-scroll { display: block }
.r-stage.scrolling .r-page, .r-stage.scrolling .r-leaf, .r-stage.scrolling .r-curl, .r-stage.scrolling .r-cast, .r-stage.scrolling .r-edge, .r-stage.scrolling .r-spine, .r-stage.scrolling .r-ribbon { display: none !important }
.r-sheet { position: relative; width: var(--r-pagew); min-height: 100%; margin: 0 auto; box-sizing: border-box; padding: var(--r-vpad) var(--r-gut) 40vh; background-color: var(--bg); box-shadow: 0 0 0 1px var(--faint), 0 8px 34px rgba(20, 25, 40, .07) }
.r-flow.r-sflow { position: static; width: auto; height: auto; column-width: auto; columns: auto; transform: none }
.r-sflow .r-titlepage { height: auto; padding: 16% 0 14% }
.r-sflow .r-notes { margin-top: 2.4em; padding-top: 1.2em; border-top: 1px solid var(--faint) }
.r-schap + .r-schap { margin-top: 3em }
.r-schap { position: relative }
/* Where the PDF turns a page: a fine gold tick in the text, and a faint rule across with the PDF's page number. */
.r-pb { display: none }
.r-sflow .r-pb { display: inline-block; vertical-align: top; height: calc((var(--r-lh, 1.6) + 2.4) * 1em); text-indent: 0 }
.r-sflow .r-pb::after { content: none }
.r-sflow .r-pb::before { content: 'p. ' attr(data-pg); position: absolute; left: 0; right: 0; margin-top: calc((var(--r-lh, 1.6) + 1.2) / .58 * 1em); height: 1.5em; line-height: 1.5em; text-align: right; white-space: nowrap; font-family: 'Jost', sans-serif; font-size: .58em; font-style: normal; font-weight: 500; letter-spacing: .1em; color: color-mix(in srgb, var(--accent) 85%, transparent); text-indent: 0; background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent) 0 3px, transparent 3px 8px) left center / calc(100% - 5.2em) 1px no-repeat; pointer-events: none; transform: translateY(-50%) }

.r-swatches button span { font-size: 1.05em; line-height: 1 }
.r-swatches button i { font-style: normal; font-size: calc(9.5px * var(--u, 1)); line-height: 1.25; opacity: .85 }
.r-themenote { margin: 0 2px 12px; font-size: calc(12.5px * var(--u, 1)); line-height: 1.45; color: var(--soft) }

/* ---------- Colour in the text ----------
   Headings take a deep tone of the paper's gold, numbers and bullets the gold itself, and each paragraph opens
   with its first word in that deep tone. Everything else stays ink. */
.reader { --head: color-mix(in srgb, var(--accent) 62%, var(--ink)) }
.reader.dark { --head: color-mix(in srgb, var(--accent) 78%, var(--ink)) }
.r-flow h2 { color: var(--head) }
.r-chead h1, .r-titlepage h1 { color: var(--head) }
.r-flow h3 { color: var(--head); font-size: .74em; letter-spacing: .13em }
.r-flow .r-n { color: var(--accent); font-family: var(--r-font); font-weight: 600; font-size: .95em; letter-spacing: 0; font-variant-numeric: lining-nums tabular-nums }
.r-flow h3 .r-n { font-size: 1.35em; margin-right: .15em }
.r-np { position: relative; padding-left: 1.7em; text-indent: 0 !important }
.r-np > .r-n:first-child { position: absolute; left: 0; width: 1.4em; text-align: right; top: 0 }
.r-fw { color: var(--head); font-weight: 600 }
.reader.plainlead .r-fw { color: inherit; font-weight: inherit }
.r-list li::before { opacity: 1; width: .3em; height: .3em }
.r-list li { padding-left: 1.3em }

/* Page numbers, a little larger, in the book's own old-style figures. */
.r-folio { font-family: 'Cormorant Garamond', var(--r-font); font-size: calc(15px * var(--u, 1)); letter-spacing: .06em; color: var(--head); font-variant-numeric: lining-nums }

/* ---------- Sections on the shelf ---------- */
.r-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 28px }
.r-chips button { height: 32px; padding: 0 14px !important; border-radius: 16px; font-size: calc(12.5px * var(--u, 1)); letter-spacing: .5px; color: var(--soft); box-shadow: inset 0 0 0 1px var(--faint); transition: background-color .2s ease, color .2s ease }
.r-chips button:hover { color: var(--ink); background: var(--faint) }
.r-chips button.on { color: var(--bg); background: var(--ink); box-shadow: none }
.r-chips .r-newsec { color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent) }
.r-section > h3 { display: flex; align-items: baseline; gap: 12px }
.r-section > h3 span { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: calc(26px * var(--u, 1)); letter-spacing: 0; text-transform: none; color: var(--head) }
.r-section > h3 em { font-style: normal; font-size: calc(11px * var(--u, 1)); letter-spacing: 1.6px; color: var(--soft) }
.r-secmore { margin-left: auto; width: 30px; height: 26px; border-radius: 8px; color: var(--soft); font-size: calc(16px * var(--u, 1)) }
.r-secmore:hover { background: var(--faint); color: var(--ink) }
.r-series { margin-bottom: 22px }
.r-series h4 { margin: 4px 0 12px; font-family: 'Jost', sans-serif; font-weight: 400; font-size: calc(11px * var(--u, 1)); letter-spacing: 2.2px; text-transform: uppercase; color: var(--accent) }
.r-ideas, .r-secpick { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 6px }
.r-ideas button, .r-secpick button { height: 30px; padding: 0 12px !important; border-radius: 15px; font-size: calc(12.5px * var(--u, 1)); color: var(--ink); box-shadow: inset 0 0 0 1px var(--faint) }
.r-ideas button:hover, .r-secpick button:hover { background: var(--faint) }
.r-secpick button.on { background: var(--ink); color: var(--bg); box-shadow: none }
.r-secpick button[data-new] { color: var(--accent) }

/* ---------- Highlights for study ---------- */
.r-hlfilter { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px }
.r-hlfilter button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px !important; border-radius: 14px; font-size: calc(12px * var(--u, 1)); color: var(--soft); box-shadow: inset 0 0 0 1px var(--faint) }
.r-hlfilter button.on { color: var(--ink); background: var(--faint) }
.r-hlfilter em { font-style: normal; opacity: .7; font-variant-numeric: tabular-nums }
.r-hlfilter .r-dot, .r-namerow .r-dot { width: 12px; height: 12px; display: inline-block; flex: none }
.r-hlsearch { margin-bottom: 6px }
.r-namerow { display: flex; align-items: center; gap: 10px; margin: 8px 0 }
.r-namerow .r-dot { width: 18px; height: 18px; border-radius: 50% }

/* Justified text: even spacing helped by hyphenation, never stretched across a short last line. */
.reader.justify .r-flow p { text-align: justify; text-justify: inter-word; -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 6 3 2 }
.reader.justify .r-flow .r-quran p, .reader.justify .r-flow .r-cap, .reader.justify .r-flow .r-by { text-align: center }
.reader.justify .r-flow .r-cap { text-align: left }

/* A chapter opens beneath its number, set large and faint. */
.r-cnum { font-family: 'Cormorant Garamond', var(--r-font); font-weight: 300; font-size: 4.2em; line-height: .9; color: var(--accent); opacity: .28; margin-bottom: .05em; font-variant-numeric: lining-nums }
/* The Qur'an between ornate brackets, in gold. */
.r-quran p::before { content: '\FD3F'; margin-right: .3em; color: var(--accent); font-style: normal; font-family: 'Geeza Pro', 'Al Bayan', serif }
.r-quran p::after { content: '\FD3E'; margin-left: .3em; color: var(--accent); font-style: normal; font-family: 'Geeza Pro', 'Al Bayan', serif }
/* Who narrated a hadith, in quiet gold capitals. */
.r-lead { font-variant-caps: all-small-caps; letter-spacing: .1em; color: var(--head); font-size: .8em }
/* The end of a chapter. */
.r-flourish { display: flex; align-items: center; justify-content: center; gap: .8em; margin: 1.6em 0 .6em; color: var(--accent); break-inside: avoid }
.r-flourish i { width: 2.6em; height: 1px; background: currentColor; opacity: .4 }
.r-flourish svg { width: .9em; height: .9em }

/* Covers, upright and centred in their frame. */
.r-cover { aspect-ratio: 5 / 7 }
.r-cover img { object-position: 50% 50% }

/* Ornament: a fine line, small dots and an eight-pointed star, drawn once and coloured by the paper's gold. */
.reader { --r-band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 16'%3E%3Crect x='4' y='7.6' width='50' height='.8'/%3E%3Crect x='106' y='7.6' width='50' height='.8'/%3E%3Ccircle cx='57.5' cy='8' r='1.2'/%3E%3Ccircle cx='102.5' cy='8' r='1.2'/%3E%3Cpolygon points='65,5.4 67.6,8 65,10.6 62.4,8'/%3E%3Cpolygon points='95,5.4 97.6,8 95,10.6 92.4,8'/%3E%3Cpolygon points='75.2,3.2 84.8,3.2 84.8,12.8 75.2,12.8'/%3E%3Cpolygon points='80,1.2 86.8,8 80,14.8 73.2,8'/%3E%3C/svg%3E") }
.r-band { display: block; width: 8.5em; height: .85em; margin: 0 auto; background: var(--accent); opacity: .7; -webkit-mask: var(--r-band) center / contain no-repeat; mask: var(--r-band) center / contain no-repeat }
.r-chead .r-band { margin-top: .2em }
.r-flourish .r-band { width: 7em; opacity: .55 }
.r-flourish.r-last { flex-direction: column; gap: .7em; margin-top: 2.6em }
.r-flourish.r-last .r-band { width: 11em; height: 1.1em; opacity: .75 }
.r-flourish small { font-family: 'Jost', sans-serif; font-size: .58em; letter-spacing: .32em; text-transform: uppercase; opacity: .8 }
.r-break { margin: 1.3em 0; break-inside: avoid }
.r-break .r-band { width: 5.5em; opacity: .5 }
/* A hadith's gold rule ends in two small diamonds. */
.r-hadith { position: relative }
.r-hadith::before, .r-hadith::after { content: ''; position: absolute; left: -2.5px; width: 4px; height: 4px; transform: rotate(45deg); background: var(--accent); opacity: .75 }
.r-hadith::before { top: -3px }
.r-hadith::after { bottom: -3px }
/* A section heading's gold rule ends in a small diamond. */
.r-flow h2::after { content: ''; position: absolute; left: 1.95em; top: calc(.5px - .13em); width: .26em; height: .26em; transform: rotate(45deg); background: var(--accent); opacity: .55 }
.r-flow h2 { position: relative }

/* Highlights on the night papers: clear, warm colours with a brighter line beneath, never muddy. */
.reader.dark mark.c-gold { background: rgba(246, 200, 92, .3); box-shadow: inset 0 -2px 0 rgba(246, 200, 92, .75) }
.reader.dark mark.c-rose { background: rgba(244, 132, 128, .3); box-shadow: inset 0 -2px 0 rgba(244, 132, 128, .75) }
.reader.dark mark.c-sage { background: rgba(122, 206, 134, .27); box-shadow: inset 0 -2px 0 rgba(122, 206, 134, .72) }
.reader.dark mark.c-sky { background: rgba(110, 172, 245, .32); box-shadow: inset 0 -2px 0 rgba(110, 172, 245, .78) }
.reader.dark .r-dot.c-gold { background: rgb(246, 200, 92) } .reader.dark .r-dot.c-rose { background: rgb(244, 132, 128) }
.reader.dark .r-dot.c-sage { background: rgb(122, 206, 134) } .reader.dark .r-dot.c-sky { background: rgb(110, 172, 245) }
.reader.dark mark.noted { box-shadow: inset 0 -2px 0 var(--accent) }

/* The top bar: a clear reading timer and one Options button, both in words, legible at a glance. */
.r-bar { opacity: .82 }
.r-goalpill { height: 36px; padding: 0 14px 0 8px; font-family: 'Jost', sans-serif; font-size: calc(13px * var(--u, 1)); letter-spacing: .02em; color: var(--ink); box-shadow: inset 0 0 0 1px var(--faint) }
.r-goalpill .r-tplay, .r-goalpill .r-tpause { display: none }
.r-goalpill.manual:not(.running) .r-tplay { display: inline; color: var(--accent) }
.r-goalpill.manual.running .r-tpause { display: inline; color: var(--accent) }
.r-goalpill.manual.running { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent) }
.r-optwrap { position: relative; margin-left: 6px }
.r-opts { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 10px; border-radius: 18px; font-family: 'Jost', sans-serif; font-size: calc(13.5px * var(--u, 1)); letter-spacing: .02em; color: var(--ink); box-shadow: inset 0 0 0 1px var(--faint); transition: background-color .2s ease }
.r-opts:hover, .r-opts.on { background: var(--faint) }
.r-opts .r-chev { opacity: .6; transition: transform .2s ease }
.r-opts.on .r-chev { transform: rotate(180deg) }
.r-optmenu { position: absolute; right: 0; top: 44px; z-index: 30; min-width: 250px; padding: 8px; border-radius: 14px; background: var(--bg); color: var(--ink); box-shadow: 0 12px 36px rgba(15, 20, 35, .2), 0 0 0 1px var(--faint) }
.reader.dark .r-optmenu { background: color-mix(in srgb, var(--bg) 86%, #fff); box-shadow: 0 12px 36px rgba(0, 0, 0, .45) }
.r-optmenu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px !important; border-radius: 9px; text-align: left; font-family: 'Jost', sans-serif; font-size: calc(15px * var(--u, 1)); color: var(--ink) }
.r-optmenu button svg { flex: none; color: var(--accent) }
.r-optmenu button:hover, .r-optmenu button.on { background: var(--faint) }
.r-optmenu .r-bm.on svg { fill: var(--accent) }
.r-timerseg button { padding: 0 12px }

/* A calm top bar: Library on the left, the book's title in the middle, the timer and Options on the right. */
.r-bar { grid-template-columns: minmax(110px, 1fr) minmax(0, 2.2fr) minmax(110px, 1fr); height: 52px; padding: 0 16px; opacity: 1; border-bottom: 1px solid var(--faint); color: var(--soft) }
.r-home { justify-self: start; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px; border-radius: 17px; font-family: 'Jost', sans-serif; font-size: calc(13.5px * var(--u, 1)); color: var(--ink); transition: background-color .2s ease }
.r-home:hover { background: var(--faint) }
.r-home svg { color: var(--accent) }
.r-heading { justify-content: center }
.r-btitle { max-width: 100%; font-size: calc(17px * var(--u, 1)); color: var(--soft) }
.r-cname { display: none }
.r-tools { justify-self: end; gap: 6px }
.r-goalpill { margin-right: 0; padding: 0 12px 0 7px; box-shadow: none; color: var(--soft) }
.r-goalpill:hover { color: var(--ink) }
.r-goalpill.manual.running { color: var(--ink); box-shadow: none; background: var(--faint) }
.r-optwrap { margin-left: 0 }
.r-opts { color: var(--ink) }
/* In a long scroll the text fades softly under the bar instead of being cut off. */
.r-scroll { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px); mask-image: linear-gradient(to bottom, transparent 0, #000 26px) }
@media (max-width: 640px) { .r-btitle { display: none } .r-bar { grid-template-columns: auto 1fr auto } }
.r-goalpill, .r-opts, .r-home { white-space: nowrap; flex: none }

/* Book cards: each line has its own room, so a two-line title and an author's accented name never touch. */
.r-btxt b { -webkit-line-clamp: 3; line-height: 1.28; padding-bottom: .12em }
.r-btxt small { margin: 6px 0 10px; line-height: 1.55; padding-top: .1em; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: clip }
.r-btxt { min-width: 0 }
/* Authors' names often carry transliteration marks (ā, ī, ū, ḥ); this face draws them properly. */
.r-btxt small, .r-cinfo > p, .r-by, .r-gencover small { font-family: 'Avenir Next', 'Helvetica Neue', sans-serif }

/* While a book is open, the app's top bar melts into the reading desk, its border gone, its buttons in the page's ink. */
.sheet:has(section[aria-label="The Perfect Library"] .r-read:not([hidden])) > div:first-child { background: var(--lib-top, #EDE7DA) !important; border-bottom-color: transparent !important; transition: background-color 1.2s ease }
.sheet:has(section[aria-label="The Perfect Library"] .r-read:not([hidden])) > div:first-child > .dots { background: color-mix(in srgb, var(--lib-ink, #27324A) 22%, transparent) !important }
.sheet:has(section[aria-label="The Perfect Library"] .r-read:not([hidden])) > div:first-child h1 > button, .sheet:has(section[aria-label="The Perfect Library"] .r-read:not([hidden])) > div:first-child > div > button { color: var(--lib-ink, #27324A) !important; transition: color 1.2s ease }
.sheet:has(section[aria-label="The Perfect Library"] .r-read:not([hidden])) > div:first-child h1 > button svg path, .sheet:has(section[aria-label="The Perfect Library"] .r-read:not([hidden])) > div:first-child > div > button svg path, .sheet:has(section[aria-label="The Perfect Library"] .r-read:not([hidden])) > div:first-child > div > button svg circle { stroke: var(--lib-ink, #27324A) !important }

/* Shelf: every card's progress bar sits on the same line */
.r-book { height: 100% }
.r-btxt { flex: 1 1 auto; display: flex; flex-direction: column }
.r-btxt .r-bar2 { margin-top: auto; flex: none; width: 100% }

/* The PDF's own structure: indented passages stay indented, and wider gaps between sections keep their space */
.r-flow [data-ind] { text-indent: 0 }
.r-flow [data-ind="1"] { margin-left: 1.6em }
.r-flow [data-ind="2"] { margin-left: 3.2em }
.r-flow [data-ind="3"] { margin-left: 4.8em }
.r-flow p[data-gap], .r-flow ul[data-gap], .r-flow blockquote[data-gap] { margin-top: 2.2em }

/* Notes sit apart from the main text in a translucent gold box */
.r-notes, .r-endnotes { padding: 1em 1.15em .4em; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 9%, transparent); -webkit-column-break-inside: auto; break-inside: auto }
.r-endnotes { margin: 0 0 1.2em; font-size: .86em; line-height: 1.5 }
.r-endnotes ol { margin: 0; padding: 0; list-style: none }
.r-endnotes li { margin: 0 0 .7em; display: grid; grid-template-columns: 2em 1fr; text-indent: 0 }
.r-endnotes li span { color: var(--accent); font-family: 'Jost', sans-serif; font-size: .8em; font-weight: 500; padding-top: .2em }
.r-endnotes li:target, .r-endnotes li.r-flash { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 4px }
.r-flow sup.fn { color: var(--accent); cursor: pointer; font-weight: 500 }

/* Pictures, charts and tables from the PDF, kept where they stood */
.r-fig { margin: 1.4em 0; text-align: center; text-indent: 0; break-inside: avoid; -webkit-column-break-inside: avoid }
.r-fig img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 6px; background: #fff; box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent) }
.reader[data-theme=night] .r-fig img, .reader[data-theme=dark] .r-fig img { filter: brightness(.86) }
.r-tablewrap { margin: 1.2em 0; overflow-x: auto; text-indent: 0; break-inside: avoid; -webkit-column-break-inside: avoid }
.r-table { width: 100%; border-collapse: collapse; font-size: .86em; line-height: 1.45 }
.r-table th, .r-table td { padding: .4em .7em; text-align: left; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent) }
.r-table th { font-family: 'Jost', sans-serif; font-weight: 500; font-size: .82em; letter-spacing: .06em; color: var(--accent); border-bottom-color: color-mix(in srgb, var(--accent) 50%, transparent) }
.r-lead.r-leadnum { font-family: var(--r-font); font-size: 1em; font-variant-caps: normal; letter-spacing: 0; color: var(--accent); margin-bottom: .3em }
.r-endnotes { padding-bottom: .9em }
.r-endnotes li:last-child { margin-bottom: 0 }

/* Today's goal reached: a quiet card under the top bar that stays until closed */
.r-goalpop { position: absolute; top: 64px; left: 50%; z-index: 27; width: min(420px, calc(100% - 32px)); transform: translateX(-50%); display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; padding: 14px 18px 10px; border-radius: 16px; background: color-mix(in srgb, var(--bg) 92%, var(--accent)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: 0 14px 40px rgba(0, 0, 0, .22); color: var(--ink); animation: r-gpin .6s ease both; transition: opacity .6s ease }
.r-goalpop.out { opacity: 0 }
@keyframes r-gpin { from { opacity: 0 } to { opacity: 1 } }
.r-gpstar { width: 26px; height: 26px; color: var(--accent) }
.r-gpstar svg { width: 100%; height: 100% }
.r-gptext b { display: block; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 500; font-size: 1.18em; line-height: 1.25 }
.r-gptext small { display: block; margin-top: 2px; font-family: 'Jost', sans-serif; font-size: .78em; letter-spacing: .04em; color: var(--soft) }
.r-gpacts { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px }
.r-gpacts .r-txt { font-size: .82em; color: var(--accent) }

/* Qur'an quotations: a soft rounded card, a little crescent and star above, tiny sparkles at either end */
.r-quran { position: relative; margin: 1.6em .2em 1.4em; padding: 1.5em 1.2em .9em; border-radius: 18px; background: color-mix(in srgb, var(--accent) 7%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent) }
.r-quran::before { content: ''; position: absolute; top: 0; left: 50%; width: 2.1em; height: 1.5em; margin: 0; transform: translate(-50%, -55%); opacity: 1; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 30'%3E%3Ccircle cx='21' cy='15' r='15' fill='%23000' fill-opacity='0'/%3E%3Cpath d='M19 4a11 11 0 1 0 9.5 16.5A9 9 0 1 1 19 4z'/%3E%3Cpath d='M31 7.5l1.2 2.6 2.8.4-2 2 .5 2.8-2.5-1.4-2.5 1.4.5-2.8-2-2 2.8-.4z'/%3E%3Ccircle cx='8' cy='20' r='1'/%3E%3Ccircle cx='36' cy='21' r='.9'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 30'%3E%3Cpath d='M19 4a11 11 0 1 0 9.5 16.5A9 9 0 1 1 19 4z'/%3E%3Cpath d='M31 7.5l1.2 2.6 2.8.4-2 2 .5 2.8-2.5-1.4-2.5 1.4.5-2.8-2-2 2.8-.4z'/%3E%3Ccircle cx='8' cy='20' r='1'/%3E%3Ccircle cx='36' cy='21' r='.9'/%3E%3C/svg%3E") center / contain no-repeat; box-shadow: 0 0 0 6px var(--bg); border-radius: 50% }
.r-quran p::before, .r-quran p::after { content: '✦'; display: inline-block; font-family: 'Apple Symbols', 'Jost', sans-serif; font-style: normal; font-size: .55em; vertical-align: .35em; color: var(--accent); opacity: .85 }
.r-quran p::before { margin-right: .55em }
.r-quran p::after { margin-left: .55em }
.r-quran cite { margin-top: .4em }
.r-quran::after { content: ''; position: absolute; top: -1px; left: 50%; width: 3.4em; height: 1px; transform: translateX(-50%); background: var(--bg) }
.r-quran::before { z-index: 1; width: 2.5em; height: 1.8em; box-shadow: none }
/* A shelf section folds away to its heading; the whole heading toggles it. */
.r-section > h3 { cursor: pointer; user-select: none; -webkit-user-select: none }
.r-secfold { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: -4px; border-radius: 7px; color: var(--soft); align-self: center; transition: transform .2s ease }
.r-section > h3:hover .r-secfold { background: var(--faint); color: var(--ink) }
.r-section.folded .r-secfold { transform: rotate(-90deg) }
.r-section.folded > :not(h3) { display: none }
.r-section.folded > h3 { margin-bottom: 0 }
/* The front page, calmer: section names a step smaller with a soft count pill, a pencil to rename that shows on
   hover, series labels in quiet small caps, and progress as a rounded track with the percent beside it. */
.r-section > h3 { align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 18px }
.r-section > h3 .r-secname { font-size: calc(21px * var(--u, 1)); line-height: 1.2; border-radius: 6px; padding: 1px 4px; margin: 0 -4px; outline: none; cursor: text }
.r-section > h3 .r-secname[contenteditable="true"] { min-width: 5em; background: var(--faint); box-shadow: inset 0 -1px 0 var(--accent) }
.r-section > h3 em { padding: 3px 9px; border-radius: 10px; background: var(--faint); font-size: calc(10px * var(--u, 1)); letter-spacing: 1.4px; line-height: 1.3 }
.r-secedit { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--soft); opacity: 0; transition: opacity .2s ease }
.r-section > h3:hover .r-secedit, .r-secedit:focus-visible { opacity: 1 }
.r-secedit:hover { background: var(--faint); color: var(--ink) }
.r-secmore { opacity: .6 }
.r-section > h3:hover .r-secmore { opacity: 1 }
.r-series h4 { margin: 2px 0 14px; font-size: calc(10px * var(--u, 1)); letter-spacing: 2px; color: var(--soft); opacity: .85 }
.r-series + .r-series { margin-top: 26px }
.r-section + .r-section { margin-top: 40px }
.r-prog { display: flex; align-items: center; gap: 10px; min-height: 16px }
.r-ptrack { flex: 1 1 auto; position: relative; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden }
.r-ptrack i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, var(--bg)), var(--accent)) }
.r-prog em { flex: none; min-width: 2.6em; text-align: right; font-family: 'Jost', sans-serif; font-style: normal; font-size: calc(11px * var(--u, 1)); letter-spacing: .4px; color: var(--soft); font-variant-numeric: tabular-nums }
.r-prog.r-new em { text-align: left; font-size: calc(10px * var(--u, 1)); letter-spacing: 1.6px; text-transform: uppercase; opacity: .75 }
.r-prog.r-done em { color: var(--accent) }
.r-btxt .r-prog { margin-top: auto }
.r-progbig { max-width: 320px; margin: 4px 0 20px }
.r-progbig .r-ptrack { height: 5px }
.r-progbig em { font-size: calc(12px * var(--u, 1)) }
.r-chips { align-items: center }
.r-chips .r-addbook { margin-left: auto; color: var(--bg); background: var(--accent); box-shadow: none }
.r-chips .r-addbook:hover { color: var(--bg); background: color-mix(in srgb, var(--accent) 85%, var(--ink)) }

/* A notes box that runs over a page break is framed whole on each page, and a single note stays together where it can */
.r-notes, .r-endnotes { -webkit-box-decoration-break: clone; box-decoration-break: clone }
.r-endnotes li, .r-notes li { break-inside: avoid; -webkit-column-break-inside: avoid }

/* A printed flourish or chapter number kept as a picture sits on the page like ink, with no frame */
.r-fig.r-orn { margin: .6em 0 }
.r-fig.r-orn img { border-radius: 0; box-shadow: none; background: none; filter: brightness(1.2) contrast(1.5); mix-blend-mode: multiply }
.reader[data-theme=night] .r-fig.r-orn img, .reader[data-theme=dark] .r-fig.r-orn img { filter: brightness(1.2) contrast(1.5) invert(1) brightness(.85); mix-blend-mode: screen }

/* The bookmark sits in the top bar beside Options: one tap marks the page, and it fills gold when the page is marked */
.r-bar .r-bm { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; border-radius: 18px; color: var(--ink); box-shadow: inset 0 0 0 1px var(--faint); transition: background-color .2s ease, color .2s ease }
.r-bar .r-bm:hover { background: var(--faint) }
.r-bar .r-bm svg { width: 18px; height: 18px }
.r-bar .r-bm.on { color: var(--accent) }
.r-bar .r-opts { padding-left: 14px }
