/* Generated material assets provide grain, wear and feathered transitions. */
:root { --paper-texture: url('/api/museum/static/decor-archival-paper-fine-v2.48a2992ce72b0422.webp'); }
#museum-app .catalogue-leaf > .leaf-surface {
  border: 0; border-image: none;
  background-color: #eee7d8;
  background-image: url('/api/museum/static/decor-archival-page-rim-v4.153d47b1c8a74904.webp'), var(--paper-texture);
  background-size: 100% 100%, 630px 630px;
  background-repeat: no-repeat, repeat;
  background-clip: border-box;
  box-shadow: none;
  mask-image: none; -webkit-mask-image: none; clip-path: none;
}
#museum-app .leaf-surface::before,
#museum-app .leaf-surface::after { content: none; }
#museum-app .specimen {
  background-color: #eee7d8;
  background-image: var(--paper-texture);
  background-size: 630px 630px;
}
#museum-app .entity-timeline {
  border: 0; border-image: none;
  background-color: #eee7d8;
  background-image: url('/api/museum/static/decor-archival-page-rim-v4.153d47b1c8a74904.webp'), var(--paper-texture);
  background-size: 100% 100%, 630px 630px;
  background-repeat: no-repeat, repeat;
  background-clip: border-box;
  box-shadow: none; padding: 24px 16px;
}
#museum-app .section-leaf,
#museum-app .paper-stack::before,
#museum-app .paper-stack::after {
  border: 0; border-image: none;
  background-image: url('/api/museum/static/decor-archival-page-rim-v4.153d47b1c8a74904.webp'), var(--paper-texture);
  background-size: 100% 100%, 630px 630px;
}
@media (width > 650px) {
  #museum-app .paper-edge-material {
    background-color: #e6ddca;
    background-image: var(--paper-texture); background-size: 630px 630px;
  }
  #museum-app .sector-entry .sector-tab::after {
    content: ''; position: absolute; inset: 0; z-index: 0;
    background: url('/api/museum/static/decor-archival-tab-v2.1e9937755b8900e9.webp') center / 155% 100% no-repeat;
    transform: scaleX(var(--book-reflection)); pointer-events: none;
  }
  #museum-app .sector-entry .sector-tab::before { z-index: 1; }
}
@media (max-width: 650px) {
  #museum-app .entity-timeline { padding: 20px 12px; }
}

/* Place the feathered rim over the grain without exposing its canvas margin. */
#museum-app .catalogue-leaf > .leaf-surface {
  background-image: var(--paper-texture);
  background-size: 630px 630px;
  overflow: hidden;
}
#museum-app .leaf-surface::after {
  content: ''; position: absolute; inset: -8px;
  background: url('/api/museum/static/decor-archival-page-rim-v4.153d47b1c8a74904.webp') center / 100% 100% no-repeat;
  opacity: .56; mask-image: none; scale: 1;
}
#museum-app .catalogue-leaf > .leaf-surface { background-repeat: repeat; }

/* The generated sheet's alpha cuts the grain to the actual worn silhouette. */
#museum-app .catalogue-leaf > .leaf-surface {
  -webkit-mask-image: url('/api/museum/static/decor-archival-page-worn-v3.a6591743a1b8fad0.webp');
  mask-image: url('/api/museum/static/decor-archival-page-worn-v3.a6591743a1b8fad0.webp');
  -webkit-mask-size: calc(100% + 16px) calc(100% + 16px);
  mask-size: calc(100% + 16px) calc(100% + 16px);
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
#museum-app .catalogue-leaf::before {
  content: ''; position: absolute; inset: 3px -2px -4px 2px; width: auto;
  z-index: 0; border: 0;
  background: url('/api/museum/static/decor-archival-page-rim-v4.153d47b1c8a74904.webp') center / 100% 100% no-repeat,
    var(--paper-texture) center / 630px 630px repeat;
  -webkit-mask-image: url('/api/museum/static/decor-archival-page-worn-v3.a6591743a1b8fad0.webp');
  mask-image: url('/api/museum/static/decor-archival-page-worn-v3.a6591743a1b8fad0.webp');
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  filter: brightness(.93) drop-shadow(0 2px 2px #48342055);
  pointer-events: none;
}

/* Cast the page shadow from its rendered alpha, never its rectangular box. */
#museum-app .catalogue-leaf {
  background: none; border: 0; box-shadow: none;
  filter: drop-shadow(0 2px 2px #34261955) drop-shadow(0 4px 5px #34261933);
}
#museum-app .catalogue-leaf::before { filter: brightness(.91); }

/* Each tab is one paper surface, without a second inset tab face. */
@media (width > 650px) {
  #museum-app .sector-entry .sector-tab::after { content: none; }
}

/* A preserved archival insert, with no distressed parchment frame. */
#museum-app .entity-timeline {
  border: 0; border-image: none; background-color: transparent;
  background-image: none;
  background-repeat: no-repeat; box-shadow: none;
  position: relative; z-index: auto;
}
#museum-app .entity-timeline-panel { position: relative; isolation: isolate; }
#museum-app .entity-timeline-material {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  display: block; direction: ltr;
}
#museum-app .timeline-continuous-panel {
  display: block; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 1px 1.5px #57402e32);
}

/* All timeline entries remain visible on mobile, with compact artwork. */
@media (max-width: 750px) {
  #museum-app .entity-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
    gap: 12px 6px;
    overflow: visible;
    padding: 18px 12px;
  }
  #museum-app .entity-timeline li { min-width: 0; }
  #museum-app .entity-timeline-link { padding: 2px 0; gap: 4px; }
  #museum-app .entity-timeline-link .specimen-mount { height: 48px; }
  #museum-app .entity-timeline-date,
  #museum-app [lang='ar'] .entity-timeline-date {
    font-size: 10px; line-height: 1.5; padding-top: 3px;
  }
}
@media (min-width: 500px) and (max-width: 750px) {
  #museum-app .entity-timeline { grid-template-columns: repeat(var(--timeline-count, 7), minmax(0, 1fr)); }
}
@media (max-width: 499px) {
  #museum-app .entity-timeline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 750px) {
  #museum-app .entity-timeline[data-compact='true'] { display: flex; justify-content: center; }
  #museum-app .entity-timeline[data-compact='true'] li { flex: 0 1 82px; }
}

/* The current logo reveals its destination before leaving the museum. */
#museum-app .entity-current-link { position: relative; }
#museum-app .entity-current-link.is-confirming { z-index: 2; }
#museum-app .entity-current-hint {
  position: fixed;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 210px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #bba17e;
  border-radius: 8px;
  background: #542e29f5;
  color: #fff7e5;
  box-shadow: 0 3px 10px #34261940;
  text-align: center;
  pointer-events: none;
  font: 400 13px/1.5 'Bahrain Logos Geomanist', Arial, sans-serif;
}
#museum-app .entity-current-hint:lang(ar) { font-family: 'Bahrain Logos Tajawal', Arial, sans-serif; font-size: 15px; }
#museum-app .entity-current-hint[hidden] { display: none; }
#museum-app .entity-current-hint::after { content: ''; position: absolute; top: 100%; left: var(--callout-arrow-x); width: 12px; height: 7px; background: #542e29f5; clip-path: polygon(0 0, 100% 0, 50% 100%); transform: translateX(-50%); }
#museum-app .entity-current-hint[data-placement='below']::after { top: auto; bottom: 100%; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* Baked light and subtle native paper grain share the sheet's image treatment.
   Rebuild with scripts/build-specimen-light-spots.py; no CSS color stops. */
#museum-app a.specimen-link::before {
  opacity: .85;
  background: url('/api/museum/static/decor-specimen-light-card.327bf30c20764385.webp') center / 100% 100% no-repeat;
  transition: opacity 260ms ease;
}
#museum-app a.specimen-link .specimen-mount::before {
  content: ''; display: block; position: absolute; inset: -12px;
  border: 0; box-shadow: none; pointer-events: none;
  background: url('/api/museum/static/decor-specimen-light-mount.bfade5cf75a7c5b8.webp') center / 100% 100% no-repeat;
  filter: none; opacity: 0;
  transition: opacity 260ms ease;
}
@media (hover: hover) and (pointer: fine) {
  #museum-app a.specimen-link:hover::before { opacity: 1; }
  #museum-app a.specimen-link:hover .specimen-mount::before { opacity: .9; }
}
#museum-app a.specimen-link:focus-visible::before { opacity: 1; }
#museum-app a.specimen-link:focus-visible .specimen-mount::before { opacity: .9; }
@media (prefers-reduced-motion: reduce) {
  #museum-app a.specimen-link::before,
  #museum-app a.specimen-link .specimen-mount::before { transition: none; }
}

/* Timeline dates follow the museum's Amiri typography. */
#museum-app .entity-timeline-date,
#museum-app [lang='ar'] .entity-timeline-date {
  font-family: 'Amiri', serif;
  font-weight: 400; font-style: normal;
}

/* Distinct generated paper rims replace the repeated four-corner mount. */
#museum-app a.specimen-link.specimen::after {
  mix-blend-mode: multiply;
  border-image-source: var(--frame-material, url('/api/museum/static/decor-archival-frame-v2-1.8455c91d242e83ac.webp'));
  border-image-slice: 12%;
  border-image-width: var(--frame-width, 16px);
  opacity: var(--frame-opacity, .75);
}

/* The full-card light fades into the sheet, with no solid rectangular base. */
#museum-app .specimen-grid a.specimen-link {
  background: none;
  overflow: visible;
}
#museum-app .specimen-grid a.specimen-link::before {
  inset: -18px;
  opacity: .85;
  background: url('/api/museum/static/decor-specimen-light-grid.af9b6025bb912d65.webp') center / 100% 100% no-repeat;
  filter: none;
}
#museum-app .specimen-grid a.specimen-link .specimen-mount::before { display: none; }
@media (hover: hover) and (pointer: fine) {
  #museum-app .specimen-grid a.specimen-link:hover::before { opacity: 1; }
}
#museum-app .specimen-grid a.specimen-link:focus-visible::before { opacity: 1; }

/* Both material layers share the image's real cutouts; their wrapper casts the shadow. */
#museum-app .catalogue-leaf { filter: none; }
#museum-app .catalogue-leaf > .leaf-surface {
  background: none; overflow: visible;
  mask-image: none; -webkit-mask-image: none;
  filter: drop-shadow(1px 1px 1.5px #38281870) drop-shadow(0 3px 3px #38281830);
}
#museum-app .leaf-surface::before {
  content: ''; position: absolute; inset: 0; opacity: 1;
  border: 0; box-shadow: none;
  background: var(--paper-texture) center / 630px 630px repeat;
  -webkit-mask-image: url('/api/museum/static/decor-archival-page-small-tears-v7.50f730231343f633.webp');
  mask-image: url('/api/museum/static/decor-archival-page-small-tears-v7.50f730231343f633.webp');
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
#museum-app .leaf-surface::after {
  inset: 0; opacity: .65;
  background: url('/api/museum/static/decor-archival-page-small-tears-v7.50f730231343f633.webp') center / 100% 100% no-repeat;
  mask-image: none; -webkit-mask-image: none;
}

/* Extra full-page skins made the narrow bottom edge look piled and torn. */
#museum-app .paper-stack::before,
#museum-app .paper-stack::after { content: none; }
@media (max-width: 750px) {
  #museum-app .catalogue-leaf::before { content: none; }
  #museum-app .catalogue-leaf > .leaf-surface {
    filter: drop-shadow(0 1px 1px #38281845);
  }
}
@media (width > 750px) {
  #museum-app .catalogue-leaf::before {
    background: url('/api/museum/static/decor-archival-page-small-tears-v7.50f730231343f633.webp') center / 100% 100% no-repeat;
    -webkit-mask-image: none; mask-image: none;
    filter: brightness(.91) drop-shadow(0 1px 1px #38281840);
  }
}

/* Nine image sections preserve the generated corners at every page ratio. */
#museum-app .catalogue-leaf > .leaf-surface {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px;
  grid-template-rows: 36px minmax(0, 1fr) 36px;
  background: none; border: 0; mask-image: none; -webkit-mask-image: none;
}
#museum-app .leaf-surface::before,
#museum-app .leaf-surface::after { content: none; }
#museum-app .paper-image-patch {
  /* Explicit stretch avoids Safari resolving SVG percentage heights to the whole sheet. */
  display: block; width: 100%; height: auto; align-self: stretch; min-width: 0; min-height: 0;
  overflow: hidden;
}
#museum-app .showing-record .catalogue-leaf::before { content: none; }
@media (max-width: 750px) {
  #museum-app .catalogue-leaf > .leaf-surface {
    grid-template-columns: 26px minmax(0, 1fr) 26px;
    grid-template-rows: 26px minmax(0, 1fr) 26px;
  }
}

/* Material patch order is physical; only the whole paper mirrors for RTL. */
#museum-app .catalogue-leaf > .leaf-surface {
  direction: ltr;
  grid-template-columns: 14px minmax(0, 1fr) 14px;
  grid-template-rows: 14px minmax(0, 1fr) 14px;
  transform: scaleX(var(--book-reflection));
}
#museum-app .filter-callout { justify-content: flex-start; gap: 14px; }
#museum-app .filter-summary { flex: 0 1 auto; }
.index-tab-image { display: none; }
@media (width > 650px) {
  #museum-app .index-tab-image {
    display: block; position: absolute; width: 150px;
    height: calc((var(--tab-height, 170px) - 20px) * 2.5);
    top: calc(10px + var(--tab-scatter-y, 0px) - (var(--tab-height, 170px) - 20px) * .75);
    left: calc(var(--tab-face-tip, 84px) - 166px);
    z-index: 0; pointer-events: none;
    filter: drop-shadow(calc(1px * var(--book-reflection)) 2px 2px #4a36244d);
  }
  #museum-app [dir='rtl'] .index-tab-image { left: auto; right: calc(var(--tab-face-tip, 84px) - 166px); }
  #museum-app .index-tab-image img {
    display: block; width: 100%; height: 100%;
    transform: scaleX(var(--book-reflection));
  }
}
@media (width > 650px) {
  #museum-app .sector-entry[data-image-tab]:has(> .sector-tab[aria-pressed='true']) { z-index: 3; }
  /* Its silhouette is painted with the front sheet; retain the label/hit area. */
  #museum-app .sector-entry:has(> .sector-tab[aria-pressed='true']) .index-tab-image { visibility: hidden; }
}
@media (width > 750px) {
  #museum-app .entity-timeline li { flex: 1 1 0; min-width: 0; }
}
@media (width > 650px) {
  #museum-app .index-tab-image { transition: translate 340ms cubic-bezier(.22, .61, .36, 1); }
  #museum-app .index-tab-image img { transform: scale(var(--book-reflection), var(--tab-art-flip, 1)); }
  #museum-app .sector-entry:has(> .sector-tab:not([aria-pressed='true']):is(:hover, :focus-visible)) .index-tab-image {
    translate: calc(4px * var(--book-reflection)) 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #museum-app .index-tab-image { transition: none; }
}

/* Grain tiles at a fixed physical size; it never stretches with page height. */
#museum-app .paper-image-patch:nth-child(5) {
  background: url('/api/museum/static/decor-archival-paper-warm-fine-v9.227242b1767bbced.webp') center / 630px 630px repeat;
}
#museum-app .paper-image-patch:nth-child(5) image { display: none; }
:root { --paper-texture: url('/api/museum/static/decor-archival-paper-warm-fine-v9.227242b1767bbced.webp'); }

/* Feather the tiled grain into the generated perimeter without a visible join. */
#museum-app .paper-image-patch:nth-child(5) { background: none; }
#museum-app .paper-image-patch:nth-child(5) image { display: block; }
#museum-app .paper-grain-center {
  position: absolute; inset: var(--paper-corner-size, 14px);
  background: var(--paper-texture) center / 630px 630px repeat;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent), linear-gradient(to bottom, transparent, #000 18px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent), linear-gradient(to bottom, transparent, #000 18px, #000 calc(100% - 18px), transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}

/* Missing artwork keeps its space while the rest of the museum remains usable. */
#museum-app .specimen-mount > .missing-logo,
#museum-app .missing-logo.modern-logo-preview {
  display: grid; place-items: center; text-align: center;
  padding: 8px; color: #8a7761; font-size: 12px;
}
#museum-app.museum-assets-degraded .catalogue-leaf { background-color: #f4ecd9; }
#museum-app.museum-assets-degraded .entity-timeline-panel { background-color: #f4ecd9; }

/* Give narrow-screen corners enough physical room without stretching their crops. */
@media (max-width: 650px) {
  #museum-app .catalogue-leaf > .leaf-surface {
    --paper-corner-size: 24px;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    grid-template-rows: 24px minmax(0, 1fr) 24px;
  }
}

/* A single grain surface avoids colored joins between the paper slices. */
#museum-app .catalogue-leaf > .leaf-surface { display: block; }
#museum-app .paper-continuous-surface {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  overflow: visible;
}

#museum-app .record-actions { margin-top: 44px; margin-bottom: 24px; }
#museum-app .era-menu:not([hidden]) {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px; padding: 10px;
}
#museum-app .era-field .era-option {
  justify-content: center; position: relative; text-align: center;
  min-height: 44px; padding: 8px 20px; margin: 0; border: 0;
  background: #fffaf033;
}
#museum-app .era-option[data-era='all'],
#museum-app .era-option[data-era='unknown'] { grid-column: 1 / -1; }
#museum-app .era-field .era-option:hover,
#museum-app .era-field .era-option[data-active='true'] { background: #b49b6c26; }
#museum-app .era-field .era-option[aria-selected='true'] { background: #b49b6c38; }
#museum-app .era-option .era-check { position: absolute; inset-inline-end: 6px; }
#museum-app .modern-logo-preview {
  width: auto; height: auto; max-width: 64px; max-height: 46px;
}
#museum-app .modern-logo-row.recessed-field { height: 60px; padding-block: 7px; box-sizing: border-box; }
#museum-app .modern-logo-row.recessed-field {
  grid-template-columns: 102px max-content; padding-inline: 0 22px;
}
#museum-app .modern-logo-row.recessed-field .modern-logo-preview {
  min-width: 0; justify-self: center; margin: 0;
}
#museum-app [lang='en'] .modern-logo-row.recessed-field {
  grid-template-columns: max-content 102px; padding-inline: 22px 0;
}
#museum-app [lang='en'] .modern-logo-row.recessed-field .modern-logo-preview { margin: 0; }
@media (max-width: 750px) {
  #museum-app .record-actions { margin-top: 48px; margin-bottom: 28px; }
  #museum-app .record-mount { margin-bottom: 28px; }
  #museum-app .record-heading { margin-top: 28px; }
}

/* Contribution page shares the museum's existing paper and typography. */
#museum-app .museum-contact { max-width: 700px; width: 100%; margin: 24px auto 42px; color: #503926; }
#museum-app .contact-return { display: inline-flex; align-items: center; min-height: 44px; color: #713e36; }
#museum-app .contact-title { margin: 18px 0 20px; font-size: 32px; line-height: 1.5; font-weight: 700; }
#museum-app .museum-contact :is(.contact-title, .contact-guidelines-title) { font-family: 'Quintessential', Georgia, serif; }
#museum-app .contact-title:focus { outline: none; }
#museum-app .contact-intro, #museum-app .contact-guidelines { font-size: 20px; line-height: 1.9; }
#museum-app .contact-guidelines-title { margin: 30px 0 12px; font-size: 23px; }
#museum-app .contact-guidelines { padding-inline-start: 25px; margin: 0; }
#museum-app .contact-guidelines li { padding-inline-start: 5px; margin-block: 12px; }
#museum-app .contact-email { margin-top: 30px; min-height: 58px; }
#museum-app [data-contact-address] { color: #713e36; font-family: 'Quintessential', serif; font-size: 24px; overflow-wrap: anywhere; }
#museum-app .contact-status { margin: 10px 0 0; }
#museum-app .museum-product[lang='ar'] .museum-contact { font-family: 'Amiri', serif; }
#museum-app .museum-product[lang='ar'] :is(.contact-title, .contact-guidelines-title) { font-family: 'Bahrain Museum Ruqaa', serif; }
#museum-app .museum-product[lang='ar'] [data-contact-email] { font: 18px/1.8 'Bahrain Museum Ruqaa', serif; }
#museum-app .museum-contact [hidden] { display: none; }
@media (max-width: 650px) {
  #museum-app .museum-contact { width: auto; margin: 10px 8px 25px; }
  #museum-app .contact-title { font-size: 27px; margin-top: 12px; }
  #museum-app .contact-intro, #museum-app .contact-guidelines { font-size: 18px; }
}
