/* Multimedia Gallery (inc/media-gallery.php). Navy glass, gold rule, serif titles, the four-box mark. */

.mg { display: grid; gap: 56px; }

/* ---------- showcase ---------- */
.mg-stage { position: relative; height: clamp(500px, 76vh, 700px); overflow: hidden; border-top: 6px solid var(--bb-gold); background: #061b44; color: #fff; box-shadow: 0 30px 70px rgba(6, 27, 68, .28); isolation: isolate; }
.mg-slides, .mg-slide { position: absolute; inset: 0; margin: 0; }
.mg-slide { opacity: 0; transition: opacity 1.1s ease; }
.mg-slide.is-active { opacity: 1; z-index: 1; }
.mg-slide img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; display: block; }
.mg-slide.is-active img { animation: mg-zoom 14s ease-out both; }
@keyframes mg-zoom { from { transform: scale(1.1); } to { transform: scale(1); } }
.mg-slide.is-portrait .mg-slide-blur { position: absolute; inset: -40px; background: center / cover; filter: blur(34px) brightness(.55); }
.mg-slide.is-portrait img { position: absolute; right: 6%; top: 6%; width: auto; max-width: 44%; height: 88%; object-fit: contain; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
.mg-shade { position: absolute; inset: 0; z-index: 2; background: linear-gradient(90deg, rgba(4, 22, 54, .92) 0%, rgba(6, 30, 70, .62) 42%, rgba(6, 30, 70, .06) 78%), linear-gradient(0deg, rgba(3, 14, 36, .92) 0%, rgba(3, 14, 36, 0) 42%); }
.mg-mark { position: absolute; z-index: 3; top: 28px; left: 40px; width: 42px; height: 50px; background: var(--boxes-light, none) center / contain no-repeat; }
.mg-copy { position: absolute; z-index: 3; left: 40px; bottom: 130px; max-width: min(860px, calc(100% - 80px)); }
.mg-eyebrow { display: inline-flex; align-items: center; gap: 12px; color: var(--bb-gold-2); font-size: 13px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.mg-eyebrow::before { content: ""; width: 34px; height: 3px; background: var(--bb-gold); }
.mg-index { margin: 14px 0 0; color: #c9d8ee; font: 700 14px Arial, sans-serif; letter-spacing: .12em; }
.mg-index b { color: var(--bb-gold-2); font: 700 28px Georgia, serif; letter-spacing: 0; }
.mg-title { margin: 4px 0 10px; color: #fff; font: 700 clamp(38px, 7.6vw, 112px)/.96 Georgia, "Times New Roman", serif; letter-spacing: -.012em; text-transform: uppercase; text-shadow: 0 6px 40px rgba(0, 0, 0, .45); overflow-wrap: anywhere; }
.mg-title::after { content: "."; color: var(--bb-gold); }
.mg-title.is-in { animation: mg-title-in .75s var(--bb-ease, cubic-bezier(.2, .7, .2, 1)) both; }
@keyframes mg-title-in { from { opacity: 0; transform: translateY(26px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0); } }
.mg-meta { margin: 0 0 22px; color: #d6e4f3; font-size: 16px; }
.mg-meta i { margin: 0 6px; color: var(--bb-gold-2); font-style: normal; }
.mg-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.mg-stage .bh-btn-ghost { border: 2px solid rgba(255, 255, 255, .6); background: transparent; color: #fff; cursor: pointer; }
.mg-stage .bh-btn-ghost:hover, .mg-stage .bh-btn-ghost:focus-visible { background: #fff; color: var(--bb-navy); }

.mg-arrow { position: absolute; z-index: 4; display: grid; place-items: center; width: 50px; height: 50px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 50%; background: rgba(6, 27, 68, .5); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; backdrop-filter: blur(6px); transition: background .15s, color .15s; }
.mg-arrow:hover, .mg-arrow:focus-visible { background: var(--bb-gold); border-color: var(--bb-gold); color: #0a2456; }
.mg-stage .mg-prev { right: 104px; bottom: 138px; }
.mg-stage .mg-next { right: 40px; bottom: 138px; }

.mg-rail { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; margin: 0; padding: 14px 40px 18px; list-style: none; overflow-x: auto; background: linear-gradient(0deg, rgba(3, 14, 36, .85), rgba(3, 14, 36, 0)); scrollbar-width: none; }
.mg-rail::-webkit-scrollbar { display: none; }
.mg-rail li { flex: none; margin: 0; }
.mg-rail button { position: relative; display: block; width: 96px; height: 64px; padding: 0; overflow: hidden; border: 2px solid rgba(255, 255, 255, .25); border-radius: 3px; background: #0a2c6b; cursor: pointer; opacity: .78; transition: opacity .2s, border-color .2s, transform .2s var(--bb-ease, ease); }
.mg-rail button:hover, .mg-rail button:focus-visible { opacity: 1; transform: translateY(-3px); }
.mg-rail button.is-active { opacity: 1; border-color: var(--bb-gold); }
.mg-rail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-rail-n { position: absolute; left: 5px; top: 3px; color: #fff; font: 800 12px Arial, sans-serif; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
.mg-prog { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--bb-gold); }
.mg-stage.is-running .mg-rail button.is-active .mg-prog { animation: mg-prog 6.5s linear forwards; }
@keyframes mg-prog { to { width: 100%; } }

/* ---------- categories ---------- */
.mg-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 8px; }
.mg-cat { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 2px; background: #0a2c6b; color: #fff; text-decoration: none; box-shadow: 0 12px 30px rgba(6, 27, 68, .14); }
.mg-cat img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--bb-ease, ease); }
.mg-cat::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(0deg, rgba(4, 22, 54, .92) 0%, rgba(4, 22, 54, .15) 62%); }
.mg-cat::after { content: ""; position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, var(--bb-sky), var(--bb-navy-1), var(--bb-gold)); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--bb-ease, ease); }
.mg-cat:hover img, .mg-cat:focus-visible img { transform: scale(1.07); }
.mg-cat:hover::after, .mg-cat:focus-visible::after { transform: scaleX(1); }
.mg-cat-body { position: absolute; z-index: 2; left: 18px; right: 18px; bottom: 16px; display: grid; gap: 2px; }
.mg-cat-body strong { font: 700 21px/1.15 Georgia, "Times New Roman", serif; }
.mg-cat-body small { color: var(--bb-gold-2); font-size: 12.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

/* ---------- library ---------- */
.mg-bar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin: 18px 0 14px; }
.mg-search { position: relative; flex: 1 1 320px; max-width: 520px; }
.mg-search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--bb-navy); pointer-events: none; }
.mg-search input { width: 100%; min-height: 50px; padding: 0 16px 0 44px; border: 1px solid #b9c8dc; border-radius: 4px; background: #fff; color: var(--bb-ink); font: 16px Arial, sans-serif; }
.mg-search input:focus { outline: 0; border-color: var(--bb-navy); box-shadow: 0 0 0 3px rgba(247, 194, 27, .55); }
.mg-view { display: flex; }
.mg-view button { min-height: 50px; padding: 0 18px; border: 1px solid var(--bb-navy); background: #fff; color: var(--bb-navy); font: 800 14px Arial, sans-serif; cursor: pointer; }
.mg-view button + button { border-left: 0; }
.mg-view button.is-active { background: var(--bb-navy); color: #fff; }
.mg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mg-chips button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid #c9d7e6; border-radius: 999px; background: #fff; color: var(--bb-navy); font: 800 14px Arial, sans-serif; cursor: pointer; transition: background .15s, border-color .15s; }
.mg-chips button:hover { border-color: var(--bb-navy); }
.mg-chips button b { padding: 1px 8px; border-radius: 999px; background: #eef4fa; font-size: 12px; }
.mg-chips button.is-active { border-color: var(--bb-gold); background: var(--bb-gold); color: #0a2456; }
.mg-chips button.is-active b { background: rgba(10, 36, 86, .14); }
.mg-count { margin: 10px 0 14px; color: var(--bb-muted); }
.mg-count strong { color: var(--bb-navy); font-size: 22px; }

.mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: 190px; grid-auto-flow: dense; gap: 12px; }
.mg-tile { position: relative; display: block; overflow: hidden; background: #dfe8f3; border-radius: 2px; }
.mg-tile[hidden] { display: none; }
.mg-tile.is-tall { grid-row: span 2; }
.mg-tile.is-wide { grid-column: span 2; grid-row: span 2; }
.mg-grid.is-uniform .mg-tile { grid-row: auto; grid-column: auto; }
.mg-tile img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; display: block; transition: transform .6s var(--bb-ease, ease), filter .3s; }
.mg-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(4, 22, 54, .88) 0%, rgba(4, 22, 54, 0) 55%); opacity: 0; transition: opacity .3s; }
.mg-tile:hover img, .mg-tile:focus-visible img { transform: scale(1.07); }
.mg-tile:hover::after, .mg-tile:focus-visible::after { opacity: 1; }
.mg-tile-cap { position: absolute; z-index: 2; left: 14px; right: 14px; bottom: 12px; display: grid; gap: 2px; color: #fff; opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s var(--bb-ease, ease); }
.mg-tile-cap b { font: 700 16px/1.25 Georgia, serif; }
.mg-tile-cap small { color: var(--bb-gold-2); font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mg-tile:hover .mg-tile-cap, .mg-tile:focus-visible .mg-tile-cap { opacity: 1; transform: none; }
.mg-tile-zoom { position: absolute; z-index: 2; top: 10px; right: 10px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--bb-gold); color: #0a2456; opacity: 0; transform: scale(.7); transition: opacity .25s, transform .25s var(--bb-ease, ease); }
.mg-tile:hover .mg-tile-zoom, .mg-tile:focus-visible .mg-tile-zoom { opacity: 1; transform: none; }
.mg-tile:focus-visible, .mg-cat:focus-visible { outline: 3px solid var(--bb-gold-2); outline-offset: 2px; }
.mg-more { margin: 22px 0 0; text-align: center; }
.mg-more[hidden], .mg-more:has([hidden]) { display: none; }
.mg-empty { padding: 30px; border: 1px dashed #9fb7d6; text-align: center; color: var(--bb-muted); }
.mg-empty[hidden] { display: none; }

/* ---------- viewer ---------- */
.mg-lb { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; border: 0; background: #03101f; color: #fff; }
.mg-lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.mg-lb::backdrop { background: #03101f; }
.mg-lb-top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 3px solid var(--bb-gold); background: rgba(255, 255, 255, .04); }
.mg-lb-title { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.mg-lb-title strong { font: 700 18px Georgia, serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-lb-title small { color: var(--bb-gold-2); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mg-lb-count { color: #c9d8ee; font-weight: 700; font-size: 14px; }
.mg-lb-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 50%; background: transparent; color: #fff; font-size: 16px; text-decoration: none; cursor: pointer; transition: background .15s, color .15s; }
.mg-lb-btn:hover, .mg-lb-btn:focus-visible, .mg-lb-btn.is-done, .mg-lb-btn[aria-pressed="true"] { background: var(--bb-gold); border-color: var(--bb-gold); color: #0a2456; }
.mg-lb-close { font-size: 28px; }
.mg-lb-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; padding: 10px 70px; }
.mg-lb-stage img { max-width: 100%; max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); object-fit: contain; box-shadow: 0 20px 70px rgba(0, 0, 0, .55); transition: opacity .25s; }
.mg-lb-stage img.is-loading { opacity: .35; }
.mg-lb .mg-prev { left: 14px; top: calc(50% - 25px); }
.mg-lb .mg-next { right: 14px; top: calc(50% - 25px); }
.mg-film { display: flex; gap: 6px; padding: 10px 18px 14px; overflow-x: auto; background: rgba(255, 255, 255, .04); scrollbar-width: thin; }
.mg-film button { flex: none; width: 84px; height: 56px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 3px; background: #0a2c6b; cursor: pointer; opacity: .55; transition: opacity .15s, border-color .15s; }
.mg-film button:hover { opacity: .9; }
.mg-film button.is-active { border-color: var(--bb-gold); opacity: 1; }
.mg-film img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .mg { gap: 40px; }
  .mg-stage { height: 560px; }
  .mg-copy { left: 22px; bottom: 118px; max-width: calc(100% - 44px); }
  .mg-mark { left: 22px; top: 20px; width: 34px; height: 41px; }
  .mg-stage .mg-prev, .mg-stage .mg-next { display: none; }
  .mg-rail { padding: 10px 22px 14px; }
  .mg-rail button { width: 76px; height: 52px; }
  .mg-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: 140px; gap: 8px; }
  .mg-tile.is-wide { grid-column: span 1; grid-row: span 1; }
  .mg-tile-cap, .mg-tile::after { opacity: 1; transform: none; }
  .mg-lb-stage { padding: 6px; }
  .mg-lb .mg-arrow { width: 40px; height: 40px; font-size: 24px; }
  .mg-lb-title strong { font-size: 15px; }
  .mg-lb-btn { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .mg-slide { transition: none; }
  .mg-slide.is-active img, .mg-title.is-in { animation: none; }
  .mg-tile img, .mg-cat img { transition: none; }
}
html.a11y-motion .mg-slide.is-active img, html.a11y-motion .mg-title.is-in { animation: none; }

/* ---------- legibility and fluid text (overrides) ---------- */
.mg-shade { background:
  linear-gradient(90deg, rgba(3, 16, 42, .96) 0%, rgba(4, 24, 58, .82) 38%, rgba(6, 30, 70, .28) 72%, rgba(6, 30, 70, 0) 100%),
  linear-gradient(0deg, rgba(3, 12, 32, .96) 0%, rgba(3, 12, 32, .55) 30%, rgba(3, 12, 32, 0) 58%); }
.mg-copy { max-width: min(900px, calc(100% - 80px)); text-shadow: 0 2px 18px rgba(0, 0, 0, .75); }
.mg-eyebrow { font-size: clamp(13px, 1.25vw, 16px); color: #ffe08a; }
.mg-index { font-size: clamp(14px, 1.2vw, 16px); color: #e6eefb; }
.mg-index b { font-size: clamp(26px, 2.6vw, 36px); }
.mg-title { font-size: clamp(34px, 6.4vw, 104px); line-height: 1; text-shadow: 0 4px 30px rgba(0, 0, 0, .8), 0 1px 2px rgba(0, 0, 0, .9); text-wrap: balance; hyphens: auto; }
.mg-title.is-long { font-size: clamp(30px, 4.6vw, 76px); }
.mg-meta { font-size: clamp(16px, 1.4vw, 19px); color: #fff; font-weight: 600; }
.mg-meta i { color: var(--bb-gold-2); }
.mg-actions .bh-btn { min-height: 52px; font-size: clamp(14px, 1.2vw, 16px); text-shadow: none; }
.mg-stage .bh-btn-ghost { background: rgba(3, 16, 42, .55); backdrop-filter: blur(4px); }
.mg-rail-n { font-size: 13px; text-shadow: 0 1px 8px #000, 0 0 3px #000; }

.mg-cat::before { background: linear-gradient(0deg, rgba(3, 12, 32, .96) 0%, rgba(3, 12, 32, .7) 38%, rgba(3, 12, 32, .05) 72%); }
.mg-cat-body strong { font-size: clamp(19px, 1.7vw, 24px); text-shadow: 0 2px 10px rgba(0, 0, 0, .7); }
.mg-cat-body small { font-size: 13px; color: #ffe08a; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }

.mg-tile::after { background: linear-gradient(0deg, rgba(3, 12, 32, .94) 0%, rgba(3, 12, 32, .55) 40%, rgba(3, 12, 32, 0) 70%); }
.mg-tile-cap b { font-size: clamp(15px, 1.3vw, 18px); text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }
.mg-tile-cap small { font-size: 12px; color: #ffe08a; }
.mg-chips button { font-size: clamp(13.5px, 1.1vw, 15px); }
.mg-count { font-size: 16px; }

/* Touch screens have no hover: captions are always shown, on a solid band. */
@media (hover: none), (max-width: 860px) {
  .mg-tile::after { opacity: 1; }
  .mg-tile-cap { opacity: 1; transform: none; left: 10px; right: 10px; bottom: 8px; }
  .mg-tile-cap b { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .mg-tile-cap small { font-size: 11px; }
  .mg-tile-zoom { display: none; }
}
@media (max-width: 860px) {
  .mg-stage { height: clamp(520px, 92vw + 160px, 640px); }
  .mg-copy { bottom: 112px; left: 20px; max-width: calc(100% - 40px); }
  .mg-title { font-size: clamp(30px, 10vw, 54px); }
  .mg-title.is-long { font-size: clamp(26px, 8.4vw, 44px); }
  .mg-eyebrow { font-size: 12.5px; letter-spacing: .16em; }
  .mg-meta { font-size: 15px; margin-bottom: 16px; }
  .mg-actions .bh-btn { flex: 1 1 140px; justify-content: center; padding: 0 16px; }
  .mg-cat-body strong { font-size: 18px; }
  .mg-cats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .mg-cat { aspect-ratio: 1 / 1; }
  .mg-cat-body { left: 12px; right: 12px; bottom: 12px; }
  .mg-lb-title strong { font-size: 16px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mg-lb-count { font-size: 13px; }
}
@media (max-width: 420px) {
  .mg-lb-top { gap: 6px; padding: 10px 12px; }
  .mg-lb-btn { width: 36px; height: 36px; }
  .mg-lb-count { display: none; }
}

/* Text must read over any photo: an even dark veil under the copy, stronger where the words sit. */
.mg-shade { background:
  linear-gradient(90deg, rgba(3, 16, 42, .92) 0%, rgba(4, 24, 58, .74) 45%, rgba(6, 30, 70, .34) 80%, rgba(6, 30, 70, .12) 100%),
  linear-gradient(0deg, rgba(3, 12, 32, .96) 0%, rgba(3, 12, 32, .6) 34%, rgba(3, 12, 32, .22) 66%, rgba(3, 12, 32, .3) 100%); }
@media (max-width: 860px) {
  .mg-shade { background: linear-gradient(0deg, rgba(3, 12, 32, .97) 0%, rgba(3, 12, 32, .88) 45%, rgba(3, 12, 32, .62) 100%); }
  .mg-slide img { object-position: center 20%; }
}
.mg-meta { text-shadow: 0 2px 12px rgba(0, 0, 0, .95), 0 0 2px rgba(0, 0, 0, .9); }
.mg-title { color: #fff; }

/* The page's body-text rule (.prose p) would turn these grey; set them explicitly. */
.mg .mg-stage .mg-title { color: #fff !important; margin-block: 4px 10px; }
.mg .mg-stage .mg-meta { color: #fff !important; }
.mg .mg-stage .mg-index { color: #e6eefb !important; }
.mg .mg-stage .mg-index b { color: var(--bb-gold-2) !important; }
.mg .mg-stage .mg-eyebrow { color: #ffe08a !important; }
.mg .mg-stage .mg-title::after { color: var(--bb-gold) !important; }
.mg .mg-cat-body strong, .mg .mg-tile-cap b, .mg .mg-lb-title strong { color: #fff; }
.mg .mg-cat-body small, .mg .mg-tile-cap small, .mg .mg-lb-title small { color: #ffe08a; }
