/**
 * Galería de fotos SmartTravelX.
 */

.stx-photo-gallery {
    --stx-gallery-accent: #e85d04;
    --stx-gallery-border: #e5e7eb;
    --stx-gallery-text: #1f2937;
    --stx-gallery-muted: #6b7280;
    --stx-gallery-radius: 10px;
    display: block;
    margin: 0 auto 2.5rem;
    color: var(--stx-gallery-text);
}

.stx-photo-gallery__header {
    margin-bottom: 1.5rem;
}

.stx-photo-gallery__title {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    line-height: 1.2;
}

.stx-photo-gallery__lead {
    margin: 0;
    color: var(--stx-gallery-muted);
}

/* Buscador */

.stx-photo-gallery__search {
    max-width: 32rem;
    margin-bottom: 1.5rem;
}

.stx-photo-gallery__search-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--stx-gallery-muted);
}

.stx-photo-gallery__search-input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--stx-gallery-border);
    border-radius: var(--stx-gallery-radius);
    background: #fff;
    color: inherit;
    font-size: 1rem;
    line-height: 1.4;
}

.stx-photo-gallery__search-input:focus {
    outline: 2px solid var(--stx-gallery-accent);
    outline-offset: 1px;
    border-color: var(--stx-gallery-accent);
}

/* Estados */

.stx-photo-gallery__status {
    margin: 0.75rem 0 0;
    color: var(--stx-gallery-muted);
    font-size: 0.925rem;
}

.stx-photo-gallery__status--error {
    color: #b91c1c;
}

.stx-photo-gallery__status[hidden],
.stx-photo-gallery__more[hidden],
.stx-photo-gallery__panel[hidden] {
    display: none;
}

.stx-photo-gallery__notice {
    padding: 1.5rem;
    border: 1px solid var(--stx-gallery-border);
    border-radius: var(--stx-gallery-radius);
    background: #f9fafb;
    text-align: center;
}

.stx-photo-gallery__notice-text {
    margin: 0 0 1rem;
}

.stx-photo-gallery__notice-text:only-child {
    margin-bottom: 0;
}

.stx-photo-gallery--empty p {
    margin: 0;
    padding: 1.5rem;
    border: 1px solid var(--stx-gallery-border);
    border-radius: var(--stx-gallery-radius);
    background: #f9fafb;
    color: var(--stx-gallery-muted);
    text-align: center;
}

/* Acordeón por servicio */

.stx-photo-gallery__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stx-photo-gallery__service {
    border: 1px solid var(--stx-gallery-border);
    border-radius: var(--stx-gallery-radius);
    background: #fff;
    overflow: hidden;
}

.stx-photo-gallery__service[hidden] {
    display: none;
}

.stx-photo-gallery__service-head {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    margin: 0;
    padding: 0 0.75rem 0 0;
    font-size: 1rem;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid transparent;
}

.stx-photo-gallery__service--open .stx-photo-gallery__service-head {
    border-bottom-color: var(--stx-gallery-border);
}

.stx-photo-gallery__toggle {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 3.25rem;
    margin: 0;
    padding: 0.75rem 1rem;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.stx-photo-gallery__toggle:hover .stx-photo-gallery__service-name,
.stx-photo-gallery__toggle:focus-visible .stx-photo-gallery__service-name {
    color: var(--stx-gallery-accent);
}

.stx-photo-gallery__service-name {
    flex: 1 1 auto;
    transition: color 0.2s ease;
}

.stx-photo-gallery__count {
    flex: 0 0 auto;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.stx-photo-gallery__chevron {
    flex: 0 0 auto;
    color: var(--stx-gallery-muted);
    transition: transform 0.2s ease;
}

.stx-photo-gallery__toggle[aria-expanded='true'] .stx-photo-gallery__chevron {
    transform: rotate(180deg);
}

.stx-photo-gallery__zip {
    display: inline-flex;
    flex: 0 0 auto;
    align-self: center;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--stx-gallery-border);
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.stx-photo-gallery__zip:hover,
.stx-photo-gallery__zip:focus {
    color: var(--stx-gallery-accent);
    border-color: var(--stx-gallery-accent);
    text-decoration: none;
}

.stx-photo-gallery__panel {
    padding: 1.25rem 1rem;
}

/* Rejilla de miniaturas */

.stx-photo-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.85rem;
}

.stx-photo-gallery__grid:empty {
    display: none;
}

.stx-photo-gallery__thumb {
    position: relative;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f3f4f6;
    aspect-ratio: 27 / 16;
    overflow: hidden;
    cursor: pointer;
}

.stx-photo-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.stx-photo-gallery__thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgb(232 93 4 / 0.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='34' height='34' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16.5 16.5L21 21M11 8v6M8 11h6'/%3E%3C/svg%3E") no-repeat center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stx-photo-gallery__thumb:hover img,
.stx-photo-gallery__thumb:focus-visible img {
    transform: scale(1.08);
}

.stx-photo-gallery__thumb:hover::after,
.stx-photo-gallery__thumb:focus-visible::after {
    opacity: 1;
}

.stx-photo-gallery__more {
    margin-top: 1.25rem;
    text-align: center;
}

.stx-photo-gallery__more-button {
    min-width: 12rem;
    padding: 0.65rem 1.25rem;
    border: 1px solid var(--stx-gallery-border);
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.stx-photo-gallery__more-button:hover:not(:disabled),
.stx-photo-gallery__more-button:focus-visible:not(:disabled) {
    color: var(--stx-gallery-accent);
    border-color: var(--stx-gallery-accent);
}

.stx-photo-gallery__more-button:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Paginación de servicios */

.stx-photo-gallery__pagination {
    margin-top: 1.75rem;
}

.stx-photo-gallery__pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.stx-photo-gallery__pagination li {
    margin: 0;
    list-style: none;
}

.stx-photo-gallery__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.6rem;
    border: 1px solid var(--stx-gallery-border);
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.9rem;
    text-decoration: none;
}

.stx-photo-gallery__pagination .page-numbers:hover,
.stx-photo-gallery__pagination .page-numbers:focus {
    color: var(--stx-gallery-accent);
    border-color: var(--stx-gallery-accent);
    text-decoration: none;
}

.stx-photo-gallery__pagination .page-numbers.current {
    background: var(--stx-gallery-accent);
    border-color: var(--stx-gallery-accent);
    color: #fff;
    font-weight: 700;
}

/* Visor de fotos */

.stx-gallery-viewer {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgb(15 23 42 / 0.9);
}

.stx-gallery-viewer[hidden] {
    display: none;
}

.stx-gallery-viewer__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 68rem;
    max-height: 100%;
}

.stx-gallery-viewer__stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.stx-gallery-viewer__image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 11rem);
    margin: 0 auto;
    border-radius: 8px;
    background: rgb(255 255 255 / 0.06);
    object-fit: contain;
}

.stx-gallery-viewer__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #fff;
}

.stx-gallery-viewer__caption {
    flex: 1 1 14rem;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.stx-gallery-viewer__counter {
    display: block;
    color: rgb(255 255 255 / 0.7);
    font-size: 0.8rem;
}

.stx-gallery-viewer__download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    background: var(--stx-gallery-accent, #e85d04);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.stx-gallery-viewer__download:hover,
.stx-gallery-viewer__download:focus {
    color: #fff;
    text-decoration: none;
    filter: brightness(1.08);
}

.stx-gallery-viewer__close,
.stx-gallery-viewer__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 0.14);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.stx-gallery-viewer__close:hover,
.stx-gallery-viewer__close:focus-visible,
.stx-gallery-viewer__nav:hover,
.stx-gallery-viewer__nav:focus-visible {
    background: rgb(255 255 255 / 0.3);
}

.stx-gallery-viewer__close {
    position: absolute;
    top: -3.35rem;
    right: 0;
}

.stx-gallery-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.stx-gallery-viewer__nav[hidden] {
    display: none;
}

.stx-gallery-viewer__nav--prev {
    left: 0.5rem;
}

.stx-gallery-viewer__nav--next {
    right: 0.5rem;
}

.stx-gallery-viewer-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .stx-photo-gallery__service-head {
        flex-wrap: wrap;
        padding: 0 0.75rem 0.75rem;
    }

    .stx-photo-gallery__toggle {
        flex-basis: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .stx-photo-gallery__grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .stx-gallery-viewer {
        padding: 3.5rem 0.75rem 1rem;
    }

    .stx-gallery-viewer__close {
        top: -3rem;
        right: -0.25rem;
    }

    .stx-gallery-viewer__image {
        max-height: calc(100vh - 14rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .stx-photo-gallery__thumb img,
    .stx-photo-gallery__thumb::after,
    .stx-photo-gallery__chevron {
        transition: none;
    }

    .stx-photo-gallery__thumb:hover img,
    .stx-photo-gallery__thumb:focus-visible img {
        transform: none;
    }
}
