/* Publication text remains readable even when JavaScript/storage is unavailable. */
.publication-reader { --reading-size: 16px; }
#content_main .publication-reader > h2,
.reading-dialog .publication-reader > h2 {
  font-size: calc(var(--reading-size) * 1.375); line-height: 1.35;
}
.publication-reader :is(.text_short, .text_long) table {
  display: block; max-width: 100%; overflow-x: auto;
}
#content_main .publication-reader .text_short,
#content_main .publication-reader .text_long,
.reading-dialog .publication-reader .text_short,
.reading-dialog .publication-reader .text_long {
  font-size: var(--reading-size); line-height: 1.65; overflow-wrap: anywhere;
}
/* Older editor content contains fixed inline sizes; let the reader control them. */
.publication-reader :is(.text_short, .text_long) :is(p, div, span, font, ul, ol, li, dl, dt, dd, table, thead, tbody, tfoot, tr, td, th, caption, a, strong, em, b, i, small, pre, code, blockquote) {
  font-size: inherit !important; line-height: inherit !important;
}
.publication-reader :is(.text_short, .text_long) h1 { font-size: 1.7em !important; }
.publication-reader :is(.text_short, .text_long) h2 { font-size: 1.5em !important; }
.publication-reader :is(.text_short, .text_long) h3 { font-size: 1.25em !important; }
.publication-reader :is(.text_short, .text_long) :is(h4, h5, h6) { font-size: 1.1em !important; }
.reading-options {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 0 12px; font: 14px/1.4 Arial, sans-serif;
}
.reading-options[hidden] { display: none; }
.reading-options button {
  min-height: 31px; min-width: 44px; padding: 4px 12px; box-sizing: border-box;
  border: 1px solid #bcae9d; border-radius: 5px; background: #fffaf2;
  color: #682026; cursor: pointer; font: inherit;
}
.reading-options button:hover { background: #f1e6d6; }
.reading-options button:focus-visible { outline: 3px solid #a92125; outline-offset: 2px; }
.reading-options button:disabled { opacity: .5; cursor: default; }
.reading-size { min-width: 36px; color: #69584b; }
.reading-dialog {
  width: 100%; max-width: none; height: 100%; max-height: none;
  margin: 0; padding: 0; border: 0; background: #fffaf2; color: #342a25;
}
.reading-dialog::backdrop { background: #fffaf2; }
.reading-surface, .reading-surface:fullscreen {
  width: 100%; height: 100%; overflow: auto; box-sizing: border-box; background: #fffaf2;
}
.reading-dialog .publication-reader {
  max-width: 850px; margin: 0 auto; padding: 0 24px 40px;
  box-sizing: border-box; min-height: 100%;
}
.reading-dialog .reading-options {
  position: sticky; top: 0; z-index: 1; background: #fffaf2;
  padding: 12px 0; border-bottom: 1px solid #dfd2c1; margin-bottom: 20px;
}
.reading-dialog img { max-width: 100%; height: auto; }
body.reading-open { overflow: hidden; }
@media (max-width: 600px) {
  .reading-dialog .publication-reader { padding: 0 16px 24px; }
}
@media print {
  .reading-options { display: none !important; }
}
