/* =========================================================
   TMS — Gallery Popup (about-us)
   Botón + modal con galería de fotos a color + lightbox
   ========================================================= */

:root {
    --tms-blue-dark: #002A42;
    --tms-blue: #024b75;
    --tms-blue-light: #3a90c2;
}

/* ---------- Trigger button ---------- */
.gallery-cta {
    padding: 55px 15px 60px;
    text-align: center;
}

.gallery-cta__label {
    display: block;
    font-size: 13px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--tms-blue-light);
    font-weight: 700;
    margin-bottom: 12px;
}

.gallery-cta__text {
    max-width: 620px;
    margin: 0 auto 26px;
    color: #6b7883;
    font-size: 16px;
    line-height: 1.6;
}

.btn-gallery {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 38px;
    border: 0;
    border-radius: 50px;
    background: linear-gradient(120deg, var(--tms-blue-dark) 0%, var(--tms-blue) 55%, var(--tms-blue-light) 100%);
    background-size: 180% 100%;
    background-position: 0% 0%;
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(0, 42, 66, .28);
    transition: background-position .5s ease, transform .3s ease, box-shadow .3s ease;
}

.btn-gallery:hover,
.btn-gallery:focus {
    background-position: 100% 0%;
    transform: translateY(-3px);
    box-shadow: 0 18px 34px rgba(0, 42, 66, .35);
    color: #fff !important;
    outline: none;
}

.btn-gallery:focus-visible {
    outline: 3px solid rgba(58, 144, 194, .55);
    outline-offset: 3px;
}

.btn-gallery i {
    font-size: 17px;
    transition: transform .35s ease;
}

.btn-gallery:hover i {
    transform: scale(1.15) rotate(-6deg);
}

.btn-gallery__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .18);
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0;
}

/* ---------- Modal shell ---------- */
.tms-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    background: rgba(0, 16, 26, .82);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .35s ease;
    overflow-y: auto;
    padding: 30px 15px;
}

.tms-gallery-modal.is-visible {
    display: block;
}

.tms-gallery-modal.is-open {
    opacity: 1;
}

body.tms-gallery-lock {
    overflow: hidden;
}

.tms-gallery__dialog {
    position: relative;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .45);
    transform: translateY(28px) scale(.98);
    opacity: 0;
    transition: transform .4s cubic-bezier(.2, .8, .3, 1), opacity .4s ease;
    overflow: hidden;
}

.tms-gallery-modal.is-open .tms-gallery__dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.tms-gallery__header {
    position: relative;
    padding: 34px 60px 26px 40px;
    background: linear-gradient(120deg, var(--tms-blue-dark) 0%, var(--tms-blue) 100%);
    color: #fff;
}

.tms-gallery__subtitle {
    display: block;
    font-size: 12px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #8ec6e8;
    font-weight: 700;
    margin-bottom: 8px;
}

.tms-gallery__title {
    margin: 0;
    font-size: 27px;
    line-height: 1.25;
    color: #fff;
    font-weight: 700;
}

.tms-gallery__desc {
    margin: 10px 0 0;
    max-width: 700px;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .78);
}

.tms-gallery__close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .25s ease, transform .25s ease;
}

.tms-gallery__close:hover {
    background: rgba(255, 255, 255, .3);
    transform: rotate(90deg);
}

/* ---------- Grid (masonry con columnas) ---------- */
.tms-gallery__body {
    padding: 32px 34px 40px;
}

.tms-gallery__grid {
    column-count: 3;
    column-gap: 18px;
}

.tms-gallery__item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #0b1c26;
    border-radius: 12px;
    overflow: hidden;
    cursor: zoom-in;
    margin: 0 0 18px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    box-shadow: 0 6px 18px rgba(0, 42, 66, .12);
    transition: transform .35s ease, box-shadow .35s ease;
    opacity: 0;
    transform: translateY(18px);
    animation: tmsFadeUp .5s forwards;
}

@keyframes tmsFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tms-gallery__item:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 34px rgba(0, 42, 66, .25);
}

.tms-gallery__item img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform .6s ease, opacity .4s ease;
}

.tms-gallery__item:hover img {
    transform: scale(1.06);
    opacity: .82;
}

.tms-gallery__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 40px 16px 14px;
    background: linear-gradient(to top, rgba(0, 42, 66, .92), rgba(0, 42, 66, 0));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    letter-spacing: .2px;
    transform: translateY(8px);
    opacity: 0;
    transition: transform .35s ease, opacity .35s ease;
}

.tms-gallery__item:hover .tms-gallery__caption,
.tms-gallery__item:focus-visible .tms-gallery__caption {
    transform: translateY(0);
    opacity: 1;
}

.tms-gallery__zoom {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: var(--tms-blue-dark);
    font-size: 14px;
    opacity: 0;
    transform: scale(.7);
    transition: opacity .3s ease, transform .3s ease;
}

.tms-gallery__item:hover .tms-gallery__zoom {
    opacity: 1;
    transform: scale(1);
}

/* ---------- Lightbox ---------- */
.tms-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10010;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 10, 16, .94);
    opacity: 0;
    transition: opacity .3s ease;
    padding: 60px 70px;
}

.tms-lightbox.is-visible {
    display: flex;
}

.tms-lightbox.is-open {
    opacity: 1;
}

.tms-lightbox__figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    text-align: center;
}

.tms-lightbox__img {
    max-width: 100%;
    max-height: 76vh;
    border-radius: 10px;
    box-shadow: 0 26px 60px rgba(0, 0, 0, .6);
    animation: tmsZoomIn .35s ease;
}

@keyframes tmsZoomIn {
    from {
        opacity: 0;
        transform: scale(.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tms-lightbox__caption {
    margin-top: 16px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.tms-lightbox__counter {
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, .55);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 1px;
}

.tms-lightbox__nav,
.tms-lightbox__close {
    position: absolute;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: background .25s ease, transform .25s ease;
}

.tms-lightbox__nav {
    top: 50%;
    width: 52px;
    height: 52px;
    margin-top: -26px;
    font-size: 20px;
}

.tms-lightbox__nav:hover,
.tms-lightbox__close:hover {
    background: var(--tms-blue-light);
}

.tms-lightbox__nav--prev {
    left: 22px;
}

.tms-lightbox__nav--next {
    right: 22px;
}

.tms-lightbox__close {
    top: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    font-size: 22px;
}

.tms-lightbox__close:hover {
    transform: rotate(90deg);
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .tms-gallery__grid {
        column-count: 2;
    }

    .tms-gallery__header {
        padding: 28px 58px 22px 26px;
    }

    .tms-gallery__title {
        font-size: 22px;
    }

    .tms-gallery__body {
        padding: 24px 22px 30px;
    }
}

@media (max-width: 575px) {
    .tms-gallery-modal {
        padding: 14px 10px;
    }

    .tms-gallery__grid {
        column-count: 1;
    }

    .tms-gallery__caption,
    .tms-gallery__zoom {
        opacity: 1;
        transform: none;
    }

    .tms-lightbox {
        padding: 70px 14px;
    }

    .tms-lightbox__nav {
        width: 44px;
        height: 44px;
        margin-top: -22px;
    }

    .tms-lightbox__nav--prev {
        left: 8px;
    }

    .tms-lightbox__nav--next {
        right: 8px;
    }

    .btn-gallery {
        padding: 14px 26px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .tms-gallery__item,
    .tms-gallery__item img,
    .tms-lightbox__img,
    .btn-gallery {
        animation: none !important;
        transition: none !important;
    }
}
