/* Reading presentation only: one independently scrollable region per column. */
html:root body .ae-reading-independent-grid {
  --ae-independent-pane-height: clamp(180px, calc(100vh - 210px), 760px);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: start !important;
  gap: 24px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

html:root body .ae-reading-independent-grid > .ae-reading-independent-pane {
  box-sizing: border-box !important;
  position: static !important;
  top: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: var(--ae-independent-pane-height) !important;
  max-height: var(--ae-independent-pane-height) !important;
  overflow: auto !important;
  overscroll-behavior: contain !important;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: var(--nx-accent, #674195) var(--nx-soft, #f0eaf8);
  overflow-wrap: break-word;
  scroll-behavior: auto;
  scroll-margin-block: 18px;
}

/* The legacy text block becomes content of its named outer passage region. */
html:root body .ae-reading-independent-grid > .ae-reading-independent-pane > .passage-text {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  scrollbar-gutter: auto;
}

html:root body .ae-reading-independent-pane:focus-visible {
  outline: 3px solid var(--nx-accent, #674195) !important;
  outline-offset: 3px !important;
}

html:root body .ae-reading-independent-grid[hidden] {
  display: none !important;
}

@supports (height: 100dvh) {
  html:root body .ae-reading-independent-grid {
    --ae-independent-pane-height: clamp(180px, calc(100dvh - 210px), 760px);
  }
}

@media (max-width: 760px) {
  html:root body .ae-reading-independent-grid {
    --ae-independent-pane-height: clamp(180px, 55vh, 520px);
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 18px !important;
  }
  html:root body .ae-reading-independent-grid > .ae-reading-independent-pane {
    margin-bottom: 0 !important;
  }
  @supports (height: 100dvh) {
    html:root body .ae-reading-independent-grid {
      --ae-independent-pane-height: clamp(180px, 55dvh, 520px);
    }
  }
}

@media print {
  html:root body .ae-reading-independent-grid {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  html:root body .ae-reading-independent-grid > .ae-reading-independent-pane,
  html:root body .ae-reading-independent-grid > .ae-reading-independent-pane > .passage-text {
    position: static !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    scrollbar-gutter: auto;
    outline: none !important;
  }
}
