
/* Constrain Mirador viewer within container */
.iiif-viewer-container[data-viewer="mirador"] {
    position: relative !important;
    overflow: hidden !important;
}

.iiif-viewer-container[data-viewer="mirador"] .mirador-viewer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Ensure Mirador doesn't escape container */
#mirador-viewer-553,
[id^="mirador-viewer-"] {
    position: relative !important;
    overflow: hidden !important;
}

[id^="mirador-viewer-"] > div {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Fix autocomplete dropdown text color */
.ui-autocomplete {
  background-color: #fff !important;
  color: #212529 !important;
}

.ui-autocomplete .ui-menu-item {
  color: #212529 !important;
}

.ui-autocomplete .ui-menu-item-wrapper {
  color: #212529 !important;
}

.ui-autocomplete .ui-state-active,
.ui-autocomplete .ui-state-focus {
  background-color: #0d6efd !important;
  color: #fff !important;
}

/* Select2 dropdown fix */
.select2-container--default .select2-results__option {
  color: #212529 !important;
}

.select2-container--default .select2-results__option--highlighted {
  background-color: #0d6efd !important;
  color: #fff !important;
}

.select2-dropdown {
  background-color: #fff !important;
  color: #212529 !important;
}

/* AtoM autocomplete fix */
.autocomplete-results,
.autocomplete ul,
.autocomplete li {
  background-color: #fff !important;
  color: #212529 !important;
}

.autocomplete li:hover,
.autocomplete li.selected {
  background-color: #0d6efd !important;
  color: #fff !important;
}

/* YUI autocomplete fix */
.yui-ac-content {
  background-color: #fff !important;
  color: #212529 !important;
}

.yui-ac-content li {
  color: #212529 !important;
}

.yui-ac-content li.yui-ac-highlight {
  background-color: #0d6efd !important;
  color: #fff !important;
}

/* YUI Autocomplete Dropdown Fixes */
.yui-ac {
  position: relative;
  font-family: inherit;
}

.yui-ac-container {
  position: absolute;
  z-index: 9999;
  width: 100%;
  background-color: #fff !important;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.yui-ac-content {
  background-color: #fff !important;
  overflow: hidden;
  overflow-y: auto;
  max-height: 300px;
}

.yui-ac-content ul {
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: #fff !important;
}

.yui-ac-content li {
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: #212529 !important;
  background-color: #fff !important;
  border-bottom: 1px solid #f8f9fa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yui-ac-content li:last-child {
  border-bottom: none;
}

.yui-ac-content li:hover,
.yui-ac-content li.yui-ac-highlight {
  background-color: #0d6efd !important;
  color: #fff !important;
}

.yui-ac-content li.yui-ac-prehighlight {
  background-color: #e9ecef !important;
  color: #212529 !important;
}

/* Fix for the input container */
.yui-ac-input {
  position: relative;
}

/* Shadow fix */
.yui-ac-shadow {
  display: none;
}

/* Ensure visibility */
.yui-ac .yui-ac-bd {
  background-color: #fff !important;
}

/* 3D Model Viewer containment */
.iiif-viewer-container {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
    overflow: hidden;
}

.model-wrapper {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

model-viewer {
    position: relative !important;
    z-index: 1 !important;
}

/* Ensure user action buttons appear above viewer */
.card.mb-4.mt-3 {
    position: relative;
    z-index: 10;
}

/* Ensure section content appears properly */
section#identityArea,
section.border-bottom {
    position: relative;
    z-index: 5;
    background-color: #fff;
}

/* Fix 3D viewer containment - prevent overlap */
.iiif-viewer-container,
.model-wrapper,
model-viewer {
    position: relative !important;
    z-index: 1 !important;
    display: block !important;
    overflow: visible !important;
}

model-viewer::part(default-poster),
model-viewer::part(default-progress-bar) {
    position: absolute !important;
}

/* Force buttons and content to appear above viewer */
#identityArea,
.border-bottom,
#content section {
    position: relative !important;
    z-index: 10 !important;
    background-color: #fff !important;
}

/* User action buttons card */
.card.mb-4.mt-3[style*="z-index: 100"] {
    z-index: 100 !important;
    background-color: #fff;
}

/* ==========================================================================
   Digital Object Viewer Container
   ========================================================================== */

.digital-object-viewer {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 1rem;
  overflow: hidden;
  background: #f8f9fa;
  border-radius: 8px;
}

.digital-object-viewer .iiif-viewer-container {
  position: relative;
  width: 100%;
  min-height: 400px;
}

.digital-object-viewer .osd-viewer,
.digital-object-viewer .mirador-wrapper,
.digital-object-viewer .model-wrapper {
  position: relative !important;
  width: 100% !important;
  z-index: 1;
}

/* Prevent viewer overflow into other sections */
.digital-object-viewer + section,
.digital-object-viewer + #identityArea,
.digital-object-viewer ~ .border-bottom {
  position: relative;
  z-index: 10;
  background-color: #fff;
}

/* ==========================================================================
   Standard Digital Object Viewer (non-IIIF fallback)
   Displays when Cantaloupe IIIF server is not available
   ========================================================================== */

.digital-object-viewer {
  position: relative;
  width: 100%;
  text-align: center;
  margin: 0 0 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border: none;
  border-radius: 8px;
}

.digital-object-viewer a {
  display: inline-block;
}

.digital-object-viewer img {
  max-width: 100%;
  max-height: 600px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.digital-object-viewer img:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  cursor: zoom-in;
}

.digital-object-viewer video,
.digital-object-viewer audio {
  width: 100%;
  max-width: 100%;
  border-radius: 4px;
}

.digital-object-viewer iframe {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

.digital-object-viewer .btn {
  margin-top: 1rem;
}

/* IIIF Viewer Container (when Cantaloupe is available) */
.iiif-viewer-container {
  position: relative;
  width: 100%;
  min-height: 400px;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
}

/* Fix form-select text color in card headers */
.card-header .form-select,
.card-header .form-control,
.card-header select,
.card-header input[type="text"] {
  color: #212529 !important;
  background-color: #fff !important;
}

.card-header .form-select option {
  color: #212529 !important;
  background-color: #fff !important;
}

/* ==========================================================================
   Fix: AtoM bundle overrides body/wrapper/footer styles, breaking layout.
   The bundle sets body{display:flex;flex-grow:0} without flex-direction,
   and generic footer{margin-top:-1rem;::before{content:"— "}} etc.
   ========================================================================== */

/* Body: must be flex-column so header/wrapper/footer stack vertically */
body {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
  height: auto !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Wrapper: must grow to push footer to bottom */
#wrapper {
  flex: 1 1 auto !important;
}

/* Footer: reset all bundle overrides on the page footer */
footer.ahg-site-footer {
  flex-shrink: 0 !important;
  display: block !important;
  height: auto !important;
  margin: 0 !important;
  padding: 1rem 0 !important;
  font-size: 1rem !important;
  border-top: none !important;
  background-color: var(--ahg-footer-bg, var(--ahg-primary, #005837)) !important;
  color: var(--ahg-footer-text, #fff) !important;
  justify-content: initial !important;
  flex-wrap: initial !important;
  align-items: initial !important;
}

footer.ahg-site-footer::before {
  content: none !important;
}

footer.ahg-site-footer a,
footer.ahg-site-footer a.footer-link {
  color: rgba(255, 255, 255, 0.7) !important;
  text-decoration: none !important;
}

footer.ahg-site-footer a:hover,
footer.ahg-site-footer a.footer-link:hover {
  color: #fff !important;
  text-decoration: underline !important;
}

/* Static page content - ensure Markdown/HTML renders properly */
.static-page-content h1 { font-size: 2rem; font-weight: 600; margin: 1.5rem 0 1rem; }
.static-page-content h2 { font-size: 1.5rem; font-weight: 600; margin: 1.25rem 0 0.75rem; border-bottom: 1px solid var(--ahg-border, #dee2e6); padding-bottom: 0.3rem; }
.static-page-content h3 { font-size: 1.25rem; font-weight: 600; margin: 1rem 0 0.5rem; }
.static-page-content h4 { font-size: 1.1rem; font-weight: 600; margin: 1rem 0 0.5rem; }
.static-page-content p { margin-bottom: 1rem; line-height: 1.7; }
.static-page-content ul, .static-page-content ol { margin-bottom: 1rem; padding-left: 2rem; }
.static-page-content li { margin-bottom: 0.25rem; }
.static-page-content hr { margin: 1.5rem 0; border-top: 1px solid var(--ahg-border, #dee2e6); }
.static-page-content code { background: #f4f4f4; padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.9em; }
.static-page-content pre { background: #f4f4f4; padding: 1rem; border-radius: 0.375rem; overflow-x: auto; margin-bottom: 1rem; }
.static-page-content pre code { background: none; padding: 0; }
.static-page-content blockquote { border-left: 4px solid var(--ahg-primary, #005837); padding: 0.5rem 1rem; margin: 1rem 0; color: var(--ahg-muted, #6c757d); }
.static-page-content table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.static-page-content table th, .static-page-content table td { padding: 0.5rem; border: 1px solid var(--ahg-border, #dee2e6); }
.static-page-content table th { background: var(--ahg-light, #f8f9fa); font-weight: 600; }
.static-page-content a { color: var(--ahg-link-color, #005837); text-decoration: underline; }
.static-page-content img { max-width: 100%; height: auto; }
