/**
 * TitanGallery theme
 * Override these properties on `.titan-gallery` in the site stylesheet.
 */
.titan-gallery {
    --tg-z-index: 10000;
    --tg-backdrop: rgba(6, 7, 9, 0.965);
    --tg-panel: rgba(24, 25, 29, 0.76);
    --tg-panel-strong: rgba(30, 31, 35, 0.94);
    --tg-border: rgba(255, 255, 255, 0.13);
    --tg-text-color: #f7f7f8;
    --tg-muted-color: rgba(247, 247, 248, 0.68);
    --tg-control-bg: rgba(24, 25, 29, 0.72);
    --tg-control-bg-hover: rgba(255, 255, 255, 0.16);
    --tg-control-color: #fff;
    --tg-accent-color: #fff;
    --tg-error-color: #ffb4b4;
    --tg-control-size: 46px;
    --tg-control-edge: 20px;
    --tg-content-max-width: 1440px;
    --tg-content-max-height: calc(100vh - 164px);
    --tg-content-max-height: calc(100dvh - 164px);
    --tg-video-max-width: 1200px;
    --tg-thumbnail-width: 72px;
    --tg-thumbnail-height: 54px;
    --tg-thumbnail-gap: 8px;
    --tg-radius: 8px;
    --tg-transition-duration: 220ms;
    --tg-slide-duration: 420ms;
    --tg-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --tg-bottom-space: 94px;

    position: fixed;
    inset: 0;
    z-index: var(--tg-z-index);
    display: grid;
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: var(--tg-text-color);
    background: var(--tg-backdrop);
    opacity: 0;
    transition: opacity var(--tg-transition-duration) ease;
    overscroll-behavior: contain;
}

.titan-gallery.is-open {
    opacity: 1;
}

.titan-gallery,
.titan-gallery * {
    box-sizing: border-box;
}

.titan-gallery button {
    appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    font: inherit;
    background: none;
}

.titan-gallery button:focus-visible,
.titan-gallery iframe:focus-visible {
    outline: 2px solid var(--tg-accent-color);
    outline-offset: 3px;
}

.titan-gallery [hidden] {
    display: none !important;
}

.titan-gallery__dialog {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
    height: 100%;
    padding: 72px 84px var(--tg-bottom-space);
    pointer-events: none;
    transition: padding-bottom var(--tg-slide-duration) var(--tg-ease-out);
}

.titan-gallery__dialog.thumbnails-collapsed {
    --tg-bottom-space: 74px;
}

.titan-gallery__toolbar {
    position: absolute;
    top: var(--tg-control-edge);
    right: var(--tg-control-edge);
    left: var(--tg-control-edge);
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--tg-control-size);
    pointer-events: none;
}

.titan-gallery__toolbar-actions,
.titan-gallery__zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.titan-gallery__counter {
    padding: 8px 12px;
    color: var(--tg-muted-color);
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: 0.04em;
    background: var(--tg-control-bg);
    border: 1px solid var(--tg-border);
    border-radius: 999px;
    backdrop-filter: blur(14px);
}

.titan-gallery__close,
.titan-gallery__control,
.titan-gallery__zoom-button,
.titan-gallery__zoom-reset,
.titan-gallery__dock-button {
    position: relative;
    z-index: 4;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition:
        color var(--tg-transition-duration) ease,
        background-color var(--tg-transition-duration) ease,
        border-color var(--tg-transition-duration) ease,
        opacity var(--tg-transition-duration) ease,
        transform var(--tg-transition-duration) var(--tg-ease-out);
    pointer-events: auto;
}

.titan-gallery__close,
.titan-gallery__control {
    width: var(--tg-control-size);
    height: var(--tg-control-size);
    background: var(--tg-control-bg);
    border: 1px solid var(--tg-border) !important;
    border-radius: 50%;
    backdrop-filter: blur(14px);
}

.titan-gallery__close:hover,
.titan-gallery__control:hover,
.titan-gallery__zoom-button:hover,
.titan-gallery__zoom-reset:hover,
.titan-gallery__dock-button:hover {
    background: var(--tg-control-bg-hover);
}

.titan-gallery__close:active,
.titan-gallery__control:active,
.titan-gallery__dock-button:active {
    transform: scale(0.94);
}

.titan-gallery__close::before,
.titan-gallery__close::after {
    position: absolute;
    width: 20px;
    height: 2px;
    background: var(--tg-control-color);
    border-radius: 2px;
    content: '';
}

.titan-gallery__close::before {
    transform: rotate(45deg);
}

.titan-gallery__close::after {
    transform: rotate(-45deg);
}

.titan-gallery__control {
    position: absolute;
    top: 50%;
    z-index: 7;
    transform: translateY(-50%);
}

.titan-gallery__control:active {
    transform: translateY(-50%) scale(0.94);
}

.titan-gallery__control::before {
    width: 13px;
    height: 13px;
    border-top: 2px solid var(--tg-control-color);
    border-right: 2px solid var(--tg-control-color);
    content: '';
}

.titan-gallery__previous {
    left: var(--tg-control-edge);
}

.titan-gallery__previous::before {
    margin-left: 5px;
    transform: rotate(-135deg);
}

.titan-gallery__next {
    right: var(--tg-control-edge);
}

.titan-gallery__next::before {
    margin-right: 5px;
    transform: rotate(45deg);
}

.titan-gallery__control:disabled,
.titan-gallery__zoom-button:disabled,
.titan-gallery__zoom-reset:disabled {
    cursor: default;
    opacity: 0.32;
}

.titan-gallery__zoom-controls {
    gap: 0;
    padding: 3px;
    background: var(--tg-control-bg);
    border: 1px solid var(--tg-border);
    border-radius: 999px;
    backdrop-filter: blur(14px);
}

.titan-gallery__zoom-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.titan-gallery__zoom-button::before,
.titan-gallery__zoom-in::after {
    position: absolute;
    width: 14px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    content: '';
}

.titan-gallery__zoom-in::after {
    transform: rotate(90deg);
}

.titan-gallery__zoom-reset {
    min-width: 52px;
    height: 34px;
    padding: 0 8px !important;
    color: var(--tg-muted-color) !important;
    font-size: 12px !important;
    font-variant-numeric: tabular-nums;
    border-radius: 999px;
}

.titan-gallery__stage {
    position: relative;
    align-self: stretch;
    width: 100%;
    max-width: var(--tg-content-max-width);
    height: 100%;
    max-height: var(--tg-content-max-height);
    margin: auto;
    overflow: hidden;
    touch-action: pan-y;
    pointer-events: auto;
    perspective: 1400px;
    transform-origin: center;
    transition:
        opacity var(--tg-slide-duration) var(--tg-ease-out),
        transform var(--tg-slide-duration) var(--tg-ease-out),
        filter var(--tg-slide-duration) var(--tg-ease-out);
}

.titan-gallery__dialog.is-zoomed .titan-gallery__stage {
    touch-action: none;
}

.titan-gallery__slide {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.985);
    transition:
        opacity var(--tg-slide-duration) var(--tg-ease-out),
        transform var(--tg-slide-duration) var(--tg-ease-out),
        filter var(--tg-slide-duration) var(--tg-ease-out);
    pointer-events: none;
    will-change: transform, opacity;
}

.titan-gallery__slide.is-active {
    z-index: 2;
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    pointer-events: auto;
}

.titan-gallery__slide.is-entering {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.975);
}

.titan-gallery__slide.is-from-right {
    transform: translate3d(12%, 0, 0) scale(0.985);
}

.titan-gallery__slide.is-from-left {
    transform: translate3d(-12%, 0, 0) scale(0.985);
}

.titan-gallery__slide.is-to-left {
    opacity: 0;
    transform: translate3d(-12%, 0, 0) scale(0.985);
}

.titan-gallery__slide.is-to-right {
    opacity: 0;
    transform: translate3d(12%, 0, 0) scale(0.985);
}

.titan-gallery__slide.is-dragging {
    transition: none;
}

.titan-gallery__slide.is-snapping {
    transition:
        opacity var(--tg-slide-duration) var(--tg-ease-out),
        transform var(--tg-slide-duration) var(--tg-ease-out);
}

.titan-gallery__slide.is-loading::after {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-top-color: var(--tg-accent-color);
    border-radius: 50%;
    animation: titan-gallery-spin 700ms linear infinite;
    content: '';
}

.titan-gallery__media {
    display: grid;
    place-items: center;
    max-width: 100%;
    max-height: var(--tg-content-max-height);
    cursor: zoom-in;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center;
    transition: transform 280ms var(--tg-ease-out);
    will-change: transform;
}

.titan-gallery__dialog.is-zoomed .titan-gallery__media {
    cursor: grab;
}

.titan-gallery__media.is-panning {
    cursor: grabbing;
    transition: none;
}

.titan-gallery__image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: var(--tg-content-max-height);
    object-fit: contain;
    opacity: 0;
    user-select: none;
    transition: opacity var(--tg-transition-duration) ease;
    -webkit-user-drag: none;
}

.titan-gallery__image.is-loaded {
    opacity: 1;
}

.titan-gallery__video {
    width: min(100%, var(--tg-video-max-width));
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--tg-radius);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.titan-gallery__iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.titan-gallery__caption {
    z-index: 3;
    max-width: min(100%, 920px);
    margin: 10px auto 0;
    color: var(--tg-muted-color);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    pointer-events: auto;
    transition:
        opacity var(--tg-slide-duration) var(--tg-ease-out),
        transform var(--tg-slide-duration) var(--tg-ease-out),
        filter var(--tg-slide-duration) var(--tg-ease-out);
}

.titan-gallery__error {
    margin: 0;
    color: var(--tg-error-color);
    font-size: 16px;
}

.titan-gallery__thumbnail-dock {
    position: absolute;
    bottom: 16px;
    left: 50%;
    z-index: 9;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 32px);
    min-height: 62px;
    padding: 6px;
    background: var(--tg-panel);
    border: 1px solid var(--tg-border);
    border-radius: 16px;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.32);
    transform: translateX(-50%);
    backdrop-filter: blur(22px) saturate(145%);
    transition:
        left var(--tg-slide-duration) var(--tg-ease-out),
        transform var(--tg-slide-duration) var(--tg-ease-out);
    pointer-events: auto;
}

.titan-gallery__dialog.thumbnails-collapsed .titan-gallery__thumbnail-dock {
    left: 16px;
    transform: translateX(0);
}

.titan-gallery__dock-button {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 11px;
}

.titan-gallery__thumbnail-toggle::before {
    width: 21px;
    height: 16px;
    background:
        linear-gradient(currentColor 0 0) 0 0 / 6px 6px no-repeat,
        linear-gradient(currentColor 0 0) 100% 0 / 12px 6px no-repeat,
        linear-gradient(currentColor 0 0) 0 100% / 12px 6px no-repeat,
        linear-gradient(currentColor 0 0) 100% 100% / 6px 6px no-repeat;
    border-radius: 2px;
    content: '';
}

.titan-gallery__grid-toggle::before {
    width: 20px;
    height: 20px;
    background:
        linear-gradient(currentColor 0 0) 0 0 / 8px 8px no-repeat,
        linear-gradient(currentColor 0 0) 100% 0 / 8px 8px no-repeat,
        linear-gradient(currentColor 0 0) 0 100% / 8px 8px no-repeat,
        linear-gradient(currentColor 0 0) 100% 100% / 8px 8px no-repeat;
    border-radius: 2px;
    content: '';
}

.titan-gallery__dialog.is-grid-open .titan-gallery__grid-toggle {
    color: #111;
    background: #fff;
}

.titan-gallery__thumbnails {
    display: flex;
    gap: var(--tg-thumbnail-gap);
    justify-content: flex-start;
    width: max-content;
    max-width: min(68vw, 960px);
    overflow-x: auto;
    opacity: 1;
    scroll-behavior: smooth;
    scrollbar-width: none;
    transition:
        max-width var(--tg-slide-duration) var(--tg-ease-out),
        opacity var(--tg-transition-duration) ease;
    pointer-events: auto;
}

.titan-gallery__thumbnails::-webkit-scrollbar {
    display: none;
}

.titan-gallery__dialog.thumbnails-collapsed .titan-gallery__thumbnails {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
}

.titan-gallery__thumbnail {
    position: relative;
    flex: 0 0 var(--tg-thumbnail-width);
    width: var(--tg-thumbnail-width);
    height: var(--tg-thumbnail-height);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent !important;
    border-radius: var(--tg-radius);
    opacity: 0.52;
    transform: translateZ(0);
    transition:
        border-color var(--tg-transition-duration) ease,
        opacity var(--tg-transition-duration) ease,
        transform var(--tg-transition-duration) var(--tg-ease-out);
}

.titan-gallery__thumbnail:hover,
.titan-gallery__thumbnail.is-current {
    border-color: var(--tg-accent-color) !important;
    opacity: 1;
}

.titan-gallery__thumbnail:hover {
    transform: translateY(-2px);
}

.titan-gallery__thumbnail img,
.titan-gallery__grid-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.titan-gallery__thumbnail-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--tg-control-color);
    background: var(--tg-control-bg);
}

.titan-gallery__thumbnail.is-video::after,
.titan-gallery__grid-item.is-video::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid #fff;
    content: '';
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.75));
    transform: translate(-42%, -50%);
}

.titan-gallery__grid-panel {
    position: absolute;
    inset: 70px 72px 88px;
    z-index: 6;
    overflow: hidden;
    background: rgba(13, 14, 17, 0.88);
    border: 1px solid var(--tg-border);
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.44);
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.965);
    transition:
        opacity var(--tg-slide-duration) var(--tg-ease-out),
        transform var(--tg-slide-duration) var(--tg-ease-out);
    backdrop-filter: blur(28px) saturate(135%);
    pointer-events: none;
}

.titan-gallery__dialog.is-grid-open .titan-gallery__grid-panel {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    pointer-events: auto;
}

.titan-gallery__dialog.is-grid-open .titan-gallery__stage,
.titan-gallery__dialog.is-grid-open .titan-gallery__caption {
    opacity: 0.12;
    transform: scale(0.94);
    filter: blur(7px);
}

.titan-gallery__dialog.is-grid-open .titan-gallery__control {
    opacity: 0;
    pointer-events: none;
}

.titan-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    width: 100%;
    height: 100%;
    padding: 18px;
    overflow: auto;
    overscroll-behavior: contain;
}

.titan-gallery__grid-item {
    position: relative;
    aspect-ratio: 4 / 3;
    min-height: 0;
    overflow: hidden;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 2px solid transparent !important;
    border-radius: 10px;
    opacity: 0.72;
    transform: translateZ(0);
    transition:
        border-color var(--tg-transition-duration) ease,
        opacity var(--tg-transition-duration) ease,
        transform var(--tg-transition-duration) var(--tg-ease-out),
        box-shadow var(--tg-transition-duration) ease;
}

.titan-gallery__grid-item:hover {
    opacity: 1;
    transform: translateY(-3px) scale(1.015);
}

.titan-gallery__grid-item.is-current {
    border-color: #fff !important;
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

@keyframes titan-gallery-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 767px) {
    .titan-gallery {
        --tg-control-size: 40px;
        --tg-control-edge: 10px;
        --tg-content-max-height: calc(100vh - 172px);
        --tg-content-max-height: calc(100dvh - 172px);
        --tg-thumbnail-width: 62px;
        --tg-thumbnail-height: 48px;
        --tg-bottom-space: 86px;
    }

    .titan-gallery__dialog {
        padding: 62px 12px var(--tg-bottom-space);
    }

    .titan-gallery__dialog.thumbnails-collapsed {
        --tg-bottom-space: 68px;
    }

    .titan-gallery__toolbar-actions {
        gap: 5px;
    }

    .titan-gallery__zoom-reset {
        min-width: 45px;
    }

    .titan-gallery__zoom-button {
        width: 32px;
        height: 32px;
    }

    .titan-gallery__previous {
        left: 7px;
    }

    .titan-gallery__next {
        right: 7px;
    }

    .titan-gallery__caption {
        padding-right: 8px;
        padding-left: 8px;
        font-size: 13px;
    }

    .titan-gallery__thumbnail-dock {
        bottom: 10px;
        max-width: calc(100% - 20px);
        min-height: 58px;
        border-radius: 14px;
    }

    .titan-gallery__dialog.thumbnails-collapsed .titan-gallery__thumbnail-dock {
        left: 10px;
    }

    .titan-gallery__dock-button {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .titan-gallery__thumbnails {
        max-width: calc(100vw - 128px);
    }

    .titan-gallery__grid-panel {
        inset: 62px 10px 76px;
        border-radius: 14px;
    }

    .titan-gallery__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
        padding: 9px;
    }

    .titan-gallery__grid-item {
        border-radius: 7px;
    }
}

@media (max-width: 420px) {
    .titan-gallery__counter {
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .titan-gallery__zoom-reset {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .titan-gallery,
    .titan-gallery__dialog,
    .titan-gallery__slide,
    .titan-gallery__media,
    .titan-gallery__caption,
    .titan-gallery__close,
    .titan-gallery__control,
    .titan-gallery__zoom-button,
    .titan-gallery__zoom-reset,
    .titan-gallery__thumbnail-dock,
    .titan-gallery__dock-button,
    .titan-gallery__thumbnails,
    .titan-gallery__thumbnail,
    .titan-gallery__grid-panel,
    .titan-gallery__grid-item {
        scroll-behavior: auto;
        transition-duration: 0.01ms !important;
    }

    .titan-gallery__slide.is-loading::after {
        animation-duration: 1.4s;
    }
}
