/*
 * What every design's gallery shares: the viewer a picture opens in, and the
 * fallback layout. Each design draws its own grid over this in its own file.
 * Colours come from the clinic's palette; the viewer is deliberately neutral
 * dark, as any viewer is, so a photograph is judged on its own.
 */
.g-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.g-item { margin: 0; min-width: 0; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; }
.g-open { all: unset; box-sizing: border-box; display: block; position: relative; width: 100%; height: 100%; cursor: zoom-in; overflow: hidden; border-radius: inherit; }
.g-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.8,.2,1), filter .4s; }
.g-open:hover img { transform: scale(1.05); }
.g-open:focus-visible { outline: 3px solid var(--clinic-500, #14b8a6); outline-offset: 3px; }
.g-cap { position: absolute; inset-inline: 0; bottom: 0; padding: 26px 14px 12px; font-size: 13.5px; line-height: 1.4; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.66), transparent); text-align: start; pointer-events: none; }

/* A way along a strip of photographs, where a design lays them out sideways. */
.g-nav { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.g-nav button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid currentColor; background: transparent; color: inherit; font: 700 22px/1 system-ui, sans-serif; cursor: pointer; opacity: .75; transition: opacity .2s, background .2s; }
.g-nav button:hover { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }
[dir="rtl"] .g-nav button { transform: scaleX(-1); }

/* ------------------------------------------------------------------ viewer */
.g-viewer { position: fixed; inset: 0; z-index: 2147482000; display: none; align-items: center; justify-content: center;
  background: rgba(6, 9, 12, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); touch-action: pan-y; }
.g-viewer.open { display: flex; animation: g-fade .25s ease both; }
.g-viewer figure { margin: 0; max-width: min(1200px, 94vw); max-height: 90vh; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.g-viewer img { max-width: 100%; max-height: 80vh; border-radius: 10px; box-shadow: 0 40px 90px -20px rgba(0,0,0,.8); animation: g-pop .35s cubic-bezier(.2,.8,.2,1) both; }
.g-viewer figcaption { color: #f1f5f9; font: 500 15px/1.5 system-ui, sans-serif; text-align: center; max-width: 70ch; min-height: 1.5em; }
.g-viewer button { position: absolute; border: 0; cursor: pointer; width: 46px; height: 46px; border-radius: 50%; font: 700 22px/1 system-ui, sans-serif;
  color: #fff; background: rgba(255,255,255,.14); transition: background .2s, transform .2s; }
.g-viewer button:hover { background: rgba(255,255,255,.28); }
.g-viewer button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.g-close { top: 16px; inset-inline-end: 16px; }
.g-prev { inset-inline-start: 14px; top: 50%; margin-top: -23px; }
.g-next { inset-inline-end: 14px; top: 50%; margin-top: -23px; }
[dir="rtl"] .g-prev, [dir="rtl"] .g-next { transform: scaleX(-1); }
.g-count { position: absolute; top: 24px; inset-inline-start: 20px; color: rgba(255,255,255,.7); font: 600 13px/1 system-ui, sans-serif; }
body.g-locked { overflow: hidden; }
@keyframes g-fade { from { opacity: 0; } }
@keyframes g-pop { from { opacity: 0; transform: scale(.94); } }
@media (max-width: 560px) { .g-prev, .g-next { top: auto; bottom: 18px; margin: 0; } .g-viewer img { max-height: 70vh; } }
@media (prefers-reduced-motion: reduce) { .g-open img, .g-viewer img, .g-viewer.open { animation: none; transition: none; } }

/* ------------------------------------------------------------------ classic */
.gallery.panel .g-grid { gap: 16px; grid-auto-flow: dense; }
.gallery.panel .g-item { border-radius: 20px; box-shadow: 0 1px 2px rgba(13,17,23,.05), 0 18px 36px -20px rgba(13,17,23,.35); border: 1px solid var(--line, #e7ecec); }
.gallery.panel .g-item:nth-child(7n+1) { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.gallery.panel .g-open:hover img { transform: scale(1.06); }
@media (max-width: 560px) { .gallery.panel .g-item:nth-child(7n+1) { grid-column: auto; grid-row: auto; aspect-ratio: 4 / 3; } }
