/* ── Tabbed Gallery – Frontend ─────────────────────────────────────────────── */

:root {
    --tg-margin:  40px;
    --tg-gap:     6px;
    --tg-gold:    #b89b6a;
    --tg-dark:    #111;
    --tg-radius:  6px;
    --tg-speed:   5000ms;
}

.tg-gallery {
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════ TABS */

.tg-tabs {
    all: unset;
    display: flex !important;
    justify-content: center;
    align-items: flex-end;
    gap: 0;
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(0,0,0,.13);
    width: 100%;
    box-sizing: border-box;
}

.tg-tab {
    all: unset;
    display: inline-block !important;
    box-sizing: border-box;
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    margin-bottom: -1px;
    padding: 0 40px 14px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: .22em !important;
    text-transform: uppercase !important;
    color: #999 !important;
    cursor: pointer;
    transition: color .3s, border-color .3s !important;
    line-height: 1 !important;
    box-shadow: none !important;
    outline: none;
    -webkit-appearance: none;
}

.tg-tab:hover  { color: var(--tg-dark) !important; background: transparent !important; }
.tg-tab:focus  { outline: none; background: transparent !important; box-shadow: none !important; }
.tg-tab.active { color: var(--tg-dark) !important; border-bottom-color: var(--tg-gold) !important; background: transparent !important; }

/* ═══════════════════════════════════════════════════════ PANELS */

.tg-panel        { display: none; }
.tg-panel.active { display: block; }

/* ═══════════════════════════════════════════════════════ FRAME */

.tg-slider { width: 100%; }

.tg-frame {
    position: relative;
    width: calc(100vw - var(--tg-margin) * 2);
    left: 50%;
    transform: translateX(-50%);
}

/* ═══════════════════════════════════════════════════════ HERO */

.tg-hero {
    position: relative;
    width: 100%;
    background: #0a0a0a;
    overflow: hidden;
    border-radius: var(--tg-radius) var(--tg-radius) 0 0;
    line-height: 0;
}

.tg-slides {
    position: relative;
    width: 100%;
    line-height: 0;
}

/* ── Slides: stack with absolute so Ken Burns doesn't shift layout ── */
.tg-slide {
    position: relative;
    width: 100%;
    display: none;
    line-height: 0;
}

.tg-slide.active {
    display: block;
}

.tg-slide img {
    width: 100%;
    height: auto;
    display: block;
    transform-origin: center center;
}

/* Ken Burns on active slide */
.tg-slide.active img {
    animation: tgKenBurns var(--tg-speed) ease-out forwards;
}

@keyframes tgKenBurns {
    0%   { transform: scale(1);    }
    100% { transform: scale(1.07); }
}

/* Fade in */
.tg-slide.active {
    animation: tgFadeIn .6s ease forwards;
}

@keyframes tgFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Caption ── */
.tg-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 48px 28px 52px;
    background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 100%);
    pointer-events: none;
}

.tg-caption p {
    margin: 0 !important;
    padding: 0 !important;
    color: rgba(255,255,255,.9) !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    letter-spacing: .12em !important;
    text-transform: uppercase !important;
    animation: tgFadeUp .5s ease forwards;
}

@keyframes tgFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Counter (top-right) ── */
.tg-counter {
    position: absolute;
    top: 20px;
    right: 22px;
    display: flex;
    align-items: baseline;
    gap: 5px;
    z-index: 10;
    pointer-events: none;
}

.tg-counter-cur,
.tg-counter-total {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .08em;
    line-height: 1;
    text-shadow: 0 1px 6px rgba(0,0,0,.5);
}

.tg-counter-sep {
    font-size: 10px;
    color: rgba(255,255,255,.55);
    line-height: 1;
}

/* ── Arrows ── */
.tg-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.08) !important;
    border: 1px solid rgba(255,255,255,.3) !important;
    border-radius: 0 !important;
    color: #fff !important;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background .25s, border-color .25s !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none;
    -webkit-appearance: none;
    all: unset;
    /* re-apply needed props after all:unset */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background .25s, border-color .25s;
}

.tg-arrow svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
}

.tg-arrow:hover {
    background: rgba(255,255,255,.22);
    border-color: rgba(255,255,255,.7);
}

.tg-prev { left: 20px; }
.tg-next { right: 20px; }

/* ── Dots ── */
.tg-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.tg-dot {
    all: unset;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.4);
    cursor: pointer;
    transition: background .3s, transform .3s;
    display: block;
}

.tg-dot.active {
    background: var(--tg-gold);
    transform: scale(1.4);
}

.tg-dot:hover {
    background: rgba(255,255,255,.75);
}

/* ── Progress bar (bottom of hero, above dots) ── */
.tg-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,.18);
    z-index: 11;
    overflow: hidden;
}

.tg-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--tg-gold);
    transition: width .15s linear;
}

/* ═══════════════════════════════════════════════════════ THUMBNAILS */

.tg-thumbs-wrap {
    display: flex;
    align-items: stretch;
    gap: var(--tg-gap);
    margin-top: var(--tg-gap);
}

.tg-thumb-arrow {
    all: unset;
    width: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f2f2;
    border-radius: var(--tg-radius);
    cursor: pointer;
    color: #555;
    transition: background .2s, color .2s;
}

.tg-thumb-arrow svg {
    width: 16px;
    height: 16px;
    display: block;
}

.tg-thumb-arrow:hover {
    background: var(--tg-dark);
    color: #fff;
}

.tg-thumbs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc(20% - 6px);
    gap: var(--tg-gap);
    overflow: hidden;
    flex: 1;
    scroll-behavior: smooth;
}

.tg-thumb {
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    background: #222;
    border-radius: var(--tg-radius);
    opacity: .45;
    transition: opacity .3s ease, box-shadow .3s ease;
    flex-shrink: 0;
}

.tg-thumb.active,
.tg-thumb:hover {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--tg-gold);
}

.tg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform .4s ease;
}

.tg-thumb:hover img { transform: scale(1.06); }

/* ═══════════════════════════════════════════════════════ LIGHTBOX */

.tg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

.tg-lightbox.open {
    opacity: 1;
    pointer-events: auto;
}

.tg-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5,5,5,.92);
    cursor: zoom-out;
}

.tg-lb-stage {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tg-lb-img {
    max-width: 100%;
    max-height: 82vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 3px;
    box-shadow: 0 30px 80px rgba(0,0,0,.7);
    animation: tgLbIn .35s ease;
}

@keyframes tgLbIn {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}

.tg-lb-caption {
    color: rgba(255,255,255,.6);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-top: 14px;
    text-align: center;
}

.tg-lb-close {
    all: unset;
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 3;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50%;
    transition: color .2s, border-color .2s;
}

.tg-lb-close:hover { color: #fff; border-color: rgba(255,255,255,.6); }
.tg-lb-close svg   { width: 18px; height: 18px; display: block; }

.tg-lb-arrow {
    all: unset;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.6);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,.18);
    transition: color .2s, border-color .2s;
}

.tg-lb-arrow:hover  { color: #fff; border-color: rgba(255,255,255,.55); }
.tg-lb-arrow svg    { width: 22px; height: 22px; display: block; }
.tg-lb-prev         { left: 24px; }
.tg-lb-next         { right: 24px; }

.tg-lb-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.45);
    font-size: 11px;
    letter-spacing: .14em;
    z-index: 3;
}

/* ═══════════════════════════════════════════════════════ EMPTY */

.tg-empty {
    padding: 48px;
    text-align: center;
    color: #bbb;
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════ RESPONSIVE */

@media (max-width: 768px) {
    :root { --tg-margin: 16px; }
    .tg-arrow  { width: 38px; height: 38px; }
    .tg-arrow svg { width: 16px; height: 16px; }
    .tg-tabs   { gap: 0; }
    .tg-tab    { padding: 0 22px 12px !important; }
    .tg-thumbs { grid-auto-columns: calc(33.33% - 5px); }
    .tg-lb-arrow { width: 40px; height: 40px; }
    .tg-lb-prev  { left: 8px; }
    .tg-lb-next  { right: 8px; }
}
