.uv-pui-slot { margin: 1rem 0; width: 100%; }
.uv-pui-slot iframe { display: block; width: 100%; height: min(70vh, 650px); min-height: 350px; border: 1px solid #aaa; }
@media (max-width: 600px) { .uv-pui-slot iframe { height: 65vh; min-height: 300px; } }

.uv-pui-ao-media { min-width: 0; margin-bottom: 1rem; }
.uv-pui-file-links { display: none; overflow-wrap: anywhere; }
.uv-pui-file-links h2 { font-size: 1.125rem; margin: .5rem 0; }
.uv-pui-file-links ul { margin: 0; padding-left: 1.25rem; }
.uv-pui-file-links li { margin: .25rem 0; }

/* The server-rendered marker survives viewer failure and works without JS. */
@media (max-width: 600px) {
  #notes_row:has(> .resizable-content-pane > .uv-pui-ao-media) {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  #notes_row:has(> .resizable-content-pane > .uv-pui-ao-media) > .resizable-content-pane,
  #notes_row:has(> .resizable-content-pane > .uv-pui-ao-media) > #sidebar {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    min-width: 0;
  }
  #notes_row:has(> .resizable-content-pane > .uv-pui-ao-media) > .resizable-content-pane { order: 0; }
  #notes_row:has(> .resizable-content-pane > .uv-pui-ao-media) > #sidebar { order: 1 !important; }
  #notes_row:has(> .resizable-content-pane > .uv-pui-ao-media) > #sidebar .resizable-sidebar-handle { display: none; }
}

/* Public layout only. Correct intrinsic sizes instead of clipping the page. */
@media (max-width: 600px) {
  #header, #header > .row { width: 100%; max-width: 100%; }
  #header > .row { padding-left: 1rem; padding-right: 1rem; }
  #header .site-title { overflow-wrap: anywhere; }
  #info_row { flex-direction: column; }
  #info_row > .information, #info_row > .page_actions { width: 100%; min-width: 0; }
  .page_actions > .d-flex { flex-wrap: wrap; justify-content: flex-start !important; }
  .page_actions .large-badge, .page_actions .page_action { max-width: 100%; }
  .page_actions .page_action { white-space: normal; }
  #main-content .information, #main-content .record-header,
  #main-content .identifier, #main-content .breadcrumb,
  #main-content .upper-record-details, #main-content .additional-file-version,
  #main-content .panel-heading { min-width: 0; overflow-wrap: anywhere; }
  #main-content .breadcrumb li { min-width: 0; max-width: 100%; }
  #main-content .badge-and-identifier { overflow: visible; }
  #main-content .available-digital-objects { float: none; width: 100%; max-width: 100%; }
  #main-content .objectimage { margin: 0 0 1rem; }
  #main-content .objectimage img, #main-content .additional-file-version img {
    min-width: 0; max-width: 100%; height: auto;
  }
  #main-content .external-digital-object__content-btn { white-space: normal; }
  #main-content .upper-record-details dl, #main-content .upper-record-details ul { max-width: 100%; }
  #main-content .upper-record-details dt, #main-content .upper-record-details dd { overflow-wrap: anywhere; }
  #content .row.has-resizable-content { flex-wrap: wrap; }
  #content .row.has-resizable-content > .resizable-content-pane,
  #content .row.has-resizable-content > .resizable-sidebar,
  #main-content > .resizable-content-pane,
  #main-content > .resizable-sidebar,
  #main-content .row.has-resizable-content > .resizable-content-pane,
  #main-content .row.has-resizable-content > .resizable-sidebar {
    width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; min-width: 0;
  }
  #content .resizable-sidebar-handle { display: none; }
  #load-all-section .d-flex { flex-wrap: wrap; min-width: 0; }
  #content .infinite-records-container { min-width: 0; max-width: 100%; }
  #content .infinite-record-record { min-width: 0; overflow-wrap: anywhere; }
  #content .infinite-records-container .record { min-width: 0; overflow-wrap: anywhere; }
  #main-content .tabbing.nav-pills { flex-wrap: wrap; }
  /* Search and Digital Materials results live outside #main-content. */
  #content .recordrow > .flex > div { min-width: 0; }
  #content .recordrow .identifier, #content .recordrow .record-title,
  #content .recordrow .recordsummary, #content .recordrow .result_context {
    white-space: normal; overflow-wrap: anywhere;
  }
}

/* A failed viewer leaves an accessible recovery action alongside the Files list. */
.uv-pui-fallback { margin: 1rem 0; padding: 1rem; border: 1px solid #aaa; max-width: 100%; overflow-wrap: anywhere; }
.uv-pui-fallback p { margin: 0 0 .75rem; }
.uv-pui-fallback button { max-width: 100%; white-space: normal; border: 1px solid #666; background: #fff; color: #222; padding: .5rem .75rem; }
.uv-pui-fallback button:focus-visible { outline: 3px solid #2255aa; outline-offset: 2px; }

.uv-pui-unavailable { margin: 1rem 0; padding: .5rem .75rem; color: #333; background: #f5f5f5; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) {
  .uv-pui-unavailable { color: #f0f0f0; background: #242424; }
}
