/* Galéria fotiek (partials/gallery.htm) – rozloženie podľa počtu fotiek */
.iofp-gallery { margin: 4rem 0 0; }
.iofp-gallery__heading { font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.2; margin: 0 0 1.5rem; }
.iofp-gallery__grid { --gap: 24px; --row: clamp(150px, 15vw, 240px); display: grid; gap: var(--gap); margin: 0; padding: 0; list-style: none; }
.iofp-gallery__item { min-width: 0; padding: 0; margin: 0; }
.iofp-gallery__item[hidden] { display: none; }
.iofp-gallery__link { position: relative; display: block; height: 100%; border-radius: 20px; overflow: hidden; background: #F9F9F9; box-shadow: 0 12px 40px rgba(24, 20, 51, .07); }
.iofp-gallery__link img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.iofp-gallery__link:focus-visible { outline: 2px solid #181433; outline-offset: 3px; }
@media (hover: hover) { .iofp-gallery__link:hover img { transform: scale(1.04); } }

/* 1 fotka – široká */
.iofp-gallery__grid--1 .iofp-gallery__link { aspect-ratio: 16 / 9; }
/* 2 a 4 fotky – vedľa seba / mriežka 2 × 2 */
.iofp-gallery__grid--2, .iofp-gallery__grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.iofp-gallery__grid--2 .iofp-gallery__link, .iofp-gallery__grid--4 .iofp-gallery__link { aspect-ratio: 4 / 3; }
/* 3 fotky – jedna veľká a dve menšie */
.iofp-gallery__grid--3 { grid-template-columns: 2fr 1fr; grid-auto-rows: var(--row); }
/* 5 a viac – jedna veľká a štyri menšie, ďalšie cez „+N“ */
.iofp-gallery__grid--5 { grid-template-columns: 2fr 1fr 1fr; grid-auto-rows: var(--row); }
.iofp-gallery__grid--3 > :first-child, .iofp-gallery__grid--5 > :first-child { grid-row: span 2; }

.iofp-gallery__more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(24, 20, 51, .55); color: #fff; font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; transition: background-color .3s; }
@media (hover: hover) { .iofp-gallery__link:hover .iofp-gallery__more { background: rgba(24, 20, 51, .7); } }

@media (max-width: 991px) {
    .iofp-gallery__grid { --gap: 16px; }
}
@media (max-width: 767px) {
    .iofp-gallery { margin-top: 2.5rem; }
    .iofp-gallery__grid { --row: 140px; }
    .iofp-gallery__grid--3, .iofp-gallery__grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .iofp-gallery__grid--3 > :first-child, .iofp-gallery__grid--5 > :first-child { grid-column: span 2; grid-row: span 1; height: 220px; }
    .iofp-gallery__link { border-radius: 16px; }
}

/* Zväčšenie na celú obrazovku */
.iofp-lightbox { position: fixed; inset: 0; z-index: 2147483647; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(12, 10, 26, .97); color: #fff; }
.iofp-lightbox::backdrop { background: transparent; }
/* Bootstrap reboot dáva dialogu display:block – zatvorený musí zmiznúť (inak „sa nedá zavrieť“) */
.iofp-lightbox:not([open]) { display: none; }
.iofp-lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.iofp-lightbox__figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 1rem; max-width: calc(100vw - 8rem); }
.iofp-lightbox__img { max-width: 100%; max-height: calc(100vh - 9rem); width: auto; height: auto; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); user-select: none; }
.iofp-lightbox__caption { font-size: .9375rem; line-height: 1.5; color: rgba(255, 255, 255, .85); text-align: center; min-height: 1.5em; }
.iofp-lightbox__btn { position: absolute; display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; transition: background-color .2s; }
.iofp-lightbox__btn:hover { background: rgba(255, 255, 255, .2); }
.iofp-lightbox__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.iofp-lightbox__btn svg { width: 22px; height: 22px; }
.iofp-lightbox__close { top: max(1.25rem, env(safe-area-inset-top)); right: 1.25rem; }
.iofp-lightbox__prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.iofp-lightbox__next { right: 1.25rem; top: 50%; transform: translateY(-50%); }
.iofp-lightbox__count { position: absolute; top: max(1.6rem, env(safe-area-inset-top)); left: 1.5rem; font-size: .9375rem; font-weight: 600; color: rgba(255, 255, 255, .8); font-variant-numeric: tabular-nums; }
.iofp-lightbox--single .iofp-lightbox__prev, .iofp-lightbox--single .iofp-lightbox__next, .iofp-lightbox--single .iofp-lightbox__count { display: none; }
@media (max-width: 767px) {
    .iofp-lightbox__figure { max-width: 100vw; padding: 0 .75rem; }
    .iofp-lightbox__img { max-height: calc(100vh - 11rem); border-radius: 8px; }
    .iofp-lightbox__prev, .iofp-lightbox__next { top: auto; bottom: max(1.25rem, env(safe-area-inset-bottom)); transform: none; }
    .iofp-lightbox__prev { left: calc(50% - 64px); }
    .iofp-lightbox__next { right: calc(50% - 64px); }
}
body.iofp-lightbox-open { overflow: hidden; }
/* Poistka pre prehliadače, kde <dialog> nie je nad všetkým (top layer) – fixná hlavička webu ho nesmie prekryť */
body.iofp-lightbox-open > header, body.iofp-lightbox-open .navbar, body.iofp-lightbox-open #gdpr-reload { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .iofp-gallery__link img { transition: none; } }
