/******************************************************
 * SINGLE IMMOBILE – GALLERY FOTO STILE IMMOBILIARE.IT
 * (hero 1+2 foto + fullscreen mosaico + fullscreen slideshow)
 ******************************************************/

/* --------------------------------------
   HERO 3 FOTO – MOBILE FIRST
-------------------------------------- */

.immobile-gallery-hero {
    display: flex;
    flex-direction: column;
    gap: 2px !important;
    margin-bottom: 24px;
    border-radius: 0;
    overflow: hidden;
}

/* Blocchi base */
.immobile-hero-main,
.immobile-hero-thumb {
    position: relative;
    overflow: hidden;
    background: #000;
    border-radius: 0;
    margin: 0;
    aspect-ratio: 16 / 9;
}

.immobile-hero-main {
    height: auto;
}

.immobile-hero-thumb {
    height: auto;
}

.immobile-hero-click {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

/* Overlay on hover */
.immobile-hero-click::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.25);
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}

.immobile-hero-click:hover::after {
    opacity: 1;
}

.immobile-hero-click img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}

.immobile-hero-click:hover img {
    transform: scale(1.015);
}

/* badge "+X foto" */
.immobile-hero-more {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1.2rem;
}

/* --------------------------------------
   DESKTOP HERO (stile immobiliare.it)
-------------------------------------- */



    .immobile-gallery-hero {
        display: grid;
        grid-template-columns: 2fr 1fr;
        grid-template-rows: repeat(2, 1fr);
        gap: 0;
        aspect-ratio: 8 / 3;
        border-radius: 14px;
        overflow: hidden;
    }

    .immobile-hero-main {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
        height: auto;
        aspect-ratio: auto;
    }

    .immobile-hero-thumb:nth-child(2),
    .immobile-hero-thumb:nth-child(3) {
        height: 100%;
        aspect-ratio: auto;
    }

    .immobile-hero-thumb:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }
    .immobile-hero-thumb:nth-child(3) {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }


/* --------------------------------------
   MOBILE: una sola foto
-------------------------------------- */



/* --------------------------------------
   FULLSCREEN BASE (planimetrie + legacy)
-------------------------------------- */

body.immobile-lightbox-open {
    overflow: hidden;
}

.immobile-fullscreen {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    display: none;
    flex-direction: column;
    background: #000;
    color: #fff;
    z-index: 9999;
    min-height: 0;
    overflow: hidden;
}

.immobile-fullscreen.is-open,
.immobile-fullscreen.is-visible {
    display: flex;
}

.immobile-fullscreen__topbar {
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    padding: 0 14px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.immobile-fullscreen__close {
    background: none;
    color: #fff;
    border: 0;
    padding: 6px;
    cursor: pointer;
}

/* --------------------------------------
   CRWS GALLERY VIEWER (foto annuncio)
-------------------------------------- */

.crws-gallery-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    flex-direction: column;
    background: #000;
    color: #f4f4f5;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.crws-gallery-viewer.is-open {
    display: flex;
}

.crws-gallery-viewer__shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.crws-gallery-viewer__toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 12px;
    border-bottom: 1px solid #27272a;
    background: #09090b;
}

.crws-gallery-viewer__modes {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.crws-gallery-viewer__mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 4px;
    padding: 4px 8px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    background: #18181b;
    color: #a1a1aa;
    transition: color 0.15s ease, background 0.15s ease;
}

.crws-gallery-viewer__mode:hover {
    color: #e4e4e7;
}

.crws-gallery-viewer__mode.is-active {
    background: #3f3f46;
    color: #f4f4f5;
}

.crws-gallery-viewer__mode-icon {
    font-size: 11px;
    line-height: 1;
}

.crws-gallery-viewer__mode-svg {
    display: block;
    flex-shrink: 0;
}

.crws-gallery-viewer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 4px;
    background: #18181b;
    color: #71717a;
    cursor: pointer;
    transition: color 0.15s ease;
}

.crws-gallery-viewer__close:hover {
    color: #d4d4d8;
}

.crws-gallery-viewer__slideshow {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.crws-gallery-viewer__slideshow[hidden],
.crws-gallery-viewer__mosaic[hidden] {
    display: none !important;
}

.crws-gallery-viewer__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    cursor: zoom-in;
}

.crws-gallery-viewer__stage.is-panning {
    cursor: grabbing;
}

.crws-gallery-viewer__stage.can-pan:not(.is-panning) {
    cursor: grab;
}

.crws-gallery-viewer__main-img {
    pointer-events: none;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform 0.15s ease-out;
}

.crws-gallery-viewer__stage.is-panning .crws-gallery-viewer__main-img {
    transition: none;
}

.crws-gallery-viewer__zoom {
    position: absolute;
    right: 16px;
    z-index: 20;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #52525b;
    border-radius: 6px;
    background: #18181b;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

.crws-gallery-viewer__slideshow.has-carousel .crws-gallery-viewer__zoom {
    bottom: 80px;
}

.crws-gallery-viewer__zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-bottom: 1px solid #52525b;
    background: transparent;
    color: #d4d4d8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.crws-gallery-viewer__zoom-btn:last-child {
    border-bottom: 0;
}

.crws-gallery-viewer__zoom-btn:hover:not(:disabled) {
    background: #27272a;
    color: #f4f4f5;
}

.crws-gallery-viewer__zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.crws-gallery-viewer__zoom-btn svg {
    display: block;
}

.crws-gallery-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #3f3f46;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #e4e4e7;
    cursor: pointer;
    padding: 0;
}

.crws-gallery-viewer__nav:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.7);
}

.crws-gallery-viewer__nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.crws-gallery-viewer__nav--prev {
    left: 12px;
}

.crws-gallery-viewer__nav--next {
    right: 12px;
}

.crws-gallery-viewer__carousel {
    flex-shrink: 0;
    height: 64px;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid #27272a;
    background: rgba(9, 9, 11, 0.9);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #3f3f46 #18181b;
}

.crws-gallery-viewer__carousel::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.crws-gallery-viewer__carousel::-webkit-scrollbar-track {
    background: #18181b;
}

.crws-gallery-viewer__carousel::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
}

.crws-gallery-viewer__carousel::-webkit-scrollbar-thumb:hover {
    background: #f59e0b;
}

.crws-gallery-viewer__carousel-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    min-width: 100%;
    padding: 0 8px;
}

.crws-gallery-viewer__thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 48px;
    padding: 0;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

.crws-gallery-viewer__thumb.is-active {
    border-color: #f59e0b;
}

.crws-gallery-viewer__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.crws-gallery-viewer__mosaic {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}

.crws-gallery-viewer__mosaic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

@media (min-width: 640px) {
    .crws-gallery-viewer__mosaic-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .crws-gallery-viewer__mosaic-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .crws-gallery-viewer__mosaic-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.crws-gallery-viewer__mosaic-item {
    position: relative;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: 1px solid #27272a;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.crws-gallery-viewer__mosaic-item:hover {
    border-color: #f59e0b;
}

.crws-gallery-viewer__mosaic-item.is-active {
    border-color: #f59e0b;
}

.crws-gallery-viewer__mosaic-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease-out;
}

.crws-gallery-viewer__mosaic-item:hover img {
    transform: scale(1.1);
}

