/* THE READER (@ovi 2026-10-28), library only. Pages, not a scroll — see reader_ui.php. */
#ovi-reader {
  position: fixed; inset: 0; z-index: 2147483600;
  display: none; flex-direction: column;
  background: var(--rd-bg, #faf7f0); color: var(--rd-ink, #1c1a17);
  font-family: var(--rd-face, Georgia, 'Times New Roman', serif);
  overscroll-behavior: contain;
}
#ovi-reader.on { display: flex; }
#ovi-reader * { box-sizing: border-box; }

/* top bar */
.rd-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  font: 600 13px/1.2 system-ui, sans-serif;
  background: var(--rd-bar, rgba(0,0,0,.05));
  border-bottom: 1px solid var(--rd-line, rgba(0,0,0,.12));
}
.rd-bar b { flex: 1 1 auto; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.rd-btn {
  flex: 0 0 auto; min-width: 34px; height: 32px; padding: 0 9px;
  border: 1px solid var(--rd-line, rgba(0,0,0,.2)); border-radius: 7px;
  background: transparent; color: inherit; cursor: pointer;
  font: 600 14px/1 system-ui, sans-serif;
}
.rd-btn:active { transform: translateY(1px); }

/* the page itself */
.rd-stage {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden;
  touch-action: pan-y;
}
.rd-strip {
  position: absolute; top: 0; bottom: 0; left: 0;
  padding: var(--rd-pad, 22px) 0;
  column-gap: var(--rd-gap, 36px);
  column-fill: auto;
  transition: transform .26s cubic-bezier(.2,.8,.25,1);
  will-change: transform;
  font-size: var(--rd-size, 18px);
  line-height: var(--rd-lead, 1.6);
}
.rd-strip > .rd-inner { }
.rd-strip img { max-width: 100%; height: auto; display: block; margin: 10px auto; }
.rd-strip h1, .rd-strip h2, .rd-strip h3 { line-height: 1.25; }
.rd-strip p { margin: 0 0 .85em; text-align: justify; hyphens: auto; }
.rd-strip a { color: inherit; text-decoration: underline; }

/* THE READER HAS TO DEFEND ITSELF FROM THE SITE.
   It is an overlay living INSIDE the shop's page, so every rule in the theme's stylesheet
   reaches into it. Measured: the strip was set to 26px and its paragraphs were still
   rendering at 18px, because a site rule targets p directly and specificity beat
   inheritance — so the type size control did nothing to the actual words.

   This is the one place !important is the right tool rather than a guess. The overlay
   cannot know what a given spoke's theme will declare, and it is not trying to win an
   argument with a rule it can see; it is insulating content it did not write from a
   stylesheet it does not control. Headings are in em so they grow with the setting too. */
#ovi-reader .rd-strip p,
#ovi-reader .rd-strip div,
#ovi-reader .rd-strip span,
#ovi-reader .rd-strip li,
#ovi-reader .rd-strip td,
#ovi-reader .rd-strip blockquote {
  font-size: inherit !important;
  font-family: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
}
#ovi-reader .rd-strip h1 { font-size: 1.6em !important; }
#ovi-reader .rd-strip h2 { font-size: 1.35em !important; }
#ovi-reader .rd-strip h3 { font-size: 1.15em !important; }
#ovi-reader .rd-strip h1, #ovi-reader .rd-strip h2, #ovi-reader .rd-strip h3,
#ovi-reader .rd-strip h4, #ovi-reader .rd-strip h5 {
  font-family: inherit !important; color: inherit !important;
}

/* the two halves you tap to turn */
.rd-tap { position: absolute; top: 0; bottom: 0; width: 34%; z-index: 3; }
.rd-tap.l { left: 0; } .rd-tap.r { right: 0; }

/* bottom bar: where you are */
.rd-foot {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 6px 12px calc(env(safe-area-inset-bottom) + 8px);
  font: 500 11.5px/1.2 system-ui, sans-serif; opacity: .75;
  border-top: 1px solid var(--rd-line, rgba(0,0,0,.12));
}
.rd-foot .rd-prog { flex: 1 1 auto; height: 3px; border-radius: 2px;
  background: var(--rd-line, rgba(0,0,0,.14)); overflow: hidden; }
.rd-foot .rd-prog i { display: block; height: 100%; width: 0;
  background: currentColor; transition: width .2s ease; }

/* the panels */
.rd-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  max-height: 62%; overflow: auto; -webkit-overflow-scrolling: touch;
  background: var(--rd-bg, #faf7f0);
  border-top: 1px solid var(--rd-line, rgba(0,0,0,.18));
  box-shadow: 0 -10px 26px rgba(0,0,0,.22);
  transform: translateY(101%); transition: transform .24s ease;
  padding: 12px 14px calc(env(safe-area-inset-bottom) + 14px);
}
.rd-panel.on { transform: none; }
.rd-row { display: flex; align-items: center; gap: 9px; margin: 0 0 11px;
  font: 600 12.5px/1.2 system-ui, sans-serif; }
.rd-row span.lab { flex: 0 0 76px; opacity: .7; }
.rd-row .rd-btn { flex: 0 0 auto; }
.rd-toc a { display: block; padding: 9px 4px; color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--rd-line, rgba(0,0,0,.08));
  font: 500 14px/1.3 system-ui, sans-serif; }
.rd-toc a.here { font-weight: 800; }

/* grounds */
#ovi-reader[data-tone="sepia"] { --rd-bg:#f4ecd8; --rd-ink:#4a3b28; --rd-line:rgba(74,59,40,.2); --rd-bar:rgba(74,59,40,.07); }
#ovi-reader[data-tone="dark"]  { --rd-bg:#14161a; --rd-ink:#d8d6d1; --rd-line:rgba(216,214,209,.2); --rd-bar:rgba(255,255,255,.05); }

.rd-msg { padding: 40px 24px; text-align: center; font: 500 15px/1.5 system-ui, sans-serif; }
.rd-msg a { display: inline-block; margin-top: 14px; padding: 10px 16px;
  border: 1px solid currentColor; border-radius: 8px; color: inherit; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .rd-strip, .rd-panel { transition: none !important; }
}
/* ovi-reading-lite: no permanent layer and no slide for the strip. A chapter can be 10,000 pixels wide; one layer that size is what a phone cannot hold. */
.rd-strip { will-change: auto !important; transition: none !important; }

/* ovi-reading-lite-panels: a closed panel (contents, text size, notes) is not kept as a full height scrolling layer; it appears when opened */
.rd-panel:not(.on) { display: none !important; }
.rd-panel { transition: none !important; }

/* ovi-no-boards: the page turn boards of the first reader sat over two thirds of the words; a tap on the stage turns the page now */
.rd-tap { display: none !important; }

/* ===================================================================
   MARKINGS (@ovi 2026-10-29). Robin: "I want my markings permenents and retrievable."
   =================================================================== */
#ovi-reader mark.rd-mark {
  background: transparent; color: inherit; border-radius: 2px;
  padding: 0 1px; margin: 0 -1px; cursor: pointer;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
#ovi-reader mark.rd-mark[data-c="yellow"] { background: rgba(255, 214, 64, .40); }
#ovi-reader mark.rd-mark[data-c="green"]  { background: rgba(104, 222, 140, .38); }
#ovi-reader mark.rd-mark[data-c="blue"]   { background: rgba(120, 190, 255, .38); }
#ovi-reader mark.rd-mark[data-c="pink"]   { background: rgba(255, 140, 190, .36); }
/* "none" is a passage kept without colouring it — an underline, the way you would in
   a book you did not want to deface */
#ovi-reader mark.rd-mark[data-c="none"] {
  background: transparent; border-bottom: 2px solid currentColor; opacity: .95; }
#ovi-reader mark.rd-mark.has-note { box-shadow: inset 0 -2px 0 rgba(0,0,0,.35); }
#ovi-reader[data-tone="dark"] mark.rd-mark.has-note { box-shadow: inset 0 -2px 0 rgba(255,255,255,.4); }

/* the bar that comes up over a held passage */
.rd-mbar {
  position: fixed; z-index: 2147483100; display: none;
  align-items: center; gap: 6px; padding: 7px 8px;
  background: #15171c; color: #fff; border-radius: 11px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
  font: 600 12px/1 var(--ovi-body, inherit);
}
.rd-mbar.on { display: flex; }
.rd-mbar button {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  border: 0; border-radius: 8px; padding: 7px 9px;
  font: 600 12px/1 var(--ovi-body, inherit); color: #fff; background: rgba(255,255,255,.14);
}
.rd-mbar button.sw { width: 24px; height: 24px; padding: 0; border-radius: 50%; }
.rd-mbar button.sw[data-c="yellow"] { background: #ffd640; }
.rd-mbar button.sw[data-c="green"]  { background: #68de8c; }
.rd-mbar button.sw[data-c="blue"]   { background: #78beff; }
.rd-mbar button.sw[data-c="pink"]   { background: #ff8cbe; }
.rd-mbar button.sw[data-c="none"]   { background: transparent; border: 2px solid #fff; }
.rd-mbar button.sw.on { outline: 2px solid #fff; outline-offset: 2px; }

/* writing a note against a passage */
.rd-note {
  position: fixed; inset: 0; z-index: 2147483200; display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.72);
}
.rd-note.on { display: flex; }
.rd-note .rd-note-card {
  width: min(100%, 560px); max-height: 86vh; overflow-y: auto;
  background: #15171c; color: #fff; border-radius: 16px 16px 0 0; padding: 16px 16px 20px;
}
.rd-note blockquote {
  margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.07); border-radius: 0 8px 8px 0;
  font: italic 400 14px/1.45 var(--ovi-heading, Georgia, serif);
  max-height: 28vh; overflow-y: auto;
}
.rd-note textarea {
  width: 100%; min-height: 108px; resize: vertical; padding: 11px 12px;
  background: rgba(255,255,255,.08); color: #fff;
  border: 1px solid rgba(255,255,255,.22); border-radius: 10px;
  font: 400 15px/1.45 var(--ovi-body, inherit);
}
.rd-note .rd-note-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.rd-note .rd-note-acts button {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding: 10px 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3);
  background: transparent; color: #fff; font: 600 13px/1 var(--ovi-body, inherit);
}
.rd-note .rd-note-acts button.go { background: #fff; color: #111; border-color: #fff; }
.rd-note .rd-note-acts button.rub { margin-right: auto; border-color: rgba(255,120,120,.6);
  color: #ff9a9a; }

/* ===================================================================
   THE NOTEBOOK (@ovi 2026-10-29)
   =================================================================== */
#ovi-notebook {
  position: fixed; inset: 0; z-index: 2147483300; display: none;
  flex-direction: column;
  background: #14161a; color: #e6e4e0;
  font: 400 15px/1.5 var(--ovi-body, system-ui, sans-serif);
}
#ovi-notebook.on { display: flex; }
#ovi-notebook .nb-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.12);
}
#ovi-notebook .nb-top h3 {
  flex: 1 1 auto; margin: 0;
  font: 700 16px/1.2 var(--ovi-heading, Georgia, serif); letter-spacing: .02em; }
#ovi-notebook .nb-top small { display: block; font: 500 11.5px/1.3 inherit; opacity: .55;
  letter-spacing: 0; }
#ovi-notebook .nb-top button {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: inherit; border: 0;
  border-radius: 9px; padding: 9px 12px; font: 600 13px/1 inherit; }

#ovi-notebook .nb-find { flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 14px; }
#ovi-notebook .nb-find input {
  flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 12px;
  background: rgba(255,255,255,.08); color: inherit;
  border: 1px solid rgba(255,255,255,.2); border-radius: 10px;
  font: 400 15px/1 inherit; }
#ovi-notebook .nb-find button {
  -webkit-appearance: none; appearance: none; cursor: pointer; flex: 0 0 auto;
  background: transparent; color: inherit;
  border: 1px solid rgba(255,255,255,.28); border-radius: 10px;
  padding: 0 12px; height: 40px; font: 600 12.5px/1 inherit; }
#ovi-notebook .nb-find button.on { background: #fff; color: #111; border-color: #fff; }

#ovi-notebook .nb-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 14px 40px;
  -webkit-overflow-scrolling: touch; }

#ovi-notebook .nb-book { margin: 16px 0 6px; display: flex; gap: 10px; align-items: center; }
#ovi-notebook .nb-book img {
  width: 34px; height: 51px; object-fit: cover; border-radius: 2px; flex: 0 0 auto;
  background: #2a2520; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
#ovi-notebook .nb-book b { display: block; font: 600 14.5px/1.25 var(--ovi-heading, Georgia, serif); }
#ovi-notebook .nb-book span { display: block; font-size: 12px; opacity: .55; }

#ovi-notebook .nb-mark {
  position: relative; margin: 0 0 9px 8px; padding: 10px 12px 10px 14px;
  background: rgba(255,255,255,.055); border-radius: 0 9px 9px 0; cursor: pointer; }
#ovi-notebook .nb-mark::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  border-radius: 2px; background: #ffd640; }
#ovi-notebook .nb-mark[data-c="green"]::before { background: #68de8c; }
#ovi-notebook .nb-mark[data-c="blue"]::before  { background: #78beff; }
#ovi-notebook .nb-mark[data-c="pink"]::before  { background: #ff8cbe; }
#ovi-notebook .nb-mark[data-c="none"]::before  { background: rgba(255,255,255,.45); }
#ovi-notebook .nb-mark q {
  display: block; quotes: none;
  font: italic 400 14.5px/1.5 var(--ovi-heading, Georgia, serif); }
#ovi-notebook .nb-mark .nb-note {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,.2);
  font: 400 13.5px/1.45 inherit; }
#ovi-notebook .nb-mark .nb-where {
  margin-top: 7px; font: 500 11px/1.2 inherit; opacity: .5;
  display: flex; gap: 10px; flex-wrap: wrap; }

#ovi-notebook .nb-none { padding: 40px 10px; text-align: center; opacity: .6; }
#ovi-notebook .nb-none a { color: #9fe; }

/* the way in, in the bookshelf window */
#ovi-notebook-open {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: rgba(128,128,128,.16); color: inherit;
  border: 1px solid rgba(128,128,128,.4); border-radius: 9px;
  padding: 8px 12px; font: 600 12.5px/1 var(--ovi-body, inherit); }


/* ===================================================================
   SHARING (@ovi 2026-10-29)
   =================================================================== */
#ovi-share {
  position: fixed; inset: 0; z-index: 2147483500; display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.72);
}
#ovi-share.on { display: flex; }
#ovi-share .sh-card {
  width: min(100%, 560px); max-height: 88vh; display: flex; flex-direction: column;
  background: #15171c; color: #fff; border-radius: 16px 16px 0 0;
}
#ovi-share .sh-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 8px; }
#ovi-share .sh-top h4 { flex: 1 1 auto; margin: 0;
  font: 700 15px/1.3 var(--ovi-heading, Georgia, serif); }
#ovi-share .sh-top button {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: inherit; border: 0;
  border-radius: 8px; padding: 8px 11px; font: 600 12.5px/1 var(--ovi-body, sans-serif); }
#ovi-share .sh-what {
  flex: 0 0 auto; margin: 0 16px 10px; padding: 9px 11px;
  background: rgba(255,255,255,.07); border-left: 3px solid rgba(255,255,255,.35);
  border-radius: 0 8px 8px 0; max-height: 20vh; overflow-y: auto;
  font: italic 400 13.5px/1.45 var(--ovi-heading, Georgia, serif); }
#ovi-share input.sh-find, #ovi-share textarea {
  flex: 0 0 auto; margin: 0 16px 10px; padding: 10px 12px;
  background: rgba(255,255,255,.08); color: #fff;
  border: 1px solid rgba(255,255,255,.22); border-radius: 10px;
  font: 400 14.5px/1.4 var(--ovi-body, sans-serif); }
#ovi-share textarea { min-height: 60px; resize: vertical; }
#ovi-share .sh-list { flex: 1 1 auto; min-height: 60px; overflow-y: auto; padding: 0 10px 10px; }
#ovi-share .sh-who {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 12px; margin: 0 0 4px; border-radius: 10px; }
#ovi-share .sh-who:hover { background: rgba(255,255,255,.07); }
#ovi-share .sh-who.on { background: rgba(255,255,255,.16); }
#ovi-share .sh-who i {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.16); display: inline-flex;
  align-items: center; justify-content: center;
  font: 700 12px/1 var(--ovi-body, sans-serif); font-style: normal; }
#ovi-share .sh-who b { flex: 1 1 auto; font: 500 14.5px/1.3 var(--ovi-body, sans-serif); }
#ovi-share .sh-who span { font: 500 11px/1 var(--ovi-body, sans-serif); opacity: .5; }
#ovi-share .sh-go {
  flex: 0 0 auto; margin: 0 16px 16px;
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding: 12px; border-radius: 11px; border: 0;
  background: #fff; color: #111; font: 700 14px/1 var(--ovi-body, sans-serif); }
#ovi-share .sh-go[disabled] { opacity: .4; cursor: default; }
#ovi-share .sh-said { margin: 0 16px 12px; font: 500 13px/1.4 var(--ovi-body, sans-serif);
  opacity: .8; }

/* ovi-reader-layers: the reader sits at z-index 2147483600; the bar, the note box, the passages panel and the share sheet were written when it sat lower (2147483100 to 2147483500)
   and so were painted UNDER the book. Each is now above it, in the order they open. */
.rd-mbar { z-index: 2147483610 !important; }
.rd-note { z-index: 2147483620 !important; }
#ovi-notebook { z-index: 2147483630 !important; }
#ovi-share { z-index: 2147483635 !important; }

/* ovi-ownedit: EDITING YOUR OWN BOOK (23 Nov 2026). The bar below the page while writing, in the marking bar's own cloth. */
.rd-ebar {
  position: fixed; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom) + 8px); z-index: 2147483612; display: none;
  flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 8px;
  background: #15171c; color: #fff; border-radius: 11px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
  font: 600 12px/1 var(--ovi-body, inherit);
}
.rd-ebar.on { display: flex; }
.rd-ebar button {
  -webkit-appearance: none; appearance: none; cursor: pointer; border: 0; border-radius: 8px; padding: 8px 10px; min-height: 32px;
  font: 600 12px/1 var(--ovi-body, inherit); color: #fff; background: rgba(255,255,255,.14);
}
.rd-ebar button.rd-go { background: #68de8c; color: #10261a; }
.rd-ebar button.rd-em { display: none; }
.rd-ebar[data-has-media="1"] button.rd-em { display: inline-block; }
.rd-ebar[data-ro="1"] button { display: none; }
.rd-ebar .rd-esay { flex: 1 1 100%; min-height: 0; font-weight: 500; opacity: .85; }
.rd-ebar .rd-esay:empty { display: none; }
#ovi-reader[data-editing="1"] .rd-strip { position: static !important; height: auto !important; width: auto !important; transform: none !important;
  column-count: auto !important; column-width: auto !important; column-gap: 0 !important; padding: var(--rd-pad, 22px) !important; }
#ovi-reader[data-editing="1"] .rd-stage { overflow: auto; -webkit-overflow-scrolling: touch; touch-action: auto; }
#ovi-reader[data-editing="1"] .rd-tap { display: none; }
#ovi-reader[data-editing="1"] .rd-inner { padding-bottom: 120px; outline: none; }
#ovi-reader[data-editing="1"] .rd-inner:focus { outline: none; }
.rd-inner img.rd-sel, .rd-inner video.rd-sel, .rd-inner audio.rd-sel { outline: 3px solid #68de8c; outline-offset: 2px; }
.rd-strip video, .rd-strip audio { max-width: 100%; display: block; margin: 10px auto; }
.rd-strip img[data-wrap="left"], .rd-strip video[data-wrap="left"] { float: left; max-width: 55%; margin: 4px 12px 12px 0; }
.rd-strip img[data-wrap="right"], .rd-strip video[data-wrap="right"] { float: right; max-width: 55%; margin: 4px 0 12px 12px; }
.rd-pad { position: fixed; inset: 0; z-index: 2147483640; background: var(--rd-bg, #faf7f0); color: var(--rd-ink, #1c1a17); display: flex; flex-direction: column; }
.rd-pad-top { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; font: 600 13px/1.2 system-ui, sans-serif; border-bottom: 1px solid var(--rd-line, rgba(0,0,0,.12)); background: var(--rd-bar, rgba(0,0,0,.05)); }
.rd-pad-top b { flex: 1 1 auto; }
.rd-pad-top button { min-height: 32px; padding: 0 9px; border: 1px solid var(--rd-line, rgba(0,0,0,.2)); border-radius: 7px; background: transparent; color: inherit; font: 600 13px/1 system-ui, sans-serif; cursor: pointer; }
.rd-pad-top button.on { background: var(--rd-ink, #1c1a17); color: var(--rd-bg, #faf7f0); }
.rd-pad-top button.rd-go { background: #68de8c; color: #10261a; border-color: transparent; }
.rd-pad canvas { flex: 1 1 auto; touch-action: none; background-image: linear-gradient(var(--rd-line, rgba(0,0,0,.12)) 1px, transparent 1px); background-size: 100% 28px; }
