/* ============================================================
   Ton Master — Galerija
   Sve promenljive su skopirane na .tmg-otr, ne na :root,
   pa plugin ne dira ostatak sajta.
   ============================================================ */

.tmg-otr {
    --tmg-akcenat: #e8293b;
    --tmg-akcenat-svetli: #ff3546;
    --tmg-tamna: #0e0a0b;
    --tmg-svetli-tekst: #FCF7F7;
    --tmg-prigusen: #B1A09F;
    --tmg-ivica: rgba(255, 255, 255, 0.10);
    --tmg-radijus: 20px;
    --tmg-razmak: 14px;
    padding-top: 80px;
    padding-bottom: 80px;
}

/* ---------- zaglavlje ---------- */
.tmg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 32px;
}

.tmg-head--center {
    display: block;
    text-align: center;
    margin-bottom: 45px;
}

.tmg-eyebrow {
    color: var(--tmg-akcenat);
    font-size: 13px;
    letter-spacing: 2.6px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.tmg-naslov {
    color: var(--tmg-svetli-tekst);
    font-size: 48px;
    line-height: 1.2;
    margin-bottom: 0px;
    text-transform: uppercase;
}

.tmg-naslov span {
    color: var(--tmg-akcenat);
}

.tmg-opis {
    color: var(--tmg-prigusen);
    font-size: 18px;
    line-height: 1.6;
    max-width: 35rem;
    margin-top: 18px;
    margin-bottom: 0px;
}

.tmg-head--center .tmg-opis {
    margin-left: auto;
    margin-right: auto;
}

/* ---------- filteri ---------- */
.tmg-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tmg-filter {
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tmg-filter:hover {
    color: var(--tmg-svetli-tekst);
    border-color: rgba(255, 255, 255, 0.4);
}

.tmg-filter.is-active {
    background: var(--tmg-akcenat);
    border-color: var(--tmg-akcenat);
    color: var(--tmg-svetli-tekst);
}

/* ---------- mozaik ---------- */
.tmg-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 145px;
    gap: var(--tmg-razmak);
}

.tmg-item--lg {
    grid-column: span 8;
    grid-row: span 4;
}

.tmg-item--sm {
    grid-column: span 4;
    grid-row: span 2;
}

.tmg-item--vid {
    grid-column: span 3;
    grid-row: span 4;
}

.tmg-item--quarter {
    grid-column: span 3;
    grid-row: span 2;
}

/* ---------- masonry ---------- */
.tmg-grid--masonry {
    display: block;
    column-count: 3;
    column-gap: 16px;
}

.tmg-grid--masonry .tmg-item {
    display: block;
    width: 100%;
    margin-bottom: 16px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.tmg-item--r43 {
    aspect-ratio: 4 / 3;
}

.tmg-item--r34 {
    aspect-ratio: 3 / 4;
}

.tmg-item--r11 {
    aspect-ratio: 1 / 1;
}

.tmg-item--r23 {
    aspect-ratio: 2 / 3;
}

/* ---------- pločica ---------- */
.tmg-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--tmg-radijus);
    cursor: pointer;
    background: var(--tmg-tamna);
    border: 1px solid var(--tmg-ivica);
}

.tmg-item.is-hidden,
.tmg-item.is-filtered {
    display: none;
}

.tmg-item.is-revealed {
    animation: tmg-fade 0.45s ease;
}

@keyframes tmg-fade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0px);
    }
}

.tmg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.tmg-item:hover img {
    transform: scale(1.05);
}

.tmg-item--vid {
    border-color: rgba(232, 41, 59, 0.30);
}

.tmg-item--vid:hover {
    box-shadow: 0px 0px 50px -14px rgba(232, 41, 59, 0.45);
}

.tmg-scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(0deg, rgba(14, 10, 11, 0.85) 0%, rgba(14, 10, 11, 0.05) 55%);
}

.tmg-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(14, 10, 11, 0.6);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--tmg-svetli-tekst);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    line-height: 1;
}

.tmg-cap {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 3;
    color: var(--tmg-svetli-tekst);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    line-height: 1.3;
    text-shadow: 0px 2px 12px rgba(0, 0, 0, 0.9);
}

.tmg-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--tmg-akcenat);
    color: var(--tmg-svetli-tekst);
    box-shadow: 0px 14px 40px -8px rgba(232, 41, 59, 0.8);
    transition: transform 0.25s ease, background 0.25s ease;
    pointer-events: none;
}

.tmg-play svg {
    width: 22px;
    height: 22px;
    margin-left: 2px;
}

.tmg-item--vid:hover .tmg-play {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--tmg-akcenat-svetli);
}

/* ---------- učitaj više ---------- */
.tmg-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 26px;
}

.tmg-more {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 16px 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.05);
    color: var(--tmg-svetli-tekst);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.tmg-more:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.tmg-more.is-done {
    display: none;
}

/* ---------- strelice (mobilni carousel) ---------- */
.tmg-arrows {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 22px;
}

.tmg-arrow {
    width: 46px;
    height: 46px;
    flex: none;
    padding: 0px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.20);
    background: rgba(255, 255, 255, 0.05);
    color: var(--tmg-svetli-tekst);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.tmg-arrow svg {
    width: 20px;
    height: 20px;
}

.tmg-arrow:not(:disabled):hover {
    background: var(--tmg-akcenat);
    border-color: var(--tmg-akcenat);
}

.tmg-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.tmg-count {
    min-width: 58px;
    text-align: center;
    color: var(--tmg-prigusen);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
}

/* ---------- prazan filter ---------- */
.tmg-empty {
    display: none;
    text-align: center;
    color: var(--tmg-prigusen);
    font-size: 16px;
    margin-top: 40px;
    margin-bottom: 0px;
}

.tmg-otr.is-empty .tmg-empty {
    display: block;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.tmg-lb {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(6, 4, 4, 0.9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tmg-lb.is-open {
    opacity: 1;
    visibility: visible;
}

.tmg-lb__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 100%;
}

.tmg-lb__img {
    display: block;
    max-width: min(1100px, 86vw);
    max-height: 74vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    background: #000000;
    box-shadow: 0px 40px 100px -30px #000000;
}

.tmg-lb__vid {
    position: relative;
    height: 74vh;
    max-width: 92vw;
    border-radius: 14px;
    overflow: hidden;
    background: #000000;
    box-shadow: 0px 40px 100px -30px #000000;
}

.tmg-lb__vid iframe,
.tmg-lb__vid video {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border: 0px;
    display: block;
    object-fit: contain;
    background: #000000;
}

.tmg-lb__cap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-align: center;
    margin-bottom: 70px;
}

.tmg-lb__count {
    color: var(--tmg-akcenat, #e8293b);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3.6px;
    text-transform: uppercase;
    line-height: 1;
}

.tmg-lb__title {
    color: #FCF7F7;
    font-size: 22px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tmg-lb__close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 4;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e8293b;
    color: #FCF7F7;
    border: 0px;
    padding: 0px;
    cursor: pointer;
    box-shadow: 0px 8px 24px -6px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s ease, background 0.2s ease;
}

.tmg-lb__close:hover {
    transform: rotate(90deg);
    background: #c11a2b;
}

.tmg-lb__close svg {
    width: 18px;
    height: 18px;
}

.tmg-lb__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 52px;
    height: 52px;
    padding: 0px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.20);
    background: rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #FCF7F7;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.tmg-lb__nav:hover {
    background: #e8293b;
    border-color: #e8293b;
}

.tmg-lb__nav svg {
    width: 20px;
    height: 20px;
}

.tmg-lb__nav--prev {
    left: 28px;
}

.tmg-lb__nav--next {
    right: 28px;
}

.tmg-lb__thumbs {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    gap: 9px;
    justify-content: flex-start;
    max-width: min(820px, 92vw);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.tmg-lb__thumbs::-webkit-scrollbar {
    display: none;
}

.tmg-lb__thumb {
    position: relative;
    flex: none;
    width: 70px;
    height: 48px;
    padding: 0px;
    border-radius: 10px;
    overflow: hidden;
    background: none;
    border: 2px solid transparent;
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 0.25s ease, border-color 0.25s ease;
}

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

.tmg-lb__thumb.is-video:after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0px;
    height: 0px;
    border-style: solid;
    border-width: 6px 0px 6px 10px;
    border-color: transparent transparent transparent #FCF7F7;
    filter: drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.9));
}

.tmg-lb__thumb:hover {
    opacity: 0.8;
}

.tmg-lb__thumb.is-active {
    opacity: 1;
    border-color: #e8293b;
}

/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1024px) {
    .tmg-grid {
        grid-auto-rows: 110px;
    }

    .tmg-item--lg {
        grid-column: span 12;
        grid-row: span 3;
    }

    .tmg-item--sm {
        grid-column: span 6;
        grid-row: span 2;
    }

    .tmg-item--vid {
        grid-column: span 6;
        grid-row: span 4;
    }

    .tmg-item--quarter {
        grid-column: span 6;
        grid-row: span 2;
    }

    .tmg-grid--masonry {
        column-count: 2;
    }

    .tmg-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .tmg-naslov {
        font-size: 38px;
    }

    .tmg-lb__thumbs {
        display: none;
    }

    .tmg-lb__cap {
        margin-bottom: 0px;
    }
}

/* ============================================================
   TELEFON
   ============================================================ */

@media (max-width: 767px) {
    .tmg-otr {
        padding-top: 55px;
        padding-bottom: 55px;
    }

    /* mozaik postaje carousel */
    .tmg-grid {
        display: flex;
        grid-auto-rows: auto;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tmg-grid::-webkit-scrollbar {
        display: none;
    }

    .tmg-grid:not(.tmg-grid--masonry) .tmg-item {
        grid-column: auto;
        grid-row: auto;
        flex: 0 0 100%;
        min-width: 100%;
        aspect-ratio: 3 / 4;
        scroll-snap-align: start;
        border-radius: 16px;
    }

    .tmg-arrows {
        display: flex;
    }

    /* masonry ostaje mreža */
    .tmg-grid--masonry {
        display: block;
        column-count: 2;
        column-gap: 10px;
        overflow: visible;
    }

    .tmg-grid--masonry .tmg-item {
        margin-bottom: 10px;
        border-radius: 14px;
    }

    .tmg-otr--masonry .tmg-arrows {
        display: none;
    }

    .tmg-item:hover img {
        transform: none;
    }

    .tmg-item--vid:hover .tmg-play {
        transform: translate(-50%, -50%);
    }

    .tmg-play {
        width: 52px;
        height: 52px;
    }

    .tmg-grid--masonry .tmg-play {
        width: 42px;
        height: 42px;
    }

    .tmg-grid--masonry .tmg-play svg {
        width: 17px;
        height: 17px;
    }

    .tmg-grid--masonry .tmg-badge {
        top: 9px;
        left: 9px;
        padding: 5px 9px;
        font-size: 8px;
        letter-spacing: 1.1px;
    }

    .tmg-grid--masonry .tmg-cap {
        left: 10px;
        right: 10px;
        bottom: 10px;
        font-size: 9.5px;
        letter-spacing: 0.9px;
    }

    .tmg-filter {
        padding: 9px 14px;
        font-size: 10.5px;
        letter-spacing: 1px;
    }

    .tmg-naslov {
        font-size: 30px;
    }

    .tmg-lb {
        padding: 20px 12px;
    }

    .tmg-lb__nav {
        display: none;
    }

    .tmg-lb__close {
        top: 8px;
        right: 8px;
    }

    .tmg-lb__img {
        max-width: 92vw;
        max-height: 70vh;
    }

    .tmg-lb__vid {
        height: 70vh;
    }

    .tmg-lb__title {
        font-size: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tmg-item img,
    .tmg-play,
    .tmg-lb,
    .tmg-lb__close {
        transition: none;
    }

    .tmg-item.is-revealed {
        animation: none;
    }
}
