/* Галереи тем (ThemCL / CustThemCL / InfiniteTheme) */

html, body { overflow-x: hidden; }

.tg-wrap {
    max-width: 1000px;
    margin: clamp(14px, 3vw, 28px) auto;
    padding: 0 14px clamp(80px, 12vw, 100px);
}

.tg-hero {
    background: var(--glass);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 32px) clamp(18px, 4vw, 32px);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.tg-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(76,175,80,0.07) 0%, rgba(100,170,255,0.05) 100%);
    pointer-events: none;
}

.tg-hero-top { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; position: relative; }
.tg-hero-icon {
    width: 56px; height: 56px; border-radius: 14px; flex-shrink: 0;
    background: linear-gradient(135deg, rgba(76,175,80,0.2), rgba(100,170,255,0.15));
    border: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: center;
}
.tg-hero-icon .icon { width: 26px; height: 26px; }
.tg-hero-info { flex: 1; min-width: 0; }
.tg-hero-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 800; color: var(--text);
    letter-spacing: -.02em; margin: 0 0 6px;
}
.tg-hero-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0 0 8px; }

.tg-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; position: relative; }
.tg-tab {
    display: inline-flex; align-items: center; min-height: 44px;
    padding: 8px 14px; border-radius: 99px;
    font-size: 13px; font-weight: 700; text-decoration: none;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,.04); color: var(--muted);
}
.tg-tab.is-on {
    background: rgba(100,170,255,.14);
    border-color: rgba(100,170,255,.32);
    color: var(--accent);
}

.tg-tags-wrap {
    margin-top: 12px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px; padding: 12px 14px;
}
.tg-tags-wrap p {
    font-size: 11px; color: var(--muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px;
}
.tg-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tg-tag {
    padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600;
    background: rgba(100,170,255,.1); border: 1px solid rgba(100,170,255,.18);
    color: var(--accent);
}

.tg-note {
    margin-top: 12px; padding: 10px 14px;
    background: rgba(255,215,0,.08); border: 1px solid rgba(255,215,0,.2);
    border-radius: 10px; font-size: 13px; color: #e8c44a;
    display: flex; align-items: flex-start; gap: 8px;
}
.tg-note .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.tg-hero-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; position: relative; }
.tg-btn {
    padding: 10px 16px; min-height: 44px; border-radius: 9px;
    text-decoration: none; font-size: 13px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid transparent;
}
.tg-btn-tg    { background: rgba(0,136,204,.15); color: #29b6f6; border-color: rgba(0,136,204,.25); }
.tg-btn-drive { background: rgba(76,175,80,.12); color: #4caf50; border-color: rgba(76,175,80,.22); }
.tg-btn-back  { background: rgba(255,255,255,.05); color: var(--muted); border-color: var(--glass-border); }

.tg-count {
    font-size: 13px; color: var(--muted); margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.tg-count span {
    background: rgba(76,175,80,.12); border: 1px solid rgba(76,175,80,.22);
    color: #4caf50; font-weight: 700; padding: 2px 10px; border-radius: 99px; font-size: 12px;
}

.tg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.tg-card {
    background: var(--glass);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
}
.tg-img {
    position: relative; overflow: hidden;
    background: rgba(0,0,0,.2); cursor: pointer;
}
.tg-img img {
    width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover;
}
.tg-num {
    position: absolute; top: 8px; left: 8px;
    background: rgba(0,0,0,.6);
    color: var(--muted); font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 99px;
}
.tg-zoom {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,.55);
    color: #fff; width: 28px; height: 28px; border-radius: 50%;
    display: none; align-items: center; justify-content: center;
}
.tg-body {
    padding: 12px 14px 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tg-name {
    font-size: 13px; font-weight: 700; color: var(--text);
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tg-dl {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 44px; padding: 8px 14px; border-radius: 8px;
    background: rgba(76,175,80,.12); border: 1px solid rgba(76,175,80,.24);
    color: #4caf50; font-size: 12px; font-weight: 700;
    text-decoration: none; white-space: nowrap; flex-shrink: 0;
}

.tg-lb {
    display: none; position: fixed; inset: 0; z-index: 9900;
    background: rgba(0,0,0,.88);
    align-items: center; justify-content: center; padding: 16px; cursor: pointer;
}
.tg-lb.open { display: flex; }
.tg-lb img {
    max-width: 92vw; max-height: 90vh; border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.7); cursor: default; user-select: none;
}
.tg-lb-close, .tg-lb-nav {
    position: fixed; border-radius: 50%;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.tg-lb-close { top: 16px; right: 18px; width: 44px; height: 44px; font-size: 18px; }
.tg-lb-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 20px; }
.tg-lb-prev { left: 12px; }
.tg-lb-next { right: 12px; }
.tg-lb-info {
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.6);
    padding: 6px 16px; border-radius: 99px;
    color: rgba(255,255,255,.8); font-size: 13px; white-space: nowrap;
}

@media (max-width: 720px) {
    .tg-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .tg-name { font-size: 12px; }
    .tg-dl { padding: 8px 10px; font-size: 11px; }
}
@media (max-width: 480px) {
    .tg-grid { grid-template-columns: 1fr; }
    .tg-lb-nav { display: none; }
}

@media (hover: hover) and (pointer: fine) {
    .tg-tab:hover { color: var(--text); background: rgba(255,255,255,.08); }
    .tg-btn-tg:hover { background: rgba(0,136,204,.25); }
    .tg-btn-drive:hover { background: rgba(76,175,80,.22); }
    .tg-btn-back:hover { background: rgba(255,255,255,.1); color: var(--text); }
    .tg-card { transition: border-color .2s, transform .15s; }
    .tg-card:hover { border-color: rgba(76,175,80,.3); transform: translateY(-2px); }
    .tg-img img { transition: transform .3s; }
    .tg-card:hover .tg-img img { transform: scale(1.03); }
    .tg-zoom { display: flex; opacity: 0; transition: opacity .2s; }
    .tg-card:hover .tg-zoom { opacity: 1; }
    .tg-dl { transition: background .18s, transform .18s; }
    .tg-dl:hover { background: rgba(76,175,80,.24); transform: translateY(-1px); }
    .tg-lb-close:hover, .tg-lb-nav:hover { background: rgba(255,255,255,.22); }
}
