/* Prana Veda · the gallery (/galerie/, /en/gallery/; Tamina asked for one, 2026-11-06). Load after site.css and
   pages.css. Each theme is a run of justified rows: every photo keeps its own shape (--ar, its width over its height),
   the rows fill the width and the last one doesn't stretch. A photo opens in the viewer (/gallery.js): it grows out of
   the photo you pressed, slides to its neighbours, and shrinks back into place. Same tokens, the one radius (--r).
   Media rules at the END. */

/* the opening: the title and their own line, centred, before the bar */
.gal-open { padding-block: clamp(28px, 4vw, 56px) clamp(40px, 5vw, 64px); }
.gal-open .head { margin-bottom: 0; }
.gal-open h1 { font-size: clamp(2.4rem, 1.6rem + 3.2vw, 4rem); }
.gal-open .lede { text-wrap: pretty; }

/* the bar: eight themes; on narrow screens it scrolls sideways and keeps the current one in view (/gallery.js) */
.gal .jumpbar__in { max-width: min(100%, var(--max)); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.gal .jumpbar__in::-webkit-scrollbar { display: none; }
.gal-theme .head { margin-bottom: clamp(20px, 3vw, 32px); }

/* the rows: flex-wrap where each photo grows by its own shape, so every row ends flush and keeps every photo whole */
.gal-rows { --row: 240px; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gal-rows::after { content: ''; flex-grow: 1000000; } /* the last row keeps its natural size instead of stretching */
.gal-rows li { flex: var(--ar) 1 calc(var(--ar) * var(--row)); min-width: 0; }
.ph { position: relative; display: block; aspect-ratio: var(--ar); overflow: clip; border-radius: var(--r); background: var(--paper-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; transition: scale 700ms var(--ease), opacity 300ms var(--ease); }
.ph::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.04); pointer-events: none; }
.ph:hover img { scale: 1.035; }
.ph:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ph.is-away img { opacity: 0; } /* while its photo is open in the viewer, its place waits empty */

/* the viewer: a dark full-screen dialog; the photo, its words under it, the count, round glass buttons at the sides */
dialog.lb { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #f4efe6; overflow: hidden; }
dialog.lb::backdrop { background: rgb(14 12 8 / 0); transition: background 320ms var(--ease), overlay 320ms allow-discrete, display 320ms allow-discrete; }
dialog.lb.is-shown::backdrop { background: rgb(14 12 8 / 0.94); }
.lb__stage { position: absolute; inset: 0; display: grid; place-items: center; padding: 64px 88px 112px; touch-action: pan-y; }
.lb__frame { position: relative; transform-origin: 0 0; touch-action: none; }
.lb__img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--r); background: rgb(255 255 255 / 0.04) center / cover no-repeat; box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.8); user-select: none; -webkit-user-drag: none; }
html.lb-open { overflow: hidden; }
.lb__cap { position: absolute; left: 50%; bottom: 28px; display: grid; gap: 4px; justify-items: center; width: min(100% - 48px, 680px); margin: 0; text-align: center; translate: -50% 0; transition: opacity 260ms var(--ease); }
.lb__group { font: 500 0.76rem/1.4 var(--text); letter-spacing: 0.14em; text-transform: uppercase; color: #d8c293; }
.lb__text { font: 300 clamp(1rem, 0.95rem + 0.3vw, 1.15rem)/1.45 var(--text); color: rgb(244 239 230 / 0.9); text-wrap: balance; }
.lb__count { position: absolute; left: 24px; top: 22px; margin: 0; font: 500 0.88rem/1 var(--text); color: rgb(244 239 230 / 0.7); font-variant-numeric: tabular-nums; }
.lb__btn { position: absolute; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 999px; background: rgb(255 255 255 / 0.1); color: #fff; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.16); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); cursor: pointer; transition: background var(--t-quick) var(--ease), color var(--t-quick) var(--ease), opacity var(--t-quick) var(--ease); }
.lb__btn:hover { background: #fff; color: #1d1a10; }
.lb__btn .mark { width: 22px; height: 22px; }
.lb__btn--prev { left: 20px; top: 50%; margin-top: -40px; }
.lb__btn--next { right: 20px; top: 50%; margin-top: -40px; }
.lb__btn--close { right: 16px; top: 12px; width: 44px; height: 44px; }
.lb__btn:disabled { opacity: 0; pointer-events: none; }
.lb :is(.lb__btn, .lb__count, .lb__cap) { opacity: 0; }
.lb.is-shown :is(.lb__btn:not(:disabled), .lb__count, .lb__cap) { opacity: 1; }

/* ═══════════ Media rules ═══════════ */
@media (max-width: 900px) {
  .gal-rows { --row: 180px; gap: 6px; }
  .lb__stage { padding: 60px 12px 128px; }
  .lb__btn--prev, .lb__btn--next { top: auto; bottom: 20px; margin-top: 0; width: 44px; height: 44px; }
  .lb__btn--prev { left: 12px; } .lb__btn--next { right: 12px; }
  .lb__cap { bottom: 84px; }
}
@media (max-width: 520px) {
  .gal-rows { --row: 96px; gap: 4px; } /* two photos to a row on a phone */
  .lb__cap { bottom: 80px; width: calc(100% - 32px); }
}
@media (hover: none) {
  .ph:hover img { scale: 1; }
}
