/*   Y O U R   C S S   S T Y L E S
**
** Style all markdown content elements properly
** Use the markdown test file to check it: https://github.com/typemill/typemill/blob/master/content/00-Welcome/03-Markdown-Test.md
** You can activate and use the Tachyons CSS library: https://typemill.net/theme-developers/helper-functions#activate-tachyons
**
*/
/* Obecný styl */
.reference-content {
    display: grid;
    gap: 2rem 0.75rem; /* Změněno z 0.75rem na 0.75rem 2rem - větší horizontální mezery */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.reference-content > * {
    grid-column: 1 / -1; /* Zajistí, že všechny přímé děti budou přes celou šířku */
}

.reference-content figure {
    margin: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.reference-content figure::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0);
    transition: background-color 0.3s ease;
    pointer-events: none; /* Přidáno aby overlay nebránil kliknutí */
}

.reference-content figure:hover::after {
    background-color: rgba(255, 255, 255, 0.7); /* Změněno z 0.7 na 0.5 pro menší zesvětlení */
}

.image-title-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: transparent; /* Změněno z white na transparent pro výchozí stav */
    padding: 0.5rem 1rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease; /* Přidán přechod pro barvu */
    pointer-events: none;
    width: 80%;
    font-size: 1.8rem; /* Přidáno - zvětšení písma */
}

.reference-content figure:hover .image-title-overlay {
    opacity: 1;
    z-index: 2;
    color: black; /* Změněno na černou při hoveru */
}

.reference-content img {
    width: 100%; /* Obrázky budou zabírat 100% šířky rodičovského elementu */
    height: 250px; /* Zvětšeno z 200px na 250px */
    object-fit: cover; /* Zajištění, že obrázky budou mít stejnou velikost náhledu a budou oříznuty */
    object-position: left top; /* Přidáno pro zarovnání k levému hornímu rohu */
    border-radius: 0; /* Změněno z 8px */
    transition: transform 0.3s ease;
}

.reference-content img:hover {
    transform: scale(1.05);
}

.reference-content figcaption {
    margin-top: 0.2rem; /* Zmenšeno z 1rem pro menší mezeru */
    font-size: 0.8rem; /* Menší velikost textu */
    text-align: center; /* Centrovaný text */
}

.reference-content figcaption em {
    font-style: normal; /* Odstranění kurzívy */
}

.reference-content p,
.reference-content ul {
    width: 100%;  /* Výchozí šířka pro mobily */
    margin-left: auto;
    margin-right: auto;
}

.reference-content ul {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.2em;  /* Menší odsazení pro odrážky */
    list-style: disc;  /* Obnovení odrážek */
    box-sizing: border-box;  /* Zajistí, že padding je započítán do celkové šířky */
}

.reference-content ul li {
    padding-left: 0;  /* Odstranění paddingu u li */
    margin-left: 0;   /* Odstranění marginu u li */
}

@media (min-width: 769px) {  /* Změněno z 64em na 768px */
    .reference-content {
        grid-template-columns: repeat(3, 1fr); /* Změněno ze 4 sloupců na 3 */
    }

    .reference-content figure {
        grid-column: span 1; /* Obrázky budou zabírat jednu buňku */
    }

    /* Desktop styles */
    .reference-content p,
    .reference-content ul {
        width: 50%;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 48em) and (max-width: 64em) {
    .reference-content {
        grid-template-columns: repeat(3, 1fr); /* 3 sloupce na středních obrazovkách */
    }

    .reference-content figure {
        grid-column: span 1; /* Obrázky budou zabírat jednu buňku */
    }
}

@media (min-width: 30em) and (max-width: 48em) {
    .reference-content {
        grid-template-columns: repeat(2, 1fr); /* 2 sloupce na menších obrazovkách */
    }

    .reference-content figure {
        grid-column: span 1; /* Obrázky budou zabírat jednu buňku */
    }
}

@media (max-width: 30em) {
    .reference-content {
        grid-template-columns: 1fr; /* 1 sloupec na mobilních zařízeních */
    }

    .reference-content figure {
        grid-column: span 1; /* Obrázky budou zabírat jednu buňku */
    }

    .reference-content figcaption {
        margin-top: 0.5rem; /* Zmenšeno i pro mobilní zobrazení */
        margin-bottom: 1.5rem; /* Přidáno spodní odsazení */
        font-size: 0.875rem; /* Zvětšení fontu z 0.75rem */
    }
}

#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 1000;
}

#lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0; /* Změněno z 4px */
    cursor: pointer; /* Přidáno pro indikaci klikatelnosti */
}

.lightbox-caption {
    color: white;
    text-align: center;
    margin-top: 1rem;
    font-size: 1rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: none;
    border: none;
    color: #eee; /* Změna barvy na #eee */
    font-size: 3rem; /* Zvětšeno z 2rem */
    cursor: pointer;
    padding: 1.5rem; /* Zvětšeno z 1rem pro lepší dotykovou plochu */
    z-index: 1001;
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

@media (max-width: 768px) {
    .lightbox-content img {
        max-height: 90vh;
    }
    
    .lightbox-close {
        font-size: 2.5rem; /* Zvětšeno z 1.5rem */
        padding: 1rem; /* Zvětšeno z 0.5rem */
        top: 0.5rem; /* Přidáno pro lepší pozici */
        right: 0.5rem; /* Přidáno pro lepší pozici */
        color: #eee; /* Změna barvy na #eee */
    }

    .lightbox-prev,
    .lightbox-next {
        display: none; /* Skrytí šipek na mobilních zařízeních */
    }
}

/* Add touch-specific styles */
@media (hover: none) {
    .lightbox-prev,
    .lightbox-next,
    .lightbox-close {
        -webkit-tap-highlight-color: transparent;
    }

    #lightbox img {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}