/* ==========================================================
   SMART GALLERY OVERLAY 3.5.3
   ========================================================== */

.smart-gallery-wrapper,
.smart-gallery-page-wrapper {
    box-sizing: border-box;
}

.smart-gallery-wrapper *,
.smart-gallery-wrapper *::before,
.smart-gallery-wrapper *::after,
.smart-gallery-page-wrapper *,
.smart-gallery-page-wrapper *::before,
.smart-gallery-page-wrapper *::after {
    box-sizing: inherit;
}

[hidden] {
    display: none !important;
}

/* ==========================================================
   MOZAIKA V ČLÁNKU
   ========================================================== */

.smart-gallery-wrapper {
    width: 100%;
    scroll-margin-top: 80px;
}

.smart-gallery-grid {
    display: grid;
    grid-auto-rows: 110px;
    gap: 5px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.smart-gallery-cols-1 .smart-gallery-grid { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.smart-gallery-cols-2 .smart-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.smart-gallery-cols-3 .smart-gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.smart-gallery-cols-4 .smart-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.smart-gallery-cols-5 .smart-gallery-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.smart-gallery-cols-6 .smart-gallery-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.smart-gallery-cols-7 .smart-gallery-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.smart-gallery-cols-8 .smart-gallery-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.smart-gallery-cols-9 .smart-gallery-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); }

.smart-gallery-item {
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    grid-row: span var(--sg-row-span, 1);
}

/*
 * Některé šablony vynucují vlastní odrážky na <li> i přes list-style
 * nastavené na rodičovském <ul>. Resetujeme proto pouze položky Smart
 * Gallery, včetně markeru a případných dekorativních ::before prvků.
 */
.smart-gallery-wrapper .smart-gallery-grid > .smart-gallery-item,
.smart-gallery-page-wrapper .smart-gallery-page-bottom-thumbs > .smart-gallery-page-bottom-item {
    list-style: none !important;
}

.smart-gallery-wrapper .smart-gallery-grid > .smart-gallery-item::marker,
.smart-gallery-page-wrapper .smart-gallery-page-bottom-thumbs > .smart-gallery-page-bottom-item::marker {
    content: "" !important;
    font-size: 0 !important;
}

.smart-gallery-wrapper .smart-gallery-grid > .smart-gallery-item::before,
.smart-gallery-page-wrapper .smart-gallery-page-bottom-thumbs > .smart-gallery-page-bottom-item::before {
    content: none !important;
    display: none !important;
}

.smart-gallery-thumb {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 5px;
    background: #e8e8e8;
    text-decoration: none;
}

.smart-gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.22s ease;
}

.smart-gallery-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background 0.22s ease;
}

.smart-gallery-thumb:hover img,
.smart-gallery-thumb:focus-visible img {
    transform: scale(1.04);
}

.smart-gallery-thumb:hover::after {
    background: rgba(0, 0, 0, 0.12);
}

.smart-gallery-thumb:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

.smart-gallery-wrapper .smart-gallery-total-label {
    margin: 5px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    color: #999 !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    text-align: right !important;
}

.smart-gallery-total-icon {
    margin-right: 3px;
    opacity: 0.7;
}

.smart-gallery-error,
.smart-gallery-placeholder {
    color: #777;
    font-size: 13px;
    font-style: italic;
}

/* ==========================================================
   DETAIL FOTOGRAFIE
   ========================================================== */

.smart-gallery-page-wrapper {
    width: 100%;
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 10px;
}

.smart-gallery-anchor {
    height: 0;
    overflow: hidden;
    scroll-margin-top: 80px;
    outline: 0;
}

.smart-gallery-page-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: min(70vh, 760px);
    min-height: 320px;
    margin-bottom: 8px;
    overflow: hidden;
}

.smart-gallery-page-main-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.smart-gallery-zoom-button {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: zoom-in;
    font: inherit;
}

.smart-gallery-zoom-button:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 3px;
}

.smart-gallery-page-main-img {
    display: block;
    max-width: 100%;
    max-height: min(70vh, 760px);
    width: auto;
    height: auto;
    border-radius: 4px;
    object-fit: contain;
    transition: opacity 0.18s ease;
}

.smart-gallery-page-main-inner.is-loading .smart-gallery-page-main-img {
    opacity: 0.28;
}

.smart-gallery-page-main-inner.is-loading::before {
    content: '';
    position: absolute;
    z-index: 4;
    inset: 0;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.smart-gallery-page-main-inner.is-loading::after {
    content: '';
    position: absolute;
    z-index: 5;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-top-color: rgba(255, 255, 255, 0.98);
    border-radius: 50%;
    animation: smartGallerySpin 0.8s linear infinite;
    pointer-events: none;
}

@keyframes smartGallerySpin {
    to { transform: rotate(360deg); }
}

.smart-gallery-page-arrow {
    position: absolute;
    z-index: 6;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    text-decoration: none;
    transform: translateY(-50%);
    transition: background 0.18s ease;
    user-select: none;
}

.smart-gallery-page-prev { left: 8px; }
.smart-gallery-page-next { right: 8px; }

.smart-gallery-page-arrow:hover,
.smart-gallery-page-arrow:focus-visible {
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    text-decoration: none;
}

.smart-gallery-page-arrow:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.smart-gallery-page-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 6px 0 8px;
}

.smart-gallery-page-back {
    min-width: 0;
    font-size: 14px;
}

.smart-gallery-page-back a {
    color: #0073aa;
    text-decoration: none;
}

.smart-gallery-page-back a:hover,
.smart-gallery-page-back a:focus-visible {
    text-decoration: underline;
}

.smart-gallery-page-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

.smart-gallery-page-index {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
}

/* ==========================================================
   SPODNÍ NÁHLEDY
   ========================================================== */

.smart-gallery-page-bottom-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 5px;
    margin: 8px 0 0 !important;
    padding: 0 !important;
    list-style: none !important;
    /* Vlastní scrollovací oblast pro delší seznam náhledů. */
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.smart-gallery-page-bottom-item {
    min-width: 0;
    margin: 0;
    padding: 0;
}

.smart-gallery-page-bottom-thumb {
    display: block;
    border-radius: 3px;
    text-decoration: none;
}

.smart-gallery-page-bottom-thumb img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 3px;
    object-fit: cover;
    opacity: 0.62;
    transition: opacity 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.smart-gallery-page-bottom-thumb:hover img,
.smart-gallery-page-bottom-thumb:focus-visible img {
    opacity: 1;
    transform: scale(1.035);
}

.smart-gallery-page-bottom-thumb.is-active img {
    opacity: 1;
    box-shadow: 0 0 0 2px #0073aa;
}

.smart-gallery-page-bottom-thumb:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

/* ==========================================================
   INFO PANEL
   ========================================================== */

.smart-gallery-info-toggle {
    position: absolute;
    z-index: 7;
    left: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 17px;
    font-style: italic;
    line-height: 1;
}

.smart-gallery-info-toggle:hover,
.smart-gallery-info-toggle:focus-visible {
    background: rgba(0, 0, 0, 0.88);
}

.smart-gallery-info-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.smart-gallery-info-panel {
    position: absolute;
    z-index: 7;
    left: 10px;
    bottom: 50px;
    max-width: min(70%, 620px);
    padding: 10px 14px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.84);
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
}

.smart-gallery-info-title {
    margin-bottom: 4px;
    font-weight: 600;
}

.smart-gallery-info-text {
    font-weight: 400;
    white-space: pre-line;
}

/* ==========================================================
   LIGHTBOX
   ========================================================== */

body.smart-gallery-lightbox-open {
    overflow: hidden;
}

.smart-gallery-lightbox {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.94);
    cursor: zoom-out;
}

.smart-gallery-lightbox-dialog {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: default;
}

.smart-gallery-lightbox-img {
    display: block;
    max-width: 96vw;
    max-height: calc(100vh - 72px);
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 10px 45px rgba(0, 0, 0, 0.45);
}

.smart-gallery-lightbox-close,
.smart-gallery-lightbox-arrow {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

.smart-gallery-lightbox-close {
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 34px;
    font-weight: 300;
}

.smart-gallery-lightbox-arrow {
    top: 50%;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 28px;
    transform: translateY(-50%);
}

.smart-gallery-lightbox-prev { left: 0; }
.smart-gallery-lightbox-next { right: 0; }

.smart-gallery-lightbox-close:hover,
.smart-gallery-lightbox-close:focus-visible,
.smart-gallery-lightbox-arrow:hover,
.smart-gallery-lightbox-arrow:focus-visible {
    background: rgba(255, 255, 255, 0.18);
}

.smart-gallery-lightbox-close:focus-visible,
.smart-gallery-lightbox-arrow:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.smart-gallery-lightbox-caption {
    position: absolute;
    right: 60px;
    bottom: 0;
    left: 60px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 900px) {
    .smart-gallery-grid {
        grid-auto-rows: 96px;
    }
}

@media (max-width: 768px) {
    .smart-gallery-page-wrapper {
        margin: 12px auto;
        padding: 0 6px;
    }

    .smart-gallery-page-main {
        height: 62vw;
        min-height: 0;
        max-height: 70vh;
    }

    .smart-gallery-page-main-img {
        max-height: min(62vw, 70vh);
    }

    .smart-gallery-page-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }


    .smart-gallery-info-panel {
        max-width: 88%;
    }

    .smart-gallery-lightbox {
        padding: 12px;
    }

    .smart-gallery-lightbox-img {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 64px);
    }

    .smart-gallery-lightbox-arrow {
        width: 42px;
        height: 42px;
        font-size: 24px;
    }
}

@media (max-width: 600px) {
    .smart-gallery-grid {
        grid-auto-rows: 82px;
    }

    .smart-gallery-cols-3 .smart-gallery-grid,
    .smart-gallery-cols-4 .smart-gallery-grid,
    .smart-gallery-cols-5 .smart-gallery-grid,
    .smart-gallery-cols-6 .smart-gallery-grid,
    .smart-gallery-cols-7 .smart-gallery-grid,
    .smart-gallery-cols-8 .smart-gallery-grid,
    .smart-gallery-cols-9 .smart-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .smart-gallery-item {
        grid-row: span var(--sg-row-span-mobile, 1);
    }
}

@media (max-width: 480px) {
    .smart-gallery-page-main {
        height: 70vw;
    }

    .smart-gallery-page-main-img {
        max-height: 70vw;
    }

    .smart-gallery-page-arrow {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .smart-gallery-page-bottom-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    }

    .smart-gallery-lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 30px;
    }

    .smart-gallery-lightbox-arrow {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }

    .smart-gallery-lightbox-caption {
        right: 46px;
        left: 46px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .smart-gallery-thumb img,
    .smart-gallery-thumb::after,
    .smart-gallery-page-main-img,
    .smart-gallery-page-arrow,
    .smart-gallery-page-bottom-thumb img {
        transition: none;
    }

    .smart-gallery-page-main-inner.is-loading::after {
        animation-duration: 1.5s;
    }
}
