/* SOUL gallery: justified photo grid, home mosaic and the full-screen zoom viewer. */

/* ── Gallery page hero ─────────────────────────────── */
.gal-hero { position: relative; overflow: hidden; isolation: isolate; padding: clamp(80px, 11vw, 150px) 0 clamp(60px, 8vw, 100px); background: var(--emerald-2); color: var(--ivory); }
.gal-hero__bg { position: absolute; inset: 0; z-index: -1; display: grid; grid-template-columns: 1fr 1.3fr 1fr; }
.gal-hero__bg span { background-size: cover; background-position: center; filter: saturate(.85); opacity: .32; }
.gal-hero__bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(9,61,48,.72) 0%, rgba(9,61,48,.92) 70%); }
.gal-hero h1 { color: var(--ivory); font-size: clamp(2.6rem, 6vw, 4.6rem); }
.gal-hero .eyebrow { color: var(--gold-soft); }
.gal-hero .lead { color: #E4DCC8; }
.gal-hero__in { position: relative; }
.gal-facts { list-style: none; margin: 8px 0 0; padding: 0; display: flex; justify-content: center; gap: clamp(24px, 6vw, 72px); }
.gal-facts li { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gal-facts b { font: 600 clamp(1.8rem, 3.6vw, 2.6rem)/1 var(--serif); color: var(--gold-soft); }
.gal-facts span { font: 500 .7rem/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: #E4DCC8; }

/* ── Justified grid: each photo grows by its aspect ratio so rows line up edge to edge ── */
.gal-sec { padding-top: clamp(48px, 6vw, 80px); }
.gal-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.gal-item { margin: 0; flex-grow: calc(var(--r) * 100); flex-basis: calc(var(--r) * 200px); position: relative; }
.gal-fill { flex-grow: 1000; }
.gal-btn { display: block; width: 100%; padding: 0; border: 0; background: var(--ivory-2); cursor: zoom-in; position: relative; overflow: hidden;
  aspect-ratio: var(--r); border-radius: 6px; box-shadow: 0 10px 24px -18px rgba(31,27,22,.6); }
.gal-btn img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1), filter .4s; }
.gal-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9,61,48,0) 55%, rgba(9,61,48,.55)); opacity: 0; transition: opacity .35s; }
.gal-item figcaption { position: absolute; left: 16px; right: 56px; bottom: 14px; z-index: 2; color: #FBF6EA; font: italic 500 1.05rem/1.3 var(--serif);
  opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; pointer-events: none; text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.gal-zoom { position: absolute; z-index: 2; right: 12px; bottom: 12px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(251,248,240,.92); color: var(--emerald); opacity: 0; transform: scale(.8); transition: opacity .3s, transform .3s; }
.gal-zoom svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.gal-btn:hover img, .gal-btn:focus-visible img { transform: scale(1.06); }
.gal-btn:hover::after, .gal-btn:focus-visible::after,
.gal-item:hover figcaption, .gal-item:focus-within figcaption { opacity: 1; transform: none; }
.gal-btn:hover .gal-zoom, .gal-btn:focus-visible .gal-zoom { opacity: 1; transform: none; }
@media (max-width: 640px) {
  .gal-grid { gap: 8px; }
  .gal-item { flex-basis: calc(var(--r) * 110px); }
  .gal-item figcaption { display: none; }
  .gal-zoom { opacity: 1; transform: none; width: 30px; height: 30px; right: 8px; bottom: 8px; }
}

/* ── Home mosaic ───────────────────────────────────── */
.gal-home { position: relative; padding: clamp(64px, 9vw, 120px) 0; background: var(--emerald-2); color: var(--ivory); overflow: hidden; isolation: isolate; }
.gal-home::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .08;
  background-image: radial-gradient(circle at 1px 1px, var(--gold-soft) 1px, transparent 0); background-size: 26px 26px; }
.gal-home__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 36px; }
.gal-home__head h2 { color: var(--ivory); margin: 0; }
.gal-home .sec-eyebrow { color: var(--gold-soft); }
.gal-home .sec-eyebrow::after { display: none; }
.gal-home .textlink { color: var(--ivory); border-bottom-color: var(--gold-soft); }
.gal-mosaic { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: clamp(150px, 16vw, 220px); grid-auto-flow: dense; gap: 12px; }
.gm-tile { position: relative; overflow: hidden; border: 0; padding: 0; margin: 0; background: #0C3328; cursor: zoom-in; border-radius: 8px; display: block; text-decoration: none; }
.gm-big { grid-column: span 2; grid-row: span 2; }
.gm-tall { grid-row: span 2; }
.gm-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s cubic-bezier(.2,.7,.2,1); }
.gm-tile::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,30,24,0) 50%, rgba(5,30,24,.75)); opacity: .55; transition: opacity .4s; }
.gm-cap { position: absolute; z-index: 2; left: 16px; right: 60px; bottom: 14px; text-align: left; color: #FBF6EA; font: italic 500 1rem/1.3 var(--serif);
  opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; }
.gm-big .gm-cap { font-size: 1.3rem; opacity: 1; transform: none; }
.gm-tile:hover img, .gm-tile:focus-visible img { transform: scale(1.07); }
.gm-tile:hover::after { opacity: 1; }
.gm-tile:hover .gm-cap, .gm-tile:focus-visible .gm-cap { opacity: 1; transform: none; }
.gm-tile:hover .gal-zoom, .gm-tile:focus-visible .gal-zoom { opacity: 1; transform: none; }
.gm-tile:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.gm-more { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; text-align: center; cursor: pointer;
  background: transparent; border: 1px solid var(--gold); color: var(--ivory); transition: background .3s; }
.gm-more::after { display: none; }
.gm-more:hover { background: rgba(217,196,158,.1); color: var(--ivory); }
.gm-more__n { font: 600 clamp(2.6rem, 4vw, 3.6rem)/1 var(--serif); color: var(--gold-soft); }
.gm-more__t { font-size: .85rem; letter-spacing: .08em; color: #E4DCC8; line-height: 1.4; }
.gm-more__go { margin-top: 6px; font: 500 .72rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; border-bottom: 1px solid var(--gold-soft); padding-bottom: 5px; }
@media (max-width: 760px) {
  .gal-mosaic { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 42vw; gap: 8px; }
  .gm-cap { display: none; }
  .gm-big .gm-cap { display: block; font-size: 1.05rem; }
}

/* ── Viewer ────────────────────────────────────────── */
.glb { position: fixed; inset: 0; z-index: 1000; background: rgba(8,14,11,.96); color: #F4EEDF; display: flex; flex-direction: column; animation: glb-in .25s ease; }
.glb[hidden] { display: none; }
html.glb-open { overflow: hidden; }
.glb-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; position: relative; z-index: 3; }
.glb-count { margin: 0; font: 500 .78rem/1 var(--sans); letter-spacing: .2em; color: #CFC6B0; }
.glb-tools { display: flex; align-items: center; gap: 6px; }
.glb-zoom { min-width: 52px; text-align: center; font: 500 .78rem var(--sans); color: #CFC6B0; }
.glb-btn, .glb-nav { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(217,196,158,.3); background: rgba(255,255,255,.04);
  color: #F4EEDF; cursor: pointer; transition: background .2s, border-color .2s; }
.glb-btn:hover, .glb-nav:hover { background: rgba(217,196,158,.18); border-color: var(--gold-soft); }
.glb-btn svg, .glb-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.glb-close { margin-left: 8px; }
.glb-stage { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: zoom-in; user-select: none; }
.glb-stage.is-zoomed { cursor: grab; } .glb-stage.is-dragging { cursor: grabbing; }
.glb-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; opacity: 0; transition: opacity .3s; }
.glb-img.is-ready { opacity: 1; }
.glb-stage.is-anim .glb-img { transition: transform .28s cubic-bezier(.2,.7,.2,1), opacity .3s; }
.glb-spin { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px; border-radius: 50%; border: 2px solid rgba(217,196,158,.25); border-top-color: var(--gold-soft); animation: lb-spin 0.9s linear infinite; }
.glb-nav { position: absolute; top: 50%; margin-top: -26px; width: 52px; height: 52px; z-index: 3; }
.glb-prev { left: 16px; } .glb-next { right: 16px; }
.glb-bottom { padding: 10px 18px 16px; text-align: center; position: relative; z-index: 3; }
.glb-caption { margin: 0 0 4px; font: italic 500 1.2rem/1.3 var(--serif); min-height: 1.3em; }
.glb-hint { margin: 0 0 12px; font-size: .74rem; color: #9C9482; letter-spacing: .04em; }
.glb-strip { display: flex; gap: 8px; overflow-x: auto; justify-content: safe center; padding: 4px 2px; scrollbar-width: none; }
.glb-strip::-webkit-scrollbar { display: none; }
.glb-strip button { flex: none; width: 64px; height: 46px; padding: 0; border: 2px solid transparent; border-radius: 4px; overflow: hidden; background: #222; cursor: pointer; opacity: .5; transition: opacity .2s, border-color .2s; }
.glb-strip button img { width: 100%; height: 100%; object-fit: cover; }
.glb-strip button:hover { opacity: .85; }
.glb-strip button[aria-current="true"] { opacity: 1; border-color: var(--gold-soft); }
@media (max-width: 640px) {
  .glb-nav { display: none; }
  .glb-zoom, .glb-hint { display: none; }
  .glb-btn { width: 40px; height: 40px; }
  .glb-strip button { width: 50px; height: 38px; }
}
@keyframes glb-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gal-btn img, .gm-tile img, .glb, .glb-stage.is-anim .glb-img { transition: none; animation: none; } }
