/* Reading: base, state, and responsive rules. */

#dywRightCol .dyw-pdf-frame {
  display: block;
  width: 100%;
  flex: 1 1 0%;
  min-height: 400px;
  border: 0;
}

.page-container:not(.full-mode) #dywRightCol .dyw-pdf-frame {
  min-height: 0px;
  height: 100%;
}

.page-container.full-mode #dywRightCol .dyw-pdf-frame {
  min-height: 0px;
}

#deskTextView {
  display: none;
}

.desk-text-mode #deskTextView {
  display: block;
  flex: 1 1 0%;
  min-height: 0px;
  overflow: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--reading-ink);
}

#deskTextContent {
  padding: 24px 28px;
  font-size: 21px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

/* Preserve the former normal-page reading measure as the outer shell grows. */
.page-container:not(.full-mode) #deskTextContent {
  box-sizing: border-box;
  max-width: 1250px;
  margin-inline: auto;
}

#deskTextContent section + section {
  border-top: 1px solid var(--line-subtle);
  margin-top: 24px;
  padding-top: 16px;
}

#deskTextContent h2 {
  font-size: 22px;
  color: var(--accent-primary);
  margin: 0px 0px 16px;
}

#deskTextContent h3 {
  font-size: 20px;
  margin: 12px 0px;
}

/* Independent amudim: current on the right, next on the left. Narrow reading
   panes stack the same content, including when commentaries consume the width. */
#deskTextView {
  container-type: inline-size;
}

#deskTextContent.desk-text-spread {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  max-width: none;
}

.desk-text-page {
  min-width: 0;
}

.desk-text-spread > .desk-text-companion {
  border-inline-start: 1px solid var(--line-subtle);
  padding-inline-start: 28px;
}

@container (max-width: 600px) {
  #deskTextContent.desk-text-spread {
    grid-template-columns: minmax(0, 1fr);
  }

  .desk-text-spread > .desk-text-companion {
    border-inline-start: 0;
    padding-inline-start: 0;
    border-top: 1px solid var(--line-subtle);
    padding-top: 24px;
  }
}

.page-container.full-mode.desk-scroll-full #deskTextView {
  overflow: visible;
}

.desk-pdf-share {
  position: absolute;
  z-index: 2;
}

.desk-text-mode .desk-pdf-share {
  display: none;
}

.page-container.desk-commentaries-below #dywRightCol .dyw-pdf-frame {
  flex: 0 0 auto;
  min-height: 400px;
}

.desk-pdf-share {
  top: 10px;
  left: 10px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 50%;
  padding: 7px;
  background: var(--desk-gilded);
  overflow: visible;
}

.desk-pdf-share svg {
  width: 24px;
  height: 24px;
  fill: none;
}

.desk-pdf-share[data-state="loading"] svg {
  animation: 1s linear 0s infinite normal none running desk-share-spin;
}

@keyframes desk-share-spin {
100% { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .desk-pdf-share[data-state="loading"] svg {
    animation: auto ease 0s 1 normal none running none;
  }
}

.desk-pdf-share[data-state="share"] svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
