/* Hlavní obsah na stránce portfolia */
.portfolio-page-main {
    padding-top: 100px;
    padding-bottom: 100px; /* Mezera zespodu */
    background-color: var(--bg-color-light); 
    color: var(--text-color-dark);
}

.portfolio-page-main .page-section {
    padding-top: 40px;
}

.portfolio-page-main .portfolio-text h2 {
    text-align: center;
    font-size: 3.2rem; 
    margin-bottom: 40px; 
}

/* Styly pro filtrovací tlačítka */
.filter-buttons {
    text-align: center;
    margin-bottom: 40px;
}

.filter-btn {
    background: none;
    border: none; 
    color: #555;
    padding: 10px 15px; 
    margin: 5px;
    cursor: pointer;
    font-size: 1rem; 
    font-weight: 700; 
    text-transform: uppercase;
    transition: all 0.3s ease;
    text-decoration: none;
}

.filter-btn:hover {
    background-color: transparent; 
    color: #555; 
    text-decoration: none; 
}

.filter-btn.active {
    background-color: transparent; 
    color: var(--gold-color); 
    border: none; 
    text-decoration: underline; 
    text-underline-offset: 10px;
}

.filter-btn.active:hover {
    color: var(--gold-color);
    text-decoration: underline;
    text-underline-offset: 10px;
}

/* --- MŘÍŽKA PRO FOTKY (MASONRY) --- */
.gallery-grid {
    position: relative; 
    display: block;     
    width: 100%;
    margin-bottom: 20px; 
}

.gallery-item {
    position: absolute; /* JS určuje pozici */
    top: 0;
    left: 0;
    margin: 0; 
    
    /* --- OPRAVA PROTI BÍLÝM PRUHŮM --- */
    height: auto !important;      /* Musí se přizpůsobit obrázku */
    min-height: auto !important;  /* Zrušíme minimální výšku */
    background: transparent !important; /* Zrušíme bílé pozadí */
    border: none !important;      /* Zrušíme rámeček */
    padding: 0 !important;        /* Zrušíme vnitřní odsazení */
    /* -------------------------------- */

    transition: top 0.3s ease, left 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; 
    border-radius: 4px; 
    overflow: visible; 
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto; /* Obrázek určuje výšku */
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.gallery-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    z-index: 10; 
}

.gallery-item::before,
.gallery-item:hover::before {
    background: none;
}

/* Responzivita pro filtry */
@media (max-width: 768px) {
    .filter-buttons-wrapper {
        position: relative; 
        margin: 0 -15px; 
    }

    .filter-buttons {
        display: flex;
        overflow-x: auto;
        white-space: nowrap; 
        justify-content: flex-start; 
        -webkit-overflow-scrolling: touch; 
        scrollbar-width: none; 
        padding-bottom: 15px; 
        padding-left: 15px; 
        padding-right: 15px; 
    }

    .filter-buttons-wrapper::before,
    .filter-buttons-wrapper::after {
        content: '';
        position: absolute;
        top: 0;
        height: calc(100% - 15px); 
        pointer-events: none; 
        transition: opacity 0.3s ease;
    }

    .filter-buttons-wrapper::after {
        right: 0; 
        width: 90px; 
        background: linear-gradient(to left, var(--bg-color-light) 30%, transparent);
        opacity: 0; 
    }

    .filter-buttons-wrapper::before {
        left: 0;
        width: 40px;
        background: linear-gradient(to right, var(--bg-color-light) 30%, transparent);
        opacity: 0; 
    }
    .filter-buttons-wrapper.is-scrollable-right::after { opacity: 1; }
    .filter-buttons-wrapper.is-scrollable-left::before { opacity: 1; }

    .filter-buttons::-webkit-scrollbar {
        display: none; 
    }
}

/* === STYLY PRO LIGHTBOX === */
.gallery-item a {
    display: block;
    line-height: 0; 
    position: relative;
    z-index: 2;
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color-light); 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease; 
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto; 
    padding: 40px; 
    box-sizing: border-box;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.lightbox-img.slide-out-left { animation: slideOutLeft 0.3s ease-out forwards; }
.lightbox-img.slide-out-right { animation: slideOutRight 0.3s ease-out forwards; }
.lightbox-img.slide-in-from-right { animation: slideInFromRight 0.3s ease-in forwards; }
.lightbox-img.slide-in-from-left { animation: slideInFromLeft 0.3s ease-in forwards; }

@keyframes slideOutLeft { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-100px); opacity: 0; } }
@keyframes slideInFromRight { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100px); opacity: 0; } }
@keyframes slideInFromLeft { from { transform: translateX(-100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.lightbox-img.zoomed {
    transform: scale(2); 
    cursor: zoom-out;
}

.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    color: #333; 
    border: none;
    font-size: 2.5rem; 
    cursor: pointer;
    padding: 25vh 5vw; 
    user-select: none;
    transition: color 0.3s ease; 
    z-index: 1001;
}

.lightbox-prev:hover, .lightbox-next:hover { color: var(--gold-color); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #333; 
    font-size: 3rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    user-select: none;
    z-index: 1001;
    transition: color 0.3s ease, transform 0.3s ease; 
}

.lightbox-close:hover { color: var(--gold-color); transform: rotate(90deg); }

.lightbox-toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px 15px; 
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9); 
    backdrop-filter: blur(5px); 
    gap: 15px; 
    z-index: 1002; 
}

.lightbox-counter { font-size: 1rem; color: #333; font-weight: 600; min-width: 50px; text-align: center; }
.lightbox-play { background: none; border: none; color: #333; font-size: 1.3rem; cursor: pointer; transition: color 0.3s ease; }
.lightbox-play:hover { color: var(--gold-color); }