/* === Widget v sidebaru === */
.widget_tg .widget-title {
    margin-bottom: .75rem;
}

.tg-widget__scroll {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    /* subtle scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 transparent;
}
.tg-widget__scroll::-webkit-scrollbar { width: 6px; }
.tg-widget__scroll::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 3px; }
.tg-widget__scroll::-webkit-scrollbar-track { background: transparent; }

.tg-card {
    border-radius: 8px;
    background: #fff;
    border: 1px solid #eaeaea;
    transition: background .15s, border-color .15s;
}
.tg-card:hover { background: #fafafa; border-color: #d4d4d4; }

.tg-card__link {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: .6rem;
    padding: .5rem;
    text-decoration: none;
    color: inherit;
    align-items: center;
}
.tg-card--text .tg-card__link {
    grid-template-columns: 1fr;
}

.tg-card__thumb {
    width: 72px;
    height: 72px;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    flex-shrink: 0;
}

.tg-card__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.tg-card__text {
    font-size: .9rem;
    line-height: 1.35;
    color: #2a2a2a;
    /* line clamp 3 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tg-card--text .tg-card__text { -webkit-line-clamp: 4; }

.tg-card__date {
    font-size: .75rem;
    color: #888;
}

/* === Single detail === */
.tg-post {
    max-width: 760px;
    margin: 0 auto;
}
.tg-post__header { margin-bottom: 1.5rem; }
.tg-post__title {
    font-size: 1.75rem;
    line-height: 1.25;
    margin: 0 0 .5rem;
}
.tg-post__date {
    font-size: .85rem;
    color: #888;
}
.tg-post__content {
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 2rem;
    white-space: normal;
}
.tg-post__content a { color: #0066cc; text-decoration: underline; }

/* === Galerie === */
.tg-post__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
    margin-top: 1.5rem;
}
.tg-gallery__item {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    background: #f0f0f0;
}
.tg-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .2s;
}
.tg-gallery__item:hover img { transform: scale(1.03); }

/* === Lightbox === */
.tg-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    padding: 2rem;
}
.tg-lightbox.is-open { display: flex; }
.tg-lightbox__stage {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: calc(100% - 6rem);
    max-height: 88%;
}
.tg-lightbox__stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Navigační šipky */
.tg-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.12);
    border: 0;
    color: #fff;
    font-size: 2.5rem;
    width: 3rem;
    height: 5rem;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    transition: background .15s;
    padding: 0;
}
.tg-lightbox__nav:hover { background: rgba(255,255,255,.28); }
.tg-lightbox__nav--prev { left: 1rem; }
.tg-lightbox__nav--next { right: 1rem; }
.tg-lightbox__nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.tg-lightbox__nav[hidden] { display: none; }

/* Počítadlo */
.tg-lightbox__counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    font-family: system-ui, -apple-system, sans-serif;
    background: rgba(0,0,0,.4);
    padding: .25rem .75rem;
    border-radius: 999px;
}
.tg-lightbox__counter[hidden] { display: none; }
.tg-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: 0;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}
.tg-lightbox__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
    border-radius: 4px;
}

@media (max-width: 600px) {
    .tg-post__gallery { grid-template-columns: repeat(2, 1fr); }
    .tg-post__title { font-size: 1.4rem; }

    .tg-lightbox__nav {
        font-size: 2rem;
        width: 2.5rem;
        height: 4rem;
    }
    .tg-lightbox__nav--prev { left: .25rem; }
    .tg-lightbox__nav--next { right: .25rem; }
    .tg-lightbox__stage {
        max-width: calc(100% - 5rem);
    }
}
