/* family-reader.css: the reading pages' own rules. Two parts:
   1. the listening page (pages/listen.blade.php pushes this file too), kept as it was;
   2. the text reader (pages/read.blade.php), f2 design 2026-09-29 ("2-15 English site - Text
      reader", 9-2 Source reader parts): its own bar, the chapter column on wide screens, the
      chapter bar and sheets on phones, and the three reading themes.
   Colours are the design's THEMES, measured: light ink #221A17 on #FFF 16.9:1, body #2E2A24
   14.5:1, muted #6E605A 6.0:1; sepia ink #3B2F22 on #F7EEDC 11.6:1, muted #65543F 6.5:1;
   night ink #EDE6DE on #1E1A24 13.9:1, body #D9D1C7 11.6:1, muted #ABA298 6.6:1. Coral #C9401F
   with white text 4.96:1; the night eyebrow #FF9C82 on #1E1A24 7.6:1. */

/* ================================================================== 1. listening page === */
.listen-stage { display: flex; flex-direction: column; align-items: center; padding: 28px; border-radius: 18px; background: linear-gradient(180deg, #F8F4FF 0%, #fff 60%); min-width: 0; }
.listen-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin: -8px 0 8px; font-size: 12px; font-weight: 600; color: var(--sub); }
.listen-cover { position: relative; width: 190px; height: 270px; border-radius: 14px; overflow: hidden; box-shadow: 0 22px 50px rgba(11, 33, 77, .22); background: #EEF2F8; flex: 0 0 auto; }
.listen-author { margin: 5px 0 0; font-size: 13px; font-weight: 600; text-align: center; }
.listen-length { margin: 6px 0 0; font-size: 11.5px; text-align: center; }
.listen-player { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; }
.listen-chapter { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 8px; text-align: center; font-size: 13px; }
.listen-chapter .muted { font-weight: 600; }
.listen-chapter h2 { margin: 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.listen-chapter h2::before { content: "·" / ""; margin-right: 8px; color: var(--muted); font-weight: 600; }
.listen-native[controls] { display: block; width: 100%; margin-top: 16px; }
.transport { width: 100%; display: flex; flex-direction: column; align-items: center; }
.transport__scrub { margin-top: 18px; width: 100%; display: flex; align-items: center; gap: 13px; }
.transport__time { flex: 0 0 52px; font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.transport__time:first-child { text-align: right; }
.transport__seek { flex: 1 1 auto; min-width: 0; height: 24px; margin: 0; accent-color: var(--audio); cursor: pointer; }
.transport__seek:disabled { cursor: default; opacity: .55; }
.transport__row { margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.transport__skip, .transport__play { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; font-family: inherit; }
.transport__skip { position: relative; flex-direction: column; gap: 0; width: 50px; height: 50px; border: 1px solid var(--field); background: #fff; color: var(--ink); }
.transport__skip svg { width: 18px; height: 18px; }
.transport__n { font-size: 9.5px; font-weight: 700; line-height: 1; margin-top: 1px; }
.transport__skip:hover:not(:disabled) { border-color: var(--audio); color: var(--audio); }
.transport__skip:disabled { opacity: .45; cursor: default; }
.transport__play { width: 66px; height: 66px; border: 1px solid var(--audio); background: var(--audio); color: #fff; box-shadow: 0 14px 30px rgba(123, 69, 201, .35); }
.transport__play svg { margin-left: 2px; }
.transport__play[data-state="playing"] svg { margin-left: 0; }
/* One button, two faces: the script sets data-state, so the icon and the accessible name
   can never disagree about whether the recording is running. */
.transport__play-icon { display: none; }
.transport__play[data-state="paused"] .transport__play-icon[data-icon="play"],
.transport__play[data-state="playing"] .transport__play-icon[data-icon="pause"],
.transport__play:not([data-state]) .transport__play-icon[data-icon="play"] { display: inline-flex; }
.transport__row--quiet { margin-top: 22px; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.transport__field { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 0 0 14px; border: 1px solid var(--field); border-radius: 9px; background: #fff; font-size: 12.5px; font-weight: 600; color: var(--ink); min-width: 0; }
.transport__field label { white-space: nowrap; cursor: pointer; }
.transport__field select { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0 10px 0 4px; border: 0; background: transparent; color: var(--audio); font: inherit; font-weight: 700; cursor: pointer; }
.transport__field select:focus { outline: none; }
.listen-renew { margin-top: 14px; }
.listen-status { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--sub); text-align: center; }
.listen-status:empty { margin: 0; }
.listen-moves { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; max-width: 560px; }
.listen-switch { margin-top: 16px; font-size: 12px; font-weight: 600; }
.listen-note { margin: 14px 0 0; max-width: 460px; font-size: 11.5px; line-height: 1.55; text-align: center; }
.listen-chapters { overflow: hidden; border-radius: 14px; }
.listen-chapters__head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.listen-chapters__head h2 { margin: 0; font-size: 13.5px; font-weight: 700; }
.listen-chapters__head .muted { font-size: 11px; font-weight: 600; }
.listen-chapters__list { list-style: none; margin: 0; padding: 0; }
.listen-chapters__list li + li { border-top: 1px solid #F1F4F9; }
.listen-chapters__n { flex: 0 0 22px; height: 22px; border-radius: 50%; background: #F1F4F9; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--sub); }
.listen-chapters__t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.listen-chapters__d { flex: 0 0 auto; font-size: 11px; }
.listen-chapters__note { margin: 0; padding: 12px 16px 14px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
@media (max-width: 560px) {
  .listen-stage { padding: 22px 16px; }
  .transport__scrub { gap: 8px; }
  .transport__time { flex-basis: 44px; }
  .transport__row { gap: 22px; }
  .transport__skip { width: 52px; height: 52px; }
  .transport__field { height: 44px; }
  .transport__row--quiet { grid-template-columns: minmax(0, 1fr); }
  .listen-back { min-height: 44px; }
}
@media (max-width: 560px) {
  /* Listening page tap targets: the author, "Read the book instead", the seek bar and the
     Speed and Sleep timer selects (the select fills its field, so the field is 46px). */
  .listen-author, .listen-switch { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
  .listen-author { margin-top: 0; }
  .transport__seek { height: 44px; }
  .transport__field { height: 46px; }
}
/* r5-2 (08 phone): when the chapter title wrapped, its "·" separator started a line on its
   own. On a phone the chapter number sits above the title, with no separator. */
@media (max-width: 560px) {
  .listen-chapter { flex-direction: column; align-items: center; gap: 2px; }
  .listen-chapter h2::before { content: none; }
}
/* ===================================================================== listen page */
/* Flat surfaces and buttons (rules 5, 7): no lavender gradient behind the player and no
   purple glow under the play button. The title in the book serif for Latin catalogues. */
.listen-stage { background: #fff; }
.transport__play { box-shadow: none; }
.listen-title { letter-spacing: 0; }
.listen-title:not(:lang(bn)) { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.2; }
@media (max-width: 640px) {
  .listen-title:not(:lang(bn)) { font-size: 24px; }
}


/* ============================================================ listening page === */
/* The player as a phone audiobook app draws it: the warm panel of the book page, a big cover,
   the title, the scrubber, one round play button between two skips, then quiet pill fields.
   The purple of the old player gives way to the pilot's orange; the markup, the transport and
   the stream renewal are untouched (styling hooks only). */
.listen-v3 { padding-top: 24px; padding-bottom: 56px; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; }
.listen-stage { padding: 20px 24px 28px; border: 0; border-radius: var(--r-panel); background: var(--warm); box-shadow: none; }
.listen-back { align-self: flex-start; min-height: 44px; margin: 0 0 6px -8px; padding: 0 14px 0 8px; border-radius: 999px; font-size: 13.5px; font-weight: 650; color: var(--ink); }
.listen-back:hover { background: rgba(26, 29, 41, .06); color: var(--ink); }
.listen-cover { width: 200px; height: 286px; margin-top: 6px; border-radius: 14px; background: #EEEEF2; box-shadow: 0 2px 4px rgba(26, 29, 41, .10), 0 26px 44px -16px rgba(26, 29, 41, .48); }
.listen-title { margin-top: 26px; max-width: 30ch; font-size: 26px; font-weight: 800; letter-spacing: -.025em; line-height: 1.2; color: var(--ink); text-wrap: balance; }
.listen-title:not(:lang(bn)) { font-family: var(--sans); }
.listen-author { display: inline-flex; align-items: center; min-height: 32px; margin-top: 4px; font-size: 15px; font-weight: 650; }
a.listen-author { color: var(--accent-ink); }
a.listen-author:hover { color: var(--accent-deep); }
p.listen-author { color: var(--body); }
.listen-length { margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--muted); }
.listen-player { max-width: 520px; }
.listen-chapter { margin-top: 22px; width: 100%; flex-direction: column; align-items: center; gap: 4px; }
.listen-chapter .muted { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.listen-chapter h2 { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--ink); text-wrap: balance; }
.listen-chapter h2::before { content: none; }
.listen-native[controls] { margin-top: 18px; border-radius: 999px; }
.transport__scrub { margin-top: 20px; gap: 12px; }
.transport__time { flex-basis: 48px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.transport__seek { height: 28px; accent-color: var(--accent-ink); }
.transport__row { margin-top: 18px; gap: 26px; }
.transport__skip { width: 56px; height: 56px; border: 0; background: #fff; color: var(--ink); box-shadow: var(--shadow-soft); }
.transport__skip:hover:not(:disabled) { color: var(--accent-ink); }
.transport__skip svg { width: 20px; height: 20px; }
.transport__n { font-size: 10px; font-weight: 750; }
.transport__play { width: 76px; height: 76px; border-color: var(--accent-ink); background: var(--accent-ink); color: #fff; box-shadow: 0 16px 30px -10px rgba(194, 65, 12, .6); transition: background-color .18s var(--ease-out), transform .18s var(--ease-out); }
.transport__play:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.transport__play:active { transform: scale(.96); }
.transport__play svg { width: 28px; height: 28px; }
.transport__play:focus-visible, .transport__skip:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; box-shadow: 0 0 0 6px var(--accent-tint); }
.transport__row--quiet { margin-top: 24px; gap: 10px; }
.transport__field { height: 44px; padding-left: 16px; border: 1px solid var(--field); border-radius: 999px; background: #fff; font-size: 13.5px; font-weight: 650; color: var(--ink); }
.transport__field:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-tint); }
.transport__field select { padding-right: 14px; color: var(--accent-ink); font-weight: 750; border-radius: 0 999px 999px 0; }
.transport__field:has([data-slept="true"]) { border-color: var(--accent-ink); background: var(--accent-tint); }
/* Renewal: when a stream ticket lapses, the recovery is one clear pill under the player. */
.listen-renew { margin-top: 16px; height: 44px; padding: 0 20px; border-color: var(--accent-ink); background: #fff; color: var(--accent-ink); font-size: 14px; }
.listen-renew:hover { background: var(--accent-tint); color: var(--accent-deep); border-color: var(--accent-deep); }
.listen-status { margin-top: 10px; max-width: 44ch; font-size: 13px; font-weight: 500; color: var(--body); }
[data-audio-state="failed"] .listen-status, [data-audio-state="denied"] .listen-status, [data-audio-state="removed"] .listen-status { color: var(--accent-deep); font-weight: 650; }
.listen-moves { margin-top: 22px; gap: 10px; max-width: 520px; }
.listen-moves .btn { height: 44px; padding: 0 18px; border-color: rgba(26, 29, 41, .16); background: transparent; font-size: 13.5px; }
.listen-moves .btn:hover { background: #fff; border-color: var(--accent-ink); color: var(--accent-ink); }
.listen-switch { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--accent-ink); }
.listen-switch:hover { color: var(--accent-deep); }
.listen-note { margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
/* The chapter list: a soft card, the chapter playing in the warm tint. */
.listen-chapters { border: 0; border-radius: 22px; background: #fff; box-shadow: 0 0 0 1px var(--line), var(--shadow-soft); }
.listen-chapters__head { padding: 16px 18px; border-bottom-color: var(--line); }
.listen-chapters__head h2 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.listen-chapters__head .muted { font-size: 12.5px; color: var(--muted); }
.listen-chapters__list { padding: 6px; }
.listen-chapters__list li + li { border-top: 0; }
.listen-chapters__list a { min-height: 52px; padding: 10px 12px; border-radius: 14px; font-size: 13.5px; font-weight: 550; color: var(--body); }
.listen-chapters__list a:hover { background: var(--soft); color: var(--ink); }
.listen-chapters__n { flex-basis: 28px; height: 28px; background: var(--soft); font-size: 11.5px; color: var(--body); font-variant-numeric: tabular-nums; }
.listen-chapters__d { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.listen-chapters__list a[aria-current] { background: var(--accent-tint); color: var(--accent-deep); font-weight: 700; }
.listen-chapters__list a[aria-current] .listen-chapters__n { background: var(--accent-ink); color: #fff; }
.listen-chapters__list a[aria-current] .listen-chapters__d { color: var(--accent-deep); }
.listen-chapters__note { padding: 12px 18px 16px; border-top-color: var(--line); font-size: 12px; color: var(--muted); }
@media (min-width: 981px) {
  .listen-chapters { position: sticky; top: 20px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
  .listen-chapters__list { overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 980px) {
  .listen-v3 { grid-template-columns: minmax(0, 1fr); padding-top: 16px; gap: 20px; }
}
@media (max-width: 560px) {
  .listen-v3 { padding-top: 12px; }
  .listen-stage { padding: 12px 16px 24px; border-radius: 24px; }
  .listen-cover { width: min(210px, 62vw); height: auto; aspect-ratio: 200 / 286; }
  .listen-title { margin-top: 22px; font-size: 23px; }
  .transport__row { gap: 22px; }
  .transport__skip { width: 56px; height: 56px; }
  .transport__row--quiet { grid-template-columns: minmax(0, 1fr); }
  .transport__field { justify-content: space-between; }
  .transport__field select { flex: 0 1 auto; text-align: right; text-align-last: right; }
  .listen-moves .btn { flex: 1 1 100%; }
  .listen-chapters { border-radius: 20px; }
}
@media (max-width: 359px) {
  .transport__row { gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .transport__play { transition: none; }
  .transport__play:active { transform: none; }
}

/* ===================================================================== 2. text reader === */
.rd {
  --rd-page: #FFF7F3; --rd-paper: #FFFFFF; --rd-ink: #221A17; --rd-body: #2E2A24;
  --rd-line: #F3E3DC; --rd-edge: #EBD6CC; --rd-muted: #6E605A; --rd-hover: #FFF3EE;
  --rd-eyebrow: var(--f2-coral); --rd-mark: var(--f2-coral);
  --rd-size: 18px; --rd-leading: 1.75;
  --rd-font: var(--f2-serif);
  min-height: 100vh; min-height: 100dvh; padding-bottom: calc(100px + env(safe-area-inset-bottom));
  background: var(--rd-page); color: var(--rd-ink); font-family: var(--f2-ui);
}
.rd[data-theme="sepia"] {
  --rd-page: #EFE3CC; --rd-paper: #F7EEDC; --rd-ink: #3B2F22; --rd-body: #3B2F22;
  --rd-line: #E0CFAF; --rd-edge: #D5C09A; --rd-muted: #65543F; --rd-hover: #EFE3CC;
  --rd-eyebrow: #A8361A; --rd-mark: #A8361A;
}
.rd[data-theme="night"] {
  --rd-page: #15121A; --rd-paper: #1E1A24; --rd-ink: #EDE6DE; --rd-body: #D9D1C7;
  --rd-line: #322B3A; --rd-edge: #463D50; --rd-muted: #ABA298; --rd-hover: #2A2433;
  --rd-eyebrow: #FF9C82; --rd-mark: #FF9C82;
  color-scheme: dark;
}
.rd[data-font="sans"] { --rd-font: 'DM Sans', 'Hind Siliguri', 'DM Sans Fallback', system-ui, sans-serif; }
.rd[data-leading="compact"] { --rd-leading: 1.55; }
.rd[data-leading="relaxed"] { --rd-leading: 2; }
/* The reader draws its own bar: the site header, footer and tab bar step aside. */
body:has(.rd) .f2-header { display: none; }
body:has(.rd) { background: #FFF7F3; }
body:has(.rd[data-theme="sepia"]) { background: #EFE3CC; }
body:has(.rd[data-theme="night"]) { background: #15121A; }
.rd :focus-visible { outline: 3px solid var(--f2-accent); outline-offset: 2px; }

/* buttons */
.rd-btn {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 0 0 auto;
  min-width: 44px; height: 44px; padding: 0 10px; border: 1.5px solid var(--rd-line); border-radius: 14px;
  background: transparent; color: var(--rd-ink); font: 700 14px/1.2 var(--f2-ui); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .16s var(--f2-ease), border-color .16s var(--f2-ease), transform .16s var(--f2-ease);
}
.rd-btn:hover { background: var(--rd-hover); border-color: var(--f2-coral); color: var(--rd-ink); }
.rd-btn:active { transform: translateY(1px); }
.rd-btn--icon { width: 44px; padding: 0; }
.rd-btn.rd-btn--primary { border-color: var(--f2-coral); background: var(--f2-coral); color: #fff; }
.rd-btn.rd-btn--primary:hover { border-color: var(--f2-coral-dark); background: var(--f2-coral-dark); color: #fff; }
.rd-btn.rd-btn--audio { border-color: var(--f2-audio); background: var(--f2-audio); color: #fff; }
.rd-btn.rd-btn--audio:hover { border-color: var(--f2-audio-ink); background: var(--f2-audio-ink); color: #fff; }
.rd-aa span { font-size: 15px; font-weight: 700; }
.rd-mark[aria-pressed="true"] { color: var(--rd-mark); border-color: var(--rd-mark); }
.rd-mark[aria-pressed="true"] svg { fill: currentColor; }

/* the bar */
.rd-bar {
  position: sticky; top: 0; z-index: var(--f2-z-sticky);
  background: var(--rd-paper); border-bottom: 1px solid var(--rd-line);
  transition: transform .22s var(--f2-ease);
}
.rd-bar__in { box-sizing: border-box; display: flex; align-items: center; gap: 4px; max-width: 1280px; height: 58px; margin: 0 auto; padding: 0 8px; }
.rd-bar__cover { flex: 0 0 auto; width: 30px; height: 44px; margin-left: 4px; object-fit: cover; border-radius: 6px; background: var(--rd-line); }
.rd-bar__book { flex: 1 1 auto; min-width: 0; padding: 0 6px; }
.rd-bar__title {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--rd-ink); font-size: 14.5px; font-weight: 700; line-height: 44px; text-decoration: none;
}
.rd-bar__title:hover { color: var(--rd-ink); text-decoration: underline; text-underline-offset: 2px; }
.rd-bar__meta { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rd-muted); font-size: 12.5px; line-height: normal; }
.rd-bar__wide, .rd-bar__word { display: none; }
.rd-bar .rd-bar__wide { padding: 0 14px; border-color: #EBD6CC; }
.rd-bar .rd-btn--audio { width: 44px; padding: 0; }

/* the page */
.rd-grid { box-sizing: border-box; max-width: 1280px; margin: 0 auto; }
.rd-toc { display: none; }
.rd-toc:target { display: block; margin: 12px; padding: 8px; border: 1px solid var(--rd-line); border-radius: 22px; background: var(--rd-paper); }
.rd-toc__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.rd-toc__list a {
  display: flex; align-items: center; min-height: 44px; padding: 8px 12px; box-sizing: border-box; border-radius: 12px;
  color: var(--rd-ink); font-size: 14.5px; font-weight: 500; line-height: 1.35; text-decoration: none; overflow-wrap: anywhere;
}
.rd-toc__list li[data-depth="2"] a { padding-left: 26px; font-size: 14px; }
.rd-toc__list li[data-depth="3"] a { padding-left: 40px; font-size: 13.5px; }
.rd-toc__list a:hover { background: var(--rd-hover); color: var(--rd-ink); }
.rd-toc__list a[aria-current] { background: var(--f2-coral); color: #fff; font-weight: 700; }
.rd-marks { margin-top: 12px; padding: 12px 4px 4px; border-top: 1px solid var(--rd-line); }
.rd-marks__title { margin: 0 8px 6px; color: var(--rd-muted); font-size: 12.5px; font-weight: 700; }
.rd-marks__list { margin: 0; padding: 0; list-style: none; }
.rd-marks__list a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; box-sizing: border-box; border-radius: 12px; color: var(--rd-ink); font-size: 14px; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.rd-marks__list a::before { content: ""; flex: 0 0 auto; width: 10px; height: 13px; background: var(--rd-mark); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.rd-marks__list a:hover { background: var(--rd-hover); }

.rd-paper { min-width: 0; padding: 22px 20px 28px; background: var(--rd-paper); }
.rd-eyebrow {
  margin: 0; text-align: center; color: var(--rd-eyebrow);
  font-size: 12.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; line-height: 1.4;
  overflow-wrap: anywhere; text-wrap: balance;
}
.rd-h1 {
  margin: 8px auto 0; max-width: 640px; text-align: center; color: var(--rd-ink);
  font-family: var(--f2-serif); font-size: 28px; font-weight: 600; line-height: 1.26;
  overflow-wrap: anywhere; text-wrap: balance;
}
.rd-parts { display: flex; flex-direction: column; gap: 10px; max-width: 640px; margin: 18px auto 0; }
.rd-parts__note { margin: 0; color: var(--rd-ink); opacity: .8; font-size: 14px; line-height: normal; }
.rd-parts__list { display: flex; flex-wrap: wrap; gap: 8px; }
.rd-parts__list a {
  display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 6px; box-sizing: border-box;
  border: 1.5px solid #EBD6CC; border-radius: 12px; color: var(--rd-ink); font: 700 14px/1 var(--f2-ui); text-decoration: none;
}
.rd-parts__list a:hover { border-color: var(--f2-coral); background: var(--rd-hover); }
.rd-parts__list a[aria-current] { border-color: var(--f2-coral); background: var(--f2-coral); color: #fff; }

.rd-text {
  max-width: 640px; margin: 24px auto 0; color: var(--rd-body);
  font-family: var(--rd-font); font-size: var(--rd-size); line-height: var(--rd-leading);
  overflow-wrap: break-word;
}
.rd-text > :first-child { margin-top: 0; }
.rd-text p { margin: 0 0 1.05em; text-wrap: pretty; }
.rd-text :is(h1, h2, h3, h4, h5, h6) { margin: 1.6em 0 .6em; color: var(--rd-ink); font-family: inherit; font-weight: 600; line-height: 1.3; text-wrap: balance; }
.rd-text h1, .rd-text h2 { font-size: 1.3em; }
.rd-text h3 { font-size: 1.15em; }
.rd-text :is(h4, h5, h6) { font-size: 1em; }
.rd-text blockquote { margin: 1.2em 0; padding: 0 0 0 1.1em; border-left: 1px solid var(--rd-edge); }
.rd-text :is(ul, ol) { margin: 0 0 1.05em; padding-left: 1.4em; }
.rd-text li { margin-bottom: .35em; }
.rd-text hr { margin: 2em auto; width: 30%; border: 0; border-top: 1px solid var(--rd-edge); }
.rd-text pre { overflow-x: auto; white-space: pre-wrap; font-size: .85em; }
.rd-text table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .9em; }
.rd-text :is(td, th) { padding: .3em .6em; border: 1px solid var(--rd-line); vertical-align: top; }
.rd-text a { color: inherit; }
.rd-text :is(sup, sub) { line-height: 0; }

.rd-continue {
  display: flex; align-items: center; justify-content: center; max-width: 640px; min-height: 52px; margin: 10px auto 0; padding: 8px 18px;
  box-sizing: border-box; border-radius: 16px; background: var(--f2-coral); color: #fff; font: 700 15.5px/1.3 var(--f2-ui); text-align: center; text-decoration: none;
}
.rd-continue:hover { background: var(--f2-coral-dark); color: #fff; }
.rd-turn { display: none; }

/* phones and tablets: the chapter bar at the foot of the screen */
.rd-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--f2-z-sticky);
  padding: 0 12px calc(12px + env(safe-area-inset-bottom)); background: var(--rd-paper); border-top: 1px solid var(--rd-line);
  transition: transform .22s var(--f2-ease);
}
.rd-bottom__track { height: 4px; margin: 0 -12px 8px; background: var(--rd-line); }
.rd-bottom__track span { display: block; height: 100%; background: var(--f2-coral); }
.rd-bottom__row { display: flex; align-items: center; gap: 8px; max-width: 720px; margin: 0 auto; }
.rd-bottom__row .rd-btn--primary { width: 48px; height: 48px; }
.rd-bottom__where {
  flex: 1 1 auto; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px; color: var(--rd-ink); text-align: center; text-decoration: none;
}
.rd-bottom__where:hover { background: var(--rd-hover); color: var(--rd-ink); }
.rd-bottom__where b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 700; }
.rd-bottom__where span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rd-muted); font-size: 12.5px; }
/* Calm chrome on a phone: reading down slides both bars away; any move up brings them back. */
.rd.is-calm .rd-bar { transform: translateY(-100%); }
.rd.is-calm .rd-bottom { transform: translateY(110%); }

/* the text settings and chapter sheets (f2-sheet, bde-f2.js) */
.rd-sheet { color: #221A17; }
.rd-cap { margin: 18px 0 8px; color: #6E605A; font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.rd-sheet .f2-sheet__head + .rd-cap { margin-top: 0; }
.rd-size { display: flex; align-items: center; gap: 10px; }
.rd-size input { flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; accent-color: var(--f2-coral); }
.rd-choices { display: flex; gap: 8px; }
.rd-choice {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 8px; border: 1.5px solid #EBD6CC; border-radius: 14px;
  background: #fff; color: #221A17; font: 700 14px/1.2 var(--f2-ui); cursor: pointer;
}
.rd-choice:hover { border-color: var(--f2-coral); }
.rd-choice[aria-pressed="true"] { border-color: var(--f2-coral); background: #FFE9E1; color: #A8361A; }
.rd-size__step { flex: 0 0 48px; height: 48px; padding: 0; }
.rd-size__step--big { font-size: 18px; }
.rd-choice--serif { font-family: var(--f2-serif); font-weight: 600; }
.rd-choice.rd-choice--light { background: #FFFFFF; color: #221A17; }
.rd-choice.rd-choice--sepia { background: #F7EEDC; color: #3B2F22; }
.rd-choice.rd-choice--night { background: #1E1A24; color: #EDE6DE; }
.rd-sheet__link {
  display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: 6px; padding: 8px 14px; box-sizing: border-box; line-height: 1.3;
  border: 1.5px solid #EBD6CC; border-radius: 14px; color: #221A17; font-weight: 700; text-align: center; text-decoration: none;
}
.rd-sheet__link:hover { border-color: var(--f2-coral); color: #221A17; }
.rd-sheet--chapters .f2-sheet__head { position: sticky; top: -8px; z-index: 1; margin: 0 -18px 6px; padding: 8px 18px; background: #fff; }
@media (min-width: 768px) {
  .rd-sheet--chapters .f2-sheet__head { top: -24px; margin: -24px -24px 6px; padding: 24px 24px 8px; }
}
.rd-sheet--chapters .rd-toc__list a { color: #221A17; }
.rd-sheet--chapters .rd-toc__list a:hover { background: #FFF3EE; }
.rd-sheet--chapters .rd-toc__list a[aria-current] { background: var(--f2-coral); color: #fff; }
.rd-sheet--chapters .rd-marks { border-top-color: #F3E3DC; }
.rd-sheet--chapters .rd-marks__title { color: #6E605A; }
.rd-sheet--chapters .rd-marks__list a { color: #221A17; }
.rd-sheet--chapters .rd-marks__list a::before { background: var(--f2-coral); }

/* UI/UX review 2026-10-02 (C1): the contents' appendices, the end of the book, and the
   Gutenberg header or trailer folded inside a chapter. Theme colours come from the --rd-*
   tokens, so Light, Sepia and Night all hold (coral on white 4.96:1, muted 6.0:1 and up). */
.rd-toc__group {
  margin: 14px 12px 4px; padding-top: 12px; border-top: 1px solid var(--rd-line);
  color: var(--rd-muted); font: 700 12.5px/1.4 var(--f2-ui);
}
.rd-toc__list--appendix a { color: var(--rd-muted); font-size: 14px; }
.rd-toc__list--appendix a:hover { color: var(--rd-ink); }
.rd-sheet--chapters .rd-toc__group { border-top-color: #F3E3DC; color: #6E605A; }
.rd-sheet--chapters .rd-toc__list--appendix a { color: #6E605A; }
.rd-sheet--chapters .rd-toc__list--appendix a[aria-current] { color: #fff; }

.rd-end {
  max-width: 640px; margin: 40px auto 0; padding: 28px 0 0; border-top: 1px solid var(--rd-line);
  text-align: center; color: var(--rd-ink);
}
.rd-end__title {
  margin: 0; font-family: var(--f2-serif); font-size: 26px; font-weight: 600;
  line-height: 1.25; overflow-wrap: anywhere; text-wrap: balance;
}
.rd-end__title:focus { outline: none; }
.rd-end__by { margin: 6px 0 0; color: var(--rd-muted); font-size: 15px; }
.rd-end__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.rd-end__actions .rd-btn { height: 48px; padding: 0 20px; font-size: 15px; }
.rd-end__h { margin: 32px 0 12px; font: 700 15px/1.3 var(--f2-ui); color: var(--rd-ink); text-align: left; }
.rd-end__shelf {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px;
  margin: 0; padding: 0; list-style: none; text-align: left;
}
@media (min-width: 560px) { .rd-end__shelf { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.rd-end__book { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--rd-ink); text-decoration: none; border-radius: 10px; }
.rd-end__cover {
  position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 8px;
  background: var(--rd-line); box-shadow: 0 1px 2px rgba(34, 26, 23, .12);
  transition: transform .18s var(--f2-ease);
}
.rd-end__cover img, .rd-end__cover img[width][height] { display: block; width: 100%; height: 100%; object-fit: cover; }
.rd-end__cover .f2-house { position: absolute; inset: 0; }
.rd-end__name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font: 650 13px/1.3 var(--f2-ui); overflow-wrap: anywhere;
}
.rd-end__author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rd-muted); font-size: 12px; }
.rd-end__book:hover .rd-end__cover { transform: translateY(-2px); }
.rd-end__book:hover .rd-end__name { text-decoration: underline; text-underline-offset: 2px; }
.rd-end__more { text-align: left; }
.rd-end__note { margin: -6px 0 8px; color: var(--rd-muted); font-size: 13.5px; line-height: 1.45; }
.rd-end__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.rd-end__list a {
  display: flex; align-items: center; min-height: 44px; padding: 6px 12px; box-sizing: border-box; border-radius: 12px;
  color: var(--rd-ink); font-size: 14.5px; text-decoration: none; overflow-wrap: anywhere;
}
.rd-end__list a:hover { background: var(--rd-hover); }

.rd-fold { max-width: 640px; margin: 20px auto 0; border: 1px solid var(--rd-line); border-radius: 14px; color: var(--rd-muted); }
.rd-fold > summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; cursor: pointer;
  font: 600 13.5px/1.3 var(--f2-ui); list-style: none;
}
.rd-fold > summary::-webkit-details-marker { display: none; }
.rd-fold > summary::before {
  content: ""; flex: 0 0 auto; width: 7px; height: 7px; margin-right: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
  transition: transform .16s var(--f2-ease);
}
.rd-fold[open] > summary::before { transform: rotate(45deg); }
.rd-fold > summary:hover { color: var(--rd-ink); }
.rd-fold__text { margin: 0; padding: 0 16px 12px; font-size: 14px; line-height: 1.6; color: var(--rd-muted); }
@media (prefers-reduced-motion: reduce) {
  .rd-end__cover, .rd-fold > summary::before { transition: none; }
  .rd-end__book:hover .rd-end__cover { transform: none; }
}

@media (min-width: 981px) {
  .rd { padding-bottom: 48px; }
  .rd-bar__in { height: 66px; gap: 12px; padding: 0 48px; }
  .rd-bar__wide { display: inline-flex; }
  .rd-bar__word { display: inline; }
  .rd-bar .rd-btn--audio { width: auto; gap: 8px; padding: 0 16px; }
  .rd-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; padding: 24px 48px 0; }
  .rd-toc, .rd-toc:target {
    display: block; position: sticky; top: 90px; max-height: calc(100vh - 112px); overflow-y: auto; overscroll-behavior: contain;
    margin: 0; padding: 8px; box-sizing: border-box; border: 1px solid var(--rd-line); border-radius: 22px; background: var(--rd-paper);
  }
  .rd-paper { padding: 48px 56px 40px; border: 1px solid var(--rd-line); border-radius: 26px; }
  .rd-h1 { font-size: 34px; }
  .rd-end__title { font-size: 30px; }
  .rd-turn { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 640px; margin: 32px auto 0; }
  .rd-turn .rd-btn--primary { height: 48px; padding: 0 20px; font-size: 16px; }
  .rd-turn__read { color: var(--rd-muted); font-size: 12.5px; white-space: nowrap; }
  .rd-bottom { display: none; }
  .rd.is-calm .rd-bar { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rd-bar, .rd-bottom, .rd-btn { transition: none; }
}
@media print {
  .rd-bar, .rd-bottom, .rd-toc, .rd-turn, .rd-parts, .rd-continue { display: none !important; }
  .rd, .rd-paper { padding: 0; border: 0; background: #fff; }
}
