/* Keep decorative frames painted independently. Only the logo mount may skip
   offscreen work; its card already reserves the complete square outer size. */
@supports (content-visibility: auto) {
  #museum-app .specimen-grid > .specimen-link[data-offscreen='true']:not([data-reveal='pending']):not([data-reveal='revealing']) > .specimen-mount {
    content-visibility: auto;
    contain-intrinsic-width: none;
    contain-intrinsic-height: auto 240px;
  }
}
/* The skipped mount must never widen the card's implicit grid column. */
#museum-app a.specimen-link { grid-template-columns: minmax(0, 1fr); }
#museum-app .collection-more { text-align: center; padding: 22px 0 4px; }
#museum-app .collection-more[hidden] { display: none; }
#museum-app .collection-more button { min-height: 44px; padding: 8px 18px; }
/* This obsolete rim belongs to a disabled tab pseudo-element, not the visible
   specimen rims. Clearing its image also prevents a dormant CSS request. */
#museum-app .sector-tab::after { border-image-source: none; }
/* Staged secondary previews keep their accessible names and reserved geometry
   without exposing the browser's empty-src icon before the image arrives. */
#museum-app .entity-timeline img:is([data-src], [data-image-pending]),
#museum-app .modern-logo-preview:is([data-src], [data-image-pending]) { opacity: 0; }

/* Frames remain visible decoration; only artwork/captions reveal. Grouping
   opacity on the card would isolate the original multiply blending. */
#museum-app .specimen-loading { display: none; }
/* A miniature catalogue leaf turns while artwork is pending. No image asset,
   blurred wash, text, dots or spinner; the frame itself never animates. */
#museum-app [data-reveal='pending'] .specimen-loading,
#museum-app [data-detail-loading='pending'] > .specimen-loading {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: block; width: 42px; height: 29px; pointer-events: none;
  perspective: 110px; transform: rotate(-5deg);
}
#museum-app .specimen-loading::before,
#museum-app .specimen-loading::after,
#museum-app .specimen-loading-leaf {
  content: ''; position: absolute; top: 0; width: 21px; height: 29px;
  border: .7px solid #9c805c70;
  background: linear-gradient(100deg, #e8d9bd, #fff6e3 70%);
  box-shadow: 0 1px 1px #765a3620;
}
#museum-app .specimen-loading::before {
  right: 50%; border-radius: 2px 0 0 3px; transform: skewY(-3deg);
}
#museum-app .specimen-loading::after {
  left: 50%; border-radius: 0 3px 2px 0; transform: skewY(3deg);
}
#museum-app .specimen-loading-leaf {
  left: 50%; z-index: 1; border-radius: 0 3px 2px 0;
  transform-origin: 0 50%; backface-visibility: visible;
  animation: museum-loading-page 1800ms cubic-bezier(.4,0,.2,1) infinite;
  animation-delay: var(--logo-loading-phase, 0ms);
  animation-play-state: paused;
}
#museum-app [data-reveal='pending'][data-reveal-visible='true'] .specimen-loading-leaf,
#museum-app [data-detail-loading='pending'][data-detail-loading-visible='true'] .specimen-loading-leaf { animation-play-state: running; }
/* Detail artwork retains its mount dimensions while loading, including scans
   clipped with SVG. The existing miniature book is the only animated layer. */
#museum-app [data-detail-loading] > :is(.specimen-artwork, .modern-logo-preview) { transition: opacity 180ms ease; }
#museum-app [data-detail-loading='pending'] > :is(.specimen-artwork, .modern-logo-preview) { opacity: 0; }
#museum-app .modern-logo-preview-mount {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-width: 0; height: 46px; align-self: center; grid-column: 1; grid-row: 1;
}
#museum-app [lang='en'] .modern-logo-row.recessed-field .modern-logo-preview-mount { grid-column: 2; }
#museum-app .modern-logo-row.recessed-field .modern-logo-preview-mount > .modern-logo-preview {
  width: 64px; height: 100%; max-width: 100%; max-height: 100%;
  min-width: 0; min-height: 0; margin: 0; flex: 0 1 auto; object-fit: contain;
}
#museum-app .modern-logo-preview-mount + .modern-logo-copy { border-left: 1px solid #99877145; padding-inline: 10px; }
@media (max-width: 460px) {
  #museum-app .modern-logo-row.recessed-field .modern-logo-preview-mount > .modern-logo-preview { width: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  #museum-app [data-detail-loading] > :is(.specimen-artwork, .modern-logo-preview) { transition: none; }
}
@keyframes museum-loading-page {
  0%, 10% { transform: rotateY(0deg) skewY(3deg); background-color: #fff6e3; }
  48% { transform: rotateY(-85deg) skewY(-8deg); background-color: #d5bd96; }
  85%, 100% { transform: rotateY(-180deg) skewY(3deg); background-color: #f4e6cd; }
}
#museum-app .specimen-grid > [data-reveal='pending'] .specimen-artwork,
#museum-app .specimen-grid > [data-reveal='pending'] .specimen-caption,
#museum-app .specimen-grid > [data-reveal='pending'] .sample-mark {
  opacity: 0;
}
#museum-app .specimen-grid > [data-reveal='revealing'] :is(.specimen-artwork, .specimen-caption, .sample-mark) {
  animation: museum-card-art-reveal var(--card-reveal-duration, 520ms) cubic-bezier(.2,.65,.3,1) var(--card-reveal-delay, 0ms) both;
}
@keyframes museum-card-art-reveal {
  from { opacity: 0; translate: 0 var(--card-reveal-offset, 6px); }
  to { opacity: 1; translate: 0 0; }
}
#museum-app .specimen-grid > [data-reveal='pending']:focus-visible .specimen-caption { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  #museum-app .specimen-loading-leaf { animation: none; transform: rotateY(-25deg); }
  #museum-app .specimen-grid > [data-reveal='revealing'] :is(.specimen-artwork, .specimen-caption, .sample-mark) {
    animation: none;
  }
}

/* Disabled earlier paper skins can still trigger CSS mask downloads. Clear
   their sources explicitly while retaining every visible material layer. */
#museum-app .paper-stack::before,
#museum-app .paper-stack::after,
#museum-app .section-leaf,
#museum-app .leaf-surface::before,
#museum-app .leaf-surface::after {
  background-image: none;
  mask-image: none; -webkit-mask-image: none;
  border-image-source: none;
}
@media (max-width: 750px) {
  #museum-app .catalogue-leaf::before {
    background-image: none;
    mask-image: none; -webkit-mask-image: none;
  }
}
@media (width > 650px) {
  #museum-app .sector-entry .sector-tab::after { background-image: none; }
  #museum-app .sector-entry[data-image-tab] .index-sheet {
    background-image: none; mask-image: none; -webkit-mask-image: none;
  }
}

/* Permanent baked frame artwork. Safari paints actual SVG image content with
   synchronous presentation; CSS border-image no longer races logo painting. */
#museum-app a.specimen-link.specimen[data-frame-variant]::after {
  content: none; border-image-source: none;
}
#museum-app a.specimen-link > .specimen-frame {
  position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px);
  pointer-events: none; z-index: 2; overflow: hidden;
  mix-blend-mode: multiply; opacity: var(--frame-opacity, .8);
  transform-box: border-box; transform-origin: 50% 50%;
  transform: rotate(calc(var(--frame-orientation, 0deg) + var(--frame-rotation, 0deg)));
  scale: calc(var(--book-reflection) * var(--frame-mirror, 1)) 1;
}

/* Used only after the opener's ten-second budget. Keep a settled paper spread
   instead of allowing delayed materials/fonts to appear after the cover lifts. */
#museum-app .opening-surface-fallback { visibility: hidden; }
#museum-app .opening-paper-fallback { background: #f4ecd9; border-radius: 12px; }
#museum-app .museum-frame-unavailable > .specimen-frame { visibility: hidden; }
#museum-app .museum-frame-unavailable { outline: 1px solid #9c805c55; outline-offset: -5px; }
#museum-app.museum-fonts-degraded :is(.museum-product, .museum-product *) { font-family: Georgia, 'Times New Roman', serif !important; }
