/* /galeri/ — album chips, masonry grid (JS row spans), accessible lightbox — content agent. */

/* ---------- Album chips ---------- */
.album-bar {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 760px) {
  .album-bar { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; }
}
.album-bar__label {
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.album-chips { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 759px) {
  .album-bar { padding-inline: 0; overflow: hidden; }
  .album-bar__label { padding-inline: 16px; }
  /* One swipeable row instead of a tall stack of chips */
  .album-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 16px 4px;
    scroll-padding-inline: 16px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .album-chips::-webkit-scrollbar { display: none; }
  .album-chip { flex: none; scroll-snap-align: start; }
}
.album-chip.chip { gap: .55rem; min-height: 44px; padding: 4px 14px 4px 4px; }
.album-chip--all.chip { padding-left: 14px; }
.album-chip__thumb {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--cream-200);
  box-shadow: 0 0 0 2px var(--surface);
}
.album-chip[aria-pressed="true"] .album-chip__thumb { box-shadow: 0 0 0 2px var(--brass-300); }
.album-chip__name { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Masonry grid ---------- */
.gallery-grid {
  --gap: clamp(10px, .5rem + .6vw, 16px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 8px;
  gap: var(--gap);
  margin-top: 4px;
}
@media (min-width: 700px) { .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.gallery-grid--empty { display: block; }

.gallery-skel { grid-row-end: span 30; height: 100%; min-height: 0; border-radius: var(--radius); }
.gallery-skel:nth-child(3n + 2) { grid-row-end: span 38; }
.gallery-skel:nth-child(4n + 3) { grid-row-end: span 24; }

.gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--cream-200);
  box-shadow: var(--shadow-sm);
  isolation: isolate;
  grid-row-end: span 26;
  animation: card-in .55s var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 12) * 40ms);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s var(--ease), opacity .4s var(--ease);
}
.gallery-item img:not(.is-loaded) { opacity: 0; }
.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(0, 10, 26, .78) 0%, rgba(0, 10, 26, .1) 45%, transparent 70%);
  opacity: 0;
  transition: opacity .35s var(--ease);
}
.gallery-item__overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  color: var(--cream-50);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.gallery-item__caption {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.4;
}
.gallery-item__zoom {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border-radius: 50%;
  background: rgba(253, 250, 247, .16);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.gallery-item__zoom .icon { width: 17px; height: 17px; }
.gallery-item:hover img, .gallery-item:focus-visible img { transform: scale(1.04); }
.gallery-item:hover::after, .gallery-item:focus-visible::after,
.gallery-item:hover .gallery-item__overlay, .gallery-item:focus-visible .gallery-item__overlay { opacity: 1; transform: none; }
.gallery-item:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
@media (hover: none) {
  .gallery-item__overlay { display: none; }
}

.gallery-more { display: grid; justify-items: center; gap: .6rem; margin-top: clamp(28px, 1.5rem + 1.5vw, 44px); }
.gallery-more__note { margin: 0; font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- Lightbox ---------- */
dialog.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 6, 16, .96);
  color: var(--cream-100);
  overflow: hidden;
}
dialog.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: lb-in .25s var(--ease); }
dialog.lightbox::backdrop { background: rgba(0, 6, 16, .9); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(10px, env(safe-area-inset-top)) clamp(12px, 3vw, 28px) 10px;
}
.lightbox__title {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  min-width: 0;
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--cream-100);
}
.lightbox__title [data-lb-album] { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lightbox__counter { flex: none; font-variant-numeric: tabular-nums; color: var(--brass-300); }
.lightbox__btn, .lightbox__nav {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(244, 229, 222, .22);
  border-radius: 50%;
  background: rgba(253, 250, 247, .06);
  color: var(--cream-50);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.lightbox__btn:hover, .lightbox__nav:hover { border-color: var(--brass-300); background: rgba(253, 250, 247, .14); }
.lightbox__btn:focus-visible, .lightbox__nav:focus-visible { outline: 2.5px solid var(--brass-300); outline-offset: 3px; }
.lightbox__btn .icon, .lightbox__nav .icon { width: 22px; height: 22px; }
.lightbox__nav:disabled { opacity: .3; cursor: default; }
.lightbox__stage {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
  min-height: 0;
  overflow: hidden;
  padding: 0 clamp(8px, 2vw, 24px);
  touch-action: pan-y pinch-zoom;
}
.lightbox__figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  height: 100%;
  min-height: 0;
  margin: 0;
}
.lightbox__frame {
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity .25s var(--ease);
}
.lightbox__img.is-loading { opacity: .25; }
.lightbox__spinner { position: absolute; }
.lightbox__caption {
  max-width: 70ch;
  min-height: 1.5em;
  margin: 0;
  padding: 14px 8px 4px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: rgba(248, 241, 235, .9);
  text-align: center;
}
.lightbox__hint {
  margin: 0;
  padding: 6px 16px max(12px, env(safe-area-inset-bottom));
  font-size: .75rem;
  color: rgba(248, 241, 235, .55);
  text-align: center;
}
@media (max-width: 699px) {
  .lightbox__stage { grid-template-columns: minmax(0, 1fr); padding: 0 6px; }
  .lightbox__nav { position: absolute; bottom: 4px; z-index: 2; width: 44px; height: 44px; background: rgba(0, 6, 16, .6); }
  .lightbox__nav--prev { left: 10px; }
  .lightbox__nav--next { right: 10px; }
  .lightbox__caption { padding: 12px 64px 8px; }
  .lightbox__hint { display: none; }
}
