/* Stage 14N — corrective museum presentation and interaction pass */

html {
  scroll-padding-top: calc(var(--sticky-header-height, 76px) + 18px);
}

/* Preserve the established Art Deco hierarchy in newly added sections. */
.library-page h1,
.library-page h2,
.library-page h3,
.dossier-main h1,
.dossier-main h2,
.dossier-main h3,
.research-library h1,
.research-library h2,
.research-library h3,
.paper-subgroup h3,
.highlight-card h3 {
  font-family: var(--deco, "Poiret One", sans-serif);
  text-transform: uppercase;
  letter-spacing: .045em;
}

main section > h1,
main section > h2,
main section > h3,
main article > h1,
main article > h2,
main article > h3,
.document-reader h1,
.document-reader h2,
.document-reader h3,
.source-viewer h2,
.source-viewer h3 {
  font-family: var(--deco, "Poiret One", sans-serif);
  text-transform: uppercase;
  letter-spacing: .045em;
}

/* The entry belongs to the hero, not a second explanatory panel. */
.hero-frame { position: relative; padding-bottom: clamp(78px, 9vh, 104px); }
.hero-enter-button {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  padding: 11px 18px 9px;
  border: 1px solid rgba(241,202,120,.78);
  background: rgba(2,12,18,.82);
  color: #f5dda3;
  font: 700 .74rem/1 var(--nav, sans-serif);
  letter-spacing: .12em;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(0,0,0,.36);
}
.hero-enter-button:hover,
.hero-enter-button:focus-visible { background: #d5b36d; color: #061018; }
.museum-entry { display: none !important; }

/* Museum lobby: a visual preview wall, without redundant explanatory copy. */
.archive-highlights {
  margin-top: 0;
  padding: clamp(14px, 2vw, 24px);
  background: linear-gradient(180deg, rgba(3,16,22,.98), rgba(5,25,33,.9));
}
.archive-highlights .highlights-heading,
.archive-highlights .highlight-copy { display: none !important; }
.archive-highlights .highlight-grid {
  grid-template-columns: repeat(12, minmax(0,1fr));
  grid-auto-rows: clamp(165px, 19vw, 290px);
  gap: 10px;
}
.archive-highlights .highlight-card,
.archive-highlights .highlight-card.feature-wide {
  grid-column: span 3;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-color: rgba(223,187,113,.42);
}
.archive-highlights .highlight-card:nth-child(1),
.archive-highlights .highlight-card:nth-child(2) { grid-column: span 6; }
.archive-highlights .highlight-media,
.archive-highlights .highlight-card.portrait .highlight-media,
.archive-highlights .highlight-film-poster {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  overflow: hidden;
  background: #06141b;
}
.archive-highlights .highlight-media img,
.archive-highlights .highlight-film-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease, filter .3s ease;
}
.archive-highlights .highlight-card:hover img { transform: scale(1.035); filter: contrast(1.06); }
.archive-highlights .highlight-card.newspaper .highlight-media img {
  width: 142%;
  max-width: none;
  margin-left: -21%;
  object-fit: cover;
  object-position: center top;
  background: #eee9dc;
}
.archive-highlights .highlight-card.portrait .highlight-media img { object-position: center 12%; }
.archive-highlights .highlight-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 35%;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(0,8,12,.62));
}

/* Crop the archival sheet only in the room preview; the viewer retains the full sheet. */
#room-boom .plate-media { overflow: hidden; }
#room-boom .plate-media img {
  width: 118%;
  height: 118%;
  max-width: none;
  margin: -6% 0 0 -9%;
  object-fit: cover;
  object-position: 52% 44%;
}

/* Let the timeline rail use the full height of its paired detail panel. */
.batch4-timeline .timeline-workbench { align-items: stretch !important; }
.batch4-timeline .timeline-rail {
  max-height: none;
  height: 100%;
  overflow: visible;
  align-content: stretch;
  grid-template-rows: repeat(8, minmax(104px, 1fr));
}
.batch4-timeline .timeline-moment { min-height: 104px; }

/* The actual creator animation replaces the illegible placeholder panel. */
.wind-source-card { padding: 0; overflow: hidden; background: #06141b; }
.wind-source-card .wind-animation {
  display: block;
  width: 100%;
  height: auto;
  min-height: 320px;
  object-fit: contain;
  background: #fff;
}
.wind-source-card figcaption { padding: 10px 14px 13px; margin: 0; }
.local-video-fallback {
  position:relative;
  display:block;
  width:100%;
  aspect-ratio:16/9;
  overflow:hidden;
  background:#000;
}
.local-video-fallback img { width:100%; height:100%; object-fit:cover; opacity:.72; }
.local-video-fallback span {
  position:absolute;
  left:50%; top:50%; transform:translate(-50%,-50%);
  padding:11px 15px;
  border:1px solid #efd99f;
  background:rgba(1,8,12,.86);
  color:#fff0bd;
  font:700 .75rem/1 var(--nav,sans-serif);
  letter-spacing:.08em;
  text-transform:uppercase;
  white-space:nowrap;
}

/* Viewer controls must remain above the sticky site header. */
.exhibit-modal.source-viewer,
[role="dialog"].source-viewer { z-index: 4000 !important; }
.source-viewer .modal-panel.source-viewer-panel {
  max-height: calc(100dvh - 24px) !important;
}
.source-viewer .viewer-toolbar {
  position: sticky;
  top: 0;
  z-index: 12;
}
.source-viewer .modal-close { z-index: 20; }
.source-viewer .viewer-toolbar button { min-height: 38px; }
main .document-toolbar,
main .sequence-toolbar,
main .page-controls,
main [class*="viewer-controls"],
main [class*="document-controls"] {
  position: sticky;
  top: var(--sticky-header-height, 76px);
  z-index: 1200;
  background: #06141b;
}

/* Replace bare homepage text leads with museum-object previews. */
.paper-source-leads { grid-template-columns: repeat(3, minmax(0,1fr)); }
.paper-source-leads a {
  min-height: 250px;
  padding: 0;
  position: relative;
  overflow: hidden;
  background: #06141b;
}
.paper-source-leads a img { width:100%; height:100%; object-fit:cover; object-position:center top; }
.paper-source-leads a .paper-lead-caption {
  position:absolute;
  inset:auto 0 0;
  padding:16px;
  background:linear-gradient(transparent,rgba(0,8,12,.96) 38%);
}
.paper-source-leads a strong { display:block; color:#f1d89c; font-family:var(--deco,"Poiret One",sans-serif); text-transform:uppercase; }
.paper-source-leads a span { color:#d8d0bd; }

/* Smaller catalog previews and stable card layout reduce expensive decoding. */
.publication-record .source-preview {
  width: min(100%, 360px);
  max-height: 220px;
  object-fit: contain;
  content-visibility: auto;
}
.publication-record { content-visibility: auto; contain-intrinsic-size: 420px; }
.catalog-load-more {
  display:block;
  margin: 22px auto 6px;
  padding: 11px 18px;
  border: 1px solid rgba(223,187,113,.62);
  background: rgba(7,29,38,.84);
  color: #f2dca4;
  font: 700 .74rem/1 var(--nav,sans-serif);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor:pointer;
}

/* Every media row closes to the full available width. JavaScript assigns
   proportional spans from the actual item count; no filler cards are used. */
.balanced-media-grid {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
}
.balanced-media-grid > * {
  grid-column: span var(--balance-span, 12) !important;
  min-width: 0;
}

/* Research records without a legitimate image still receive a clearly
   labeled catalog card rather than a blank hole or a misleading photograph. */
.catalog-record-cover {
  width: min(100%, 360px);
  min-height: 190px;
  margin: 12px 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(223,187,113,.34);
  background:
    linear-gradient(135deg, transparent 0 48%, rgba(223,187,113,.08) 48% 52%, transparent 52%),
    linear-gradient(160deg, #0b2a34, #04131a);
  color: #ead7a4;
}
.catalog-record-cover small {
  color: #9eb9b6;
  font: 700 .68rem/1.2 var(--nav,sans-serif);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.catalog-record-cover strong {
  font: 400 1.15rem/1.18 var(--deco,"Poiret One",sans-serif);
  text-transform: uppercase;
  letter-spacing: .04em;
}

@media (max-width: 900px) {
  .archive-highlights .highlight-card,
  .archive-highlights .highlight-card.feature-wide,
  .archive-highlights .highlight-card:nth-child(1),
  .archive-highlights .highlight-card:nth-child(2) { grid-column: span 6; }
  .batch4-timeline .timeline-rail { grid-template-rows: none; }
  .paper-source-leads { grid-template-columns: 1fr; }
  .balanced-media-grid > * { grid-column: span 6 !important; }
}
@media (max-width: 600px) {
  .hero-frame { padding-bottom: 88px; }
  .archive-highlights .highlight-grid { grid-auto-rows: 210px; }
  .archive-highlights .highlight-card,
  .archive-highlights .highlight-card.feature-wide,
  .archive-highlights .highlight-card:nth-child(1),
  .archive-highlights .highlight-card:nth-child(2) { grid-column: 1 / -1; }
  .balanced-media-grid > * { grid-column: 1 / -1 !important; }
}

/* Stage 14S: the post-hero lobby is a quiet visual preview, not a second
   editorial introduction. Six objects make two equal-width rows on desktop. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.archive-highlights.lobby-preview {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(18px, 2.8vw, 38px) clamp(16px, 3vw, 44px) clamp(28px, 4vw, 54px);
  background: #04131a;
}
.lobby-preview-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: clamp(210px, 21vw, 310px);
  gap: clamp(8px, 1.1vw, 16px);
}
.lobby-preview-card {
  grid-column: span 3;
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(223,187,113,.34);
  background: #071a23;
}
.lobby-preview-card.lobby-preview-wide { grid-column: span 6; }
.lobby-preview-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .35s ease, filter .35s ease;
}
.lobby-preview-card:first-of-type img { object-position: top center; }
.lobby-preview-card:hover img,
.lobby-preview-card:focus-visible img { transform: scale(1.018); filter: brightness(1.08); }
.lobby-preview-card:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
@media (max-width: 900px) {
  .lobby-preview-card,
  .lobby-preview-card.lobby-preview-wide { grid-column: span 6; }
}
@media (max-width: 600px) {
  .lobby-preview-grid { grid-auto-rows: 210px; }
  .lobby-preview-card,
  .lobby-preview-card.lobby-preview-wide { grid-column: 1 / -1; }
}
