/* The carousel inherits the original sanctuary arch; the viewer keeps full images. */
.bm-gallery { padding-bottom: 2rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
.bm-gallery [hidden], .bm-photo-viewer [hidden] { display: none !important; }
.bm-gallery__photos { display: grid; gap: 2rem; }
.bm-gallery__slide { margin: 0; min-width: 0; }
.bm-gallery__photo { display: flex; align-items: center; justify-content: center; background: var(--umber); outline-offset: 5px; touch-action: pan-y pinch-zoom; }
.bm-gallery__photo img { width: 100%; height: 100%; object-fit: cover; object-position: var(--bam-photo-position, 50% 25%); }
.bm-gallery__photo::after { pointer-events: none; }
.bm-gallery__slide figcaption { padding: 1rem 0 0.25rem; color: var(--text-inv); font-family: var(--f-display); font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.3rem); font-style: italic; }
.bm-gallery__controls { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.75rem; }
.bm-gallery__count { color: var(--text-inv-mute); font-size: 0.94rem; font-variant-numeric: tabular-nums; }
.bm-gallery__button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-width: 44px; min-height: 44px; padding: 0.55rem 0.75rem; border: 1px solid var(--line-inv); background: transparent; color: var(--text-inv); line-height: 1.2; font: inherit; font-size: 0.94rem; cursor: pointer; transition: color 180ms var(--ease-out), border-color 180ms var(--ease-out); }
.bm-gallery__button svg { flex: none; }
.bm-gallery__button:disabled { opacity: 0.45; cursor: default; }
.bm-gallery__thumbs { display: flex; justify-content: flex-start; justify-content: safe center; gap: 0.75rem; margin-top: 1.25rem; padding: 5px; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: var(--gold-soft) var(--umber); }
.bm-gallery__thumbs button { flex: 0 0 72px; height: 58px; min-width: 44px; padding: 3px; border: 1px solid transparent; background: transparent; cursor: pointer; opacity: 0.72; transition: opacity 180ms var(--ease-out), border-color 180ms var(--ease-out); }
.bm-gallery__thumbs button[aria-current="true"] { border-color: var(--gold-soft); opacity: 1; }
.bm-gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.bm-gallery__status, .bm-photo-viewer__status { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; min-height: 1.5rem; color: var(--text-inv-mute); font-size: 0.94rem; }
.bm-gallery__status { margin-top: 0.75rem; }
.bm-gallery__hint { margin-top: 0.85rem; color: var(--text-inv-mute); font-size: 0.94rem; }
.bm-gallery :focus-visible, .bm-photo-viewer :focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.bm-photo-viewer { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--ink); color: var(--text-inv); overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--gold-soft) var(--ink-2); }
.bm-photo-viewer::backdrop { background: var(--ink); }
.bm-photo-viewer[open] { display: block; }
.bm-photo-viewer__shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 0.75rem; height: 100%; min-height: 24rem; padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
.bm-photo-viewer__head, .bm-photo-viewer__foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.bm-photo-viewer__stage { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.bm-photo-viewer__stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bm-photo-viewer__stage[aria-busy="true"] img { visibility: hidden; }
.bm-photo-viewer__direct { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold-soft); text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-align: center; }
@media (hover: hover) { .bm-gallery__button:hover:not(:disabled) { color: var(--gold-soft); border-color: var(--gold-soft); } .bm-gallery__thumbs button:hover { opacity: 1; } .bm-photo-viewer__direct:hover { color: var(--text-inv); } }
@media (max-width: 540px) { .bm-gallery__thumbs { justify-content: flex-start; gap: 0.55rem; } .bm-gallery__thumbs button { flex-basis: 52px; height: 48px; } .bm-gallery__button { gap: 0.2rem; padding-inline: 0.5rem; font-size: 0.88rem; } .bm-photo-viewer__shell { padding-inline: max(0.75rem, env(safe-area-inset-left)); } .bm-photo-viewer__head, .bm-photo-viewer__foot { gap: 0.5rem; } .bm-photo-viewer__direct { font-size: 0.88rem; } }
@media (max-width: 700px) { .bm-gallery__photo img { object-position: var(--bam-photo-position-mobile, 50% 20%); } }
@media (prefers-reduced-motion: reduce) { .bm-gallery__button, .bm-gallery__thumbs button { transition: none; } }
