/* Scoped to the finding aid: do not resize viewers on normal item pages. */
.sas-finding-aid > .main-region,
.sas-item-detail,
.sas-item-metadata,
.sas-item-media {
    min-width: 0;
    max-width: 100%;
}
@media (min-width: 768px) {
    .sas-finding-aid > .main-region { flex: 1 1 0; }
}
.sas-item-detail { overflow-wrap: anywhere; }
.sas-item-media {
    width: 100%;
    max-width: 48rem;
    margin: 1.5rem auto;
}
.sas-item-media octopusviewer-viewer {
    width: 100%;
    max-width: 100%;
    /* Override the site's global Safari rule (75vh / minimum 600px). */
    height: 420px !important;
    min-height: 0 !important;
}
.sas-native-media { margin-bottom: 1rem; min-width: 0; }
.sas-native-media img {
    display: block;
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
}
.sas-native-media iframe,
.sas-native-media embed,
.sas-native-media object,
.sas-native-media video { max-width: 100%; }
.sas-native-media .openseadragon { width: 100%; }
@media (max-width: 767px) {
    .sas-item-media octopusviewer-viewer { height: 360px !important; }
}
/* Also loaded inside this viewer's shadow root, instead of the theme override.
   Preserve flexible sizing without forcing hidden sidebars to display. */
:host .octopusviewer-body { min-height: 0; min-width: 0; }
:host .octopusviewer-media-view { min-width: 0; min-height: 0; }
:host .sidebar.hidden { display: none !important; }
