/* ==========================================================================
   Galerie – desktop: mřížka fotek, mobil: rozbalovací sekce, lightbox
   ========================================================================== */
.gallery-page {
    padding: clamp(28px, 6vw, 64px) var(--gutter) clamp(40px, 7vw, 80px);
    background:
        radial-gradient(90% 40% at 50% 0%, rgba(46, 125, 50, .08) 0%, transparent 70%),
        linear-gradient(180deg, #fff 0%, var(--c-50) 22%, var(--c-50) 100%);
}
.gallery-page > * {
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
}
.gallery-page h1 {
    text-align: center;
    color: var(--ink);
    margin-bottom: clamp(28px, 5vw, 52px);
    font-size: clamp(2rem, 5.5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}
.gallery-page h1::after {
    content: '';
    display: block;
    width: 56px;
    height: 4px;
    margin: 16px auto 0;
    border-radius: 4px;
    background: var(--c-600);
}

/* Jedna galerie */
.gallery-block {
    margin-bottom: clamp(14px, 3vw, 36px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
/* Hlavička – na mobilu tlačítko pro rozbalení */
.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 72px;
    padding: 18px 20px;
    background: none;
    border: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .2s var(--ease);
}
.gallery-header:focus-visible { outline-offset: -3px; border-radius: var(--radius-lg); }
.gallery-header-info { display: block; min-width: 0; }
.gallery-title {
    display: block;
    margin: 0 0 8px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.6vw, 1.5rem);
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.gallery-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 13.5px;
}
.gallery-header-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--c-50);
    border: 1px solid var(--line);
}
.gallery-toggle-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--c-100);
    color: var(--c-700);
    font-size: 13px;
    transition: transform .3s var(--ease), background-color .2s var(--ease);
}
.gallery-block.collapsed .gallery-toggle-icon { transform: rotate(-90deg); }

/* Popis */
.gallery-desc {
    padding: 0 20px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
    max-width: 80ch;
}

/* Mřížka fotek */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 12px 14px;
}
.gallery-grid-item {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: var(--c-100);
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}
.gallery-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s var(--ease), filter .3s var(--ease);
}
.gallery-grid-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
    background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .25) 100%);
    opacity: 0;
    transition: opacity .3s var(--ease);
    pointer-events: none;
}
.gallery-grid-item:hover img { transform: scale(1.05); }
.gallery-grid-item:hover::after { opacity: 1; }
.gallery-grid-item:focus-visible { outline-offset: 2px; }
.gallery-no-photos {
    padding: 20px 24px 28px;
    color: var(--muted);
    font-style: italic;
    text-align: center;
}

/* Mobil: sekce jsou sbalené */
@media (max-width: 768px) {
    .gallery-block.collapsed .gallery-grid,
    .gallery-block.collapsed .gallery-desc,
    .gallery-block.collapsed .gallery-no-photos { display: none; }
    .gallery-header:active { background: var(--c-50); }
    .gallery-block:not(.collapsed) .gallery-header { border-bottom: 1px solid var(--line); }
    .gallery-block:not(.collapsed) .gallery-toggle-icon { background: var(--c-600); color: #fff; }
}
@media (min-width: 560px) {
    .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px 16px 18px; }
}
/* Tablet a desktop: vždy rozbalené, bez šipky */
@media (min-width: 769px) {
    .gallery-block.collapsed .gallery-grid,
    .gallery-block.collapsed .gallery-desc,
    .gallery-block.collapsed .gallery-no-photos { display: block; }
    .gallery-block.collapsed .gallery-grid,
    .gallery-grid { display: grid; }
    .gallery-toggle-icon { display: none; }
    .gallery-header { cursor: default; padding: 24px 28px 8px; min-height: 0; }
    .gallery-desc { padding: 0 28px; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 16px 28px 28px; }
}

/* ---------- Lightbox ---------- */
.lb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 64px 12px;
    background: rgba(6, 14, 6, .94);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.lb-overlay.active { display: flex; }
@media (prefers-reduced-motion: no-preference) {
    .lb-overlay.active { animation: lb-fade .25s var(--ease); }
    .lb-overlay.active img { animation: lb-zoom .3s var(--ease); }
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-zoom { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.lb-overlay img {
    max-width: min(92vw, 1600px);
    max-height: calc(100vh - 128px);
    max-height: calc(100dvh - 128px);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    object-fit: contain;
}
.lb-close, .lb-nav {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .22); }
.lb-close:focus-visible, .lb-nav:focus-visible { outline-color: #fff; }
.lb-close { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.lb-nav { top: 50%; transform: translateY(-50%); font-size: 20px; }
.lb-prev { left: max(12px, env(safe-area-inset-left)); }
.lb-next { right: max(12px, env(safe-area-inset-right)); }
/* Na telefonu šipky dole, aby nezakrývaly fotku */
@media (max-width: 768px) {
    .lb-nav { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); transform: none; }
    .lb-prev { left: calc(50% - 64px); }
    .lb-next { right: calc(50% - 64px); }
}
@media (min-width: 769px) {
    .lb-overlay { padding: 48px 88px; }
    .lb-overlay img { max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); max-width: calc(100vw - 176px); }
    .lb-nav { width: 56px; height: 56px; }
}
