/* reader-ux.css: the book reader's chrome (toolbar, dock, spacing), redesigned 2026-10-09.
   Loaded by every books/<slug>.html after its inline <style>, so these rules win (the old toolbar used inline styles,
   hence the !important on button rules). The page content, page-turn engine and audio logic are untouched.
   Principles: one primary action (Listen, gilt), secondary tools grouped in one Aa menu, nothing wraps,
   controls in one docked region, the book uses the height it is given. Tokens match /os.css. */
:root { --os-ink: #14120e; --os-bar: #1a1712; --os-line: rgba(217, 164, 65, .18); --os-gilt: #d9a441; --os-text: #e7dfcc; --os-dim: #a89f8a; --tb: 64px; --dock: 128px; }

/* ---------- toolbar ---------- */
.topbar { height: var(--tb) !important; background: linear-gradient(#211c15, #17140f) !important; border-bottom: 1px solid rgba(217, 164, 65, .32); box-shadow: 0 2px 14px rgba(0, 0, 0, .45); gap: 10px !important; padding: 0 16px !important; flex-wrap: nowrap !important; overflow: visible !important; }
.topbar > * { flex: 0 0 auto; }
.topbar a, .topbar button, .topbar select { white-space: nowrap !important; }
.topbar .brand { font-size: 13px !important; letter-spacing: .2em !important; color: var(--os-gilt) !important; margin-right: 4px; }
.topbar .brand .rx-press { opacity: .7; }
.rx-btn, .topbar a.rx-btn { display: inline-flex !important; align-items: center; gap: 6px; height: 40px; box-sizing: border-box; padding: 0 14px !important; border: 1px solid #3a3528 !important; border-radius: 9px !important; background: #221e17 !important; color: var(--os-text) !important; font: 600 14.5px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important; opacity: 1 !important; text-decoration: none !important; cursor: pointer; }
.rx-btn:hover { border-color: #5c5340 !important; background: #2a251c !important; }
.rx-btn:focus-visible, .rx-menu button:focus-visible, .topbar select:focus-visible { outline: 2px solid var(--os-gilt); outline-offset: 2px; }
.rx-btn .ic { font-size: 14px; line-height: 1; }
.rx-back { padding: 0 10px !important; }
.topbar .sel select { height: 40px !important; border-radius: 9px !important; background: #221e17 !important; border: 1px solid #3a3528 !important; color: var(--os-text) !important; font: 600 14.5px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important; padding: 0 12px !important; max-width: 30vw !important; }
.topbar #wksel { color: var(--os-gilt) !important; }
.rx-spacer { flex: 1 1 auto !important; }
.rx-primary, .topbar a.rx-primary { background: var(--os-gilt) !important; border-color: var(--os-gilt) !important; color: #1b1405 !important; font-weight: 800 !important; }
.rx-primary:hover { background: #e6b556 !important; }
.topbar .notify { display: none !important; }            /* "Keep me posted ... when this is available" is wrong on a finished book */
.topbar .rx-hide { display: none !important; }            /* originals moved into the Aa menu stay in the DOM for their listeners */

/* the Aa menu */
.rx-menuwrap { position: relative; }
.rx-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--os-bar); border: 1px solid #3a3528; border-radius: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .5); padding: 8px; z-index: 60; display: none; }
.rx-menu.open { display: block; }
.rx-menu .rx-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px; color: var(--os-dim); font: 600 12px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; letter-spacing: .04em; }
.rx-menu .rx-seg { display: inline-flex; border: 1px solid #3a3528; border-radius: 9px; overflow: hidden; }
.rx-menu button { background: #221e17; color: var(--os-text); border: 0; font: 700 13px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; padding: 8px 12px; cursor: pointer; white-space: nowrap; }
.rx-menu .rx-seg button + button { border-left: 1px solid #3a3528; }
.rx-menu button:hover { background: #2e281e; }
.rx-menu .rx-item { width: 100%; text-align: left; border-radius: 8px; background: transparent; }
.rx-menu hr { border: 0; border-top: 1px solid #2e2a20; margin: 6px 0; }

/* ---------- the book: fill the height between toolbar and dock ---------- */
.stage { inset: var(--tb) 0 0 0 !important; top: calc(var(--tb) + env(safe-area-inset-top, 0px)) !important; align-items: flex-start !important; padding-top: 14px; box-sizing: border-box; }
.book { height: calc(100dvh - var(--tb) - var(--dock) - 30px) !important; }   /* 10-31 Eric: no 1080px cap, the book uses the space down to the player */
.arrow { top: var(--tb) !important; bottom: var(--dock) !important; }

/* ---------- one dock: audio row above the page row, same width, opaque, never overlapping ---------- */
.pbar, .abar { left: 50% !important; transform: translateX(-50%) !important; width: min(760px, 94vw) !important; max-width: none !important; box-sizing: border-box; background: var(--os-bar) !important; border: 1px solid #3a3528 !important; border-radius: 14px !important; flex-wrap: nowrap !important; justify-content: space-between; }
.pbar { bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important; padding: 6px 12px !important; }
.abar { bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important; padding: 7px 10px !important; gap: 8px !important; }
.abar button, .abar select { white-space: nowrap !important; }
.abar #aplay { background: var(--os-gilt) !important; color: #1b1405 !important; min-width: 128px; }
.abar input[type=range], .pbar input[type=range] { flex: 1 1 auto; width: auto !important; min-width: 60px; accent-color: var(--os-gilt) !important; }
.pbar button, .abar button.sk, .abar select { background: #221e17 !important; border-color: #3a3528 !important; color: var(--os-text) !important; }
.pbar .pcount, .abar .at { color: var(--os-dim) !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* the dock's height is reserved from the first paint (every book has audio now): if the book shrank when the audio row
   appeared, the pages measured a moment earlier would overflow their page (10-09) */

/* 10-31 laws-of-UX pass (Eric): on desktop the two bars read as ONE control (common region): the audio row sits flush on
   the page row with a hairline between, instead of two floating boxes with a gap. The page-turn zones show a faint
   chevron that brightens on hover, so turning the page is discoverable without hunting for the small dock arrows. */
@media (min-width: 641px) {
  .abar { bottom: calc(57px + env(safe-area-inset-bottom, 0px)) !important; border-radius: 14px 14px 0 0 !important; border-bottom: 0 !important; box-shadow: 0 -6px 24px rgba(0,0,0,.35); }
  .pbar { border-radius: 0 0 14px 14px !important; border-top: 1px solid #2b271e !important; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
  .abar[hidden] + .pbar, body:not(.rx-audio) .pbar { border-radius: 14px !important; }
  .arrow { color: rgba(226, 194, 100, .22) !important; font-size: 30px !important; transition: color .15s ease, background-color .15s ease; }
  .arrow:hover, .arrow:focus-visible { color: var(--os-gilt) !important; background-color: rgba(226, 194, 100, .04) !important; outline: none; }
}
@media (min-width: 641px) and (prefers-reduced-motion: reduce) { .arrow { transition: none; } }

/* the "About this edition" text is for search engines and the scroll view: keep it fully below the fold */
.about { margin-top: calc(100dvh + 40px) !important; }

/* ---------- narrow screens ---------- */
@media (max-width: 1100px) { .rx-label { display: none; } .rx-btn { padding: 0 10px !important; } }
@media (max-width: 900px) { .topbar .brand { display: none !important; } }
@media (max-width: 640px) {
  :root { --tb: 52px; --dock: 120px; }
  .topbar { gap: 6px !important; padding: 0 8px !important; }
  .topbar .sel select { max-width: 42vw !important; }
  .rx-primary .rx-label { display: none; }
  .abar #aplay { min-width: 0; }
  .abar .at { display: none; }
}

/* [hidden] must win over the button display rule (e.g. the Scripture button on books without references) */
.topbar [hidden], .topbar a.rx-btn[hidden], .topbar button.rx-btn[hidden] { display: none !important; }
/* one Listen, not two: when the audio row is in the dock, its "Listen along" is the primary action */
body.rx-audio .topbar .rx-primary { display: none !important; }
.topbar .sel select { max-width: min(30vw, 420px) !important; }

/* ---------- phones, rebuilt 2026-10-19 (reader-ux.js adds body.rxm) ---------- */
@media (max-width: 640px) {
  body.rxm { --tb: 56px; --dock: calc(104px + env(safe-area-inset-bottom, 0px)); }
  body.rxm .topbar { gap: 2px !important; padding: 0 4px !important; }
  body.rxm .topbar .sel, body.rxm .topbar .rxm-orig { display: none !important; }
  body.rxm .topbar .rx-btn { width: 44px; height: 44px !important; padding: 0 !important; justify-content: center; border: 0 !important; background: none !important; flex: none !important; }
  body.rxm .topbar .rx-btn .ic { font-size: 19px; }
  body.rxm .topbar .rx-primary { width: auto; padding: 0 12px !important; background: var(--os-gilt) !important; height: 36px !important; }
  .rxm-title { flex: 1 1 auto !important; min-width: 0; height: 48px; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 0 6px; border: 0; border-radius: 12px; background: none; color: var(--os-text); text-align: left; cursor: pointer; }
  .rxm-title:active { background: #221e17; }
  .rxm-title b { font: 700 15px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rxm-title span { font: 600 12.5px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--os-gilt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rxm-title span::after { content: ' \25BE'; color: var(--os-dim); }
  .rxm-more .ic { font-size: 24px !important; }
  .rxm-morewrap .rx-menu { min-width: 240px; }
  .rxm-prog { position: fixed; left: 0; right: 0; top: calc(var(--tb) + env(safe-area-inset-top, 0px)); height: 3px; background: #2a251c; z-index: 30; }
  .rxm-prog i { display: block; height: 100%; width: 0; background: var(--os-gilt); transition: width .3s; }

  /* the dock's page row goes: the page shows "N of M", the line under the header shows how far in you are,
     and pages turn by swipe or a tap on either edge */
  body.rxm .pbar { display: none !important; }
  body.rxm .book { height: calc(100dvh - var(--tb) - var(--dock) - 34px) !important; }
  body.rxm .arrow { bottom: var(--dock) !important; }

  /* one player bar */
  body.rxm .abar { left: 0 !important; right: 0 !important; transform: none !important; width: 100% !important; bottom: 0 !important; border-radius: 0 !important; border-width: 1px 0 0 !important;
    padding: 2px 12px calc(8px + env(safe-area-inset-bottom, 0px)) !important; display: grid !important; grid-template-columns: 44px 56px 44px minmax(0, 1fr) auto; grid-template-rows: 26px 60px; align-items: center; column-gap: 8px !important; row-gap: 0 !important; }
  body.rxm .abar[hidden] { display: none !important; }
  body.rxm .abar #aseek { grid-column: 1 / -1; grid-row: 1; width: 100% !important; margin: 0; height: 26px; }
  body.rxm .abar #aback, body.rxm .abar #afwd { grid-row: 2; width: 44px; height: 44px; border: 0 !important; background: none !important; font: 700 13px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; padding: 0; }
  body.rxm .abar #aplay { grid-row: 2; position: relative; width: 56px !important; min-width: 0 !important; height: 56px; padding: 0; border: 0; border-radius: 50% !important; font-size: 0 !important; display: grid; place-items: center; }
  body.rxm .abar #aplay::before { content: '\25B6'; font-size: 21px; margin-left: 3px; color: #1b1405; }
  body.rxm.rxm-playing .abar #aplay::before { content: '\275A\275A'; font-size: 15px; margin-left: 0; letter-spacing: -1px; }
  body.rxm .abar #aplay.rxm-loading::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--os-gilt); animation: rxmspin .9s linear infinite; }
  @keyframes rxmspin { to { transform: rotate(360deg); } }
  body.rxm .abar #avar { display: none !important; }
  .rxm-now { grid-row: 2; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .rxm-now b { color: #fff; font: 600 14px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.rxm .abar .rxm-now .at { display: block !important; font: 13px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--os-dim) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
  body.rxm .abar #aspeed { grid-row: 2; height: 36px; border-radius: 18px !important; padding: 0 10px; font: 700 14px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

  /* chapter sheet */
  .rxm-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .rxm-scrim.open { opacity: 1; pointer-events: auto; }
  .rxm-sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 78dvh; display: flex; flex-direction: column; background: var(--os-bar); border-radius: 18px 18px 0 0; border-top: 1px solid #3a3528; z-index: 81; transform: translateY(102%); transition: transform .25s ease; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .rxm-sheet.open { transform: none; }
  .rxm-grab { width: 40px; height: 4px; border-radius: 2px; background: #4a4334; margin: 8px auto 2px; flex: none; }
  .rxm-shead { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 6px 18px; color: var(--os-text); font: 700 16px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
  .rxm-x { width: 44px; height: 44px; border: 0; background: none; color: var(--os-dim); font-size: 26px; }
  .rxm-works { flex: none; display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; }
  .rxm-works button { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid #3a3528; background: #221e17; color: var(--os-text); font: 600 14px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
  .rxm-works button.on { background: var(--os-gilt); border-color: var(--os-gilt); color: #1b1405; }
  .rxm-list { overflow-y: auto; padding: 0 8px 12px; -webkit-overflow-scrolling: touch; }
  .rxm-list button { display: block; width: 100%; min-height: 48px; text-align: left; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--os-text); font: 15px/1.35 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
  .rxm-list button.on { background: #2b2519; color: var(--os-gilt); font-weight: 700; }
  .rxm-empty { color: var(--os-dim); padding: 12px; }

  /* arrival card */
  .rxm-arrive { position: fixed; left: 12px; right: 12px; bottom: calc(var(--dock) + 12px); z-index: 70; display: flex; flex-direction: column; gap: 12px; padding: 14px; background: #221e17; border: 1px solid #5c5340; border-radius: 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, .6); }
  .rxm-arrive .t { padding-right: 36px; }
  .rxm-arrive .t b { display: block; color: #fff; font: 700 15px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
  .rxm-arrive .t span { display: block; margin-top: 3px; color: var(--os-dim); font: 13.5px/1.4 Georgia, serif; }
  .rxm-arrive .go { height: 52px; width: 100%; border: 0; border-radius: 26px; background: var(--os-gilt); color: #1b1405; font: 800 16px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
  .rxm-arrive .x { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none; color: var(--os-dim); font-size: 24px; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) { .rxm-sheet, .rxm-scrim { transition: none; } body.rxm .abar #aplay.rxm-loading::after { animation-duration: 3s; } }
/* 10-19: "Starting the narration…" pill, from the Listen tap until the voice is moving */
.rx-starting { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock) + 14px); z-index: 75; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: #221e17; border: 1px solid #5c5340; color: var(--os-text); font: 600 14px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; box-shadow: 0 10px 26px rgba(0, 0, 0, .55); white-space: nowrap; max-width: calc(100vw - 32px); }
.rx-starting[hidden] { display: none; }
.rx-starting i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(217, 164, 65, .3); border-top-color: var(--os-gilt); animation: rxSpin .8s linear infinite; flex-shrink: 0; }
@keyframes rxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rx-starting i { animation-duration: 2.4s; } }
/* 10-31: the book's title in the toolbar (where am I?) */
.rx-title { font: 700 19px Georgia, 'Times New Roman', serif; color: var(--os-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26vw; padding: 0 2px 0 6px; }
@media (max-width: 900px) { .rx-title { max-width: 22vw; font-size: 14px; } }
@media (max-width: 640px) { .rx-title { display: none !important; } }
