/* PÁLYÁZATI GALÉRIA – helyi albumok és kisméretű előnézeti képek. */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 22px;
  margin: 26px 0;
}

.album-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.album-card:hover {
  color: inherit;
  border-color: var(--brown);
}

.album-card img,
.album-card__empty {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #eee8db;
}

.album-card__empty {
  display: grid;
  place-items: center;
  font-size: 3rem;
  color: var(--brown);
}

.album-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  overflow-wrap: anywhere;
}

.album-card__body strong {
  font-size: 1.05rem;
}

.album-card__count {
  margin-top: auto;
  padding-top: 6px;
  font-size: 0.88rem;
}

/* A főgaléria egyetlen gyűjtőalbuma maradjon kis méretű kártya. */
.album-grid--compact {
  grid-template-columns: minmax(0, 1fr);
  max-width: 240px;
}

.album-grid--compact .album-card__body {
  gap: 8px;
  padding: 12px;
}

.album-grid--compact .album-card__body strong {
  font-size: 0.95rem;
}

.album-grid--compact .album-card__count {
  font-size: 0.8rem;
}

.gallery-summary {
  color: var(--brown);
  font-weight: 600;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(175px, 100%), 1fr));
  gap: 18px;
  margin: 26px 0;
}

.photo-grid figure {
  min-width: 0;
  margin: 0;
}

.photo-grid a {
  display: block;
  border: 1px solid var(--line);
  background: #eee8db;
  border-radius: 4px;
  overflow: hidden;
  cursor: zoom-in;
}

.photo-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.photo-grid figcaption {
  padding: 8px 2px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

/* A natív dialog elem a navigáció fölött jelenik meg, és bent tartja a fókuszt. */
.image-viewer-open {
  overflow: hidden;
}

.image-viewer:not([open]) {
  display: none;
}

.image-viewer {
  box-sizing: border-box;
  width: min(1200px, calc(100vw - 24px));
  max-width: none;
  height: min(900px, calc(100vh - 24px));
  height: min(900px, calc(100dvh - 24px));
  max-height: none;
  margin: auto;
  padding: 18px;
  color: #fff;
  background: #1c1a17;
  border: 1px solid #817665;
  border-radius: 8px;
}

.image-viewer::backdrop {
  background: rgb(0 0 0 / 85%);
}

.image-viewer__layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  height: 100%;
}

.image-viewer__toolbar,
.image-viewer__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.image-viewer h2 {
  margin: 0;
  color: inherit;
  font-size: 1rem;
  line-height: 1.4;
}

.image-viewer button,
.image-viewer a {
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  color: #fff;
  font: inherit;
  text-align: center;
  background: #302c27;
  border: 1px solid #9b8f7b;
  border-radius: 5px;
  cursor: pointer;
}

.image-viewer button:hover,
.image-viewer a:hover {
  color: #fff;
  background: #4a4236;
}

.image-viewer button:focus-visible,
.image-viewer a:focus-visible {
  outline: 3px solid #ffdf7e;
  outline-offset: 3px;
}

.image-viewer button:disabled {
  opacity: 0.35;
  cursor: default;
}

.image-viewer__stage {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  min-height: 0;
}

.image-viewer__stage button {
  padding: 0;
  font-size: 2.5rem;
  line-height: 1;
}

.image-viewer__picture {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.image-viewer__picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: pan-y pinch-zoom;
}

.image-viewer__status {
  position: absolute;
  inset: auto 0 0;
  margin: 0;
  padding: 10px;
  color: #fff;
  text-align: center;
  background: rgb(0 0 0 / 80%);
}

.image-viewer__footer p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.image-viewer__footer a {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.high-contrast .album-card,
.high-contrast .photo-grid a,
.high-contrast .image-viewer,
.high-contrast .image-viewer button,
.high-contrast .image-viewer a {
  color: #ffeb3b;
  background: #000;
  border-color: #ffeb3b;
}

@media (max-width: 600px) {
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .image-viewer {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    padding: 10px;
  }

  .image-viewer__stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 4px;
  }

  .image-viewer__toolbar {
    align-items: start;
    gap: 8px;
  }

  .image-viewer__toolbar button {
    flex-shrink: 0;
  }

  .image-viewer__footer {
    flex-wrap: wrap;
    gap: 6px;
  }
}
