.reference-page-container {
    max-width: 95vw;
    margin: 0 auto;
    padding-top: 40px;
    padding-bottom: 60px;
    padding-left: 20px;
    padding-right: 20px;
}

.reference-page-container h1 {
    text-align: center;
    font-size: 2.8rem;
    margin-bottom: 15px;
}

.page-intro {
    text-align: center;
    font-size: 1.1rem;
    color: #333;
    max-width: 600px;
    margin: 0 auto 50px auto;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.reference-tile {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.reference-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.tile-image {
    width: 100%;
    height: 35vh;
    overflow: hidden;
}

.tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tile-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.tile-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.tile-description {
    font-size: 1rem;
    color: #333;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.tile-button {
    display: inline-block;
    padding: 10px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--color-hunter-green);
    border-radius: 5px;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease;
    margin-top: auto;
    align-self: flex-start;
}

.tile-button:hover {
    background-color: var(--color-dark-green);
}

.center-container {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 6px;
}

.location-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-icon {
    color: var(--primary-color);
    font-size: 1.4rem;
    font-weight: 500;
    user-select: none;
}

.location-text {
    font-size: 1.1rem;
    font-weight: 500;
}

/* =========================================
   NOVÁ SPODNÍ GALERIE
   ========================================= */

.photo-gallery-section {
    padding-bottom: 60px;
    text-align: center;
}

.gallery-heading {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: var(--color-hunter-green, #2c4c3b); 
}

.gallery-subheading {
    color: #666;
    margin-bottom: 30px;
}

.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.gallery-lightbox-item {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-lightbox-item:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

/* =========================================
   VYSKAKOVACÍ OKNO (LIGHTBOX) - ZÁKLAD
   ========================================= */

.lightbox-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content-wrapper {
    position: relative;
    max-width: 80%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-caption {
    margin-top: 15px;
    color: #fff;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Křížek zavřít */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 45px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10000;
}

/* Obal pro šipky na desktopu (přes celou šířku obrazovky) */
.lightbox-nav-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between; /* Hodí šipky na kraje */
    padding: 0 40px;
    pointer-events: none; /* Kliknutí propadne skrz na fotku */
    box-sizing: border-box;
}

.lightbox-prev, .lightbox-next {
    color: white;
    font-size: 40px;
    font-weight: bold;
    padding: 20px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.3s;
    border-radius: 5px;
    pointer-events: auto; /* Samotné šipky musí být klikací */
}

.lightbox-close:hover,
.lightbox-prev:hover, 
.lightbox-next:hover {
    color: #ddd;
    background-color: rgba(255, 255, 255, 0.1);
}

/* =========================================
   MEDIA QUERIES (TABLETY A MOBILY)
   ========================================= */

@media (max-width: 992px) {
    .reference-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    
    /* Zrušení hover efektů na dotykových zařízeních */
    .reference-tile:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); 
    }

    .gallery-lightbox-item:hover {
        transform: none;
        box-shadow: none; 
    }

    /* --- LIGHTBOX NA MOBILU --- */

    /* Přeskládání pod sebe a zajištění, že se nic neustřihne */
    .lightbox-overlay {
        flex-direction: column;
        padding: 0;
        box-sizing: border-box;
    }

    /* Kontejner s obrázkem dokonale vycentrovaný */
    .lightbox-content-wrapper {
        width: 100%;
        max-width: 100%;
        padding: 0 15px; /* Pojistka proti okraji displeje */
        box-sizing: border-box;
        margin-bottom: 20px; /* Mezera nad šipkami */
    }

    /* Samotný obrázek */
    .lightbox-img {
        max-height: 60vh; /* Na mobilu musí být nižší, ať zbyde místo */
        margin: 0 auto;   /* Vycentrování na střed */
    }

    .lightbox-caption {
        font-size: 0.95rem;
    }

    /* Přesun šipek dolů vedle sebe */
    .lightbox-nav-controls {
        position: static;
        transform: none;
        width: 100%;
        padding: 0;
        justify-content: center; /* Vycentruje šipky doprostřed */
        gap: 25px; /* MEZERA MEZI ŠIPKAMI */
        pointer-events: auto;
    }

    /* Mobilní šipky s pozadím */
    .lightbox-prev, .lightbox-next {
        font-size: 24px;
        padding: 0;
        width: 60px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(255, 255, 255, 0.15); /* Jemné čtvercové pozadí */
        border-radius: 8px;
    }

    /* Zmenšení a upravení křížku */
    .lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 35px;
    }
}

@media (max-width: 576px) {
    .reference-grid {
        grid-template-columns: 1fr;
    }

    .reference-page-container h1 {
        font-size: 2.2rem;
    }

    /* Snížení výšky obrázku v kartě realizace na mobilech */
    .tile-image {
        height: 25vh;
    }
}

/* =========================================
   TISK (PRINT)
   ========================================= */

@media print {
    body {
        font-family: Georgia, serif;
        font-size: 11pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
        padding-top: 0;
    }

    * {
        color: #000 !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .main-header,
    .main-footer,
    .tile-button {
        display: none;
    }

    .reference-page-container {
        max-width: 100%;
        width: 100%;
        padding: 0;
    }

    h1 {
        font-size: 18pt;
    }

    h3 {
        font-size: 14pt;
    }

    p {
        font-size: 11pt;
    }

    .reference-grid {
        display: block;
    }

    .reference-tile {
        margin-bottom: 30px;
        page-break-inside: avoid;
    }

    .tile-image {
        height: auto;
        text-align: center;
    }

    .tile-image img {
        width: 100%;
        max-width: 450px;
        height: auto;
        object-fit: contain;
    }

    .tile-content {
        padding: 10px 0;
    }
}