/* REMER - Galleria mosaico editoriale (solo #remer-project-gallery)
   Griglia senza buchi, bilanciata per 1-7 contenuti. */
#remer-project-gallery.rg-gallery {
    --rg-gap: 16px;
    --rg-row-size: clamp(53px, 4.7vw, 74px);
    --rg-rows: 10;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(var(--rg-rows), var(--rg-row-size));
    gap: var(--rg-gap);
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}
#remer-project-gallery.rg-gallery * { box-sizing: border-box; }
#remer-project-gallery.rg-gallery[data-count="0"] { display: none; }
#remer-project-gallery.rg-gallery[data-count="1"] {
    --rg-rows: 7;
    grid-template-columns: minmax(0, 1fr);
    max-width: 1100px;
}
#remer-project-gallery.rg-gallery[data-count="2"] {
    --rg-rows: 9;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
#remer-project-gallery.rg-gallery[data-count="3"] { --rg-rows: 9; }
#remer-project-gallery.rg-gallery[data-count="7"] { --rg-rows: 12; }

#remer-project-gallery .rg-card {
    grid-column: var(--rg-column);
    grid-row: var(--rg-row) / span var(--rg-span);
    position: relative;
    display: block;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    isolation: isolate;
    border-radius: 10px;
    background: #20262a;
    color: #fff !important;
    text-decoration: none !important;
}
#remer-project-gallery .rg-card img,
#remer-project-gallery .rg-card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform .75s cubic-bezier(.2,.7,.2,1);
}
#remer-project-gallery .rg-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,.7) 100%);
}
#remer-project-gallery .rg-card:hover img,
#remer-project-gallery .rg-card:hover video,
#remer-project-gallery .rg-card:focus-visible img,
#remer-project-gallery .rg-card:focus-visible video { transform: scale(1.045); }
#remer-project-gallery .rg-card-content {
    position: absolute;
    z-index: 2;
    left: 18px;
    right: 18px;
    bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    text-align: center;
}
#remer-project-gallery .rg-card-title {
    font-size: clamp(17px,1.4vw,24px);
    line-height: 1.25;
    font-weight: 600;
    text-shadow: 0 2px 6px #0007;
}
#remer-project-gallery .rg-card-subtitle {
    font-size: 14px;
    line-height: 1.4;
    text-shadow: 0 2px 6px #0007;
}
#remer-project-gallery .rg-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin-top: 7px;
    padding: 9px 22px;
    border: 1px solid #ffffff70;
    border-radius: 40px;
    background: #ffffff24;
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 13px;
    transition: background .25s;
}
#remer-project-gallery .rg-card:hover .rg-card-button { background: #ffffff50; }
#remer-project-gallery .rg-card:focus-visible { outline: 3px solid #106dd0; outline-offset: 3px; }

/* Tablet: due colonne, dimensioni bilanciate; niente posizioni desktop fisse */
@media (max-width: 900px) {
    #remer-project-gallery.rg-gallery,
    #remer-project-gallery.rg-gallery[data-count="1"],
    #remer-project-gallery.rg-gallery[data-count="2"] {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-auto-rows: 260px;
        grid-auto-flow: row;
        padding: 0 16px;
        max-width: none;
    }
    #remer-project-gallery .rg-card { grid-column: auto; grid-row: auto; }
    #remer-project-gallery.rg-gallery[data-count="1"] { grid-template-columns: minmax(0,1fr); }
    #remer-project-gallery.rg-gallery[data-count="1"] .rg-card { min-height: 380px; }
}

/* Smartphone: una colonna, foto compatte e nessuno spazio vuoto */
@media (max-width: 600px) {
    #remer-project-gallery.rg-gallery,
    #remer-project-gallery.rg-gallery[data-count="1"],
    #remer-project-gallery.rg-gallery[data-count="2"] {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 0 14px;
    }
    #remer-project-gallery .rg-card {
        height: 420px;
        min-height: 0;
        flex: none;
        border-radius: 10px;
    }
    #remer-project-gallery .rg-card-title { font-size: 21px; }
    #remer-project-gallery .rg-card-content { bottom: 23px; }
}
@media (prefers-reduced-motion: reduce) {
    #remer-project-gallery .rg-card img,
    #remer-project-gallery .rg-card video { transition: none; }
}

/* REMER - Margini SOLO slider verticale esistente, lasciati invariati */
#remer-location-slider {
    width: calc(100% - 60px) !important;
    max-width: 1900px;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}
@media (max-width: 991px) {
    #remer-location-slider { width: calc(100% - 40px) !important; }
}
@media (max-width: 575px) {
    #remer-location-slider { width: calc(100% - 30px) !important; }
}




/* ==========================================
   REMER - MOSAICO EDITORIALE DEFINITIVO
   7 immagini - proporzioni del riferimento
   ========================================== */

@media (min-width: 901px) {

    #remer-project-gallery.rg-gallery[data-count="7"] {
        display: grid !important;

        grid-template-columns:
            repeat(3, minmax(0, 1fr)) !important;

        grid-template-rows:
            repeat(16, minmax(0, 1fr)) !important;

        /* Altezza proporzionata alla larghezza */
        height: clamp(760px, 88vw, 1450px) !important;

        gap: 10px !important;
        align-items: stretch;
    }

    /* SINISTRA */

    /* Ottagono - orizzontale alto */
    #remer-project-gallery[data-count="7"]
    .rg-card:nth-child(1) {
        grid-column: 1 !important;
        grid-row: 1 / 7 !important;
    }

    /* Academy - quasi quadrata */
    #remer-project-gallery[data-count="7"]
    .rg-card:nth-child(4) {
        grid-column: 1 !important;
        grid-row: 7 / 13 !important;
    }

    /* Element - orizzontale basso */
    #remer-project-gallery[data-count="7"]
    .rg-card:nth-child(7) {
        grid-column: 1 !important;
        grid-row: 13 / 17 !important;
    }

    /* CENTRO */

    /* Atelier */
    #remer-project-gallery[data-count="7"]
    .rg-card:nth-child(2) {
        grid-column: 2 !important;
        grid-row: 1 / 6 !important;
    }

    /* Chrono - verticale molto alta */
    #remer-project-gallery[data-count="7"]
    .rg-card:nth-child(5) {
        grid-column: 2 !important;
        grid-row: 6 / 17 !important;
    }

    /* DESTRA */

    /* Celebrity - verticale molto alta */
    #remer-project-gallery[data-count="7"]
    .rg-card:nth-child(3) {
        grid-column: 3 !important;
        grid-row: 1 / 12 !important;
    }

    /* X-Style - orizzontale */
    #remer-project-gallery[data-count="7"]
    .rg-card:nth-child(6) {
        grid-column: 3 !important;
        grid-row: 12 / 17 !important;
    }

    /* Tutte le immagini riempiono il riquadro */
    #remer-project-gallery .rg-card img,
    #remer-project-gallery .rg-card video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}
