/**
 * Galería carrusel del detalle — imagen principal a pantalla completa (object-fit: cover)
 */

.apis-detail-gallery-carousel
{
    --apis-gallery-stage-height: min(62vh, 560px);
    --apis-gallery-stage-bg: #e2e8f0;
    --apis-gallery-thumb-size: 72px;
    background: #fff;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 32px;
    border-radius: 12px;
    overflow: hidden;
}

.apis-detail-gallery-carousel__stage
{
    position: relative;
    background: var(--apis-gallery-stage-bg);
    min-height: var(--apis-gallery-stage-height);
    height: var(--apis-gallery-stage-height);
}

.apis-detail-gallery-carousel__viewport
{
    width: 100%;
    height: 100%;
    overflow: hidden;
    outline: none;
}

.apis-detail-gallery-carousel__viewport:focus-visible
{
    box-shadow: inset 0 0 0 3px rgba(15, 118, 110, 0.55);
}

.apis-detail-gallery-carousel__track
{
    display: flex;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.apis-detail-gallery-slide
{
    flex: 0 0 100%;
    min-width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.apis-detail-gallery-slide__trigger
{
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: var(--apis-gallery-stage-bg);
    cursor: zoom-in;
    overflow: hidden;
}

.apis-detail-gallery-slide__img
{
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.apis-detail-gallery-slide__trigger:hover .apis-detail-gallery-slide__img
{
    transform: scale(1.03);
}

.apis-detail-gallery-nav
{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    font-size: 21.6px;
    line-height: 1;
}

.apis-detail-gallery-nav:hover
{
    background: #fff;
    transform: translateY(-50%) scale(1.04);
}

.apis-detail-gallery-nav--prev
{
    left: 14px;
}

.apis-detail-gallery-nav--next
{
    right: 14px;
}

.apis-detail-gallery-carousel__chrome
{
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.apis-detail-gallery-counter
{
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 13.6px;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(6px);
}

.apis-detail-gallery-fullscreen
{
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 16.8px;
}

.apis-detail-gallery-fullscreen:hover
{
    background: rgba(15, 23, 42, 0.9);
    transform: scale(1.05);
}

.apis-detail-gallery-thumbs,
.apis-detail-gallery-index
{
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.apis-detail-gallery-index__head
{
    display: flex;
    align-items: center;
    gap: 10px;
}

.apis-detail-gallery-index__title
{
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}

.apis-detail-gallery-index__range
{
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.02em;
}

.apis-detail-gallery-index__pager
{
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.apis-detail-gallery-index__page
{
    width: 30px;
    height: 30px;
    border: 1px solid #dbe3ee;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
}

.apis-detail-gallery-index__page:hover:not(:disabled)
{
    border-color: #94a3b8;
}

.apis-detail-gallery-index__page:disabled
{
    opacity: 0.35;
    cursor: default;
}

.apis-detail-gallery-index.is-single-page .apis-detail-gallery-index__pager
{
    display: none;
}

.apis-detail-gallery-index__list
{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 8px;
}

.apis-detail-gallery-thumb,
.apis-detail-gallery-index__item
{
    position: relative;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 56px;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #e2e8f0;
}

.apis-detail-gallery-thumb img
{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(0.75) brightness(0.88);
    transition: filter 0.2s ease;
}

.apis-detail-gallery-index__num
{
    position: absolute;
    left: 7px;
    bottom: 5px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    text-shadow: 0 1px 4px rgba(15, 23, 42, 0.65);
    line-height: 1;
}

.apis-detail-gallery-thumb:hover img,
.apis-detail-gallery-thumb.is-active img
{
    filter: none;
}

.apis-detail-gallery-thumb.is-active
{
    box-shadow: 0 0 0 2px #2563eb;
}

.apis-property-detail-showcase .apis-detail-gallery-carousel
{
    border-radius: 0;
    margin-bottom: 24px;
    --apis-gallery-stage-bg: #cbd5e1;
}

/* Visor a pantalla completa (sin Lightbox2 ni descargas) */
.apis-property-lightbox
{
    position: fixed;
    inset: 0;
    z-index: 100050;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: clamp(16px, 3vw, 32px);
    box-sizing: border-box;
    background: rgba(10, 12, 16, 0.96);
    backdrop-filter: none;
}

.apis-property-lightbox[hidden]
{
    display: none !important;
}

body.apis-property-lightbox-open
{
    overflow: hidden;
}

.apis-property-lightbox__stage
{
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: min(96vw, 1280px);
}

.apis-property-lightbox--has-index .apis-property-lightbox__stage
{
    max-width: min(72vw, 1120px);
}

.apis-property-lightbox__content
{
    position: relative;
    width: 100%;
    max-height: min(92vh, 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 56px;
    box-sizing: border-box;
}

.apis-property-lightbox__img
{
    display: block;
    max-width: 100%;
    max-height: min(86vh, calc(100dvh - 96px));
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center center;
    border-radius: 4px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    background: #0a0a0a;
}

/* Modo natural: nunca recortar; respetar proporción original */
.apis-property-lightbox--natural .apis-property-lightbox__img
{
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: min(86vh, calc(100dvh - 96px)) !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
}

/* Modo cuadrado (opcional): recorte centrado 1:1 */
.apis-property-lightbox--square .apis-property-lightbox__img
{
    width: min(88vw, 78vh) !important;
    height: min(88vw, 78vh) !important;
    max-width: min(88vw, 78vh) !important;
    max-height: min(88vw, 78vh) !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    object-position: center !important;
}

.apis-property-lightbox__counter
{
    position: absolute;
    bottom: -36px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.92);
    font-size: 14.4px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.apis-property-lightbox__close,
.apis-property-lightbox__nav
{
    position: absolute;
    z-index: 2;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 21.6px;
    line-height: 1;
}

.apis-property-lightbox__close:hover,
.apis-property-lightbox__nav:hover
{
    background: rgba(255, 255, 255, 0.28);
}

.apis-property-lightbox__close
{
    top: 18px;
    left: 18px;
    right: auto;
    width: 44px;
    height: 44px;
}

.apis-property-lightbox__nav
{
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
}

.apis-property-lightbox__nav--prev
{
    left: 4px;
}

.apis-property-lightbox__nav--next
{
    right: 4px;
}

/* Índice paginado del visor (números, no tira de miniaturas) */
.apis-property-lightbox__index
{
    flex: 0 0 196px;
    width: 196px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 14px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    box-sizing: border-box;
    max-height: min(82vh, 680px);
}

.apis-property-lightbox__index-head
{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.apis-property-lightbox__index-title
{
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.48);
}

.apis-property-lightbox__index-count
{
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}

.apis-property-lightbox__index-list
{
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.apis-property-lightbox__index-item
{
    display: grid;
    grid-template-columns: 36px 1fr;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 6px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.42);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, color 0.2s ease;
}

.apis-property-lightbox__index-item[hidden]
{
    display: none !important;
}

.apis-property-lightbox__index-item:hover
{
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
}

.apis-property-lightbox__index-item.is-active
{
    background: rgba(96, 165, 250, 0.16);
    color: #fff;
}

.apis-property-lightbox__index-num
{
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.apis-property-lightbox__index-preview
{
    display: block;
    width: 100%;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

.apis-property-lightbox__index-item.is-active .apis-property-lightbox__index-preview,
.apis-property-lightbox__index-item:hover .apis-property-lightbox__index-preview
{
    opacity: 1;
}

.apis-property-lightbox__index-preview img
{
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apis-property-lightbox__index-pager
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.apis-property-lightbox__index-page
{
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
}

.apis-property-lightbox__index-page:hover:not(:disabled)
{
    background: rgba(255, 255, 255, 0.22);
}

.apis-property-lightbox__index-page:disabled
{
    opacity: 0.28;
    cursor: default;
}

.apis-property-lightbox__index-range
{
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.04em;
}

.apis-property-lightbox__index.is-single-page .apis-property-lightbox__index-pager
{
    display: none;
}

@media (max-width: 768px)
{
    .apis-detail-gallery-carousel
    {
        --apis-gallery-stage-height: min(48vh, 400px);
        --apis-gallery-thumb-size: 60px;
        border-radius: 0;
    }

    .apis-detail-gallery-nav
    {
        width: 40px;
        height: 40px;
    }

    .apis-detail-gallery-nav--prev
    {
        left: 8px;
    }

    .apis-detail-gallery-nav--next
    {
        right: 8px;
    }

    .apis-detail-gallery-carousel__chrome
    {
        right: 8px;
        bottom: 8px;
    }

    .apis-detail-gallery-index
    {
        padding: 10px 12px 12px;
    }

    .apis-detail-gallery-index__list
    {
        grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
        gap: 6px;
    }

    .apis-detail-gallery-thumb,
    .apis-detail-gallery-index__item
    {
        min-height: 48px;
    }

    .apis-property-lightbox
    {
        flex-direction: column;
        justify-content: flex-end;
        gap: 10px;
        padding: 52px 8px 12px;
    }

    .apis-property-lightbox--has-index .apis-property-lightbox__stage,
    .apis-property-lightbox__stage
    {
        max-width: 100%;
        flex: 1 1 auto;
        width: 100%;
    }

    .apis-property-lightbox__content
    {
        padding: 0 44px;
        width: 100%;
        max-width: 100vw;
    }

    .apis-property-lightbox__img,
    .apis-property-lightbox--natural .apis-property-lightbox__img
    {
        max-height: min(62vh, calc(100dvh - 220px)) !important;
    }

    .apis-property-lightbox__nav--prev
    {
        left: 2px;
    }

    .apis-property-lightbox__nav--next
    {
        right: 2px;
    }

    .apis-property-lightbox__close
    {
        top: 10px;
        left: auto;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .apis-property-lightbox__counter
    {
        bottom: -28px;
        font-size: 12.8px;
    }

    .apis-property-lightbox__index
    {
        flex: 0 0 auto;
        width: 100%;
        max-height: none;
        padding: 10px 10px 8px;
        border-radius: 14px;
    }

    .apis-property-lightbox__index-head
    {
        padding-bottom: 8px;
    }

    .apis-property-lightbox__index-list
    {
        flex-direction: row;
        justify-content: center;
        gap: 6px;
    }

    .apis-property-lightbox__index-item
    {
        grid-template-columns: 1fr;
        justify-items: center;
        width: 48px;
        min-height: 0;
        padding: 6px 4px;
        gap: 4px;
    }

    .apis-property-lightbox__index-item:not(.is-active) .apis-property-lightbox__index-preview
    {
        display: none;
    }

    .apis-property-lightbox__index-item.is-active
    {
        width: 72px;
    }

    .apis-property-lightbox__index-num
    {
        font-size: 13px;
    }

    .apis-property-lightbox__index-preview
    {
        height: 28px;
    }

    .apis-property-lightbox__index-pager
    {
        padding-top: 4px;
    }
}
